[7853] | 1 | ## $Id: interfaces.py 8454 2012-05-15 21:24:25Z henrik $ |
---|
| 2 | ## |
---|
| 3 | ## Copyright (C) 2011 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 | """Customized interfaces of the university application package. |
---|
| 19 | """ |
---|
| 20 | |
---|
[8012] | 21 | from zope import schema |
---|
[8051] | 22 | from waeup.kofa.applicants.interfaces import ( |
---|
[8053] | 23 | IApplicantBaseData, |
---|
[8051] | 24 | AppCatCertificateSource, CertificateSource) |
---|
| 25 | from waeup.kofa.schoolgrades import ResultEntryField |
---|
[8247] | 26 | from waeup.kofa.interfaces import SimpleKofaVocabulary, academic_sessions_vocab |
---|
[8184] | 27 | from waeup.kofa.schema import FormattedDate |
---|
[8071] | 28 | from waeup.kofa.students.vocabularies import nats_vocab |
---|
[8101] | 29 | from waeup.uniben.interfaces import ( |
---|
| 30 | lgas_vocab, high_qual, high_grade, exam_types) |
---|
[8020] | 31 | from waeup.uniben.interfaces import MessageFactory as _ |
---|
[8247] | 32 | from waeup.uniben.payments.interfaces import ICustomOnlinePayment |
---|
[7853] | 33 | |
---|
[8053] | 34 | class IUGApplicant(IApplicantBaseData): |
---|
[8012] | 35 | """An undergraduate applicant. |
---|
| 36 | |
---|
| 37 | """ |
---|
| 38 | |
---|
[8071] | 39 | nationality = schema.Choice( |
---|
| 40 | source = nats_vocab, |
---|
| 41 | title = _(u'Nationality'), |
---|
| 42 | required = False, |
---|
| 43 | ) |
---|
| 44 | lga = schema.Choice( |
---|
| 45 | source = lgas_vocab, |
---|
| 46 | title = _(u'State/LGA (Nigerians only)'), |
---|
| 47 | required = False, |
---|
| 48 | ) |
---|
| 49 | |
---|
| 50 | # This ordering doesn't work properly. |
---|
| 51 | IUGApplicant[ |
---|
| 52 | 'nationality'].order = IApplicantBaseData['sex'].order |
---|
| 53 | IUGApplicant[ |
---|
| 54 | 'lga'].order = IUGApplicant['nationality'].order |
---|
| 55 | |
---|
| 56 | |
---|
[8053] | 57 | class IPGApplicant(IApplicantBaseData): |
---|
[7853] | 58 | """A postgraduate applicant. |
---|
| 59 | |
---|
[7866] | 60 | """ |
---|
| 61 | |
---|
[8071] | 62 | nationality = schema.Choice( |
---|
| 63 | source = nats_vocab, |
---|
| 64 | title = _(u'Nationality'), |
---|
| 65 | required = False, |
---|
| 66 | ) |
---|
| 67 | lga = schema.Choice( |
---|
| 68 | source = lgas_vocab, |
---|
| 69 | title = _(u'State/LGA (Nigerians only)'), |
---|
| 70 | required = False, |
---|
| 71 | ) |
---|
[8051] | 72 | perm_address = schema.Text( |
---|
| 73 | title = _(u'Permanent Address'), |
---|
| 74 | required = False, |
---|
| 75 | ) |
---|
| 76 | course1 = schema.Choice( |
---|
| 77 | title = _(u'1st Choice Course of Study'), |
---|
| 78 | source = AppCatCertificateSource(), |
---|
| 79 | required = True, |
---|
| 80 | ) |
---|
| 81 | course2 = schema.Choice( |
---|
| 82 | title = _(u'2nd Choice Course of Study'), |
---|
| 83 | source = AppCatCertificateSource(), |
---|
| 84 | required = False, |
---|
| 85 | ) |
---|
| 86 | hq_type = schema.Choice( |
---|
| 87 | title = _(u'Qualification Obtained'), |
---|
| 88 | required = False, |
---|
| 89 | readonly = False, |
---|
| 90 | vocabulary = high_qual, |
---|
| 91 | ) |
---|
| 92 | hq_matric_no = schema.TextLine( |
---|
| 93 | title = _(u'Former Matric Number'), |
---|
| 94 | required = False, |
---|
| 95 | readonly = False, |
---|
| 96 | ) |
---|
| 97 | hq_degree = schema.Choice( |
---|
| 98 | title = _(u'Class of Degree'), |
---|
| 99 | required = False, |
---|
| 100 | readonly = False, |
---|
| 101 | vocabulary = high_grade, |
---|
| 102 | ) |
---|
| 103 | hq_school = schema.TextLine( |
---|
| 104 | title = _(u'Institution Attended'), |
---|
| 105 | required = False, |
---|
| 106 | readonly = False, |
---|
| 107 | ) |
---|
| 108 | hq_session = schema.TextLine( |
---|
| 109 | title = _(u'Years Attended'), |
---|
| 110 | required = False, |
---|
| 111 | readonly = False, |
---|
| 112 | ) |
---|
| 113 | hq_disc = schema.TextLine( |
---|
| 114 | title = _(u'Discipline'), |
---|
| 115 | required = False, |
---|
| 116 | readonly = False, |
---|
| 117 | ) |
---|
| 118 | pp_school = schema.Choice( |
---|
| 119 | title = _(u'Qualification Obtained'), |
---|
| 120 | required = False, |
---|
| 121 | readonly = False, |
---|
| 122 | vocabulary = exam_types, |
---|
| 123 | ) |
---|
[8101] | 124 | #presently = schema.Bool( |
---|
| 125 | # title = _(u'Attending'), |
---|
| 126 | # required = False, |
---|
| 127 | # readonly = False, |
---|
| 128 | # ) |
---|
| 129 | presently_inst = schema.TextLine( |
---|
| 130 | title = _(u'If yes, name of institution'), |
---|
| 131 | required = False, |
---|
| 132 | readonly = False, |
---|
| 133 | ) |
---|
| 134 | nysc_year = schema.Int( |
---|
| 135 | title = _(u'Nysc Year'), |
---|
| 136 | required = False, |
---|
| 137 | readonly = False, |
---|
| 138 | ) |
---|
| 139 | nysc_lga = schema.Choice( |
---|
| 140 | source = lgas_vocab, |
---|
| 141 | title = _(u'Nysc Location'), |
---|
| 142 | required = False, |
---|
| 143 | ) |
---|
[8012] | 144 | employer = schema.TextLine( |
---|
| 145 | title = _(u'Employer'), |
---|
| 146 | required = False, |
---|
| 147 | readonly = False, |
---|
| 148 | ) |
---|
[8051] | 149 | emp_position = schema.TextLine( |
---|
| 150 | title = _(u'Employer Position'), |
---|
| 151 | required = False, |
---|
| 152 | readonly = False, |
---|
| 153 | ) |
---|
[8184] | 154 | emp_start = FormattedDate( |
---|
[8051] | 155 | title = _(u'Start Date'), |
---|
| 156 | required = False, |
---|
| 157 | readonly = False, |
---|
[8378] | 158 | show_year = True, |
---|
[8051] | 159 | ) |
---|
[8184] | 160 | emp_end = FormattedDate( |
---|
[8051] | 161 | title = _(u'End Date'), |
---|
| 162 | required = False, |
---|
| 163 | readonly = False, |
---|
[8378] | 164 | show_year = True, |
---|
[8051] | 165 | ) |
---|
| 166 | emp_reason = schema.TextLine( |
---|
| 167 | title = _(u'Reason for Leaving'), |
---|
| 168 | required = False, |
---|
| 169 | readonly = False, |
---|
| 170 | ) |
---|
| 171 | employer2 = schema.TextLine( |
---|
| 172 | title = _(u'2nd Employer'), |
---|
| 173 | required = False, |
---|
| 174 | readonly = False, |
---|
| 175 | ) |
---|
| 176 | emp2_position = schema.TextLine( |
---|
| 177 | title = _(u'2nd Employer Position'), |
---|
| 178 | required = False, |
---|
| 179 | readonly = False, |
---|
| 180 | ) |
---|
[8184] | 181 | emp2_start = FormattedDate( |
---|
[8051] | 182 | title = _(u'Start Date'), |
---|
| 183 | required = False, |
---|
| 184 | readonly = False, |
---|
[8378] | 185 | show_year = True, |
---|
[8051] | 186 | ) |
---|
[8184] | 187 | emp2_end = FormattedDate( |
---|
[8051] | 188 | title = _(u'End Date'), |
---|
| 189 | required = False, |
---|
| 190 | readonly = False, |
---|
[8378] | 191 | show_year = True, |
---|
[8051] | 192 | ) |
---|
| 193 | emp2_reason = schema.TextLine( |
---|
| 194 | title = _(u'Reason for Leaving'), |
---|
| 195 | required = False, |
---|
| 196 | readonly = False, |
---|
| 197 | ) |
---|
| 198 | notice = schema.Text( |
---|
| 199 | title = _(u'Notice'), |
---|
| 200 | required = False, |
---|
| 201 | readonly = False, |
---|
| 202 | ) |
---|
| 203 | screening_venue = schema.TextLine( |
---|
| 204 | title = _(u'Screening Venue'), |
---|
| 205 | required = False, |
---|
| 206 | readonly = False, |
---|
| 207 | ) |
---|
| 208 | screening_score = schema.Int( |
---|
| 209 | title = _(u'Screening Score'), |
---|
| 210 | required = False, |
---|
| 211 | readonly = False, |
---|
| 212 | ) |
---|
| 213 | course_admitted = schema.Choice( |
---|
| 214 | title = _(u'Admitted Course of Study'), |
---|
| 215 | source = CertificateSource(), |
---|
| 216 | required = False, |
---|
| 217 | readonly = False, |
---|
| 218 | ) |
---|
[8012] | 219 | |
---|
[8051] | 220 | |
---|
[8071] | 221 | # This ordering doesn't work properly. |
---|
[8051] | 222 | IPGApplicant[ |
---|
[8071] | 223 | 'nationality'].order = IApplicantBaseData['sex'].order |
---|
| 224 | IPGApplicant[ |
---|
| 225 | 'lga'].order = IPGApplicant['nationality'].order |
---|
| 226 | IPGApplicant[ |
---|
[8051] | 227 | 'student_id'].order = IPGApplicant['notice'].order |
---|
| 228 | |
---|
[8071] | 229 | |
---|
[8196] | 230 | class ICustomApplicant(IUGApplicant,IPGApplicant): |
---|
[8012] | 231 | """An interface for both types of applicants. |
---|
| 232 | |
---|
| 233 | """ |
---|
| 234 | |
---|
[8053] | 235 | def loggerInfo(ob_class, comment): |
---|
| 236 | """Adds an INFO message to the log file |
---|
| 237 | """ |
---|
| 238 | |
---|
| 239 | def createStudent(): |
---|
| 240 | """Create a student object from applicatnt data |
---|
| 241 | and copy applicant object. |
---|
| 242 | """ |
---|
| 243 | |
---|
[8017] | 244 | class IUGApplicantEdit(IUGApplicant): |
---|
[8012] | 245 | """An undergraduate applicant interface for editing. |
---|
| 246 | |
---|
| 247 | Here we can repeat the fields from base data and set the |
---|
| 248 | `required` and `readonly` attributes to True to further restrict |
---|
| 249 | the data access. Or we can allow only certain certificates to be |
---|
| 250 | selected by choosing the appropriate source. |
---|
| 251 | |
---|
| 252 | We cannot omit fields here. This has to be done in the |
---|
| 253 | respective form page. |
---|
| 254 | """ |
---|
| 255 | |
---|
[8017] | 256 | class IPGApplicantEdit(IPGApplicant): |
---|
[7866] | 257 | """A postgraduate applicant interface for editing. |
---|
| 258 | |
---|
| 259 | Here we can repeat the fields from base data and set the |
---|
| 260 | `required` and `readonly` attributes to True to further restrict |
---|
| 261 | the data access. Or we can allow only certain certificates to be |
---|
| 262 | selected by choosing the appropriate source. |
---|
| 263 | |
---|
| 264 | We cannot omit fields here. This has to be done in the |
---|
| 265 | respective form page. |
---|
[8017] | 266 | """ |
---|
[8454] | 267 | |
---|
[8247] | 268 | class ICustomApplicantOnlinePayment(ICustomOnlinePayment): |
---|
| 269 | """An applicant payment via payment gateways. |
---|
| 270 | |
---|
| 271 | """ |
---|