From 067bf46997127725b4fcbb9eed49db9041bb4954 Mon Sep 17 00:00:00 2001
From: Ivan Tyagov <ivan@nexedi.com>
Date: Mon, 5 Dec 2011 15:17:23 +0200
Subject: [PATCH] Allow to see from where (i.e. an URL) resp. CR / CU came
 from. Always use root web site.

---
 .../Base_viewCredentialFieldLibrary.xml       |   1 +
 .../my_view_mode_url_string.xml               | 129 ++++++++++++++++++
 ...edentialRecovery_sendPasswordResetLink.xml |   2 +-
 .../CredentialRecovery_view.xml               |   1 +
 .../CredentialRecovery_view/my_url_string.xml |  84 ++++++++++++
 .../CredentialRequest_view.xml                |   1 +
 .../CredentialRequest_view/my_url_string.xml  |  84 ++++++++++++
 .../erp5_credential/CredentialUpdate_view.xml |   1 +
 .../CredentialUpdate_view/my_url_string.xml   |  84 ++++++++++++
 bt5/erp5_credential/bt/revision               |   2 +-
 10 files changed, 387 insertions(+), 2 deletions(-)
 create mode 100644 bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/Base_viewCredentialFieldLibrary/my_view_mode_url_string.xml
 create mode 100644 bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRecovery_view/my_url_string.xml
 create mode 100644 bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_view/my_url_string.xml
 create mode 100644 bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialUpdate_view/my_url_string.xml

diff --git a/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/Base_viewCredentialFieldLibrary.xml b/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/Base_viewCredentialFieldLibrary.xml
index 0496b6ebb8..d280686039 100644
--- a/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/Base_viewCredentialFieldLibrary.xml
+++ b/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/Base_viewCredentialFieldLibrary.xml
@@ -159,6 +159,7 @@
                         <string>my_view_mode_group_list</string>
                         <string>my_view_mode_destination_decision_person_title_list</string>
                         <string>my_view_mode_read_only_default_credential_question_question_title</string>
+                        <string>my_view_mode_url_string</string>
                       </list>
                     </value>
                 </item>
diff --git a/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/Base_viewCredentialFieldLibrary/my_view_mode_url_string.xml b/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/Base_viewCredentialFieldLibrary/my_view_mode_url_string.xml
new file mode 100644
index 0000000000..f958430dec
--- /dev/null
+++ b/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/Base_viewCredentialFieldLibrary/my_view_mode_url_string.xml
@@ -0,0 +1,129 @@
+<?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>default</string>
+                <string>editable</string>
+                <string>title</string>
+              </list>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>my_view_mode_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>default</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>
+                <item>
+                    <key> <string>title</string> </key>
+                    <value> <string></string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>values</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>default</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>editable</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+                <item>
+                    <key> <string>field_id</string> </key>
+                    <value> <string>my_string_field</string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string>Base_viewFieldLibrary</string> </value>
+                </item>
+                <item>
+                    <key> <string>target</string> </key>
+                    <value> <string>Click to edit the target</string> </value>
+                </item>
+                <item>
+                    <key> <string>title</string> </key>
+                    <value> <string>Came from</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>here/getUrlString</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRecovery_sendPasswordResetLink.xml b/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRecovery_sendPasswordResetLink.xml
index d5f30578fa..e788330a4e 100644
--- a/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRecovery_sendPasswordResetLink.xml
+++ b/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRecovery_sendPasswordResetLink.xml
@@ -63,7 +63,7 @@ if message_reference is None:\n
 notification_message = portal.NotificationTool_getDocumentValue(message_reference,\n
                                                                 context.getLanguage())\n
 \n
-context.REQUEST.set(\'came_from\', context.getUrlString())\n
+context.REQUEST.set(\'came_from\', portal.absolute_url())\n
 \n
 portal.portal_password.mailPasswordResetRequest(user_login=reference,\n
                                                 REQUEST=context.REQUEST,\n
diff --git a/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRecovery_view.xml b/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRecovery_view.xml
index 341eb5e16f..6cf2885f71 100644
--- a/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRecovery_view.xml
+++ b/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRecovery_view.xml
@@ -102,6 +102,7 @@
                         <string>my_default_email_text</string>
                         <string>my_default_credential_question_answer</string>
                         <string>my_destination_decision_title_list</string>
+                        <string>my_url_string</string>
                       </list>
                     </value>
                 </item>
diff --git a/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRecovery_view/my_url_string.xml b/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRecovery_view/my_url_string.xml
new file mode 100644
index 0000000000..4a3d5d6773
--- /dev/null
+++ b/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRecovery_view/my_url_string.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>my_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>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>field_id</string> </key>
+                    <value> <string>my_view_mode_url_string</string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string>Base_viewCredentialFieldLibrary</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>
+</ZopeData>
diff --git a/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_view.xml b/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_view.xml
index 8f5cc0c14c..cf589e9561 100644
--- a/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_view.xml
+++ b/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_view.xml
@@ -118,6 +118,7 @@
                         <string>my_skill_list</string>
                         <string>my_start_date</string>
                         <string>my_stop_date</string>
+                        <string>my_url_string</string>
                       </list>
                     </value>
                 </item>
diff --git a/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_view/my_url_string.xml b/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_view/my_url_string.xml
new file mode 100644
index 0000000000..4a3d5d6773
--- /dev/null
+++ b/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_view/my_url_string.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>my_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>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>field_id</string> </key>
+                    <value> <string>my_view_mode_url_string</string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string>Base_viewCredentialFieldLibrary</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>
+</ZopeData>
diff --git a/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialUpdate_view.xml b/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialUpdate_view.xml
index 6cceea70fc..d5e1d28234 100644
--- a/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialUpdate_view.xml
+++ b/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialUpdate_view.xml
@@ -123,6 +123,7 @@
                         <string>my_skill_list</string>
                         <string>my_start_date</string>
                         <string>my_stop_date</string>
+                        <string>my_url_string</string>
                       </list>
                     </value>
                 </item>
diff --git a/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialUpdate_view/my_url_string.xml b/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialUpdate_view/my_url_string.xml
new file mode 100644
index 0000000000..4a3d5d6773
--- /dev/null
+++ b/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialUpdate_view/my_url_string.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>my_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>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>field_id</string> </key>
+                    <value> <string>my_view_mode_url_string</string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string>Base_viewCredentialFieldLibrary</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>
+</ZopeData>
diff --git a/bt5/erp5_credential/bt/revision b/bt5/erp5_credential/bt/revision
index 7b89b2202c..009bd2c17f 100644
--- a/bt5/erp5_credential/bt/revision
+++ b/bt5/erp5_credential/bt/revision
@@ -1 +1 @@
-406
\ No newline at end of file
+407
\ No newline at end of file
-- 
2.30.9