source: products/PloneSMSCommunicator/tags/0.1.3/Extensions/Install.py @ 1593

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

Building directory structure

File size: 1.7 KB
Line 
1from Products.Archetypes.Extensions.utils import installTypes, install_subskin
2from Products.Archetypes.public import listTypes
3from Products.CMFCore.utils import getToolByName
4from StringIO import StringIO
5import os
6
7from Products.PloneSMSCommunicator.PloneSMSCommunicator import PloneSMSCommunicator
8from Products.PloneSMSCommunicator.config import *
9
10def install_configlet(self, out):
11    control_panel=getToolByName(self,'portal_controlpanel')
12    control_panel.registerConfiglet(PROJECTNAME,
13                                    'Portal SMS Communicator',
14                                    'string:${portal_url}/prefs_smsCommunicator_properties' ,
15                                     permission=SMSCOMMUNICATOR_MP,
16                                     imageUrl='link_icon.gif',
17                                     category='Products',
18                                    )
19    print >> out, "Installed configlet.,,"
20
21
22def remove_configlet(self, out):
23    control_panel=getToolByName(self,'portal_controlpanel')
24    control_panel.unregisterConfiglet(PROJECTNAME) 
25    print >> out, "Removed configlet.,,"
26
27def install(self):
28
29    out=StringIO();
30    installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME)
31    portal=getToolByName(self, 'portal_url').getPortalObject()
32
33    if COMMUNICATORID not in portal.objectIds():
34        addPloneTool=portal.manage_addProduct[PROJECTNAME].manage_addTool(PROJECTNAME)
35
36    install_subskin(self, out, GLOBALS)
37    install_configlet(self, out)
38
39    print >> out, "Successfully installed %s." % PROJECTNAME
40    return out.getvalue()
41
42def uninstall(self):
43    out = StringIO()
44    remove_configlet(self, out)
45    print >> out, "Successfully uninstalled %s." % PROJECTNAME
46    return out.getvalue()
Note: See TracBrowser for help on using the repository browser.