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