From 3b8a54c80fb32031cf2dffbcccb6cc03dd82b658 Mon Sep 17 00:00:00 2001
From: Thibaut Deheunynck <thibaut@nexedi.com>
Date: Wed, 23 Apr 2008 15:00:43 +0000
Subject: [PATCH] Change ERP5Site_buildChart in order to respect the changes in
 OOoChart ( the conversion of the dictionaries in lists )

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20776 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_core/ERP5Site_buildChart.xml         | 123 +++++++++++-------
 product/ERP5/bootstrap/erp5_core/bt/revision  |   2 +-
 2 files changed, 77 insertions(+), 48 deletions(-)

diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Site_buildChart.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Site_buildChart.xml
index cc59d42321..4fcf6bed8a 100644
--- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Site_buildChart.xml
+++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Site_buildChart.xml
@@ -89,7 +89,8 @@
               global col_char python:\'B\';\n
               global chart_type request/chart_type;\n
               global series_source request/series_source;\n
-              global user_column_id_dict request/user_column_id_dict;\n
+              global user_column_id_list request/user_column_id_list;\n
+              global colour_column_list request/colour_column_list;\n
               global user_data_title request/user_data_title;\n
               global grid_graph request/grid_graph;\n
               global data_label_text request/data_label_text;\n
@@ -99,6 +100,7 @@
     <number:number-style style:name="N0">\n
       <number:number number:min-integer-digits="1"/>\n
     </number:number-style>\n
+\n
     <style:style style:name="chart_frame" style:family="chart">\n
       <style:graphic-properties draw:stroke="none"\n
                                   svg:stroke-width="0cm"\n
@@ -122,10 +124,12 @@
                              style:font-pitch-complex="variable"\n
                              style:font-size-complex="35pt"/>\n
     </style:style>\n
+\n
     <style:style style:name="chart_legend" style:family="chart">\n
       <style:graphic-properties draw:fill="none"/>\n
       <tal:block metal:use-macro="here/OOoChart_macroLibrary/macros/style_text_properties" />\n
     </style:style>\n
+\n
     <style:style style:name="chart_picture" style:family="chart">\n
       <style:chart-properties tal:condition="python:chart_type==\'chart:bar\'"\n
                               chart:mean-value="false"\n
@@ -266,7 +270,7 @@
     <style:style style:family="chart" style:name="sector_pie">\n
       <style:chart-properties tal:attributes="chart:pie-offset python:request.sector_pie_offset;"/>\n
     </style:style>\n
-    <tal:block tal:condition="python:chart_type==\'chart:line\' and series_source==\'columns\'">\n
+    <tal:block tal:condition="python:chart_type==\'chart:line\' and series_source==\'rows\'">\n
       <style:style style:family="chart" style:name="data_line_rows">\n
         <tal:block metal:use-macro="here/OOoChart_macroLibrary/macros/style_text_properties" />\n
       </style:style>\n
@@ -282,17 +286,24 @@
       <style:style tal:condition="python:chart_type==\'chart:bar\' and series_source==\'columns\'"\n
                     style:family="chart"\n
                     tal:attributes="style:name python:\'data_bar_%s\' % column_item[0]">\n
-        <style:graphic-properties  svg:stroke-color=\'#000000\'\n
-                                  tal:attributes="draw:fill-color python:request.colour_column_dict.get(column_item[0]);\n
-                                  "/>\n
-        <tal:block metal:use-macro="here/OOoChart_macroLibrary/macros/style_text_properties" />\n
+        <tal:block tal:repeat="colorList colour_column_list" >\n
+            <style:graphic-properties tal:condition="python: column_item[0]==colorList[0] "\n
+                                      svg:stroke-color=\'#000000\'\n
+                                      tal:attributes="draw:fill-color python:colorList[1];\n
+                                      "/>\n
+          </tal:block>\n
+          <tal:block metal:use-macro="here/OOoChart_macroLibrary/macros/style_text_properties" />\n
       </style:style>\n
 \n
-      <!-- style for chart:line and serie data columns-->\n
-      <style:style tal:condition="python:chart_type==\'chart:line\' or chart_type==\'chart:scatter\' and series_source==\'columns\'"\n
+      <!-- style for chart:line or chart:scatter and serie data columns-->\n
+      <style:style tal:condition="python:chart_type==\'chart:line\' and series_source==\'columns\'"\n
                     style:family="chart"\n
                     tal:attributes="style:name python:\'data_line_%s\' % column_item[0]">\n
