[open-ils-commits] r8784 - in branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default: acq/picklist common

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Feb 19 17:59:27 EST 2008


Author: djfiander
Date: 2008-02-19 17:29:08 -0500 (Tue, 19 Feb 2008)
New Revision: 8784

Modified:
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view.html
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/widgets.html
Log:
factor out code to move between pages of items

Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view.html	2008-02-19 22:28:57 UTC (rev 8783)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view.html	2008-02-19 22:29:08 UTC (rev 8784)
@@ -3,6 +3,8 @@
  vim:ft=mako: 
 -->
 <%inherit file='../base.html'/>
+<%namespace file='../../common/widgets.html' name='widget' />
+
 <%def name="page_title()">${_('Picklist')}</%def>
 <%def name="block_content()">
 
@@ -19,22 +21,11 @@
     <thead>
         <tr>
             <td colspan='3' id='oils-acq-picklist-header-block'>
-                <table id='oils-acq-pikclist-header-subtable'><tr>
+                <table id='oils-acq-picklist-header-subtable'><tr>
                 <td id='oils-acq-picklist-paging-block'>
-                    <%
-                        c.oils.acq.offset.value = int(c.oils.acq.offset.value)
-                        c.oils.acq.limit.value = int(c.oils.acq.limit.value)
-                        # set up the paging info
-                        paging = _('Entries %(offset)s - %(limit)s') % {
-                            'offset': c.oils.acq.offset.value + 1,
-                            'limit': c.oils.acq.limit.value + c.oils.acq.offset.value
-                        }
-                    %>
-                    ${paging}
-                    % if c.oils.acq.offset.value > 0:
-                        <a href='?${c.oils.acq.offset.cgi_name}=${c.oils.acq.offset.value - c.oils.acq.limit.value}'>&#171;</a>
-                    % endif
-                    <a href='?${c.oils.acq.offset.cgi_name}=${c.oils.acq.offset.value + c.oils.acq.limit.value}'>&#187;</a>
+		  ${widget.paging(c.oils.acq.offset.value,
+		                  c.oils.acq.limit.value,
+		                  c.oils.acq.picklist.value.entry_count())}
                 </td>
                 <td id='oils-acq-picklist-actions-block'>
                     <select name='${c.oils.acq.picklist_action.cgi_name}'>

Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/widgets.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/widgets.html	2008-02-19 22:28:57 UTC (rev 8783)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/widgets.html	2008-02-19 22:29:08 UTC (rev 8784)
@@ -46,3 +46,31 @@
         ${org_draw_node(tree, 0, selected, disable_depth)}
     </select>
 </%def>
+
+<%def name='paging(start, count, max)'>
+    <!--
+	Creating paging links to move from page to page in long
+	list of results
+      -->
+
+    <%
+       start = int(start)
+       if (start + count > max):
+           end = max
+       else:
+           end = start + count
+       # set up the paging info
+       paging = _('Entries %(offset)d - %(limit)d of %(max)d') % {
+           'offset': start + 1, 'limit': end, 'max': max }
+    %>
+
+    % if start > 0:
+        <a href='?${c.oils.acq.offset.cgi_name}=${start - count}'>&#171;</a>
+    % endif
+
+    ${paging}
+
+    % if end < max:
+        <a href='?${c.oils.acq.offset.cgi_name}=${end}'>&#187;</a>
+    % endif
+</%def>



More information about the open-ils-commits mailing list