2009-11-03 08:02:18 -06:00
|
|
|
<metal:queryResults define-macro="queryResult"
|
2009-11-17 03:05:19 -06:00
|
|
|
tal:define="tool python: contextObj;
|
|
|
|
contentType request/type_name;
|
|
|
|
startNumber request/startNumber|python:'0';
|
|
|
|
startNumber python: int(startNumber);
|
|
|
|
searchName request/search;
|
2009-12-30 10:12:18 -06:00
|
|
|
searchLabel python: test(searchName=='_advanced', 'search_results', '%s_search_%s' % (contentType, searchName));
|
2009-11-17 03:05:19 -06:00
|
|
|
searchDescr python: '%s_descr' % searchLabel;
|
|
|
|
severalTypes python: contentType and (contentType.find(',') != -1);
|
2010-04-30 05:05:29 -05:00
|
|
|
sortKey request/sortKey| python:'';
|
|
|
|
sortOrder request/sortOrder| python:'asc';
|
|
|
|
filterKey request/filterKey| python:'';
|
|
|
|
filterValue request/filterValue | python:'';
|
2010-10-14 07:43:56 -05:00
|
|
|
queryResult python: tool.executeQuery(contentType, searchName, startNumber, remember=True, sortBy=sortKey, sortOrder=sortOrder, filterKey=filterKey, filterValue=filterValue);
|
2009-11-17 03:05:19 -06:00
|
|
|
objs queryResult/objects;
|
|
|
|
totalNumber queryResult/totalNumber;
|
|
|
|
batchSize queryResult/batchSize;
|
|
|
|
ajaxHookId python:'queryResult';
|
2010-10-14 07:43:56 -05:00
|
|
|
navBaseCall python: 'askQueryResult(\'%s\',\'%s\',\'%s\',\'%s\',**v**)' % (ajaxHookId, tool.absolute_url(), contentType, searchName);
|
|
|
|
newSearchUrl python: '%s/skyn/search?type_name=%s&' % (tool.getAppFolder().absolute_url(), contentType);">
|
2009-11-03 08:02:18 -06:00
|
|
|
|
|
|
|
<tal:result condition="objs">
|
|
|
|
|
2009-11-17 03:05:19 -06:00
|
|
|
<fieldset>
|
|
|
|
<legend>
|
|
|
|
<span tal:replace="structure python: test(searchName, tool.translate(searchLabel), test(severalTypes, tool.translate(tool.getAppName()), tool.translate('%s_plural' % contentType)))"/>
|
|
|
|
(<span tal:replace="totalNumber"/>)
|
2010-01-06 11:36:16 -06:00
|
|
|
<tal:newSearch condition="python: searchName == '_advanced'">
|
|
|
|
— <i><a tal:attributes="href newSearchUrl"
|
|
|
|
tal:content="python: tool.translate('search_new')"></a></i>
|
|
|
|
</tal:newSearch>
|
2009-11-17 03:05:19 -06:00
|
|
|
</legend>
|
2009-11-03 08:02:18 -06:00
|
|
|
|
2009-11-17 03:05:19 -06:00
|
|
|
<table cellpadding="0" cellspacing="0" width="100%"><tr>
|
2009-11-17 08:46:41 -06:00
|
|
|
<td tal:define="descr python: tool.translate(searchDescr)"
|
|
|
|
tal:condition="python: searchName and descr">
|
|
|
|
<span class="discreet" tal:content="descr"></span><br/><br/>
|
2009-11-17 03:05:19 -06:00
|
|
|
</td>
|
2009-11-24 15:41:42 -06:00
|
|
|
<td align="right" width="25%">
|
2009-11-17 03:05:19 -06:00
|
|
|
<tal:comment replace="nothing">Appy (top) navigation</tal:comment>
|
2010-04-30 05:05:29 -05:00
|
|
|
<metal:nav use-macro="here/skyn/navigate/macros/appyNavigate"/>
|
2009-11-17 03:05:19 -06:00
|
|
|
</td>
|
|
|
|
</tr></table>
|
|
|
|
|
|
|
|
<table tal:define="fieldDescrs python: tool.getResultColumns(objs[0], contentType)"
|
2009-12-15 14:30:43 -06:00
|
|
|
class="listing nosort" width="100%" cellpadding="0" cellspacing="0">
|
2010-08-05 11:23:17 -05:00
|
|
|
<tal:comment replace="nothing">Every item in fieldDescrs is an Appy type (dict version),
|
2009-10-18 07:52:27 -05:00
|
|
|
excepted for workflow state (which is not a field): in this case it is simply the
|
2010-04-30 07:43:44 -05:00
|
|
|
string "workflow_state".</tal:comment>
|
2009-06-29 07:06:01 -05:00
|
|
|
|
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>
|
|
|
|
<tal:comment replace="nothing">Mandatory column "Title"/"Name"</tal:comment>
|
2010-04-30 05:05:29 -05:00
|
|
|
|
|
|
|
<th tal:define="fieldName python:'title'; sortable python:True; filterable python:True">
|
2010-09-20 04:33:54 -05:00
|
|
|
<span tal:replace="structure python: tool.truncateText(tool.translate('ref_name'))"/>
|
2010-04-30 05:05:29 -05:00
|
|
|
<metal:sortAndFilter use-macro="here/skyn/navigate/macros/sortAndFilter"/>
|
2009-06-29 07:06:01 -05:00
|
|
|
</th>
|
|
|
|
|
|
|
|
<tal:comment replace="nothing">Columns corresponding to other fields</tal:comment>
|
|
|
|
<tal:columnHeader repeat="fieldDescr fieldDescrs">
|
2010-08-05 11:23:17 -05:00
|
|
|
<th tal:define="fieldName fieldDescr/name|string:workflow_state;
|
2010-09-20 04:33:54 -05:00
|
|
|
sortable python: tool.isSortable(fieldName, contentType, 'search');
|
2010-04-30 05:05:29 -05:00
|
|
|
filterable fieldDescr/filterable|nothing;">
|
2009-06-29 07:06:01 -05:00
|
|
|
<tal:comment replace="nothing">Display header for a "standard" field</tal:comment>
|
|
|
|
<tal:standardField condition="python: fieldName != 'workflow_state'">
|
2010-09-20 04:33:54 -05:00
|
|
|
<span tal:replace="structure python: tool.truncateText(tool.translate(fieldDescr['labelId']))"/>
|
2009-06-29 07:06:01 -05:00
|
|
|
</tal:standardField>
|
|
|
|
<tal:comment replace="nothing">Display header for the workflow state</tal:comment>
|
|
|
|
<tal:workflowState condition="python: fieldName == 'workflow_state'">
|
2009-10-18 07:52:27 -05:00
|
|
|
<span tal:replace="python: tool.translate('workflow_state')"/>
|
2009-06-29 07:06:01 -05:00
|
|
|
</tal:workflowState>
|
2010-04-30 05:05:29 -05:00
|
|
|
<metal:sortAndFilter use-macro="here/skyn/navigate/macros/sortAndFilter"/>
|
2009-06-29 07:06:01 -05:00
|
|
|
</th>
|
|
|
|
</tal:columnHeader>
|
|
|
|
|
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>
|
2010-04-30 05:05:29 -05:00
|
|
|
<th tal:condition="severalTypes">
|
2009-10-18 07:52:27 -05:00
|
|
|
<span tal:replace="python: tool.translate('root_type')"/>
|
2009-06-29 07:06:01 -05:00
|
|
|
</th>
|
|
|
|
|
|
|
|
<tal:comment replace="nothing">Column "Actions"</tal:comment>
|
2009-10-18 07:52:27 -05:00
|
|
|
<th tal:content="python: tool.translate('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
|
|
|
|
|
|
|
<tal:comment replace="nothing">Mandatory column "Title"/"Name"</tal:comment>
|
2009-11-17 03:05:19 -06:00
|
|
|
<td id="field_title"><a
|
2010-10-14 07:43:56 -05:00
|
|
|
tal:define="navInfo python:'search.%s.%s.%d.%d' % (contentType, searchName, repeat['obj'].number()+startNumber, totalNumber);"
|
2010-09-17 08:32:48 -05:00
|
|
|
tal:content="obj/Title" tal:attributes="href python: obj.getUrl(nav=navInfo, page='main')"></a></td>
|
2009-06-29 07:06:01 -05:00
|
|
|
|
|
|
|
<tal:comment replace="nothing">Columns corresponding to other fields</tal:comment>
|
2010-08-05 11:23:17 -05:00
|
|
|
<tal:otherFields repeat="widget fieldDescrs">
|
|
|
|
<tal:standardField condition="python: widget != 'workflowState'">
|
|
|
|
<td tal:condition="python: '_wrong' not in widget"
|
|
|
|
tal:attributes="id python:'field_%s' % widget['name']">
|
2009-06-29 07:06:01 -05:00
|
|
|
<tal:field define="contextObj python:obj;
|
2010-08-05 11:23:17 -05:00
|
|
|
layoutType python:'cell';
|
2009-06-29 07:06:01 -05:00
|
|
|
innerRef python:True"
|
2010-08-05 11:23:17 -05:00
|
|
|
condition="python: contextObj.showField(widget['name'], 'view')">
|
|
|
|
<metal:field use-macro="here/skyn/widgets/show/macros/field"/>
|
2009-06-29 07:06:01 -05:00
|
|
|
</tal:field>
|
|
|
|
</td>
|
2010-08-05 11:23:17 -05:00
|
|
|
<td tal:condition="python: '_wrong' in widget" style="color:red">Field
|
|
|
|
<span tal:replace="widget/name"/> not found.
|
2009-07-10 08:01:50 -05:00
|
|
|
</td>
|
2009-06-29 07:06:01 -05:00
|
|
|
</tal:standardField>
|
2010-08-05 11:23:17 -05:00
|
|
|
<tal:workflowState condition="python: widget == 'workflowState'">
|
2009-10-18 07:52:27 -05:00
|
|
|
<td id="field_workflow_state" tal:content="python: tool.translate(obj.getWorkflowLabel())"></td>
|
2009-06-29 07:06:01 -05:00
|
|
|
</tal:workflowState>
|
|
|
|
</tal:otherFields>
|
|
|
|
|
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"
|
2009-10-18 07:52:27 -05:00
|
|
|
tal:content="python: tool.translate(obj.portal_type)"></td>
|
2009-06-29 07:06:01 -05:00
|
|
|
|
|
|
|
<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>
|
2010-09-17 08:32:48 -05:00
|
|
|
<td class="noPadding">
|
2010-10-14 07:43:56 -05:00
|
|
|
<a tal:define="navInfo python:'search.%s.%s.%d.%d' % (contentType, searchName, repeat['obj'].number()+startNumber, totalNumber);"
|
2010-09-17 08:32:48 -05:00
|
|
|
tal:attributes="href python: obj.getUrl(mode='edit', page='main', nav=navInfo)"
|
|
|
|
tal:condition="python: member.has_permission('Modify portal content', obj)">
|
2009-11-25 13:37:22 -06:00
|
|
|
<img title="Edit" i18n:domain="plone" i18n:attributes="title"
|
|
|
|
tal:attributes="src string: $portal_url/skyn/edit.gif"/>
|
2009-06-29 07:06:01 -05:00
|
|
|
</a></td>
|
|
|
|
<tal:comment replace="nothing">Delete the element</tal:comment>
|
2009-10-20 09:57:00 -05:00
|
|
|
<td class="noPadding">
|
|
|
|
<img tal:condition="python: member.has_permission('Delete objects', obj)"
|
2009-11-24 15:41:42 -06:00
|
|
|
title="Delete" i18n:domain="plone" i18n:attributes="title" style="cursor:pointer"
|
|
|
|
tal:attributes="src string: $portal_url/skyn/delete.png;
|
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>
|
2009-11-17 03:05:19 -06:00
|
|
|
</table>
|
2009-06-29 07:06:01 -05:00
|
|
|
|
2009-11-17 03:05:19 -06:00
|
|
|
<tal:comment replace="nothing">Appy (bottom) navigation</tal:comment>
|
2010-04-30 05:05:29 -05:00
|
|
|
<metal:nav use-macro="here/skyn/navigate/macros/appyNavigate"/>
|
2009-11-17 03:05:19 -06:00
|
|
|
</fieldset>
|
2009-11-03 08:02:18 -06:00
|
|
|
</tal:result>
|
|
|
|
|
2010-01-06 11:36:16 -06:00
|
|
|
<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>
|
2009-11-03 08:02:18 -06:00
|
|
|
|
|
|
|
</metal:queryResults>
|