appypod-rattail/gen/ui/result.pt

158 lines
7.7 KiB
Plaintext
Raw Normal View History

<metal:queryResults define-macro="queryResult"
2011-11-25 11:01:20 -06:00
tal:define="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 '';
2009-11-17 03:05:19 -06:00
startNumber request/startNumber|python:'0';
startNumber python: int(startNumber);
searchName request/search;
2011-11-25 11:01:20 -06:00
labelId python: searchName and ('%s_search_%s' % (className, searchName)) or '';
labelId python: (searchName == '_advanced') and 'search_results' or labelId;
searchLabel python: labelId and tool.translate(labelId) or '';
2011-11-25 11:01:20 -06:00
severalTypes python: className and (className.find(',') != -1);
sortKey request/sortKey| python:'';
sortOrder request/sortOrder| python:'asc';
filterKey request/filterKey| python:'';
filterValue request/filterValue | python:'';
2011-11-25 11:01:20 -06:00
queryResult python: tool.executeQuery(className, searchName, startNumber, remember=True, sortBy=sortKey, sortOrder=sortOrder, filterKey=filterKey, filterValue=filterValue, refObject=refObject, refField=refField);
2009-11-17 03:05:19 -06:00
objs queryResult/objects;
totalNumber queryResult/totalNumber;
batchSize queryResult/batchSize;
ajaxHookId python:'queryResult';
2011-11-25 11:01:20 -06:00
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)">
<tal:result condition="objs">
2009-11-17 03:05:19 -06:00
<fieldset>
<legend>
2011-11-25 11:01:20 -06:00
<span tal:replace="structure python: test(searchName, searchLabel, test(severalTypes, tool.translate(tool.getAppName()), tool.translate('%s_plural' % className)))"/>
2009-11-17 03:05:19 -06:00
(<span tal:replace="totalNumber"/>)
<tal:newSearch condition="python: searchName == '_advanced'">
&nbsp;&mdash;&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>
<tal:comment replace="nothing">Display here POD templates if required.</tal:comment>
2011-09-18 08:00:05 -05:00
<table align="right"
2011-11-25 11:01:20 -06:00
tal:define="widgets python: tool.getResultPodFields(className);
layoutType python:'view'"
tal:condition="python: objs and widgets">
<tr><td tal:define="contextObj python: objs[0]"
tal:repeat="widget widgets">
2011-11-25 11:01:20 -06:00
<metal:pod use-macro="context/ui/widgets/show/macros/field"/>&nbsp;&nbsp;&nbsp;
</td></tr>
</table>
2011-09-18 08:00:05 -05:00
<table 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/>
2009-11-17 03:05:19 -06:00
</td>
</tal:descr>
<td align="right" width="25%">
<tal:comment replace="nothing">Appy (top) navigation</tal:comment>
2011-11-25 11:01:20 -06:00
<metal:nav use-macro="context/ui/navigate/macros/appyNavigate"/>
2009-11-17 03:05:19 -06:00
</td>
</tr>
</table>
2009-11-17 03:05:19 -06:00
2011-11-25 11:01:20 -06:00
<table tal:define="fieldNames python: tool.getResultColumnsNames(className, refInfo);
widgets python: objs[0].getAppyTypesFromNames(fieldNames);"
2011-09-18 08:00:05 -05:00
class="list" width="100%">
<tal:comment replace="nothing">Headers, with filters and sort arrows</tal:comment>
2009-06-29 07:06:01 -05:00
<tr>
<tal:header repeat="widget widgets">
2011-11-25 11:01:20 -06:00
<th tal:define="sortable python: tool.isSortable(widget['name'], className, 'search');
filterable widget/filterable|nothing;">
<span tal:replace="structure python: tool.truncateText(tool.translate(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>
</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>
2009-06-29 07:06:01 -05:00
</th>
<tal:comment replace="nothing">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: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);"
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">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')">
2011-11-25 11:01:20 -06:00
<metal:field use-macro="context/ui/widgets/show/macros/field"/>
</tal:field>
</td>
</tal:fields>
2009-06-29 07:06:01 -05: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"
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="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);"
tal:attributes="href python: obj.getUrl(mode='edit', page='main', nav=navInfo)"
2011-09-18 08:00:05 -05:00
tal:condition="python: obj.allows('Modify portal content')">
<img title="Edit" tal:attributes="src string: $appUrl/ui/edit.gif"/>
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>
<img tal:condition="python: obj.allows('Delete objects') and obj.mayDelete()"
title="Delete" style="cursor:pointer"
2011-11-25 11:01:20 -06:00
tal:attributes="src string: $appUrl/ui/delete.png;
onClick python:'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>
2011-11-25 11:01:20 -06:00
<metal:nav use-macro="here/ui/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>