## $Id: interfaces.py 17157 2022-11-03 06:00:32Z 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, invariant, Invalid from waeup.kofa.students.vocabularies import StudyLevelSource from waeup.kofa.interfaces import validate_email, SimpleKofaVocabulary from waeup.kofa.students.interfaces import IStudentPersonal from waeup.kofa.schema import FormattedDate, PhoneNumber from kofacustom.nigeria.students.interfaces import ( INigeriaStudentBase, INigeriaUGStudentClearance, INigeriaPGStudentClearance, INigeriaStudentPersonal, INigeriaStudentStudyLevel, INigeriaStudentStudyCourse, INigeriaCourseTicket, INigeriaStudentUpdateByRegNo, INigeriaStudentUpdateByMatricNo, ) from kofacustom.iuokada.payments.interfaces import ICustomOnlinePayment from kofacustom.iuokada.applicants.interfaces import sponsors_vocab from kofacustom.iuokada.interfaces import MessageFactory as _ class ICustomStudentBase(INigeriaStudentBase): """Representation of student base data. """ email2 = schema.ASCIILine( title = _(u'Second Email'), required = False, constraint=validate_email, ) library = schema.Bool( title = _(u'Library Id Card'), default = False, required = False, ) sponsor = schema.Choice( title = _(u'Sponsor'), vocabulary = sponsors_vocab, required = False, ) present = schema.Bool( title = _(u'Physically Present on Campus'), default = False, required = False, ) ICustomStudentBase['email2'].order = ICustomStudentBase[ 'phone'].order ICustomStudentBase['phone'].order = ICustomStudentBase[ 'email'].order class ICustomStudentPersonal(IStudentPersonal): """Student personal/bio data. """ is_foreigner = Attribute('True if student is non-Nigerian') # Duplicated fields from the ICustomStudentBase email = schema.ASCIILine( title = _(u'Email'), required = False, constraint=validate_email, ) email2 = schema.ASCIILine( title = _(u'Second Email'), required = False, constraint=validate_email, ) phone = PhoneNumber( title = _(u'Phone'), required = False, ) parents_email = schema.ASCIILine( title = _(u"Parents' Email"), required = False, constraint=validate_email, ) sponsor = schema.Choice( title = _(u'Sponsor'), vocabulary = sponsors_vocab, required = False, ) # New fields perm_address = schema.Text( title = _(u'Home Address'), required = False, ) postal_address = schema.Text( title = _(u'Postal Address'), required = False, ) hostel_address = schema.Text( title = _(u'Hostel Address'), required = False, ) father_address = schema.Text( title = _(u'Father\'s Address'), required = False, ) mother_address = schema.Text( title = _(u'Mother\'s Address'), required = False, ) guardian_address = schema.Text( title = _(u'Guardian/Sponsor\'s Address'), required = False, ) father_phone = PhoneNumber( title = _(u'Father\'s Mobile Phone Number'), description = u'', required = False, ) mother_phone = PhoneNumber( title = _(u'Mother\'s Mobile Phone Number'), description = u'', required = False, ) guardian_phone = PhoneNumber( title = _(u'Guardian\'s Mobile Phone Number'), description = u'', required = False, ) marit_stat = schema.Choice( title = u'Marital 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 ICustomStudentPersonalEdit(ICustomStudentPersonal): """Interface for editing personal data by students. Here we can repeat the fields from IStudentPersonal and set the `required` if necessary. """ # Duplicated fields from the ICustomStudentPersonal: # All fields are required! email = schema.ASCIILine( title = _(u'Email'), required = True, constraint=validate_email, ) email2 = schema.ASCIILine( title = _(u'Second Email'), required = True, constraint=validate_email, ) phone = PhoneNumber( title = _(u'Phone'), required = True, ) parents_email = schema.ASCIILine( title = _(u"Parents' Email"), required = True, constraint=validate_email, ) sponsor = schema.Choice( title = _(u'Sponsor'), vocabulary = sponsors_vocab, required = True, ) # New fields perm_address = schema.Text( title = _(u'Home Address'), required = True, ) postal_address = schema.Text( title = _(u'Postal Address'), required = True, ) hostel_address = schema.Text( title = _(u'Hostel Address'), required = True, ) father_address = schema.Text( title = _(u'Father\'s Address'), required = True, ) mother_address = schema.Text( title = _(u'Mother\'s Address'), required = True, ) guardian_address = schema.Text( title = _(u'Guardian/Sponsor\'s Address'), required = True, ) father_phone = PhoneNumber( title = _(u'Father\'s Mobile Phone Number'), description = u'', required = True, ) mother_phone = PhoneNumber( title = _(u'Mother\'s Mobile Phone Number'), description = u'', required = True, ) guardian_phone = PhoneNumber( title = _(u'Guardian\'s Mobile Phone Number'), description = u'', required = True, ) marit_stat = schema.Choice( title = u'Marital Status', default = 'unmarried', required = True, vocabulary = SimpleKofaVocabulary( (_('Unmarried'), 'unmarried'), (_('Married'), 'married'),) ) religion = schema.Choice( title = u'Religion', default = 'no_say', required = True, vocabulary = SimpleKofaVocabulary( (_('Muslim'), 'muslim'), (_('Christian'), 'christian'), (_('Others'), 'others'), (_('Prefer not to say'), 'no_say'),) ) disabled = schema.Bool( title = u'Disabled', default = False, required = True, ) class ICustomUGStudentClearance(INigeriaUGStudentClearance): """Representation of ug student clearance data. """ class ICustomPGStudentClearance(INigeriaPGStudentClearance): """Representation of pg student clearance data. """ class ICustomStudent(ICustomStudentBase,ICustomUGStudentClearance, ICustomPGStudentClearance, ICustomStudentPersonal): """Representation of a student. """ class ICustomStudentStudyCourse(INigeriaStudentStudyCourse): """A container for student study levels. """ class ICustomStudentStudyLevel(INigeriaStudentStudyLevel): """A container for course tickets. """ class ICustomStudentOnlinePayment(ICustomOnlinePayment): """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.Choice( title = _(u'Payment Level'), source = StudyLevelSource(), required = False, ) ICustomStudentOnlinePayment['p_level'].order = ICustomStudentOnlinePayment[ 'p_session'].order ICustomStudentOnlinePayment['provider_amt'].order = ICustomStudentOnlinePayment[ 'net_amt'].order class ICustomCourseTicket(INigeriaCourseTicket): """A course ticket. """ class ICustomStudentUpdateByRegNo(INigeriaStudentUpdateByRegNo): """Representation of a student. Skip regular reg_number validation. """ class ICustomStudentUpdateByMatricNo(INigeriaStudentUpdateByMatricNo): """Representation of a student. Skip regular matric_number validation. """