root/qTopic/trunk/Extensions/Install.py

Revision 420 (checked in by fenix, 2 years ago)

fixed installation script, modify fti, fixed bugs

Line 
1 from StringIO import StringIO
2 from Products.Archetypes import listTypes
3 from Products.Archetypes.Extensions.utils import installTypes, install_subskin
4 from Products.CMFCore.utils import getToolByName
5
6 from Products.qTopic.config import *
7
8 def install(self):
9     out = StringIO()
10
11     installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME)
12     print >> out, 'Types Installed'
13
14     install_subskin(self, out, GLOBALS)
15     print >> out, 'Skins Installed'
16
17     pact = getToolByName(self, 'portal_actions')
18     pact.addAction( 'export_csv',
19                     'Export in CSV',
20                     'string:$object_url/export_csv?download=1',
21                     'python:(object.meta_type == "qTopic") or (object.meta_type == "ATTopic")',
22                     'View',
23                     'document_actions')
24     pact_icons = getToolByName(self, 'portal_actionicons')
25     pact_icons.addActionIcon('plone',
26                              'export_csv',
27                              'topic_icon.gif',
28                              'Export in CSV')
29
30     out.write('Installation %s successfully completed.\n' % PROJECTNAME)
31     return out.getvalue()
32
33
34 def uninstall(self):
35     skinstool = getToolByName(self, 'portal_skins')
36     for skinName in skinstool.getSkinSelections():
37         path = skinstool.getSkinPath(skinName)
38         path = [i.strip() for i in  path.split(',')]
39         if SKINS_SUBDIR in path:
40             path.remove(SKINS_SUBDIR)
41             path = ','.join(path)
42             skinstool.addSkinSelection(skinName, path)
43        
44     pact_icons = getToolByName(self, 'portal_actionicons')
45     pact_icons.removeActionIcon('plone', 'export_csv')
Note: See TracBrowser for help on using the browser.