From 7e6fc61be05414f186ae07beb8942d3ca909944a Mon Sep 17 00:00:00 2001
From: Nicolas Delaby <nicolas@nexedi.com>
Date: Wed, 28 Sep 2011 15:27:06 +0200
Subject: [PATCH] Always edit property which is displayed on UI

Before this patch only coordinate_text property was editable on form, even if url_string value is displayed.
So if user change the value of coordinate_text, the url_tring was still returned as it take precedence over
coordinate_text
---
 .../erp5_base/Organisation_view.xml           |   1 +
 .../my_default_email_coordinate_text.xml      |  27 +++-
 .../my_default_email_url_string.xml           | 115 ++++++++++++++++++
 .../portal_skins/erp5_base/Person_view.xml    |   1 +
 .../my_default_email_coordinate_text.xml      |  27 +++-
 .../my_default_email_url_string.xml           | 115 ++++++++++++++++++
 bt5/erp5_base/bt/revision                     |   2 +-
 7 files changed, 285 insertions(+), 3 deletions(-)
 create mode 100644 bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Organisation_view/my_default_email_url_string.xml
 create mode 100644 bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Person_view/my_default_email_url_string.xml

diff --git a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Organisation_view.xml b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Organisation_view.xml
index 18ac8c2dae..6c1a9f7291 100644
--- a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Organisation_view.xml
+++ b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Organisation_view.xml
@@ -102,6 +102,7 @@
                     <value>
                       <list>
                         <string>my_default_email_coordinate_text</string>
+                        <string>my_default_email_url_string</string>
                         <string>default_telephone</string>
                         <string>default_fax</string>
                         <string>my_default_address_street_address</string>
diff --git a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Organisation_view/my_default_email_coordinate_text.xml b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Organisation_view/my_default_email_coordinate_text.xml
index 7962bd72cb..d09034c96c 100644
--- a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Organisation_view/my_default_email_coordinate_text.xml
+++ b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Organisation_view/my_default_email_coordinate_text.xml
@@ -9,7 +9,9 @@
         <item>
             <key> <string>delegated_list</string> </key>
             <value>
-              <list/>
+              <list>
+                <string>enabled</string>
+              </list>
             </value>
         </item>
         <item>
@@ -50,6 +52,12 @@
             <key> <string>tales</string> </key>
             <value>
               <dictionary>
+                <item>
+                    <key> <string>enabled</string> </key>
+                    <value>
+                      <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+                    </value>
+                </item>
                 <item>
                     <key> <string>field_id</string> </key>
                     <value> <string></string> </value>
@@ -69,6 +77,10 @@
             <key> <string>values</string> </key>
             <value>
               <dictionary>
+                <item>
+                    <key> <string>enabled</string> </key>
+                    <value> <int>1</int> </value>
+                </item>
                 <item>
                     <key> <string>field_id</string> </key>
                     <value> <string>my_email</string> </value>
@@ -87,4 +99,17 @@
       </dictionary>
     </pickle>
   </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <global name="TALESMethod" module="Products.Formulator.TALESField"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_text</string> </key>
+            <value> <string>python: (here.hasDefaultEmail() and not here.getDefaultEmail().isDetailed()) or not here.hasDefaultEmail()</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
 </ZopeData>
diff --git a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Organisation_view/my_default_email_url_string.xml b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Organisation_view/my_default_email_url_string.xml
new file mode 100644
index 0000000000..01c4aec930
--- /dev/null
+++ b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Organisation_view/my_default_email_url_string.xml
@@ -0,0 +1,115 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>delegated_list</string> </key>
+            <value>
+              <list>
+                <string>enabled</string>
+              </list>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>my_default_email_url_string</string> </value>
+        </item>
+        <item>
+            <key> <string>message_values</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>external_validator_failed</string> </key>
+                    <value> <string>The input failed the external validator.</string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>overrides</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>field_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>target</string> </key>
+                    <value> <string></string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>tales</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>enabled</string> </key>
+                    <value>
+                      <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+                    </value>
+                </item>
+                <item>
+                    <key> <string>field_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>target</string> </key>
+                    <value> <string></string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>values</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>enabled</string> </key>
+                    <value> <int>1</int> </value>
+                </item>
+                <item>
+                    <key> <string>field_id</string> </key>
+                    <value> <string>my_view_mode_email_url_string</string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string>Base_viewBaseFieldLibrary</string> </value>
+                </item>
+                <item>
+                    <key> <string>target</string> </key>
+                    <value> <string>Click to edit the target</string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <global name="TALESMethod" module="Products.Formulator.TALESField"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_text</string> </key>
+            <value> <string>python: here.getDefaultEmail().isDetailed()</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Person_view.xml b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Person_view.xml
index 15ab291d94..22ad44e254 100644
--- a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Person_view.xml
+++ b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Person_view.xml
@@ -109,6 +109,7 @@
                     <value>
                       <list>
                         <string>my_default_email_coordinate_text</string>
