appypod-rattail/gen/ui/result.pt

139 lines
7 KiB
Plaintext
Raw Normal View History

<div id="queryResult" metal:define-macro="queryResult"
tal:define="_ python: tool.translate;
className request/className;
refInfo tool/getRefInfo;
refObject python: refInfo[0];
refField python: refInfo[1];
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 '';
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);
objs queryResult/objects;
totalNumber queryResult/totalNumber;
batchSize queryResult/batchSize;
ajaxHookId python:'queryResult';
navBaseCall python: 'askQueryResult(\'%s\',\'%s\',\'%s\',\'%s\',**v**)' % (ajaxHookId, tool.absolute_url(), className, searchName);
newSearchUrl python: '%s/ui/search?className=%s%s' % (tool.absolute_url(), className, refUrlPart);
showSubTitles python: request.get('showSubTitles', 'true') == 'true'">
2012-06-13 02:59:19 -05:00
<tal:result condition="objs">
<tal:comment replace="nothing">Display here POD templates if required.</tal:comment>
<table tal:define="widgets python: tool.getResultPodFields(className);
2012-06-13 02:59:19 -05:00
layoutType python:'view'"
tal:condition="python: objs and widgets"
tal:attributes="align dright">
2012-06-13 02:59:19 -05:00
<tr>
<td tal:define="contextObj python: objs[0]" tal:repeat="widget widgets">
<metal:pod use-macro="context/ui/widgets/show/macros/field"/>&nbsp;&nbsp;&nbsp;
</td>
</tr>
</table>
<tal:comment replace="nothing">The title of the search.</tal:comment>
<p>
<span tal:replace="structure python: test(searchName, searchLabel, _('%s_plural' % className))"/>
2012-06-13 02:59:19 -05:00
(<span tal:replace="totalNumber"/>)
<tal:newSearch condition="python: searchName == '_advanced'">
&nbsp;&mdash;&nbsp;<i><a tal:attributes="href newSearchUrl"
2012-06-03 11:34:56 -05:00
tal:content="python: _('search_new')"></a></i>
</tal:newSearch>
2012-06-13 02:59:19 -05:00
</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/>
</td>
</tal:descr>
<td tal:attributes="align dright" width="25%">
2012-06-13 02:59:19 -05:00
<tal:comment replace="nothing">Appy (top) navigation</tal:comment>
<metal:nav use-macro="context/ui/navigate/macros/appyNavigate"/>
</td>
</tr>
</table>
2009-11-17 03:05:19 -06:00
<table tal:define="columnLayouts python: tool.getResultColumnsLayouts(className, refInfo);
columns python: objs[0].getColumnsSpecifiers(columnLayouts, dir)"
class="list" width="100%">
<tal:comment replace="nothing">Headers, with filters and sort arrows</tal:comment>
2009-06-29 07:06:01 -05:00
<tr>
<tal:header repeat="column columns">
<th tal:define="widget column/field;
sortable python: tool.isSortable(widget['name'], className, 'search');
filterable widget/filterable|nothing"
tal:attributes="width column/width; align column/align">
2012-06-03 11:34:56 -05:00
<span tal:replace="structure python: tool.truncateText(_(widget['labelId']))"/>
2011-11-25 11:01:20 -06:00
<metal:icons use-macro="context/ui/navigate/macros/sortAndFilter"/>
<metal:details use-macro="context/ui/navigate/macros/showDetails"/>
</th>
</tal:header>
2009-06-29 07:06:01 -05:00
</tr>
<tal:comment replace="nothing">Results</tal:comment>
2009-12-15 14:30:43 -06:00
<tal:row repeat="obj objs">
<tr id="query_row" valign="top" tal:define="odd repeat/obj/odd"
2009-12-15 14:30:43 -06:00
tal:attributes="class python:test(odd, 'even', 'odd')">
2009-06-29 07:06:01 -05:00
<tal:fields repeat="column columns">
<td tal:define="widget column/field"
tal:attributes="id python:'field_%s' % widget['name'];
width column/width; align column/align">
<tal:comment replace="nothing">Title</tal:comment>
<tal:title condition="python: widget['name'] == 'title'">
<tal:icons replace="structure obj/getIcons"/>
2011-11-25 11:01:20 -06:00
<a tal:define="navInfo python:'search.%s.%s.%d.%d' % (className, searchName, repeat['obj'].number()+startNumber, totalNumber);"
tal:content="obj/Title" tal:attributes="href python: obj.getUrl(nav=navInfo, page=obj.getDefaultViewPage())"></a>
<div name="subTitle" tal:content="structure obj/getSubTitle"
tal:attributes="style python: showSubTitles and 'display:block' or 'display:none'"></div>
2009-06-29 07:06:01 -05:00
<tal:comment replace="nothing">Actions: edit, delete</tal:comment>
<div tal:attributes="align dright" tal:condition="obj/mayAct">
<a tal:define="navInfo python:'search.%s.%s.%d.%d' % (className, searchName, repeat['obj'].number()+startNumber, totalNumber);"
tal:attributes="href python: obj.getUrl(mode='edit', page=obj.getDefaultEditPage(), nav=navInfo)"
tal:condition="obj/mayEdit">
<img tal:attributes="src string: $appUrl/ui/edit.gif;
title python: _('object_edit')"/></a><img
tal:condition="obj/mayDelete" style="cursor:pointer"
tal:attributes="src string: $appUrl/ui/delete.png;
title python: _('object_delete');
onClick python:'onDeleteObject(\'%s\')' % obj.UID()"/>
</div>
</tal:title>
<tal:comment replace="nothing">Any other field</tal:comment>
<tal:other condition="python: widget['name'] != 'title'">
<tal:field define="contextObj python:obj;
layoutType python:'cell';
innerRef python:True"
condition="python: contextObj.showField(widget['name'], 'result')">
<metal:field use-macro="context/ui/widgets/show/macros/field"/>
</tal:field>
</tal:other>
</td>
</tal:fields>
2009-06-29 07:06:01 -05:00
</tr>
2009-12-15 14:30:43 -06:00
</tal:row>
2012-06-13 02:59:19 -05:00
</table>
2009-06-29 07:06:01 -05:00
2012-06-13 02:59:19 -05:00
<tal:comment replace="nothing">Appy (bottom) navigation</tal:comment>
<metal:nav use-macro="here/ui/navigate/macros/appyNavigate"/>
</tal:result>
<tal:noResult condition="not: objs">
2012-06-03 11:34:56 -05:00
<span tal:replace="python: _('query_no_result')"/>
<tal:newSearch condition="python: searchName == '_advanced'">
<br/><i class="discreet"><a tal:attributes="href newSearchUrl"
2012-06-03 11:34:56 -05:00
tal:content="python: _('search_new')"></a></i>
</tal:newSearch>
</tal:noResult>
</div>