source: waeup_product/trunk/Extensions/install.py @ 19

Last change on this file since 19 was 19, checked in by joachim, 19 years ago

initial import

  • Property svn:keywords set to Id
File size: 5.5 KB
Line 
1from Products.CPSInstaller.CPSInstaller import CPSInstaller
2from Products.CMFCore.CMFCorePermissions import View
3try:
4  from Products.CPSSubscriptions.CPSSubscriptionsPermissions import \
5     CanNotifyContent
6  CPSSubscriptions = True
7except ImportError:
8  CPSSubscriptions = False
9try:
10  from Products.CPSForum.CPSForumPermissions import \
11     ForumManageComments
12  CPSForum = True
13except ImportError:
14  CPSForum = False
15
16class WAeUPInstaller(CPSInstaller):
17    """
18    WAeUP Installer
19    """
20    product_name = "WAeUP"
21
22    def install(self,portal):
23        "install"
24
25        product_name = self.product_name
26        self.log("Starting %(product_name)s install" % vars() )
27   
28        ##########################################
29        # Actions
30        ##########################################
31        if CPSSubscriptions:
32            ptypes = "('Portal', 'CPSMailAccess Message', 'CPSMailAccess Box', 'CPSMailAccess Folder',"\
33                     +  "'StudentFolder', 'Student', 'Jamb')"
34            condition = "object.portal_type not in %s" % ptypes
35   
36            action = {'id' : 'notify_content',
37                      'name' : 'action_notify_content',
38                      'action' : 'string:${object_url}/content_notify_email_form',
39                      'condition' : 'python:%s' % condition,
40                      'permission' :  (CanNotifyContent,),
41                      'category' : 'object',
42                      }
43            self.deleteActions({'portal_subscriptions': ['notify_content',]})
44            self.verifyAction('portal_subscriptions', **action)
45        if CPSForum:
46            ptypes = "('StudentFolder', 'Student', 'Jamb')"
47            condition = "object.portal_type not in %s" % ptypes
48   
49            action = {'id' : 'activate_comments',
50                      'name': 'action_activate_comments',
51                      'action': 'string:${object/absolute_url}/set_comment_mode?mode=1',
52                      'condition' : 'python:%s' % condition,
53                      'permission': (ForumManageComments,),
54                      'category' : 'object',
55                      }
56            self.deleteActions({'portal_discussion': ['activate_comments',]})
57            self.verifyAction('portal_subscriptions', **action)
58       
59        ##########################################
60        # SKINS
61        ##########################################
62        self.log("Verifying %(product_name)s skinss" % vars())
63        wskins = { 'waeup_default' : 'Products/WAeUP/skins/waeup_default',
64                   'waeup_student' : 'Products/WAeUP/skins/waeup_student',
65                 }
66        self.verifySkins(wskins)
67        self.resetSkinCache()
68        ##########################################
69        # PORTAL TYPES
70        ##########################################
71        dtypes = portal.getWAeUPTypes()
72        self.verifyFlexibleTypes(dtypes)
73        self.allowContentTypes('StudentFolder', ('Workspace','Section',))
74        #self.allowContentTypes('Student', ('Workspace', 'Section'))
75        ptypes = {
76                  'StudentFolder' : {
77                  'allowed_content_types': ('Student',),
78                  'typeinfo_name': 'WAeUP: StudentFolder',
79                  'add_meta_type': 'Factory-based Type Information',
80                  },
81                  'Student' : {
82                  'allowed_content_types': ('Jamb',),
83                  'typeinfo_name': 'WAeUP: Student',
84                  'add_meta_type': 'Factory-based Type Information',
85                  },
86                 }
87        self.verifyContentTypes(ptypes)
88        ##########################################
89        # PORTAL Schemas
90        ##########################################
91        self.log("Verifying %(product_name)s schemas" % vars())
92        self.verifySchemas(portal.getWAeUPSchemas())
93        ##########################################
94        # PORTAL layouts
95        ##########################################
96        self.log("Verifying %(product_name)s layouts" % vars())
97        self.verifyLayouts(portal.getWAeUPLayouts())
98        ##########################################
99        # PORTAL Vocabularies
100        ##########################################
101        self.log("Verifying %(product_name)s vocabularies" % vars())
102        self.verifyVocabularies(portal.getWAeUPVocabularies())
103   
104        self.installCustomWorkflows()
105        self.verifyWorkflowAssociation()
106       
107        self.log("End of specific %(product_name)s install" % vars())
108        self.finalize()
109       
110
111    def installCustomWorkflows(self):
112        """Installs custom workflows
113        """
114        from Products.WAeUP.Workflows.WAeUPWorkflow import \
115             waeupWorkflowsInstall
116
117        waeupWorkflowsInstall(self.context)
118
119
120    def verifyWorkflowAssociation(self):
121        """Verify workflow association
122        """
123        ws_chains = {
124                      'Student': 'waeup_workspace_wf',
125                      'Jamb': 'waeup_workspace_wf',
126                      }
127
128        se_chains = { 'StudentFolder': 'waeup_section_wf',
129                      'Student': 'waeup_section_wf',
130                      'Jamb': 'waeup_section_wf',
131                      }
132
133        self.verifyLocalWorkflowChains(self.portal['workspaces'],
134                                       ws_chains,
135                                       destructive=1)
136        self.verifyLocalWorkflowChains(self.portal['sections'],
137                                       se_chains,
138                                       destructive=1)
139
140
141def install(self):
142    installer = WAeUPInstaller(self)
143    installer.install(self)
144    return installer.logResult()
Note: See TracBrowser for help on using the repository browser.