Update of /cvsroot/roller/roller/src/org/roller/presentation
In directory sc8-pr-cvs1:/tmp/cvs-serv15759/src/org/roller/presentation
Modified Files:
RollerRequest.java
Log Message:
More work on velocimacros.
Index: RollerRequest.java
===================================================================
RCS file:
/cvsroot/roller/roller/src/org/roller/presentation/RollerRequest.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** RollerRequest.java 26 Jan 2003 16:05:56 -0000 1.35
--- RollerRequest.java 29 Jan 2003 22:31:25 -0000 1.36
***************
*** 8,12 ****
import java.util.Calendar;
import java.util.Date;
- import java.util.Hashtable;
import java.util.List;
import java.util.StringTokenizer;
--- 8,11 ----
***************
*** 17,24 ****
import javax.servlet.jsp.PageContext;
- import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
- import org.apache.struts.util.RequestUtils;
import org.roller.RollerException;
import org.roller.model.BookmarkData;
--- 16,21 ----
***************
*** 512,518 ****
catch (RollerException e)
{
! mLogger.error("Getting weblog category from request",e);
}
}
}
return mWeblogCategory;
--- 509,528 ----
catch (RollerException e)
{
! mLogger.error("Getting weblog category by id from
request",e);
}
}
+ else if ((id = getFromRequest(WEBLOGCATEGORYNAME_KEY)) != null)
+ {
+ try
+ {
+ mWeblogCategory =
+
getRoller().getWeblogManager().getWeblogCategory(id,
+ getUser().getUserName());
+ }
+ catch (RollerException e)
+ {
+ mLogger.error("Getting weblog category
by name from request",e);
+ }
+ }
}
return mWeblogCategory;
***************
*** 723,728 ****
String name = getUser().getUserName();
String dayParam = getDateString(true);
! String catParam= getWeblogCategory()==null
! ? null : getWeblogCategory().getName();
WeblogManager mgr = getRoller().getWeblogManager();
return mgr.getRecentWeblogEntries(
--- 733,741 ----
String name = getUser().getUserName();
String dayParam = getDateString(true);
! String catParam = null;
! if (this.getWeblogCategory() != null)
! {
! catParam = getWeblogCategory().getName();
! }
WeblogManager mgr = getRoller().getWeblogManager();
return mgr.getRecentWeblogEntries(
***************
*** 773,894 ****
return ret;
}
-
- //-------------------------------------------------------------------
- /**
- * *******************************************************
- * The following are hackish methods written solely to
- * support the idiosyncracies and failings of Velocity.
- * *******************************************************
- **/
-
- /** Build the URL for editing an WeblogEntry **/
- public String getEntryEditUrl(WeblogEntryData entry)
- {
- Hashtable params = new Hashtable();
- params.put( RollerRequest.WEBLOGENTRYID_KEY, entry.getId());
- params.put( RollerRequest.USERNAME_KEY,
getUser().getUserName());
- params.put( RollerRequest.ANCHOR_KEY, entry.getAnchor());
- try
- {
- return RequestUtils.computeURL( mPageContext,
- "editWeblog", null, null, params, null, false);
- }
- catch (MalformedURLException mue)
- {
- mLogger.warn("RollerRequest.editEntryUrl exception: ",
mue);
- }
- return mRequest.getContextPath() + "weblog.do?method=edit";
- }
-
- /**
- * Another stupid helper method to make up for the shortcomings of
Velocity.
- * @return HashMap
- */
- public Hashtable addParam(String key, String value, Hashtable map)
- {
- if (map == null) map = new Hashtable();
- if (key != null && value != null)
- map.put(key, value);
- return map;
- }
-
- /**
- * Convenience method, contrived helper for Velocity.
- * @param useIds
- * @param isAction
- * @param path
- * @param val1
- * @param val2
- * @return String
- */
- public String strutsUrlHelper( boolean useIds, boolean isAction,
- String path, String val1, String val2)
- {
- Hashtable params = new Hashtable();
- return strutsUrlHelper( useIds, isAction, path, val1, val2,
params);
- }
-
- /**
- * Very contrived helper method for Velocimacros generating Struts links.
- * This is really only of use to the showNavBar macro.
- * @param useIds
- * @param isAction
- * @param path
- * @param val1
- * @param val2
- * @return String
- */
- public String strutsUrlHelper( boolean useIds, boolean isAction,
- String path, String val1, String val2, Hashtable params)
- {
- if (useIds)
- {
- if (this.getFolder() != null)
- {
- params.put(RollerRequest.FOLDERID_KEY,
- this.getFolder().getId());
- }
- if (this.getUser() != null)
- {
- params.put(RollerRequest.USERNAME_KEY,
- this.getUser().getUserName());
- }
- }
-
- if (StringUtils.isNotEmpty(val1) && !val1.equals("null"))
- {
- params.clear();
- params.put("rmk", val1);
- params.put("rmik", val2);
- }
-
- String returnUrl = "";
- try
- {
- if (isAction)
- {
- returnUrl = RequestUtils.computeURL(
mPageContext,
- path, null,
null, params, null, false);
- }
- else
- {
- returnUrl = RequestUtils.computeURL(
mPageContext,
- null, path,
null, params, null, false);
- }
- }
- catch (MalformedURLException mue)
- {
- mLogger.warn("RollerRequest.strutsUrlHelper exception:
", mue);
- returnUrl = "<span class=\"error\">ERROR generating
link</span>";
- }
- return returnUrl;
- }
-
- /**
- * *******************************************************
- * The end of the hackish methods written solely to support the
- * idiosyncracies and failings of Velocity.
- * ******************************************************* */
-
//------------------------------------------------------------------------
--- 786,789 ----
-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
|