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