From 350150dfe992a55f8910d8cf203a322f3ac29d37 Mon Sep 17 00:00:00 2001
From: Yusei Tahara <yusei@nexedi.com>
Date: Tue, 13 Jul 2010 01:20:01 +0000
Subject: [PATCH] 2010-07-13 yusei * Support more than four dimensional matrix.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@37073 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../portal_skins/erp5_core/Base_edit.xml             | 12 +++++++++++-
 product/ERP5/bootstrap/erp5_core/bt/change_log       |  3 +++
 product/ERP5/bootstrap/erp5_core/bt/revision         |  2 +-
 3 files changed, 15 insertions(+), 2 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 8819e708cb..dd96936279 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
@@ -147,6 +147,7 @@ def editMatrixBox(matrixbox_field, matrixbox):\n
         lines = []\n
         columns = []\n
         tabs = []\n
+        extra_dimension_list_list = []\n
         if as_cell_range_script_id:\n
           cell_range = getattr(matrix_context,\n
               as_cell_range_script_id)(matrixbox=True, base_id=cell_base_id)\n
@@ -156,6 +157,11 @@ def editMatrixBox(matrixbox_field, matrixbox):\n
             lines, columns = cell_range\n
           elif len(cell_range) == 3:\n
             lines, columns, tabs = cell_range\n
+          elif len(cell_range) > 3:\n
+            lines = cell_range[0]\n
+            columns = cell_range[1]\n
+            tabs = cell_range[2]\n
+            extra_dimension_list_list = cell_range[3:]\n
         else:\n
           lines = matrixbox_field.get_value(\'lines\')\n
           columns = matrixbox_field.get_value(\'columns\')\n
@@ -164,11 +170,13 @@ def editMatrixBox(matrixbox_field, matrixbox):\n
         column_ids = map(lambda x: x[0], columns)\n
         line_ids = map(lambda x: x[0], lines)\n
         tab_ids = map(lambda x: x[0], tabs)\n
+        extra_dimension_category_list_list = [[category for category, label in dimension_list] for dimension_list in extra_dimension_list_list]\n
 \n
         # There are 3 cases\n
         # Case 1: we do 1 dimensional matrix\n
         # Case 2: we do 2 dimensional matrix\n
         # Case 3: we do 2 dimensional matrix + tabs\n
+        # Case 4: we do 2 dimensional matrix + tabs + extra\n
         cell_range = matrix_context.getCellRange(base_id = cell_base_id)\n
         if (len(column_ids) == 0) or (column_ids[0] is None):\n
           matrixbox_cell_range = [line_ids]\n
@@ -182,8 +190,10 @@ def editMatrixBox(matrixbox_field, matrixbox):\n
 \n
         else:\n
           matrixbox_cell_range = [line_ids, column_ids, tab_ids]\n
+          if extra_dimension_category_list_list:\n
+            matrixbox_cell_range = matrixbox_cell_range + extra_dimension_category_list_list\n
           if cell_range != matrixbox_cell_range:\n
-            matrix_context.setCellRange(line_ids, column_ids, tab_ids, base_id=cell_base_id)\n
+            matrix_context.setCellRange(base_id=cell_base_id, *matrixbox_cell_range)\n
 \n
       for k,v in matrixbox.items():\n
         # Only update cells which still exist\n
diff --git a/product/ERP5/bootstrap/erp5_core/bt/change_log b/product/ERP5/bootstrap/erp5_core/bt/change_log
index 79666df2b3..1cc59866cb 100644
--- a/product/ERP5/bootstrap/erp5_core/bt/change_log
+++ b/product/ERP5/bootstrap/erp5_core/bt/change_log
@@ -1,3 +1,6 @@
+2010-07-13 yusei
+* Support more than four dimensional matrix.
+
 2010-07-02 Kazuhiko
 * Allow Manager to invoke validation_workflow's actions.
 
diff --git a/product/ERP5/bootstrap/erp5_core/bt/revision b/product/ERP5/bootstrap/erp5_core/bt/revision
index 48d20d9ccb..49d66a8bd3 100644
--- a/product/ERP5/bootstrap/erp5_core/bt/revision
+++ b/product/ERP5/bootstrap/erp5_core/bt/revision
@@ -1 +1 @@
-1625
\ No newline at end of file
+1626
\ No newline at end of file
-- 
2.30.9