[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, |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | ###) |
---|
| 44 | |
---|
| 45 | class Student(CPSDocument): ###( |
---|
| 46 | """ |
---|
| 47 | WAeUP Student container for the various student data |
---|
| 48 | """ |
---|
| 49 | meta_type = 'Student' |
---|
| 50 | portal_type = meta_type |
---|
| 51 | security = ClassSecurityInfo() |
---|
| 52 | |
---|
[139] | 53 | security.declareProtected(View,"getTitle") |
---|
| 54 | def getTitle(self): |
---|
| 55 | """compose title""" |
---|
| 56 | content = self.PERSONAL.getContent() |
---|
| 57 | return "%s %s" % (content.firstname,content.lastname) |
---|
| 58 | |
---|
[57] | 59 | InitializeClass(Student) |
---|
| 60 | |
---|
| 61 | def addStudent(container, id, REQUEST=None, **kw): |
---|
| 62 | """Add a Student.""" |
---|
| 63 | ob = Student(id, **kw) |
---|
| 64 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
| 65 | |
---|
| 66 | ###) |
---|
[91] | 67 | |
---|
[89] | 68 | studentpersonal_fti = { ###( |
---|
| 69 | 'title': 'WAeUP StudentPersonal', |
---|
| 70 | 'description': '', |
---|
| 71 | 'content_icon': 'student.gif', |
---|
| 72 | 'content_meta_type': 'StudentPersonal', |
---|
| 73 | 'factory': 'addStudent', |
---|
| 74 | 'immediate_view': 'student_personal_index_html', |
---|
| 75 | 'global_allow': True, |
---|
| 76 | 'filter_content_types': True, |
---|
| 77 | 'allowed_content_types': (), |
---|
| 78 | 'allow_discussion': False, |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | ###) |
---|
| 82 | |
---|
| 83 | class StudentPersonal(CPSDocument): ###( |
---|
| 84 | """ |
---|
| 85 | WAeUP Student container for the various student data |
---|
| 86 | """ |
---|
| 87 | meta_type = 'StudentPersonal' |
---|
| 88 | portal_type = meta_type |
---|
| 89 | security = ClassSecurityInfo() |
---|
| 90 | |
---|
| 91 | InitializeClass(StudentPersonal) |
---|
| 92 | |
---|
| 93 | def addStudentPersonal(container, id, REQUEST=None, **kw): |
---|
| 94 | """Add a Students personal data.""" |
---|
| 95 | ob = StudentPersonal(id, **kw) |
---|
| 96 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
| 97 | |
---|
| 98 | ###) |
---|
| 99 | |
---|
| 100 | jamb_fti = { ###( |
---|
| 101 | 'title': 'WAeUP Jamb', |
---|
| 102 | 'description': '', |
---|
| 103 | 'content_icon': '', |
---|
| 104 | 'content_meta_type': 'Jamb', |
---|
| 105 | 'factory': 'addJamb', |
---|
| 106 | 'immediate_view': 'cpsdocument_view', |
---|
| 107 | 'global_allow': True, |
---|
| 108 | 'filter_content_types': True, |
---|
| 109 | 'allowed_content_types': ('Course',), |
---|
| 110 | 'allow_discussion': False, |
---|
| 111 | } |
---|
| 112 | ###) |
---|
| 113 | |
---|
| 114 | class Jamb(CPSDocument): ###( |
---|
| 115 | """ |
---|
| 116 | WAeUP Jamb containing the courses and students |
---|
| 117 | """ |
---|
| 118 | meta_type = 'Jamb' |
---|
| 119 | portal_type = meta_type |
---|
| 120 | security = ClassSecurityInfo() |
---|
| 121 | |
---|
| 122 | InitializeClass(Jamb) |
---|
| 123 | |
---|
| 124 | def addJamb(container, id, REQUEST=None, **kw): |
---|
| 125 | """Add a Jamb.""" |
---|
| 126 | ob = Jamb(id, **kw) |
---|
| 127 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
| 128 | ###) |
---|
| 129 | |
---|
[139] | 130 | study_level_fti = { ###( |
---|
| 131 | 'title': 'WAeUP StudyLevel', |
---|
| 132 | 'description': '', |
---|
| 133 | 'content_icon': '', |
---|
| 134 | 'content_meta_type': 'StudyLevel', |
---|
| 135 | 'factory': 'addStudyLevel', |
---|
| 136 | 'immediate_view': 'cpsdocument_view', |
---|
| 137 | 'global_allow': True, |
---|
| 138 | 'filter_content_types': True, |
---|
| 139 | 'allowed_content_types': ('Course',), |
---|
| 140 | 'allow_discussion': False, |
---|
| 141 | } |
---|
| 142 | ###) |
---|
| 143 | |
---|
| 144 | class StudyLevel(CPSDocument): ###( |
---|
| 145 | """ |
---|
| 146 | WAeUP StudyLevel containing the courses and students |
---|
| 147 | """ |
---|
| 148 | meta_type = 'StudyLevel' |
---|
| 149 | portal_type = meta_type |
---|
| 150 | security = ClassSecurityInfo() |
---|
| 151 | |
---|
| 152 | InitializeClass(StudyLevel) |
---|
| 153 | |
---|
| 154 | def addStudyLevel(container, id, REQUEST=None, **kw): |
---|
| 155 | """Add a StudyLevel.""" |
---|
| 156 | ob = StudyLevel(id, **kw) |
---|
| 157 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
| 158 | ###) |
---|
| 159 | |
---|
| 160 | semester_fti = { ###( |
---|
| 161 | 'title': 'WAeUP Semester', |
---|
| 162 | 'description': '', |
---|
| 163 | 'content_icon': '', |
---|
| 164 | 'content_meta_type': 'Semester', |
---|
| 165 | 'factory': 'addSemester', |
---|
| 166 | 'immediate_view': 'cpsdocument_view', |
---|
| 167 | 'global_allow': True, |
---|
| 168 | 'filter_content_types': True, |
---|
| 169 | 'allowed_content_types': ('Course',), |
---|
| 170 | 'allow_discussion': False, |
---|
| 171 | } |
---|
| 172 | ###) |
---|
| 173 | |
---|
| 174 | class Semester(CPSDocument): ###( |
---|
| 175 | """ |
---|
| 176 | WAeUP Semester containing the courses and students |
---|
| 177 | """ |
---|
| 178 | meta_type = 'Semester' |
---|
| 179 | portal_type = meta_type |
---|
| 180 | security = ClassSecurityInfo() |
---|
| 181 | |
---|
| 182 | InitializeClass(Semester) |
---|
| 183 | |
---|
| 184 | def addSemester(container, id, REQUEST=None, **kw): |
---|
| 185 | """Add a Semester.""" |
---|
| 186 | ob = Semester(id, **kw) |
---|
| 187 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
| 188 | ###) |
---|
| 189 | |
---|