appypod-rattail/gen/plone25/skin/macros.pt

160 lines
8.4 KiB
Plaintext
Raw Normal View History

<metal:queryResults define-macro="queryResult"
2009-11-17 03:05:19 -06:00
tal:define="tool python: contextObj;
contentType request/type_name;
flavourNumber python: int(request['flavourNumber']);
2009-11-17 03:05:19 -06:00
startNumber request/startNumber|python:'0';
startNumber python: int(startNumber);
searchName request/search;
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);
sortKey request/sortKey| python:'';
sortOrder request/sortOrder| python:'asc';
filterKey request/filterKey| python:'';
filterValue request/filterValue | python:'';
queryResult python: tool.executeQuery(contentType, flavourNumber, 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';
navBaseCall python: 'askQueryResult(\'%s\',\'%s\',\'%s\',\'%s\',\'%s\',**v**)' % (ajaxHookId, tool.absolute_url(), contentType, flavourNumber, searchName);
newSearchUrl python: '%s/skyn/search?type_name=%s&flavourNumber=%d' % (tool.getAppFolder().absolute_url(), contentType, flavourNumber);">
<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"/>)
<tal:newSearch condition="python: searchName == '_advanced'">
&nbsp;&nbsp;—&nbsp;&nbsp;<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-17 03:05:19 -06:00
<table cellpadding="0" cellspacing="0" width="100%"><tr>
<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>
<td align="right" width="25%">
2009-11-17 03:05:19 -06:00
<tal:comment replace="nothing">Appy (top) navigation</tal:comment>
<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">
<tal:comment replace="nothing">Every item in fieldDescrs is an Appy type (dict version),
excepted for workflow state (which is not a field): in this case it is simply the
string "workflow_state".</tal:comment>
2009-06-29 07:06:01 -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>
<th tal:define="fieldName python:'title'; sortable python:True; filterable python:True">
<span tal:content="python: tool.translate('ref_name')"/>
<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">
<th tal:define="fieldName fieldDescr/name|string:workflow_state;
sortable fieldDescr/indexed|nothing;
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'">
<span tal:replace="python: 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'">
<span tal:replace="python: tool.translate('workflow_state')"/>
2009-06-29 07:06:01 -05:00
</tal:workflowState>
<metal:sortAndFilter use-macro="here/skyn/navigate/macros/sortAndFilter"/>
2009-06-29 07:06:01 -05:00
</th>
</tal:columnHeader>
<tal:comment replace="nothing">Column "Object type", shown if instances of several types are shown</tal:comment>
<th tal:condition="severalTypes">
<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>
<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
tal:define="navInfo python:'nav=search.%s:%d.%s.%d.%d' % (contentType, flavourNumber, searchName, repeat['obj'].number()+startNumber, totalNumber);"
tal:content="obj/Title" tal:attributes="href python: obj.getUrl() + '/?' + navInfo"></a></td>
2009-06-29 07:06:01 -05:00
<tal:comment replace="nothing">Columns corresponding to other fields</tal:comment>
<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;
layoutType python:'cell';
2009-06-29 07:06:01 -05:00
innerRef python:True"
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>
<td tal:condition="python: '_wrong' in widget" style="color:red">Field
<span tal:replace="widget/name"/> not found.
</td>
2009-06-29 07:06:01 -05:00
</tal:standardField>
<tal:workflowState condition="python: widget == 'workflowState'">
<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>
<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>
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>
<td class="noPadding"><a tal:attributes="href python: obj.absolute_url() + '/skyn/edit'"
2009-06-29 07:06:01 -05:00
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"/>
2009-06-29 07:06:01 -05:00
</a></td>
<tal:comment replace="nothing">Delete the element</tal:comment>
<td class="noPadding">
<img tal:condition="python: member.has_permission('Delete objects', obj)"
title="Delete" i18n:domain="plone" i18n:attributes="title" style="cursor:pointer"
tal:attributes="src string: $portal_url/skyn/delete.png;
onClick python:'javascript:onDeleteObject(\'%s\')' % obj.UID()"/>
</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>
<metal:nav use-macro="here/skyn/navigate/macros/appyNavigate"/>
2009-11-17 03:05:19 -06:00
</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>