[5004] | 1 | """Interfaces of academics specific objects. |
---|
| 2 | """ |
---|
| 3 | from zope import schema |
---|
| 4 | from zope.interface import Attribute |
---|
[5977] | 5 | from waeup.sirp.interfaces import (IWAeUPObject, IWAeUPContainer) |
---|
| 6 | |
---|
| 7 | from waeup.sirp.university.vocabularies import (course_levels, |
---|
[5986] | 8 | semester, |
---|
| 9 | application_category, |
---|
| 10 | study_mode, |
---|
| 11 | CourseSource) |
---|
[5004] | 12 | |
---|
| 13 | class IFaculty(IWAeUPContainer): |
---|
| 14 | """Representation of a university faculty. |
---|
| 15 | """ |
---|
[5948] | 16 | code = schema.TextLine( |
---|
| 17 | title = u'Code', |
---|
| 18 | description = u'Abbreviated code of the faculty', |
---|
| 19 | default = u'NA', |
---|
| 20 | required = True, |
---|
| 21 | readonly = True, |
---|
| 22 | ) |
---|
| 23 | |
---|
[5004] | 24 | title = schema.TextLine( |
---|
| 25 | title = u'Name of Faculty', |
---|
| 26 | default = u'Unnamed', |
---|
| 27 | required = True, |
---|
| 28 | ) |
---|
| 29 | |
---|
| 30 | title_prefix = schema.TextLine( |
---|
| 31 | title = u'Title prefix', |
---|
| 32 | default = u'faculty', |
---|
| 33 | required = True, |
---|
| 34 | ) |
---|
[5951] | 35 | |
---|
| 36 | class IFacultyAdd(IFaculty): |
---|
| 37 | """Representation of a university faculty. |
---|
| 38 | """ |
---|
| 39 | code = schema.TextLine( |
---|
| 40 | title = u'Code', |
---|
| 41 | description = u'Abbreviated code of the faculty', |
---|
| 42 | default = u'NA', |
---|
| 43 | required = True, |
---|
| 44 | readonly = False, |
---|
| 45 | ) |
---|
| 46 | |
---|
| 47 | IFacultyAdd['code'].order = IFaculty['code'].order |
---|
[5004] | 48 | |
---|
| 49 | class IFacultyContainer(IWAeUPContainer): |
---|
| 50 | """A container for faculties. |
---|
| 51 | """ |
---|
| 52 | def addFaculty(faculty): |
---|
| 53 | """Add an IFactulty object. |
---|
| 54 | |
---|
| 55 | Returns the key, under which the object was stored. |
---|
| 56 | """ |
---|
| 57 | class IDepartment(IWAeUPObject): |
---|
| 58 | """Representation of a department. |
---|
| 59 | """ |
---|
[5948] | 60 | code = schema.TextLine( |
---|
| 61 | title = u'Code', |
---|
| 62 | default = u'NA', |
---|
| 63 | description = u'Abbreviated code of the department', |
---|
| 64 | required = True, |
---|
| 65 | readonly = True, |
---|
| 66 | ) |
---|
| 67 | |
---|
[5004] | 68 | title = schema.TextLine( |
---|
| 69 | title = u'Name of Department', |
---|
| 70 | default = u'Unnamed', |
---|
| 71 | required = True, |
---|
| 72 | ) |
---|
| 73 | |
---|
| 74 | title_prefix = schema.TextLine( |
---|
| 75 | title = u'Title prefix', |
---|
| 76 | default = u'department', |
---|
| 77 | required = True, |
---|
| 78 | ) |
---|
| 79 | |
---|
| 80 | courses = Attribute("A container for courses.") |
---|
| 81 | certificates = Attribute("A container for certificates.") |
---|
| 82 | |
---|
[5951] | 83 | class IDepartmentAdd(IDepartment): |
---|
| 84 | """Representation of a university department. |
---|
| 85 | """ |
---|
| 86 | code = schema.TextLine( |
---|
| 87 | title = u'Code', |
---|
| 88 | default = u'NA', |
---|
| 89 | description = u'Abbreviated code of the department', |
---|
| 90 | required = True, |
---|
| 91 | readonly = False, |
---|
| 92 | ) |
---|
| 93 | |
---|
| 94 | IDepartmentAdd['code'].order = IDepartment['code'].order |
---|
[5004] | 95 | |
---|
| 96 | class ICourseContainer(IWAeUPContainer): |
---|
| 97 | """A container for faculties. |
---|
| 98 | """ |
---|
| 99 | def addCourse(faculty): |
---|
| 100 | """Add an ICourse object. |
---|
| 101 | |
---|
| 102 | Returns the key, under which the object was stored. |
---|
| 103 | """ |
---|
| 104 | |
---|
| 105 | class ICourse(IWAeUPObject): |
---|
| 106 | """Representation of a course. |
---|
| 107 | """ |
---|
| 108 | code = schema.TextLine( |
---|
| 109 | title = u'Code', |
---|
| 110 | default = u'NA', |
---|
| 111 | description = u'Abbreviated code of the course', |
---|
| 112 | required = True, |
---|
| 113 | readonly = True, |
---|
| 114 | ) |
---|
| 115 | |
---|
| 116 | title = schema.TextLine( |
---|
| 117 | title = u'Title of course', |
---|
| 118 | default = u'Unnamed', |
---|
| 119 | required = True, |
---|
| 120 | ) |
---|
| 121 | |
---|
| 122 | credits = schema.Int( |
---|
| 123 | title = u'Credits', |
---|
| 124 | default = 0, |
---|
| 125 | required = False, |
---|
| 126 | ) |
---|
| 127 | |
---|
| 128 | passmark = schema.Int( |
---|
| 129 | title = u'Passmark', |
---|
| 130 | default = 40, |
---|
| 131 | required = False, |
---|
| 132 | ) |
---|
| 133 | |
---|
| 134 | semester = schema.Choice( |
---|
| 135 | title = u'Semester/Term', |
---|
| 136 | default = 0, |
---|
[5977] | 137 | vocabulary = semester, |
---|
[5004] | 138 | required = True, |
---|
| 139 | ) |
---|
| 140 | |
---|
[5951] | 141 | class ICourseAdd(ICourse): |
---|
| 142 | """Representation of a course. |
---|
| 143 | """ |
---|
| 144 | code = schema.TextLine( |
---|
| 145 | title = u'Code', |
---|
| 146 | default = u'NA', |
---|
| 147 | description = u'Abbreviated code of the course', |
---|
| 148 | required = True, |
---|
| 149 | readonly = False, |
---|
| 150 | ) |
---|
| 151 | |
---|
| 152 | ICourseAdd['code'].order = ICourse['code'].order |
---|
[5004] | 153 | |
---|
| 154 | class ICertificate(IWAeUPObject): |
---|
| 155 | """Representation of a certificate. |
---|
| 156 | """ |
---|
| 157 | code = schema.TextLine( |
---|
| 158 | title = u'Code', |
---|
| 159 | default = u'NA', |
---|
| 160 | description = u'Abbreviated code of the certificate.', |
---|
| 161 | required = True, |
---|
[5948] | 162 | readonly = True, |
---|
[5004] | 163 | ) |
---|
| 164 | |
---|
[5949] | 165 | #review_state = schema.Choice( |
---|
| 166 | # title = u'Review State', |
---|
| 167 | # default = 'unchecked', |
---|
| 168 | # values = ['unchecked', 'checked'] |
---|
| 169 | # ) |
---|
[5004] | 170 | |
---|
| 171 | title = schema.TextLine( |
---|
[5948] | 172 | title = u'Title', |
---|
[5951] | 173 | default = u'Unnamed', |
---|
[5004] | 174 | required = True, |
---|
| 175 | ) |
---|
| 176 | |
---|
[5986] | 177 | study_mode = schema.Choice( |
---|
[5948] | 178 | title = u'Study Mode', |
---|
[5986] | 179 | vocabulary = study_mode, |
---|
[5951] | 180 | default = u'ug_ft', |
---|
[5004] | 181 | required = True, |
---|
| 182 | ) |
---|
| 183 | |
---|
[5977] | 184 | start_level = schema.Choice( |
---|
[5948] | 185 | title = u'Start Level', |
---|
[5977] | 186 | #source = LevelSource(), |
---|
| 187 | vocabulary = course_levels, |
---|
| 188 | default = 100, |
---|
[5004] | 189 | required = True, |
---|
| 190 | ) |
---|
| 191 | |
---|
[5977] | 192 | end_level = schema.Choice( |
---|
[5948] | 193 | title = u'End Level', |
---|
[5977] | 194 | #source = LevelSource(), |
---|
| 195 | vocabulary = course_levels, |
---|
| 196 | default = 500, |
---|
[5004] | 197 | required = True, |
---|
| 198 | ) |
---|
| 199 | |
---|
[5986] | 200 | application_category = schema.Choice( |
---|
[5949] | 201 | title = u'Application Category', |
---|
[5986] | 202 | vocabulary = application_category, |
---|
[5951] | 203 | default = u'basic', |
---|
[5986] | 204 | required = True, |
---|
[5948] | 205 | ) |
---|
[5004] | 206 | |
---|
[5951] | 207 | class ICertificateAdd(ICertificate): |
---|
| 208 | """Representation of a certificate. |
---|
| 209 | """ |
---|
| 210 | code = schema.TextLine( |
---|
| 211 | title = u'Code', |
---|
| 212 | default = u'NA', |
---|
| 213 | description = u'Abbreviated code of the certificate.', |
---|
| 214 | required = True, |
---|
| 215 | readonly = False, |
---|
| 216 | ) |
---|
| 217 | |
---|
| 218 | ICertificateAdd['code'].order = ICertificate['code'].order |
---|
[5004] | 219 | |
---|
| 220 | class ICertificateContainer(IWAeUPContainer): |
---|
| 221 | """A container for certificates. |
---|
| 222 | """ |
---|
| 223 | def addCertificate(faculty): |
---|
| 224 | """Add an ICertificate object. |
---|
| 225 | |
---|
| 226 | Returns the key, under which the object was stored. |
---|
| 227 | """ |
---|
| 228 | |
---|
| 229 | class ICertificateCourse(IWAeUPObject): |
---|
[5977] | 230 | """A certificatecourse is referring a course and |
---|
[5004] | 231 | provides some own attributes. |
---|
| 232 | """ |
---|
| 233 | course = schema.Choice( |
---|
[5977] | 234 | title = u'Course referrer', |
---|
[5004] | 235 | source = CourseSource(), |
---|
[5950] | 236 | readonly = True, |
---|
[5004] | 237 | ) |
---|
| 238 | |
---|
[5977] | 239 | level = schema.Choice( |
---|
[5951] | 240 | title = u'Level', |
---|
[5004] | 241 | required = True, |
---|
[5977] | 242 | #source = LevelSource(), |
---|
| 243 | vocabulary = course_levels, |
---|
[5950] | 244 | readonly = False, |
---|
[5004] | 245 | ) |
---|
| 246 | |
---|
| 247 | core_or_elective = schema.Bool( |
---|
| 248 | title = u'Is mandatory course (not elective)', |
---|
| 249 | required = True, |
---|
[5950] | 250 | default = True, |
---|
[5004] | 251 | ) |
---|
| 252 | |
---|
| 253 | def getCourseCode(): |
---|
[5977] | 254 | """Return the code of the course referred to. |
---|
[5004] | 255 | |
---|
| 256 | This is needed for cataloging. |
---|
| 257 | """ |
---|
[5951] | 258 | |
---|
| 259 | |
---|
| 260 | class ICertificateCourseAdd(ICertificateCourse): |
---|
[5977] | 261 | """A certificatecourse is referring a course and |
---|
[5951] | 262 | provides some own attributes. |
---|
| 263 | """ |
---|
| 264 | course = schema.Choice( |
---|
[5977] | 265 | title = u'Course', |
---|
[5951] | 266 | source = CourseSource(), |
---|
| 267 | readonly = False, |
---|
| 268 | ) |
---|
| 269 | |
---|
| 270 | ICertificateCourseAdd['course'].order = ICertificateCourse['course'].order |
---|