From 59cd86c03876470ff2d069ffafe2870cea7758a2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com>
Date: Thu, 11 Jan 2007 12:38:04 +0000
Subject: [PATCH] get uid from selection when installing bt thus we can use
 listbox with multiple pages and when installing multiple bt at a time, do not
 check dependencies again at preinstall as it has already been made before

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12015 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 ...ateTool_downloadRepositoryBusinessTemplateList.xml | 11 +++++++----
 .../erp5_core/TemplateTool_getModifiedObjectList.xml  |  9 ++++++++-
 ...lateTool_installRepositoryBusinessTemplateList.xml | 10 +++++++---
 product/ERP5/bootstrap/erp5_core/bt/revision          |  2 +-
 .../bt/template_update_business_template_workflow     |  2 +-
 5 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/TemplateTool_downloadRepositoryBusinessTemplateList.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/TemplateTool_downloadRepositoryBusinessTemplateList.xml
index 6d59c3c52e..e1a8b012f4 100644
--- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/TemplateTool_downloadRepositoryBusinessTemplateList.xml
+++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/TemplateTool_downloadRepositoryBusinessTemplateList.xml
@@ -71,9 +71,11 @@
             <value> <string>REQUEST = container.REQUEST\n
 RESPONSE = REQUEST.RESPONSE\n
 \n
-uids = getattr(REQUEST, \'uids\', ())\n
+selection_name = kw[\'list_selection_name\']\n
+uids = context.portal_selections.getSelectionCheckedUidsFor(selection_name)\n
+\n
 ret_url = \'/\'.join([context.absolute_url(), REQUEST.get(\'form_id\', \'view\')])\n
-#return repr(len(uids))\n
+\n
 if len(uids) == 0:\n
   RESPONSE.redirect("%s?portal_status_message=No+Business+Template+Specified" % ret_url)\n
   return\n
@@ -139,9 +141,10 @@ RESPONSE.redirect("%s?portal_status_message=Business+Templates+Downloaded+As:+%s
                             <string>container</string>
                             <string>REQUEST</string>
                             <string>RESPONSE</string>
-                            <string>getattr</string>
-                            <string>uids</string>
+                            <string>_getitem_</string>
+                            <string>selection_name</string>
                             <string>context</string>
+                            <string>uids</string>
                             <string>ret_url</string>
                             <string>len</string>
                             <string>id_list</string>
diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/TemplateTool_getModifiedObjectList.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/TemplateTool_getModifiedObjectList.xml
index 2180885612..80c9ca1391 100644
--- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/TemplateTool_getModifiedObjectList.xml
+++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/TemplateTool_getModifiedObjectList.xml
@@ -70,15 +70,21 @@
             <key> <string>_body</string> </key>
             <value> <string>REQUEST = container.REQUEST\n
 \n
+\n
 bt_id_list = getattr(REQUEST, \'bt_list\', ())\n
 if len(bt_id_list) == 0:\n
   bt_id_list = kw.get(\'bt_list\', ())\n
 \n
+if \'MultiInstallationDialog\' in getattr(REQUEST, \'current_form_id\', \'\'):\n
+  check_dependencies = 0\n
+else:\n
+  check_dependencies = 1\n
+\n
 from Products.ERP5Type.Document import newTempBase\n
 from Products.ERP5Type.Cache import CachingMethod\n
 \n
 def getModifiedObjectList(bt):\n
-  return bt.preinstall()\n
+  return bt.preinstall(check_dependencies = check_dependencies)\n
 \n
 getModifiedObjectList = CachingMethod(getModifiedObjectList, id=\'BusinessTemplate_getModifiedObjectList\', cache_duration=36000)\n
 \n
@@ -174,6 +180,7 @@ return object_list\n
                             <string>getattr</string>
                             <string>bt_id_list</string>
                             <string>len</string>
+                            <string>check_dependencies</string>
                             <string>Products.ERP5Type.Document</string>
                             <string>newTempBase</string>
                             <string>Products.ERP5Type.Cache</string>
diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/TemplateTool_installRepositoryBusinessTemplateList.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/TemplateTool_installRepositoryBusinessTemplateList.xml
index d02c08f43a..1307ff5d01 100644
--- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/TemplateTool_installRepositoryBusinessTemplateList.xml
+++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/TemplateTool_installRepositoryBusinessTemplateList.xml
@@ -74,8 +74,9 @@ from ZTUtils import make_query\n
 \n
 REQUEST = container.REQUEST\n
 RESPONSE = REQUEST.RESPONSE\n
+selection_name = kw[\'list_selection_name\']\n
 \n
-uids = getattr(REQUEST, \'uids\', ())\n
+uids = context.portal_selections.getSelectionCheckedUidsFor(selection_name)\n
 \n
 if len(uids) == 0:\n
   return context.REQUEST.RESPONSE.redirect(\'%s/TemplateTool_viewInstallRepositoryBusinessTemplateListDialog?portal_status_message=%s\'%(context.absolute_url(), context.urlQuote(\'No Business Template specified.\')))\n
@@ -123,6 +124,8 @@ for uid in uids:\n
   tuple_list.append(context.decodeRepositoryBusinessTemplateUid(uid))\n
 tuple_list = context.sortBusinessTemplateList(tuple_list)\n
 \n
+context.log(\'uids = %s\' %(uids,), \'tuple list = %s\' %(tuple_list,))\n
+\n
 bt_list = []\n
 for repository, id in tuple_list:\n
   bt = context.download(\'/\'.join([repository, id]))\n
@@ -187,10 +190,11 @@ RESPONSE.redirect(\'%s/TemplateTool_viewMultiInstallationDialog?%s&form_id=Busin
                             <string>container</string>
                             <string>REQUEST</string>
                             <string>RESPONSE</string>
-                            <string>getattr</string>
+                            <string>_getitem_</string>
+                            <string>selection_name</string>
+                            <string>context</string>
                             <string>uids</string>
                             <string>len</string>
-                            <string>context</string>
                             <string>id_list</string>
                             <string>portal_status_message</string>
                             <string>current_uid_list</string>
diff --git a/product/ERP5/bootstrap/erp5_core/bt/revision b/product/ERP5/bootstrap/erp5_core/bt/revision
index c72784c8c5..06690d5eea 100644
--- a/product/ERP5/bootstrap/erp5_core/bt/revision
+++ b/product/ERP5/bootstrap/erp5_core/bt/revision
@@ -1 +1 @@
-235
\ No newline at end of file
+238
\ No newline at end of file
diff --git a/product/ERP5/bootstrap/erp5_core/bt/template_update_business_template_workflow b/product/ERP5/bootstrap/erp5_core/bt/template_update_business_template_workflow
index 56a6051ca2..c227083464 100644
--- a/product/ERP5/bootstrap/erp5_core/bt/template_update_business_template_workflow
+++ b/product/ERP5/bootstrap/erp5_core/bt/template_update_business_template_workflow
@@ -1 +1 @@
-1
\ No newline at end of file
+0
\ No newline at end of file
-- 
2.30.9