From 58401d97196b2fef9660c8fa57b0334eac829266 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Thu, 16 Aug 2007 13:46:04 +0000
Subject: [PATCH] restore enhanced function handling from r15620 and r15655

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15709 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../my_function.xml                           |  2 +-
 .../erp5_base/Career_getFunctionItemList.xml  | 23 +++++++++++++------
 .../Career_viewFieldLibrary/my_function.xml   | 14 +++++------
 .../my_function.xml                           |  8 +++----
 bt5/erp5_base/bt/revision                     |  2 +-
 5 files changed, 29 insertions(+), 20 deletions(-)

diff --git a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Assignment_viewFieldLibrary/my_function.xml b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Assignment_viewFieldLibrary/my_function.xml
index bad5a163ea..529289a780 100644
--- a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Assignment_viewFieldLibrary/my_function.xml
+++ b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Assignment_viewFieldLibrary/my_function.xml
@@ -139,7 +139,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python: getattr(context.portal_categories.function, preferences.getPreference(\'preferred_category_child_item_list_method_id\', \'getCategoryChildCompactLogicalPathItemList\'))()</string> </value>
+            <value> <string>python: getattr(context.portal_categories.function, preferences.getPreference(\'preferred_category_child_item_list_method_id\', \'getCategoryChildCompactLogicalPathItemList\'))(filter_node=1)</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Career_getFunctionItemList.xml b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Career_getFunctionItemList.xml
index 774f36c52c..0450b9fc4a 100644
--- a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Career_getFunctionItemList.xml
+++ b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Career_getFunctionItemList.xml
@@ -73,16 +73,22 @@
   and extend it with all possible functions.\n
 """\n
 \n
+portal = context.getPortalObject()\n
+category_child_item_list_method_id = portal.portal_preferences.getPreference(\n
+                        \'preferred_category_child_item_list_method_id\',\n
+                        \'getCategoryChildCompactLogicalPathItemList\')\n
 result = []\n
+\n
 if context.getSubordination():\n
   subordination_value = context.getSubordinationValue()\n
   if subordination_value is not None:\n
-    if subordination_value.getFunction():\n
-      function_value = subordination_value.getFunctionValue()\n
-      if function_value is not None:\n
-        result.extend(function_value.getCategoryChildCompactLogicalPathItemList(filter_node=1))\n
+    function_value = subordination_value.getFunctionValue()\n
+    if function_value is not None:\n
+      result.extend(getattr(function_value, category_child_item_list_method_id)(filter_node=1))\n
 \n
-result.extend(context.portal_categories.function.getCategoryChildCompactLogicalPathItemList(filter_node=1))\n
+result.extend(getattr(\n
+         portal.portal_categories.function,\n
+         category_child_item_list_method_id)(filter_node=1))\n
 \n
 return result\n
 </string> </value>
@@ -127,12 +133,15 @@ return result\n
                         <key> <string>co_varnames</string> </key>
                         <value>
                           <tuple>
-                            <string>result</string>
                             <string>_getattr_</string>
-<string>context</string>
+                            <string>context</string>
+                            <string>portal</string>
+                            <string>category_child_item_list_method_id</string>
+                            <string>result</string>
                             <string>subordination_value</string>
                             <string>None</string>
                             <string>function_value</string>
+                            <string>getattr</string>
                           </tuple>
                         </value>
                     </item>
diff --git a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Career_viewFieldLibrary/my_function.xml b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Career_viewFieldLibrary/my_function.xml
index 3f5d8894af..6120cc6a34 100644
--- a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Career_viewFieldLibrary/my_function.xml
+++ b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Career_viewFieldLibrary/my_function.xml
@@ -61,7 +61,7 @@
             <value>
               <dictionary>
                 <item>
-                    <key> <string>description</string> </key>
+                    <key>                 <string>description</string> </key>
                     <value> <string></string> </value>
                 </item>
                 <item>
@@ -73,7 +73,7 @@
                     <value> <string></string> </value>
                 </item>
                 <item>
-                    <key> <string>items</string> </key>
+                    <key>                 <string>items</string> </key>
                     <value>
                       <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
                     </value>
@@ -83,7 +83,7 @@
                     <value> <string></string> </value>
                 </item>
                 <item>
-                    <key> <string>title</string> </key>
+                    <key>                 <string>title</string> </key>
                     <value> <string></string> </value>
                 </item>
               </dictionary>
@@ -94,7 +94,7 @@
             <value>
               <dictionary>
                 <item>
-                    <key>                 <string>description</string> </key>
+                    <key> <string>description</string> </key>
                     <value> <string>The function assigned to the person.</string> </value>
                 </item>
                 <item>
@@ -106,7 +106,7 @@
                     <value> <string>Base_viewFieldLibrary</string> </value>
                 </item>
                 <item>
-                    <key>                 <string>items</string> </key>
+                    <key> <string>items</string> </key>
                     <value>
                       <list/>
                     </value>
@@ -116,7 +116,7 @@
                     <value> <string>Click to edit the target</string> </value>
                 </item>
                 <item>
-                    <key>                 <string>title</string> </key>
+                    <key> <string>title</string> </key>
                     <value> <string>Function</string> </value>
                 </item>
               </dictionary>
@@ -139,7 +139,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python: getattr(context.portal_categories.function, preferences.getPreference(\'preferred_category_child_item_list_method_id\', \'getCategoryChildCompactLogicalPathItemList\'))()</string> </value>
+            <value> <string>here/Career_getFunctionItemList</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Organisation_viewFieldLibrary/my_function.xml b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Organisation_viewFieldLibrary/my_function.xml
index 7ef270b523..591620b907 100644
--- a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Organisation_viewFieldLibrary/my_function.xml
+++ b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Organisation_viewFieldLibrary/my_function.xml
@@ -94,7 +94,7 @@
             <value>
               <dictionary>
                 <item>
-                    <key>                 <string>description</string> </key>
+                    <key> <string>description</string> </key>
                     <value> <string>The function of the organisation.</string> </value>
                 </item>
                 <item>
@@ -106,7 +106,7 @@
                     <value> <string>Base_viewFieldLibrary</string> </value>
                 </item>
                 <item>
-                    <key>                 <string>items</string> </key>
+                    <key> <string>items</string> </key>
                     <value>
                       <list/>
                     </value>
@@ -116,7 +116,7 @@
                     <value> <string>Click to edit the target</string> </value>
                 </item>
                 <item>
-                    <key>                 <string>title</string> </key>
+                    <key> <string>title</string> </key>
                     <value> <string>Function</string> </value>
                 </item>
               </dictionary>
@@ -139,7 +139,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python: getattr(context.portal_categories.function, preferences.getPreference(\'preferred_category_child_item_list_method_id\', \'getCategoryChildCompactLogicalPathItemList\'))(filter_leaves=1)</string> </value>
+            <value> <string>python: getattr(context.portal_categories.function, preferences.getPreference(\'preferred_category_child_item_list_method_id\', \'getCategoryChildCompactLogicalPathItemList\'))(filter_leave=1)</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_base/bt/revision b/bt5/erp5_base/bt/revision
index 70e1a64c23..aca544d017 100644
--- a/bt5/erp5_base/bt/revision
+++ b/bt5/erp5_base/bt/revision
@@ -1 +1 @@
-144
\ No newline at end of file
+145
\ No newline at end of file
-- 
2.30.9