Commit 55c25bb6 authored by Nicolas Delaby's avatar Nicolas Delaby

2008-04-04 Thibaut

add rendering OOoChart
Image support improvement

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20308 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b30bfab4
...@@ -114,7 +114,7 @@ bWxQSwUGAAAAAAIAAgCeAAAAhwwAAAAA</string> </value> ...@@ -114,7 +114,7 @@ bWxQSwUGAAAAAAIAAgCeAAAAhwwAAAAA</string> </value>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
<office:document-content \n <office:document-content\n
xmlns:draw=\'urn:oasis:names:tc:opendocument:xmlns:drawing:1.0\'\n xmlns:draw=\'urn:oasis:names:tc:opendocument:xmlns:drawing:1.0\'\n
xmlns:office=\'urn:oasis:names:tc:opendocument:xmlns:office:1.0\'\n xmlns:office=\'urn:oasis:names:tc:opendocument:xmlns:office:1.0\'\n
xmlns:text=\'urn:oasis:names:tc:opendocument:xmlns:text:1.0\'\n xmlns:text=\'urn:oasis:names:tc:opendocument:xmlns:text:1.0\'\n
...@@ -143,6 +143,7 @@ bWxQSwUGAAAAAAIAAgCeAAAAhwwAAAAA</string> </value> ...@@ -143,6 +143,7 @@ bWxQSwUGAAAAAAIAAgCeAAAAhwwAAAAA</string> </value>
xmlns:metal=\'http://xml.zope.org/namespaces/metal\'\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 tal:attributes=\'dummy python:request.RESPONSE.setHeader("Content-Type", "text/html;; charset=utf-8")\'\n
office:version=\'1.0\'>\n office:version=\'1.0\'>\n
\n
<office:scripts/>\n <office:scripts/>\n
<office:font-face-decls>\n <office:font-face-decls>\n
<style:font-face svg:font-family="\'DejaVu Sans\'" style:font-family-generic=\'roman\' style:name=\'DejaVu Sans\' style:font-pitch=\'variable\'/>\n <style:font-face svg:font-family="\'DejaVu Sans\'" style:font-family-generic=\'roman\' style:name=\'DejaVu Sans\' style:font-pitch=\'variable\'/>\n
...@@ -219,12 +220,13 @@ bWxQSwUGAAAAAAIAAgCeAAAAhwwAAAAA</string> </value> ...@@ -219,12 +220,13 @@ bWxQSwUGAAAAAAIAAgCeAAAAhwwAAAAA</string> </value>
</office:automatic-styles>\n </office:automatic-styles>\n
<office:body>\n <office:body>\n
<office:text>\n <office:text>\n
<office:forms form:automatic-focus="false" form:apply-design-mode="false"/>\n
<text:sequence-decls>\n <text:sequence-decls>\n
<text:sequence-decl text:display-outline-level=\'0\' text:name=\'Illustration\'/>\n <text:sequence-decl text:display-outline-level=\'0\' text:name=\'Illustration\'/>\n
<text:sequence-decl text:display-outline-level=\'0\' text:name=\'Table\'/>\n <text:sequence-decl text:display-outline-level=\'0\' text:name=\'Table\'/>\n
<text:sequence-decl text:display-outline-level=\'0\' text:name=\'Text\'/>\n <text:sequence-decl text:display-outline-level=\'0\' text:name=\'Text\'/>\n
<text:sequence-decl text:display-outline-level=\'0\' text:name=\'Drawing\'/>\n <text:sequence-decl text:display-outline-level=\'0\' text:name=\'Drawing\'/>\n
</text:sequence-decls> \n </text:sequence-decls>\n
<tal:block metal:define-macro="form_layout"\n <tal:block metal:define-macro="form_layout"\n
tal:define="dummy python: request.set(\'here\',here); ">\n tal:define="dummy python: request.set(\'here\',here); ">\n
<!-- standard groups -->\n <!-- standard groups -->\n
...@@ -249,7 +251,7 @@ bWxQSwUGAAAAAAIAAgCeAAAAhwwAAAAA</string> </value> ...@@ -249,7 +251,7 @@ bWxQSwUGAAAAAAIAAgCeAAAAhwwAAAAA</string> </value>
office:value-type=\'string\'\n office:value-type=\'string\'\n
tal:define="value python: field.get_value(\'default\')">\n tal:define="value python: field.get_value(\'default\')">\n
\n \n
<tal:block tal:condition="python: field_type not in (\'ImageField\', )">\n <tal:block tal:condition="python: field_type not in (\'ImageField\', \'OOoChart\',)">\n
<tal:block tal:condition="python: same_type(value,[]) or same_type(value,())">\n <tal:block tal:condition="python: same_type(value,[]) or same_type(value,())">\n
<tal:block tal:repeat="item value">\n <tal:block tal:repeat="item value">\n
<text:p text:style-name=\'field-content\'\n <text:p text:style-name=\'field-content\'\n
...@@ -270,22 +272,52 @@ bWxQSwUGAAAAAAIAAgCeAAAAhwwAAAAA</string> </value> ...@@ -270,22 +272,52 @@ bWxQSwUGAAAAAAIAAgCeAAAAhwwAAAAA</string> </value>
</tal:block>\n </tal:block>\n
<tal:block tal:condition="python: value is None">\n <tal:block tal:condition="python: value is None">\n
<text:p text:style-name=\'field-content\' tal:content="python: \' \'" />\n <text:p text:style-name=\'field-content\' tal:content="python: \' \'" />\n
</tal:block> \n
</tal:block>\n </tal:block>\n
</tal:block>\n
<!-- With this max_size, pictures and graph stay in a table cell-->\n
<tal:block tal:define="global max_size python:9;"/>\n
<tal:block tal:condition="python: field_type == \'ImageField\'">\n <tal:block tal:condition="python: field_type == \'ImageField\'">\n
<text:p text:style-name=\'field-content\'\n <text:p text:style-name=\'field-content\'\n
tal:define="size python: modules[\'Products.ERP5.Document.Image\'].getSizeFromImageDisplay(field.get_value(\'image_display\'))">\n tal:define="size python:modules[\'Products.ERP5.Document.Image\'].getSizeFromImageDisplay(field.get_value(\'image_display\'));\n
<office:include_img tal:attributes="width python: (size and size[0] or 100) / 20.;\n width python:(((size and size[0] ) / 20.) &lt; max_size and (size and size[0] ) / 20.) or max_size">\n
<tal:block>\n
<office:include_img tal:attributes="width width;\n
path python: \'/\'.join(request.physicalPathFromURL(field.get_value(\'default\')));"/>\n path python: \'/\'.join(request.physicalPathFromURL(field.get_value(\'default\')));"/>\n
</tal:block>\n
</text:p>\n </text:p>\n
</tal:block>\n </tal:block>\n
<tal:block tal:condition="python: field_type == \'OOoChart\'">\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="\n
width python:int((getattr(here.portal_preferences, preferred_method_width_id)()));\n
height python:int((getattr(here.portal_preferences, preferred_method_height_id)()));\n
width_graph python:(width *0.02 &lt; max_size and width*0.02 ) or max_size;\n
height_graph python:(height*0.02 &lt; max_size and height*0.02 ) or max_size">\n
<text:p text:style-name=\'field-content\'>\n
<draw:frame draw:style-name=\'gr1\'\n
draw:layer=\'layout\'\n
text:anchor-type="paragraph"\n
tal:attributes="svg:height python:str(height_graph)+\'cm\';\n
svg:width python:str(width_graph)+\'cm\'">\n
<tal:block tal:replace="python: field.render_odf()"/>\n
</draw:frame>\n
</text:p>\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
</table:table-cell>\n </table:table-cell>\n
</tal:block>\n </tal:block>\n
</table:table-row>\n </table:table-row>\n
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>\n
</table:table> \n </table:table>\n
<text:p></text:p>\n <text:p></text:p>\n
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>\n
...@@ -295,7 +327,7 @@ bWxQSwUGAAAAAAIAAgCeAAAAhwwAAAAA</string> </value> ...@@ -295,7 +327,7 @@ bWxQSwUGAAAAAAIAAgCeAAAAhwwAAAAA</string> </value>
<tal:block tal:define="field_list python: form.get_fields_in_group(\'center\')">\n <tal:block tal:define="field_list python: form.get_fields_in_group(\'center\')">\n
<tal:block tal:repeat="field field_list">\n <tal:block tal:repeat="field field_list">\n
<tal:block tal:define="field_type python: field.meta_type == \'ProxyField\' and field.getRecursiveTemplateField().meta_type or field.meta_type">\n <tal:block tal:define="field_type python: field.meta_type == \'ProxyField\' and field.getRecursiveTemplateField().meta_type or field.meta_type">\n
<tal:block tal:condition="python: field_type not in (\'ImageField\', )">\n <tal:block tal:condition="python: field_type not in (\'ImageField\',\'OOoChart\' )">\n
<text:p text:style-name=\'field-label-center\' i18n:domain="ui" i18n:translate=""\n <text:p text:style-name=\'field-label-center\' i18n:domain="ui" i18n:translate=""\n
tal:content="python: field.get_value(\'title\')"/>\n tal:content="python: field.get_value(\'title\')"/>\n
<text:p text:style-name=\'field-content-center\'\n <text:p text:style-name=\'field-content-center\'\n
...@@ -312,9 +344,34 @@ bWxQSwUGAAAAAAIAAgCeAAAAhwwAAAAA</string> </value> ...@@ -312,9 +344,34 @@ bWxQSwUGAAAAAAIAAgCeAAAAhwwAAAAA</string> </value>
path python: \'/\'.join(request.physicalPathFromURL(field.get_value(\'default\')));"/>\n path python: \'/\'.join(request.physicalPathFromURL(field.get_value(\'default\')));"/>\n
</text:p>\n </text:p>\n
</tal:block>\n </tal:block>\n
<tal:block tal:condition="python: field_type == \'OOoChart\'">\n
<text:p text:style-name=\'field-label-center\' i18n:domain="ui" i18n:translate=""\n
tal:content="python: field.get_value(\'title\')"/>\n
<text:p text:style-name=\'standard\'/>\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
<text:p text:style-name=\'field-content-center\'>\n
<draw:frame draw:style-name=\'inline-graphic\'\n
draw:layer=\'layout\'\n
text:anchor-type="paragraph"\n
tal:attributes="svg:height python:height;\n
svg:width python:width">\n
<tal:block tal:replace="python: field.render_odf()"/>\n
</draw:frame>\n
</text:p>\n
\n
</tal:block>\n
</tal:block>\n
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>\n
</tal:block> \n
\n \n
<!-- bottom group -->\n <!-- bottom group -->\n
<tal:block tal:define="field_list python: form.get_fields_in_group(\'bottom\')">\n <tal:block tal:define="field_list python: form.get_fields_in_group(\'bottom\')">\n
...@@ -333,19 +390,46 @@ bWxQSwUGAAAAAAIAAgCeAAAAhwwAAAAA</string> </value> ...@@ -333,19 +390,46 @@ bWxQSwUGAAAAAAIAAgCeAAAAhwwAAAAA</string> </value>
<tal:block tal:condition="python: field_type == \'ImageField\'">\n <tal:block tal:condition="python: field_type == \'ImageField\'">\n
<text:p text:style-name=\'field-content\'\n <text:p text:style-name=\'field-content\'\n
tal:define="size python: modules[\'Products.ERP5.Document.Image\'].getSizeFromImageDisplay(field.get_value(\'image_display\'))">\n tal:define="size python: modules[\'Products.ERP5.Document.Image\'].getSizeFromImageDisplay(field.get_value(\'image_display\'))">\n
<text:p text:style-name=\'field-content-center\'>\n
<office:include_img style="inline-graphic"\n <office:include_img style="inline-graphic"\n
tal:attributes="width python: (size and size[0] or 100) / 20.;\n tal:attributes="width python: (size and size[0] or 100) / 20.;\n
path python: \'/\'.join(request.physicalPathFromURL(field.get_value(\'default\')));"/>\n path python: \'/\'.join(request.physicalPathFromURL(field.get_value(\'default\')));"/>\n
</text:p>\n </text:p>\n
</text:p>\n
</tal:block>\n
<tal:block tal:condition="python: field_type == \'OOoChart\'">\n
<text:p text:style-name=\'field-label-center\' i18n:domain="ui" i18n:translate=""\n
tal:content="python: field.get_value(\'title\')"/>\n
<text:p text:style-name=\'standard\'/>\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
<text:p text:style-name=\'field-content-center\'>\n
<draw:frame draw:style-name=\'inline-graphic\'\n
draw:layer=\'layout\'\n
text:anchor-type="paragraph"\n
svg:height="10cm"\n
svg:width="10cm"\n
tal:attributes="svg:height python:height;\n
svg:width python:width">\n
<tal:block tal:replace="python: field.render_odf()"/>\n
</draw:frame>\n
</text:p>\n
</tal:block>\n
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>\n
</tal:block> \n
</tal:block>\n </tal:block>\n
</office:text>\n </office:text>\n
</office:body>\n </office:body>\n
</office:document-content>\n </office:document-content>
]]></string> </value> ]]></string> </value>
</item> </item>
......
2008-04-04 Thibaut
add rendering OOoChart
Image support improvement
2007-10-30 Jerome 2007-10-30 Jerome
Add macros for deferred rendering in report_view Add macros for deferred rendering in report_view
......
36 38
\ 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