[gen] It is now possible to define, via method 'getDynamicSearches', dynamic searches for a class.

This commit is contained in:
Gaetan Delannay 2012-11-14 17:40:52 +01:00
parent 4872e5d8b8
commit 5269b278f7
6 changed files with 99 additions and 52 deletions

View file

@ -64,8 +64,9 @@
<tr valign="middle">
<tal:comment replace="nothing">Go to the source URL (search or referred object)</tal:comment>
<td tal:condition="sourceUrl"><a tal:attributes="href sourceUrl"><img
tal:attributes="src string: $appUrl/ui/gotoSource.png;
title python: backText + ' : ' + _('goto_source')"/></a></td>
tal:define="gotoSource python: _('goto_source');
goBack python: backText and ('%s - %s' % (backText, gotoSource)) or gotoSource"
tal:attributes="src string: $appUrl/ui/gotoSource.png; title goBack"/></a></td>
<tal:comment replace="nothing">Go to the first page</tal:comment>
<td tal:condition="firstUrl"><a tal:attributes="href firstUrl"><img
tal:attributes="src string: $appUrl/ui/arrowLeftDouble.png;

View file

@ -1,9 +1,10 @@
<tal:comment replace="nothing">Macro for displaying a search</tal:comment>
<div metal:define-macro="search" class="portletSearch">
<a tal:attributes="href python: '%s?className=%s&search=%s' % (queryUrl, rootClass, search['name']);
title search/descr;
title search/translatedDescr;
class python: test(search['name'] == currentSearch, 'portletCurrent', '');"
tal:content="structure search/label"></a>
tal:content="search/translated">
</a>
</div>
<tal:comment replace="nothing">Macro for displaying a group of searches</tal:comment>
@ -16,7 +17,8 @@
src python:test(expanded, 'ui/collapse.gif', 'ui/expand.gif');
onClick python:'toggleCookie(\'%s\')' % widget['labelId'];
align dleft"/>
<span tal:replace="python: _(widget['labelId'])"/>
<span tal:condition="not: widget/translated" tal:replace="python: _(widget['labelId'])"/>
<span tal:condition="widget/translated" tal:replace="widget/translated"/>
</div>
<tal:comment replace="nothing">Group content</tal:comment>
<div tal:define="display python:test(expanded, 'display:block', 'display:none')"

View file

@ -7,15 +7,13 @@
refUrlPart python: refObject and ('&ref=%s:%s' % (refObject.UID(), refField)) or '';
startNumber request/startNumber|python:'0';
startNumber python: int(startNumber);
searchName request/search;
labelId python: searchName and ('%s_search_%s' % (className, searchName)) or '';
labelId python: (searchName == '_advanced') and 'search_results' or labelId;
searchLabel python: labelId and _(labelId) or '';
searchName request/search|python:'';
searchDescr python: tool.getSearch(className, searchName, descr=True);
sortKey request/sortKey| python:'';
sortOrder request/sortOrder| python:'asc';
filterKey request/filterKey| python:'';
filterValue request/filterValue | python:'';
queryResult python: tool.executeQuery(className, searchName, startNumber, remember=True, sortBy=sortKey, sortOrder=sortOrder, filterKey=filterKey, filterValue=filterValue, refObject=refObject, refField=refField);
queryResult python: tool.executeQuery(className, search=searchDescr['search'], startNumber=startNumber, remember=True, sortBy=sortKey, sortOrder=sortOrder, filterKey=filterKey, filterValue=filterValue, refObject=refObject, refField=refField);
objs queryResult/objects;
totalNumber queryResult/totalNumber;
batchSize queryResult/batchSize;
@ -39,7 +37,7 @@
<tal:comment replace="nothing">The title of the search.</tal:comment>
<p>
<span tal:replace="structure python: test(searchName, searchLabel, _('%s_plural' % className))"/>
<span tal:replace="searchDescr/translated"/>
(<span tal:replace="totalNumber"/>)
<tal:newSearch condition="python: searchName == '_advanced'">
&nbsp;&mdash;&nbsp;<i><a tal:attributes="href newSearchUrl"
@ -48,19 +46,16 @@
</p>
<table width="100%">
<tr>
<tal:descr condition="searchName">
<td tal:define="descr python: _('%s_descr' % labelId)"
tal:condition="descr/strip">
<span class="discreet" tal:content="descr"></span><br/>
<tal:comment replace="nothing">Search description</tal:comment>
<td tal:condition="searchDescr/translatedDescr">
<span class="discreet" tal:content="searchDescr/translatedDescr"></span><br/>
</td>
</tal:descr>
<td tal:attributes="align dright" width="25%">
<tal:comment replace="nothing">Appy (top) navigation</tal:comment>
<metal:nav use-macro="context/ui/navigate/macros/appyNavigate"/>
</td>
</tr>
</table>
<table tal:define="columnLayouts python: tool.getResultColumnsLayouts(className, refInfo);
columns python: objs[0].getColumnsSpecifiers(columnLayouts, dir)"
class="list" width="100%">