[1] | 1 | from Products.Archetypes.Extensions.utils import installTypes, install_subskin |
---|
| 2 | from Products.Archetypes.public import listTypes |
---|
| 3 | from Products.CMFCore.utils import getToolByName |
---|
| 4 | from StringIO import StringIO |
---|
| 5 | import os |
---|
| 6 | |
---|
| 7 | from Products.PloneSMSCommunicator.PloneSMSCommunicator import PloneSMSCommunicator |
---|
| 8 | from Products.PloneSMSCommunicator.config import * |
---|
| 9 | |
---|
| 10 | def 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 | |
---|
| 22 | def remove_configlet(self, out): |
---|
| 23 | control_panel=getToolByName(self,'portal_controlpanel') |
---|
| 24 | control_panel.unregisterConfiglet(PROJECTNAME) |
---|
| 25 | print >> out, "Removed configlet.,," |
---|
| 26 | |
---|
| 27 | def 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 | |
---|
| 42 | def uninstall(self): |
---|
| 43 | out = StringIO() |
---|
| 44 | remove_configlet(self, out) |
---|
| 45 | print >> out, "Successfully uninstalled %s." % PROJECTNAME |
---|
| 46 | return out.getvalue() |
---|