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 @@ ...@@ -40,38 +40,98 @@
<value> <string encoding="cdata"><![CDATA[ <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 <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 <tal:block metal:use-macro="here/style_macros/macros/style_macro"/>\n
<office:scripts/>\n <office:scripts/>\n
\n
<office:body metal:define-macro="form_layout">\n <office:body metal:define-macro="form_layout">\n
<office:spreadsheet>\n <office:spreadsheet>\n
\n \n
\n <tal:block metal:define-macro="field_render" \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:define="field_meta_type python: field.meta_type == \'ProxyField\' and field.getRecursiveTemplateField().meta_type or field.meta_type">\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:condition="python: field_meta_type == \'MatrixBox\'">\n
<tal:block tal:define="matrixbox python:field;">\n <tal:block tal:define="matrixbox python:field;">\n
<tal:block metal:use-macro="here/matrixbox_ods_macro/macros/matrixbox" />\n <tal:block metal:use-macro="here/matrixbox_ods_macro/macros/matrixbox" />\n
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>\n
<tal:block tal:condition="python: field_meta_type == \'ListBox\'">\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 metal:use-macro="here/listbox_ods_macro/macros/listbox" />\n
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>\n
<tal:block tal:condition="python: field_meta_type not in (\'ListBox\', \'MatrixBox\', \'OOoChart\')">\n <!-- Add the title and the value for standard fields -->\n
<tal:block tal:define="warning_log python: context.log(\'field_ods_macro ignored field:%s\' % field)"/>\n <tal:block tal:condition="python: field_meta_type not in (\'MatrixBox\', \'ListBox\')">\n
<table:table-row table:style-name="ro2">\n <tal:block tal:define="field python:field;">\n
<table:table-cell/>\n <tal:block metal:use-macro="here/field_ods_macro/macros/standard_field_value" />\n
</table:table-row>\n </tal:block>\n
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>\n
\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 \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 <!-- 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 `field` is optional and is only defined when we have an editable field for this column or cell.\n
-->\n -->\n
......
...@@ -61,112 +61,17 @@ dQEAAAAA</string> </value> ...@@ -61,112 +61,17 @@ dQEAAAAA</string> </value>
table:style-name=\'co2\'\n table:style-name=\'co2\'\n
table:default-cell-style-name=\'report-column-title\'/>\n table:default-cell-style-name=\'report-column-title\'/>\n
\n \n
<!-- macro form_layout -->\n
<tal:block metal:define-macro="form_layout">\n <tal:block metal:define-macro="form_layout">\n
\n <tal:block tal:define="global group_list python:form.get_groups()"/>\n
<!-- if we have other fields to display, calculate max column len, which will be used later to make standard fields (ie. not listbox) using covered cells -->\n <!-- Use the user preferences -->\n
<tal:block tal:condition="python: len(form.get_fields()) &gt; 1">\n <tal:block tal:repeat="group python: [g for g in group_list if g not in (\'hidden\', )]">\n
<tal:block tal:condition="report_item | nothing">\n
<tal:block tal:define="global column_len python: report_item.selection_columns and len(report_item.selection_columns) or 0;"/>\n
</tal:block>\n
<tal:block>\n
<tal:block tal:condition="not: column_len | nothing"\n
tal:define="field_list python:form.get_fields_in_group(\'bottom\')"> \n
<tal:block tal:define="global column_len python: 5"/>\n
<!-- This default is used for the ERP5 Report itself, which often does not contain a listbox directly -->\n
<tal:block tal:condition=\'field_list\'>\n
<tal:block tal:define="field python:field_list[0]">\n
<tal:block tal:condition="python:field.meta_type == \'ListBox\' or (field.meta_type == \'ProxyField\' and field.getRecursiveTemplateField().meta_type == \'ListBox\')">\n
<tal:block tal:define="column_list python: field.get_value(\'columns\');\n
global column_len python: len(column_list)" />\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
\n
<tal:block tal:define="dummy python: request.set(\'here\', here)">\n
<tal:block tal:repeat="group python: [g for g in form.get_groups() if g not in (\'bottom\', \'hidden\')]">\n
<tal:block tal:define="field_list python: form.get_fields_in_group(group)">\n
<tal:block tal:condition="python: field_list not in [None, []]">\n
<tal:block tal:repeat="field field_list">\n
<tal:block tal:condition="python:field.meta_type != \'HiddenStringField\' and field.meta_type != \'OOoChart\'">\n
<table:table-row table:style-name=\'ro2\'>\n
\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
\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
<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: column_len-1"\n
office:value-type=\'string\'\n
tal:define="value python: field.get_value(\'default\')">\n
\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]"\n
tal:on-error="item"></text:p>\n
</tal:block>\n
</tal:block>\n
\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"\n
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"\n
tal:content="python: displayed_value_list[0]" />\n
<text:p tal:condition="not: displayed_value_list"\n
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
</tal:block>\n
\n
<table:table-row>\n
<table:table-cell table:style-name=\'Default\'/>\n
</table:table-row>\n
\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
<tal:block tal:define="field_list python:form.get_fields_in_group(\'bottom\')">\n
<tal:block tal:repeat="field field_list">\n
<tal:block metal:use-macro="here/field_ods_macro/macros/bottom_group_field" />\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
\n
<tal:block tal:repeat="group python: [g for g in form.get_groups() if g not in (\'hidden\', )]">\n
<tal:block tal:define="field_list python: form.get_fields_in_group(group)">\n <tal:block tal:define="field_list python: form.get_fields_in_group(group)">\n
<tal:block tal:condition="python: field_list not in [None, []]">\n <tal:block tal:condition="python: field_list not in [None, []]">\n
\n
<tal:block tal:repeat="field field_list">\n <tal:block tal:repeat="field field_list">\n
<tal:block tal:condition="python:field.meta_type != \'HiddenStringField\'\n <tal:block tal:condition="python:field.meta_type != \'HiddenStringField\'\n
and field.meta_type == \'OOoChart\' or (field.meta_type == \'ProxyField\' and field.getRecursiveTemplateField().meta_type == \'OOoChart\')">\n and field.meta_type == \'OOoChart\' or (field.meta_type == \'ProxyField\' and field.getRecursiveTemplateField().meta_type == \'OOoChart\')">\n
<table:table-row table:style-name=\'ro2\'>\n <table:table-row table:style-name=\'ro2\'>\n
\n
<table:table-cell table:number-rows-spanned=\'1\'\n <table:table-cell table:number-rows-spanned=\'1\'\n
table:style-name=\'report-column-title\'\n table:style-name=\'report-column-title\'\n
table:number-columns-spanned=\'1\'\n table:number-columns-spanned=\'1\'\n
...@@ -197,9 +102,38 @@ dQEAAAAA</string> </value> ...@@ -197,9 +102,38 @@ dQEAAAAA</string> </value>
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>\n
\n
<!-- Calculating by group the max length of columns to merge -->\n
<tal:block tal:repeat="group python: [g for g in group_list if g not in (\'hidden\', )]">\n
<!-- if we have other fields to display, calculate max column len, which will be used \n
later to make standard fields (ie. not listbox) using covered cells -->\n
<tal:block tal:define="global field_list python: form.get_fields_in_group(group)"/>\n
<tal:block tal:condition="python:len(field_list) &gt; 0">\n
<tal:block tal:define="global column_len python: 5"/>\n
<tal:block tal:condition="report_item | nothing">\n
<tal:block tal:define="global column_len python: report_item.selection_columns and len(report_item.selection_columns) or 0;"/>\n
</tal:block>\n
<tal:block tal:condition="python: column_len &lt; 6">\n
<tal:block tal:repeat="field python:field_list">\n
<tal:block tal:condition="python:field.meta_type == \'ListBox\' or (field.meta_type == \'ProxyField\' and field.getRecursiveTemplateField().meta_type == \'ListBox\')">\n
<tal:block tal:define="column_list python: field.get_value(\'columns\');\n
global column_len python: max(column_len, len(column_list))" />\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
<!-- Display field -->\n
<tal:block tal:repeat="field python:field_list">\n
<tal:block metal:use-macro="form/field_ods_macro/macros/field_render" />\n
</tal:block>\n
</tal:block>\n
<table:table-row>\n
<table:table-cell table:style-name=\'Default\'/>\n
</table:table-row>\n
</tal:block>\n
</tal:block>\n
</table:table>\n </table:table>\n
</office:spreadsheet>\n </office:spreadsheet>\n
</office:body>\n </office:body>\n
</office:document-content>\n </office:document-content>\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