use new merge method for controlling report macros; provide default macros for some report field types

This commit is contained in:
Helmut Merz 2014-08-12 13:08:35 +02:00
parent c28d2e88f1
commit d07daca284
3 changed files with 36 additions and 5 deletions

View file

@ -16,12 +16,13 @@
<div metal:use-macro="item/report_macros/params" />
<div metal:define-macro="buttons">
<input type="submit" name="report_execute" value="Execute Report"
i18n:attributes="value"
tal:condition="item/queryFields" />
tal:attributes="value item/reportExecuteTitle|string:Execute Report"
i18n:attributes="value" />
<input type="submit"
tal:condition="item/reportDownload"
tal:attributes="name string:${item/reportDownload}:method;
value item/reportDownloadTitle" />
value item/reportDownloadTitle"
i18n:attributes="value" />
</div>
<br />
</form>
@ -42,7 +43,8 @@
<tr tal:repeat="field item/queryFields">
<tal:field define="fieldType field/fieldType;
crit python:criteria and criteria.get(field.name)">
<td><b><span tal:content="field/title" />: </b></td>
<td><b><span tal:content="field/title"
i18n:translate="" />:&nbsp;</b></td>
<td><metal:field use-macro="item/report_macros/?fieldType" /></td>
</tal:field>
</tr>
@ -77,4 +79,30 @@
</metal:field>
<metal:input define-macro="relation"
tal:define="name field/name">
<div dojoType="dojox.data.QueryReadStore"
tal:attributes="url string:${field/storeUrl}&project=${item/adapted/uid};
jsId string:${name}_search_store" >
</div>
<input type="hidden"
name="nodeUrl"
id="nodeUrl"
tal:attributes="value item/view/nodeView/url" />
<div tal:attributes="id string:${name}_values">
<div>
<input dojoType="dijit.form.FilteringSelect"
autoComplete="False"
labelAttr="label"
searchDelay="400"
scrollOnFocus="false"
tal:attributes="store string:${name}_search_store;
name string:${name}_search;
id string:${name}_search;
onChange string:setEnhancedRelation('$name');" />
</div>
</div>
</metal:input>
</html>

View file

@ -48,7 +48,8 @@ class ReportView(ConceptView):
@Lazy
def report_macros(self):
return self.controller.getTemplateMacros('report', report_template)
return self.controller.mergeTemplateMacros('report', report_template)
#return self.controller.getTemplateMacros('report', report_template)
@Lazy
def macro(self):

View file

@ -104,6 +104,7 @@ class IntegerField(Field):
class DateField(Field):
fieldType='date',
format = ('date', 'short')
renderer = cssClass = 'center'
dbtype = 'date'
@ -211,6 +212,7 @@ class IntegerUrlField(IntegerField, UrlField):
class RelationField(Field):
fieldType = 'relation'
renderer = 'target'
displayAttribute = 'title'