2009-11-03 08:02:18 -06:00
|
|
|
<metal:queryResults define-macro="queryResult"
|
2012-06-03 11:34:56 -05:00
|
|
|
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 '';
|
|
|
|
severalTypes python: className and (className.find(',') != -1);
|
|
|
|
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)">
|
2009-11-03 08:02:18 -06:00
|
|
|
|
2012-06-13 02:59:19 -05:00
|
|
|
<tal:result condition="objs">
|
2009-11-03 08:02:18 -06:00
|
|
|
|
2012-06-13 02:59:19 -05:00
|
|
|
<tal:comment replace="nothing">Display here POD templates if required.</tal:comment>
|
2012-06-27 06:27:24 -05:00
|
|
|
<table tal:define="widgets python: tool.getResultPodFields(className);
|
2012-06-13 02:59:19 -05:00
|
|
|
layoutType python:'view'"
|
2012-06-27 06:27:24 -05:00
|
|
|
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"/>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<tal:comment replace="nothing">The title of the search.</tal:comment>
|
|
|
|
<p>
|
|
|
|
<span tal:replace="structure python: test(searchName, searchLabel, test(severalTypes, _(tool.getAppName()), _('%s_plural' % className)))"/>
|
|
|
|
(<span tal:replace="totalNumber"/>)
|
2010-01-06 11:36:16 -06:00
|
|
|
<tal:newSearch condition="python: searchName == '_advanced'">
|
2011-09-20 12:21:48 -05:00
|
|
|
— <i><a tal:attributes="href newSearchUrl"
|
2012-06-03 11:34:56 -05:00
|
|
|
tal:content="python: _('search_new')"></a></i>
|
2010-01-06 11:36:16 -06:00
|
|
|
</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>
|
2012-06-27 06:27:24 -05:00
|
|
|
<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
|
|
|
|
2012-06-13 02:59:19 -05:00
|
|
|
<table tal:define="fieldNames python: tool.getResultColumnsNames(className, refInfo);
|
2010-12-06 04:11:40 -06:00
|
|
|
widgets python: objs[0].getAppyTypesFromNames(fieldNames);"
|
2011-09-18 08:00:05 -05:00
|
|
|
class="list" width="100%">
|
2010-04-30 05:05:29 -05:00
|
|
|
<tal:comment replace="nothing">Headers, with filters and sort arrows</tal:comment>
|
2009-06-29 07:06:01 -05:00
|
|
|
<tr>
|
2010-12-06 04:11:40 -06:00
|
|
|
<tal:header repeat="widget widgets">
|
2011-11-25 11:01:20 -06:00
|
|
|
<th tal:define="sortable python: tool.isSortable(widget['name'], className, 'search');
|
2010-12-06 04:11:40 -06:00
|
|
|
filterable widget/filterable|nothing;">
|
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"/>
|
2009-06-29 07:06:01 -05:00
|
|
|
</th>
|
2010-12-06 04:11:40 -06:00
|
|
|
</tal:header>
|
|
|
|
<tal:comment replace="nothing">Object type, shown if instances of several types are shown</tal:comment>
|
2010-04-30 05:05:29 -05:00
|
|
|
<th tal:condition="severalTypes">
|
2012-06-03 11:34:56 -05:00
|
|
|
<span tal:replace="python: _('root_type')"></span>
|
2009-06-29 07:06:01 -05:00
|
|
|
</th>
|
2010-12-06 04:11:40 -06:00
|
|
|
<tal:comment replace="nothing">Actions</tal:comment>
|
2012-06-03 11:34:56 -05:00
|
|
|
<th tal:content="python: _('ref_actions')"></th>
|
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" tal:define="odd repeat/obj/odd"
|
|
|
|
tal:attributes="class python:test(odd, 'even', 'odd')">
|
2009-06-29 07:06:01 -05:00
|
|
|
|
2010-12-06 04:11:40 -06:00
|
|
|
<tal:fields repeat="widget widgets">
|
|
|
|
<tal:comment replace="nothing">Title</tal:comment>
|
|
|
|
<td id="field_title"
|
|
|
|
tal:condition="python: widget['name'] == 'title'">
|
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);"
|
2012-06-02 10:39:05 -05:00
|
|
|
tal:content="obj/Title" tal:attributes="href python: obj.getUrl(nav=navInfo, page=obj.getDefaultViewPage())"></a>
|
2010-12-06 04:11:40 -06:00
|
|
|
</td>
|
2009-06-29 07:06:01 -05:00
|
|
|
|
2010-12-06 04:11:40 -06:00
|
|
|
<tal:comment replace="nothing">Workflow state</tal:comment>
|
|
|
|
<td id="field_workflow_state"
|
2011-02-01 04:09:54 -06:00
|
|
|
tal:condition="python: widget['name'] == 'state'"
|
2012-06-03 11:34:56 -05:00
|
|
|
tal:content="python: _(obj.getWorkflowLabel())">
|
2010-12-06 04:11:40 -06:00
|
|
|
</td>
|
|
|
|
|
|
|
|
<tal:comment replace="nothing">Any other field</tal:comment>
|
2011-02-01 04:09:54 -06:00
|
|
|
<td tal:condition="python: widget['name'] not in ('title', 'state')"
|
2010-12-06 04:11:40 -06:00
|
|
|
tal:attributes="id python:'field_%s' % widget['name']">
|
|
|
|
<tal:field define="contextObj python:obj;
|
|
|
|
layoutType python:'cell';
|
|
|
|
innerRef python:True"
|
2012-03-06 10:02:41 -06:00
|
|
|
condition="python: contextObj.showField(widget['name'], 'result')">
|
2011-11-25 11:01:20 -06:00
|
|
|
<metal:field use-macro="context/ui/widgets/show/macros/field"/>
|
2010-12-06 04:11:40 -06:00
|
|
|
</tal:field>
|
|
|
|
</td>
|
|
|
|
</tal:fields>
|
2009-06-29 07:06:01 -05:00
|
|
|
|
2009-11-03 08:02:18 -06:00
|
|
|
<tal:comment replace="nothing">Column "Object type", shown if instances of several types are shown</tal:comment>
|
|
|
|
<td tal:condition="severalTypes" id="field_root_type"
|
2012-06-03 11:34:56 -05:00
|
|
|
tal:content="python: _(obj.portal_type)"></td>
|
2009-06-29 07:06:01 -05:00
|
|
|
|
|
|
|
<tal:comment replace="nothing">Column "Actions"</tal:comment>
|
2012-06-27 06:27:24 -05:00
|
|
|
<td tal:attributes="align dright">
|
2012-02-23 08:58:06 -06:00
|
|
|
<table class="noStyle" tal:condition="obj/mayAct">
|
2009-06-29 07:06:01 -05:00
|
|
|
<tr>
|
|
|
|
<tal:comment replace="nothing">Edit the element</tal:comment>
|
2011-09-18 08:00:05 -05:00
|
|
|
<td>
|
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);"
|
2012-06-02 10:39:05 -05:00
|
|
|
tal:attributes="href python: obj.getUrl(mode='edit', page=obj.getDefaultEditPage(), nav=navInfo)"
|
2012-06-01 08:57:19 -05:00
|
|
|
tal:condition="obj/mayEdit">
|
2012-06-03 11:34:56 -05:00
|
|
|
<img tal:attributes="src string: $appUrl/ui/edit.gif;
|
|
|
|
title python: _('object_edit')"/>
|
2009-06-29 07:06:01 -05:00
|
|
|
</a></td>
|
|
|
|
<tal:comment replace="nothing">Delete the element</tal:comment>
|
2011-09-18 08:00:05 -05:00
|
|
|
<td>
|
2012-06-03 11:34:56 -05:00
|
|
|
<img tal:condition="obj/mayDelete" style="cursor:pointer"
|
2011-11-25 11:01:20 -06:00
|
|
|
tal:attributes="src string: $appUrl/ui/delete.png;
|
2012-06-03 11:34:56 -05:00
|
|
|
title python: _('object_delete');
|
2010-09-17 08:32:48 -05:00
|
|
|
onClick python:'onDeleteObject(\'%s\')' % obj.UID()"/>
|
2009-10-20 09:57:00 -05:00
|
|
|
</td>
|
2009-06-29 07:06:01 -05:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</td>
|
|
|
|
</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"/>
|
2009-11-03 08:02:18 -06:00
|
|
|
</tal:result>
|
|
|
|
|
2010-01-06 11:36:16 -06:00
|
|
|
<tal:noResult condition="not: objs">
|
2012-06-03 11:34:56 -05:00
|
|
|
<span tal:replace="python: _('query_no_result')"/>
|
2010-01-06 11:36:16 -06:00
|
|
|
<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>
|
2010-01-06 11:36:16 -06:00
|
|
|
</tal:newSearch>
|
|
|
|
</tal:noResult>
|
2009-11-03 08:02:18 -06:00
|
|
|
</metal:queryResults>
|