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