[1] | 1 | # Author: Melnychuk Taras |
---|
| 2 | # Contact: fenix@quintagroup.com |
---|
| 3 | # Date: $Date: 2006-02-08 12:32:23 |
---|
| 4 | # Copyright: quintagroup.com |
---|
| 5 | |
---|
| 6 | from Products.Archetypes.public import listTypes |
---|
| 7 | from Products.Archetypes.Extensions.utils import installTypes, install_subskin |
---|
| 8 | from Products.CMFCore import CMFCorePermissions |
---|
| 9 | from Products.CMFCore.utils import getToolByName |
---|
| 10 | from StringIO import StringIO |
---|
| 11 | |
---|
| 12 | from Products.qPloneEpydoc.PloneEpydoc import PloneEpydoc |
---|
| 13 | from Products.qPloneEpydoc.config import * |
---|
| 14 | |
---|
| 15 | |
---|
| 16 | def install_tool(self, out, tool='PloneEpydoc'): |
---|
| 17 | portal=getToolByName(self, 'portal_url').getPortalObject() |
---|
| 18 | pt = getToolByName(self, 'portal_types') |
---|
| 19 | if not TOOLID in portal.objectIds(): |
---|
| 20 | addPloneTool=portal.manage_addProduct[PROJECTNAME].manage_addTool(tool) |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | def install_configlet(self, out): |
---|
| 24 | control_panel=getToolByName(self,'portal_controlpanel') |
---|
| 25 | control_panel.registerConfiglet(PROJECTNAME, |
---|
| 26 | 'PloneEpydoc', |
---|
| 27 | 'string:${portal_url}/prefs_portal_documentation', |
---|
| 28 | permission=MANAGE_TOOL_PERMISSION, |
---|
| 29 | imageUrl='topic_icon.gif', |
---|
| 30 | category='Products', |
---|
| 31 | ) |
---|
| 32 | print >> out, "Installed configlet.,," |
---|
| 33 | |
---|
| 34 | |
---|
| 35 | |
---|
| 36 | def remove_configlet(self, out): |
---|
| 37 | |
---|
| 38 | control_panel=getToolByName(self,'portal_controlpanel') |
---|
| 39 | control_panel.unregisterConfiglet(PROJECTNAME) |
---|
| 40 | |
---|
| 41 | def install(self): |
---|
| 42 | |
---|
| 43 | out=StringIO(); |
---|
| 44 | |
---|
| 45 | installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) |
---|
| 46 | install_subskin(self, out, GLOBALS) |
---|
| 47 | install_tool(self, out) |
---|
| 48 | install_configlet(self, out) |
---|
| 49 | |
---|
| 50 | print >> out, "Successfully installed %s." % PROJECTNAME |
---|
| 51 | return out.getvalue() |
---|
| 52 | |
---|
| 53 | def uninstall(self): |
---|
| 54 | out = StringIO() |
---|
| 55 | |
---|
| 56 | remove_configlet(self, out) |
---|
| 57 | |
---|
| 58 | print >> out, "Successfully uninstalled %s." % PROJECTNAME |
---|
| 59 | return out.getvalue() |
---|