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

Last change on this file since 1 was 1, checked in by myroslav, 18 years ago

Building directory structure

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