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,145 +61,79 @@ dQEAAAAA</string> </value> ...@@ -61,145 +61,79 @@ 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="field_list python: form.get_fields_in_group(group)">\n
<tal:block tal:define="global column_len python: report_item.selection_columns and len(report_item.selection_columns) or 0;"/>\n <tal:block tal:condition="python: field_list not in [None, []]">\n
</tal:block>\n <tal:block tal:repeat="field field_list">\n
<tal:block>\n <tal:block tal:condition="python:field.meta_type != \'HiddenStringField\'\n
<tal:block tal:condition="not: column_len | nothing"\n and field.meta_type == \'OOoChart\' or (field.meta_type == \'ProxyField\' and field.getRecursiveTemplateField().meta_type == \'OOoChart\')">\n
tal:define="field_list python:form.get_fields_in_group(\'bottom\')"> \n <table:table-row table:style-name=\'ro2\'>\n
<tal:block tal:define="global column_len python: 5"/>\n <table:table-cell table:number-rows-spanned=\'1\'\n
<!-- This default is used for the ERP5 Report itself, which often does not contain a listbox directly -->\n table:style-name=\'report-column-title\'\n
<tal:block tal:condition=\'field_list\'>\n table:number-columns-spanned=\'1\'\n
<tal:block tal:define="field python:field_list[0]">\n office:value-type=\'string\'>\n
<tal:block tal:condition="python:field.meta_type == \'ListBox\' or (field.meta_type == \'ProxyField\' and field.getRecursiveTemplateField().meta_type == \'ListBox\')">\n <text:p tal:content="python:here.Localizer.erp5_ui.gettext(field.get_value (\'title\')).encode(\'utf-8\')">\n
<tal:block tal:define="column_list python: field.get_value(\'columns\');\n </text:p>\n
global column_len python: len(column_list)" />\n </table:table-cell>\n
</tal:block>\n <tal:block tal:define="display python: field.get_value(\'image_display\') "\n
</tal:block>\n tal:condition="display">\n
</tal:block>\n <tal:block tal:define="preferred_method_height_id python: \'getPreferred%sImageHeight\' % (display.capitalize());\n
</tal:block>\n preferred_method_width_id python: \'getPreferred%sImageWidth\'\n
</tal:block>\n % (display.capitalize());\n
</tal:block>\n " >\n
\n <tal:block tal:define="global height python:\'%scm\' % (int((getattr(here.portal_preferences, preferred_method_height_id)())) * 0.020) ;\n
<tal:block tal:define="dummy python: request.set(\'here\', here)">\n global width python: \'%scm\' % (int((getattr(here.portal_preferences, preferred_method_width_id)())) * 0.020 );"/>\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 </tal:block>\n
</tal:block>\n
<table:table-cell>\n
<draw:frame draw:z-index="0" draw:style-name="gr1" svg:x="0.2cm" svg:y="0.2cm" svg:width="7.996cm" svg:height="6.999cm"\n
tal:attributes="svg:height python:height;\n
svg:width python:width">\n
<tal:block tal:replace="structure python: field.render_odf(render_prefix=render_prefix)"/>\n
</draw:frame>\n
</table:table-cell>\n
</table:table-row>\n </table:table-row>\n
</tal:block>\n </tal:block>\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>\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 \n
<tal:block tal:repeat="group python: [g for g in form.get_groups() if g not in (\'hidden\', )]">\n <!-- Calculating by group the max length of columns to merge -->\n
<tal:block tal:define="field_list python: form.get_fields_in_group(group)">\n <tal:block tal:repeat="group python: [g for g in group_list if g not in (\'hidden\', )]">\n
<tal:block tal:condition="python: field_list not in [None, []]">\n <!-- if we have other fields to display, calculate max column len, which will be used \n
\n later to make standard fields (ie. not listbox) using covered cells -->\n
<tal:block tal:repeat="field field_list">\n <tal:block tal:define="global field_list python: form.get_fields_in_group(group)"/>\n
<tal:block tal:condition="python:field.meta_type != \'HiddenStringField\'\n <tal:block tal:condition="python:len(field_list) &gt; 0">\n
and field.meta_type == \'OOoChart\' or (field.meta_type == \'ProxyField\' and field.getRecursiveTemplateField().meta_type == \'OOoChart\')">\n <tal:block tal:define="global column_len python: 5"/>\n
<table:table-row table:style-name=\'ro2\'>\n <tal:block tal:condition="report_item | nothing">\n
\n <tal:block tal:define="global column_len python: report_item.selection_columns and len(report_item.selection_columns) or 0;"/>\n
<table:table-cell table:number-rows-spanned=\'1\'\n </tal:block>\n
table:style-name=\'report-column-title\'\n <tal:block tal:condition="python: column_len &lt; 6">\n
table:number-columns-spanned=\'1\'\n <tal:block tal:repeat="field python:field_list">\n
office:value-type=\'string\'>\n <tal:block tal:condition="python:field.meta_type == \'ListBox\' or (field.meta_type == \'ProxyField\' and field.getRecursiveTemplateField().meta_type == \'ListBox\')">\n
<text:p tal:content="python:here.Localizer.erp5_ui.gettext(field.get_value (\'title\')).encode(\'utf-8\')">\n <tal:block tal:define="column_list python: field.get_value(\'columns\');\n
</text:p>\n global column_len python: max(column_len, len(column_list))" />\n
</table:table-cell>\n
<tal:block tal:define="display python: field.get_value(\'image_display\') "\n
tal:condition="display">\n
<tal:block tal:define="preferred_method_height_id python: \'getPreferred%sImageHeight\' % (display.capitalize());\n
preferred_method_width_id python: \'getPreferred%sImageWidth\'\n
% (display.capitalize());\n
" >\n
<tal:block tal:define="global height python:\'%scm\' % (int((getattr(here.portal_preferences, preferred_method_height_id)())) * 0.020) ;\n
global width python: \'%scm\' % (int((getattr(here.portal_preferences, preferred_method_width_id)())) * 0.020 );"/>\n
</tal:block>\n
</tal:block>\n </tal:block>\n
<table:table-cell>\n </tal:block>\n
<draw:frame draw:z-index="0" draw:style-name="gr1" svg:x="0.2cm" svg:y="0.2cm" svg:width="7.996cm" svg:height="6.999cm"\n </tal:block>\n
tal:attributes="svg:height python:height;\n <!-- Display field -->\n
svg:width python:width">\n <tal:block tal:repeat="field python:field_list">\n
<tal:block tal:replace="structure python: field.render_odf(render_prefix=render_prefix)"/>\n <tal:block metal:use-macro="form/field_ods_macro/macros/field_render" />\n
</draw:frame>\n
</table:table-cell>\n
</table:table-row>\n
</tal:block>\n </tal:block>\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
</tal:block>\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