source: products/qPloneSkinDump/trunk/Extensions/Install.py @ 2111

Last change on this file since 2111 was 74, checked in by chervol, 18 years ago

initial plone2.0.5 branch import

File size: 1.5 KB
Line 
1from Products.Archetypes.Extensions.utils import install_subskin
2from Products.CMFCore.utils import getToolByName
3try:
4    from Products.CMFCore.permissions import ManagePortal
5except:
6    from Products.CMFCore.CMFCorePermissions import ManagePortal
7
8from Products.qPloneSkinDump.config import *
9from StringIO import StringIO
10
11def install(self):
12    out=StringIO()
13
14    controlpanel_tool = getToolByName(self, 'portal_controlpanel')
15
16    controlpanel_tool.unregisterConfiglet(CONFIGURATION_CONFIGLET)
17    controlpanel_tool.registerConfiglet(id=CONFIGURATION_CONFIGLET, name='qPloneSkinDump Configuration', category='Products',
18                                        action='string:${portal_url}/qploneskindump_config',
19                                        appId=PROJECTNAME,  permission=ManagePortal, imageUrl='skins_icon.gif')
20
21    install_subskin(self, out, GLOBALS)
22
23    out.write('Installation qPloneSkinDump successfully completed.\n')
24    return out.getvalue()
25
26def uninstall(self) :
27    controlpanel_tool = getToolByName(self, 'portal_controlpanel')
28#    controlpanel_tool.unregisterConfiglet(TOOL_ID)
29    controlpanel_tool.unregisterConfiglet(CONFIGURATION_CONFIGLET)
30
31    skinstool = getToolByName(self, 'portal_skins')
32    skinLayer = PROJECTNAME.lower()
33    for skinName in skinstool.getSkinSelections():
34        path = skinstool.getSkinPath(skinName)
35        path = [i.strip() for i in  path.split(',')]
36        if skinLayer in path:
37            path.remove(skinLayer)
38            path = ','.join(path)
39            skinstool.addSkinSelection(skinName, path)
40
Note: See TracBrowser for help on using the repository browser.