[Erp5-report] r15854 - /erp5/trunk/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_od...
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Aug 27 18:51:31 CEST 2007
Author: rie
Date: Mon Aug 27 18:51:31 2007
New Revision: 15854
URL: http://svn.erp5.org?rev=15854&view=rev
Log:
Improve and finalize ODS style.
Provide a report function for ODS style.
Removed:
erp5/trunk/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/ListBox_getColumnWithDict.xml
Removed: erp5/trunk/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/ListBox_getColumnWithDict.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/ListBox_getColumnWithDict.xml?rev=15853&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/ListBox_getColumnWithDict.xml (original)
+++ erp5/trunk/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/ListBox_getColumnWithDict.xml (removed)
@@ -1,314 +1,0 @@
-<?xml version="1.0"?>
-<ZopeData>
- <record id="1" aka="AAAAAAAAAAE=">
- <pickle>
- <tuple>
- <tuple>
- <string>Products.PythonScripts.PythonScript</string>
- <string>PythonScript</string>
- </tuple>
- <none/>
- </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>""" XXX this is a copy of erp5_pdf_style\'s one.\n
-This is currently not used\n
-\n
-Is it possible to have openoffice calculate widths when rendering ? \n
-\n
-\n
-"""\n
-\n
-\n
-from DateTime import DateTime\n
-\n
-# if REQUEST.other contains ${form_id}/${listbox_id}/ListBox_getColumnWithDict\n
-# magic key, this will be used as column width, instead of calculating.\n
-if listbox is not None:\n
- cache = context.REQUEST.other.get(\n
- \'%s/%s/ListBox_getColumnWithDict\' % (\n
- listbox.aq_parent.getId(), listbox.getId()), None)\n
- if cache is not None:\n
- return cache\n
-\n
-N_ = context.Base_translateString\n
-\n
-# XXX this is just a copy / paste of the old implementation\n
-# dirty code : if we are in domain or report tree, just use the old one, otherwise\n
-# use the new one that gives better results in list mode.\n
-if is_domain_tree_mode or is_report_tree_mode : \n
- result = {}\n
- \n
- # 0.5 is too small and can crash pdf generation\n
- min_column_width = 1\n
- \n
- for listboxline in listboxline_list:\n
- if 1 : #not listboxline.isTitleLine():\n
- line_width = 0\n
- col_count = 0\n
- if is_report_tree_mode:\n
- col_count += 1\n
- column_property = listboxline.getSectionName()\n
- if column_property is None: \n
- string_property = \'\'\n
- else:\n
- string_property = str(column_property)\n
- line_width += len(string_property) + section_width * (listboxline.getSectionDepth() - 1)\n
- for column_id, column_property in listboxline.getColumnItemList(): \n
- col_count += 1\n
- if column_property is None: \n
- string_property = \'\'\n
- else:\n
- string_property = str(column_property)\n
- line_width += len(string_property)\n
- for column_id, column_property in listboxline.getColumnItemList():\n
- if column_property is None: \n
- string_property = \'\'\n
- else:\n
- string_property = str(column_property)\n
- result[column_id] = max(result.get(column_id, min_column_width),\n
- min( frame_width * 2 / col_count, \n
- frame_width * len(str(string_property)) / max(line_width, 1)))\n
- if is_report_tree_mode:\n
- column_property = listboxline.getSectionName()\n
- if column_property is None: \n
- string_property = \'\'\n
- else:\n
- string_property = str(column_property)\n
- column_id = \'section_name\'\n
- result[column_id] = max(result.get(column_id,min_column_width), min(frame_width * 3 / col_count, frame_width * (len(str(string_property)) + section_width * (listboxline.getSectionDepth() - 1)) / max(line_width, 1)))\n
- \n
- total_col_width = 0.0\n
- for column_id in result.keys():\n
- if result[column_id] == 0.0:\n
- result[column_id] = 1.0\n
- for column_id in result.keys():\n
- if column_id != \'section_name\' or is_report_tree_mode:\n
- total_col_width += result[column_id]\n
- for column_id in result.keys():\n
- if column_id != \'section_name\' or is_report_tree_mode:\n
- result[column_id] = result[column_id] * frame_width / total_col_width \n
- \n
- return result\n
-\n
-## End of dirty patch ###############################################\n
- \n
-\n
-\n
-# 0.5 is too small and can crash pdf generation\n
-min_column_width = 1\n
-\n
-max_line_len = {}\n
-number = (int, float, long)\n
-for listboxline in listboxline_list:\n
- col_count = 0\n
- for column_id, column_property in listboxline.getColumnItemList():\n
- col_count += 1\n
- if isinstance(column_property, unicode):\n
- column_property = column_property.encode(\'utf8\')\n
- if isinstance(column_property, number):\n
- string_property = "%s+++" % (column_property)\n
- elif isinstance(column_property, DateTime):\n
- string_property = column_property.strftime(\'%Y/%m/%d++\')\n
- else:\n
- string_property = str(column_property or \'\')\n
- if listboxline.isStatLine():\n
- string_property = "%s+++++" % string_property\n
- elif listboxline.isTitleLine():\n
- string_property = "%s++++++++" % str(N_(string_property))\n
- new_column_max_len = max(len(string_property),\n
- max_line_len.get(column_id, 0))\n
- update_dict = {}\n
- update_dict[column_id] = new_column_max_len\n
- max_line_len.update(update_dict)\n
- \n
-total_max_len = float(sum(max_line_len.values()))\n
-result = {}\n
-for column_id, max_len in max_line_len.items() :\n
- result[column_id] = min(\n
- max((max(max_len, 1) / total_max_len) * frame_width,\n
- min_column_width),\n
- frame_width / col_count + 5)\n
-\n
-return result\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>_owner</string> </key>
- <value>
- <none/>
- </value>
- </item>
- <item>
- <key> <string>_params</string> </key>
- <value> <string>listboxline_list, is_domain_tree_mode, is_report_tree_mode, frame_width=19.0, section_width=4.0, listbox=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>6</int> </value>
- </item>
- <item>
- <key> <string>co_varnames</string> </key>
- <value>
- <tuple>
- <string>listboxline_list</string>
- <string>is_domain_tree_mode</string>
- <string>is_report_tree_mode</string>
- <string>frame_width</string>
- <string>section_width</string>
- <string>listbox</string>
- <string>DateTime</string>
- <string>None</string>
- <string>_getattr_</string>
- <string>context</string>
- <string>cache</string>
- <string>N_</string>
- <string>result</string>
- <string>min_column_width</string>
- <string>_getiter_</string>
- <string>listboxline</string>
- <string>line_width</string>
- <string>col_count</string>
- <string>column_property</string>
- <string>string_property</string>
- <string>str</string>
- <string>len</string>
- <string>column_id</string>
- <string>max</string>
- <string>min</string>
- <string>_write_</string>
- <string>total_col_width</string>
- <string>_getitem_</string>
- <string>max_line_len</string>
- <string>int</string>
- <string>float</string>
- <string>long</string>
- <string>number</string>
- <string>isinstance</string>
- <string>unicode</string>
- <string>new_column_max_len</string>
- <string>update_dict</string>
- <string>sum</string>
- <string>total_max_len</string>
- <string>max_len</string>
- </tuple>
- </value>
- </item>
- </dictionary>
- </state>
- </object>
- </value>
- </item>
- <item>
- <key> <string>func_defaults</string> </key>
- <value>
- <tuple>
- <float>19.0</float>
- <float>4.0</float>
- <none/>
- </tuple>
- </value>
- </item>
- <item>
- <key> <string>id</string> </key>
- <value> <string>ListBox_getColumnWithDict</string> </value>
- </item>
- <item>
- <key> <string>title</string> </key>
- <value> <string></string> </value>
- </item>
- <item>
- <key> <string>warnings</string> </key>
- <value>
- <tuple/>
- </value>
- </item>
- </dictionary>
- </pickle>
- </record>
-</ZopeData>
More information about the Erp5-report
mailing list