From 97f6df3e6db031f96eb89479ba9182b879b25616 Mon Sep 17 00:00:00 2001
From: Rafael Monnerat <rafael@nexedi.com>
Date: Fri, 1 Apr 2011 22:45:02 +0000
Subject: [PATCH] Enable preferences.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45022 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 ...figuration_afterMaxmaDemoConfiguration.xml | 31 ++++++++++++-------
 bt5/erp5_configurator_maxma_demo/bt/revision  |  2 +-
 2 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/bt5/erp5_configurator_maxma_demo/SkinTemplateItem/portal_skins/erp5_configurator_maxma_demo/BusinessConfiguration_afterMaxmaDemoConfiguration.xml b/bt5/erp5_configurator_maxma_demo/SkinTemplateItem/portal_skins/erp5_configurator_maxma_demo/BusinessConfiguration_afterMaxmaDemoConfiguration.xml
index 9a0909a71c..9a16f13ee0 100644
--- a/bt5/erp5_configurator_maxma_demo/SkinTemplateItem/portal_skins/erp5_configurator_maxma_demo/BusinessConfiguration_afterMaxmaDemoConfiguration.xml
+++ b/bt5/erp5_configurator_maxma_demo/SkinTemplateItem/portal_skins/erp5_configurator_maxma_demo/BusinessConfiguration_afterMaxmaDemoConfiguration.xml
@@ -55,25 +55,32 @@ from AccessControl import getSecurityManager\n
 from Products.ERP5Type.Log import log\n
 \n
 portal = context.getPortalObject()\n
-portal_preferences = portal.portal_preferences\n
-bt = context.portal_templates.getInstalledBusinessTemplate("erp5_demo_maxma_sample")\n
-N_ = context.Base_translateString\n
+bt = portal.portal_templates.getInstalledBusinessTemplate("erp5_demo_maxma_sample")\n
 isTransitionPossible = portal.portal_workflow.isTransitionPossible\n
 \n
-for obj in context.portal_catalog(path=["%%/%s" % i.replace("**", "%") for i in bt.getTemplatePathList()]):\n
+for obj in portal.portal_catalog(path=["%%/%s" % i.replace("**", "%") for i in bt.getTemplatePathList()]):\n
   obj.activate().updateLocalRolesOnSecurityGroups()\n
 \n
-for gadget in context.portal_gadgets.objectValues():\n
+for document in portal.portal_catalog(portal_type=bt.getTemplatePortalTypeRoleList()):\n
+  document.updateLocalRolesOnSecurityGroups()\n
+\n
+conversion_server_hostname = portal.portal_preferences.getPreferredOoodocServerAddress()\n
+conversion_server_port = portal.portal_preferences.getPreferredOoodocServerPortNumber()\n
+for preference_id in ["default_configurator_preference", "default_configurator_system_preference"]:\n
+  preference = getattr(portal.portal_preferences, preference_id)\n
+  if preference.getPortalType() == "System Preference":\n
+    preference.setPreferredOoodocServerPortNumber(conversion_server_port)\n
+    preference.setPreferredOoodocServerAddress(conversion_server_hostname)\n
+\n
+  if isTransitionPossible(preference, "enable"):\n
+    preference.enable()\n
+  preference.updateLocalRolesOnSecurityGroups()\n
+\n
+for gadget in portal.portal_gadgets.objectValues():\n
   if gadget.getValidationState() == \'invisible\':\n
     gadget.visible()\n
     gadget.public()\n
 \n
-# update security settings for default preference # XXX why ???\n
-default_configurator_preference = getattr(portal_preferences,\n
-                                          \'default_configurator_preference\', None)\n
-if default_configurator_preference is not None:\n
-  default_configurator_preference.updateLocalRolesOnSecurityGroups()\n
-\n
 # set manually in \'Module Properties\' respective business_application category\n
 # XXX This should be part of Configuration Item probably, but as access_tab is\n
 # going to be deprecated, make sure it still requires set business application\n
@@ -127,7 +134,7 @@ log("%s" % printed)\n
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>alter_preferences=True</string> </value>
+            <value> <string>**kw</string> </value>
         </item>
         <item>
             <key> <string>id</string> </key>
diff --git a/bt5/erp5_configurator_maxma_demo/bt/revision b/bt5/erp5_configurator_maxma_demo/bt/revision
index 19c7bdba7b..8e2afd3427 100644
--- a/bt5/erp5_configurator_maxma_demo/bt/revision
+++ b/bt5/erp5_configurator_maxma_demo/bt/revision
@@ -1 +1 @@
-16
\ No newline at end of file
+17
\ No newline at end of file
-- 
2.30.9