From 5f25a82117ec46b87b36c78f9bda498bf915336c Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Thu, 3 Sep 2009 13:41:22 +0000
Subject: [PATCH] * add '/view' at the end for non Web Page documents in
 WebSection_getPermanentURL. * always use getPermanentURL in
 WebSection_viewContentListAsRSS.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28788 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_web/WebSection_getPermanentURL.xml           | 11 +++++++++--
 .../WebSection_viewContentListAsRSS/listbox_link.xml  |  2 +-
 bt5/erp5_web/bt/revision                              |  2 +-
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getPermanentURL.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getPermanentURL.xml
index faf38812ad..657100c3d6 100644
--- a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getPermanentURL.xml
+++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getPermanentURL.xml
@@ -99,7 +99,8 @@ if not reference:\n
 # Return absolute URL if this is not an appropriate portal_type\n
 portal = context.getPortalObject()\n
 valid_portal_type_list = portal.getPortalDocumentTypeList()\n
-if document.getPortalType() not in valid_portal_type_list:\n
+portal_type = document.getPortalType()\n
+if portal_type not in valid_portal_type_list:\n
   return document.absolute_url()\n
 \n
 # Return absolute URL if this is not a \'live\' document\n
@@ -109,7 +110,12 @@ if document.getValidationState() not in validation_state:\n
   return document.absolute_url()\n
 \n
 # Return the URL\n
-return "%s/%s" % (context.absolute_url(), reference)\n
+# XXX we need to add \'/view\' in web view\'s permanent URL for non-Web Page documents.\n
+# If we change the behaviour of index_html() to same as view(), we can remove \'/view\'. \n
+if portal_type == \'Web Page\':\n
+  return "%s/%s" % (context.absolute_url(), reference)\n
+else:\n
+  return "%s/%s/view" % (context.absolute_url(), reference)\n
 </string> </value>
         </item>
         <item>
@@ -152,6 +158,7 @@ return "%s/%s" % (context.absolute_url(), reference)\n
                             <string>context</string>
                             <string>portal</string>
                             <string>valid_portal_type_list</string>
+                            <string>portal_type</string>
                             <string>validation_state</string>
                           </tuple>
                         </value>
diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSection_viewContentListAsRSS/listbox_link.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSection_viewContentListAsRSS/listbox_link.xml
index a4c773921c..6e33ae12de 100644
--- a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSection_viewContentListAsRSS/listbox_link.xml
+++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSection_viewContentListAsRSS/listbox_link.xml
@@ -273,7 +273,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:(cell.getPortalType() == \'Web Page\' and cell.getPermanentURL(cell) or cell.absolute_url() + \'/view\')</string> </value>
+            <value> <string>python:cell.getPermanentURL(cell)</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_web/bt/revision b/bt5/erp5_web/bt/revision
index 6ae4142a6e..c5316a94dd 100644
--- a/bt5/erp5_web/bt/revision
+++ b/bt5/erp5_web/bt/revision
@@ -1 +1 @@
-847
\ No newline at end of file
+848
\ No newline at end of file
-- 
2.30.9