logo       

roller/src/org/roller/presentation RollerRequest.java,1.35,1.36: msg#00277

Subject: roller/src/org/roller/presentation RollerRequest.java,1.35,1.36
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


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
web.pylons.gene...    hurd.l4/2002-10...    kernel.commits....    user-groups.lin...    yellowdog.gener...    java.drools.use...    security.openva...    package-managem...    linux.debian.us...    qnx.openqnx.dev...    genealogy.gramp...    file-systems.if...    voip.wengophone...    tex.context/200...    ietf.smime/2003...    audio.csound.de...    culture.region....    xfree86.devel/2...    mobile.kannel.u...    distributed.con...    education.engli...    org.user-groups...    bug-tracking.gn...    recreation.bicy...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe