From 49b5fb6968edf09a1b1018f89f07c394e19f0ae4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Fri, 30 Oct 2009 16:17:32 +0000
Subject: [PATCH] support new style matrix box configuration

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30168 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../portal_skins/erp5_core/Base_edit.xml      | 21 +++++++++++++++----
 product/ERP5/bootstrap/erp5_core/bt/revision  |  2 +-
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_edit.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_edit.xml
index 9b1ce85559..c317a232e4 100644
--- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_edit.xml
+++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_edit.xml
@@ -142,10 +142,23 @@ def editMatrixBox(matrixbox_field, matrixbox):\n
         for k in hidden_attributes:\n
           gv[k] = getattr(request, k, None)\n
       if matrixbox_field.get_value(\'update_cell_range\'):\n
-        # Update cell range each time it is modified\n
-        lines = matrixbox_field.get_value(\'lines\')\n
-        columns = matrixbox_field.get_value(\'columns\')\n
-        tabs = matrixbox_field.get_value(\'tabs\')\n
+        as_cell_range_script_id = matrixbox_field.get_value(\n
+                \'as_cell_range_script_id\')\n
+        lines = []\n
+        columns = []\n
+        tabs = []\n
+        if as_cell_range_script_id:\n
+          cell_range = getattr(context, as_cell_range_script_id)(matrixbox=True)\n
+          if len(cell_range) == 1:\n
+            lines, = cell_range\n
+          elif len(cell_range) == 2:\n
+            lines, columns = cell_range\n
+          elif len(cell_range) == 3:\n
+            lines, columns, tabs = cell_range\n
+        else:\n
+          lines = matrixbox_field.get_value(\'lines\')\n
+          columns = matrixbox_field.get_value(\'columns\')\n
+          tabs = matrixbox_field.get_value(\'tabs\')\n
 \n
         column_ids = map(lambda x: x[0], columns)\n
         line_ids = map(lambda x: x[0], lines)\n
diff --git a/product/ERP5/bootstrap/erp5_core/bt/revision b/product/ERP5/bootstrap/erp5_core/bt/revision
index 2796f968cf..c6778f8867 100644
--- a/product/ERP5/bootstrap/erp5_core/bt/revision
+++ b/product/ERP5/bootstrap/erp5_core/bt/revision
@@ -1 +1 @@
-1352
\ No newline at end of file
+1355
\ No newline at end of file
-- 
2.30.9