## $Id: interfaces.py 9567 2012-11-07 10:07:03Z henrik $ ## ## Copyright (C) 2012 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 ## from zope import schema from zope.interface import Attribute from waeup.kofa.schema import TextLineChoice from waeup.kofa.interfaces import SimpleKofaVocabulary, academic_sessions_vocab from waeup.kofa.schema import FormattedDate, PhoneNumber from waeup.kofa.schoolgrades import ResultEntryField from waeup.kofa.students.vocabularies import nats_vocab from waeup.kofa.students.interfaces import ( IStudentBase, IUGStudentClearance, IPGStudentClearance, IStudentPersonal, IStudentNavigation, IStudentStudyLevel, IStudentStudyCourse, ICourseTicket ) from waeup.kofa.students.vocabularies import ( nats_vocab, contextual_reg_num_source) from kofacustom.nigeria.interfaces import ( high_qual, high_grade, exam_types, LGASource) from kofacustom.nigeria.interfaces import MessageFactory as _ from kofacustom.nigeria.payments.interfaces import INigeriaOnlinePayment class INigeriaStudentBase(IStudentBase): """Representation of student base data. """ reg_number = TextLineChoice( title = _(u'Registration Number'), required = False, readonly = False, source = contextual_reg_num_source, ) is_staff = schema.Bool( title = _(u'Staff Member'), required = False, readonly = False, default = False, ) INigeriaStudentBase['reg_number'].order = IStudentBase[ 'reg_number'].order class INigeriaUGStudentClearance(IUGStudentClearance): """Representation of ug student clearance data. """ officer_comment = schema.Text( title = _(u"Officer's Comment"), required = False, ) clearance_locked = schema.Bool( title = _(u'Clearance form locked'), default = False, required = False, ) clr_code = schema.TextLine( title = _(u'CLR Activation Code'), required = False, readonly = False, ) date_of_birth = FormattedDate( title = _(u'Date of Birth'), required = False, show_year = True, ) nationality = schema.Choice( source = nats_vocab, title = _(u'Nationality'), required = True, ) lga = schema.Choice( source = LGASource(), title = _(u'State/LGA (Nigerians only)'), required = False, ) def_adm = schema.Bool( title = _(u'Deferent of Admission'), required = False, readonly = False, ) fst_sit_fname = schema.TextLine( title = _(u'Full Name'), required = False, readonly = False, ) fst_sit_no = schema.TextLine( title = _(u'Exam Number'), required = False, readonly = False, ) fst_sit_date = FormattedDate( title = _(u'Exam Date'), required = False, readonly = False, show_year = True, ) fst_sit_type = schema.Choice( title = _(u'Exam Type'), required = False, readonly = False, vocabulary = exam_types, ) fst_sit_results = schema.List( title = _(u'Exam Results'), value_type = ResultEntryField(), required = False, readonly = False, default = [], ) scd_sit_fname = schema.TextLine( title = _(u'Full Name'), required = False, readonly = False, ) scd_sit_no = schema.TextLine( title = _(u'Exam Number'), required = False, readonly = False, ) scd_sit_date = FormattedDate( title = _(u'Exam Date'), required = False, readonly = False, show_year = True, ) scd_sit_type = schema.Choice( title = _(u'Exam Type'), required = False, readonly = False, vocabulary = exam_types, ) scd_sit_results = schema.List( title = _(u'Exam Results'), value_type = ResultEntryField(), required = False, readonly = False, default = [], ) alr_fname = schema.TextLine( title = _(u'Full Name'), required = False, readonly = False, ) alr_no = schema.TextLine( title = _(u'Exam Number'), required = False, readonly = False, ) alr_date = FormattedDate( title = _(u'Exam Date'), required = False, readonly = False, show_year = True, ) alr_results = schema.List( title = _(u'Exam Results'), value_type = ResultEntryField(), required = False, readonly = False, default = [], ) hq_type = schema.Choice( title = _(u'Qualification Obtained'), required = False, readonly = False, vocabulary = high_qual, ) hq_fname = schema.TextLine( title = _(u'Full Name'), required = False, readonly = False, ) hq_matric_no = schema.TextLine( title = _(u'Former Matric Number'), required = False, readonly = False, ) hq_degree = schema.Choice( title = _(u'Class of Degree'), required = False, readonly = False, vocabulary = high_grade, ) hq_school = schema.TextLine( title = _(u'Institution Attended'), required = False, readonly = False, ) hq_session = schema.TextLine( title = _(u'Years Attended'), required = False, readonly = False, ) hq_disc = schema.TextLine( title = _(u'Discipline'), required = False, readonly = False, ) class INigeriaPGStudentClearance(INigeriaUGStudentClearance): """Representation of pg student clearance data. """ hq2_type = schema.Choice( title = _(u'Qualification Obtained'), required = False, readonly = False, vocabulary = high_qual, ) hq2_matric_no = schema.TextLine( title = _(u'Former Matric Number'), required = False, readonly = False, ) hq2_degree = schema.Choice( title = _(u'Class of Degree'), required = False, readonly = False, vocabulary = high_grade, ) hq2_school = schema.TextLine( title = _(u'Institution Attended'), required = False, readonly = False, ) hq2_session = schema.TextLine( title = _(u'Years Attended'), required = False, readonly = False, ) hq2_disc = schema.TextLine( title = _(u'Discipline'), required = False, readonly = False, ) nysc_year = schema.Int( title = _(u'Nysc Year'), required = False, readonly = False, ) nysc_location = schema.TextLine( title = _(u'Nysc Location'), required = False, ) nysc_lga = schema.Choice( source = LGASource(), title = _(u'Nysc LGA'), required = False, ) employer = schema.TextLine( title = _(u'Employer'), required = False, readonly = False, ) emp_position = schema.TextLine( title = _(u'Employer Position'), required = False, readonly = False, ) emp_start = FormattedDate( title = _(u'Start Date'), required = False, readonly = False, show_year = True, ) emp_end = FormattedDate( title = _(u'End Date'), required = False, readonly = False, show_year = True, ) emp_reason = schema.TextLine( title = _(u'Reason for Leaving'), required = False, readonly = False, ) employer2 = schema.TextLine( title = _(u'2nd Employer'), required = False, readonly = False, ) emp2_position = schema.TextLine( title = _(u'2nd Employer Position'), required = False, readonly = False, ) emp2_start = FormattedDate( title = _(u'Start Date'), required = False, readonly = False, show_year = True, ) emp2_end = FormattedDate( title = _(u'End Date'), required = False, readonly = False, show_year = True, ) emp2_reason = schema.TextLine( title = _(u'Reason for Leaving'), required = False, readonly = False, ) former_matric = schema.TextLine( title = _(u'If yes, matric number'), required = False, readonly = False, ) class INigeriaStudentPersonal(IStudentPersonal): """Student personal data. """ is_foreigner = Attribute('True if student is non-Nigerian') next_kin_name = schema.TextLine( title = _(u'Next of Kin Name'), required = False, readonly = False, ) next_kin_relation = schema.TextLine( title = _(u'Next of Kin Relationship'), required = False, readonly = False, ) next_kin_address = schema.Text( title = _(u'Next of Kin Address'), required = False, readonly = False, ) next_kin_phone = PhoneNumber( title = _(u'Next of Kin Phone'), description = u'', required = False, readonly = False, ) marit_stat = schema.Choice( title = u'Maritual Status', default = 'unmarried', required = False, vocabulary = SimpleKofaVocabulary( (_('Unmarried'), 'unmarried'), (_('Married'), 'married'),) ) 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'),) ) disabled = schema.Bool( title = u'Disabled', default = False, required = False, ) class INigeriaStudent(INigeriaStudentBase,INigeriaUGStudentClearance, INigeriaPGStudentClearance,INigeriaStudentPersonal): """Representation of a student. """ class INigeriaStudentPersonalEdit(INigeriaStudentPersonal): """Interface for editing personal data by students. Here we can repeat the fields from IStudentPersonal and set the `required` if necessary. """ perm_address = schema.Text( title = _(u'Permanent Address'), required = True, ) next_kin_name = schema.TextLine( title = _(u'Next of Kin Name'), required = True, readonly = False, ) next_kin_relation = schema.TextLine( title = _(u'Next of Kin Relationship'), required = True, readonly = False, ) next_kin_address = schema.Text( title = _(u'Next of Kin Address'), required = True, readonly = False, ) next_kin_phone = PhoneNumber( title = _(u'Next of Kin Phone'), description = u'', required = True, readonly = False, ) INigeriaStudentPersonalEdit['perm_address'].order = INigeriaStudentPersonal[ 'perm_address'].order INigeriaStudentPersonalEdit['next_kin_name'].order = INigeriaStudentPersonal[ 'next_kin_name'].order INigeriaStudentPersonalEdit['next_kin_relation'].order = INigeriaStudentPersonal[ 'next_kin_relation'].order INigeriaStudentPersonalEdit['next_kin_address'].order = INigeriaStudentPersonal[ 'next_kin_address'].order INigeriaStudentPersonalEdit['next_kin_phone'].order = INigeriaStudentPersonal[ 'next_kin_phone'].order class INigeriaStudentStudyCourse(IStudentStudyCourse): """A container for student study levels. """ class INigeriaStudentStudyLevel(IStudentStudyLevel): """A container for course tickets. """ class INigeriaStudentOnlinePayment(INigeriaOnlinePayment): """A student payment via payment gateways. This Interface does not inherit from IStudentOnlinePayment. Thus all fields from IStudentOnlinePayment have to be repeated here. """ p_current = schema.Bool( title = _(u'Current Session Payment'), default = True, required = False, ) p_level = schema.Int( title = _(u'Payment Level'), required = False, ) INigeriaStudentOnlinePayment['p_level'].order = INigeriaStudentOnlinePayment[ 'p_session'].order class INigeriaCourseTicket(ICourseTicket): """A course ticket. """ class INigeriaStudentUpdateByRegNo(INigeriaStudent): """Representation of a student. Skip regular reg_number validation. """ reg_number = schema.TextLine( title = _(u'Registration Number'), required = False, ) class INigeriaStudentUpdateByMatricNo(INigeriaStudent): """Representation of a student. Skip regular matric_number validation. """ matric_number = schema.TextLine( title = _(u'Matriculation Number'), required = False, )