## $Id: interfaces.py 17714 2024-03-11 11:28:19Z henrik $ ## ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## """Customized interfaces of the university application package. """ from zope import schema from waeup.kofa.applicants.interfaces import ( IApplicantBaseData, AppCatCertificateSource, CertificateSource) from waeup.kofa.schoolgrades import ResultEntryField from waeup.kofa.interfaces import ( SimpleKofaVocabulary, academic_sessions_vocab, validate_email, IKofaObject) from waeup.kofa.schema import FormattedDate, TextLineChoice, PhoneNumber from waeup.kofa.students.vocabularies import nats_vocab, GenderSource from waeup.kofa.applicants.interfaces import ( contextual_reg_num_source, IApplicantBaseData, IApplicantOnlinePayment, IApplicantUpdateByRegNo) from kofacustom.nigeria.applicants.interfaces import ( LGASource, high_qual, high_grade, exam_types, INigeriaApplicantOnlinePayment) from kofacustom.udss.interfaces import MessageFactory as _ from kofacustom.udss.payments.interfaces import ICustomOnlinePayment class ICustomUGApplicant(IKofaObject): """A pupil. """ suspended = schema.Bool( title = _(u'Account suspended'), default = False, required = False, ) applicant_id = schema.TextLine( title = _(u'Applicant Id'), required = False, readonly = False, ) reg_number = TextLineChoice( title = _(u'Registration Number'), readonly = False, required = False, source = contextual_reg_num_source, ) firstname = schema.TextLine( title = _(u'First Name'), required = True, ) middlename = schema.TextLine( title = _(u'Middle Name'), required = False, ) lastname = schema.TextLine( title = _(u'Last Name (Surname)'), required = True, ) date_of_birth = FormattedDate( title = _(u'Date of Birth'), required = False, show_year = True, ) sex = schema.Choice( title = _(u'Gender'), source = GenderSource(), required = True, ) nationality = schema.Choice( source = nats_vocab, title = _(u'Nationality'), required = False, ) religion = schema.Choice( title = u'Religion', default = 'no_say', required = False, vocabulary = SimpleKofaVocabulary( (_('Muslim'), 'muslim'), (_('Christian'), 'christian'), (_('Others'), 'others'), (_('Prefer not to say'), 'no_say'),) ) email = schema.ASCIILine( title = _(u'Email Address'), required = False, constraint=validate_email, ) phone = PhoneNumber( title = _(u'Phone'), description = u'', required = False, ) recent_schools_comment = schema.Text( title = _(u'Recent Schools Attended (with dates)'), required = False, ) present_class_comment = schema.Text( title = _(u'Child\'s Present Class'), description = u'Indicate the child\'s present class. Please upload a ' 'copy of the first term result of the present class. ' 'Children in Basic Four or less than 10yrs by October ' 'should not apply.', required = False, ) handicapped_comment = schema.Text( title = _(u'Health Problems'), description = u'Does the child has any special health problem or handicap? ' 'If yes, give details.', required = False, ) bloodgroup = schema.TextLine( title = _(u'Blood Group'), required = False, ) genotype = schema.TextLine( title = _(u'Genotype'), required = False, ) father_firstname = schema.TextLine( title = _(u'First Name of Father'), required = False, ) father_middlename = schema.TextLine( title = _(u'Middle Name of Father'), required = False, ) father_lastname = schema.TextLine( title = _(u'Last Name (Surname) of Father'), required = False, ) father_status = schema.TextLine( title = _(u'Father\'s Status and Rank'), required = False, ) father_employer = schema.TextLine( title = _(u'Father\'s Employer'), required = False, ) father_res_address = schema.Text( title = _(u'Father\'s Residential Address'), required = False, ) father_contact_address = schema.Text( title = _(u'Father\'s Contact Address (incl. P.O. Box)'), required = False, ) mother_firstname = schema.TextLine( title = _(u'First Name of Mother'), required = False, ) mother_middlename = schema.TextLine( title = _(u'Middle Name of Mother'), required = False, ) mother_lastname = schema.TextLine( title = _(u'Last Name (Surname) of Mother'), required = False, ) mother_status = schema.TextLine( title = _(u'Mother\'s Status and Rank'), required = False, ) mother_employer = schema.TextLine( title = _(u'Mother\'s Employer'), required = False, ) mother_res_address = schema.Text( title = _(u'Mother\'s Residential Address'), required = False, ) mother_contact_address = schema.Text( title = _(u'Mother\'s Contact Address (incl. P.O. Box)'), required = False, ) responsible = schema.TextLine( title = _(u'Financial Responsibility'), description = u'Who will responsible for for the child\'s school ' 'fees and other fiancial commitments?', required = False, ) notice = schema.Text( title = _(u'Notice'), required = False, ) student_id = schema.TextLine( title = _(u'Student Id'), required = False, readonly = False, ) locked = schema.Bool( title = _(u'Form locked'), default = False, required = False, ) class ICustomApplicant(ICustomUGApplicant): """An interface for both types of applicants. Attention: The ICustomPGApplicant field seetings will be overwritten by ICustomPGApplicant field settings. If a field is defined in both interfaces zope.schema validates only against the constraints in ICustomUGApplicant. This does not affect the forms since they are build on either ICustomUGApplicant or ICustomPGApplicant. """ def writeLogMessage(view, comment): """Adds an INFO message to the log file """ def createStudent(): """Create a student object from applicant data and copy applicant object. """ class ICustomUGApplicantEdit(ICustomUGApplicant): """An undergraduate applicant interface for edit forms. Here we can repeat the fields from base data and set the `required` and `readonly` attributes to True to further restrict the data access. Or we can allow only certain certificates to be selected by choosing the appropriate source. We cannot omit fields here. This has to be done in the respective form page. """ email = schema.ASCIILine( title = _(u'Email Address'), required = True, constraint=validate_email, ) date_of_birth = FormattedDate( title = _(u'Date of Birth'), required = True, show_year = True, ) ICustomUGApplicantEdit[ 'date_of_birth'].order = ICustomUGApplicant['date_of_birth'].order ICustomUGApplicantEdit[ 'email'].order = ICustomUGApplicant['email'].order class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment): """An applicant payment via payment gateways. """ class ICustomApplicantUpdateByRegNo(IApplicantUpdateByRegNo): """Representation of an applicant. Skip regular reg_number validation if reg_number is used for finding the applicant object. """