From ef5b2cacca86c5778f5bcae9ff23a955b2884a87 Mon Sep 17 00:00:00 2001
From: Mayoro Diagne <mayoro@nexedi.com>
Date: Thu, 8 Jul 2010 00:26:23 +0000
Subject: [PATCH] 2010-07-08 mayoro * Select View tab corresponding to
 generated form

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36965 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../EGov_getDefaultCurrentAction.xml          | 134 ++++++++++++++++++
 .../erp5_egov_theme/view_main.xml             |   3 +-
 bt5/erp5_egov/bt/change_log                   |   3 +
 bt5/erp5_egov/bt/revision                     |   2 +-
 4 files changed, 140 insertions(+), 2 deletions(-)
 create mode 100644 bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov_theme/EGov_getDefaultCurrentAction.xml

diff --git a/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov_theme/EGov_getDefaultCurrentAction.xml b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov_theme/EGov_getDefaultCurrentAction.xml
new file mode 100644
index 0000000000..2cfc8d0ce3
--- /dev/null
+++ b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov_theme/EGov_getDefaultCurrentAction.xml
@@ -0,0 +1,134 @@
+<?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>Script_magic</string> </key>
+            <value> <int>3</int> </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>if current_action is None:\n
+ for action in actions:\n
+    if action[\'id\'] == \'view\':\n
+      current_action = action\n
+\n
+return current_action\n
+</string> </value>
+        </item>
+        <item>
+            <key> <string>_code</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string>actions = [], current_action = None</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>2</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>actions</string>
+                            <string>current_action</string>
+                            <string>None</string>
+                            <string>_getiter_</string>
+                            <string>action</string>
+                            <string>_getitem_</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <tuple>
+                <list/>
+                <none/>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>EGov_getDefaultCurrentAction</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov_theme/view_main.xml b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov_theme/view_main.xml
index 094e2831c2..9456efe136 100644
--- a/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov_theme/view_main.xml
+++ b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov_theme/view_main.xml
@@ -65,7 +65,8 @@
             tal:content="string:installUnsavedChangesWarning(\'$message\')">\n
           </script>\n
           <div class="document"\n
-               tal:define="actions actions/object_view | python: []">\n
+               tal:define="actions actions/object_view | python: [];\n
+                           current_action  python: context.EGov_getDefaultCurrentAction(actions,current_action);">\n
             <div class="actions"\n
                  tal:condition="python: (not is_web_mode or editable_mode) and len(actions)">\n
               <button tal:condition="python: not is_web_mode and form_action"\n
diff --git a/bt5/erp5_egov/bt/change_log b/bt5/erp5_egov/bt/change_log
index 85fcbcdaf1..d21a080689 100644
--- a/bt5/erp5_egov/bt/change_log
+++ b/bt5/erp5_egov/bt/change_log
@@ -1,3 +1,6 @@
+2010-07-08 mayoro
+* Select View tab corresponding to generated form
+
 2010-07-07 mayoro
 * remove using getOwner (private method)
 * remove proxy roles
diff --git a/bt5/erp5_egov/bt/revision b/bt5/erp5_egov/bt/revision
index 8d75cc7df7..e8f7ef6cfa 100644
--- a/bt5/erp5_egov/bt/revision
+++ b/bt5/erp5_egov/bt/revision
@@ -1 +1 @@
-705
\ No newline at end of file
+707
\ No newline at end of file
-- 
2.30.9