[CMF-checkins] CVS: CMF/CMFDefault/skins/zpt_generic - batch_widgets.pt:1.1 getBatchNavigation.py:1.1 roster.pt:1.6 search.pt:1.6

Yvo Schubbe cvs-admin at zope.org
Sat Nov 1 11:42:00 EST 2003


Update of /cvs-repository/CMF/CMFDefault/skins/zpt_generic
In directory cvs.zope.org:/tmp/cvs-serv20127/CMFDefault/skins/zpt_generic

Modified Files:
	roster.pt search.pt 
Added Files:
	batch_widgets.pt getBatchNavigation.py 
Log Message:
membership management ui (part 2):
- moved batch navigation into batch_widgets.pt to make the code reusable for members_manage_form.pt


=== Added File CMF/CMFDefault/skins/zpt_generic/batch_widgets.pt ===
<html>
<body>

<tal:test tal:define="previous python: {'length': '20', 'text': 'Previous',
                                        'type': 'items', 'url':'?'};
                      next python: {'length': '', 'text': 'Next',
                                    'type': 'item', 'url':'?'};
                      navigation python: {'previous': previous, 'next': next};
                      global batch python: {'navigation': navigation}" />

 <metal:block metal:define-macro="navigation"
              tal:define="p batch/navigation/previous/url;
                          n batch/navigation/next/url"
 ><p class="BatchNavigation" tal:condition="python: p or n"
  ><tal:case tal:condition="p">
  <a href="" tal:attributes="href p" i18n:translate=""
  ><tal:span tal:content="batch/navigation/previous/text"
   >Previous</tal:span
  > <tal:case tal:condition="batch/navigation/previous/length"
      tal:content="batch/navigation/previous/length"
      i18n:name="count">n</tal:case
  > <tal:span tal:content="batch/navigation/previous/type"
   >items</tal:span></a></tal:case
 ><tal:case tal:condition="python:p and n">
  &nbsp;&nbsp;</tal:case
 ><tal:case tal:condition="n">
  <a href="" tal:attributes="href n" i18n:translate=""
  ><tal:span tal:content="batch/navigation/next/text"
   >Next</tal:span
  > <tal:case tal:condition="batch/navigation/next/length"
      tal:content="batch/navigation/next/length"
      i18n:name="count">n</tal:case
  > <tal:span tal:content="batch/navigation/next/type"
   >items</tal:span></a></tal:case
 ></p
></metal:block>

</body>
</html>


=== Added File CMF/CMFDefault/skins/zpt_generic/getBatchNavigation.py ===
## Script (Python) "getBatchNavigation"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=batch_obj, target, type_singular='item', type_plural='items', previous_text='Previous', next_text='Next', **kw
##title=
##
from ZTUtils import make_query
if kw.has_key('b_start'):
    del kw['b_start']

navigation = {}

items = []
for batch in (batch_obj.previous, batch_obj.next):
    length = batch and batch.length or 0
    if length:
        batch_start = batch.first
        if batch_start:
            kw['b_start'] = batch_start
        query = kw and ( '?%s' % make_query(kw) ) or ''
        url = '%s%s' % (target, query)
    items.append( {'length': length > 1 and length or '',
                   'type': length == 1 and type_singular or type_plural,
                   'url': length and url or ''} )
navigation['previous'] = items[0]
navigation['previous']['text'] = previous_text
navigation['next'] = items[1]
navigation['next']['text'] = next_text

return navigation


=== CMF/CMFDefault/skins/zpt_generic/roster.pt 1.5 => 1.6 ===
--- CMF/CMFDefault/skins/zpt_generic/roster.pt:1.5	Mon Sep  1 10:02:06 2003
+++ CMF/CMFDefault/skins/zpt_generic/roster.pt	Sat Nov  1 11:42:00 2003
@@ -29,7 +29,7 @@
                    b_start request/b_start | b_start;
                    members mtool/getRoster;
                    Batch python:modules['ZTUtils'].Batch;
-                   batch python:Batch(members, 25, int(b_start), orphan=1)">
+                   global batch python:Batch(members, 25, int(b_start), orphan=1)">
  <tr tal:repeat="members batch">
   <td> <br /> </td>
   <td tal:define="id members/id;
@@ -46,26 +46,15 @@
    <span tal:replace="python: listed and 'Yes' or 'No'">Yes...Or No</span>
   </td>
  </tr>
-
- <tr>
-  <td> <br /> </td>
-  <td>
-   <span tal:define="p batch/previous" tal:condition="p">
-    <a href=""
-       tal:attributes="href string:?b_start=${p/first}"
-       i18n:translate="">Previous <span tal:replace="p/length"
-                                        i18n:name="count">p</span> Members</a>
-   </span>
-   <span tal:define="n batch/next" tal:condition="n">
-    <a href=""
-       tal:attributes="href string:?b_start=${batch/end}"
-       i18n:translate="">Next <span tal:replace="n/length"
-                                    i18n:name="count">n</span> Members</a>
-   </span>
-  </td>
- </tr>
 </tbody>
 </table>
+
+<tal:span tal:define="target python: mtool.getMembersFolder().absolute_url();
+                      batch python: {'navigation':
+               here.getBatchNavigation(batch, target, 'member', 'members') }">
+ <metal:block metal:use-macro="here/batch_widgets/macros/navigation" />
+</tal:span>
+
 </div>
 </div>
 </body>


=== CMF/CMFDefault/skins/zpt_generic/search.pt 1.5 => 1.6 ===
--- CMF/CMFDefault/skins/zpt_generic/search.pt:1.5	Wed Jul  9 14:10:25 2003
+++ CMF/CMFDefault/skins/zpt_generic/search.pt	Sat Nov  1 11:42:00 2003
@@ -63,20 +63,12 @@
 <p tal:condition="not:results"
    i18n:translate="">There are no items matching your specified criteria.</p>
 
-<p tal:define="mq python:modules['ZTUtils'].make_query">
- <span tal:define="p batch/previous" tal:condition="p">
-   <a href=""
-      tal:attributes="href python: '?' + mq( request.form, b_start=p.first )"
-      i18n:translate=""
-   >Previous <span tal:replace="p/length" i18n:name="count">n</span> items</a>
- </span>&nbsp;&nbsp;
- <span tal:define="n batch/next" tal:condition="n">
-   <a href=""
-      tal:attributes="href python: '?' + mq( request.form, b_start=n.first )"
-      i18n:translate=""
-   >Next <span tal:replace="n/length" i18n:name="count">n</span> items</a>
- </span>
- </p>
+<tal:span tal:define="target string:${here/portal_url}/search;
+                      batch python: {'navigation':
+                    here.getBatchNavigation(batch, target, **request.form) }">
+ <metal:block metal:use-macro="here/batch_widgets/macros/navigation" />
+</tal:span>
+
 </div>
 </div>
 </div>




More information about the CMF-checkins mailing list