[8862] | 1 | ## $Id: interfaces.py 9552 2012-11-06 09:59:04Z 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 |
---|
[8968] | 19 | from zope.interface import Attribute |
---|
[8862] | 20 | from waeup.kofa.schema import TextLineChoice |
---|
| 21 | from waeup.kofa.interfaces import SimpleKofaVocabulary, academic_sessions_vocab |
---|
| 22 | from waeup.kofa.schema import FormattedDate |
---|
| 23 | from waeup.kofa.schoolgrades import ResultEntryField |
---|
| 24 | from waeup.kofa.students.vocabularies import nats_vocab |
---|
| 25 | from waeup.kofa.students.interfaces import ( |
---|
| 26 | IStudentBase, IUGStudentClearance, IPGStudentClearance, |
---|
| 27 | IStudentPersonal, IStudentNavigation, IStudentStudyLevel, |
---|
| 28 | IStudentStudyCourse, ICourseTicket |
---|
| 29 | ) |
---|
| 30 | from waeup.kofa.students.vocabularies import ( |
---|
| 31 | nats_vocab, contextual_reg_num_source) |
---|
| 32 | from kofacustom.nigeria.interfaces import ( |
---|
| 33 | high_qual, high_grade, exam_types, LGASource) |
---|
| 34 | from kofacustom.nigeria.interfaces import MessageFactory as _ |
---|
[8863] | 35 | from kofacustom.nigeria.payments.interfaces import INigeriaOnlinePayment |
---|
[8862] | 36 | |
---|
| 37 | |
---|
[8863] | 38 | class INigeriaStudentBase(IStudentBase): |
---|
[8862] | 39 | """Representation of student base data. |
---|
| 40 | |
---|
| 41 | """ |
---|
| 42 | |
---|
| 43 | reg_number = TextLineChoice( |
---|
| 44 | title = _(u'Registration Number'), |
---|
| 45 | required = False, |
---|
| 46 | readonly = False, |
---|
| 47 | source = contextual_reg_num_source, |
---|
| 48 | ) |
---|
| 49 | |
---|
[8966] | 50 | is_staff = schema.Bool( |
---|
| 51 | title = _(u'Staff Member'), |
---|
| 52 | required = False, |
---|
| 53 | readonly = False, |
---|
| 54 | default = False, |
---|
| 55 | ) |
---|
| 56 | |
---|
[8949] | 57 | INigeriaStudentBase['reg_number'].order = IStudentBase[ |
---|
| 58 | 'reg_number'].order |
---|
| 59 | |
---|
[8863] | 60 | class INigeriaStudentPersonal(IStudentPersonal): |
---|
[8862] | 61 | """Student personal data. |
---|
| 62 | |
---|
| 63 | """ |
---|
| 64 | |
---|
[8968] | 65 | is_foreigner = Attribute('True if student is non-Nigerian') |
---|
| 66 | |
---|
[8862] | 67 | marit_stat = schema.Choice( |
---|
| 68 | title = u'Maritual Status', |
---|
| 69 | default = 'unmarried', |
---|
| 70 | required = False, |
---|
| 71 | vocabulary = SimpleKofaVocabulary( |
---|
| 72 | (_('Unmarried'), 'unmarried'), |
---|
| 73 | (_('Married'), 'married'),) |
---|
| 74 | ) |
---|
| 75 | |
---|
[8923] | 76 | religion = schema.Choice( |
---|
| 77 | title = u'Religion', |
---|
| 78 | default = 'no_say', |
---|
| 79 | required = False, |
---|
| 80 | vocabulary = SimpleKofaVocabulary( |
---|
| 81 | (_('Muslim'), 'muslim'), |
---|
| 82 | (_('Christian'), 'christian'), |
---|
| 83 | (_('Others'), 'others'), |
---|
| 84 | (_('Prefer not to say'), 'no_say'),) |
---|
| 85 | ) |
---|
| 86 | |
---|
| 87 | next_kin_name = schema.TextLine( |
---|
| 88 | title = _(u'Next of Kin Name'), |
---|
| 89 | required = False, |
---|
| 90 | readonly = False, |
---|
| 91 | ) |
---|
| 92 | |
---|
| 93 | next_kin_relation = schema.TextLine( |
---|
| 94 | title = _(u'Next of Kin Relationship'), |
---|
| 95 | required = False, |
---|
| 96 | readonly = False, |
---|
| 97 | ) |
---|
| 98 | |
---|
| 99 | next_kin_address = schema.Text( |
---|
| 100 | title = _(u'Next of Kin Address'), |
---|
| 101 | required = False, |
---|
| 102 | readonly = False, |
---|
| 103 | description = _(u'Please provide email address and/or phone number.'), |
---|
| 104 | ) |
---|
| 105 | |
---|
| 106 | disabled = schema.Bool( |
---|
| 107 | title = u'Disabled', |
---|
| 108 | default = False, |
---|
| 109 | required = False, |
---|
| 110 | ) |
---|
| 111 | |
---|
[8863] | 112 | class INigeriaUGStudentClearance(IUGStudentClearance): |
---|
[8862] | 113 | """Representation of ug student clearance data. |
---|
| 114 | |
---|
| 115 | """ |
---|
[9535] | 116 | officer_comment = schema.Text( |
---|
| 117 | title = _(u"Officer's Comment"), |
---|
| 118 | required = False, |
---|
| 119 | ) |
---|
| 120 | |
---|
| 121 | clearance_locked = schema.Bool( |
---|
| 122 | title = _(u'Clearance form locked'), |
---|
| 123 | default = False, |
---|
| 124 | required = False, |
---|
| 125 | ) |
---|
| 126 | |
---|
| 127 | clr_code = schema.TextLine( |
---|
| 128 | title = _(u'CLR Activation Code'), |
---|
| 129 | required = False, |
---|
| 130 | readonly = False, |
---|
| 131 | ) |
---|
| 132 | |
---|
[8862] | 133 | date_of_birth = FormattedDate( |
---|
| 134 | title = _(u'Date of Birth'), |
---|
| 135 | required = False, |
---|
| 136 | show_year = True, |
---|
| 137 | ) |
---|
| 138 | |
---|
| 139 | nationality = schema.Choice( |
---|
| 140 | source = nats_vocab, |
---|
| 141 | title = _(u'Nationality'), |
---|
[9036] | 142 | required = True, |
---|
[8862] | 143 | ) |
---|
| 144 | |
---|
| 145 | lga = schema.Choice( |
---|
| 146 | source = LGASource(), |
---|
| 147 | title = _(u'State/LGA (Nigerians only)'), |
---|
| 148 | required = False, |
---|
| 149 | ) |
---|
| 150 | |
---|
| 151 | def_adm = schema.Bool( |
---|
| 152 | title = _(u'Deferent of Admission'), |
---|
| 153 | required = False, |
---|
| 154 | readonly = False, |
---|
| 155 | ) |
---|
| 156 | |
---|
| 157 | fst_sit_fname = schema.TextLine( |
---|
| 158 | title = _(u'Full Name'), |
---|
| 159 | required = False, |
---|
| 160 | readonly = False, |
---|
| 161 | ) |
---|
| 162 | fst_sit_no = schema.TextLine( |
---|
| 163 | title = _(u'Exam Number'), |
---|
| 164 | required = False, |
---|
| 165 | readonly = False, |
---|
| 166 | ) |
---|
| 167 | |
---|
| 168 | fst_sit_date = FormattedDate( |
---|
| 169 | title = _(u'Exam Date'), |
---|
| 170 | required = False, |
---|
| 171 | readonly = False, |
---|
| 172 | show_year = True, |
---|
| 173 | ) |
---|
| 174 | |
---|
| 175 | fst_sit_type = schema.Choice( |
---|
| 176 | title = _(u'Exam Type'), |
---|
| 177 | required = False, |
---|
| 178 | readonly = False, |
---|
| 179 | vocabulary = exam_types, |
---|
| 180 | ) |
---|
| 181 | |
---|
| 182 | fst_sit_results = schema.List( |
---|
| 183 | title = _(u'Exam Results'), |
---|
| 184 | value_type = ResultEntryField(), |
---|
| 185 | required = False, |
---|
| 186 | readonly = False, |
---|
| 187 | default = [], |
---|
| 188 | ) |
---|
| 189 | |
---|
| 190 | scd_sit_fname = schema.TextLine( |
---|
| 191 | title = _(u'Full Name'), |
---|
| 192 | required = False, |
---|
| 193 | readonly = False, |
---|
| 194 | ) |
---|
| 195 | scd_sit_no = schema.TextLine( |
---|
| 196 | title = _(u'Exam Number'), |
---|
| 197 | required = False, |
---|
| 198 | readonly = False, |
---|
| 199 | ) |
---|
| 200 | |
---|
| 201 | scd_sit_date = FormattedDate( |
---|
| 202 | title = _(u'Exam Date'), |
---|
| 203 | required = False, |
---|
| 204 | readonly = False, |
---|
| 205 | show_year = True, |
---|
| 206 | ) |
---|
| 207 | |
---|
| 208 | scd_sit_type = schema.Choice( |
---|
| 209 | title = _(u'Exam Type'), |
---|
| 210 | required = False, |
---|
| 211 | readonly = False, |
---|
| 212 | vocabulary = exam_types, |
---|
| 213 | ) |
---|
| 214 | |
---|
| 215 | scd_sit_results = schema.List( |
---|
| 216 | title = _(u'Exam Results'), |
---|
| 217 | value_type = ResultEntryField(), |
---|
| 218 | required = False, |
---|
| 219 | readonly = False, |
---|
| 220 | default = [], |
---|
| 221 | ) |
---|
| 222 | |
---|
| 223 | alr_fname = schema.TextLine( |
---|
| 224 | title = _(u'Full Name'), |
---|
| 225 | required = False, |
---|
| 226 | readonly = False, |
---|
| 227 | ) |
---|
| 228 | alr_no = schema.TextLine( |
---|
| 229 | title = _(u'Exam Number'), |
---|
| 230 | required = False, |
---|
| 231 | readonly = False, |
---|
| 232 | ) |
---|
| 233 | |
---|
| 234 | alr_date = FormattedDate( |
---|
| 235 | title = _(u'Exam Date'), |
---|
| 236 | required = False, |
---|
| 237 | readonly = False, |
---|
| 238 | show_year = True, |
---|
| 239 | ) |
---|
| 240 | |
---|
| 241 | alr_results = schema.List( |
---|
| 242 | title = _(u'Exam Results'), |
---|
| 243 | value_type = ResultEntryField(), |
---|
| 244 | required = False, |
---|
| 245 | readonly = False, |
---|
| 246 | default = [], |
---|
| 247 | ) |
---|
| 248 | |
---|
| 249 | hq_type = schema.Choice( |
---|
| 250 | title = _(u'Qualification Obtained'), |
---|
| 251 | required = False, |
---|
| 252 | readonly = False, |
---|
| 253 | vocabulary = high_qual, |
---|
| 254 | ) |
---|
| 255 | |
---|
[9552] | 256 | hq_fname = schema.TextLine( |
---|
| 257 | title = _(u'Full Name'), |
---|
| 258 | required = False, |
---|
| 259 | readonly = False, |
---|
| 260 | ) |
---|
| 261 | |
---|
[8862] | 262 | hq_matric_no = schema.TextLine( |
---|
| 263 | title = _(u'Former Matric Number'), |
---|
| 264 | required = False, |
---|
| 265 | readonly = False, |
---|
| 266 | ) |
---|
| 267 | |
---|
| 268 | hq_degree = schema.Choice( |
---|
| 269 | title = _(u'Class of Degree'), |
---|
| 270 | required = False, |
---|
| 271 | readonly = False, |
---|
| 272 | vocabulary = high_grade, |
---|
| 273 | ) |
---|
| 274 | |
---|
| 275 | hq_school = schema.TextLine( |
---|
| 276 | title = _(u'Institution Attended'), |
---|
| 277 | required = False, |
---|
| 278 | readonly = False, |
---|
| 279 | ) |
---|
| 280 | |
---|
| 281 | hq_session = schema.TextLine( |
---|
| 282 | title = _(u'Years Attended'), |
---|
| 283 | required = False, |
---|
| 284 | readonly = False, |
---|
| 285 | ) |
---|
| 286 | |
---|
| 287 | hq_disc = schema.TextLine( |
---|
| 288 | title = _(u'Discipline'), |
---|
| 289 | required = False, |
---|
| 290 | readonly = False, |
---|
| 291 | ) |
---|
| 292 | |
---|
| 293 | |
---|
[8863] | 294 | class INigeriaPGStudentClearance(INigeriaUGStudentClearance): |
---|
[8862] | 295 | """Representation of pg student clearance data. |
---|
| 296 | |
---|
| 297 | """ |
---|
| 298 | |
---|
| 299 | hq2_type = schema.Choice( |
---|
| 300 | title = _(u'Qualification Obtained'), |
---|
| 301 | required = False, |
---|
| 302 | readonly = False, |
---|
| 303 | vocabulary = high_qual, |
---|
| 304 | ) |
---|
| 305 | |
---|
| 306 | hq2_matric_no = schema.TextLine( |
---|
| 307 | title = _(u'Former Matric Number'), |
---|
| 308 | required = False, |
---|
| 309 | readonly = False, |
---|
| 310 | ) |
---|
| 311 | |
---|
| 312 | hq2_degree = schema.Choice( |
---|
| 313 | title = _(u'Class of Degree'), |
---|
| 314 | required = False, |
---|
| 315 | readonly = False, |
---|
| 316 | vocabulary = high_grade, |
---|
| 317 | ) |
---|
| 318 | |
---|
| 319 | hq2_school = schema.TextLine( |
---|
| 320 | title = _(u'Institution Attended'), |
---|
| 321 | required = False, |
---|
| 322 | readonly = False, |
---|
| 323 | ) |
---|
| 324 | |
---|
| 325 | hq2_session = schema.TextLine( |
---|
| 326 | title = _(u'Years Attended'), |
---|
| 327 | required = False, |
---|
| 328 | readonly = False, |
---|
| 329 | ) |
---|
| 330 | |
---|
| 331 | hq2_disc = schema.TextLine( |
---|
| 332 | title = _(u'Discipline'), |
---|
| 333 | required = False, |
---|
| 334 | readonly = False, |
---|
| 335 | ) |
---|
| 336 | |
---|
| 337 | nysc_year = schema.Int( |
---|
| 338 | title = _(u'Nysc Year'), |
---|
| 339 | required = False, |
---|
| 340 | readonly = False, |
---|
| 341 | ) |
---|
| 342 | |
---|
[8946] | 343 | nysc_location = schema.TextLine( |
---|
| 344 | title = _(u'Nysc Location'), |
---|
| 345 | required = False, |
---|
| 346 | ) |
---|
| 347 | |
---|
[8862] | 348 | nysc_lga = schema.Choice( |
---|
| 349 | source = LGASource(), |
---|
[8946] | 350 | title = _(u'Nysc LGA'), |
---|
[8862] | 351 | required = False, |
---|
| 352 | ) |
---|
| 353 | |
---|
| 354 | employer = schema.TextLine( |
---|
| 355 | title = _(u'Employer'), |
---|
| 356 | required = False, |
---|
| 357 | readonly = False, |
---|
| 358 | ) |
---|
| 359 | |
---|
| 360 | emp_position = schema.TextLine( |
---|
| 361 | title = _(u'Employer Position'), |
---|
| 362 | required = False, |
---|
| 363 | readonly = False, |
---|
| 364 | ) |
---|
| 365 | |
---|
| 366 | emp_start = FormattedDate( |
---|
| 367 | title = _(u'Start Date'), |
---|
| 368 | required = False, |
---|
| 369 | readonly = False, |
---|
| 370 | show_year = True, |
---|
| 371 | ) |
---|
| 372 | |
---|
| 373 | emp_end = FormattedDate( |
---|
| 374 | title = _(u'End Date'), |
---|
| 375 | required = False, |
---|
| 376 | readonly = False, |
---|
| 377 | show_year = True, |
---|
| 378 | ) |
---|
| 379 | |
---|
| 380 | emp_reason = schema.TextLine( |
---|
| 381 | title = _(u'Reason for Leaving'), |
---|
| 382 | required = False, |
---|
| 383 | readonly = False, |
---|
| 384 | ) |
---|
| 385 | |
---|
| 386 | employer2 = schema.TextLine( |
---|
| 387 | title = _(u'2nd Employer'), |
---|
| 388 | required = False, |
---|
| 389 | readonly = False, |
---|
| 390 | ) |
---|
| 391 | |
---|
| 392 | emp2_position = schema.TextLine( |
---|
| 393 | title = _(u'2nd Employer Position'), |
---|
| 394 | required = False, |
---|
| 395 | readonly = False, |
---|
| 396 | ) |
---|
| 397 | |
---|
| 398 | emp2_start = FormattedDate( |
---|
| 399 | title = _(u'Start Date'), |
---|
| 400 | required = False, |
---|
| 401 | readonly = False, |
---|
| 402 | show_year = True, |
---|
| 403 | ) |
---|
| 404 | emp2_end = FormattedDate( |
---|
| 405 | title = _(u'End Date'), |
---|
| 406 | required = False, |
---|
| 407 | readonly = False, |
---|
| 408 | show_year = True, |
---|
| 409 | ) |
---|
| 410 | |
---|
| 411 | emp2_reason = schema.TextLine( |
---|
| 412 | title = _(u'Reason for Leaving'), |
---|
| 413 | required = False, |
---|
| 414 | readonly = False, |
---|
| 415 | ) |
---|
| 416 | |
---|
| 417 | former_matric = schema.TextLine( |
---|
| 418 | title = _(u'If yes, matric number'), |
---|
| 419 | required = False, |
---|
| 420 | readonly = False, |
---|
| 421 | ) |
---|
| 422 | |
---|
| 423 | |
---|
[8863] | 424 | class INigeriaStudent(INigeriaStudentBase,INigeriaUGStudentClearance, |
---|
| 425 | INigeriaPGStudentClearance,INigeriaStudentPersonal): |
---|
[8862] | 426 | """Representation of a student. |
---|
| 427 | |
---|
| 428 | """ |
---|
| 429 | |
---|
[8863] | 430 | class INigeriaStudentStudyCourse(IStudentStudyCourse): |
---|
[8862] | 431 | """A container for student study levels. |
---|
| 432 | |
---|
| 433 | """ |
---|
| 434 | |
---|
[8863] | 435 | class INigeriaStudentStudyLevel(IStudentStudyLevel): |
---|
[8862] | 436 | """A container for course tickets. |
---|
| 437 | |
---|
| 438 | """ |
---|
| 439 | |
---|
[8863] | 440 | class INigeriaStudentOnlinePayment(INigeriaOnlinePayment): |
---|
[8862] | 441 | """A student payment via payment gateways. |
---|
| 442 | |
---|
| 443 | This Interface does not inherit from IStudentOnlinePayment. |
---|
| 444 | Thus all fields from IStudentOnlinePayment have to be repeated here. |
---|
| 445 | """ |
---|
| 446 | |
---|
[9471] | 447 | p_current = schema.Bool( |
---|
| 448 | title = _(u'Current Session Payment'), |
---|
| 449 | default = True, |
---|
| 450 | required = False, |
---|
| 451 | ) |
---|
| 452 | |
---|
[8862] | 453 | p_level = schema.Int( |
---|
| 454 | title = _(u'Payment Level'), |
---|
| 455 | required = False, |
---|
| 456 | ) |
---|
| 457 | |
---|
[8863] | 458 | INigeriaStudentOnlinePayment['p_level'].order = INigeriaStudentOnlinePayment[ |
---|
[8862] | 459 | 'p_session'].order |
---|
| 460 | |
---|
[8863] | 461 | class INigeriaCourseTicket(ICourseTicket): |
---|
[8862] | 462 | """A course ticket. |
---|
| 463 | |
---|
| 464 | """ |
---|
| 465 | |
---|
[8863] | 466 | class INigeriaStudentUpdateByRegNo(INigeriaStudent): |
---|
[8862] | 467 | """Representation of a student. Skip regular reg_number validation. |
---|
| 468 | |
---|
| 469 | """ |
---|
| 470 | reg_number = schema.TextLine( |
---|
| 471 | title = _(u'Registration Number'), |
---|
| 472 | required = False, |
---|
| 473 | ) |
---|
| 474 | |
---|
[8863] | 475 | class INigeriaStudentUpdateByMatricNo(INigeriaStudent): |
---|
[8862] | 476 | """Representation of a student. Skip regular matric_number validation. |
---|
| 477 | |
---|
| 478 | """ |
---|
| 479 | matric_number = schema.TextLine( |
---|
| 480 | title = _(u'Matriculation Number'), |
---|
| 481 | required = False, |
---|
| 482 | ) |
---|