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