2013-03-09 09:06:12 -06:00
|
|
|
<tal:comment replace="nothing">Show field content of a given object.</tal:comment>
|
|
|
|
<metal:field define-macro="field">
|
|
|
|
<tal:comment replace="nothing">Title</tal:comment>
|
|
|
|
<tal:title condition="python: widget['name'] == 'title'">
|
2013-04-26 19:15:44 -05:00
|
|
|
<tal:nav define="navInfo python:'search.%s.%s.%d.%d' % (className, searchName, startNumber+currentNumber, totalNumber);
|
|
|
|
cssClass python: obj.getCssFor('title')">
|
2013-04-11 09:01:52 -05:00
|
|
|
<tal:sup replace="structure python: obj.getSupTitle(navInfo)"/>
|
2013-04-26 19:15:44 -05:00
|
|
|
<a tal:content="obj/Title" tal:condition="enableLinks"
|
|
|
|
tal:attributes="href python: obj.getUrl(nav=navInfo, page=obj.getDefaultViewPage()); class cssClass"></a><span
|
|
|
|
tal:condition="not: enableLinks" tal:attributes="class cssClass" tal:content="obj/Title"></span><span
|
2013-04-11 09:01:52 -05:00
|
|
|
name="subTitle" tal:content="structure obj/getSubTitle"
|
|
|
|
tal:attributes="style python: showSubTitles and 'display:inline' or 'display:none'"></span>
|
2013-03-09 09:06:12 -06:00
|
|
|
<tal:comment replace="nothing">Actions: edit, delete</tal:comment>
|
2013-04-26 19:15:44 -05:00
|
|
|
<div tal:condition="obj/mayAct">
|
2013-03-09 09:06:12 -06:00
|
|
|
<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.png;
|
|
|
|
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>
|
2013-03-10 01:29:53 -06:00
|
|
|
</tal:nav>
|
2013-03-09 09:06:12 -06:00
|
|
|
</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:f use-macro="context/ui/widgets/show/macros/field"/>
|
|
|
|
</tal:field>
|
|
|
|
</tal:other>
|
|
|
|
</metal:field>
|
|
|
|
|
|
|
|
<tal:comment replace="nothing">Show query results as a list.</tal:comment>
|
2013-04-11 09:01:52 -05:00
|
|
|
<table metal:define-macro="list" class="list" width="100%"
|
|
|
|
tal:define="showHeaders showHeaders|python:True">
|
2013-03-09 09:06:12 -06:00
|
|
|
<tal:comment replace="nothing">Headers, with filters and sort arrows</tal:comment>
|
2013-04-11 09:01:52 -05:00
|
|
|
<tr tal:condition="showHeaders">
|
2013-03-09 09:06:12 -06:00
|
|
|
<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">
|
|
|
|
<span tal:replace="structure python: tool.truncateText(_(widget['labelId']))"/>
|
|
|
|
<metal:icons use-macro="context/ui/navigate/macros/sortAndFilter"/>
|
|
|
|
<metal:details use-macro="context/ui/navigate/macros/showDetails"/>
|
|
|
|
</th>
|
|
|
|
</tal:header>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tal:comment replace="nothing">Results</tal:comment>
|
|
|
|
<tal:row repeat="obj objs">
|
2013-03-10 01:29:53 -06:00
|
|
|
<tr id="query_row" valign="top"
|
|
|
|
tal:define="odd repeat/obj/odd;
|
|
|
|
global currentNumber python: currentNumber + 1"
|
2013-03-09 09:06:12 -06:00
|
|
|
tal:attributes="class python:test(odd, 'even', 'odd')">
|
|
|
|
|
|
|
|
<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">
|
|
|
|
<metal:f use-macro="context/ui/result/macros/field"/>
|
|
|
|
</td>
|
|
|
|
</tal:fields>
|
|
|
|
</tr>
|
|
|
|
</tal:row>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<tal:comment replace="nothing">Show query results as a grid.</tal:comment>
|
|
|
|
<table metal:define-macro="grid" width="100%"
|
|
|
|
tal:define="modeElems python: resultMode.split('_');
|
|
|
|
cols python: (len(modeElems)==2) and int(modeElems[1]) or 4;
|
|
|
|
rows python: tool.splitList(objs, cols)">
|
|
|
|
<tr tal:repeat="row rows" valign="middle">
|
|
|
|
<td tal:repeat="obj row" tal:attributes="width python: '%d%%'%(100/cols)"
|
2013-03-10 01:29:53 -06:00
|
|
|
align="center" style="padding-top: 25px">
|
|
|
|
<tal:def define="global currentNumber python: currentNumber + 1">
|
|
|
|
<tal:col repeat="column columns">
|
|
|
|
<tal:field define="widget column/field">
|
|
|
|
<metal:f use-macro="context/ui/result/macros/field"/>
|
|
|
|
</tal:field>
|
|
|
|
</tal:col>
|
|
|
|
</tal:def>
|
2013-03-09 09:06:12 -06:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<tal:comment replace="nothing">Show paginated query results as a list or grid.</tal:comment>
|
2012-10-31 15:17:31 -05:00
|
|
|
<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);
|
2012-11-14 10:40:52 -06:00
|
|
|
searchName request/search|python:'';
|
|
|
|
searchDescr python: tool.getSearch(className, searchName, descr=True);
|
2012-10-31 15:17:31 -05:00
|
|
|
sortKey request/sortKey| python:'';
|
|
|
|
sortOrder request/sortOrder| python:'asc';
|
|
|
|
filterKey request/filterKey| python:'';
|
|
|
|
filterValue request/filterValue | python:'';
|
2012-11-14 10:40:52 -06:00
|
|
|
queryResult python: tool.executeQuery(className, search=searchDescr['search'], startNumber=startNumber, remember=True, sortBy=sortKey, sortOrder=sortOrder, filterKey=filterKey, filterValue=filterValue, refObject=refObject, refField=refField);
|
2012-10-31 15:17:31 -05:00
|
|
|
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);
|
2013-03-09 09:06:12 -06:00
|
|
|
showSubTitles python: request.get('showSubTitles', 'true') == 'true';
|
2013-04-09 03:57:21 -05:00
|
|
|
resultMode python: tool.getResultMode(className);
|
2013-04-11 09:01:52 -05:00
|
|
|
showNewSearch showNewSearch|python:True;
|
|
|
|
enableLinks enableLinks|python: True">
|
2009-11-03 08:02:18 -06:00
|
|
|
|
2012-06-13 02:59:19 -05:00
|
|
|
<tal:result condition="objs">
|
|
|
|
<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>
|
2013-04-16 12:56:47 -05:00
|
|
|
<span tal:replace="structure searchDescr/translated"/>
|
2012-06-13 02:59:19 -05:00
|
|
|
(<span tal:replace="totalNumber"/>)
|
2013-04-09 03:57:21 -05:00
|
|
|
<tal:newSearch condition="python: showNewSearch and (searchName == 'customSearch')">
|
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>
|
2012-11-14 10:40:52 -06:00
|
|
|
<tal:comment replace="nothing">Search description</tal:comment>
|
|
|
|
<td tal:condition="searchDescr/translatedDescr">
|
|
|
|
<span class="discreet" tal:content="searchDescr/translatedDescr"></span><br/>
|
2012-06-13 02:59:19 -05:00
|
|
|
</td>
|
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-06-29 07:06:01 -05:00
|
|
|
|
2013-03-09 09:06:12 -06:00
|
|
|
<tal:comment replace="nothing">Results, as a list or grid</tal:comment>
|
|
|
|
<tal:res define="columnLayouts python: tool.getResultColumnsLayouts(className, refInfo);
|
2013-03-10 01:29:53 -06:00
|
|
|
columns python: objs[0].getColumnsSpecifiers(columnLayouts, dir);
|
|
|
|
global currentNumber python: 0">
|
2013-03-09 09:06:12 -06:00
|
|
|
<tal:asList condition="python: resultMode == 'list'">
|
|
|
|
<metal:list use-macro="context/ui/result/macros/list"/>
|
|
|
|
</tal:asList>
|
|
|
|
<tal:asGrid condition="python: resultMode != 'list'">
|
|
|
|
<metal:grid use-macro="context/ui/result/macros/grid"/>
|
|
|
|
</tal:asGrid>
|
|
|
|
</tal:res>
|
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')"/>
|
2013-04-09 03:57:21 -05:00
|
|
|
<tal:newSearch condition="python: showNewSearch and (searchName == 'customSearch')">
|
2010-01-06 11:36:16 -06:00
|
|
|
<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>
|
2012-10-31 15:17:31 -05:00
|
|
|
</div>
|