[7505] | 1 | ## $Id: interfaces.py 8834 2012-06-27 09:48:53Z henrik $ |
---|
| 2 | ## |
---|
| 3 | ## Copyright (C) 2012 Uli Fouquet & Henrik Bettermann |
---|
| 4 | ## This program is free software; you can redistribute it and/or modify |
---|
| 5 | ## it under the terms of the GNU General Public License as published by |
---|
| 6 | ## the Free Software Foundation; either version 2 of the License, or |
---|
| 7 | ## (at your option) any later version. |
---|
| 8 | ## |
---|
| 9 | ## This program is distributed in the hope that it will be useful, |
---|
| 10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 12 | ## GNU General Public License for more details. |
---|
| 13 | ## |
---|
| 14 | ## You should have received a copy of the GNU General Public License |
---|
| 15 | ## along with this program; if not, write to the Free Software |
---|
| 16 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 17 | ## |
---|
| 18 | from zope import schema |
---|
[7822] | 19 | from waeup.kofa.schema import TextLineChoice |
---|
[8247] | 20 | from waeup.kofa.interfaces import SimpleKofaVocabulary, academic_sessions_vocab |
---|
[8184] | 21 | from waeup.kofa.schema import FormattedDate |
---|
[8101] | 22 | from waeup.kofa.schoolgrades import ResultEntryField |
---|
[8071] | 23 | from waeup.kofa.students.vocabularies import nats_vocab |
---|
[7822] | 24 | from waeup.kofa.students.interfaces import ( |
---|
[8326] | 25 | IStudentBase, IUGStudentClearance, IPGStudentClearance, |
---|
| 26 | IStudentPersonal, IStudentNavigation, IStudentStudyLevel, |
---|
| 27 | IStudentStudyCourse, ICourseTicket |
---|
[7505] | 28 | ) |
---|
[7822] | 29 | from waeup.kofa.students.vocabularies import ( |
---|
[8071] | 30 | nats_vocab, contextual_reg_num_source) |
---|
[8834] | 31 | from kofacustom.nigeria.interfaces import ( |
---|
[8504] | 32 | high_qual, high_grade, exam_types, LGASource) |
---|
[8460] | 33 | from waeup.fceokene.interfaces import MessageFactory as _ |
---|
| 34 | from waeup.fceokene.payments.interfaces import ICustomOnlinePayment |
---|
[7505] | 35 | |
---|
[8504] | 36 | |
---|
[8204] | 37 | class ICustomStudentBase(IStudentBase): |
---|
[7618] | 38 | """Representation of student base data. |
---|
[7505] | 39 | |
---|
| 40 | """ |
---|
[7618] | 41 | |
---|
| 42 | reg_number = TextLineChoice( |
---|
[8071] | 43 | title = _(u'Registration Number'), |
---|
[7505] | 44 | required = False, |
---|
[7618] | 45 | readonly = False, |
---|
| 46 | source = contextual_reg_num_source, |
---|
[7505] | 47 | ) |
---|
| 48 | |
---|
[8204] | 49 | class ICustomStudentPersonal(IStudentPersonal): |
---|
[7618] | 50 | """Student personal data. |
---|
| 51 | |
---|
| 52 | """ |
---|
| 53 | |
---|
[7505] | 54 | marit_stat = schema.Choice( |
---|
| 55 | title = u'Maritual Status', |
---|
| 56 | default = 'unmarried', |
---|
| 57 | required = False, |
---|
[7822] | 58 | vocabulary = SimpleKofaVocabulary( |
---|
[8071] | 59 | (_('Unmarried'), 'unmarried'), |
---|
| 60 | (_('Married'), 'married'),) |
---|
[7505] | 61 | ) |
---|
| 62 | |
---|
[8204] | 63 | class ICustomUGStudentClearance(IUGStudentClearance): |
---|
[7995] | 64 | """Representation of ug student clearance data. |
---|
[7505] | 65 | |
---|
| 66 | """ |
---|
[8184] | 67 | date_of_birth = FormattedDate( |
---|
[8071] | 68 | title = _(u'Date of Birth'), |
---|
[7525] | 69 | required = False, |
---|
[8416] | 70 | show_year = True, |
---|
[7505] | 71 | ) |
---|
| 72 | |
---|
[7525] | 73 | nationality = schema.Choice( |
---|
| 74 | source = nats_vocab, |
---|
[8071] | 75 | title = _(u'Nationality'), |
---|
[7525] | 76 | required = False, |
---|
| 77 | ) |
---|
| 78 | |
---|
| 79 | lga = schema.Choice( |
---|
[8504] | 80 | source = LGASource(), |
---|
[8071] | 81 | title = _(u'State/LGA (Nigerians only)'), |
---|
[7525] | 82 | required = False, |
---|
| 83 | ) |
---|
| 84 | |
---|
[8136] | 85 | def_adm = schema.Bool( |
---|
| 86 | title = _(u'Deferent of Admission'), |
---|
| 87 | required = False, |
---|
| 88 | readonly = False, |
---|
| 89 | ) |
---|
| 90 | |
---|
[8101] | 91 | fst_sit_fname = schema.TextLine( |
---|
| 92 | title = _(u'Full Name'), |
---|
| 93 | required = False, |
---|
| 94 | readonly = False, |
---|
| 95 | ) |
---|
| 96 | fst_sit_no = schema.TextLine( |
---|
| 97 | title = _(u'Exam Number'), |
---|
| 98 | required = False, |
---|
| 99 | readonly = False, |
---|
| 100 | ) |
---|
| 101 | |
---|
[8184] | 102 | fst_sit_date = FormattedDate( |
---|
[8101] | 103 | title = _(u'Exam Date'), |
---|
| 104 | required = False, |
---|
| 105 | readonly = False, |
---|
[8416] | 106 | show_year = True, |
---|
[8101] | 107 | ) |
---|
| 108 | |
---|
| 109 | fst_sit_type = schema.Choice( |
---|
| 110 | title = _(u'Exam Type'), |
---|
| 111 | required = False, |
---|
| 112 | readonly = False, |
---|
| 113 | vocabulary = exam_types, |
---|
| 114 | ) |
---|
| 115 | |
---|
| 116 | fst_sit_results = schema.List( |
---|
| 117 | title = _(u'Exam Results'), |
---|
| 118 | value_type = ResultEntryField(), |
---|
| 119 | required = False, |
---|
| 120 | readonly = False, |
---|
| 121 | default = [], |
---|
| 122 | ) |
---|
| 123 | |
---|
| 124 | scd_sit_fname = schema.TextLine( |
---|
| 125 | title = _(u'Full Name'), |
---|
| 126 | required = False, |
---|
| 127 | readonly = False, |
---|
| 128 | ) |
---|
| 129 | scd_sit_no = schema.TextLine( |
---|
| 130 | title = _(u'Exam Number'), |
---|
| 131 | required = False, |
---|
| 132 | readonly = False, |
---|
| 133 | ) |
---|
| 134 | |
---|
[8184] | 135 | scd_sit_date = FormattedDate( |
---|
[8101] | 136 | title = _(u'Exam Date'), |
---|
| 137 | required = False, |
---|
| 138 | readonly = False, |
---|
[8416] | 139 | show_year = True, |
---|
[8101] | 140 | ) |
---|
| 141 | |
---|
| 142 | scd_sit_type = schema.Choice( |
---|
| 143 | title = _(u'Exam Type'), |
---|
| 144 | required = False, |
---|
| 145 | readonly = False, |
---|
| 146 | vocabulary = exam_types, |
---|
| 147 | ) |
---|
| 148 | |
---|
| 149 | scd_sit_results = schema.List( |
---|
| 150 | title = _(u'Exam Results'), |
---|
| 151 | value_type = ResultEntryField(), |
---|
| 152 | required = False, |
---|
| 153 | readonly = False, |
---|
| 154 | default = [], |
---|
| 155 | ) |
---|
| 156 | |
---|
| 157 | alr_fname = schema.TextLine( |
---|
| 158 | title = _(u'Full Name'), |
---|
| 159 | required = False, |
---|
| 160 | readonly = False, |
---|
| 161 | ) |
---|
| 162 | alr_no = schema.TextLine( |
---|
| 163 | title = _(u'Exam Number'), |
---|
| 164 | required = False, |
---|
| 165 | readonly = False, |
---|
| 166 | ) |
---|
| 167 | |
---|
[8184] | 168 | alr_date = FormattedDate( |
---|
[8101] | 169 | title = _(u'Exam Date'), |
---|
| 170 | required = False, |
---|
| 171 | readonly = False, |
---|
[8416] | 172 | show_year = True, |
---|
[8101] | 173 | ) |
---|
| 174 | |
---|
| 175 | alr_results = schema.List( |
---|
| 176 | title = _(u'Exam Results'), |
---|
| 177 | value_type = ResultEntryField(), |
---|
| 178 | required = False, |
---|
| 179 | readonly = False, |
---|
| 180 | default = [], |
---|
| 181 | ) |
---|
| 182 | |
---|
| 183 | hq_type = schema.Choice( |
---|
| 184 | title = _(u'Qualification Obtained'), |
---|
| 185 | required = False, |
---|
| 186 | readonly = False, |
---|
| 187 | vocabulary = high_qual, |
---|
| 188 | ) |
---|
| 189 | |
---|
| 190 | hq_matric_no = schema.TextLine( |
---|
| 191 | title = _(u'Former Matric Number'), |
---|
| 192 | required = False, |
---|
| 193 | readonly = False, |
---|
| 194 | ) |
---|
| 195 | |
---|
| 196 | hq_degree = schema.Choice( |
---|
| 197 | title = _(u'Class of Degree'), |
---|
| 198 | required = False, |
---|
| 199 | readonly = False, |
---|
| 200 | vocabulary = high_grade, |
---|
| 201 | ) |
---|
| 202 | |
---|
| 203 | hq_school = schema.TextLine( |
---|
| 204 | title = _(u'Institution Attended'), |
---|
| 205 | required = False, |
---|
| 206 | readonly = False, |
---|
| 207 | ) |
---|
| 208 | |
---|
| 209 | hq_session = schema.TextLine( |
---|
| 210 | title = _(u'Years Attended'), |
---|
| 211 | required = False, |
---|
| 212 | readonly = False, |
---|
| 213 | ) |
---|
| 214 | |
---|
| 215 | hq_disc = schema.TextLine( |
---|
| 216 | title = _(u'Discipline'), |
---|
| 217 | required = False, |
---|
| 218 | readonly = False, |
---|
| 219 | ) |
---|
| 220 | |
---|
| 221 | |
---|
[8265] | 222 | class ICustomPGStudentClearance(ICustomUGStudentClearance): |
---|
[7995] | 223 | """Representation of pg student clearance data. |
---|
[7505] | 224 | |
---|
| 225 | """ |
---|
| 226 | |
---|
[8101] | 227 | hq2_type = schema.Choice( |
---|
| 228 | title = _(u'Qualification Obtained'), |
---|
| 229 | required = False, |
---|
| 230 | readonly = False, |
---|
| 231 | vocabulary = high_qual, |
---|
| 232 | ) |
---|
| 233 | |
---|
| 234 | hq2_matric_no = schema.TextLine( |
---|
| 235 | title = _(u'Former Matric Number'), |
---|
| 236 | required = False, |
---|
| 237 | readonly = False, |
---|
| 238 | ) |
---|
| 239 | |
---|
| 240 | hq2_degree = schema.Choice( |
---|
| 241 | title = _(u'Class of Degree'), |
---|
| 242 | required = False, |
---|
| 243 | readonly = False, |
---|
| 244 | vocabulary = high_grade, |
---|
| 245 | ) |
---|
| 246 | |
---|
| 247 | hq2_school = schema.TextLine( |
---|
| 248 | title = _(u'Institution Attended'), |
---|
| 249 | required = False, |
---|
| 250 | readonly = False, |
---|
| 251 | ) |
---|
| 252 | |
---|
| 253 | hq2_session = schema.TextLine( |
---|
| 254 | title = _(u'Years Attended'), |
---|
| 255 | required = False, |
---|
| 256 | readonly = False, |
---|
| 257 | ) |
---|
| 258 | |
---|
| 259 | hq2_disc = schema.TextLine( |
---|
| 260 | title = _(u'Discipline'), |
---|
| 261 | required = False, |
---|
| 262 | readonly = False, |
---|
| 263 | ) |
---|
| 264 | |
---|
| 265 | nysc_year = schema.Int( |
---|
| 266 | title = _(u'Nysc Year'), |
---|
| 267 | required = False, |
---|
| 268 | readonly = False, |
---|
| 269 | ) |
---|
| 270 | |
---|
| 271 | nysc_lga = schema.Choice( |
---|
[8504] | 272 | source = LGASource(), |
---|
[8101] | 273 | title = _(u'Nysc Location'), |
---|
| 274 | required = False, |
---|
| 275 | ) |
---|
| 276 | |
---|
| 277 | employer = schema.TextLine( |
---|
| 278 | title = _(u'Employer'), |
---|
| 279 | required = False, |
---|
| 280 | readonly = False, |
---|
| 281 | ) |
---|
| 282 | |
---|
| 283 | emp_position = schema.TextLine( |
---|
| 284 | title = _(u'Employer Position'), |
---|
| 285 | required = False, |
---|
| 286 | readonly = False, |
---|
| 287 | ) |
---|
| 288 | |
---|
[8184] | 289 | emp_start = FormattedDate( |
---|
[8101] | 290 | title = _(u'Start Date'), |
---|
| 291 | required = False, |
---|
| 292 | readonly = False, |
---|
[8416] | 293 | show_year = True, |
---|
[8101] | 294 | ) |
---|
| 295 | |
---|
[8184] | 296 | emp_end = FormattedDate( |
---|
[8101] | 297 | title = _(u'End Date'), |
---|
| 298 | required = False, |
---|
| 299 | readonly = False, |
---|
[8416] | 300 | show_year = True, |
---|
[8101] | 301 | ) |
---|
| 302 | |
---|
| 303 | emp_reason = schema.TextLine( |
---|
| 304 | title = _(u'Reason for Leaving'), |
---|
| 305 | required = False, |
---|
| 306 | readonly = False, |
---|
| 307 | ) |
---|
| 308 | |
---|
| 309 | employer2 = schema.TextLine( |
---|
| 310 | title = _(u'2nd Employer'), |
---|
| 311 | required = False, |
---|
| 312 | readonly = False, |
---|
| 313 | ) |
---|
| 314 | |
---|
| 315 | emp2_position = schema.TextLine( |
---|
| 316 | title = _(u'2nd Employer Position'), |
---|
| 317 | required = False, |
---|
| 318 | readonly = False, |
---|
| 319 | ) |
---|
| 320 | |
---|
[8184] | 321 | emp2_start = FormattedDate( |
---|
[8101] | 322 | title = _(u'Start Date'), |
---|
| 323 | required = False, |
---|
| 324 | readonly = False, |
---|
[8416] | 325 | show_year = True, |
---|
[8101] | 326 | ) |
---|
[8184] | 327 | emp2_end = FormattedDate( |
---|
[8101] | 328 | title = _(u'End Date'), |
---|
| 329 | required = False, |
---|
| 330 | readonly = False, |
---|
[8416] | 331 | show_year = True, |
---|
[8101] | 332 | ) |
---|
| 333 | |
---|
| 334 | emp2_reason = schema.TextLine( |
---|
| 335 | title = _(u'Reason for Leaving'), |
---|
| 336 | required = False, |
---|
| 337 | readonly = False, |
---|
| 338 | ) |
---|
| 339 | |
---|
[8441] | 340 | former_matric = schema.TextLine( |
---|
[8136] | 341 | title = _(u'If yes, matric number'), |
---|
| 342 | required = False, |
---|
| 343 | readonly = False, |
---|
| 344 | ) |
---|
[8101] | 345 | |
---|
[8136] | 346 | |
---|
[8204] | 347 | class ICustomStudent(ICustomStudentBase,ICustomUGStudentClearance, |
---|
| 348 | ICustomPGStudentClearance,ICustomStudentPersonal): |
---|
[7995] | 349 | """Representation of a student. |
---|
[7505] | 350 | |
---|
| 351 | """ |
---|
[8247] | 352 | |
---|
[8326] | 353 | class ICustomStudentStudyCourse(IStudentStudyCourse): |
---|
| 354 | """A container for student study levels. |
---|
| 355 | |
---|
| 356 | """ |
---|
| 357 | |
---|
| 358 | class ICustomStudentStudyLevel(IStudentStudyLevel): |
---|
| 359 | """A container for course tickets. |
---|
| 360 | |
---|
| 361 | """ |
---|
| 362 | |
---|
[8247] | 363 | class ICustomStudentOnlinePayment(ICustomOnlinePayment): |
---|
| 364 | """A student payment via payment gateways. |
---|
| 365 | |
---|
[8270] | 366 | This Interface does not inherit from IStudentOnlinePayment. |
---|
| 367 | Thus all fields from IStudentOnlinePayment have to be repeated here. |
---|
| 368 | """ |
---|
| 369 | |
---|
| 370 | p_level = schema.Int( |
---|
| 371 | title = _(u'Payment Level'), |
---|
| 372 | required = False, |
---|
| 373 | readonly = True, |
---|
| 374 | ) |
---|
[8430] | 375 | |
---|
[8270] | 376 | ICustomStudentOnlinePayment['p_level'].order = ICustomStudentOnlinePayment[ |
---|
[8326] | 377 | 'p_session'].order |
---|
| 378 | |
---|
| 379 | class ICustomCourseTicket(ICourseTicket): |
---|
| 380 | """A course ticket. |
---|
| 381 | |
---|
[8584] | 382 | """ |
---|
| 383 | |
---|
| 384 | class ICustomStudentUpdateByRegNo(ICustomStudent): |
---|
| 385 | """Representation of a student. Skip regular reg_number validation. |
---|
| 386 | |
---|
| 387 | """ |
---|
| 388 | reg_number = schema.TextLine( |
---|
| 389 | title = _(u'Registration Number'), |
---|
| 390 | required = False, |
---|
| 391 | ) |
---|
| 392 | |
---|
| 393 | class ICustomStudentUpdateByMatricNo(ICustomStudent): |
---|
| 394 | """Representation of a student. Skip regular matric_number validation. |
---|
| 395 | |
---|
| 396 | """ |
---|
| 397 | matric_number = schema.TextLine( |
---|
| 398 | title = _(u'Matriculation Number'), |
---|
| 399 | required = False, |
---|
| 400 | ) |
---|