[7505] | 1 | ## $Id: interfaces.py 14113 2016-08-23 07:00:13Z 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 | ## |
---|
[8867] | 18 | |
---|
[7505] | 19 | from zope import schema |
---|
[9496] | 20 | from zc.sourcefactory.contextual import BasicContextualSourceFactory |
---|
| 21 | from zope.catalog.interfaces import ICatalog |
---|
| 22 | from zope.component import getUtility |
---|
[13865] | 23 | from waeup.kofa.interfaces import (IKofaObject, academic_sessions_vocab) |
---|
[13795] | 24 | from waeup.kofa.students.vocabularies import ( |
---|
| 25 | StudyLevelSource, contextual_reg_num_source |
---|
| 26 | ) |
---|
| 27 | from waeup.kofa.schema import PhoneNumber, FormattedDate, TextLineChoice |
---|
[13362] | 28 | from kofacustom.nigeria.interfaces import LGASource |
---|
[8867] | 29 | from kofacustom.nigeria.students.interfaces import ( |
---|
| 30 | INigeriaStudentBase, INigeriaUGStudentClearance, INigeriaPGStudentClearance, |
---|
| 31 | INigeriaStudentPersonal, INigeriaStudentStudyLevel, |
---|
| 32 | INigeriaStudentStudyCourse, INigeriaCourseTicket, |
---|
| 33 | INigeriaStudentUpdateByRegNo, INigeriaStudentUpdateByMatricNo, |
---|
[7505] | 34 | ) |
---|
[8867] | 35 | from waeup.aaue.payments.interfaces import ICustomOnlinePayment |
---|
[8444] | 36 | from waeup.aaue.interfaces import MessageFactory as _ |
---|
[7505] | 37 | |
---|
[8867] | 38 | class ICustomStudentBase(INigeriaStudentBase): |
---|
[7618] | 39 | """Representation of student base data. |
---|
[7505] | 40 | |
---|
| 41 | """ |
---|
[7618] | 42 | |
---|
[13795] | 43 | reg_number = TextLineChoice( |
---|
| 44 | title = _(u'JAMB Registration Number'), |
---|
| 45 | required = False, |
---|
| 46 | readonly = False, |
---|
| 47 | source = contextual_reg_num_source, |
---|
| 48 | ) |
---|
| 49 | |
---|
| 50 | application_number = schema.TextLine( |
---|
| 51 | title = _(u'Application Number'), |
---|
| 52 | required = False, |
---|
| 53 | readonly = False, |
---|
| 54 | ) |
---|
| 55 | |
---|
| 56 | ICustomStudentBase['reg_number'].order = INigeriaStudentBase[ |
---|
| 57 | 'reg_number'].order |
---|
| 58 | |
---|
| 59 | ICustomStudentBase['application_number'].order = ICustomStudentBase[ |
---|
| 60 | 'reg_number'].order |
---|
| 61 | |
---|
| 62 | |
---|
[8867] | 63 | class ICustomStudentPersonal(INigeriaStudentPersonal): |
---|
[7618] | 64 | """Student personal data. |
---|
| 65 | |
---|
| 66 | """ |
---|
| 67 | |
---|
[13351] | 68 | father_name = schema.TextLine( |
---|
| 69 | title = _(u'Father\'s Name'), |
---|
| 70 | required = False, |
---|
| 71 | readonly = False, |
---|
| 72 | ) |
---|
| 73 | |
---|
| 74 | father_address = schema.Text( |
---|
| 75 | title = _(u'Father\'s Permanent Address'), |
---|
| 76 | required = False, |
---|
| 77 | readonly = False, |
---|
| 78 | ) |
---|
| 79 | |
---|
| 80 | father_work = schema.TextLine( |
---|
| 81 | title = _(u'Father\'s Place of Work'), |
---|
| 82 | required = False, |
---|
| 83 | readonly = False, |
---|
| 84 | ) |
---|
| 85 | |
---|
| 86 | father_phone = PhoneNumber( |
---|
| 87 | title = _(u'Father\'s Phone'), |
---|
| 88 | required = False, |
---|
| 89 | readonly = False, |
---|
| 90 | ) |
---|
| 91 | |
---|
| 92 | mother_name = schema.TextLine( |
---|
| 93 | title = _(u'Mother\'s Name'), |
---|
| 94 | required = False, |
---|
| 95 | readonly = False, |
---|
| 96 | ) |
---|
| 97 | |
---|
| 98 | mother_address = schema.Text( |
---|
| 99 | title = _(u'Mother\'s Permanent Address'), |
---|
| 100 | required = False, |
---|
| 101 | readonly = False, |
---|
| 102 | ) |
---|
| 103 | |
---|
| 104 | mother_work = schema.TextLine( |
---|
| 105 | title = _(u'Mother\'s Place of Work'), |
---|
| 106 | required = False, |
---|
| 107 | readonly = False, |
---|
| 108 | ) |
---|
| 109 | |
---|
| 110 | mother_phone = PhoneNumber( |
---|
| 111 | title = _(u'Mother\'s Phone'), |
---|
| 112 | required = False, |
---|
| 113 | readonly = False, |
---|
| 114 | ) |
---|
| 115 | |
---|
| 116 | phone_personal = PhoneNumber( |
---|
| 117 | title = _(u'Student\'s Personal Phone'), |
---|
| 118 | description = u'', |
---|
[13573] | 119 | required = False, |
---|
[13351] | 120 | readonly = False, |
---|
| 121 | ) |
---|
| 122 | |
---|
| 123 | class ICustomStudentPersonalEdit(ICustomStudentPersonal): |
---|
| 124 | """Interface for editing personal data by students. |
---|
| 125 | |
---|
| 126 | Here we can repeat the fields from IStudentPersonal and set the |
---|
| 127 | `required` if necessary. |
---|
| 128 | """ |
---|
| 129 | |
---|
| 130 | perm_address = schema.Text( |
---|
| 131 | title = _(u'Permanent Address'), |
---|
| 132 | required = True, |
---|
| 133 | ) |
---|
| 134 | |
---|
| 135 | next_kin_name = schema.TextLine( |
---|
| 136 | title = _(u'Next of Kin Name'), |
---|
| 137 | required = True, |
---|
| 138 | readonly = False, |
---|
| 139 | ) |
---|
| 140 | |
---|
| 141 | next_kin_relation = schema.TextLine( |
---|
| 142 | title = _(u'Next of Kin Relationship'), |
---|
| 143 | required = True, |
---|
| 144 | readonly = False, |
---|
| 145 | ) |
---|
| 146 | |
---|
| 147 | next_kin_address = schema.Text( |
---|
| 148 | title = _(u'Next of Kin Address'), |
---|
| 149 | required = True, |
---|
| 150 | readonly = False, |
---|
| 151 | ) |
---|
| 152 | |
---|
| 153 | next_kin_phone = PhoneNumber( |
---|
| 154 | title = _(u'Next of Kin Phone'), |
---|
| 155 | description = u'', |
---|
| 156 | required = True, |
---|
| 157 | readonly = False, |
---|
| 158 | ) |
---|
| 159 | |
---|
| 160 | father_name = schema.TextLine( |
---|
| 161 | title = _(u'Father\'s Name'), |
---|
| 162 | required = True, |
---|
| 163 | readonly = False, |
---|
| 164 | ) |
---|
| 165 | |
---|
| 166 | father_address = schema.Text( |
---|
| 167 | title = _(u'Father\'s Permanent Address'), |
---|
| 168 | required = True, |
---|
| 169 | readonly = False, |
---|
| 170 | ) |
---|
| 171 | |
---|
| 172 | father_work = schema.TextLine( |
---|
| 173 | title = _(u'Father\'s Place of Work'), |
---|
| 174 | required = True, |
---|
| 175 | readonly = False, |
---|
| 176 | ) |
---|
| 177 | |
---|
| 178 | father_phone = PhoneNumber( |
---|
| 179 | title = _(u'Father\'s Phone'), |
---|
| 180 | required = True, |
---|
| 181 | readonly = False, |
---|
| 182 | ) |
---|
| 183 | |
---|
| 184 | mother_name = schema.TextLine( |
---|
| 185 | title = _(u'Mother\'s Name'), |
---|
| 186 | required = True, |
---|
| 187 | readonly = False, |
---|
| 188 | ) |
---|
| 189 | |
---|
| 190 | mother_address = schema.Text( |
---|
| 191 | title = _(u'Mother\'s Permanent Address'), |
---|
| 192 | required = True, |
---|
| 193 | readonly = False, |
---|
| 194 | ) |
---|
| 195 | |
---|
| 196 | mother_work = schema.TextLine( |
---|
| 197 | title = _(u'Mother\'s Place of Work'), |
---|
| 198 | required = True, |
---|
| 199 | readonly = False, |
---|
| 200 | ) |
---|
| 201 | |
---|
| 202 | mother_phone = PhoneNumber( |
---|
| 203 | title = _(u'Mother\'s Phone'), |
---|
| 204 | required = True, |
---|
| 205 | readonly = False, |
---|
| 206 | ) |
---|
| 207 | |
---|
| 208 | phone_personal = PhoneNumber( |
---|
| 209 | title = _(u'Student\'s Personal Phone'), |
---|
| 210 | description = u'', |
---|
| 211 | required = True, |
---|
| 212 | readonly = False, |
---|
| 213 | ) |
---|
| 214 | |
---|
[8867] | 215 | class ICustomUGStudentClearance(INigeriaUGStudentClearance): |
---|
[7995] | 216 | """Representation of ug student clearance data. |
---|
[7505] | 217 | |
---|
| 218 | """ |
---|
| 219 | |
---|
[13368] | 220 | #date_of_birth = FormattedDate( |
---|
| 221 | # title = _(u'Date of Birth'), |
---|
| 222 | # required = True, |
---|
| 223 | # show_year = True, |
---|
| 224 | # ) |
---|
[13362] | 225 | |
---|
| 226 | lga = schema.Choice( |
---|
| 227 | source = LGASource(), |
---|
| 228 | title = _(u'State / LGA'), |
---|
| 229 | required = True, |
---|
| 230 | ) |
---|
| 231 | |
---|
[14107] | 232 | fst_sit_sc_pin = schema.TextLine( |
---|
[14084] | 233 | title = _(u'Scratch Card Pin'), |
---|
| 234 | required = False, |
---|
| 235 | readonly = False, |
---|
| 236 | ) |
---|
| 237 | |
---|
[14107] | 238 | fst_sit_sc_serial_number = schema.TextLine( |
---|
[14084] | 239 | title = _(u'Scratch Card Serial Number'), |
---|
| 240 | required = False, |
---|
| 241 | readonly = False, |
---|
| 242 | ) |
---|
| 243 | |
---|
[14107] | 244 | scd_sit_sc_pin = schema.TextLine( |
---|
| 245 | title = _(u'Scratch Card Pin'), |
---|
| 246 | required = False, |
---|
| 247 | readonly = False, |
---|
| 248 | ) |
---|
| 249 | |
---|
| 250 | scd_sit_sc_serial_number = schema.TextLine( |
---|
| 251 | title = _(u'Scratch Card Serial Number'), |
---|
| 252 | required = False, |
---|
| 253 | readonly = False, |
---|
| 254 | ) |
---|
| 255 | |
---|
[13362] | 256 | ICustomUGStudentClearance['lga'].order = INigeriaUGStudentClearance[ |
---|
| 257 | 'lga'].order |
---|
[13368] | 258 | #ICustomUGStudentClearance['date_of_birth'].order = INigeriaUGStudentClearance[ |
---|
| 259 | # 'date_of_birth'].order |
---|
[14107] | 260 | ICustomUGStudentClearance['fst_sit_sc_pin'].order = INigeriaUGStudentClearance['fst_sit_date'].order |
---|
| 261 | ICustomUGStudentClearance['scd_sit_sc_pin'].order = INigeriaUGStudentClearance['scd_sit_date'].order |
---|
| 262 | ICustomUGStudentClearance['fst_sit_sc_serial_number'].order = INigeriaUGStudentClearance['fst_sit_date'].order |
---|
| 263 | ICustomUGStudentClearance['scd_sit_sc_serial_number'].order = INigeriaUGStudentClearance['scd_sit_date'].order |
---|
| 264 | ICustomUGStudentClearance['scd_sit_date'].order = ICustomUGStudentClearance['scd_sit_type'].order |
---|
| 265 | ICustomUGStudentClearance['fst_sit_date'].order = ICustomUGStudentClearance['fst_sit_type'].order |
---|
[13362] | 266 | |
---|
| 267 | |
---|
[8867] | 268 | class ICustomPGStudentClearance(INigeriaPGStudentClearance): |
---|
[7995] | 269 | """Representation of pg student clearance data. |
---|
[7505] | 270 | |
---|
| 271 | """ |
---|
| 272 | |
---|
[8101] | 273 | |
---|
[8204] | 274 | class ICustomStudent(ICustomStudentBase,ICustomUGStudentClearance, |
---|
| 275 | ICustomPGStudentClearance,ICustomStudentPersonal): |
---|
[7995] | 276 | """Representation of a student. |
---|
[7505] | 277 | |
---|
| 278 | """ |
---|
[8247] | 279 | |
---|
[8867] | 280 | class ICustomStudentStudyCourse(INigeriaStudentStudyCourse): |
---|
[8326] | 281 | """A container for student study levels. |
---|
| 282 | |
---|
| 283 | """ |
---|
| 284 | |
---|
[8867] | 285 | class ICustomStudentStudyLevel(INigeriaStudentStudyLevel): |
---|
[8326] | 286 | """A container for course tickets. |
---|
| 287 | |
---|
| 288 | """ |
---|
| 289 | |
---|
[9914] | 290 | total_credits_s1 = schema.Int( |
---|
| 291 | title = _(u'1st Semester Units'), |
---|
| 292 | required = False, |
---|
| 293 | readonly = True, |
---|
| 294 | ) |
---|
| 295 | |
---|
| 296 | total_credits_s2 = schema.Int( |
---|
| 297 | title = _(u'2nd Semester Units'), |
---|
| 298 | required = False, |
---|
| 299 | readonly = True, |
---|
| 300 | ) |
---|
| 301 | |
---|
[10102] | 302 | total_credits = schema.Int( |
---|
| 303 | title = _(u'Total Units'), |
---|
| 304 | required = False, |
---|
| 305 | readonly = True, |
---|
| 306 | ) |
---|
| 307 | |
---|
[8247] | 308 | class ICustomStudentOnlinePayment(ICustomOnlinePayment): |
---|
| 309 | """A student payment via payment gateways. |
---|
| 310 | |
---|
[8270] | 311 | This Interface does not inherit from IStudentOnlinePayment. |
---|
| 312 | Thus all fields from IStudentOnlinePayment have to be repeated here. |
---|
| 313 | """ |
---|
| 314 | |
---|
[9154] | 315 | p_current = schema.Bool( |
---|
| 316 | title = _(u'Current Session Payment'), |
---|
| 317 | default = True, |
---|
| 318 | required = False, |
---|
| 319 | ) |
---|
| 320 | |
---|
[13735] | 321 | p_level = schema.Choice( |
---|
[8270] | 322 | title = _(u'Payment Level'), |
---|
[13735] | 323 | source = StudyLevelSource(), |
---|
[8270] | 324 | required = False, |
---|
| 325 | ) |
---|
[8430] | 326 | |
---|
[8270] | 327 | ICustomStudentOnlinePayment['p_level'].order = ICustomStudentOnlinePayment[ |
---|
[8326] | 328 | 'p_session'].order |
---|
| 329 | |
---|
[8867] | 330 | class ICustomCourseTicket(INigeriaCourseTicket): |
---|
[8326] | 331 | """A course ticket. |
---|
| 332 | |
---|
[8583] | 333 | """ |
---|
| 334 | |
---|
[14113] | 335 | score = schema.Int( |
---|
| 336 | title = _(u'Score'), |
---|
| 337 | required = False, |
---|
| 338 | readonly = False, |
---|
| 339 | max = 70, |
---|
| 340 | ) |
---|
| 341 | |
---|
[13770] | 342 | ca = schema.Int( |
---|
[13834] | 343 | title = _(u'CA'), |
---|
[13770] | 344 | default = None, |
---|
| 345 | required = False, |
---|
| 346 | missing_value = None, |
---|
[14113] | 347 | max = 30, |
---|
[13770] | 348 | ) |
---|
| 349 | |
---|
[13865] | 350 | class ICustomCourseTicketImport(ICustomCourseTicket): |
---|
| 351 | """An interface for importing course results and nothing more. |
---|
| 352 | """ |
---|
| 353 | score = schema.Int( |
---|
| 354 | title = _(u'Score'), |
---|
| 355 | required = False, |
---|
| 356 | readonly = False, |
---|
[14113] | 357 | max = 70, |
---|
[13865] | 358 | ) |
---|
| 359 | |
---|
| 360 | ca = schema.Int( |
---|
| 361 | title = _(u'CA'), |
---|
| 362 | required = False, |
---|
| 363 | readonly = False, |
---|
[14113] | 364 | max = 30, |
---|
[13865] | 365 | ) |
---|
| 366 | |
---|
| 367 | level_session = schema.Choice( |
---|
| 368 | title = _(u'Level Session'), |
---|
| 369 | source = academic_sessions_vocab, |
---|
| 370 | required = False, |
---|
| 371 | readonly = False, |
---|
| 372 | ) |
---|
| 373 | |
---|
[13834] | 374 | ICustomCourseTicket['ca'].order = ICustomCourseTicket['score'].order |
---|
[13770] | 375 | |
---|
[8867] | 376 | class ICustomStudentUpdateByRegNo(INigeriaStudentUpdateByRegNo): |
---|
[8583] | 377 | """Representation of a student. Skip regular reg_number validation. |
---|
| 378 | |
---|
| 379 | """ |
---|
| 380 | |
---|
[8867] | 381 | class ICustomStudentUpdateByMatricNo(INigeriaStudentUpdateByMatricNo): |
---|
[8583] | 382 | """Representation of a student. Skip regular matric_number validation. |
---|
| 383 | |
---|
[8867] | 384 | """ |
---|