[68] | 1 | #-*- mode: python; mode: fold -*- |
---|
| 2 | from Globals import InitializeClass |
---|
| 3 | from AccessControl import ClassSecurityInfo |
---|
| 4 | |
---|
| 5 | from Products.CMFCore.utils import UniqueObject, getToolByName |
---|
| 6 | from Products.CMFCore.permissions import View |
---|
| 7 | from Products.CMFCore.permissions import ModifyPortalContent |
---|
| 8 | from Products.CPSCore.CPSBase import CPSBase_adder, CPSBaseFolder |
---|
| 9 | #from Products.CPSCore.CPSBase import CPSBaseDocument as BaseDocument |
---|
| 10 | from Products.CPSDocument.CPSDocument import CPSDocument |
---|
| 11 | from Products.CPSCore.CPSBase import CPSBaseBTreeFolder as BaseBTreeFolder |
---|
| 12 | |
---|
| 13 | ##class FacultyFolder(BaseBTreeFolder): ###( |
---|
| 14 | ## """ |
---|
| 15 | ## WAeUP container for the various WAeUP containers data |
---|
| 16 | ## """ |
---|
| 17 | ## meta_type = 'Faculty Folder' |
---|
| 18 | ## portal_type = meta_type |
---|
| 19 | ## security = ClassSecurityInfo() |
---|
| 20 | ## |
---|
| 21 | ## |
---|
| 22 | ##InitializeClass(FacultyFolder) |
---|
| 23 | ## |
---|
| 24 | ##def addFacultyFolder(container, id, REQUEST=None, **kw): |
---|
| 25 | ## """Add a Student.""" |
---|
| 26 | ## ob = StudentsFolder(id, **kw) |
---|
| 27 | ## return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
| 28 | ##### |
---|
| 29 | #####) |
---|
| 30 | |
---|
| 31 | faculty_fti = { ###( |
---|
| 32 | 'title': 'WAeUP Faculty', |
---|
| 33 | 'description': '', |
---|
| 34 | 'content_icon': '', |
---|
| 35 | 'content_meta_type': 'Faculty', |
---|
| 36 | 'factory': 'addFaculty', |
---|
| 37 | 'immediate_view': 'cpsdocument_view', |
---|
| 38 | 'global_allow': True, |
---|
| 39 | 'filter_content_types': True, |
---|
| 40 | 'allowed_content_types': ('Department',), |
---|
| 41 | 'allow_discussion': False, |
---|
[89] | 42 | ## 'actions': ( |
---|
| 43 | ## {'id': 'view', |
---|
| 44 | ## 'name': 'action_view', |
---|
| 45 | ## 'action': 'string:${object_url}/faculty_index_html', |
---|
| 46 | ## #'action': 'string:${object_url}/cpsdocument_view', |
---|
| 47 | ## 'condition': '', |
---|
| 48 | ## 'permission': ('View',), |
---|
| 49 | ## 'category': 'object', |
---|
| 50 | ## 'visible': True,}, |
---|
| 51 | ## {'id': 'new_content', |
---|
| 52 | ## 'name': 'Add Data', |
---|
| 53 | ## 'action': 'string:${object_url}/folder_factories', |
---|
| 54 | ## 'condition': "python:1 or len(object.contentItems()) == 0 ", |
---|
| 55 | ## 'permission': ('Modify portal content',), |
---|
| 56 | ## 'category': 'object', |
---|
| 57 | ## 'visible': True,}, |
---|
| 58 | ## {'id': 'contents', |
---|
| 59 | ## 'name': 'action_folder_contents', |
---|
| 60 | ## 'action': 'string:${object_url}/folder_contents', |
---|
| 61 | ## 'condition': "python:1 or object.getTypeInfo().cps_proxy_type != 'document'", |
---|
| 62 | ## 'permission': ('Modify portal content',), |
---|
| 63 | ## 'category': 'object', |
---|
| 64 | ## 'visible': True,}, |
---|
| 65 | ## {'id': 'edit', |
---|
| 66 | ## 'name': 'action_edit', |
---|
| 67 | ## 'action': 'string:${object_url}/cpsdocument_edit_form', |
---|
| 68 | ## 'condition': '', |
---|
| 69 | ## 'permission': ('Modify portal content',), |
---|
| 70 | ## 'category': 'object', |
---|
| 71 | ## 'visible': True,}, |
---|
| 72 | ## ) |
---|
[68] | 73 | } |
---|
| 74 | ###) |
---|
| 75 | |
---|
| 76 | class Faculty(CPSDocument): ###( |
---|
| 77 | """ |
---|
| 78 | WAeUP Faculty containing Departments |
---|
| 79 | """ |
---|
| 80 | meta_type = 'Faculty' |
---|
| 81 | portal_type = meta_type |
---|
| 82 | security = ClassSecurityInfo() |
---|
| 83 | |
---|
| 84 | InitializeClass(Faculty) |
---|
| 85 | |
---|
| 86 | def addFaculty(container, id, REQUEST=None, **kw): |
---|
| 87 | """Add a Faculty.""" |
---|
| 88 | ob = Faculty(id, **kw) |
---|
| 89 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
| 90 | ###) |
---|
| 91 | |
---|
| 92 | department_fti = { ###( |
---|
| 93 | 'title': 'WAeUP Department', |
---|
| 94 | 'description': '', |
---|
| 95 | 'content_icon': '', |
---|
| 96 | 'content_meta_type': 'Department', |
---|
| 97 | 'factory': 'addDepartment', |
---|
| 98 | 'immediate_view': 'cpsdocument_view', |
---|
| 99 | 'global_allow': True, |
---|
| 100 | 'filter_content_types': True, |
---|
| 101 | 'allowed_content_types': ('Course',), |
---|
| 102 | 'allow_discussion': False, |
---|
[89] | 103 | ## 'actions': ( |
---|
| 104 | ## {'id': 'view', |
---|
| 105 | ## 'name': 'action_view', |
---|
| 106 | ## 'action': 'string:${object_url}/department_index_html', |
---|
| 107 | ## 'condition': '', |
---|
| 108 | ## 'permission': ('View',), |
---|
| 109 | ## 'category': 'object', |
---|
| 110 | ## 'visible': True,}, |
---|
| 111 | ## {'id': 'new_content', |
---|
| 112 | ## 'name': 'Add Data', |
---|
| 113 | ## 'action': 'string:${object_url}/folder_factories', |
---|
| 114 | ## 'condition': "python:1 or len(object.contentItems()) == 0 ", |
---|
| 115 | ## 'permission': ('Modify portal content',), |
---|
| 116 | ## 'category': 'object', |
---|
| 117 | ## 'visible': True,}, |
---|
| 118 | ## {'id': 'contents', |
---|
| 119 | ## 'name': 'action_folder_contents', |
---|
| 120 | ## 'action': 'string:${object_url}/folder_contents', |
---|
| 121 | ## 'condition': "python:1 or object.getTypeInfo().cps_proxy_type != 'document'", |
---|
| 122 | ## 'permission': ('Modify portal content',), |
---|
| 123 | ## 'category': 'object', |
---|
| 124 | ## 'visible': True,}, |
---|
| 125 | ## {'id': 'edit', |
---|
| 126 | ## 'name': 'action_edit', |
---|
| 127 | ## 'action': 'string:${object_url}/cpsdocument_edit_form', |
---|
| 128 | ## 'condition': '', |
---|
| 129 | ## 'permission': ('Modify portal content',), |
---|
| 130 | ## 'category': 'object', |
---|
| 131 | ## 'visible': True,}, |
---|
| 132 | ## ) |
---|
[68] | 133 | } |
---|
| 134 | ###) |
---|
| 135 | |
---|
| 136 | class Department(CPSDocument): ###( |
---|
| 137 | """ |
---|
| 138 | WAeUP Department containing the courses and students |
---|
| 139 | """ |
---|
| 140 | meta_type = 'Department' |
---|
| 141 | portal_type = meta_type |
---|
| 142 | security = ClassSecurityInfo() |
---|
| 143 | |
---|
| 144 | InitializeClass(Department) |
---|
| 145 | |
---|
| 146 | def addDepartment(container, id, REQUEST=None, **kw): |
---|
| 147 | """Add a Department.""" |
---|
| 148 | ob = Department(id, **kw) |
---|
| 149 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
| 150 | ###) |
---|
| 151 | |
---|
| 152 | course_fti = { ###( |
---|
| 153 | 'title': 'WAeUP Course', |
---|
| 154 | 'description': '', |
---|
| 155 | 'content_icon': '', |
---|
| 156 | 'content_meta_type': 'Course', |
---|
| 157 | 'factory': 'addCourse', |
---|
| 158 | 'immediate_view': 'cpsdocument_view', |
---|
| 159 | 'global_allow': True, |
---|
| 160 | 'filter_content_types': True, |
---|
| 161 | 'allowed_content_types': (), |
---|
| 162 | 'allow_discussion': False, |
---|
[89] | 163 | ## 'actions': ( |
---|
| 164 | ## {'id': 'view', |
---|
| 165 | ## 'name': 'action_view', |
---|
| 166 | ## 'action': 'string:${object_url}/course_index_html', |
---|
| 167 | ## 'condition': '', |
---|
| 168 | ## 'permission': ('View',), |
---|
| 169 | ## 'category': 'object', |
---|
| 170 | ## 'visible': True,}, |
---|
| 171 | ## {'id': 'new_content', |
---|
| 172 | ## 'name': 'Add Data', |
---|
| 173 | ## 'action': 'string:${object_url}/folder_factories', |
---|
| 174 | ## 'condition': "python:1 or len(object.contentItems()) == 0 ", |
---|
| 175 | ## 'permission': ('Modify portal content',), |
---|
| 176 | ## 'category': 'object', |
---|
| 177 | ## 'visible': True,}, |
---|
| 178 | ## {'id': 'contents', |
---|
| 179 | ## 'name': 'action_folder_contents', |
---|
| 180 | ## 'action': 'string:${object_url}/folder_contents', |
---|
| 181 | ## 'condition': "python:1 or object.getTypeInfo().cps_proxy_type != 'document'", |
---|
| 182 | ## 'permission': ('Modify portal content',), |
---|
| 183 | ## 'category': 'object', |
---|
| 184 | ## 'visible': True,}, |
---|
| 185 | ## {'id': 'edit', |
---|
| 186 | ## 'name': 'action_edit', |
---|
| 187 | ## 'action': 'string:${object_url}/cpsdocument_edit_form', |
---|
| 188 | ## 'condition': '', |
---|
| 189 | ## 'permission': ('Modify portal content',), |
---|
| 190 | ## 'category': 'object', |
---|
| 191 | ## 'visible': True,}, |
---|
| 192 | ## ) |
---|
[68] | 193 | } |
---|
| 194 | ###) |
---|
| 195 | |
---|
| 196 | class Course(CPSDocument): ###( |
---|
| 197 | """ |
---|
| 198 | WAeUP Course |
---|
| 199 | """ |
---|
| 200 | meta_type = 'Course' |
---|
| 201 | portal_type = meta_type |
---|
| 202 | security = ClassSecurityInfo() |
---|
| 203 | |
---|
| 204 | InitializeClass(Course) |
---|
| 205 | |
---|
| 206 | def addCourse(container, id, REQUEST=None, **kw): |
---|
| 207 | """Add a Course.""" |
---|
| 208 | ob = Course(id, **kw) |
---|
| 209 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
| 210 | ###) |
---|