+                        <string>my_default_email_url_string</string>
                         <string>default_telephone</string>
                         <string>mobile_telephone</string>
                         <string>default_fax</string>
diff --git a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Person_view/my_default_email_coordinate_text.xml b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Person_view/my_default_email_coordinate_text.xml
index 7962bd72cb..d09034c96c 100644
--- a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Person_view/my_default_email_coordinate_text.xml
+++ b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Person_view/my_default_email_coordinate_text.xml
@@ -9,7 +9,9 @@
         <item>
             <key> <string>delegated_list</string> </key>
             <value>
-              <list/>
+              <list>
+                <string>enabled</string>
+              </list>
             </value>
         </item>
         <item>
@@ -50,6 +52,12 @@
             <key> <string>tales</string> </key>
             <value>
               <dictionary>
+                <item>
+                    <key> <string>enabled</string> </key>
+                    <value>
+                      <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+                    </value>
+                </item>
                 <item>
                     <key> <string>field_id</string> </key>
                     <value> <string></string> </value>
@@ -69,6 +77,10 @@
             <key> <string>values</string> </key>
             <value>
               <dictionary>
+                <item>
+                    <key> <string>enabled</string> </key>
+                    <value> <int>1</int> </value>
+                </item>
                 <item>
                     <key> <string>field_id</string> </key>
                     <value> <string>my_email</string> </value>
@@ -87,4 +99,17 @@
       </dictionary>
     </pickle>
   </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <global name="TALESMethod" module="Products.Formulator.TALESField"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_text</string> </key>
+            <value> <string>python: (here.hasDefaultEmail() and not here.getDefaultEmail().isDetailed()) or not here.hasDefaultEmail()</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
 </ZopeData>
diff --git a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Person_view/my_default_email_url_string.xml b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Person_view/my_default_email_url_string.xml
new file mode 100644
index 0000000000..01c4aec930
--- /dev/null
+++ b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Person_view/my_default_email_url_string.xml
@@ -0,0 +1,115 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>delegated_list</string> </key>
+            <value>
+              <list>
+                <string>enabled</string>
+              </list>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>my_default_email_url_string</string> </value>
+        </item>
+        <item>
+            <key> <string>message_values</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>external_validator_failed</string> </key>
+                    <value> <string>The input failed the external validator.</string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>overrides</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>field_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>target</string> </key>
+                    <value> <string></string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>tales</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>enabled</string> </key>
+                    <value>
+                      <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+                    </value>
+                </item>
+                <item>
+                    <key> <string>field_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>target</string> </key>
+                    <value> <string></string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>values</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>enabled</string> </key>
+                    <value> <int>1</int> </value>
+                </item>
+                <item>
+                    <key> <string>field_id</string> </key>
+                    <value> <string>my_view_mode_email_url_string</string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string>Base_viewBaseFieldLibrary</string> </value>
+                </item>
+                <item>
+                    <key> <string>target</string> </key>
+                    <value> <string>Click to edit the target</string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <global name="TALESMethod" module="Products.Formulator.TALESField"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_text</string> </key>
+            <value> <string>python: here.getDefaultEmail().isDetailed()</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_base/bt/revision b/bt5/erp5_base/bt/revision
index eeb072e537..f03187e185 100644
--- a/bt5/erp5_base/bt/revision
+++ b/bt5/erp5_base/bt/revision
@@ -1 +1 @@
-997
+998
\ No newline at end of file
-- 
2.30.9