[CMF-checkins] CVS: Products/CMFDefault/skins/generic - doFormSearch.py:1.2 search.dtml:1.7 search_form.dtml:1.8
Tres Seaver
tseaver@zope.com
Fri, 4 Jan 2002 20:30:20 -0500
Update of /cvs-repository/Products/CMFDefault/skins/generic
In directory cvs.zope.org:/tmp/cvs-serv25627/CMFDefault/skins/generic
Modified Files:
search.dtml search_form.dtml
Added Files:
doFormSearch.py
Log Message:
- Merge fix for Tracker #332 from 1.2 branch.
=== Products/CMFDefault/skins/generic/doFormSearch.py 1.1 => 1.2 ===
+##parameters=REQUEST
+##title=Pre-process form variables, then return catalog query results.
+##
+form_vars = {}
+select_vars = ( 'review_state'
+ , 'Subject'
+ , 'created'
+ , 'Type'
+ )
+
+for k, v in REQUEST.form.items():
+
+ if k in select_vars:
+
+ if same_type( v, [] ):
+ v = filter( None, v )
+ if not v:
+ continue
+
+ form_vars[ k ] = v
+
+return context.portal_catalog( form_vars )
=== Products/CMFDefault/skins/generic/search.dtml 1.6 => 1.7 ===
<h1> Search Results </h1>
-<dtml-let results="portal_catalog( REQUEST=REQUEST )">
+<dtml-let results="doFormSearch( REQUEST=REQUEST )">
<p>Found <dtml-var expr="_.len(results)" thousands_commas>
items<dtml-if name="SearchableText"> matching "&dtml-SearchableText;"</dtml-if>.</p>
=== Products/CMFDefault/skins/generic/search_form.dtml 1.7 => 1.8 ===
</th>
<td>
- <select name="review_state" size="3" multiple>
- <option>private</option>
- <option>pending</option>
- <option>published</option>
+ <select name="review_state:list" size="3" multiple>
+ <option value="" selected>-- any --</option>
+ <option value="private">private</option>
+ <option value="pending">pending</option>
+ <option value="published">published</option>
</select>
<dl class="FieldHelp">
<dd> As a reviewer, you may search for items based on their
@@ -56,6 +57,7 @@
<th>Subject</th>
<td>
<select name="Subject:list" multiple size="4">
+ <option value="" selected>-- any --</option>
<dtml-in expr="portal_catalog.uniqueValuesFor( 'Subject' )">
<option value="&dtml-sequence-item;"> &dtml-sequence-item; </option>
</dtml-in>
@@ -114,6 +116,7 @@
</th>
<td>
<select name="Type:list" multiple size="5">
+ <option value="" selected>-- any --</option>
<dtml-in expr="portal_types.listContentTypes()">
<option><dtml-var sequence-item></option>
</dtml-in>