From 09db248b1798de3059ea36468f659769c02b1afb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Tue, 27 Nov 2007 12:31:50 +0000
Subject: [PATCH] when showing the current function of a career or a person,
 make sure to show only leaves, because a function node can be acquired from
 the person

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17816 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_base/Career_getFunction.xml          | 152 ++++++++++++++++++
 .../Career_viewFieldLibrary/my_function.xml   |  43 +++--
 bt5/erp5_base/bt/revision                     |   2 +-
 3 files changed, 185 insertions(+), 12 deletions(-)
 create mode 100644 bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Career_getFunction.xml

diff --git a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Career_getFunction.xml b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Career_getFunction.xml
new file mode 100644
index 0000000000..52cfbcbd8e
--- /dev/null
+++ b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Career_getFunction.xml
@@ -0,0 +1,152 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>Python_magic</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>Script_magic</string> </key>
+            <value> <int>3</int> </value>
+        </item>
+        <item>
+            <key> <string>__ac_local_roles__</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_bind_names</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>_asgns</string> </key>
+                        <value>
+                          <dictionary>
+                            <item>
+                                <key> <string>name_container</string> </key>
+                                <value> <string>container</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_context</string> </key>
+                                <value> <string>context</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_m_self</string> </key>
+                                <value> <string>script</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_subpath</string> </key>
+                                <value> <string>traverse_subpath</string> </value>
+                            </item>
+                          </dictionary>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>_body</string> </key>
+            <value> <string>\'\'\'Returns the function of this career or person.\n
+\n
+We can only select leaves for career of person functions, so we don\'t show the\n
+function if the function is a node in the function tree (this happens when\n
+function is acquired from the subordination organisation).\n
+\'\'\'\n
+function_value = context.getFunctionValue()\n
+if len(function_value):\n
+  return None\n
+return context.getFunction()\n
+</string> </value>
+        </item>
+        <item>
+            <key> <string>_code</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_filepath</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>errors</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_code</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>co_argcount</string> </key>
+                        <value> <int>0</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>_getattr_</string>
+<string>context</string>
+                            <string>function_value</string>
+                            <string>len</string>
+                            <string>None</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>Career_getFunction</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
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 6120cc6a34..7e8ee21a2f 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
@@ -3,11 +3,8 @@
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
       <tuple>
-        <tuple>
-          <string>Products.ERP5Form.ProxyField</string>
-          <string>ProxyField</string>
-        </tuple>
-        <none/>
+        <global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
+        <tuple/>
       </tuple>
     </pickle>
     <pickle>
@@ -18,6 +15,7 @@
               <list>
                 <string>title</string>
                 <string>description</string>
+                <string>default</string>
                 <string>items</string>
               </list>
             </value>
@@ -60,6 +58,12 @@
             <key> <string>tales</string> </key>
             <value>
               <dictionary>
+                <item>
+                    <key>                 <string>default</string> </key>
+                    <value>
+                      <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+                    </value>
+                </item>
                 <item>
                     <key>                 <string>description</string> </key>
                     <value> <string></string> </value>
@@ -75,7 +79,7 @@
                 <item>
                     <key>                 <string>items</string> </key>
                     <value>
-                      <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+                      <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
                     </value>
                 </item>
                 <item>
@@ -93,6 +97,10 @@
             <key> <string>values</string> </key>
             <value>
               <dictionary>
+                <item>
+                    <key>                 <string>default</string> </key>
+                    <value> <string></string> </value>
+                </item>
                 <item>
                     <key> <string>description</string> </key>
                     <value> <string>The function assigned to the person.</string> </value>
@@ -128,11 +136,24 @@
   <record id="2" aka="AAAAAAAAAAI=">
     <pickle>
       <tuple>
-        <tuple>
-          <string>Products.Formulator.TALESField</string>
-          <string>TALESMethod</string>
-        </tuple>
-        <none/>
+        <global name="TALESMethod" module="Products.Formulator.TALESField"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_text</string> </key>
+            <value> <string>here/Career_getFunction</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="3" aka="AAAAAAAAAAM=">
+    <pickle>
+      <tuple>
+        <global name="TALESMethod" module="Products.Formulator.TALESField"/>
+        <tuple/>
       </tuple>
     </pickle>
     <pickle>
diff --git a/bt5/erp5_base/bt/revision b/bt5/erp5_base/bt/revision
index b3b2268d23..d903d59723 100644
--- a/bt5/erp5_base/bt/revision
+++ b/bt5/erp5_base/bt/revision
@@ -1 +1 @@
-228
\ No newline at end of file
+229
\ No newline at end of file
-- 
2.30.9