159 lines
8 KiB
XML
159 lines
8 KiB
XML
<metal:queryResults define-macro="queryResult"
|
|
tal:define="tool python: contextObj;
|
|
contentType request/type_name;
|
|
refInfo tool/getRefInfo;
|
|
refField python: refInfo[1];
|
|
refInfo python: refInfo[0];
|
|
startNumber request/startNumber|python:'0';
|
|
startNumber python: int(startNumber);
|
|
searchName request/search;
|
|
labelId python: searchName and ('%s_search_%s' % (contentType, searchName)) or '';
|
|
labelId python: (searchName == '_advanced') and 'search_results' or labelId;
|
|
searchLabel python: labelId and tool.translate(labelId) or '';
|
|
severalTypes python: contentType and (contentType.find(',') != -1);
|
|
sortKey request/sortKey| python:'';
|
|
sortOrder request/sortOrder| python:'asc';
|
|
filterKey request/filterKey| python:'';
|
|
filterValue request/filterValue | python:'';
|
|
queryResult python: tool.executeQuery(contentType, searchName, startNumber, remember=True, sortBy=sortKey, sortOrder=sortOrder, filterKey=filterKey, filterValue=filterValue, 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(), contentType, searchName);
|
|
newSearchUrl python: '%s/skyn/search?type_name=%s&ref=%s' % (tool.getAppFolder().absolute_url(), contentType, refInfo);">
|
|
|
|
<tal:result condition="objs">
|
|
|
|
<fieldset>
|
|
<legend>
|
|
<span tal:replace="structure python: test(searchName, searchLabel, test(severalTypes, tool.translate(tool.getAppName()), tool.translate('%s_plural' % contentType)))"/>
|
|
(<span tal:replace="totalNumber"/>)
|
|
<tal:newSearch condition="python: searchName == '_advanced'">
|
|
— <i><a tal:attributes="href newSearchUrl"
|
|
tal:content="python: tool.translate('search_new')"></a></i>
|
|
</tal:newSearch>
|
|
</legend>
|
|
|
|
<tal:comment replace="nothing">Display here POD templates if required.</tal:comment>
|
|
<table align="right" cellpadding="0" cellspacing="0"
|
|
tal:define="widgets python: tool.getResultPodFields(contentType);
|
|
layoutType python:'view'"
|
|
tal:condition="python: objs and widgets">
|
|
<tr><td tal:define="contextObj python: objs[0]"
|
|
tal:repeat="widget widgets">
|
|
<metal:pod use-macro="here/skyn/widgets/show/macros/field"/>
|
|
</td></tr>
|
|
</table>
|
|
|
|
<table cellpadding="0" cellspacing="0" width="100%">
|
|
<tr>
|
|
<tal:descr condition="searchName">
|
|
<td tal:define="descr python: tool.translate('%s_descr' % labelId)"
|
|
tal:condition="descr/strip">
|
|
<span class="discreet" tal:content="descr"></span><br/><br/>
|
|
</td>
|
|
</tal:descr>
|
|
<td align="right" width="25%">
|
|
<tal:comment replace="nothing">Appy (top) navigation</tal:comment>
|
|
<metal:nav use-macro="here/skyn/navigate/macros/appyNavigate"/>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<table tal:define="fieldNames python: tool.getResultColumnsNames(contentType, refField);
|
|
widgets python: objs[0].getAppyTypesFromNames(fieldNames);"
|
|
class="listing nosort" width="100%" cellpadding="0" cellspacing="0">
|
|
<tal:comment replace="nothing">Headers, with filters and sort arrows</tal:comment>
|
|
<tr>
|
|
<tal:header repeat="widget widgets">
|
|
<th tal:define="sortable python: tool.isSortable(widget['name'], contentType, 'search');
|
|
filterable widget/filterable|nothing;">
|
|
<span tal:replace="structure python: tool.truncateText(tool.translate(widget['labelId']))"/>
|
|
<metal:icons use-macro="here/skyn/navigate/macros/sortAndFilter"/>
|
|
</th>
|
|
</tal:header>
|
|
<tal:comment replace="nothing">Object type, shown if instances of several types are shown</tal:comment>
|
|
<th tal:condition="severalTypes">
|
|
<span tal:replace="python: tool.translate('root_type')"></span>
|
|
</th>
|
|
<tal:comment replace="nothing">Actions</tal:comment>
|
|
<th tal:content="python: tool.translate('ref_actions')"></th>
|
|
</tr>
|
|
|
|
<tal:comment replace="nothing">Results</tal:comment>
|
|
<tal:row repeat="obj objs">
|
|
<tr id="query_row" tal:define="odd repeat/obj/odd"
|
|
tal:attributes="class python:test(odd, 'even', 'odd')">
|
|
|
|
<tal:fields repeat="widget widgets">
|
|
<tal:comment replace="nothing">Title</tal:comment>
|
|
<td id="field_title"
|
|
tal:condition="python: widget['name'] == 'title'">
|
|
<a tal:define="navInfo python:'search.%s.%s.%d.%d' % (contentType, searchName, repeat['obj'].number()+startNumber, totalNumber);"
|
|
tal:content="obj/Title" tal:attributes="href python: obj.getUrl(nav=navInfo, page='main')"></a>
|
|
</td>
|
|
|
|
<tal:comment replace="nothing">Workflow state</tal:comment>
|
|
<td id="field_workflow_state"
|
|
tal:condition="python: widget['name'] == 'state'"
|
|
tal:content="python: tool.translate(obj.getWorkflowLabel())">
|
|
</td>
|
|
|
|
<tal:comment replace="nothing">Any other field</tal:comment>
|
|
<td tal:condition="python: widget['name'] not in ('title', 'state')"
|
|
tal:attributes="id python:'field_%s' % widget['name']">
|
|
<tal:field define="contextObj python:obj;
|
|
layoutType python:'cell';
|
|
innerRef python:True"
|
|
condition="python: contextObj.showField(widget['name'], 'view')">
|
|
<metal:field use-macro="here/skyn/widgets/show/macros/field"/>
|
|
</tal:field>
|
|
</td>
|
|
</tal:fields>
|
|
|
|
<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"
|
|
tal:content="python: tool.translate(obj.portal_type)"></td>
|
|
|
|
<tal:comment replace="nothing">Column "Actions"</tal:comment>
|
|
<td align="right">
|
|
<table class="no-style-table" cellpadding="0" cellspacing="0">
|
|
<tr>
|
|
<tal:comment replace="nothing">Edit the element</tal:comment>
|
|
<td class="noPadding">
|
|
<a tal:define="navInfo python:'search.%s.%s.%d.%d' % (contentType, searchName, repeat['obj'].number()+startNumber, totalNumber);"
|
|
tal:attributes="href python: obj.getUrl(mode='edit', page='main', nav=navInfo)"
|
|
tal:condition="python: member.has_permission('Modify portal content', obj)">
|
|
<img title="Edit" i18n:domain="plone" i18n:attributes="title"
|
|
tal:attributes="src string: $portal_url/skyn/edit.gif"/>
|
|
</a></td>
|
|
<tal:comment replace="nothing">Delete the element</tal:comment>
|
|
<td class="noPadding">
|
|
<img tal:condition="python: member.has_permission('Delete objects', obj) and obj.mayDelete()"
|
|
title="Delete" i18n:domain="plone" i18n:attributes="title" style="cursor:pointer"
|
|
tal:attributes="src string: $portal_url/skyn/delete.png;
|
|
onClick python:'onDeleteObject(\'%s\')' % obj.UID()"/>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</tal:row>
|
|
</table>
|
|
|
|
<tal:comment replace="nothing">Appy (bottom) navigation</tal:comment>
|
|
<metal:nav use-macro="here/skyn/navigate/macros/appyNavigate"/>
|
|
</fieldset>
|
|
</tal:result>
|
|
|
|
<tal:noResult condition="not: objs">
|
|
<span tal:replace="python: tool.translate('query_no_result')"/>
|
|
<tal:newSearch condition="python: searchName == '_advanced'">
|
|
<br/><i class="discreet"><a tal:attributes="href newSearchUrl"
|
|
tal:content="python: tool.translate('search_new')"></a></i>
|
|
</tal:newSearch>
|
|
</tal:noResult>
|
|
|
|
</metal:queryResults>
|