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