## $Id: interfaces.py 14206 2016-09-29 08:54: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 from zc.sourcefactory.contextual import BasicContextualSourceFactory from zope.catalog.interfaces import ICatalog from zope.component import getUtility from waeup.kofa.interfaces import (IKofaObject, academic_sessions_vocab) from waeup.kofa.students.vocabularies import ( StudyLevelSource, contextual_reg_num_source ) from waeup.kofa.schema import PhoneNumber, FormattedDate, TextLineChoice from kofacustom.nigeria.interfaces import LGASource from kofacustom.nigeria.students.interfaces import ( INigeriaStudentBase, INigeriaUGStudentClearance, INigeriaPGStudentClearance, INigeriaStudentPersonal, INigeriaStudentStudyLevel, INigeriaStudentStudyCourse, INigeriaCourseTicket, INigeriaStudentUpdateByRegNo, INigeriaStudentUpdateByMatricNo, ) from waeup.aaue.payments.interfaces import ICustomOnlinePayment from waeup.aaue.interfaces import MessageFactory as _ class ICustomStudentBase(INigeriaStudentBase): """Representation of student base data. """ reg_number = TextLineChoice( title = _(u'JAMB Registration Number'), required = False, readonly = False, source = contextual_reg_num_source, ) application_number = schema.TextLine( title = _(u'Application Number'), required = False, readonly = False, ) ICustomStudentBase['reg_number'].order = INigeriaStudentBase[ 'reg_number'].order ICustomStudentBase['application_number'].order = ICustomStudentBase[ 'reg_number'].order class ICustomStudentPersonal(INigeriaStudentPersonal): """Student personal data. """ father_name = schema.TextLine( title = _(u'Father\'s Name'), required = False, readonly = False, ) father_address = schema.Text( title = _(u'Father\'s Permanent Address'), required = False, readonly = False, ) father_work = schema.TextLine( title = _(u'Father\'s Place of Work'), required = False, readonly = False, ) father_phone = PhoneNumber( title = _(u'Father\'s Phone'), required = False, readonly = False, ) mother_name = schema.TextLine( title = _(u'Mother\'s Name'), required = False, readonly = False, ) mother_address = schema.Text( title = _(u'Mother\'s Permanent Address'), required = False, readonly = False, ) mother_work = schema.TextLine( title = _(u'Mother\'s Place of Work'), required = False, readonly = False, ) mother_phone = PhoneNumber( title = _(u'Mother\'s Phone'), required = False, readonly = False, ) phone_personal = PhoneNumber( title = _(u'Student\'s Personal Phone'), description = u'', required = False, readonly = 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. """ 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, ) father_name = schema.TextLine( title = _(u'Father\'s Name'), required = True, readonly = False, ) father_address = schema.Text( title = _(u'Father\'s Permanent Address'), required = True, readonly = False, ) father_work = schema.TextLine( title = _(u'Father\'s Place of Work'), required = True, readonly = False, ) father_phone = PhoneNumber( title = _(u'Father\'s Phone'), required = True, readonly = False, ) mother_name = schema.TextLine( title = _(u'Mother\'s Name'), required = True, readonly = False, ) mother_address = schema.Text( title = _(u'Mother\'s Permanent Address'), required = True, readonly = False, ) mother_work = schema.TextLine( title = _(u'Mother\'s Place of Work'), required = True, readonly = False, ) mother_phone = PhoneNumber( title = _(u'Mother\'s Phone'), required = True, readonly = False, ) phone_personal = PhoneNumber( title = _(u'Student\'s Personal Phone'), description = u'', required = True, readonly = False, ) class ICustomUGStudentClearance(INigeriaUGStudentClearance): """Representation of ug student clearance data. """ #date_of_birth = FormattedDate( # title = _(u'Date of Birth'), # required = True, # show_year = True, # ) lga = schema.Choice( source = LGASource(), title = _(u'State / LGA'), required = True, ) fst_sit_sc_pin = schema.TextLine( title = _(u'Scratch Card Pin'), required = False, readonly = False, ) fst_sit_sc_serial_number = schema.TextLine( title = _(u'Scratch Card Serial Number'), required = False, readonly = False, ) scd_sit_sc_pin = schema.TextLine( title = _(u'Scratch Card Pin'), required = False, readonly = False, ) scd_sit_sc_serial_number = schema.TextLine( title = _(u'Scratch Card Serial Number'), required = False, readonly = False, ) ICustomUGStudentClearance['lga'].order = INigeriaUGStudentClearance[ 'lga'].order #ICustomUGStudentClearance['date_of_birth'].order = INigeriaUGStudentClearance[ # 'date_of_birth'].order ICustomUGStudentClearance['fst_sit_sc_pin'].order = INigeriaUGStudentClearance['fst_sit_date'].order ICustomUGStudentClearance['scd_sit_sc_pin'].order = INigeriaUGStudentClearance['scd_sit_date'].order ICustomUGStudentClearance['fst_sit_sc_serial_number'].order = INigeriaUGStudentClearance['fst_sit_date'].order ICustomUGStudentClearance['scd_sit_sc_serial_number'].order = INigeriaUGStudentClearance['scd_sit_date'].order ICustomUGStudentClearance['scd_sit_date'].order = ICustomUGStudentClearance['scd_sit_type'].order ICustomUGStudentClearance['fst_sit_date'].order = ICustomUGStudentClearance['fst_sit_type'].order 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. """ imported_cgpa = schema.Float( title = _(u'Imported Cumulative GPA'), required = False, readonly = True, ) class ICustomStudentStudyLevel(INigeriaStudentStudyLevel): """A container for course tickets. """ total_credits_s1 = schema.Int( title = _(u'1st Semester Units'), required = False, readonly = True, ) total_credits_s2 = schema.Int( title = _(u'2nd Semester Units'), required = False, readonly = True, ) total_credits = schema.Int( title = _(u'Total Units'), required = False, readonly = True, ) imported_gpa = schema.Float( title = _(u'Imported Level GPA'), required = False, readonly = True, ) imported_cgpa = schema.Float( title = _(u'Imported Cumulative GPA'), required = False, readonly = True, ) 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 class ICustomCourseTicket(INigeriaCourseTicket): """A course ticket. """ score = schema.Int( title = _(u'Score'), required = False, readonly = False, max = 70, ) ca = schema.Int( title = _(u'CA'), default = None, required = False, missing_value = None, max = 30, ) class ICustomCourseTicketImport(ICustomCourseTicket): """An interface for importing course results and nothing more. """ score = schema.Int( title = _(u'Score'), required = False, readonly = False, max = 70, ) ca = schema.Int( title = _(u'CA'), required = False, readonly = False, max = 30, ) level_session = schema.Choice( title = _(u'Level Session'), source = academic_sessions_vocab, required = False, readonly = False, ) ICustomCourseTicket['ca'].order = ICustomCourseTicket['score'].order class ICustomStudentUpdateByRegNo(INigeriaStudentUpdateByRegNo): """Representation of a student. Skip regular reg_number validation. """ class ICustomStudentUpdateByMatricNo(INigeriaStudentUpdateByMatricNo): """Representation of a student. Skip regular matric_number validation. """