Commit 8a5eac9b authored by Jérome Perrin's avatar Jérome Perrin

generate valid ODF for most cases

simplify the style for report section title (and support more than 3 levels)
drop support for getTranslatedTitle (use title instead)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17008 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e030bbc5
No related merge requests found
......@@ -64,19 +64,25 @@
<office:body>\n
<office:spreadsheet>\n
<table:table table:style-name=\'ta1\' table:print=\'false\' tal:attributes="table:name here/getTitle" >\n
<tal:block metal:define-macro="form_layout" tal:define="dummy python: request.set(\'here\', here); listbox python:form.get_fields_in_group(\'bottom\')[0]">\n
<tal:block metal:define-macro="form_layout"\n
tal:define="dummy python: request.set(\'here\', here);\n
listbox form/listbox">\n
<tal:block metal:use-macro="here/listbox_ods_macro/macros/listbox">\n
<tal:block metal:fill-slot="list_header">\n
<tal:block tal:repeat="column_item listboxline/getColumnItemList"> \n
<tal:block tal:define="column_property python: column_item[1]; column_id python: column_item[0]">\n
<table:table-column table:style-name=\'co2\' table:default-cell-style-name=\'report-column-title\'/>\n
</tal:block>\n
</tal:block>\n
<table:table-header-rows>\n
<table:table-row table:style-name=\'ro4\'>\n
<tal:block tal:condition="python: is_report_tree_mode">\n
<table:table-cell table:style-name=\'report-column-title\' table:number-columns-spanned=\'1\' office:value-type=\'string\' >\n
<tal:block tal:condition="listboxline/getSectionName">\n
<text:p tal:content="python: here.Localozer.erp5_ui.gettext(listboxline/getSectionName).encode(\'utf-8\')"/>\n
<text:p tal:content="python: here.Localizer.erp5_ui.gettext(listboxline.getSectionName()).encode(\'utf-8\')"/>\n
</tal:block>\n
</table:table-cell>\n
</tal:block>\n
<table:table-column table:style-name="co2"/>\n
<tal:block tal:condition="listboxline/isTitleLine">\n
<tal:block tal:repeat="column_item listboxline/getColumnItemList">\n
<tal:block tal:define="column_property python: column_item[1]; column_id python: column_item[0]">\n
......
......@@ -64,7 +64,12 @@ dQEAAAAA</string> </value>
<tal:block metal:use-macro="here/style_macros/macros/style_macro"/>\n
<office:body>\n
<office:spreadsheet>\n
<!-- at least one table-column element is required for ODF to validate -->\n
<table:table-column\n
table:style-name=\'co2\'\n
table:default-cell-style-name=\'report-column-title\'/>\n
\n
<!-- calculate max column len -->\n
<tal:block tal:define="field_list python:form.get_fields_in_group(\'bottom\')">\n
<tal:block tal:define="global column_len python:3"/>\n
<tal:block tal:condition=\'field_list\'>\n
......@@ -84,7 +89,6 @@ dQEAAAAA</string> </value>
<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\'">\n
<table:table-column table:style-name="co2"/>\n
<table:table-row table:style-name=\'ro2\'>\n
<table:table-cell table:number-rows-spanned=\'1\' table:style-name=\'report-column-title\' table:number-columns-spanned=\'1\' office:value-type=\'string\'>\n
<text:p tal:content="python:here.Localizer.erp5_ui.gettext(field.get_value (\'title\')).encode(\'utf-8\')"></text:p>\n
......@@ -97,14 +101,14 @@ dQEAAAAA</string> </value>
<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 != None">\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="python: str(value)">\n
</text:p>\n
<tal:block tal:condition="python:value != \'\'">\n
<text:p tal:condition="item_list" disable-output-escapint="yes" tal:content="python: [i[0].replace(\'&amp;\', \'\') for i in item_list if i[1] == value][0]">\n
<text:p tal:condition="item_list" tal:content="python: [i[0].replace(\'&amp;\', \'\') for i in item_list if i[1] == value][0]">\n
</text:p>\n
</tal:block>\n
<tal:block tal:condition="python: value == None">\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
......
......@@ -72,7 +72,6 @@
<tal:block tal:condition="python: len(listboxline_list) > 1">\n
<tal:block tal:condition="python: is_domain_tree_mode">\n
<tal:block tal:define="domain_list python: selection.getDomainList()" tal:condition="python: len(domain_list) > 0">\n
<table:table-column table:style-name="co2"/>\n
<table:table-row>\n
<table:table-cell office:value-type=\'string\'>\n
<text:p tal:content="python: domain_list[-1]"/>\n
......@@ -81,8 +80,7 @@
</tal:block>\n
</tal:block>\n
<tal:block tal:repeat="listboxline python: listboxline_list">\n
<table:table-column table:style-name=\'co2\'/>\n
<tal:block metal:define-slot="for_form_list" tal:condition="listboxline/isTitleLine | python: is_report_tree_mode">\n
<tal:block metal:define-slot="for_form_list" tal:condition="listboxline/isTitleLine | is_report_tree_mode">\n
<tal:block metal:define-slot="list_header">\n
<table:table-row table:style-name=\'ro4\'>\n
<tal:block tal:condition="python: is_report_tree_mode">\n
......@@ -93,7 +91,6 @@
</table:table-cell>\n
</tal:block>\n
\n
<table:table-column table:style-name="co2"/>\n
<tal:block tal:condition="listboxline/isTitleLine">\n
<tal:block tal:repeat="column_item listboxline/getColumnItemList">\n
<tal:block tal:define="column_property python: column_item[1]; column_id python: column_item[0]">\n
......@@ -117,7 +114,6 @@
</tal:block>\n
\n
<tal:block tal:condition="not:listboxline/isTitleLine">\n
<table:table-column table:style-name="co2"/>\n
<table:table-row>\n
<tal:block tal:condition="python: listboxline.isDataLine() or listboxline.isSummaryLine()">\n
<tal:block tal:repeat="column_item listboxline/getColumnItemList">\n
......@@ -170,14 +166,13 @@
</table:table-row>\n
</tal:block>\n
</tal:block>\n
<table:table-column table:style-name="co2"/>\n
<table:table-row metal:define-slot="table_bottom_line">\n
<tal:block tal:repeat="listboxline python: listboxline_list">\n
<tal:block tal:condition="listboxline/isTitleLine">\n
<tal:block tal:repeat="column_item listboxline/getColumnItemList">\n
<tal:block tal:define="column_property python: column_item[1]; ">\n
<tal:block tal:condition="python: column_property is not None">\n
<table:table-cell table:style-name=\'table-bottom-line\' table:number-columns-repeated=\'repeat/column_item/number\'/>\n
<table:table-cell table:style-name=\'table-bottom-line\'/>\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
......
......@@ -59,34 +59,36 @@
<office:body>\n
<office:spreadsheet>\n
\n
<tal:block tal:define="report_item_list python:report_method(); field_errors python: request.get(\'field_errors,{}\'); dummy python: request.set(\'here\', here);global sheet_per_reportsection python: int(request.get(\'sheet_per_report_section\', 0));global column_len python:3">\n
<tal:block tal:define="report_item_list python:report_method();\n
dummy python: request.set(\'here\', here);\n
global sheet_per_reportsection python: int(request.get(\'sheet_per_report_section\', 0));\n
global column_len python:5">\n
<!-- TODO: calculate column_len based on the first listbox (or selection_column if exists)-->\n
\n
<tal:block tal:define="portal_object here/portal_url/getPortalObject"> \n
<tal:block tal:condition="not: sheet_per_reportsection">\n
<table:table tal:attributes="table:name python:here.getProperty(\'title\')">\n
<!-- at least one table-column element is required for ODF to validate -->\n
<table:table-column\n
table:style-name=\'co2\'\n
table:default-cell-style-name=\'report-column-title\'/>\n
\n
<tal:block metal:use-macro="here/form_view/macros/form_layout"/>\n
\n
<tal:block tal:repeat="report_item report_item_list">\n
<tal:block metal:define-macro="make_report_item_table" tal:define="here python:report_item.getObject(portal_object); dummy python:report_item.pushReport(portal_object)">\n
<tal:block metal:define-macro="make_report_item_table"\n
tal:define="here python:report_item.getObject(portal_object);\n
dummy python:report_item.pushReport(portal_object)">\n
<tal:block tal:condition="report_item/getTitle | report_item/getTranslatedTitle">\n
<table:table-row table:style-name=\'ro2\'>\n
<tal:block tal:condition="report_item/getTitle" tal:define="level report_item/getLevel">\n
<tal:block tal:condition="python: level == 1">\n
<table:table-cell table:style-name="report-title" tal:attributes="table:number-columns-spanned python:column_len" office:value-type=\'string\' table:number-rows-spanned=\'1\'>\n
<text:p tal:content="report_item/getTitle" ></text:p>\n
</table:table-cell>\n
</tal:block>\n
<tal:block tal:condition="python: level == 2">\n
<table:table-cell table:style-name="report-title2" tal:attributes="table:number-columns-spanned python:column_len" office:value-type=\'string\' table:number-rows-spanned=\'1\'>\n
<table:table-cell table:style-name="report-title"\n
tal:attributes="table:number-columns-spanned python:column_len;\n
table:style-name python:test(level&gt;1, \'report-title%s\' % level, \'report-title\');" \n
office:value-type=\'string\'\n
table:number-rows-spanned=\'1\'>\n
<text:p tal:content="report_item/getTitle" ></text:p>\n
</table:table-cell>\n
</tal:block>\n
<tal:block tal:condition="python: level == 3">\n
<table:table-cell table:style-name="report-title3" tal:attributes="table:number-columns-spanned python:column_len" office:value-type=\'string\' table:number-rows-spanned=\'1\'>\n
<text:p tal:content="report_item/getTitle"></text:p>\n
</table:table-cell>\n
</tal:block>\n
</tal:block>\n
<tal:block tal:condition="report_item/getTranslatedTitle">\n
<text:p tal:content="report_item/getTranslatedTitle"></text:p>\n
</tal:block>\n
</table:table-row>\n
</tal:block>\n
......
83
\ No newline at end of file
84
\ No newline at end of file
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