[CMF-checkins] CVS: CMF/CMFCollector/skins/collector - collector_search.pt:1.1 search_collector.py:1.1 collector_contents.pt:1.5

Andrew Sawyers andrew@zope.com
Mon, 15 Oct 2001 09:58:51 -0400


Update of /cvs-repository/CMF/CMFCollector/skins/collector
In directory cvs.zope.org:/tmp/cvs-serv25907

Modified Files:
	collector_contents.pt 
Added Files:
	collector_search.pt search_collector.py 
Log Message:

*start for the collector search functionality.


=== Added File CMF/CMFCollector/skins/collector/collector_search.pt ===
<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">
<body>
<div metal:fill-slot="main">
<div class="Desktop">

<h3> Search Results </h3>

<div tal:define="b_start python:0;b_start request/b_start | b_start;
                 results python:apply(here.search_collector, (), request.form);
	             Batch python:modules['ZTUtils'].Batch;
	             global batch python:Batch(results, 25, b_start, orphan=1);
                ">
    <p>Found <span tal:define="pss modules/Products.PythonScripts.standard"
               tal:replace="python:pss.thousands_commas(len(results))">100</span> items 
		 <span tal:condition="exists: request/SearchableText"
		       tal:replace="string:matching ${request/SearchableText}"></span>.
    </p>
<table class="SearchResults">
 <tr>
  <td width="16"><br></td>
  <th> Title
  </th>
  <th> Type
  </th>
  <th> Date
  </th>
  </tr>
<tbody tal:repeat="results batch"
    tal:condition="results">
  <tr>
  <td tal:define="global objURL python: results.getURL()">
   <span tal:condition="results/getIcon|nothing">
     <a href="" tal:attributes="href objURL"><img src="" border="0" alt="" title=""
	                                              tal:define="alt results/Type"
	                                              tal:attributes="src results/getIcon; alt alt; title alt">
	 </a>
    </span>
  </td>
  <td>
     <a href="" tal:attributes="href objURL"><span tal:condition="results/Title" 
                                                 tal:content="results/Title">Title</span><span tal:condition="not:results/Title" tal:content="string:(No title)"></span></a>
  </td>
  <td><span tal:content="results/Type">Type</span></td>
  <td tal:content="results/Date">Date</td>
</tr>
<tr>
  <td>&nbsp;</td>
  <td colspan="3">
  <em><span tal:condition="results/Description"
            tal:content="results/Description">Description</span>
	  <span tal:condition="not:results/Description"
	        tal:content="string:(No description)"></span></em>
  </td>
</tr>
</tbody>
  </table>
<div tal:condition="not:results"
     tal:replace="string:There are no items matching your specified criteria"></div>

 <p class="Desktop" 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 )"
   >Previous <span tal:replace="p/length">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 )"
   >Next <span tal:replace="n/length">n</span> items</a>
 </span> 
 </p>
</div>
</div>
</div>
</body>
</html>



=== Added File CMF/CMFCollector/skins/collector/search_collector.py ===
## Script (Python) "search_collector.py"
##parameters=path, Type, SearchableText=None, Creator=None, classifications=None, severities=None, resolution=None, security_related=None, reported_version=None
##title=Build Collector Search
subj_items = []
if classifications:
    for i in classifications:
        subj_items.append('classification:%s' % (i))
if severities:
    for i in severities:
        subj_items.append('severity:%s' % (i))
if resolution:
    subj_items.append('resolution:%s' % (resolution))
if security_related:
    subj_items.append('security_related:' % (security_related))
if reported_version:
    subj_items.append('reported_version:' % (reported_version))
q = {}
q['path'] = path
q['Type'] = Type
if Creator:
    q['Creator'] = Creator
if subj_items:
    q['Subject'] = subj_items
return context.portal_catalog(REQUEST=q)


=== CMF/CMFCollector/skins/collector/collector_contents.pt 1.4 => 1.5 ===
 
   </form>
+  <form action="collector_search" method="get">
+  <input type="hidden" name="Type" value="Collector Issue">
+  <input type="hidden" name="path" value=""
+         tal:attributes="value python: here.absolute_url(1)">
+  Fulltext Search:  <input type="text" name="SearchableText" size="40">
+  <div>
+    Requestor:  <select name="Creator:list" multiple size="5">
+                  <option value=""
+                          tal:define="items python: here.portal_catalog.uniqueValuesFor('Creator')"
+                          tal:repeat="item items"
+                          tal:attributes="value item"
+                          tal:content="item">
+                  </option>
+                </select>
+  </div>
+  <div>
+    Status:  <select name="status:list" multiple size="5">
+               <option value=""
+                       tal:define="items python: here.portal_catalog.uniqueValuesFor('review_state')"
+                       tal:repeat="item items"
+                       tal:attributes="value item"
+                       tal:content="item">
+               </option>
+             </select>
+  </div>
+  <div>
+    Security Related:  <input type="checkbox" name="security_related" value="1">
+  </div>
+  <div>
+    Classification:  <select name="classifications:list" multiple size="5">
+                       <option value=""
+                               tal:define="items here/classifications"
+                               tal:repeat="item items"
+                               tal:attributes="value item"
+                               tal:content="item">
+                       </option>
+                     </select>
+  </div>
+  <div>
+    Severity: <select name="severities:list" multiple size="5">
+                <option value=""
+                        tal:define="items here/severities"
+                        tal:repeat="item items"
+                        tal:attributes="value item"
+                        tal:content="item">
+                </option>
+              </select>
+  </div>
+  <div>
+    <input type="Submit" value="Search">
+  </div>
+</form>
+
 </div>
 </div>
 </body>