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:use-macro="item/report_macros/params" />
<div metal:define-macro="buttons"> <div metal:define-macro="buttons">
<input type="submit" name="report_execute" value="Execute Report" <input type="submit" name="report_execute" value="Execute Report"
i18n:attributes="value" tal:attributes="value item/reportExecuteTitle|string:Execute Report"
tal:condition="item/queryFields" /> i18n:attributes="value" />
<input type="submit" <input type="submit"
tal:condition="item/reportDownload" tal:condition="item/reportDownload"
tal:attributes="name string:${item/reportDownload}:method; tal:attributes="name string:${item/reportDownload}:method;
value item/reportDownloadTitle" /> value item/reportDownloadTitle"
i18n:attributes="value" />
</div> </div>
<br /> <br />
</form> </form>
@ -42,7 +43,8 @@
<tr tal:repeat="field item/queryFields"> <tr tal:repeat="field item/queryFields">
<tal:field define="fieldType field/fieldType; <tal:field define="fieldType field/fieldType;
crit python:criteria and criteria.get(field.name)"> 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> <td><metal:field use-macro="item/report_macros/?fieldType" /></td>
</tal:field> </tal:field>
</tr> </tr>
@ -77,4 +79,30 @@
</metal:field> </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> </html>

View file

@ -48,7 +48,8 @@ class ReportView(ConceptView):
@Lazy @Lazy
def report_macros(self): 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 @Lazy
def macro(self): def macro(self):

View file

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