loops/search/search.pt
helmutm 8ee75bbf77 first working version of fulltext and title search
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@1317 fd906abe-77d9-0310-91a1-e0d9ade77398
2006-08-19 15:42:29 +00:00

141 lines
4.9 KiB
XML

<metal:search define-macro="search">
<div id="search"
tal:define="macros item/template/macros;
idPrefix string:${view/itemNum}.search;
formId string:$idPrefix.form;
resultsId string:$idPrefix.results">
<h3 tal:attributes="class string:content-$level;
ondblclick item/openEditWindow">
Search
</h3>
<div metal:define-macro="search_form" class="searchForm">
<fieldset class="box">
<form action="." method="post" id="1.search.form"
tal:attributes="id formId">
<input type="hidden" name="search.submitted" value="yes" />
<input type="hidden" name="search.resultsId" value="1.results"
tal:attributes="value resultsId" />
<table cellpadding="3">
<tal:block repeat="search_param python: ['type', 'text']">
<metal:row use-macro="macros/search_row" />
</tal:block>
<tr>
<td colspan="2">
<input type="button" value="Add concept filter" class="button" />
<input type="button" value="Add attribute filter" class="button" />
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="button.search" value="Search" class="submit"
tal:attributes="onclick python:
item.submitReplacing(resultsId, formId, view)" />
</td>
</tr>
</table>
</form>
</fieldset>
</div>
<div metal:define-macro="search_results" id="1.search.results"
tal:attributes="id resultsId | request/search.resultsId">
<fieldset class="box"
tal:condition="request/search.submitted | nothing">
<legend>Search results</legend>
<div tal:repeat="row view/results">
<div>
<a tal:attributes="href string:${view/url}/.target${row/uniqueId}"
tal:content="row/title" />
</div>
</div>
</fieldset>
</div>
</div>
</metal:search>
<tr metal:define-macro="search_row" id="1.1.row"
tal:define="rowNum item/rowNum;
idPrefix string:$idPrefix.$rowNum;
namePrefix string:search.$rowNum;
param search_param | item/searchParam"
tal:attributes="id string:$idPrefix.row">
<td style="width: 30px">
<input type="hidden" name="paramtype" value="type"
tal:attributes="name string:$namePrefix.paramtype;
value param" />
<input type="button" value="&minus;"
title="Remove search parameter"
tal:condition="python: param not in ['type', 'text']" />&nbsp;
</td>
<td>
<div metal:use-macro="macros/?param" />
</td>
</tr>
<metal:text define-macro="type">
<div>
<h3>Type(s) to search for</h3>
<label for="text"
tal:attributes="for string:$idPrefix.text">Type:</label>
<select name="text"
tal:attributes="name string:$namePrefix.text;
id string:$idPrefix.text;">
<option value=".loops/concepts/topic">Topic</option>
<option value="loops.resource.Document">Document</option>
</select>
<input type="button" value="+"
title="Add type" />&nbsp;
</div>
</metal:text>
<metal:text define-macro="text">
<div>
<h3>Search text</h3>
<input type="checkbox" checked
name="title" id="title" value="yes"
tal:attributes="name string:$namePrefix.title;
id string:$idPrefix.title;" />
<label for="title"
tal:attributes="for string:$idPrefix.title">Title</label>
<input type="checkbox"
name="full" id="full" value="yes"
tal:attributes="name string:$namePrefix.full;
id string:$idPrefix.full;" />
<label for="full"
tal:attributes="for string:$idPrefix.full">Full text</label>&nbsp;&nbsp;
<label for="text"
tal:attributes="for string:$idPrefix.text">Search words:</label>
<input type="text" name="text"
tal:attributes="name string:$namePrefix.text;
id string:$idPrefix.text;" />
<input type="button" value="+"
title="Add search word" />&nbsp;
</div>
</metal:text>
<!-- obsolete -->
<tr metal:define-macro="search_row_selectable" id="search.row.1.1">
<td>
<input type="button" value="&minus;"
title="Remove search parameter" />&nbsp;
</td>
<td tal:define="selection search_selection | string:type">
<select>
<option value="type"
tal:attributes="selected python: selection=='type'">Type</option>
<option value="text"
tal:attributes="selected python: selection=='text'">Text</option>
<option value="attribute">Attribute value</option>
<option value="concept">Concept</option>
</select>
<input metal:use-macro="template/macros/?selection" />
</td>
</tr>