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