From: Christoph G. <svn...@pl...> - 2011-02-28 14:48:27
|
Author: chrigl Date: Mon Feb 28 14:47:56 2011 New Revision: 235308 Added: zettwerk.users/trunk/zettwerk/users/profiles/default/zettwerk.users.actionicons.txt zettwerk.users/trunk/zettwerk/users/setuphandlers.py Modified: zettwerk.users/trunk/zettwerk/users/Extensions/Install.py zettwerk.users/trunk/zettwerk/users/configure.zcml zettwerk.users/trunk/zettwerk/users/profiles.zcml zettwerk.users/trunk/zettwerk/users/profiles/default/controlpanel.xml zettwerk.users/trunk/zettwerk/users/profiles/uninstall/controlpanel.xml Log: - Changed name of controlpanel link - Controlpanel icons. plone3 backward compatibility Modified: zettwerk.users/trunk/zettwerk/users/Extensions/Install.py ============================================================================== --- zettwerk.users/trunk/zettwerk/users/Extensions/Install.py (original) +++ zettwerk.users/trunk/zettwerk/users/Extensions/Install.py Mon Feb 28 14:47:56 2011 @@ -1,4 +1,9 @@ from Products.CMFCore.utils import getToolByName +try: + import plone.app.upgrade + PLONE_VERSION = 4 +except ImportError: + PLONE_VERSION = 3 def uninstall(portal): @@ -6,6 +11,14 @@ setup_tool.runAllImportStepsFromProfile('profile-zettwerk.users:uninstall') cp_tool = getToolByName(portal, 'portal_controlpanel') - cp_tool.unregisterConfiglet('zettwerkusers') + cp_tool.unregisterConfiglet('zettwerkuserlist') + + if PLONE_VERSION == 3: + ai_tool = getToolByName(portal, 'portal_actionicons') + try: + ai_tool.removeActionIcon('controlpanel', 'zettwerkuserlist') + except KeyError: + # was not there, so nothing removed + pass return "Ran all uninstall steps for zettwerk.users" Modified: zettwerk.users/trunk/zettwerk/users/configure.zcml ============================================================================== --- zettwerk.users/trunk/zettwerk/users/configure.zcml (original) +++ zettwerk.users/trunk/zettwerk/users/configure.zcml Mon Feb 28 14:47:56 2011 @@ -5,10 +5,10 @@ i18n_domain="zettwerk.users"> <five:registerPackage package="." initialize=".initialize" /> + <include package=".browser" /> <include file="profiles.zcml" /> <i18n:registerTranslations directory="locales" /> - </configure> Modified: zettwerk.users/trunk/zettwerk/users/profiles.zcml ============================================================================== --- zettwerk.users/trunk/zettwerk/users/profiles.zcml (original) +++ zettwerk.users/trunk/zettwerk/users/profiles.zcml Mon Feb 28 14:47:56 2011 @@ -3,9 +3,16 @@ xmlns:genericsetup="http://namespaces.zope.org/genericsetup" i18n_domain="zettwerk.users"> + <!-- Register the import step --> + <genericsetup:importStep + name="zettwerk.users" + title="zettwerk.users special import handlers" + description="Adds action_icons on plone 3 setups" + handler="zettwerk.users.setuphandlers.setup_action_icons" /> + <genericsetup:registerProfile name="default" - title="Zettwerk Users" + title="Zettwerk Users default" directory="profiles/default" description='Extension profile for Zettwerk Users' provides="Products.GenericSetup.interfaces.EXTENSION" @@ -13,7 +20,7 @@ <genericsetup:registerProfile name="uninstall" - title="Zettwerk Users" + title="Zettwerk Users uninstall" directory="profiles/uninstall" description="Removes Zettwerk Users" provides="Products.GenericSetup.interfaces.EXTENSION" Modified: zettwerk.users/trunk/zettwerk/users/profiles/default/controlpanel.xml ============================================================================== --- zettwerk.users/trunk/zettwerk/users/profiles/default/controlpanel.xml (original) +++ zettwerk.users/trunk/zettwerk/users/profiles/default/controlpanel.xml Mon Feb 28 14:47:56 2011 @@ -1,7 +1,7 @@ <?xml version="1.0"?> <object name="portal_controlpanel" meta_type="Plone Control Panel Tool"> - <configlet title="Zettwerk Users" action_id="zettwerkusers" - appId="ZettwerkUsers" category="Products" condition_expr="" + <configlet title="Zettwerk Userlist" action_id="zettwerkuserlist" + appId="ZettwerkUserlist" category="Products" condition_expr="" url_expr="string:${portal_url}/@@userlist_view" visible="True" icon_expr="string:${portal_url}/++resource++zettwerk.users.images/z.png"> Added: zettwerk.users/trunk/zettwerk/users/profiles/default/zettwerk.users.actionicons.txt ============================================================================== Modified: zettwerk.users/trunk/zettwerk/users/profiles/uninstall/controlpanel.xml ============================================================================== --- zettwerk.users/trunk/zettwerk/users/profiles/uninstall/controlpanel.xml (original) +++ zettwerk.users/trunk/zettwerk/users/profiles/uninstall/controlpanel.xml Mon Feb 28 14:47:56 2011 @@ -1,8 +1,7 @@ <?xml version="1.0"?> <object name="portal_controlpanel" meta_type="Plone Control Panel Tool"> - <configlet remove="True" - title="Zettwerk Users" action_id="zettwerkusers" - appId="ZettwerkUsers" category="Products" condition_expr="" + <configlet remove="True" title="Zettwerk Userlist" action_id="zettwerkuserlist" + appId="ZettwerkUserlist" category="Products" condition_expr="" url_expr="string:${portal_url}/@@userlist_view" visible="True" icon_expr="string:${portal_url}/++resource++zettwerk.users.images/z.png"> Added: zettwerk.users/trunk/zettwerk/users/setuphandlers.py ============================================================================== --- (empty file) +++ zettwerk.users/trunk/zettwerk/users/setuphandlers.py Mon Feb 28 14:47:56 2011 @@ -0,0 +1,27 @@ +from Products.CMFCore.utils import getToolByName +try: + import plone.app.upgrade + PLONE_VERSION = 4 +except ImportError: + PLONE_VERSION = 3 + + +def setup_action_icons(context): + """ Setup action icons """ + # We check from our GenericSetup context whether we are currently + # in the context of our profile + if context.readDataFile('zettwerk.users.actionicons.txt') is None: + # Marker file not present + return + + if PLONE_VERSION == 4: + # we only need this for plone 3 + return + + portal = context.getSite() + ai_tool = getToolByName(portal, 'portal_actionicons') + ai_tool.addActionIcon('controlpanel', 'zettwerkuserlist', + '++resource++zettwerk.users.images/z.png', + title='Zettwerk Userlist') + + return "Ran import steps for plone 3" |