[7505] | 1 | ## $Id: interfaces.py 13865 2016-05-26 13:44:09Z 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 | |
---|
| 232 | ICustomUGStudentClearance['lga'].order = INigeriaUGStudentClearance[ |
---|
| 233 | 'lga'].order |
---|
[13368] | 234 | #ICustomUGStudentClearance['date_of_birth'].order = INigeriaUGStudentClearance[ |
---|
| 235 | # 'date_of_birth'].order |
---|
[13362] | 236 | |
---|
| 237 | |
---|
[8867] | 238 | class ICustomPGStudentClearance(INigeriaPGStudentClearance): |
---|
[7995] | 239 | """Representation of pg student clearance data. |
---|
[7505] | 240 | |
---|
| 241 | """ |
---|
| 242 | |
---|
[8101] | 243 | |
---|
[8204] | 244 | class ICustomStudent(ICustomStudentBase,ICustomUGStudentClearance, |
---|
| 245 | ICustomPGStudentClearance,ICustomStudentPersonal): |
---|
[7995] | 246 | """Representation of a student. |
---|
[7505] | 247 | |
---|
| 248 | """ |
---|
[8247] | 249 | |
---|
[8867] | 250 | class ICustomStudentStudyCourse(INigeriaStudentStudyCourse): |
---|
[8326] | 251 | """A container for student study levels. |
---|
| 252 | |
---|
| 253 | """ |
---|
| 254 | |
---|
[8867] | 255 | class ICustomStudentStudyLevel(INigeriaStudentStudyLevel): |
---|
[8326] | 256 | """A container for course tickets. |
---|
| 257 | |
---|
| 258 | """ |
---|
| 259 | |
---|
[9914] | 260 | total_credits_s1 = schema.Int( |
---|
| 261 | title = _(u'1st Semester Units'), |
---|
| 262 | required = False, |
---|
| 263 | readonly = True, |
---|
| 264 | ) |
---|
| 265 | |
---|
| 266 | total_credits_s2 = schema.Int( |
---|
| 267 | title = _(u'2nd Semester Units'), |
---|
| 268 | required = False, |
---|
| 269 | readonly = True, |
---|
| 270 | ) |
---|
| 271 | |
---|
[10102] | 272 | total_credits = schema.Int( |
---|
| 273 | title = _(u'Total Units'), |
---|
| 274 | required = False, |
---|
| 275 | readonly = True, |
---|
| 276 | ) |
---|
| 277 | |
---|
[8247] | 278 | class ICustomStudentOnlinePayment(ICustomOnlinePayment): |
---|
| 279 | """A student payment via payment gateways. |
---|
| 280 | |
---|
[8270] | 281 | This Interface does not inherit from IStudentOnlinePayment. |
---|
| 282 | Thus all fields from IStudentOnlinePayment have to be repeated here. |
---|
| 283 | """ |
---|
| 284 | |
---|
[9154] | 285 | p_current = schema.Bool( |
---|
| 286 | title = _(u'Current Session Payment'), |
---|
| 287 | default = True, |
---|
| 288 | required = False, |
---|
| 289 | ) |
---|
| 290 | |
---|
[13735] | 291 | p_level = schema.Choice( |
---|
[8270] | 292 | title = _(u'Payment Level'), |
---|
[13735] | 293 | source = StudyLevelSource(), |
---|
[8270] | 294 | required = False, |
---|
| 295 | ) |
---|
[8430] | 296 | |
---|
[8270] | 297 | ICustomStudentOnlinePayment['p_level'].order = ICustomStudentOnlinePayment[ |
---|
[8326] | 298 | 'p_session'].order |
---|
| 299 | |
---|
[8867] | 300 | class ICustomCourseTicket(INigeriaCourseTicket): |
---|
[8326] | 301 | """A course ticket. |
---|
| 302 | |
---|
[8583] | 303 | """ |
---|
| 304 | |
---|
[13770] | 305 | ca = schema.Int( |
---|
[13834] | 306 | title = _(u'CA'), |
---|
[13770] | 307 | default = None, |
---|
| 308 | required = False, |
---|
| 309 | missing_value = None, |
---|
| 310 | ) |
---|
| 311 | |
---|
[13865] | 312 | class ICustomCourseTicketImport(ICustomCourseTicket): |
---|
| 313 | """An interface for importing course results and nothing more. |
---|
| 314 | """ |
---|
| 315 | score = schema.Int( |
---|
| 316 | title = _(u'Score'), |
---|
| 317 | required = False, |
---|
| 318 | readonly = False, |
---|
| 319 | ) |
---|
| 320 | |
---|
| 321 | ca = schema.Int( |
---|
| 322 | title = _(u'CA'), |
---|
| 323 | required = False, |
---|
| 324 | readonly = False, |
---|
| 325 | ) |
---|
| 326 | |
---|
| 327 | level_session = schema.Choice( |
---|
| 328 | title = _(u'Level Session'), |
---|
| 329 | source = academic_sessions_vocab, |
---|
| 330 | required = False, |
---|
| 331 | readonly = False, |
---|
| 332 | ) |
---|
| 333 | |
---|
[13834] | 334 | ICustomCourseTicket['ca'].order = ICustomCourseTicket['score'].order |
---|
[13770] | 335 | |
---|
[8867] | 336 | class ICustomStudentUpdateByRegNo(INigeriaStudentUpdateByRegNo): |
---|
[8583] | 337 | """Representation of a student. Skip regular reg_number validation. |
---|
| 338 | |
---|
| 339 | """ |
---|
| 340 | |
---|
[8867] | 341 | class ICustomStudentUpdateByMatricNo(INigeriaStudentUpdateByMatricNo): |
---|
[8583] | 342 | """Representation of a student. Skip regular matric_number validation. |
---|
| 343 | |
---|
[8867] | 344 | """ |
---|