roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agillil...@apache.org
Subject svn commit: r516159 - in /incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering: model/PageModel.java pagers/AbstractPager.java util/PlanetGroupPageRequest.java
Date Thu, 08 Mar 2007 19:49:47 GMT
Author: agilliland
Date: Thu Mar  8 11:49:46 2007
New Revision: 516159

URL: http://svn.apache.org/viewvc?view=rev&rev=516159
Log:
support paging for the planet page view.


Modified:
    incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/model/PageModel.java
    incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/pagers/AbstractPager.java
    incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/util/PlanetGroupPageRequest.java

Modified: incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/model/PageModel.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/model/PageModel.java?view=diff&rev=516159&r1=516158&r2=516159
==============================================================================
--- incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/model/PageModel.java
(original)
+++ incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/model/PageModel.java
Thu Mar  8 11:49:46 2007
@@ -91,8 +91,8 @@
                 pageRequest.getGroup(),
                 pagerUrl,
                 0,
-                0,
-                30);
+                pageRequest.getPageNum(),
+                getGroup().getMaxPageEntries());
     }
     
 }

Modified: incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/pagers/AbstractPager.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/pagers/AbstractPager.java?view=diff&rev=516159&r1=516158&r2=516159
==============================================================================
--- incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/pagers/AbstractPager.java
(original)
+++ incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/pagers/AbstractPager.java
Thu Mar  8 11:49:46 2007
@@ -71,10 +71,12 @@
     
     
     public String getPrevLink() {
-        if (page > 0) {
+        if (page > 1) {
             int prevPage = page - 1;
             Map params = new HashMap();
             params.put("page", ""+prevPage);
+            return createURL(url, params);
+        } else if (page == 1) {
             return createURL(url, params);
         }
         return null;

Modified: incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/util/PlanetGroupPageRequest.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/util/PlanetGroupPageRequest.java?view=diff&rev=516159&r1=516158&r2=516159
==============================================================================
--- incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/util/PlanetGroupPageRequest.java
(original)
+++ incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/util/PlanetGroupPageRequest.java
Thu Mar  8 11:49:46 2007
@@ -21,8 +21,6 @@
 import javax.servlet.http.HttpServletRequest;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.roller.planet.ui.rendering.util.InvalidRequestException;
-import org.apache.roller.planet.ui.rendering.util.PlanetRequest;
 
 
 /**
@@ -38,6 +36,7 @@
     private static Log log = LogFactory.getLog(PlanetGroupPageRequest.class);
     
     // lightweight attributes
+    private int pageNum = 0;
     
     
     public PlanetGroupPageRequest() {}
@@ -63,6 +62,24 @@
             throw new InvalidRequestException("not a valid planet group page, "+
                     request.getRequestURL());
         }
+        
+        // parse request parameters, right now we only allow for a "page" param
+        if(request.getParameter("page") != null) {
+            String pageInt = request.getParameter("page");
+            try {
+                this.pageNum = Integer.parseInt(pageInt);
+            } catch(NumberFormatException e) {
+                // ignored, bad input
+            }
+        }
+    }
+
+    public int getPageNum() {
+        return pageNum;
+    }
+
+    public void setPageNum(int pageNum) {
+        this.pageNum = pageNum;
     }
     
 }



Mime
View raw message