[CMF-checkins] CVS: Products/CMFDecor/skins/zpt_generic - review.pt:1.1 breadcrumbs.py:1.3
Tres Seaver
tseaver@zope.com
Wed, 26 Sep 2001 16:42:24 -0400
Update of /cvs-repository/Products/CMFDecor/skins/zpt_generic
In directory cvs.zope.org:/tmp/cvs-serv21574
Modified Files:
breadcrumbs.py
Added Files:
review.pt
Log Message:
- Add multi-review template.
=== Added File Products/CMFDecor/skins/zpt_generic/review.pt ===
<html metal:use-macro="here/main_template/macros/master">
<body>
<div metal:fill-slot="main">
<div class="Desktop"
tal:define="results python: here.portal_catalog( review_state='pending' );
Batch modules/ZTUtils/Batch;
def_start string:0;
bstart request/b_start | def_start;
batch python: Batch( results, 25, int( bstart ), orphan=0 );
">
<div tal:condition="results">
<h1> Items pending review </h1>
<form action="/" method="GET"
tal:attributes="action here/portal_url"
>
<table class="SearchResults">
<tr>
<td width="16"><br></td>
<td width="16"><br></td>
<th> Title
</th>
<th> Type
</th>
<th> Date
</th>
</tr>
<tbody tal:repeat="item batch">
<tr tal:define="objURL string:${item/getURL}/view;
objPath item/getpath;
">
<td>
<input type="checkbox" name="items:list"
tal:attributes="value objPath">
</td>
<td>
<span tal:condition="item/icon">
<a href="url"
tal:attributes="href objURL"
><img border="0" src="icon" alt="Type" title="Type"
tal:attributes="src string:${here/portal_url}/${item/icon};
alt item/Type|nothing;
title item/Type|nothing;
"></a>
</span>
</td>
<td>
<a href="url"
tal:attributes="href objURL"
tal:content="python: item.Title() or '(No title)'">Title</a>
</td>
<td>
<span tal:replace="item/Type" />
</td>
<td>
<span tal:replace="item/Date" />
</td>
</tr>
<tr>
<td> </td>
<td colspan="3"
tal:define="desc python: item.Description() or '(No description)'"
>
<em><span tal:replace="python: desc[:100]">Description</span></em>
</td>
</tr>
</tbody>
<tr>
<td><br></td>
<td><br></td>
<td>
<textarea name="comment:text" rows="3" cols="65"></textarea>
<input type="submit" name="publishItems:method" value="Publish">
<input type="submit" name="rejectItems:method" value="Reject">
</td>
</tr>
</table>
</form>
</div>
<div tal:condition="python: not results">
<p> There are no items matching your specified criteria. </p>
</div>
</div>
</div>
</body>
</html>
=== Products/CMFDecor/skins/zpt_generic/breadcrumbs.py 1.2 => 1.3 ===
##bind script=script
##bind subpath=traverse_subpath
-##parameters=
-##title=return breadcrumbs
+##parameters=include_root=1
+##title=Return breadcrumbs
##
-from string import split, join, upper
-from Products.PythonScripts.standard import url_quote, html_quote
-portal_url = context.portal_url
+from string import join
-path = portal_url.getRelativeUrl(context)
-if not path:
- return ''
+result = []
+portal_url = context.portal_url()
-PATTERN = (
- '<a href="%(url)s">%(title)s</a>'
- )
+if include_root:
+ result.append( { 'id' : 'root'
+ , 'title' : context.portal_properties.title()
+ , 'url' : portal_url
+ }
+ )
+
+relative = context.portal_url.getRelativeContentPath( context )
+portal = context.portal_url.getPortalObject()
+
+for i in range( len( relative ) ):
+ now = relative[ :i+1 ]
+ obj = portal.restrictedTraverse( now )
+ result.append( { 'id' : now[ -1 ]
+ , 'title' : obj.Title()
+ , 'url' : portal_url + '/' + join( now, '/' )
+ }
+ )
-LASTPATTERN = (
- '%(title)s'
- )
-
-JOINER = (
- '<font color="#666666"> > </font>'
- )
-
-url = portal_url()
-steps = split(path,'/')
-breadcrumbs = []
-last = steps.pop() # Remove last element
-last = context.Title()
-
-# Add the home link:
-breadcrumbs.append( PATTERN % { 'url' : url,
- 'title': 'Home', } )
-
-for step in steps:
- url = '%s/%s' % (url,url_quote(step))
- breadcrumbs.append( PATTERN % { 'url' : url,
- 'title': html_quote(step), } )
-
-if last:
- breadcrumbs.append(LASTPATTERN % { 'title': html_quote(last) })
-
-return join(breadcrumbs, JOINER)
+return result