From 9ba74e2919652db26107d1c59aab85551ce3e61f Mon Sep 17 00:00:00 2001
From: Romain Courteaud <romain@nexedi.com>
Date: Mon, 8 Dec 2008 10:03:09 +0000
Subject: [PATCH] Do not redirect when using portal_contributions, in order to
 prevent conflict with automatic metadata detection

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24824 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../portal_skins/erp5_base/Base_createNewFile.xml | 15 ++++++++++++---
 bt5/erp5_base/bt/revision                         |  2 +-
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base_createNewFile.xml b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base_createNewFile.xml
index 93c1f1b1c3..5046676c27 100644
--- a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base_createNewFile.xml
+++ b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base_createNewFile.xml
@@ -72,16 +72,20 @@ if file.filename not in [\'\', None]:\n
   }\n
 \n
   container = getToolByName(context.getPortalObject(), \'portal_contributions\', None)\n
+  # Do not redirect when using portal_contributions, in order to prevent\n
+  # conflict with automatic metadata detection\n
+  redirect = 0\n
 \n
   is_authorized = 1\n
   if container is None:\n
     container = context\n
     document_new_content_kw[\'portal_type\'] = portal_type\n
+    redirect = 1\n
     if portal_type not in [\'%s\' % x.id for x in container.allowedContentTypes()]:\n
       is_authorized = 0\n
 \n
   if not context.Base_checkPermission(container.getRelativeUrl(),\n
-                                  \'Add portal content\'):\n
+                                      \'Add portal content\'):\n
     is_authorized = 0\n
 \n
   if not is_authorized:\n
@@ -95,8 +99,12 @@ if file.filename not in [\'\', None]:\n
 \n
   message = translateString(\'${portal_type} created successfully.\',\n
                mapping={\'portal_type\': document.getTranslatedPortalType()})\n
-  return document.Base_redirect(\'view\', \n
-                                keep_items=dict(portal_status_message=message))\n
+  if redirect:\n
+    return document.Base_redirect(\'view\', \n
+                                  keep_items=dict(portal_status_message=message))\n
+  else:\n
+    return context.Base_redirect(\'view\', \n
+                                 keep_items=dict(portal_status_message=message))\n
 </string> </value>
         </item>
         <item>
@@ -152,6 +160,7 @@ if file.filename not in [\'\', None]:\n
                             <string>document_new_content_kw</string>
                             <string>document_edit_kw</string>
                             <string>container</string>
+                            <string>redirect</string>
                             <string>is_authorized</string>
                             <string>_write_</string>
                             <string>append</string>
diff --git a/bt5/erp5_base/bt/revision b/bt5/erp5_base/bt/revision
index 34c3a209c7..8fc2b18859 100644
--- a/bt5/erp5_base/bt/revision
+++ b/bt5/erp5_base/bt/revision
@@ -1 +1 @@
-487
\ No newline at end of file
+488
\ No newline at end of file
-- 
2.30.9