From 00de87224be8874111c871d23d9dfc87ab266f55 Mon Sep 17 00:00:00 2001 From: Ivan Tyagov <ivan@nexedi.com> Date: Fri, 25 Mar 2011 12:23:36 +0000 Subject: [PATCH] Use generic script introduced in r44616. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44619 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../WebSite_redirectToUserPreference.xml | 111 ------------------ .../WebSite_viewNavigationMenuWidget.xml | 2 +- bt5/erp5_km/bt/revision | 2 +- 3 files changed, 2 insertions(+), 113 deletions(-) delete mode 100644 bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km/WebSite_redirectToUserPreference.xml diff --git a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km/WebSite_redirectToUserPreference.xml b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km/WebSite_redirectToUserPreference.xml deleted file mode 100644 index 277a21b089..0000000000 --- a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km/WebSite_redirectToUserPreference.xml +++ /dev/null @@ -1,111 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> - </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>"""\n - This script redirects the current user to its \n - active preference. If a user has no preference\n - yet, then it creates a new preference and redirects\n - to it. In case a failure, a message is displayed.\n -"""\n -from zExceptions import Unauthorized\n -\n -# Initialize some useful variables\n -request = context.REQUEST\n -portal = context.getPortalObject()\n -website = context.getWebSiteValue()\n -user = portal.portal_membership.getAuthenticatedMember()\n -user_preference = None\n -portal_preferences = portal.portal_preferences\n -\n -# Find user owned preferences\n -kw = {\'portal_type\': \'Preference\',\n - \'owner\': user}\n -user_preference_list = portal_preferences.searchFolder(**kw)\n -\n -if not len(user_preference_list):\n - # create and enable a user owned preference\n - # if no preference exists\n - try:\n - user_preference = portal_preferences.newContent(\n - portal_type=\'Preference\', \n - title=\'Preference for %s\' %user)\n - user_preference.enable()\n - except Unautorized:\n - # user is not allowed to have its own preference\n - user_preference = None\n -else:\n - user_active_preference_list = portal_preferences.searchFolder(\n - preference_state=\'active\', **kw)\n - if len(user_active_preference_list):\n - # try to find an active preference\n - user_preference = user_active_preference_list[0]\n - else:\n - # if not use the first non active\n - user_preference = user_preference_list[0]\n -\n -# make sure next view is returned again into the context of the web site itself\n -if user_preference is None:\n - translateString = context.Base_translateString\n - msg = translateString("Could not create user preferences.")\n - return context.Base_redirect(form_id="view", keep_items={\'portal_status_message\':msg})\n -else:\n - return user_preference.Base_redirect(form_id="view", keep_items={\'editable_mode\':1})\n -</string> </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>WebSite_redirectToUserPreference</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/WebSite_viewNavigationMenuWidget.xml b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/WebSite_viewNavigationMenuWidget.xml index e0b31d603e..332072000c 100644 --- a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/WebSite_viewNavigationMenuWidget.xml +++ b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/WebSite_viewNavigationMenuWidget.xml @@ -156,7 +156,7 @@ <a href="#" i18n:translate="" i18n:domain="ui">Settings</a>\n <ul>\n <li>\n - <a tal:attributes="href string:${portal_path}/WebSite_redirectToUserPerson"\n + <a tal:attributes="href string:${portal_path}/WebSite_redirectToUserView"\n i18n:translate="" \n i18n:domain="ui">My Profile</a>\n </li>\n diff --git a/bt5/erp5_km/bt/revision b/bt5/erp5_km/bt/revision index a28c3e6791..d20a7de37d 100644 --- a/bt5/erp5_km/bt/revision +++ b/bt5/erp5_km/bt/revision @@ -1 +1 @@ -1787 \ No newline at end of file +1788 \ No newline at end of file -- 2.30.9