[CMF-checkins] CVS: CMF/CMFDefault/skins/zpt_generic -
search_results_control.py:1.1 batch_widgets.pt:1.3
search.pt:1.7 search_form.pt:1.10
Yvo Schubbe
y.2004_ at wcm-solutions.de
Mon Feb 2 07:44:53 EST 2004
Update of /cvs-repository/CMF/CMFDefault/skins/zpt_generic
In directory cvs.zope.org:/tmp/cvs-serv2775/CMFDefault/skins/zpt_generic
Modified Files:
batch_widgets.pt search.pt search_form.pt
Added Files:
search_results_control.py
Log Message:
- replaced deprecated '_usage' query parameters
- refactored search.pt
=== Added File CMF/CMFDefault/skins/zpt_generic/search_results_control.py ===
## Script (Python) "search_results_control"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=b_start=0, **kw
##title=
##
from Products.PythonScripts.standard import thousands_commas
from ZTUtils import Batch
from Products.CMFCore.utils import getToolByName
ctool = getToolByName(script, 'portal_catalog')
utool = getToolByName(script, 'portal_url')
portal_url = utool()
epoch = DateTime('1970/01/01 00:00:01 GMT')
control = {}
target = '%s/search' % portal_url
for k, v in kw.items():
if k in ('review_state', 'Title', 'Subject', 'Description', 'portal_type',
'listCreators'):
if same_type(v, []):
v = filter(None, v)
if not v:
del kw[k]
elif k in ('created',):
if v['query'] == epoch and v['range'] == 'min':
del kw[k]
else:
# work around problems with DateTime in records
kw[k] = v.copy()
elif k in ('go', 'go.x', 'go.y'):
del kw[k]
items = ctool.searchResults(kw)
batch_obj = Batch(items, 25, b_start, orphan=1)
length = batch_obj.sequence_length
summary = { 'length': length and thousands_commas(length) or '',
'type': (length == 1) and 'item' or 'items',
'match': kw.get('SearchableText') }
navigation = context.getBatchNavigation(batch_obj, target, **kw)
control['batch'] = { 'summary': summary,
'listItemInfos': batch_obj,
'navigation': navigation }
return control
=== CMF/CMFDefault/skins/zpt_generic/batch_widgets.pt 1.2 => 1.3 ===
--- CMF/CMFDefault/skins/zpt_generic/batch_widgets.pt:1.2 Tue Jan 20 17:20:10 2004
+++ CMF/CMFDefault/skins/zpt_generic/batch_widgets.pt Mon Feb 2 07:44:51 2004
@@ -1,6 +1,23 @@
<html>
<body>
+<tal:test tal:define="summary python: {'length': '9.999', 'type': 'items',
+ 'match': 'foo'};
+ global batch python: {'summary': summary}" />
+
+ <metal:block metal:define-macro="summary"
+ ><p class="BatchSummary" tal:condition="batch/summary/length"
+ i18n:translate="">Found <span tal:replace="batch/summary/length"
+ i18n:name="count">n</span> <span i18n:name="type"><span tal:omit-tag=""
+ tal:content="batch/summary/type" i18n:translate="">items</span></span
+ ><tal:case tal:condition="python: path('batch/summary/match') is not None"
+ > matching '<span tal:replace="batch/summary/match" i18n:name="text"
+ >search term</span>'</tal:case>.</p
+ ><p class="BatchSummary" tal:condition="not:batch/summary/length"
+ i18n:translate="">There are no items matching your specified criteria.</p
+></metal:block>
+
+
<tal:test tal:define="previous python: {'length': '20', 'text': 'Previous',
'type': 'items', 'url':'?'};
next python: {'length': '', 'text': 'Next',
@@ -17,7 +34,7 @@
><tal:span tal:content="batch/navigation/previous/text"
>Previous</tal:span
> <tal:case tal:condition="batch/navigation/previous/length"
- ><span tal:omit-tag="" tal:content="batch/navigation/previous/length"
+ ><span tal:replace="batch/navigation/previous/length"
i18n:name="count">n</span></tal:case
> <tal:span tal:content="batch/navigation/previous/type"
>items</tal:span></a></tal:case
@@ -28,7 +45,7 @@
><tal:span tal:content="batch/navigation/next/text"
>Next</tal:span
> <tal:case tal:condition="batch/navigation/next/length"
- ><span tal:omit-tag="" tal:content="batch/navigation/next/length"
+ ><span tal:replace="batch/navigation/next/length"
i18n:name="count">n</span></tal:case
> <tal:span tal:content="batch/navigation/next/type"
>items</tal:span></a></tal:case
=== CMF/CMFDefault/skins/zpt_generic/search.pt 1.6 => 1.7 ===
--- CMF/CMFDefault/skins/zpt_generic/search.pt:1.6 Sat Nov 1 11:42:00 2003
+++ CMF/CMFDefault/skins/zpt_generic/search.pt Mon Feb 2 07:44:51 2004
@@ -1,28 +1,19 @@
-<html xmlns:tal="http://xml.zope.org/namespaces/tal"
- xmlns:metal="http://xml.zope.org/namespaces/metal"
- metal:use-macro="here/main_template/macros/master">
+<tal:page
+ xmlns:tal="http://xml.zope.org/namespaces/tal"
+ xmlns:metal="http://xml.zope.org/namespaces/metal"
+ tal:define="control python: here.search_results_control(**request.form)"
+ tal:condition="control"
+><html metal:use-macro="here/main_template/macros/master">
<body>
-<div metal:fill-slot="main" i18n:domain="cmf_default">
-<div class="Desktop">
-<h2 i18n:translate="">Search Results</h2>
-
-<div tal:define="b_start python:0;b_start request/b_start | b_start;
- results python:here.doFormSearch( REQUEST=request );
- Batch python:modules['ZTUtils'].Batch;
- global batch python:Batch(results, 25, b_start, orphan=1);
- ">
+<metal:block metal:fill-slot="main"
+ tal:define="batch control/batch">
+<div class="Desktop" i18n:domain="cmf_default">
-<p i18n:translate="">Found <span
- tal:define="pss modules/Products.PythonScripts.standard"
- tal:replace="python:pss.thousands_commas(len(results))"
- i18n:name="count">100</span> items<span
- tal:condition="exists:request/SearchableText"
- tal:omit-tag=""> matching '<span
- tal:replace="request/SearchableText"
- i18n:name="text">search term</span>'</span>.</p>
+<h2 i18n:translate="">Search Results</h2>
-<table class="SearchResults" tal:condition="results">
+<metal:block metal:use-macro="here/batch_widgets/macros/summary" />
+<table class="SearchResults" tal:condition="batch/listItemInfos">
<thead>
<tr>
<td width="16"> </td>
@@ -31,7 +22,7 @@
<th i18n:translate="">Date</th>
</tr>
</thead>
- <tbody tal:repeat="result batch">
+ <tbody tal:repeat="result batch/listItemInfos">
<tr tal:define="objURL string:${result/getURL}/view">
<td><a href=""
tal:condition="result/getIcon|nothing"
@@ -60,17 +51,10 @@
</tr>
</tbody>
</table>
-<p tal:condition="not:results"
- i18n:translate="">There are no items matching your specified criteria.</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>
+<metal:block metal:use-macro="here/batch_widgets/macros/navigation" />
</div>
-</div>
-</div>
+</metal:block>
+
</body>
-</html>
+</html></tal:page>
=== CMF/CMFDefault/skins/zpt_generic/search_form.pt 1.9 => 1.10 ===
--- CMF/CMFDefault/skins/zpt_generic/search_form.pt:1.9 Sun Feb 1 09:34:33 2004
+++ CMF/CMFDefault/skins/zpt_generic/search_form.pt Mon Feb 2 07:44:51 2004
@@ -92,7 +92,7 @@
lastWeek python:(today-7).Date();
lastMth python:(today-31).Date();
">
- <select name="created:date">
+ <select name="created.query:record:date">
<option value="1970/01/01 00:00:01 GMT"
i18n:translate="">Ever</option>
<option value=""
@@ -109,7 +109,7 @@
tal:attributes="value lastMth"
i18n:translate="">Last month</option>
</select>
- <input type="hidden" name="created_usage" value="range:min" />
+ <input type="hidden" name="created.range:record" value="min" />
<dl class="FieldHelp">
<dd i18n:translate="">You may find only recent items by selecting a
time-frame.
More information about the CMF-checkins
mailing list