[7505] | 1 | ## $Id: interfaces.py 8502 2012-05-23 21:26:44Z 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) |
---|
[8101] | 31 | from waeup.uniben.interfaces import ( |
---|
[8502] | 32 | high_qual, high_grade, exam_types, LGASource) |
---|
[8071] | 33 | from waeup.uniben.interfaces import MessageFactory as _ |
---|
[8247] | 34 | from waeup.uniben.payments.interfaces import ICustomOnlinePayment |
---|
[8502] | 35 | from waeup.uniben.utils.lgas import LGAS |
---|
[7505] | 36 | |
---|
[8502] | 37 | |
---|
[8204] | 38 | class ICustomStudentBase(IStudentBase): |
---|
[7618] | 39 | """Representation of student base data. |
---|
[7505] | 40 | |
---|
| 41 | """ |
---|
[7618] | 42 | |
---|
| 43 | reg_number = TextLineChoice( |
---|
[8071] | 44 | title = _(u'Registration Number'), |
---|
[7505] | 45 | required = False, |
---|
[7618] | 46 | readonly = False, |
---|
| 47 | source = contextual_reg_num_source, |
---|
[7505] | 48 | ) |
---|
| 49 | |
---|
[8204] | 50 | class ICustomStudentPersonal(IStudentPersonal): |
---|
[7618] | 51 | """Student personal data. |
---|
| 52 | |
---|
| 53 | """ |
---|
| 54 | |
---|
[7505] | 55 | marit_stat = schema.Choice( |
---|
| 56 | title = u'Maritual Status', |
---|
| 57 | default = 'unmarried', |
---|
| 58 | required = False, |
---|
[7822] | 59 | vocabulary = SimpleKofaVocabulary( |
---|
[8071] | 60 | (_('Unmarried'), 'unmarried'), |
---|
| 61 | (_('Married'), 'married'),) |
---|
[7505] | 62 | ) |
---|
| 63 | |
---|
[8204] | 64 | class ICustomUGStudentClearance(IUGStudentClearance): |
---|
[7995] | 65 | """Representation of ug student clearance data. |
---|
[7505] | 66 | |
---|
| 67 | """ |
---|
[8184] | 68 | date_of_birth = FormattedDate( |
---|
[8071] | 69 | title = _(u'Date of Birth'), |
---|
[7525] | 70 | required = False, |
---|
[8416] | 71 | show_year = True, |
---|
[7505] | 72 | ) |
---|
| 73 | |
---|
[7525] | 74 | nationality = schema.Choice( |
---|
| 75 | source = nats_vocab, |
---|
[8071] | 76 | title = _(u'Nationality'), |
---|
[7525] | 77 | required = False, |
---|
| 78 | ) |
---|
| 79 | |
---|
| 80 | lga = schema.Choice( |
---|
[8502] | 81 | source = LGASource(), |
---|
[8071] | 82 | title = _(u'State/LGA (Nigerians only)'), |
---|
[7525] | 83 | required = False, |
---|
| 84 | ) |
---|
| 85 | |
---|
[8136] | 86 | def_adm = schema.Bool( |
---|
| 87 | title = _(u'Deferent of Admission'), |
---|
| 88 | required = False, |
---|
| 89 | readonly = False, |
---|
| 90 | ) |
---|
| 91 | |
---|
[8101] | 92 | fst_sit_fname = schema.TextLine( |
---|
| 93 | title = _(u'Full Name'), |
---|
| 94 | required = False, |
---|
| 95 | readonly = False, |
---|
| 96 | ) |
---|
| 97 | fst_sit_no = schema.TextLine( |
---|
| 98 | title = _(u'Exam Number'), |
---|
| 99 | required = False, |
---|
| 100 | readonly = False, |
---|
| 101 | ) |
---|
| 102 | |
---|
[8184] | 103 | fst_sit_date = FormattedDate( |
---|
[8101] | 104 | title = _(u'Exam Date'), |
---|
| 105 | required = False, |
---|
| 106 | readonly = False, |
---|
[8416] | 107 | show_year = True, |
---|
[8101] | 108 | ) |
---|
| 109 | |
---|
| 110 | fst_sit_type = schema.Choice( |
---|
| 111 | title = _(u'Exam Type'), |
---|
| 112 | required = False, |
---|
| 113 | readonly = False, |
---|
| 114 | vocabulary = exam_types, |
---|
| 115 | ) |
---|
| 116 | |
---|
| 117 | fst_sit_results = schema.List( |
---|
| 118 | title = _(u'Exam Results'), |
---|
| 119 | value_type = ResultEntryField(), |
---|
| 120 | required = False, |
---|
| 121 | readonly = False, |
---|
| 122 | default = [], |
---|
| 123 | ) |
---|
| 124 | |
---|
| 125 | scd_sit_fname = schema.TextLine( |
---|
| 126 | title = _(u'Full Name'), |
---|
| 127 | required = False, |
---|
| 128 | readonly = False, |
---|
| 129 | ) |
---|
| 130 | scd_sit_no = schema.TextLine( |
---|
| 131 | title = _(u'Exam Number'), |
---|
| 132 | required = False, |
---|
| 133 | readonly = False, |
---|
| 134 | ) |
---|
| 135 | |
---|
[8184] | 136 | scd_sit_date = FormattedDate( |
---|
[8101] | 137 | title = _(u'Exam Date'), |
---|
| 138 | required = False, |
---|
| 139 | readonly = False, |
---|
[8416] | 140 | show_year = True, |
---|
[8101] | 141 | ) |
---|
| 142 | |
---|
| 143 | scd_sit_type = schema.Choice( |
---|
| 144 | title = _(u'Exam Type'), |
---|
| 145 | required = False, |
---|
| 146 | readonly = False, |
---|
| 147 | vocabulary = exam_types, |
---|
| 148 | ) |
---|
| 149 | |
---|
| 150 | scd_sit_results = schema.List( |
---|
| 151 | title = _(u'Exam Results'), |
---|
| 152 | value_type = ResultEntryField(), |
---|
| 153 | required = False, |
---|
| 154 | readonly = False, |
---|
| 155 | default = [], |
---|
| 156 | ) |
---|
| 157 | |
---|
| 158 | alr_fname = schema.TextLine( |
---|
| 159 | title = _(u'Full Name'), |
---|
| 160 | required = False, |
---|
| 161 | readonly = False, |
---|
| 162 | ) |
---|
| 163 | alr_no = schema.TextLine( |
---|
| 164 | title = _(u'Exam Number'), |
---|
| 165 | required = False, |
---|
| 166 | readonly = False, |
---|
| 167 | ) |
---|
| 168 | |
---|
[8184] | 169 | alr_date = FormattedDate( |
---|
[8101] | 170 | title = _(u'Exam Date'), |
---|
| 171 | required = False, |
---|
| 172 | readonly = False, |
---|
[8416] | 173 | show_year = True, |
---|
[8101] | 174 | ) |
---|
| 175 | |
---|
| 176 | alr_results = schema.List( |
---|
| 177 | title = _(u'Exam Results'), |
---|
| 178 | value_type = ResultEntryField(), |
---|
| 179 | required = False, |
---|
| 180 | readonly = False, |
---|
| 181 | default = [], |
---|
| 182 | ) |
---|
| 183 | |
---|
| 184 | hq_type = schema.Choice( |
---|
| 185 | title = _(u'Qualification Obtained'), |
---|
| 186 | required = False, |
---|
| 187 | readonly = False, |
---|
| 188 | vocabulary = high_qual, |
---|
| 189 | ) |
---|
| 190 | |
---|
| 191 | hq_matric_no = schema.TextLine( |
---|
| 192 | title = _(u'Former Matric Number'), |
---|
| 193 | required = False, |
---|
| 194 | readonly = False, |
---|
| 195 | ) |
---|
| 196 | |
---|
| 197 | hq_degree = schema.Choice( |
---|
| 198 | title = _(u'Class of Degree'), |
---|
| 199 | required = False, |
---|
| 200 | readonly = False, |
---|
| 201 | vocabulary = high_grade, |
---|
| 202 | ) |
---|
| 203 | |
---|
| 204 | hq_school = schema.TextLine( |
---|
| 205 | title = _(u'Institution Attended'), |
---|
| 206 | required = False, |
---|
| 207 | readonly = False, |
---|
| 208 | ) |
---|
| 209 | |
---|
| 210 | hq_session = schema.TextLine( |
---|
| 211 | title = _(u'Years Attended'), |
---|
| 212 | required = False, |
---|
| 213 | readonly = False, |
---|
| 214 | ) |
---|
| 215 | |
---|
| 216 | hq_disc = schema.TextLine( |
---|
| 217 | title = _(u'Discipline'), |
---|
| 218 | required = False, |
---|
| 219 | readonly = False, |
---|
| 220 | ) |
---|
| 221 | |
---|
| 222 | |
---|
[8265] | 223 | class ICustomPGStudentClearance(ICustomUGStudentClearance): |
---|
[7995] | 224 | """Representation of pg student clearance data. |
---|
[7505] | 225 | |
---|
| 226 | """ |
---|
| 227 | |
---|
[8101] | 228 | hq2_type = schema.Choice( |
---|
| 229 | title = _(u'Qualification Obtained'), |
---|
| 230 | required = False, |
---|
| 231 | readonly = False, |
---|
| 232 | vocabulary = high_qual, |
---|
| 233 | ) |
---|
| 234 | |
---|
| 235 | hq2_matric_no = schema.TextLine( |
---|
| 236 | title = _(u'Former Matric Number'), |
---|
| 237 | required = False, |
---|
| 238 | readonly = False, |
---|
| 239 | ) |
---|
| 240 | |
---|
| 241 | hq2_degree = schema.Choice( |
---|
| 242 | title = _(u'Class of Degree'), |
---|
| 243 | required = False, |
---|
| 244 | readonly = False, |
---|
| 245 | vocabulary = high_grade, |
---|
| 246 | ) |
---|
| 247 | |
---|
| 248 | hq2_school = schema.TextLine( |
---|
| 249 | title = _(u'Institution Attended'), |
---|
| 250 | required = False, |
---|
| 251 | readonly = False, |
---|
| 252 | ) |
---|
| 253 | |
---|
| 254 | hq2_session = schema.TextLine( |
---|
| 255 | title = _(u'Years Attended'), |
---|
| 256 | required = False, |
---|
| 257 | readonly = False, |
---|
| 258 | ) |
---|
| 259 | |
---|
| 260 | hq2_disc = schema.TextLine( |
---|
| 261 | title = _(u'Discipline'), |
---|
| 262 | required = False, |
---|
| 263 | readonly = False, |
---|
| 264 | ) |
---|
| 265 | |
---|
| 266 | nysc_year = schema.Int( |
---|
| 267 | title = _(u'Nysc Year'), |
---|
| 268 | required = False, |
---|
| 269 | readonly = False, |
---|
| 270 | ) |
---|
| 271 | |
---|
| 272 | nysc_lga = schema.Choice( |
---|
[8502] | 273 | source = LGASource(), |
---|
[8101] | 274 | title = _(u'Nysc Location'), |
---|
| 275 | required = False, |
---|
| 276 | ) |
---|
| 277 | |
---|
| 278 | employer = schema.TextLine( |
---|
| 279 | title = _(u'Employer'), |
---|
| 280 | required = False, |
---|
| 281 | readonly = False, |
---|
| 282 | ) |
---|
| 283 | |
---|
| 284 | emp_position = schema.TextLine( |
---|
| 285 | title = _(u'Employer Position'), |
---|
| 286 | required = False, |
---|
| 287 | readonly = False, |
---|
| 288 | ) |
---|
| 289 | |
---|
[8184] | 290 | emp_start = FormattedDate( |
---|
[8101] | 291 | title = _(u'Start Date'), |
---|
| 292 | required = False, |
---|
| 293 | readonly = False, |
---|
[8416] | 294 | show_year = True, |
---|
[8101] | 295 | ) |
---|
| 296 | |
---|
[8184] | 297 | emp_end = FormattedDate( |
---|
[8101] | 298 | title = _(u'End Date'), |
---|
| 299 | required = False, |
---|
| 300 | readonly = False, |
---|
[8416] | 301 | show_year = True, |
---|
[8101] | 302 | ) |
---|
| 303 | |
---|
| 304 | emp_reason = schema.TextLine( |
---|
| 305 | title = _(u'Reason for Leaving'), |
---|
| 306 | required = False, |
---|
| 307 | readonly = False, |
---|
| 308 | ) |
---|
| 309 | |
---|
| 310 | employer2 = schema.TextLine( |
---|
| 311 | title = _(u'2nd Employer'), |
---|
| 312 | required = False, |
---|
| 313 | readonly = False, |
---|
| 314 | ) |
---|
| 315 | |
---|
| 316 | emp2_position = schema.TextLine( |
---|
| 317 | title = _(u'2nd Employer Position'), |
---|
| 318 | required = False, |
---|
| 319 | readonly = False, |
---|
| 320 | ) |
---|
| 321 | |
---|
[8184] | 322 | emp2_start = FormattedDate( |
---|
[8101] | 323 | title = _(u'Start Date'), |
---|
| 324 | required = False, |
---|
| 325 | readonly = False, |
---|
[8416] | 326 | show_year = True, |
---|
[8101] | 327 | ) |
---|
[8184] | 328 | emp2_end = FormattedDate( |
---|
[8101] | 329 | title = _(u'End Date'), |
---|
| 330 | required = False, |
---|
| 331 | readonly = False, |
---|
[8416] | 332 | show_year = True, |
---|
[8101] | 333 | ) |
---|
| 334 | |
---|
| 335 | emp2_reason = schema.TextLine( |
---|
| 336 | title = _(u'Reason for Leaving'), |
---|
| 337 | required = False, |
---|
| 338 | readonly = False, |
---|
| 339 | ) |
---|
| 340 | |
---|
[8441] | 341 | former_matric = schema.TextLine( |
---|
[8136] | 342 | title = _(u'If yes, matric number'), |
---|
| 343 | required = False, |
---|
| 344 | readonly = False, |
---|
| 345 | ) |
---|
[8101] | 346 | |
---|
[8136] | 347 | |
---|
[8204] | 348 | class ICustomStudent(ICustomStudentBase,ICustomUGStudentClearance, |
---|
| 349 | ICustomPGStudentClearance,ICustomStudentPersonal): |
---|
[7995] | 350 | """Representation of a student. |
---|
[7505] | 351 | |
---|
| 352 | """ |
---|
[8247] | 353 | |
---|
[8326] | 354 | class ICustomStudentStudyCourse(IStudentStudyCourse): |
---|
| 355 | """A container for student study levels. |
---|
| 356 | |
---|
| 357 | """ |
---|
| 358 | |
---|
| 359 | class ICustomStudentStudyLevel(IStudentStudyLevel): |
---|
| 360 | """A container for course tickets. |
---|
| 361 | |
---|
| 362 | """ |
---|
| 363 | |
---|
[8247] | 364 | class ICustomStudentOnlinePayment(ICustomOnlinePayment): |
---|
| 365 | """A student payment via payment gateways. |
---|
| 366 | |
---|
[8270] | 367 | This Interface does not inherit from IStudentOnlinePayment. |
---|
| 368 | Thus all fields from IStudentOnlinePayment have to be repeated here. |
---|
| 369 | """ |
---|
| 370 | |
---|
| 371 | p_level = schema.Int( |
---|
| 372 | title = _(u'Payment Level'), |
---|
| 373 | required = False, |
---|
| 374 | readonly = True, |
---|
| 375 | ) |
---|
[8430] | 376 | |
---|
[8270] | 377 | ICustomStudentOnlinePayment['p_level'].order = ICustomStudentOnlinePayment[ |
---|
[8326] | 378 | 'p_session'].order |
---|
| 379 | |
---|
| 380 | class ICustomCourseTicket(ICourseTicket): |
---|
| 381 | """A course ticket. |
---|
| 382 | |
---|
| 383 | """ |
---|