1 | from Products.Archetypes.Extensions.utils import install_subskin |
---|
2 | from Products.CMFCore.CMFCorePermissions import ManagePortal |
---|
3 | from Products.CMFCore.utils import getToolByName |
---|
4 | |
---|
5 | from Products.qPloneSkinDump.config import * |
---|
6 | from StringIO import StringIO |
---|
7 | |
---|
8 | def 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 | |
---|
23 | def 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 | |
---|