| 1 | ## $Id: interfaces.py 14591 2017-02-25 17:59: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 | |
|---|
| 19 | from zope import schema |
|---|
| 20 | from waeup.kofa.schema import FormattedDate, PhoneNumber |
|---|
| 21 | from waeup.kofa.students.interfaces import IUGStudentClearance |
|---|
| 22 | from waeup.kofa.students.vocabularies import nats_vocab, StudyLevelSource |
|---|
| 23 | from waeup.kofa.schoolgrades import ResultEntryField |
|---|
| 24 | from kofacustom.nigeria.interfaces import ( |
|---|
| 25 | high_qual, high_grade, exam_types, LGASource) |
|---|
| 26 | from kofacustom.nigeria.students.interfaces import ( |
|---|
| 27 | INigeriaStudentBase, INigeriaUGStudentClearance, INigeriaPGStudentClearance, |
|---|
| 28 | INigeriaStudentPersonal, INigeriaStudentStudyLevel, |
|---|
| 29 | INigeriaStudentStudyCourse, INigeriaCourseTicket, |
|---|
| 30 | INigeriaStudentUpdateByRegNo, INigeriaStudentUpdateByMatricNo, |
|---|
| 31 | ) |
|---|
| 32 | from waeup.fceokene.payments.interfaces import ICustomOnlinePayment |
|---|
| 33 | from waeup.fceokene.interfaces import MessageFactory as _ |
|---|
| 34 | |
|---|
| 35 | class ICustomStudentBase(INigeriaStudentBase): |
|---|
| 36 | """Representation of student base data. |
|---|
| 37 | |
|---|
| 38 | """ |
|---|
| 39 | |
|---|
| 40 | class ICustomStudentPersonal(INigeriaStudentPersonal): |
|---|
| 41 | """Student personal data. |
|---|
| 42 | |
|---|
| 43 | """ |
|---|
| 44 | |
|---|
| 45 | class ICustomUGStudentClearance(IUGStudentClearance): |
|---|
| 46 | """Representation of ug student clearance data. |
|---|
| 47 | |
|---|
| 48 | Completely customized for FCE Okene. |
|---|
| 49 | |
|---|
| 50 | """ |
|---|
| 51 | |
|---|
| 52 | officer_comment = schema.Text( |
|---|
| 53 | title = _(u"Officer's Comment"), |
|---|
| 54 | required = False, |
|---|
| 55 | ) |
|---|
| 56 | |
|---|
| 57 | clearance_locked = schema.Bool( |
|---|
| 58 | title = _(u'Clearance form locked'), |
|---|
| 59 | default = False, |
|---|
| 60 | required = False, |
|---|
| 61 | ) |
|---|
| 62 | |
|---|
| 63 | clr_code = schema.TextLine( |
|---|
| 64 | title = _(u'CLR Activation Code'), |
|---|
| 65 | required = False, |
|---|
| 66 | readonly = False, |
|---|
| 67 | ) |
|---|
| 68 | |
|---|
| 69 | date_of_birth = FormattedDate( |
|---|
| 70 | title = _(u'Date of Birth'), |
|---|
| 71 | required = False, |
|---|
| 72 | show_year = True, |
|---|
| 73 | ) |
|---|
| 74 | |
|---|
| 75 | nationality = schema.Choice( |
|---|
| 76 | source = nats_vocab, |
|---|
| 77 | title = _(u'Nationality'), |
|---|
| 78 | required = True, |
|---|
| 79 | ) |
|---|
| 80 | |
|---|
| 81 | lga = schema.Choice( |
|---|
| 82 | source = LGASource(), |
|---|
| 83 | title = _(u'State/LGA (Nigerians only)'), |
|---|
| 84 | required = False, |
|---|
| 85 | ) |
|---|
| 86 | |
|---|
| 87 | def_adm = schema.Bool( |
|---|
| 88 | title = _(u'Deferent of Admission'), |
|---|
| 89 | required = False, |
|---|
| 90 | readonly = False, |
|---|
| 91 | ) |
|---|
| 92 | |
|---|
| 93 | fst_sit_fname = schema.TextLine( |
|---|
| 94 | title = _(u'Full Name'), |
|---|
| 95 | required = False, |
|---|
| 96 | readonly = False, |
|---|
| 97 | ) |
|---|
| 98 | fst_sit_no = schema.TextLine( |
|---|
| 99 | title = _(u'Exam Number'), |
|---|
| 100 | required = False, |
|---|
| 101 | readonly = False, |
|---|
| 102 | ) |
|---|
| 103 | |
|---|
| 104 | fst_sit_date = FormattedDate( |
|---|
| 105 | title = _(u'Exam Date'), |
|---|
| 106 | required = False, |
|---|
| 107 | readonly = False, |
|---|
| 108 | show_year = True, |
|---|
| 109 | ) |
|---|
| 110 | |
|---|
| 111 | fst_sit_type = schema.Choice( |
|---|
| 112 | title = _(u'Exam Type'), |
|---|
| 113 | required = False, |
|---|
| 114 | readonly = False, |
|---|
| 115 | vocabulary = exam_types, |
|---|
| 116 | ) |
|---|
| 117 | |
|---|
| 118 | fst_sit_results = schema.List( |
|---|
| 119 | title = _(u'Exam Results'), |
|---|
| 120 | value_type = ResultEntryField(), |
|---|
| 121 | required = False, |
|---|
| 122 | readonly = False, |
|---|
| 123 | defaultFactory=list, |
|---|
| 124 | ) |
|---|
| 125 | |
|---|
| 126 | scd_sit_fname = schema.TextLine( |
|---|
| 127 | title = _(u'Full Name'), |
|---|
| 128 | required = False, |
|---|
| 129 | readonly = False, |
|---|
| 130 | ) |
|---|
| 131 | scd_sit_no = schema.TextLine( |
|---|
| 132 | title = _(u'Exam Number'), |
|---|
| 133 | required = False, |
|---|
| 134 | readonly = False, |
|---|
| 135 | ) |
|---|
| 136 | |
|---|
| 137 | scd_sit_date = FormattedDate( |
|---|
| 138 | title = _(u'Exam Date'), |
|---|
| 139 | required = False, |
|---|
| 140 | readonly = False, |
|---|
| 141 | show_year = True, |
|---|
| 142 | ) |
|---|
| 143 | |
|---|
| 144 | scd_sit_type = schema.Choice( |
|---|
| 145 | title = _(u'Exam Type'), |
|---|
| 146 | required = False, |
|---|
| 147 | readonly = False, |
|---|
| 148 | vocabulary = exam_types, |
|---|
| 149 | ) |
|---|
| 150 | |
|---|
| 151 | scd_sit_results = schema.List( |
|---|
| 152 | title = _(u'Exam Results'), |
|---|
| 153 | value_type = ResultEntryField(), |
|---|
| 154 | required = False, |
|---|
| 155 | readonly = False, |
|---|
| 156 | defaultFactory=list, |
|---|
| 157 | ) |
|---|
| 158 | |
|---|
| 159 | #alr_fname = schema.TextLine( |
|---|
| 160 | # title = _(u'Full Name'), |
|---|
| 161 | # required = False, |
|---|
| 162 | # readonly = False, |
|---|
| 163 | # ) |
|---|
| 164 | |
|---|
| 165 | #alr_no = schema.TextLine( |
|---|
| 166 | # title = _(u'Exam Number'), |
|---|
| 167 | # required = False, |
|---|
| 168 | # readonly = False, |
|---|
| 169 | # ) |
|---|
| 170 | |
|---|
| 171 | #alr_date = FormattedDate( |
|---|
| 172 | # title = _(u'Exam Date'), |
|---|
| 173 | # required = False, |
|---|
| 174 | # readonly = False, |
|---|
| 175 | # show_year = True, |
|---|
| 176 | # ) |
|---|
| 177 | |
|---|
| 178 | #alr_results = schema.List( |
|---|
| 179 | # title = _(u'Exam Results'), |
|---|
| 180 | # value_type = ResultEntryField(), |
|---|
| 181 | # required = False, |
|---|
| 182 | # readonly = False, |
|---|
| 183 | # defaultFactory=list, |
|---|
| 184 | # ) |
|---|
| 185 | |
|---|
| 186 | hq_type = schema.Choice( |
|---|
| 187 | title = _(u'Qualification Obtained'), |
|---|
| 188 | required = False, |
|---|
| 189 | readonly = False, |
|---|
| 190 | vocabulary = high_qual, |
|---|
| 191 | ) |
|---|
| 192 | |
|---|
| 193 | hq_fname = schema.TextLine( |
|---|
| 194 | title = _(u'Full Name'), |
|---|
| 195 | required = False, |
|---|
| 196 | readonly = False, |
|---|
| 197 | ) |
|---|
| 198 | |
|---|
| 199 | hq_matric_no = schema.TextLine( |
|---|
| 200 | title = _(u'Former Matric Number'), |
|---|
| 201 | required = False, |
|---|
| 202 | readonly = False, |
|---|
| 203 | ) |
|---|
| 204 | |
|---|
| 205 | #hq_degree = schema.Choice( |
|---|
| 206 | # title = _(u'Class of Degree'), |
|---|
| 207 | # required = False, |
|---|
| 208 | # readonly = False, |
|---|
| 209 | # vocabulary = high_grade, |
|---|
| 210 | # ) |
|---|
| 211 | |
|---|
| 212 | hq_school = schema.TextLine( |
|---|
| 213 | title = _(u'Institution Attended'), |
|---|
| 214 | required = False, |
|---|
| 215 | readonly = False, |
|---|
| 216 | ) |
|---|
| 217 | |
|---|
| 218 | hq_session = schema.TextLine( |
|---|
| 219 | title = _(u'Years Attended'), |
|---|
| 220 | required = False, |
|---|
| 221 | readonly = False, |
|---|
| 222 | ) |
|---|
| 223 | |
|---|
| 224 | hq_disc = schema.TextLine( |
|---|
| 225 | title = _(u'Course Combination'), |
|---|
| 226 | required = False, |
|---|
| 227 | readonly = False, |
|---|
| 228 | ) |
|---|
| 229 | |
|---|
| 230 | class ICustomPGStudentClearance(INigeriaPGStudentClearance): |
|---|
| 231 | """Representation of pg student clearance data. |
|---|
| 232 | |
|---|
| 233 | """ |
|---|
| 234 | |
|---|
| 235 | |
|---|
| 236 | class ICustomStudent(ICustomStudentBase,ICustomUGStudentClearance, |
|---|
| 237 | ICustomPGStudentClearance,ICustomStudentPersonal): |
|---|
| 238 | """Representation of a student. |
|---|
| 239 | |
|---|
| 240 | """ |
|---|
| 241 | |
|---|
| 242 | class ICustomStudentStudyCourse(INigeriaStudentStudyCourse): |
|---|
| 243 | """A container for student study levels. |
|---|
| 244 | |
|---|
| 245 | """ |
|---|
| 246 | |
|---|
| 247 | class ICustomStudentStudyLevel(INigeriaStudentStudyLevel): |
|---|
| 248 | """A container for course tickets. |
|---|
| 249 | |
|---|
| 250 | """ |
|---|
| 251 | |
|---|
| 252 | total_credits_s1 = schema.Int( |
|---|
| 253 | title = _(u'1st Semester Credits'), |
|---|
| 254 | required = False, |
|---|
| 255 | ) |
|---|
| 256 | |
|---|
| 257 | total_credits_s2 = schema.Int( |
|---|
| 258 | title = _(u'2nd Semester Credits'), |
|---|
| 259 | required = False, |
|---|
| 260 | ) |
|---|
| 261 | |
|---|
| 262 | total_credits = schema.Int( |
|---|
| 263 | title = _(u'Total Credits'), |
|---|
| 264 | required = False, |
|---|
| 265 | ) |
|---|
| 266 | |
|---|
| 267 | class ICustomStudentOnlinePayment(ICustomOnlinePayment): |
|---|
| 268 | """A student payment via payment gateways. |
|---|
| 269 | |
|---|
| 270 | This Interface does not inherit from IStudentOnlinePayment. |
|---|
| 271 | Thus all fields from IStudentOnlinePayment have to be repeated here. |
|---|
| 272 | """ |
|---|
| 273 | |
|---|
| 274 | p_current = schema.Bool( |
|---|
| 275 | title = _(u'Current Session Payment'), |
|---|
| 276 | default = True, |
|---|
| 277 | required = False, |
|---|
| 278 | ) |
|---|
| 279 | |
|---|
| 280 | p_level = schema.Choice( |
|---|
| 281 | title = _(u'Payment Level'), |
|---|
| 282 | source = StudyLevelSource(), |
|---|
| 283 | required = False, |
|---|
| 284 | ) |
|---|
| 285 | |
|---|
| 286 | ICustomStudentOnlinePayment['p_level'].order = ICustomStudentOnlinePayment[ |
|---|
| 287 | 'p_session'].order |
|---|
| 288 | |
|---|
| 289 | class ICustomCourseTicket(INigeriaCourseTicket): |
|---|
| 290 | """A course ticket. |
|---|
| 291 | |
|---|
| 292 | """ |
|---|
| 293 | |
|---|
| 294 | class ICustomStudentUpdateByRegNo(INigeriaStudentUpdateByRegNo): |
|---|
| 295 | """Representation of a student. Skip regular reg_number validation. |
|---|
| 296 | |
|---|
| 297 | """ |
|---|
| 298 | |
|---|
| 299 | class ICustomStudentUpdateByMatricNo(INigeriaStudentUpdateByMatricNo): |
|---|
| 300 | """Representation of a student. Skip regular matric_number validation. |
|---|
| 301 | |
|---|
| 302 | """ |
|---|