[10761] | 1 | ## $Id: interfaces.py 10761 2013-11-19 11:59:22Z 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 | |
---|
| 21 | from zope import schema |
---|
| 22 | from waeup.kofa.applicants.interfaces import ( |
---|
| 23 | IApplicantBaseData, |
---|
| 24 | AppCatCertificateSource, CertificateSource) |
---|
| 25 | from waeup.kofa.schoolgrades import ResultEntryField |
---|
| 26 | from waeup.kofa.interfaces import ( |
---|
| 27 | SimpleKofaVocabulary, academic_sessions_vocab, validate_email) |
---|
| 28 | from waeup.kofa.schema import FormattedDate, TextLineChoice |
---|
| 29 | from waeup.kofa.students.vocabularies import nats_vocab, GenderSource |
---|
| 30 | from waeup.kofa.applicants.interfaces import contextual_reg_num_source |
---|
| 31 | from kofacustom.nigeria.applicants.interfaces import ( |
---|
| 32 | LGASource, high_qual, high_grade, exam_types, |
---|
| 33 | INigeriaUGApplicant, INigeriaPGApplicant, |
---|
| 34 | INigeriaApplicantOnlinePayment, |
---|
| 35 | INigeriaUGApplicantEdit, INigeriaPGApplicantEdit, |
---|
| 36 | INigeriaApplicantUpdateByRegNo, |
---|
| 37 | IPUTMEApplicantEdit, |
---|
| 38 | ) |
---|
| 39 | from waeup.skeleton.interfaces import MessageFactory as _ |
---|
| 40 | from waeup.skeleton.payments.interfaces import ICustomOnlinePayment |
---|
| 41 | |
---|
| 42 | class ICustomUGApplicant(INigeriaUGApplicant): |
---|
| 43 | """An undergraduate applicant. |
---|
| 44 | |
---|
| 45 | This interface defines the least common multiple of all fields |
---|
| 46 | in ug application forms. In customized forms, fields can be excluded by |
---|
| 47 | adding them to the UG_OMIT* tuples. |
---|
| 48 | """ |
---|
| 49 | |
---|
| 50 | class ICustomPGApplicant(INigeriaPGApplicant): |
---|
| 51 | """A postgraduate applicant. |
---|
| 52 | |
---|
| 53 | This interface defines the least common multiple of all fields |
---|
| 54 | in pg application forms. In customized forms, fields can be excluded by |
---|
| 55 | adding them to the PG_OMIT* tuples. |
---|
| 56 | """ |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant): |
---|
| 60 | """An interface for both types of applicants. |
---|
| 61 | |
---|
| 62 | Attention: The ICustomPGApplicant field seetings will be overwritten |
---|
| 63 | by ICustomPGApplicant field settings. If a field is defined |
---|
| 64 | in both interfaces zope.schema validates only against the |
---|
| 65 | constraints in ICustomUGApplicant. This does not affect the forms |
---|
| 66 | since they are build on either ICustomUGApplicant or ICustomPGApplicant. |
---|
| 67 | """ |
---|
| 68 | |
---|
| 69 | def writeLogMessage(view, comment): |
---|
| 70 | """Adds an INFO message to the log file |
---|
| 71 | """ |
---|
| 72 | |
---|
| 73 | def createStudent(): |
---|
| 74 | """Create a student object from applicant data |
---|
| 75 | and copy applicant object. |
---|
| 76 | """ |
---|
| 77 | |
---|
| 78 | class ICustomUGApplicantEdit(INigeriaUGApplicantEdit): |
---|
| 79 | """An undergraduate applicant interface for edit forms. |
---|
| 80 | |
---|
| 81 | Here we can repeat the fields from base data and set the |
---|
| 82 | `required` and `readonly` attributes to True to further restrict |
---|
| 83 | the data access. Or we can allow only certain certificates to be |
---|
| 84 | selected by choosing the appropriate source. |
---|
| 85 | |
---|
| 86 | We cannot omit fields here. This has to be done in the |
---|
| 87 | respective form page. |
---|
| 88 | """ |
---|
| 89 | |
---|
| 90 | class ICustomPGApplicantEdit(INigeriaPGApplicantEdit): |
---|
| 91 | """A postgraduate applicant interface for editing. |
---|
| 92 | |
---|
| 93 | Here we can repeat the fields from base data and set the |
---|
| 94 | `required` and `readonly` attributes to True to further restrict |
---|
| 95 | the data access. Or we can allow only certain certificates to be |
---|
| 96 | selected by choosing the appropriate source. |
---|
| 97 | |
---|
| 98 | We cannot omit fields here. This has to be done in the |
---|
| 99 | respective form page. |
---|
| 100 | """ |
---|
| 101 | |
---|
| 102 | class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment): |
---|
| 103 | """An applicant payment via payment gateways. |
---|
| 104 | |
---|
| 105 | """ |
---|
| 106 | |
---|
| 107 | class IPUTMEApplicantEdit(IPUTMEApplicantEdit): |
---|
| 108 | """An undergraduate applicant interface for editing. |
---|
| 109 | |
---|
| 110 | Here we can repeat the fields from base data and set the |
---|
| 111 | `required` and `readonly` attributes to True to further restrict |
---|
| 112 | the data access. Or we can allow only certain certificates to be |
---|
| 113 | selected by choosing the appropriate source. |
---|
| 114 | |
---|
| 115 | We cannot omit fields here. This has to be done in the |
---|
| 116 | respective form page. |
---|
| 117 | """ |
---|
| 118 | |
---|
| 119 | class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo): |
---|
| 120 | """Representation of an applicant. |
---|
| 121 | |
---|
| 122 | Skip regular reg_number validation if reg_number is used for finding |
---|
| 123 | the applicant object. |
---|
| 124 | """ |
---|