Changeset 101 for waeup_product/trunk/skins/waeup_default
- Timestamp:
- 27 Oct 2005, 09:31:31 (19 years ago)
- Location:
- waeup_product/trunk/skins/waeup_default
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup_product/trunk/skins/waeup_default/getWAeUPLayouts.py
r96 r101 925 925 ###) 926 926 927 accomodation = { ###( 928 'widgets': { 929 'heading': Heading, 930 'text': Text, 931 '': { 932 'type': 'String Widget', 933 'data': { 934 'title': '', 935 'fields': ('level',), 936 'is_required': True, 937 'label': 'Level', 938 'label_edit': 'Level', 939 'description': '', 940 'help': '', 941 'is_i18n': False, 942 'display_width': 10, 943 'size_max': 0, 944 }, 945 }, 946 'code': { 947 'type': 'String Widget', 948 'data': { 949 'title': 'Code', 950 'fields': ('code',), 951 'is_required': True, 952 'label': 'Code', 953 'label_edit': 'Code', 954 'description': '', 955 'help': '', 956 'is_i18n': False, 957 'display_width': 10, 958 'size_max': 0, 959 }, 960 }, 961 'semester': { 962 'type': 'Boolean Widget', 963 'data': { 964 'title': '', 965 'fields': ('semester',), 966 'is_required': True, 967 'label': 'Semester', 968 'label_edit': 'Semester', 969 'label_false': 'Second Semester', 970 'label_true': 'First Semester', 971 'description': '', 972 'help': '', 973 'is_i18n': False, 974 'display_width': 10, 975 'size_max': 0, 976 }, 977 }, 978 'credit': { 979 'type': 'Int Widget', 980 'data': { 981 'title': '', 982 'fields': ('credit',), 983 'is_required': True, 984 'label': 'Credit', 985 'label_edit': 'Credit', 986 'description': '', 987 'help': '', 988 'is_i18n': False, 989 'display_width': 2, 990 'size_max': 0, 991 }, 992 }, 993 'core_elective': { 994 'type': 'Boolean Widget', 995 'data': { 996 'title': '', 997 'fields': ('core_elective',), 998 'is_required': True, 999 'label': 'Core or elective', 1000 'label_edit': 'Core or elective', 1001 'label_true': 'Core Course', 1002 'label_false': 'Elective Course', 1003 'description': '', 1004 'help': '', 1005 'is_i18n': False, 1006 'display_width': 10, 1007 'size_max': 0, 1008 }, 1009 }, 1010 }, 1011 'layout': { 1012 'style_prefix': 'layout_waeup_', 1013 'flexible_widgets': (), 1014 'ncols': 1, 1015 'rows': [ 1016 [{'widget_id': 'heading', 'ncols': 1},], 1017 [{'widget_id': 'text', 'ncols': 1},], 1018 [{'widget_id': 'level', 'ncols': 1},], 1019 [{'widget_id': 'code', 'ncols': 1},], 1020 [{'widget_id': 'semester', 'ncols': 1},], 1021 [{'widget_id': 'credit', 'ncols': 1},], 1022 [{'widget_id': 'core_elective', 'ncols': 1},], 1023 ] 1024 }, 1025 } 1026 ###) 1027 927 1028 layouts = {} 928 1029 layouts['university'] = common_layout -
waeup_product/trunk/skins/waeup_default/getWAeUPSchemas.py
r96 r101 254 254 }, 255 255 'level': { 256 'type': 'CPS String Field', 257 'data': { 258 'default_expr': 'string:', 259 'is_searchabletext': True, 260 }, 261 }, 262 'code': { 263 'type': 'CPS String Field', 264 'data': { 265 'default_expr': 'string:', 266 'is_searchabletext': True, 267 }, 268 }, 269 'semester': { 270 'type': 'CPS Boolean Field', 271 'data': { 272 'default_expr': 'python:True', 273 'is_searchabletext': False, 274 }, 275 }, 276 'credit': { 277 'type': 'CPS Int Field', 278 'data': { 279 'default_expr': 'string:', 280 'is_searchabletext': False, 281 }, 282 }, 283 'core_elective': { 284 'type': 'CPS Boolean Field', 285 'data': { 286 'default_expr': 'python:True', 287 'is_searchabletext': False, 288 }, 289 }, 290 }###) 291 292 accomodation_schema = { ###( 293 'heading': { 294 'type': 'CPS String Field', 295 'data': { 296 'default_expr': 'string:', 297 'is_searchabletext': True, 298 }, 299 }, 300 'text': { 301 'type': 'CPS String Field', 302 'data': { 303 'default_expr': 'string:', 304 'is_searchabletext': True, 305 }, 306 }, 307 '': { 256 308 'type': 'CPS String Field', 257 309 'data': { -
waeup_product/trunk/skins/waeup_default/getWAeUPTypes.py
r100 r101 1 1 #-*- mode: python; mode: fold -*- 2 2 # $Id$ 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 3 from Products.CPSInstaller.CPSInstaller import CPSInstaller 4 from Products.CMFCore.CMFCorePermissions import View, ModifyPortalContent 8 5 from Products.WAeUP.WAeUPPermissions import UniversityManage, StudentManage,FacultyManage,\ 9 6 DepartmentManage,CourseManage 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 ) 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 ), 62 64 } 65 self.setupPortalPermissions(waeup_perms) 66 63 67 ###) 64 68 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 } 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 119 137 ###) 120 138 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 } 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 ########################################## 158 215 ###) 159 216 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 # 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 211 375 ###) 212 376 213 course_type = { ###( 214 'title': 'WAeUP Course', 215 'description': '', 216 'content_icon': 'student.gif', 217 'content_meta_type': 'Course', 218 'product': 'WAeUP', 219 'factory': 'addCourse', 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 'schemas': ['metadata','common','course'], 229 'layouts': ['course',], 230 'flexible_layouts': (), 231 'layout_clusters': ['metadata:metadata','coursetotal:metadata,course'], 232 'cps_section_wf': 'waeup_section_wf', 233 'use_content_status_history': 0, 234 'actions': ( 235 {'id': 'view', 236 'name': 'action_view', 237 'action': 'string:${object_url}/course_index_html', 238 'condition': '', 239 'permission': ('View',), 240 'category': 'object', 241 'visible': True,}, 242 {'id': 'edit', 243 'name': 'action_edit', 244 'action': 'string:${object_url}/waeup_edit_form', 245 'condition': '', 246 'permission': (CourseManage,), 247 'category': 'object', 248 'visible': True,}, 249 {'id': 'contents', 250 'name': 'action_folder_contents', 251 'action': 'folder_contents', 252 'condition': "python:member and 'Manager' in member.getRoles()", 253 'permissions': (ModifyPortalContent,UniversityManage,)}, 254 {'id': 'edit', 255 'name': 'action_edit', 256 'action': 'cpsdocument_edit_form', 257 'condition': "python:member and 'Manager' in member.getRoles()", 258 'permissions': (ModifyPortalContent,UniversityManage,)}, 259 {'id': 'metadata', 260 'name': 'action_metadata', 261 'action': 'cpsdocument_metadata', 262 'condition': "python:member and 'Manager' in member.getRoles()", 263 'permissions': (ModifyPortalContent,)}, 264 {'id': 'localroles', 265 'name': 'action_local_roles', 266 'action': 'folder_localrole_form', 267 'condition': 'python:0', 268 'permissions': (ModifyPortalContent,)}, 269 ) 270 } 271 ###) 272 273 jamb_type = { ###( 274 'title': "JAMB data", 275 'description': 'The data from JAMB', 276 'content_icon': '', 277 'content_meta_type': 'CPS Document', 278 'product': 'CPSDocument', 279 'factory': 'addCPSDocument', 280 'immediate_view': 'cpsdocument_view', 281 'global_allow': True, 282 'filter_content_types': True, 283 'allowed_content_types': (), 284 'allow_discussion': False, 285 'cps_is_searchable': True, 286 'cps_proxy_type': 'document', 287 'cps_display_as_document_in_listing': True, 288 'cps_is_portalbox': False, 289 #'schemas': ['common','metadata','jamb'], 290 'schemas': ['jamb'], 291 'layouts': ['jamb'], 292 'flexible_layouts': (), 293 'storage_methods': ('admitted:store_admission_pin'), 294 'cps_workspace_wf': 'workspace_content_wf', 295 'cps_section_wf': 'section_content_wf', 296 'actions': ( 297 {'id': 'view', 298 'name': 'action_view', 299 'action': 'string:${object_url}/jamb_index_html', 300 'condition': '', 301 'permission': (View,), 302 'visible': True,}, 303 {'id': 'edit', 304 'name': 'action_edit', 305 'action': 'string:${object_url}/waeup_edit_form', 306 'condition': '', 307 'permission': (ModifyPortalContent,StudentManage), 308 }, 309 { 310 'id' : 'add_content', 311 'name' : 'Add Content', 312 'action' : 'string:${object/absolute_url}/folder_factories', 313 'condition': "python:member and 'Manager' in member.getRoles()", 314 'permissions': (StudentManage,)}, 315 {'id': 'metadata', 316 'name': 'action_metadata', 317 'action': 'cpsdocument_metadata', 318 'condition': "python:'Manager' in member.getRoles()", 319 'permissions': (UniversityManage,)}, 320 ) 321 } 322 ###) 323 324 student_personal_type = { ###( 325 'title': "Student personal data", 326 'description': '', 327 'content_icon': '', 328 'content_meta_type': 'CPS Document', 329 'product': 'WAeUP', 330 'factory': 'addStudentPersonal', 331 'immediate_view': 'student_personal_index_html', 332 'global_allow': True, 333 'filter_content_types': True, 334 'allowed_content_types': (), 335 'allow_discussion': False, 336 'cps_is_searchable': True, 337 'cps_proxy_type': 'document', 338 'cps_display_as_document_in_listing': True, 339 'cps_is_portalbox': False, 340 #'schemas': ['common','metadata','jamb'], 341 'schemas': ['student_personal'], 342 'layouts': ['student_personal'], 343 'flexible_layouts': (), 344 'storage_methods': (), 345 'cps_workspace_wf': 'workspace_content_wf', 346 'cps_section_wf': 'section_content_wf', 347 'actions': ( 348 {'id': 'view', 349 'name': 'action_view', 350 'action': 'string:${object_url}/student_personal_index_html', 351 #'action': 'string:${object_url}/cpsdocument_view', 352 'condition': '', 353 'permission': ('View',), 354 'category': 'object', 355 'visible': True,}, 356 {'id': 'edit', 357 'name': 'action_edit', 358 'action': 'string:${object_url}/student_personal_edit_form', 359 'condition': '', 360 'permission': ('View',), 361 'category': 'object', 362 'visible': True,}, 363 {'id': 'metadata', 364 'name': 'action_metadata', 365 'action': 'cpsdocument_metadata', 366 'condition': "python:member and 'Manager' in member.getRoles()", 367 'permissions': (UniversityManage,)}, 368 ) 369 } 370 ###) 371 372 faculty_type = { ###( 373 'title': 'WAeUP Faculty', 374 'description': '', 375 'content_icon': '', 376 'content_meta_type': 'Faculty', 377 'product': 'WAeUP', 378 'factory': 'addFaculty', 379 'immediate_view': 'folder_view', 380 'global_allow': True, 381 'filter_content_types': True, 382 'allowed_content_types': ('Department'), 383 'allow_discussion': 0, 384 'cps_is_searchable': True, 385 'cps_proxy_type': 'folder', 386 'cps_display_as_document_in_listing': True, 387 'schemas': ['metadata','common','faculty'], 388 'layouts': ['faculty'], 389 'flexible_layouts': (), 390 'layout_clusters': ['metadata:metadata',], 391 'cps_section_wf': 'waeup_section_wf', 392 'use_content_status_history': 0, 393 'actions': ( 394 {'id': 'view', 395 'name': 'action_view', 396 'action': 'string:${object_url}/faculty_index_html', 397 'condition': '', 398 'permission': (View,), 399 'visible': True,}, 400 {'id': 'edit', 401 'name': 'action_edit', 402 'action': 'string:${object_url}/waeup_edit_form', 403 'condition': '', 404 'permission': (UniversityManage,), 405 'visible': True,}, 406 {'id': 'add_department', 407 'name': 'Add a Department', 408 'action' : 'string:${object/absolute_url}/create_common?type_name=Department', 409 'permissions': (ModifyPortalContent,UniversityManage,)}, 410 {'id': 'contents', 411 'name': 'action_folder_contents', 412 'action': 'folder_contents', 413 'condition': "python:member and 'Manager' in member.getRoles()", 414 'permissions': (ModifyPortalContent,UniversityManage,)}, 415 {'id': 'edit', 416 'name': 'action_edit', 417 'action': 'cpsdocument_edit_form', 418 'condition': "python:member and 'Manager' in member.getRoles()", 419 'permissions': (ModifyPortalContent,UniversityManage,)}, 420 {'id': 'metadata', 421 'name': 'action_metadata', 422 'action': 'cpsdocument_metadata', 423 'condition': "python:member and 'Manager' in member.getRoles()", 424 'permissions': (ModifyPortalContent,)}, 425 {'id': 'localroles', 426 'name': 'action_local_roles', 427 'action': 'folder_localrole_form', 428 'condition': 'python:0', 429 'permissions': (ModifyPortalContent,)}, 430 ) 431 } 432 ###) 433 434 department_type = { ###( 435 'title': 'WAeUP Department', 436 'description': '', 437 'content_icon': '', 438 'content_meta_type': 'Department', 439 'product': 'WAeUP', 440 'factory': 'addDepartment', 441 'immediate_view': 'folder_view', 442 'global_allow': True, 443 'filter_content_types': True, 444 'allowed_content_types': ('Student','Course'), 445 'allow_discussion': False, 446 'cps_is_searchable': True, 447 'cps_proxy_type': 'folder', 448 'cps_display_as_document_in_listing': True, 449 'schemas': ['metadata','common','department'], 450 'layouts': ['department',], 451 'flexible_layouts': (), 452 'layout_clusters': ['metadata:metadata',], 453 'cps_section_wf': 'waeup_section_wf', 454 'use_content_status_history': 0, 455 'actions': ( 456 {'id': 'view', 457 'name': 'action_view', 458 'action': 'string:${object_url}/department_index_html', 459 'condition': '', 460 'permission': ('View',), 461 'visible': True,}, 462 {'id': 'edit', 463 'name': 'action_edit', 464 'action': 'string:${object_url}/waeup_edit_form', 465 'condition': '', 466 'permission': (FacultyManage,), 467 'visible': True,}, 468 {'id': 'create_course', 469 'name': 'Add a Course', 470 'action' : 'string:${object/absolute_url}/create_course', 471 'permissions': (ModifyPortalContent,UniversityManage,)}, 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 course_type = { ###( 497 'title': 'WAeUP Course', 498 'description': '', 499 'content_icon': 'student.gif', 500 'content_meta_type': 'Course', 501 'product': 'WAeUP', 502 'factory': 'addCourse', 503 'immediate_view': 'cpsdocument_view', 504 'global_allow': True, 505 'filter_content_types': True, 506 'allowed_content_types': (), 507 'allow_discussion': False, 508 'cps_is_searchable': True, 509 'cps_proxy_type': 'document', 510 'cps_display_as_document_in_listing': True, 511 'schemas': ['metadata','common','course'], 512 'layouts': ['course',], 513 'flexible_layouts': (), 514 'layout_clusters': ['metadata:metadata','coursetotal:metadata,course'], 515 'cps_section_wf': 'waeup_section_wf', 516 'use_content_status_history': 0, 517 'actions': ( 518 {'id': 'view', 519 'name': 'action_view', 520 'action': 'string:${object_url}/course_index_html', 521 'condition': '', 522 'permission': ('View',), 523 'category': 'object', 524 'visible': True,}, 525 {'id': 'edit', 526 'name': 'action_edit', 527 'action': 'string:${object_url}/waeup_edit_form', 528 'condition': '', 529 'permission': (CourseManage,), 530 'category': 'object', 531 'visible': True,}, 532 {'id': 'contents', 533 'name': 'action_folder_contents', 534 'action': 'folder_contents', 535 'condition': "python:member and 'Manager' in member.getRoles()", 536 'permissions': (ModifyPortalContent,UniversityManage,)}, 537 {'id': 'edit', 538 'name': 'action_edit', 539 'action': 'cpsdocument_edit_form', 540 'condition': "python:member and 'Manager' in member.getRoles()", 541 'permissions': (ModifyPortalContent,UniversityManage,)}, 542 {'id': 'metadata', 543 'name': 'action_metadata', 544 'action': 'cpsdocument_metadata', 545 'condition': "python:member and 'Manager' in member.getRoles()", 546 'permissions': (ModifyPortalContent,)}, 547 {'id': 'localroles', 548 'name': 'action_local_roles', 549 'action': 'folder_localrole_form', 550 'condition': 'python:0', 551 'permissions': (ModifyPortalContent,)}, 552 ) 553 } 554 ###) 555 556 types = {} 557 types['University'] = university_type 558 types['StudentsFolder'] = students_folder_type 559 types['Student'] = student_type 560 types['StudentPersonal'] = student_personal_type 561 types['ScratchCard'] = scratch_card 562 types['Jamb'] = jamb_type 563 types['Faculty'] = faculty_type 564 types['Department'] = department_type 565 types['Course'] = course_type 566 567 return types 568 377 return installer.logResult()
Note: See TracChangeset for help on using the changeset viewer.