-        <style:graphic-properties  tal:attributes="svg:stroke-color python:request.colour_column_dict.get(column_item[0]); "/>\n
+        <tal:block tal:repeat="colorList colour_column_list" >\n
+          <style:graphic-properties tal:condition="python: column_item[0]==colorList[0] "\n
+                                    tal:attributes="svg:stroke-color python:colorList[1];\n
+                                    draw:fill-color python:colorList[1]"/>\n
+          </tal:block>\n
         <tal:block metal:use-macro="here/OOoChart_macroLibrary/macros/style_text_properties" />\n
       </style:style>\n
 \n
@@ -300,19 +311,22 @@
       <style:style tal:condition="python:chart_type==\'chart:circle\' and series_source==\'rows\'"\n
                     style:family="chart"\n
                     tal:attributes="style:name python:\'data_circle_%s\' % column_item[0]">\n
-\n
-        <style:graphic-properties svg:stroke-color=\'#000000\'\n
-                                  tal:attributes="draw:fill-color python:request.colour_column_dict.get(column_item[0]);\n
-                                  "/>\n
+        <tal:block tal:repeat="colorList colour_column_list" >\n
+          <style:graphic-properties tal:condition="python: column_item[0]==colorList[0] "\n
+                                    svg:stroke-color=\'#000000\'\n
+                                    tal:attributes="draw:fill-color python:colorList[1];\n
+                                    "/>\n
+          </tal:block>\n
         <tal:block metal:use-macro="here/OOoChart_macroLibrary/macros/style_text_properties" />\n
       </style:style>\n
     </tal:block>\n
+\n
     <style:style style:name="chart_wall" \n
                  style:family="chart">\n
       <style:graphic-properties draw:stroke="none"\n
                                 draw:fill="none"/>\n
-    </style:style>\n
-    <style:style style:name="chart_floor"\n
+      </style:style>\n
+      <style:style style:name="chart_floor"\n
                  style:family="chart">\n
       <style:graphic-properties draw:stroke="none"\n
                                 draw:fill-color="#999999"/>\n
@@ -328,9 +342,7 @@
         <tal:block tal:define="bool request/chart_title_or_no"\n
                    tal:condition="python:bool==\'true\'">\n
           <chart:title chart:style-name="chart_title">\n
-            <text:p tal:content="request/chart_title | string:User Statistics">\n
-              User Statistics\n
-            </text:p>\n
+            <text:p tal:content="request/chart_title" />\n
           </chart:title>\n
         </tal:block>\n
         <!-- Legend Of The Graph-->\n
@@ -356,7 +368,7 @@
 \n
           <tal:block tal:condition="python:chart_type == \'chart:scatter\'\n
                       and series_source == \'columns\'\n
-                    and len(user_column_id_dict.keys()) == 0"\n
+                    and len(user_column_id_list) == 0"\n
                     tal:repeat="column_item python:column_list[1:]">\n
               <chart:series tal:attributes="chart:values-cell-range-address python:\'local-table.%s2:.%s%s\' % (col_char, col_char, line_count);\n
                             chart:label-cell-address python:\'local-table.%s1\' % col_char;\n
@@ -367,30 +379,35 @@
 \n
           <tal:block tal:condition="python:chart_type == \'chart:scatter\'\n
                       and series_source == \'columns\'\n
-                      and len(user_column_id_dict.keys()) != 0"\n
+                      and len(user_column_id_list) != 0"\n
                     tal:repeat="column_item python:column_list[1:]">\n
-            <chart:series tal:condition="python:user_column_id_dict.has_key(column_item[0])"\n
+            <tal:block tal:repeat="user_column_id python:user_column_id_list">\n
+\n
+              <chart:series tal:condition="python:user_column_id[0]==column_item[0]"\n
                           tal:attributes="chart:values-cell-range-address python:\'local-table.%s2:.%s%s\' % (col_char, col_char, line_count);\n
                           chart:label-cell-address python:\'local-table.%s1\' % col_char;\n
                           chart:style-name python:\'data_line_%s\' % column_item[0];">\n
-              <chart:data-point tal:attributes="chart:repeated line_count"/>\n
-            </chart:series>\n
+                <chart:data-point tal:attributes="chart:repeated line_count"/>\n
+              </chart:series>\n
+            </tal:block>\n
           </tal:block>\n
 \n
           <tal:block tal:condition="python:chart_type==\'chart:bar\'\n
                       and series_source==\'columns\' \n
-                      and len(user_column_id_dict.keys())!=0"\n
+                      and len(user_column_id_list)!=0"\n
                     tal:repeat="column_item python:column_list[1:]">\n
-            <chart:series tal:condition="python:user_column_id_dict.has_key(column_item[0])"\n
+            <tal:block tal:repeat="user_column_id python:user_column_id_list">\n
+              <chart:series tal:condition="python:user_column_id[0]==column_item[0]"\n
                           tal:attributes="chart:values-cell-range-address python:\'local-table.%s2:.%s%s\' % (col_char, col_char, line_count);\n
                           chart:label-cell-address python:\'local-table.%s1\' % col_char;\n
                           chart:style-name python:\'data_bar_%s\' % column_item[0];">\n
