[7853] | 1 | ## $Id: interfaces.py 8053 2012-04-06 16:01:57Z 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 |
---|
[8020] | 27 | from waeup.uniben.interfaces import MessageFactory as _ |
---|
[7853] | 28 | |
---|
[8051] | 29 | high_qual = SimpleKofaVocabulary( |
---|
| 30 | ('National Certificate of Education','nce'), |
---|
| 31 | ('Pre Degree Programme','pre'), |
---|
| 32 | ('Diploma Programme','dip'), |
---|
| 33 | ('Ordinary National Diploma','ond'), |
---|
| 34 | ('Bachelors Degree','bd'), |
---|
| 35 | ('Masters Degree','md'), |
---|
| 36 | ('Professional Qualification','pq'), |
---|
| 37 | ('Other Certification','oc'), |
---|
| 38 | ('Higher National Diploma','hnd'), |
---|
| 39 | ('NCE AL OTH','nce_al_oth'), |
---|
| 40 | ('National Defence Academy','nda'), |
---|
| 41 | ('Awaiting Results','a_rslt'), |
---|
| 42 | ('RMC','rmc'), |
---|
| 43 | ) |
---|
| 44 | |
---|
| 45 | high_grade = SimpleKofaVocabulary( |
---|
| 46 | ('Upper Credit','upper_credit'), |
---|
| 47 | ('Distinction','distinction'), |
---|
| 48 | ('Credit','credit'), |
---|
| 49 | ('Merit','merit'), |
---|
| 50 | ('Lower Credit','lower_credit'), |
---|
| 51 | ('First Class','first_class'), |
---|
| 52 | ('Second Class Upper','second_class_upper'), |
---|
| 53 | ('Second Class Lower','second_class_lower'), |
---|
| 54 | ('Third Class','third_class'), |
---|
| 55 | ('Pass','pass'), |
---|
| 56 | ('Awaiting Results','a_rslt'), |
---|
| 57 | ('A Levels','al'), |
---|
| 58 | ) |
---|
| 59 | |
---|
| 60 | exam_types = SimpleKofaVocabulary( |
---|
| 61 | ('SSCE','ssce'), |
---|
| 62 | ('WAEC','waec'), |
---|
| 63 | ('GCE O\' LEVEL','gce_o_level'), |
---|
| 64 | ('TC II','tc_ii'), |
---|
| 65 | ('RSA','rsa'), |
---|
| 66 | ('NABTEB','nabteb'), |
---|
| 67 | ('NECO','neco'), |
---|
| 68 | ('ACE','ace'), |
---|
| 69 | ('GCE A\' LEVEL','gce_a_level'), |
---|
| 70 | ('IGCSE','igcse'), |
---|
| 71 | ) |
---|
| 72 | |
---|
[8053] | 73 | class IUGApplicant(IApplicantBaseData): |
---|
[8012] | 74 | """An undergraduate applicant. |
---|
| 75 | |
---|
| 76 | """ |
---|
| 77 | |
---|
[8053] | 78 | class IPGApplicant(IApplicantBaseData): |
---|
[7853] | 79 | """A postgraduate applicant. |
---|
| 80 | |
---|
[7866] | 81 | """ |
---|
| 82 | |
---|
[8051] | 83 | perm_address = schema.Text( |
---|
| 84 | title = _(u'Permanent Address'), |
---|
| 85 | required = False, |
---|
| 86 | ) |
---|
| 87 | course1 = schema.Choice( |
---|
| 88 | title = _(u'1st Choice Course of Study'), |
---|
| 89 | source = AppCatCertificateSource(), |
---|
| 90 | required = True, |
---|
| 91 | ) |
---|
| 92 | course2 = schema.Choice( |
---|
| 93 | title = _(u'2nd Choice Course of Study'), |
---|
| 94 | source = AppCatCertificateSource(), |
---|
| 95 | required = False, |
---|
| 96 | ) |
---|
| 97 | hq_type = schema.Choice( |
---|
| 98 | title = _(u'Qualification Obtained'), |
---|
| 99 | required = False, |
---|
| 100 | readonly = False, |
---|
| 101 | vocabulary = high_qual, |
---|
| 102 | ) |
---|
| 103 | hq_matric_no = schema.TextLine( |
---|
| 104 | title = _(u'Former Matric Number'), |
---|
| 105 | required = False, |
---|
| 106 | readonly = False, |
---|
| 107 | ) |
---|
| 108 | hq_degree = schema.Choice( |
---|
| 109 | title = _(u'Class of Degree'), |
---|
| 110 | required = False, |
---|
| 111 | readonly = False, |
---|
| 112 | vocabulary = high_grade, |
---|
| 113 | ) |
---|
| 114 | hq_school = schema.TextLine( |
---|
| 115 | title = _(u'Institution Attended'), |
---|
| 116 | required = False, |
---|
| 117 | readonly = False, |
---|
| 118 | ) |
---|
| 119 | hq_session = schema.TextLine( |
---|
| 120 | title = _(u'Years Attended'), |
---|
| 121 | required = False, |
---|
| 122 | readonly = False, |
---|
| 123 | ) |
---|
| 124 | hq_disc = schema.TextLine( |
---|
| 125 | title = _(u'Discipline'), |
---|
| 126 | required = False, |
---|
| 127 | readonly = False, |
---|
| 128 | ) |
---|
| 129 | pp_school = schema.Choice( |
---|
| 130 | title = _(u'Qualification Obtained'), |
---|
| 131 | required = False, |
---|
| 132 | readonly = False, |
---|
| 133 | vocabulary = exam_types, |
---|
| 134 | ) |
---|
[8012] | 135 | employer = schema.TextLine( |
---|
| 136 | title = _(u'Employer'), |
---|
| 137 | required = False, |
---|
| 138 | readonly = False, |
---|
| 139 | ) |
---|
[8051] | 140 | emp_position = schema.TextLine( |
---|
| 141 | title = _(u'Employer Position'), |
---|
| 142 | required = False, |
---|
| 143 | readonly = False, |
---|
| 144 | ) |
---|
| 145 | emp_start = schema.Date( |
---|
| 146 | title = _(u'Start Date'), |
---|
| 147 | required = False, |
---|
| 148 | readonly = False, |
---|
| 149 | ) |
---|
| 150 | emp_end = schema.Date( |
---|
| 151 | title = _(u'End Date'), |
---|
| 152 | required = False, |
---|
| 153 | readonly = False, |
---|
| 154 | ) |
---|
| 155 | emp_reason = schema.TextLine( |
---|
| 156 | title = _(u'Reason for Leaving'), |
---|
| 157 | required = False, |
---|
| 158 | readonly = False, |
---|
| 159 | ) |
---|
| 160 | employer2 = schema.TextLine( |
---|
| 161 | title = _(u'2nd Employer'), |
---|
| 162 | required = False, |
---|
| 163 | readonly = False, |
---|
| 164 | ) |
---|
| 165 | emp2_position = schema.TextLine( |
---|
| 166 | title = _(u'2nd Employer Position'), |
---|
| 167 | required = False, |
---|
| 168 | readonly = False, |
---|
| 169 | ) |
---|
| 170 | emp2_start = schema.Date( |
---|
| 171 | title = _(u'Start Date'), |
---|
| 172 | required = False, |
---|
| 173 | readonly = False, |
---|
| 174 | ) |
---|
| 175 | emp2_end = schema.Date( |
---|
| 176 | title = _(u'End Date'), |
---|
| 177 | required = False, |
---|
| 178 | readonly = False, |
---|
| 179 | ) |
---|
| 180 | emp2_reason = schema.TextLine( |
---|
| 181 | title = _(u'Reason for Leaving'), |
---|
| 182 | required = False, |
---|
| 183 | readonly = False, |
---|
| 184 | ) |
---|
| 185 | notice = schema.Text( |
---|
| 186 | title = _(u'Notice'), |
---|
| 187 | required = False, |
---|
| 188 | readonly = False, |
---|
| 189 | ) |
---|
| 190 | screening_venue = schema.TextLine( |
---|
| 191 | title = _(u'Screening Venue'), |
---|
| 192 | required = False, |
---|
| 193 | readonly = False, |
---|
| 194 | ) |
---|
| 195 | screening_score = schema.Int( |
---|
| 196 | title = _(u'Screening Score'), |
---|
| 197 | required = False, |
---|
| 198 | readonly = False, |
---|
| 199 | ) |
---|
| 200 | course_admitted = schema.Choice( |
---|
| 201 | title = _(u'Admitted Course of Study'), |
---|
| 202 | source = CertificateSource(), |
---|
| 203 | required = False, |
---|
| 204 | readonly = False, |
---|
| 205 | ) |
---|
[8012] | 206 | |
---|
[8051] | 207 | |
---|
| 208 | IPGApplicant[ |
---|
| 209 | 'student_id'].order = IPGApplicant['notice'].order |
---|
| 210 | |
---|
[8012] | 211 | class IApplicant(IUGApplicant,IPGApplicant): |
---|
| 212 | """An interface for both types of applicants. |
---|
| 213 | |
---|
| 214 | """ |
---|
| 215 | |
---|
[8053] | 216 | def loggerInfo(ob_class, comment): |
---|
| 217 | """Adds an INFO message to the log file |
---|
| 218 | """ |
---|
| 219 | |
---|
| 220 | def createStudent(): |
---|
| 221 | """Create a student object from applicatnt data |
---|
| 222 | and copy applicant object. |
---|
| 223 | """ |
---|
| 224 | |
---|
[8017] | 225 | class IUGApplicantEdit(IUGApplicant): |
---|
[8012] | 226 | """An undergraduate applicant interface for editing. |
---|
| 227 | |
---|
| 228 | Here we can repeat the fields from base data and set the |
---|
| 229 | `required` and `readonly` attributes to True to further restrict |
---|
| 230 | the data access. Or we can allow only certain certificates to be |
---|
| 231 | selected by choosing the appropriate source. |
---|
| 232 | |
---|
| 233 | We cannot omit fields here. This has to be done in the |
---|
| 234 | respective form page. |
---|
| 235 | """ |
---|
| 236 | |
---|
[8017] | 237 | class IPGApplicantEdit(IPGApplicant): |
---|
[7866] | 238 | """A postgraduate applicant interface for editing. |
---|
| 239 | |
---|
| 240 | Here we can repeat the fields from base data and set the |
---|
| 241 | `required` and `readonly` attributes to True to further restrict |
---|
| 242 | the data access. Or we can allow only certain certificates to be |
---|
| 243 | selected by choosing the appropriate source. |
---|
| 244 | |
---|
| 245 | We cannot omit fields here. This has to be done in the |
---|
| 246 | respective form page. |
---|
[8017] | 247 | """ |
---|