[Zope3-checkins] CVS: Products3/z3checkins - container.pt:1.8

Marius Gedminas mgedmin@codeworks.lt
Thu, 5 Jun 2003 08:21:11 -0400


Update of /cvs-repository/Products3/z3checkins
In directory cvs.zope.org:/tmp/cvs-serv17971

Modified Files:
	container.pt 
Log Message:
Allow batch sizes other than 20 (if the user is clever enough to figure out
that she needs to add &size=x at the end of the URL).


=== Products3/z3checkins/container.pt 1.7 => 1.8 ===
--- Products3/z3checkins/container.pt:1.7	Fri Apr 18 04:30:35 2003
+++ Products3/z3checkins/container.pt	Thu Jun  5 08:21:10 2003
@@ -21,11 +21,14 @@
 </head>
 <body tal:define="sidebar usage/sidebar;
                   target python: sidebar and '_content' or None;
-                  dummy view/placeBookmark">
+                  dummy view/placeBookmark;
+                  start python:int(request.get('start', '0'));
+                  size python:int(request.get('size', '20'));
+                  opt_size python:(size != 20) and '&amp;size=%d' % size or ''">
 <h1>Zope 3 Checkins</h1>
 
 <div class="toolbar"
-     tal:define="first_batch python:int(request.get('start', '0')) <= 0">
+     tal:define="first_batch python:start <= 0">
 <tal:block tal:condition="not: usage/sidebar" tal:replace='structure string:
 <script language="JavaScript" type="text/javascript">
 <!--
@@ -45,17 +48,19 @@
 </div>
 
 <div class="navigation">
-<a tal:define="prev python:int(request.get('start', '0')) - 20"
-   tal:condition="python: prev >= 0"
-   tal:attributes="href string:${request/URL}?start=${prev}">Previous 20</a>
+<a tal:define="prev python:max(0, start - size)"
+   tal:condition="python: start > 0"
+   tal:attributes="href string:${request/URL}?start=${prev}${opt_size}">Previous
+   <span tal:replace="size">20</span></a>
 </div>
 
 <div tal:replace="structure view/renderCheckins" />
 
 <div class="navigation">
-<a tal:define="next python:int(request.get('start', '0')) + 20"
+<a tal:define="next python:start + size"
    tal:condition="python: next < view.count()"
-   tal:attributes="href string:${request/URL}?start=${next}">Next 20</a>
+   tal:attributes="href string:${request/URL}?start=${next}${opt_size}">Next
+   <span tal:replace="size">20</span></a>
 </div>
 
 </body>