-              <chart:data-point tal:attributes="chart:repeated line_count"/>\n
-            </chart:series>\n
+                <chart:data-point tal:attributes="chart:repeated line_count"/>\n
+              </chart:series>\n
+            </tal:block>\n
           </tal:block>\n
           <tal:block tal:condition="python: chart_type == \'chart:bar\'\n
                       and series_source == \'columns\'\n
-                      and len(user_column_id_dict.keys()) == 0"\n
+                      and len(user_column_id_list) == 0"\n
                       tal:repeat="column_item python:column_list[1:]">\n
             <chart:series tal:attributes="chart:values-cell-range-address python:\'local-table.%s2:.%s%s\' % (col_char, col_char, line_count);\n
                           chart:label-cell-address python:\'local-table.%s1\' % col_char;\n
@@ -407,8 +424,8 @@
               <chart:data-point  tal:attributes="chart:repeated column_count"/>\n
             </chart:series>\n
           </tal:block>\n
-          <tal:block tal:condition="python:chart_type == \'chart:line\'\n
-                                            or chart_type == \'chart:scatter\'\n
+          <tal:block tal:condition="python:(chart_type == \'chart:line\'\n
+                                            or chart_type == \'chart:scatter\')\n
                                             and series_source == \'rows\'"\n
                       tal:repeat="line_item python:line_list">\n
             <chart:series chart:style-name="data_line_rows"\n
@@ -419,20 +436,22 @@
           </tal:block>\n
           <tal:block tal:condition="python:chart_type==\'chart:line\'\n
                                             and series_source==\'columns\'\n
-                                            and len(user_column_id_dict.keys())"\n
+                                            and len(user_column_id_list)!=0"\n
                       tal:repeat="column_item python:column_list[1:]">\n
-            <tal:block tal:condition="python:user_column_id_dict.has_key(column_item[0]) ">\n
-              <chart:series tal:attributes="chart:values-cell-range-address\n
+            <tal:block tal:repeat="color python:user_column_id_list">\n
+              <tal:block tal:condition="python:color[0]==column_item[0] ">\n
+                <chart:series tal:attributes="chart:values-cell-range-address\n
                             python:\'local-table.%s2:.%s%s\' % (col_char, col_char, column_count);\n
                             chart:label-cell-address python:\'local-table.%s1\' % col_char;\n
                             chart:style-name python:\'data_line_%s\' % column_item[0];">\n
-                <chart:data-point  tal:attributes="chart:repeated python:line_count"/>\n
-              </chart:series>\n
+                  <chart:data-point  tal:attributes="chart:repeated python:line_count"/>\n
+                </chart:series>\n
+              </tal:block>\n
             </tal:block>\n
           </tal:block>\n
           <tal:block tal:condition="python:chart_type == \'chart:line\'\n
                                             and series_source == \'columns\'\n
-                                            and len(user_column_id_dict.keys()) == 0"\n
+                                            and len(user_column_id_list) == 0"\n
                       tal:repeat="column_item python:column_list[1:]">\n
             <chart:series tal:attributes="chart:values-cell-range-address python:\'local-table.%s2:.%s%s\' % (col_char, col_char, column_count);\n
                           chart:label-cell-address python:\'local-table.%s1\' % col_char;\n
@@ -450,8 +469,7 @@
                           chart:style-name="chart_picture">\n
           <chart:axis chart:dimension="y"\n
                       chart:name="primary-y"\n
-                      chart:style-name="chart_y_axis">\n
-          </chart:axis>\n
+                      chart:style-name="chart_y_axis"/>\n
           <tal:block tal:repeat="column_item python:column_list[1:]">\n
             <chart:series tal:attributes="chart:values-cell-range-address python:\'local-table.%s2:.%s%s\' % (col_char, col_char, column_count);\n
                           chart:label-cell-address python:\'local-table.%s1\' % col_char;">\n
@@ -464,7 +482,7 @@
         <chart:plot-area tal:condition="python:chart_type == \'chart:circle\'\n
                                                and series_source == \'rows\'"\n
                          chart:style-name="chart_picture">\n
-          <tal:block tal:condition="python:len(user_column_id_dict.keys()) == 0"\n
+          <tal:block tal:condition="python:len(user_column_id_list) == 0"\n
                      tal:repeat="column_item python:column_list[1:]">\n
             <chart:series tal:attributes="chart:values-cell-range-address python:\'local-table.%s2:.%s%s\' % (col_char, col_char, line_count);\n
                           chart:label-cell-address python:\'local-table.%s1\' % col_char;\n
@@ -473,9 +491,11 @@
                                 tal:attributes="chart:repeated python:column_count" />\n
             </chart:series>\n
           </tal:block>\n
