Changeset 102 for waeup_product/trunk/skins/waeup_default
- Timestamp:
- 27 Oct 2005, 09:59:31 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup_product/trunk/skins/waeup_default/getWAeUPTypes.py
r101 r102 1 1 #-*- mode: python; mode: fold -*- 2 2 # $Id$ 3 from Products.CPSInstaller.CPSInstaller import CPSInstaller 4 from Products.CMFCore.CMFCorePermissions import View, ModifyPortalContent 3 """Return custom document types.""" 4 # permissions 5 from Products.CMFCore.permissions import View 6 from Products.CMFCore.permissions import ModifyPortalContent 7 from Products.CMFCore.permissions import AddPortalContent 5 8 from Products.WAeUP.WAeUPPermissions import UniversityManage, StudentManage,FacultyManage,\ 6 9 DepartmentManage,CourseManage 7 try: 8 from Products.CPSSubscriptions.permissions import CanNotifyContent 9 CPSSubscriptions = True 10 except ImportError: 11 CPSSubscriptions = False 12 try: 13 from Products.CPSForum.CPSForumPermissions import ForumManageComments 14 CPSForum = True 15 except ImportError: 16 CPSForum = False 17 18 from Products.WAeUP.Students import addStudentsFolder 19 20 class WAeUPInstaller(CPSInstaller): 21 """ 22 WAeUP Installer 23 """ 24 product_name = "WAeUP" 25 26 def install(self,portal): 27 "install" 28 29 product_name = self.product_name 30 self.log("Starting %(product_name)s install" % vars() ) 31 32 # Roles and Permissions ###( 33 # 34 self.verifyRoles(( 35 # A role that can manage the University. 36 'UniversityManager', 37 # A role that can manage the StudentsRecords. 38 'StudentManager', 39 # A role that can manage a Faculty. 40 'FacultyManager', 41 # A role that can manage a department. 42 'DepartmentManager', 43 # A role that can manage a Course. 44 'CourseManager', 45 # The Student Role 46 'Student', 47 )) 48 waeup_perms = { 49 UniversityManage: 50 ('Manager', 'SectionManager','UniversityManager', 51 ), 52 StudentManage: 53 ('Manager', 'SectionManager','UniversityManager', 'StudentManager' 54 ), 55 FacultyManage: 56 ('Manager', 'SectionManager','UniversityManager', 'FacultyManager' 57 ), 58 DepartmentManage: 59 ('Manager', 'SectionManager','UniversityManager', 'DepartmentManager' 60 ), 61 CourseManage: 62 ('Manager', 'SectionManager','UniversityManager', 'CourseManager' 63 ), 10 ChangePermissions = 'Change permissions' 11 12 university_type = { ###( 13 'title': 'WAeUP Base Folder', 14 'description': 'The WAeUP Container', 15 'content_icon': 'students_folder.gif', 16 'content_meta_type': 'University', 17 'product': 'WAeUP', 18 'factory': 'addUniversity', 19 'immediate_view': 'university_view', 20 'global_allow': 1, 21 'filter_content_types': 1, 22 'allowed_content_types': ('StudentsFolder','Faculty'), 23 'allow_discussion': 0, 24 'cps_is_searchable': 1, 25 'cps_display_as_document_in_listing': 1, 26 'cps_proxy_type': 'folder', 27 'schemas': ['metadata', 'common', 'folder'], 28 'layouts': ['common', 'university'], 29 'layout_clusters': ['metadata:metadata'], 30 'cps_section_wf': 'waeup_section_wf', 31 'actions': ({'id': 'view', 32 'name': 'action_view', 33 'action': 'university_view', 34 'condition': "python:member and 'Manager' in member.getRoles()", 35 'permissions': (View,)}, 36 {'id': 'add_faculty', 37 'name': 'Add a Faculty', 38 'action' : 'string:${object/absolute_url}/create_common?type_name=Faculty', 39 #'action': 'folder_factories', 40 'permissions': (ModifyPortalContent,UniversityManage,)}, 41 {'id': 'contents', 42 'name': 'action_folder_contents', 43 'action': 'folder_contents', 44 'condition': "python:member and 'Manager' in member.getRoles()", 45 'permissions': (ModifyPortalContent,UniversityManage,)}, 46 {'id': 'edit', 47 'name': 'action_edit', 48 'action': 'cpsdocument_edit_form', 49 'condition': "python:member and 'Manager' in member.getRoles()", 50 'permissions': (ModifyPortalContent,UniversityManage,)}, 51 {'id': 'metadata', 52 'name': 'action_metadata', 53 'action': 'cpsdocument_metadata', 54 'condition': "python:member and 'Manager' in member.getRoles()", 55 'permissions': (ModifyPortalContent,)}, 56 {'id': 'localroles', 57 'name': 'action_local_roles', 58 'action': 'folder_localrole_form', 59 'condition': 'python:0', 60 'permissions': (ModifyPortalContent,)}, 61 ) 64 62 } 65 self.setupPortalPermissions(waeup_perms) 66 67 ###) 68 69 ########################################## 70 # Actions 71 ########################################## 72 if CPSSubscriptions: ###( 73 ptypes = "('Portal', 'CPSMailAccess Message', 'CPSMailAccess Box', 'CPSMailAccess Folder',"\ 74 + "'University', 'StudentsFolder', 'Student', 'Jamb', 'Faculty', 'Department','Course')" 75 condition = "object.portal_type not in %s" % ptypes 76 77 action = {'id' : 'notify_content', 78 'name' : 'action_notify_content', 79 'action' : 'string:${object_url}/content_notify_email_form', 80 'condition' : 'python:%s' % condition, 81 'permission' : (CanNotifyContent,), 82 'category' : 'object', 83 } 84 self.deleteActions({'portal_subscriptions': ['notify_content',]}) 85 self.verifyAction('portal_subscriptions', **action) 86 if CPSForum: 87 ptypes = "('University','StudentsFolder','Student', 'Jamb','Faculty', 'Department','Course')" 88 condition = "object.portal_type not in %s" % ptypes 89 90 action = {'id' : 'activate_comments', 91 'name': 'action_activate_comments', 92 'action': 'string:${object/absolute_url}/set_comment_mode?mode=1', 93 'condition' : 'python:%s' % condition, 94 'permission': (ForumManageComments,), 95 'category' : 'object', 96 } 97 self.deleteActions({'portal_subscriptions': ['activate_comments',]}) 98 self.verifyAction('portal_subscriptions', **action) 99 # now portal_discussion 100 self.deleteActions({'portal_discussion': ['comment', 101 'activate_comments', 102 'deactivate_comments', 103 'manage_comments']}) 104 action = {'id' : 'comment', 105 'name': 'action_comment', 106 'action': "string:${object/absolute_url}/post_comment", 107 'condition' : "python:getattr(object.getContent(), 'allow_discussion' , None) and object.hasCommentAction()", 108 'permission': (View,), 109 'category' : 'object', 110 } 111 self.verifyAction('portal_discussion', **action) 112 action = {'id' : 'activate_comments', 113 'name': 'action_activate_comments', 114 'action': "string:${object/absolute_url}/set_comment_mode?mode=1", 115 'condition' : "python:getattr(object.getTypeInfo(),'cps_proxy_type','') in ('document', 'folderishdocument') and getattr(object.getContent(), 'allow_discussion' , None) == 1", 116 'permission': (ForumManageComments,), 117 'category' : 'object', 118 } 119 self.verifyAction('portal_discussion', **action) 120 action = {'id' : 'deactivate_comments', 121 'name': 'action_deactivate_comments', 122 'action': "string:${object/absolute_url}/set_comment_mode?mode=0", 123 'condition' : "python:getattr(object.getTypeInfo(),'cps_proxy_type','') in ('document', 'folderishdocument') and getattr(object.getContent(), 'allow_discussion' , None) == 1", 124 'permission': (ForumManageComments,), 125 'category' : 'object', 126 } 127 self.verifyAction('portal_discussion', **action) 128 action = {'id' : 'manage_comments', 129 'name': 'action_manage_comments', 130 'action': "string:${object/absolute_url}/manage_comment", 131 'condition' : "python:getattr(object.getTypeInfo(),'cps_proxy_type','') in ('document', 'folderishdocument') and getattr(object.getContent(), 'allow_discussion' , None) == 1", 132 'permission': (ForumManageComments,), 133 'category' : 'object', 134 } 135 self.verifyAction('portal_discussion', **action) 136 137 ###) 138 139 ########################################## 140 # main_tab actions ###( 141 ########################################## 142 actions = ( { 'tool' : 'portal_actions', 143 'id' : 'student_administration', 144 'name' : 'Student Administration', 145 'action' : 'string:${portal_url}/sections/waeup/students', 146 'permission': (View, ), 147 'category' : 'main_tabs', 148 'visible' : 1, 149 }, 150 { 'tool' : 'portal_actions', 151 'id' : 'faculties', 152 'name' : 'Faculties', 153 'action' : 'string:${portal_url}/sections/waeup/faculties', 154 'permission': (View ), 155 'category' : 'main_tabs', 156 'visible' : 1, 157 }, 158 ## { 'tool' : 'portal_actions', 159 ## 'id' : 'add_jamb', 160 ## 'name' : 'Add Student JAMB', 161 ## 'action' : 'string:${object/absolute_url}/create_jamb', 162 ## 'permission': (), 163 ## 'condition' : 'python: member and here.portal_type in ("StudentsFolder",) and "StudentManager" in member.getGroups()', 164 ## 'category' : 'student', 165 ## 'visible' : 1, 166 ## }, 167 ## { 'tool' : 'portal_actions', 168 ## 'id' : 'add_faculty', 169 ## 'name' : 'Add New Faculty', 170 ## 'action' : 'string:${object/absolute_url}/addFaculty', 171 ## 'permission': (), 172 ## 'condition' : 'python: member and here.portal_type in ("University",) and "StudentManager" in member.getGroups()', 173 ## 'category' : 'student', 174 ## 'visible' : 1, 175 ## }, 176 ## { 'tool' : 'portal_actions', 177 ## 'id' : 'add_department', 178 ## 'name' : 'Add New Department', 179 ## 'action' : 'string:${object/absolute_url}/addDepartment', 180 ## 'permission': (), 181 ## 'condition' : 'python: member and here.portal_type in ("Faculty",) and "StudentManager" in member.getGroups()', 182 ## 'category' : 'student', 183 ## 'visible' : 1, 184 ## }, 185 ## { 'tool' : 'portal_actions', 186 ## 'id' : 'add_course', 187 ## 'name' : 'Add New Course', 188 ## 'action' : 'string:${object/absolute_url}/addCourse', 189 ## 'permission': (), 190 ## 'condition' : 'python: member and here.portal_type in ("Department",) and "StudentManager" in member.getGroups()', 191 ## 'category' : 'student', 192 ## 'visible' : 1, 193 ## }, 194 ## { 'tool' : 'portal_actions', 195 ## 'id' : 'add_personal', 196 ## 'name' : 'Add personal Data', 197 ## 'action' : 'string:${object/absolute_url}/create_personal_form', 198 ## 'permission': (), 199 ## 'condition' : 'python: 0 and member and not here.portal_type in ("Jamb","StudentsFolder") and not "StudentManager" in member.getGroups()', 200 ## 'category' : 'student', 201 ## 'visible' : 1, 202 ## }, 203 ## { 'tool' : 'portal_actions', 204 ## 'id' : 'edit_jamb', 205 ## 'name' : 'Edit Jamb Data', 206 ## 'action' : 'cpsdocument_edit_form', 207 ## 'permission': ( ), 208 ## 'condition' : 'python: member and here.portal_type in ("Student",) and "StudentManager" in member.getGroups()', 209 ## 'category' : 'student', 210 ## 'visible' : 1, 211 ## }, 212 ) 213 self.verifyActions(actions) 214 ########################################## 215 ###) 216 217 # skins 218 ########################################## 219 self.log("Verifying %(product_name)s skinss" % vars()) 220 wskins = { 'waeup_default' : 'Products/WAeUP/skins/waeup_default', 221 'waeup_faculty' : 'Products/WAeUP/skins/waeup_faculty', 222 'waeup_student' : 'Products/WAeUP/skins/waeup_student', 223 } 224 self.verifySkins(wskins) 225 self.resetSkinCache() 226 227 ########################################## 228 # portal types 229 ########################################## 230 dtypes = portal.getWAeUPTypes() 231 self.verifyFlexibleTypes(dtypes) 232 self.allowContentTypes('University', ('Workspace','Section',)) 233 ########################################## 234 # Schemas 235 ########################################## 236 self.log("Verifying %(product_name)s schemas" % vars()) 237 self.verifySchemas(portal.getWAeUPSchemas()) 238 ########################################## 239 # widgets 240 ########################################## 241 self.log("Verifying %(product_name)s widgets" % vars()) 242 self.verifyWidgets(portal.getWAeUPWidgets()) 243 ########################################## 244 # layouts 245 ########################################## 246 self.log("Verifying %(product_name)s layouts" % vars()) 247 self.verifyLayouts(portal.getWAeUPLayouts()) 248 ########################################## 249 # Vocabularies 250 ########################################## 251 self.log("Verifying %(product_name)s vocabularies" % vars()) 252 self.verifyVocabularies(portal.getWAeUPVocabularies()) 253 ########################################## 254 # Groups 255 ########################################## 256 257 self.installCustomWorkflows() 258 self.verifyWorkflowAssociation() 259 260 self.log("End of specific %(product_name)s install" % vars()) 261 self.finalize() 262 263 264 def installCustomWorkflows(self): 265 """Installs custom workflows 266 """ 267 from Products.WAeUP.Workflows.WAeUPWorkflow import \ 268 waeupWorkflowsInstall 269 270 waeupWorkflowsInstall(self.context) 271 272 273 def verifyWorkflowAssociation(self): 274 """Verify workflow association 275 """ 276 ws_chains = { 277 'Student': 'waeup_workspace_wf', 278 'Jamb': 'waeup_workspace_wf', 279 } 280 281 se_chains = { 'University': 'waeup_section_wf', 282 'StudentsFolder': 'waeup_section_wf', 283 'Student': 'waeup_section_wf', 284 'StudentPersonal': 'waeup_section_wf', 285 'Jamb': 'waeup_section_wf', 286 'ScratchCard': 'waeup_section_wf', 287 'Faculty': 'waeup_section_wf', 288 'Department': 'waeup_section_wf', 289 'Course': 'waeup_section_wf', 290 } 291 292 self.verifyLocalWorkflowChains(self.portal['workspaces'], 293 ws_chains, 294 destructive=1) 295 self.verifyLocalWorkflowChains(self.portal['sections'], 296 se_chains, 297 destructive=1) 298 299 300 def install(self): 301 installer = WAeUPInstaller(self) 302 installer.install(self) 303 dirtool = getattr(self,'portal_directories') 304 groups = dirtool.groups 305 for delEntry in ('StudentManager',): 306 if delEntry in groups.listEntryIds(): 307 groups.deleteEntry(delEntry) 308 for newEntry in ('Students',): 309 if newEntry not in groups.listEntryIds(): 310 groups.createEntry({'group': newEntry, 311 'members': []}) 312 #groups.manage_setLocalGroupRoles(groupid = 'StudentManager',roles=('Manager',)) 313 #groups.manage_setLocalGroupRoles(groupid = 'Students',roles=('Contributor',)) 314 sections = getattr(self,'sections') 315 waeup = getattr(sections,'waeup',None) 316 if not waeup: 317 sections.content_create(type_name='University',title='waeup') 318 sections.waeup.folder_localrole_add(member_ids=('group:Students',), 319 member_role='SectionReviewer', 320 ) 321 sections.waeup.content_create(type_name='StudentsFolder',title='students') 322 sections.waeup.folder_localrole_add(member_ids=('group:Students',), 323 member_role='SectionReviewer', 324 ) 325 ## sections.waeup.folder_localrole_add(member_ids=('group:StudentManager',), 326 ## member_role='SectionManager', 327 ## ) 328 sections.waeup.students.manage_setLocalGroupRoles(groupid = 'Students',roles=('Contributor',)) 329 sections.waeup.manage_setLocalGroupRoles(groupid = 'role:Anonymous',roles=('SectionReader',)) 330 # portlets ###( 331 # 332 portlets = ( 333 ## {'identifier': 'waeup_main_tabs', 334 ## 'type': 'Custom Portlet', 335 ## 'slot': 'main_tabs', 336 ## 'order': 0, 337 ## 'render_method': 'portlet_main_navigation', 338 ## 'Title': 'main tabs', 339 ## }, 340 {'identifier': 'waeup_breadcrumbs', 341 'type': 'Breadcrumbs Portlet', 342 'slot': 'waeup_breadcrumbs', 343 'first_item': 2, 344 'display_site_root': 0, 345 'Title': 'waeup_breadcrumbs', 346 'display': 'horizontal_trail', 347 'display_hidden_folders': 0, 348 'order': 0, 349 }, 350 {'identifier': 'waeup_main_tab_actions', 351 'type': 'Actions Portlet', 352 'slot': 'main_tabs', 353 'order': 0, 354 'categories': ['main_tabs',], 355 'Title': 'waep_main_tab_actions', 356 }, 357 {'identifier': 'waeup_object_actions', 358 'type': 'Actions Portlet', 359 'slot': 'waeup_object_actions', 360 'order': 0, 361 'categories': ['object',], 362 'Title': 'waep_manager_actions', 363 }, 364 {'identifier': 'waeup_left_top', 365 'type': 'Custom Portlet', 366 'slot': 'left_top', 367 'order': 0, 368 'render_method': 'portlet_session_info', 369 'Title': 'Session Info', 370 }, 371 ) 372 installer.verifyPortletContainer(waeup) 373 installer.verifyPortlets(portlets,waeup) 374 375 ###) 376 377 return installer.logResult() 63 ###) 64 65 students_folder_type = { ###( 66 'title': 'WAeUP Student Folder', 67 'description': 'The WAeUP Student Folder', 68 'content_icon': 'students_folder.gif', 69 'content_meta_type': 'StudentsFolder', 70 'product': 'CPSDefault', 71 'factory': 'addFolder', 72 'immediate_view': 'folder_view', 73 'global_allow': 1, 74 'filter_content_types': 1, 75 'allowed_content_types': ('Student'), 76 #'allowed_content_types': ('Student','ScratchCard'), 77 'allow_discussion': 0, 78 'cps_is_searchable': 1, 79 'cps_display_as_document_in_listing': 1, 80 'cps_proxy_type': 'folder', 81 'schemas': ['metadata', 'common', 'folder'], 82 'layouts': ['waeup_common','folder'], 83 'layout_clusters': ['metadata:metadata'], 84 'cps_section_wf': 'waeup_section_wf', 85 'actions': ({'id': 'view', 86 'name': 'Students', 87 'action': 'students_folder_view', 88 'condition': "python:member and 'Manager' in member.getRoles()", 89 'permissions': (View,)}, 90 ## { 91 ## 'id' : 'add_content', 92 ## 'name' : 'Add Content', 93 ## 'action' : 'string:${object/absolute_url}/folder_factories', 94 ## 'condition': "python:member and 'Manager' in member.getRoles()", 95 ## 'permissions': (StudentManage,)}, 96 { 97 'id' : 'add_jamb', 98 'name' : 'Add Student JAMB', 99 'action' : 'string:${object/absolute_url}/create_jamb', 100 'permissions': (UniversityManage,StudentManage)}, 101 ## {'id': 'contents', 102 ## 'name': 'action_folder_contents', 103 ## 'action': 'folder_contents', 104 ## 'permissions': (UniversityManage,)}, 105 ## {'id': 'edit', 106 ## 'name': 'action_edit', 107 ## 'action': 'cpsdocument_edit_form', 108 ## 'permissions': (UniversityManage,)}, 109 ## {'id': 'metadata', 110 ## 'name': 'action_metadata', 111 ## 'action': 'cpsdocument_metadata', 112 ## 'permissions': (UniversityManage,)}, 113 ## {'id': 'localroles', 114 ## 'name': 'action_local_roles', 115 ## 'action': 'folder_localrole_form', 116 ## 'permissions': (UniversityManage,)}, 117 ) 118 } 119 ###) 120 121 student_type = { ###( 122 'title': 'WAeUP Student', 123 'description': '', 124 'content_icon': 'student.gif', 125 'content_meta_type': 'Student', 126 'product': 'WAeUP', 127 'factory': 'addStudent', 128 'immediate_view': 'cpsdocument_view', 129 'global_allow': True, 130 'filter_content_types': True, 131 'allowed_content_types': ('Jamb','StudentPersonal'), 132 'allow_discussion': False, 133 'cps_is_searchable': True, 134 'cps_proxy_type': 'document', 135 'cps_display_as_document_in_listing': True, 136 'schemas': ['metadata','common','student'], 137 'layouts': ['waeup_common','student'], 138 'flexible_layouts': (), 139 'layout_clusters': ['metadata:metadata'], 140 'cps_section_wf': 'waeup_section_wf', 141 'use_content_status_history': 0, 142 'actions': ( 143 {'id': 'view', 144 'name': 'action_view', 145 'action': 'string:${object_url}/student_index_html', 146 #'action': 'string:${object_url}/cpsdocument_view', 147 'condition': '', 148 'permission': (View,), 149 'category': 'object', 150 'visible': True,}, 151 {'id': 'metadata', 152 'name': 'action_metadata', 153 'action': 'cpsdocument_metadata', 154 'condition': "python:member and 'Manager' in member.getRoles()", 155 'permissions': (UniversityManage,)}, 156 ) 157 } 158 ###) 159 160 scratch_card = { ###( 161 'title': 'WAeUP Scratchcard', 162 'description': '', 163 'content_icon': 'student.gif', 164 'content_meta_type': 'Scratch Card', 165 'product': 'CPSDocument', 166 'factory': 'addCPSDocument', 167 'immediate_view': 'cpsdocument_view', 168 'global_allow': True, 169 'filter_content_types': True, 170 'allowed_content_types': (), 171 'allow_discussion': False, 172 'cps_is_searchable': True, 173 'cps_proxy_type': 'document', 174 'cps_display_as_document_in_listing': True, 175 'schemas': ('scratch_card'), 176 'layouts': ('scratch_card'), 177 'cps_workspace_wf': 'waeup_workspace_wf', 178 'cps_section_wf': 'waeup_section_wf', 179 ## 'actions': ( 180 ## {'id': 'view', 181 ## 'name': 'action_view', 182 ## 'action': 'string:${object_url}/document_view', 183 ## 'condition': '', 184 ## 'permission': ('View',), 185 ## 'category': 'object', 186 ## 'visible': True,}, 187 ## {'id': 'new_content', 188 ## 'name': 'Add a scratch card', 189 ## 'action': 'string:${object_url}/folder_factories', 190 ## 'condition': "python:len(object.contentItems()) == 0 ", 191 ## 'permission': ('Modify portal content',), 192 ## 'category': 'object', 193 ## 'visible': True,}, 194 ## {'id': 'contents', 195 ## 'name': 'action_folder_contents', 196 ## 'action': 'string:${object_url}/folder_contents', 197 ## 'condition': "python:object.getTypeInfo().cps_proxy_type != 'document'", 198 ## 'permission': ('Modify portal content',), 199 ## 'category': 'object', 200 ## 'visible': True,}, 201 ## {'id': 'edit', 202 ## 'name': 'action_edit', 203 ## 'action': 'string:${object_url}/cpsdocument_edit_form', 204 ## 'condition': '', 205 ## 'permission': ('Modify portal content',), 206 ## 'category': 'object', 207 ## 'visible': True,}, 208 ## ) 209 } 210 # 211 ###) 212 213 jamb_type = { ###( 214 'title': "JAMB data", 215 'description': 'The data from JAMB', 216 'content_icon': '', 217 'content_meta_type': 'CPS Document', 218 'product': 'CPSDocument', 219 'factory': 'addCPSDocument', 220 'immediate_view': 'cpsdocument_view', 221 'global_allow': True, 222 'filter_content_types': True, 223 'allowed_content_types': (), 224 'allow_discussion': False, 225 'cps_is_searchable': True, 226 'cps_proxy_type': 'document', 227 'cps_display_as_document_in_listing': True, 228 'cps_is_portalbox': False, 229 #'schemas': ['common','metadata','jamb'], 230 'schemas': ['jamb'], 231 'layouts': ['jamb'], 232 'flexible_layouts': (), 233 'storage_methods': ('admitted:store_admission_pin'), 234 'cps_workspace_wf': 'workspace_content_wf', 235 'cps_section_wf': 'section_content_wf', 236 'actions': ( 237 {'id': 'view', 238 'name': 'action_view', 239 'action': 'string:${object_url}/jamb_index_html', 240 'condition': '', 241 'permission': (View,), 242 'visible': True,}, 243 {'id': 'edit', 244 'name': 'action_edit', 245 'action': 'string:${object_url}/waeup_edit_form', 246 'condition': '', 247 'permission': (ModifyPortalContent,StudentManage), 248 }, 249 { 250 'id' : 'add_content', 251 'name' : 'Add Content', 252 'action' : 'string:${object/absolute_url}/folder_factories', 253 'condition': "python:member and 'Manager' in member.getRoles()", 254 'permissions': (StudentManage,)}, 255 {'id': 'metadata', 256 'name': 'action_metadata', 257 'action': 'cpsdocument_metadata', 258 'condition': "python:'Manager' in member.getRoles()", 259 'permissions': (UniversityManage,)}, 260 ) 261 } 262 ###) 263 264 student_personal_type = { ###( 265 'title': "Student personal data", 266 'description': '', 267 'content_icon': '', 268 'content_meta_type': 'CPS Document', 269 'product': 'WAeUP', 270 'factory': 'addStudentPersonal', 271 'immediate_view': 'student_personal_index_html', 272 'global_allow': True, 273 'filter_content_types': True, 274 'allowed_content_types': (), 275 'allow_discussion': False, 276 'cps_is_searchable': True, 277 'cps_proxy_type': 'document', 278 'cps_display_as_document_in_listing': True, 279 'cps_is_portalbox': False, 280 #'schemas': ['common','metadata','jamb'], 281 'schemas': ['student_personal'], 282 'layouts': ['student_personal'], 283 'flexible_layouts': (), 284 'storage_methods': (), 285 'cps_workspace_wf': 'workspace_content_wf', 286 'cps_section_wf': 'section_content_wf', 287 'actions': ( 288 {'id': 'view', 289 'name': 'action_view', 290 'action': 'string:${object_url}/student_personal_index_html', 291 #'action': 'string:${object_url}/cpsdocument_view', 292 'condition': '', 293 'permission': ('View',), 294 'category': 'object', 295 'visible': True,}, 296 {'id': 'edit', 297 'name': 'action_edit', 298 'action': 'string:${object_url}/student_personal_edit_form', 299 'condition': '', 300 'permission': ('View',), 301 'category': 'object', 302 'visible': True,}, 303 {'id': 'metadata', 304 'name': 'action_metadata', 305 'action': 'cpsdocument_metadata', 306 'condition': "python:member and 'Manager' in member.getRoles()", 307 'permissions': (UniversityManage,)}, 308 ) 309 } 310 ###) 311 312 faculty_type = { ###( 313 'title': 'WAeUP Faculty', 314 'description': '', 315 'content_icon': '', 316 'content_meta_type': 'Faculty', 317 'product': 'WAeUP', 318 'factory': 'addFaculty', 319 'immediate_view': 'folder_view', 320 'global_allow': True, 321 'filter_content_types': True, 322 'allowed_content_types': ('Department'), 323 'allow_discussion': 0, 324 'cps_is_searchable': True, 325 'cps_proxy_type': 'folder', 326 'cps_display_as_document_in_listing': True, 327 'schemas': ['metadata','common','faculty'], 328 'layouts': ['faculty'], 329 'flexible_layouts': (), 330 'layout_clusters': ['metadata:metadata',], 331 'cps_section_wf': 'waeup_section_wf', 332 'use_content_status_history': 0, 333 'actions': ( 334 {'id': 'view', 335 'name': 'action_view', 336 'action': 'string:${object_url}/faculty_index_html', 337 'condition': '', 338 'permission': (View,), 339 'visible': True,}, 340 {'id': 'edit', 341 'name': 'action_edit', 342 'action': 'string:${object_url}/waeup_edit_form', 343 'condition': '', 344 'permission': (UniversityManage,), 345 'visible': True,}, 346 {'id': 'add_department', 347 'name': 'Add a Department', 348 'action' : 'string:${object/absolute_url}/create_common?type_name=Department', 349 'permissions': (ModifyPortalContent,UniversityManage,)}, 350 {'id': 'contents', 351 'name': 'action_folder_contents', 352 'action': 'folder_contents', 353 'condition': "python:member and 'Manager' in member.getRoles()", 354 'permissions': (ModifyPortalContent,UniversityManage,)}, 355 {'id': 'edit', 356 'name': 'action_edit', 357 'action': 'cpsdocument_edit_form', 358 'condition': "python:member and 'Manager' in member.getRoles()", 359 'permissions': (ModifyPortalContent,UniversityManage,)}, 360 {'id': 'metadata', 361 'name': 'action_metadata', 362 'action': 'cpsdocument_metadata', 363 'condition': "python:member and 'Manager' in member.getRoles()", 364 'permissions': (ModifyPortalContent,)}, 365 {'id': 'localroles', 366 'name': 'action_local_roles', 367 'action': 'folder_localrole_form', 368 'condition': 'python:0', 369 'permissions': (ModifyPortalContent,)}, 370 ) 371 } 372 ###) 373 374 department_type = { ###( 375 'title': 'WAeUP Department', 376 'description': '', 377 'content_icon': '', 378 'content_meta_type': 'Department', 379 'product': 'WAeUP', 380 'factory': 'addDepartment', 381 'immediate_view': 'folder_view', 382 'global_allow': True, 383 'filter_content_types': True, 384 'allowed_content_types': ('Student','Course'), 385 'allow_discussion': False, 386 'cps_is_searchable': True, 387 'cps_proxy_type': 'folder', 388 'cps_display_as_document_in_listing': True, 389 'schemas': ['metadata','common','department'], 390 'layouts': ['department',], 391 'flexible_layouts': (), 392 'layout_clusters': ['metadata:metadata',], 393 'cps_section_wf': 'waeup_section_wf', 394 'use_content_status_history': 0, 395 'actions': ( 396 {'id': 'view', 397 'name': 'action_view', 398 'action': 'string:${object_url}/department_index_html', 399 'condition': '', 400 'permission': ('View',), 401 'visible': True,}, 402 {'id': 'edit', 403 'name': 'action_edit', 404 'action': 'string:${object_url}/waeup_edit_form', 405 'condition': '', 406 'permission': (FacultyManage,), 407 'visible': True,}, 408 {'id': 'create_course', 409 'name': 'Add a Course', 410 'action' : 'string:${object/absolute_url}/create_course', 411 'permissions': (ModifyPortalContent,UniversityManage,)}, 412 {'id': 'contents', 413 'name': 'action_folder_contents', 414 'action': 'folder_contents', 415 'condition': "python:member and 'Manager' in member.getRoles()", 416 'permissions': (ModifyPortalContent,UniversityManage,)}, 417 {'id': 'edit', 418 'name': 'action_edit', 419 'action': 'cpsdocument_edit_form', 420 'condition': "python:member and 'Manager' in member.getRoles()", 421 'permissions': (ModifyPortalContent,UniversityManage,)}, 422 {'id': 'metadata', 423 'name': 'action_metadata', 424 'action': 'cpsdocument_metadata', 425 'condition': "python:member and 'Manager' in member.getRoles()", 426 'permissions': (ModifyPortalContent,)}, 427 {'id': 'localroles', 428 'name': 'action_local_roles', 429 'action': 'folder_localrole_form', 430 'condition': 'python:0', 431 'permissions': (ModifyPortalContent,)}, 432 ) 433 } 434 ###) 435 436 course_type = { ###( 437 'title': 'WAeUP Course', 438 'description': '', 439 'content_icon': 'student.gif', 440 'content_meta_type': 'Course', 441 'product': 'WAeUP', 442 'factory': 'addCourse', 443 'immediate_view': 'cpsdocument_view', 444 'global_allow': True, 445 'filter_content_types': True, 446 'allowed_content_types': (), 447 'allow_discussion': False, 448 'cps_is_searchable': True, 449 'cps_proxy_type': 'document', 450 'cps_display_as_document_in_listing': True, 451 'schemas': ['metadata','common','course'], 452 'layouts': ['course',], 453 'flexible_layouts': (), 454 'layout_clusters': ['metadata:metadata','coursetotal:metadata,course'], 455 'cps_section_wf': 'waeup_section_wf', 456 'use_content_status_history': 0, 457 'actions': ( 458 {'id': 'view', 459 'name': 'action_view', 460 'action': 'string:${object_url}/course_index_html', 461 'condition': '', 462 'permission': ('View',), 463 'category': 'object', 464 'visible': True,}, 465 {'id': 'edit', 466 'name': 'action_edit', 467 'action': 'string:${object_url}/waeup_edit_form', 468 'condition': '', 469 'permission': (CourseManage,), 470 'category': 'object', 471 'visible': True,}, 472 {'id': 'contents', 473 'name': 'action_folder_contents', 474 'action': 'folder_contents', 475 'condition': "python:member and 'Manager' in member.getRoles()", 476 'permissions': (ModifyPortalContent,UniversityManage,)}, 477 {'id': 'edit', 478 'name': 'action_edit', 479 'action': 'cpsdocument_edit_form', 480 'condition': "python:member and 'Manager' in member.getRoles()", 481 'permissions': (ModifyPortalContent,UniversityManage,)}, 482 {'id': 'metadata', 483 'name': 'action_metadata', 484 'action': 'cpsdocument_metadata', 485 'condition': "python:member and 'Manager' in member.getRoles()", 486 'permissions': (ModifyPortalContent,)}, 487 {'id': 'localroles', 488 'name': 'action_local_roles', 489 'action': 'folder_localrole_form', 490 'condition': 'python:0', 491 'permissions': (ModifyPortalContent,)}, 492 ) 493 } 494 ###) 495 496 types = {} 497 types['University'] = university_type 498 types['StudentsFolder'] = students_folder_type 499 types['Student'] = student_type 500 types['StudentPersonal'] = student_personal_type 501 types['ScratchCard'] = scratch_card 502 types['Jamb'] = jamb_type 503 types['Faculty'] = faculty_type 504 types['Department'] = department_type 505 types['Course'] = course_type 506 507 return types 508
Note: See TracChangeset for help on using the changeset viewer.