Commit 2d7356d7 authored by Sebastien Robin's avatar Sebastien Robin

2008-01-17 Seb

* add listbox_line_ods_macro
* in report tree, enable the tree structure in the ods document

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18768 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 40d6239d
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
structure = {}\n
structure[\'line\'] = None\n
structure[\'line_list\'] = []\n
\n
def order_line_list(line_list, current_structure, depth=0, index=0, last_dict=None):\n
if index < len(line_list):\n
listbox_line = line_list[index]\n
section_depth = listbox_line.getSectionDepth()\n
if listbox_line.isDataLine():\n
section_depth += 1\n
if section_depth == (depth +1):\n
last_dict = {\'line\':listbox_line, \'line_list\':[]}\n
current_structure[\'line_list\'].append(last_dict)\n
index += 1\n
elif section_depth == (depth +2):\n
new_depth = section_depth\n
new_structure = {\'line\':listbox_line, \'line_list\':[]}\n
last_dict[\'line_list\'].append(new_structure)\n
index += 1\n
index = order_line_list(line_list, new_structure, depth=new_depth, index=index, last_dict=last_dict)\n
elif section_depth > (depth +2):\n
raise ValueError, "A depth is missing"\n
else:\n
return index\n
if index < len(line_list):\n
index = order_line_list(line_list, current_structure, depth=depth, index=index, last_dict=last_dict)\n
return index\n
\n
\n
order_line_list(listbox_line_list, structure, depth=-1, index=0)\n
\n
return structure\n
]]></string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>listbox_line_list=None</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>listbox_line_list</string>
<string>structure</string>
<string>None</string>
<string>_write_</string>
<string>order_line_list</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<none/>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Listbox_getReportTreeStructure</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_text</string> </key>
<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\'\n
xmlns:i18n=\'http://xml.zope.org/namespaces/i18n\'\n
xmlns:metal=\'http://xml.zope.org/namespaces/metal\'\n
tal:attributes=\'dummy python:request.RESPONSE.setHeader("Content-Type", "text/html;; charset=utf-8")\'\n
office:version=\'1.0\' metal:define-macro="master">\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
<tal:block metal:define-macro="listbox_line">\n
\n
<tal:block tal:condition="python: listbox_line_structure[\'line\'] is not None"\n
tal:define="listboxline python: listbox_line_structure[\'line\']">\n
\n
<tal:block metal:define-slot="for_form_list"\n
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
<table:table-cell table:style-name=\'report-column-title\'\n
table:number-columns-spanned=\'1\'\n
office:value-type=\'string\'>\n
<tal:block tal:condition="listboxline/getSectionName">\n
<text:p tal:content="listboxline/getSectionName"/>\n
</tal:block>\n
</table:table-cell>\n
<tal:block tal:repeat="empty_index python: xrange(0, max_section_depth-1)">\n
<table:table-cell table:style-name=\'report-column-title\'\n
table:number-columns-spanned=\'1\'\n
office:value-type=\'string\'>\n
</table:table-cell>\n
</tal:block>\n
</tal:block>\n
\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
column_id python: column_item[0]">\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 i18n:translate="" i18n:domain="ui"\n
tal:content="python: column_property or \'\'">\n
</text:p>\n
</table:table-cell>\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
</table:table-row>\n
</tal:block>\n
</tal:block>\n
\n
<tal:block tal:condition="not:listboxline/isTitleLine"\n
tal:define="listboxline_index python: listboxline_list.index(listboxline)">\n
\n
<table:table-row>\n
<tal:block tal:condition="python: listboxline.isDataLine()">\n
<tal:block tal:repeat="empty_index python: xrange(0, max_section_depth)">\n
<table:table-cell table:style-name=\'report-column-title\'\n
table:number-columns-spanned=\'1\'\n
office:value-type=\'string\'>\n
</table:table-cell>\n
</tal:block>\n
<tal:block tal:repeat="column_item listboxline/getColumnItemList">\n
<tal:block tal:define="column_property python: column_item[1];\n
value column_property;\n
column_id python: column_item[0];\n
style_prefix string:;\n
field python: editable_fields.get(column_id, None);">\n
<tal:block metal:use-macro="here/field_ods_macro/macros/cell_value"/>\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
\n
<tal:block tal:condition="python: listboxline.isStatLine() or listboxline.isSummaryLine()">\n
<tal:block tal:repeat="empty_index python: xrange(0, listboxline.getSectionDepth())">\n
<table:table-cell table:style-name=\'report-column-title\'\n
table:number-columns-spanned=\'1\'\n
office:value-type=\'string\'>\n
</table:table-cell>\n
</tal:block>\n
<table:table-cell table:style-name=\'report-column-title\'\n
table:number-columns-spanned=\'1\'\n
office:value-type=\'string\'>\n
<tal:block tal:condition="listboxline/getSectionName">\n
<text:p tal:content="listboxline/getSectionName"/>\n
</tal:block>\n
</table:table-cell>\n
<tal:block tal:repeat="empty_index python: xrange(listboxline.getSectionDepth()+1, max_section_depth)">\n
<table:table-cell table:style-name=\'report-column-title\'\n
table:number-columns-spanned=\'1\'\n
office:value-type=\'string\'>\n
</table:table-cell>\n
</tal:block>\n
<tal:block tal:repeat="column_item python: listboxline.getColumnItemList()">\n
<tal:block tal:define="column_property python: column_item[1];\n
value column_property;\n
column_id python: column_item[0];\n
style_prefix string:stat-;\n
field python: editable_fields.get(column_id, None);">\n
<tal:block metal:use-macro="here/field_ods_macro/macros/cell_value"/>\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
</table:table-row>\n
\n
</tal:block>\n
</tal:block>\n
<tal:block tal:condition="python: len(listbox_line_structure[\'line_list\'])">\n
<tal:block tal:condition="python: listbox_line_structure[\'line\'] is None">\n
<tal:block tal:repeat="listbox_line_structure python: listbox_line_structure[\'line_list\']">\n
<tal:block metal:use-macro="here/listbox_line_ods_macro/macros/listbox_line"/>\n
</tal:block>\n
</tal:block>\n
<tal:block tal:condition="python: listbox_line_structure[\'line\'] is not None">\n
<table:table-row-group>\n
<tal:block tal:repeat="listbox_line_structure python: listbox_line_structure[\'line_list\']">\n
<tal:block metal:use-macro="here/listbox_line_ods_macro/macros/listbox_line"/>\n
</tal:block>\n
</table:table-row-group>\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
</office:spreadsheet>\n
</office:body>\n
</tal:block>\n
]]></string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/vnd.oasis.opendocument.text</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>listbox_line_ods_macro</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -63,84 +63,13 @@
editable_columns python: listbox.get_value(\'editable_columns\', REQUEST=request);\n
editable_fields python: dict([(column[0], getattr(listbox.aq_parent, \'listbox_%s\' % column[0], None)) for column in editable_columns]);\n
selection python: here.portal_selections.getSelectionFor(selection_name, REQUEST=request);\n
is_domain_tree_mode selection/domain_tree_mode | nothing;\n
is_report_tree_mode selection/report_tree_mode | nothing;" i18n:domain="ui">\n
listbox_line_structure python: here.Listbox_getReportTreeStructure(listbox_line_list=listboxline_list);\n
is_report_tree_mode selection/report_tree_mode | nothing;\n
max_section_depth python: max([x.getSectionDepth() for x in listboxline_list]) + int(is_report_tree_mode);\n
is_domain_tree_mode selection/domain_tree_mode | nothing;" i18n:domain="ui">\n
\n
<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()"\n
tal:condition="domain_list">\n
<table:table-row>\n
<table:table-cell office:value-type=\'string\'>\n
<text:p tal:content="python: domain_list[-1]"/>\n
</table:table-cell>\n
</table:table-row>\n
</tal:block>\n
</tal:block>\n
<tal:block tal:repeat="listboxline python: listboxline_list">\n
<tal:block metal:define-slot="for_form_list"\n
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
<table:table-cell table:style-name=\'report-column-title\'\n
table:number-columns-spanned=\'1\'\n
office:value-type=\'string\'>\n
<tal:block tal:condition="listboxline/getSectionName">\n
<text:p tal:content="listboxline/getSectionName"/>\n
</tal:block>\n
</table:table-cell>\n
</tal:block>\n
\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
column_id python: column_item[0]">\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 i18n:translate="" i18n:domain="ui" \n
tal:content="python: column_property or \'\'">\n
</text:p>\n
</table:table-cell>\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
</table:table-row>\n
</tal:block>\n
</tal:block>\n
\n
<tal:block tal:condition="not:listboxline/isTitleLine">\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
<tal:block tal:define="column_property python: column_item[1];\n
value column_property;\n
column_id python: column_item[0];\n
style_prefix string:;\n
field python: editable_fields.get(column_id, None);">\n
<tal:block metal:use-macro="here/field_ods_macro/macros/cell_value"/>\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
\n
<tal:block tal:condition="python: listboxline.isStatLine() or listboxline.isSummaryLine()">\n
<tal:block tal:repeat="column_item python: listboxline.getColumnItemList()">\n
<tal:block tal:define="column_property python: column_item[1];\n
value column_property;\n
column_id python: column_item[0];\n
style_prefix string:stat-;\n
field python: editable_fields.get(column_id, None);">\n
<tal:block metal:use-macro="here/field_ods_macro/macros/cell_value"/>\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
</table:table-row>\n
</tal:block>\n
</tal:block>\n
<tal:block metal:use-macro="here/listbox_line_ods_macro/macros/listbox_line"/>\n
\n
\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
......@@ -156,7 +85,6 @@
</table:table-row>\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
</office:spreadsheet>\n
</office:body>\n
</tal:block>\n
......
2008-01-17 Seb
* add listbox_line_ods_macro
* in report tree, enable the tree structure in the ods document
2007-09-04 rie
*modifies your_format
*change ods sheet's title of report_view and of form_list
......
114
\ No newline at end of file
116
\ 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