-          <tal:block tal:condition="python:len(user_column_id_dict.keys()) != 0"\n
+          <tal:block tal:condition="python:len(user_column_id_list) != 0"\n
                      tal:repeat="column_item python:column_list[1:]">\n
-            <tal:block tal:condition="python:user_column_id_dict.has_key(column_item[0])">\n
+            <tal:block tal:repeat="user_column_id python:user_column_id_list">\n
+\n
+            <tal:block tal:condition="python:user_column_id_list[0]==column_item[0]">\n
               <chart:series tal:attributes="chart:values-cell-range-address python:\'local-table.%s2:.%s%s\' % (col_char, col_char, line_count);\n
                             chart:label-cell-address python:\'local-table.%s1\' % col_char;\n
                             chart:style-name python:\'data_circle_%s\' % column_item[0];">\n
@@ -483,11 +503,12 @@
                                   tal:attributes="chart:repeated column_count" />\n
               </chart:series>\n
             </tal:block>\n
+            </tal:block>\n
           </tal:block>\n
         </chart:plot-area>\n
 \n
         <!-- Storage all ListBox Data in Spreadsheet-->\n
-        <table:table tal:condition="python:len(user_column_id_dict.keys()) == 0"\n
+        <table:table tal:condition="python:len(user_column_id_list) == 0"\n
                      table:name="local-table">\n
           <table:table-header-columns>\n
             <table:table-column/>\n
@@ -540,13 +561,13 @@
         </table:table>\n
 \n
         <!-- Storage Data given by user in Spreadsheet-->\n
-        <table:table tal:condition="python:len(user_column_id_dict.keys()) != 0"\n
+        <table:table tal:condition="python:len(user_column_id_list) != 0"\n
                       table:name="local-table">\n
           <table:table-header-columns>\n
             <table:table-column/>\n
           </table:table-header-columns>\n
           <table:table-columns>\n
-            <table:table-column tal:attributes="table:number-columns-repeated python:len(user_column_id_dict.keys())"/>\n
+            <table:table-column tal:attributes="table:number-columns-repeated python:len(user_column_id_list)"/>\n
           </table:table-columns>\n
           <table:table-header-rows>\n
             <table:table-row>\n
@@ -554,7 +575,8 @@
                 <text:p></text:p>\n
               </table:table-cell>\n
               <tal:block tal:repeat="column_item python:column_list[1:] ">\n
-                <tal:block tal:condition="python:user_column_id_dict.has_key(column_item[0]) ">\n
+                <tal:block tal:repeat="user_column_id python:user_column_id_list">\n
+                <tal:block tal:condition="python:user_column_id[0] == column_item[0] ">\n
                   <table:table-cell office:value-type="string">\n
                     <text:p tal:content="python:column_item[1]"\n
                             i18n:domain="ui"\n
@@ -562,6 +584,7 @@
                   </table:table-cell>\n
                 </tal:block>\n
               </tal:block>\n
+              </tal:block>\n
             </table:table-row>\n
           </table:table-header-rows>\n
           <table:table-rows>\n
@@ -589,7 +612,8 @@
                     </table:table-cell>\n
                   </tal:block>\n
                   <tal:block tal:repeat="column_item column_list">\n
-                    <tal:block tal:condition="python:user_column_id_dict.has_key(column_item[0]) ">\n
+                    <tal:block tal:repeat="user_column_id python:user_column_id_list">\n
+                    <tal:block tal:condition="python:user_column_id[0] == column_item[0] ">\n
                       <tal:block tal:define="column_id python:column_item[0];\n
                             column_type python:line.getColumnPropertyTypeName(column_id);\n
                             column_value python:line.getColumnProperty(column_id);\n
@@ -606,6 +630,7 @@
                       </tal:block>\n
                     </tal:block>\n
                   </tal:block>\n
+                  </tal:block>\n
                 </table:table-row>\n
               </tal:block>\n
             </tal:block>\n
@@ -633,7 +658,11 @@
         </item>
         <item>
             <key> <string>ooo_stylesheet</string> </key>
-            <value> <string>Base_getODGChartStyle.xlarge</string> </value>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>ooo_xml_file_id</string> </key>
+            <value> <string></string> </value>
         </item>
         <item>
             <key> <string>title</string> </key>
diff --git a/product/ERP5/bootstrap/erp5_core/bt/revision b/product/ERP5/bootstrap/erp5_core/bt/revision
index 8e44f67f05..e6cf7bc38f 100644
--- a/product/ERP5/bootstrap/erp5_core/bt/revision
+++ b/product/ERP5/bootstrap/erp5_core/bt/revision
@@ -1 +1 @@
-812
\ No newline at end of file
+813
\ No newline at end of file
-- 
2.30.9