Add the display of listbox and matrix with their title into all group (left, right, center, bottom)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34320 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3fa6b9af
......@@ -40,38 +40,98 @@
<value> <string encoding="cdata"><![CDATA[
<tal:block xmlns:draw=\'urn:oasis:names:tc:opendocument:xmlns:drawing:1.0\' xmlns:office=\'urn:oasis:names:tc:opendocument:xmlns:office:1.0\' xmlns:text=\'urn:oasis:names:tc:opendocument:xmlns:text:1.0\' xmlns:ooo=\'http://openoffice.org/2004/office\' xmlns:number=\'urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0\' xmlns:dc=\'http://purl.org/dc/elements/1.1/\' xmlns:meta=\'urn:oasis:names:tc:opendocument:xmlns:meta:1.0\' xmlns:table=\'urn:oasis:names:tc:opendocument:xmlns:table:1.0\' xmlns:dr3d=\'urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0\' xmlns:fo=\'urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0\' xmlns:style=\'urn:oasis:names:tc:opendocument:xmlns:style:1.0\' xmlns:xforms=\'http://www.w3.org/2002/xforms\' xmlns:form=\'urn:oasis:names:tc:opendocument:xmlns:form:1.0\' xmlns:script=\'urn:oasis:names:tc:opendocument:xmlns:script:1.0\' xmlns:ooow=\'http://openoffice.org/2004/writer\' xmlns:svg=\'urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0\' xmlns:chart=\'urn:oasis:names:tc:opendocument:xmlns:chart:1.0\' xmlns:dom=\'http://www.w3.org/2001/xml-events\' xmlns:xlink=\'http://www.w3.org/1999/xlink\' xmlns:xsd=\'http://www.w3.org/2001/XMLSchema\' xmlns:xsi=\'http://www.w3.org/2001/XMLSchema-instance\' xmlns:oooc=\'http://openoffice.org/2004/calc\' xmlns:math=\'http://www.w3.org/1998/Math/MathML\' xmlns:tal=\'http://xml.zope.org/namespaces/tal\' xmlns:i18n=\'http://xml.zope.org/namespaces/i18n\' xmlns:metal=\'http://xml.zope.org/namespaces/metal\' office:version=\'1.0\' metal:define-macro="master" tal:attributes=\'dummy python:request.RESPONSE.setHeader("Content-Type", "text/html;; charset=utf-8")\'>\n
\n
<tal:block metal:use-macro="here/style_macros/macros/style_macro"/>\n
<office:scripts/>\n
\n
<office:body metal:define-macro="form_layout">\n
<office:spreadsheet>\n
\n
\n
<!-- Render the field in the bottom group. `field` must be defined.\n
The field in the bottom group, can be ListBoxField, MatrixBoxField or a ProxyField to one of thoses.\n
-->\n
<tal:block metal:define-macro="bottom_group_field"\n
<tal:block metal:define-macro="field_render" \n
tal:define="field_meta_type python: field.meta_type == \'ProxyField\' and field.getRecursiveTemplateField().meta_type or field.meta_type">\n
<tal:block tal:condition="python: field_meta_type in (\'MatrixBox\', \'ListBox\')">\n
<!-- for Listbox and Matrix add a new line -->\n
<table:table-row>\n
<table:table-cell table:style-name=\'Default\'/>\n
</table:table-row>\n
<!-- for Listbox and Matrix, the title is added -->\n
<table:table-row table:style-name=\'ro2\'>\n
<!-- field title -->\n
<table:table-cell table:number-rows-spanned=\'1\'\n
table:style-name=\'report-column-title\'\n
table:number-columns-spanned=\'1\'\n
office:value-type=\'string\'>\n
<text:p tal:content="python:here.Localizer.erp5_ui.gettext(field.get_value(\'title\')).encode(\'utf-8\')">\n
</text:p>\n
</table:table-cell>\n
</table:table-row>\n
</tal:block>\n
<!-- Add values -->\n
<tal:block tal:condition="python: field_meta_type == \'MatrixBox\'">\n
<tal:block tal:define="matrixbox python:field;">\n
<tal:block metal:use-macro="here/matrixbox_ods_macro/macros/matrixbox" />\n
</tal:block>\n
</tal:block>\n
<tal:block tal:condition="python: field_meta_type == \'ListBox\'">\n
<tal:block tal:define="listbox python:field;" >\n
<tal:block tal:define="listbox python:field;">\n
<tal:block metal:use-macro="here/listbox_ods_macro/macros/listbox" />\n
</tal:block>\n
</tal:block>\n
<tal:block tal:condition="python: field_meta_type not in (\'ListBox\', \'MatrixBox\', \'OOoChart\')">\n
<tal:block tal:define="warning_log python: context.log(\'field_ods_macro ignored field:%s\' % field)"/>\n
<table:table-row table:style-name="ro2">\n
<table:table-cell/>\n
</table:table-row>\n
<!-- Add the title and the value for standard fields -->\n
<tal:block tal:condition="python: field_meta_type not in (\'MatrixBox\', \'ListBox\')">\n
<tal:block tal:define="field python:field;">\n
<tal:block metal:use-macro="here/field_ods_macro/macros/standard_field_value" />\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
\n
<!-- Render a value for the field which is not a Listbox / MatrixBox -->\n
<tal:block metal:define-macro="standard_field_value">\n
<table:table-row table:style-name=\'ro2\'>\n
<tal:block tal:condition="python:group != \'bottom\'">\n
<!-- field title -->\n
<table:table-cell table:number-rows-spanned=\'1\'\n
table:style-name=\'report-column-title\'\n
table:number-columns-spanned=\'1\'\n
office:value-type=\'string\'>\n
<text:p tal:content="python:here.Localizer.erp5_ui.gettext(field.get_value(\'title\')).encode(\'utf-8\')">\n
</text:p>\n
</table:table-cell>\n
</tal:block>\n
\n
<!-- field value -->\n
<tal:block tal:define="item_list python:field.has_value(\'items\') and field.get_value(\'items\') or None"\n
tal:condition="python: field.get_value(\'title\')">\n
<!-- if the group bottom there isn\'t a title -->\n
<table:table-cell table:number-rows-spanned=\'1\'\n
table:style-name=\'report-content-heading2-with-lines\'\n
tal:attributes="table:number-columns-spanned python:group == \'bottom\' and column_len or column_len-1"\n
office:value-type=\'string\'\n
tal:define="value python: field.get_value(\'default\')">\n
<tal:block tal:condition="python: same_type(value, []) or same_type(value, ())">\n
<tal:block tal:repeat="item value">\n
<text:p tal:condition="not:item_list" tal:content="item"></text:p>\n
<text:p tal:condition="item_list" tal:content="python: [i[0] for i in item_list if i[1] == item][0]"></text:p>\n
</tal:block>\n
</tal:block>\n
<tal:block tal:condition="python: (not (same_type(value, []) or same_type(value, ()))) and value is not None">\n
<text:p tal:condition="not: item_list" tal:content="value">\n
</text:p>\n
<tal:block tal:condition="python: value != \'\'">\n
<tal:block tal:condition="item_list">\n
<tal:block tal:define="displayed_value_list python: [str(i[0]).replace(\'&amp;\', \'\') for i in item_list if i[1] == value]">\n
<text:p tal:condition="displayed_value_list" tal:content="python: displayed_value_list[0]" />\n
<text:p tal:condition="not: displayed_value_list" tal:content="python: value" />\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
<tal:block tal:condition="python: value is None">\n
<text:p table:style="Default" tal:content="python: \' \'" />\n
</tal:block>\n
</tal:block>\n
</table:table-cell>\n
</tal:block>\n
</table:table-row>\n
</tal:block>\n
\n
<!-- Render a value for a field in a Listbox / MatrixBox. `value` must be defined,\n
`field` is optional and is only defined when we have an editable field for this column or cell.\n
-->\n
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment