Commit 680fa4bc authored by Jérome Perrin's avatar Jérome Perrin

listbox_pdf_macro : use render_pdf on editable fields

ListBox_getColumnWithDict : make column larger if property is a number (this is
actually a hack to make 1 234,56 style fit the column size)



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11308 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cb04ef04
...@@ -136,13 +136,17 @@ if is_domain_tree_mode or is_report_tree_mode : \n ...@@ -136,13 +136,17 @@ if is_domain_tree_mode or is_report_tree_mode : \n
min_column_width = 1\n min_column_width = 1\n
\n \n
max_line_len = {}\n max_line_len = {}\n
number = (int, float, long)\n
for listboxline in listboxline_list:\n for listboxline in listboxline_list:\n
line_width = 0\n line_width = 0\n
col_count = 0\n col_count = 0\n
for column_id, column_property in listboxline.getColumnItemList():\n for column_id, column_property in listboxline.getColumnItemList():\n
if isinstance(column_property, number):\n
string_property = "%s+++" % (column_property)\n
else:\n
string_property = str(column_property or \'\')\n string_property = str(column_property or \'\')\n
if listboxline.isStatLine():\n if listboxline.isStatLine():\n
string_property = "%s longer" % string_property\n string_property = "%s+++++" % string_property\n
elif listboxline.isTitleLine():\n elif listboxline.isTitleLine():\n
string_property = str(N_(string_property))\n string_property = str(N_(string_property))\n
line_width += len(string_property)\n line_width += len(string_property)\n
...@@ -231,9 +235,13 @@ return result\n ...@@ -231,9 +235,13 @@ return result\n
<string>total_col_width</string> <string>total_col_width</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>max_line_len</string> <string>max_line_len</string>
<string>int</string>
<string>float</string>
<string>long</string>
<string>number</string>
<string>isinstance</string>
<string>new_column_max_len</string> <string>new_column_max_len</string>
<string>update_dict</string> <string>update_dict</string>
<string>float</string>
<string>sum</string> <string>sum</string>
<string>total_max_len</string> <string>total_max_len</string>
<string>max_len</string> <string>max_len</string>
......
...@@ -66,6 +66,8 @@ ...@@ -66,6 +66,8 @@
\n \n
<tal:block tal:define="listboxline_list python:listbox.get_value(\'default\', render_format=\'list\', REQUEST=request);\n <tal:block tal:define="listboxline_list python:listbox.get_value(\'default\', render_format=\'list\', REQUEST=request);\n
selection_name python:listbox.get_value(\'selection_name\', REQUEST=request);\n selection_name python:listbox.get_value(\'selection_name\', REQUEST=request);\n
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 selection python:here.portal_selections.getSelectionFor(selection_name, REQUEST=request);\n
is_domain_tree_mode python:selection.domain_tree_mode;\n is_domain_tree_mode python:selection.domain_tree_mode;\n
is_report_tree_mode python:selection.report_tree_mode;" >\n is_report_tree_mode python:selection.report_tree_mode;" >\n
...@@ -128,8 +130,13 @@ ...@@ -128,8 +130,13 @@
<tal:block tal:define="column_property python: column_item[1];\n <tal:block tal:define="column_property python: column_item[1];\n
column_id python: column_item[0]">\n column_id python: column_item[0]">\n
<tal:block tal:condition="python: column_property is not None">\n <tal:block tal:condition="python: column_property is not None">\n
<td tal:attributes="colwidth python:\'%.2fcm\' % float(column_width[column_id])">\n <td tal:attributes="colwidth python:\'%.2fcm\' % float(column_width[column_id])"\n
<para style="TableStandard" tal:content="string:${column_property}"\n tal:define="field python: editable_fields.get(column_id, None)" >\n
<para tal:condition="python: field is None"\n
style="TableStandard" tal:content="string:${column_property}"\n
tal:attributes="style python:isinstance(column_property, (int, long, float)) and \'TableStandardRightAligned\' or \'TableStandardLeftAligned\'" />\n
<para tal:condition="python: field is not None"\n
style="TableStandard" tal:content="python:field.render_pdf(column_property)"\n
tal:attributes="style python:isinstance(column_property, (int, long, float)) and \'TableStandardRightAligned\' or \'TableStandardLeftAligned\'" />\n tal:attributes="style python:isinstance(column_property, (int, long, float)) and \'TableStandardRightAligned\' or \'TableStandardLeftAligned\'" />\n
</td>\n </td>\n
</tal:block>\n </tal:block>\n
...@@ -147,8 +154,13 @@ ...@@ -147,8 +154,13 @@
<tal:block tal:define="column_property python: column_item[1];\n <tal:block tal:define="column_property python: column_item[1];\n
column_id python: column_item[0]">\n column_id python: column_item[0]">\n
<tal:block tal:condition="python: column_property is not None">\n <tal:block tal:condition="python: column_property is not None">\n
<td tal:attributes="colwidth python:\'%.2fcm\' % float(column_width[column_id])">\n <td tal:attributes="colwidth python:\'%.2fcm\' % float(column_width[column_id])"\n
<para style="TableLastLine" tal:content="string:${column_property}"\n tal:define="field python: editable_fields.get(column_id, None)">\n
<para tal:condition="python: field is None"\n
style="TableLastLine" tal:content="string:${column_property}"\n
tal:attributes="style python:isinstance(column_property, (int, long, float)) and \'TableLastLineRightAligned\' or \'TableLastLineLeftAligned\'" />\n
<para tal:condition="python: field is not None"\n
style="TableLastLine" tal:content="python: field.render_pdf(column_property)"\n
tal:attributes="style python:isinstance(column_property, (int, long, float)) and \'TableLastLineRightAligned\' or \'TableLastLineLeftAligned\'" />\n tal:attributes="style python:isinstance(column_property, (int, long, float)) and \'TableLastLineRightAligned\' or \'TableLastLineLeftAligned\'" />\n
</td>\n </td>\n
</tal:block>\n </tal:block>\n
......
10 12
\ No newline at end of file \ 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