Ignore:
Timestamp:
10 Jul 2015, 11:39:13 (9 years ago)
Author:
Henrik Bettermann
Message:

Replace jamb_subjects field by the list-of-choices field
jamb_subjects_list which allows to select items from the jambsubjects
vocabulary. This field is available only for CBT application.

Location:
main/kofacustom.nigeria/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.nigeria/trunk

    • Property svn:ignore
      •  

        old new  
        66parts
        77sources
         8uuid.txt
        89var
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/applicants/interfaces.py

    r13157 r13160  
    2020
    2121from zope import schema
     22from zope.component import getUtility
    2223from waeup.kofa.applicants.interfaces import (
    2324    contextual_reg_num_source,
     
    2627from waeup.kofa.schoolgrades import ResultEntryField
    2728from waeup.kofa.interfaces import (
    28     SimpleKofaVocabulary, academic_sessions_vocab, validate_email)
     29    SimpleKofaVocabulary,
     30    academic_sessions_vocab,
     31    validate_email,
     32    SubjectSource,
     33    IKofaUtils)
    2934from waeup.kofa.schema import FormattedDate, TextLineChoice
    3035from waeup.kofa.students.vocabularies import nats_vocab, GenderSource
     
    3439from kofacustom.nigeria.payments.interfaces import INigeriaOnlinePayment
    3540
     41jambsubjects = SimpleKofaVocabulary(
     42    (_('Use of English'),'english_language'),
     43    (_('Agricultural Science'),'agricultural_science'),
     44    (_('Arabic'),'arabic'),
     45    (_('Biology'),'biology'),
     46    (_('Book Keeping'),'book_keeping'),
     47    (_('Chemistry'),'chemistry'),
     48    (_('Christian Religious Studies'),'christian_religious_studies'),
     49    (_('Commerce'),'commerce'),
     50    (_('Economics'),'economics'),
     51    (_('Financial Accounting'),'financial_accounting'),
     52    (_('Fine Art'),'fine_art'),
     53    (_('Food and Nutrition'),'food_and_nutrition'),
     54    (_('French'),'french'),
     55    (_('Geography'),'geography'),
     56    (_('German'),'german'),
     57    (_('Government'),'government'),
     58    (_('Hausa'),'hausa'),
     59    (_('Home Economics'),'home_economics'),
     60    (_('History'),'history'),
     61    (_('Igbo'),'igbo'),
     62    (_('Literature in English'),'literature_in_english'),
     63    (_('Literature in Nigerian Languages'),'literature_in_nigerian_languages'),
     64    (_('Mathematics'),'mathematics'),
     65    (_('Music'),'music'),
     66    (_('Physics'),'physics'),
     67    (_('Yoruba'),'yoruba'),
     68    )
     69
     70class JAMBSubjectSource(SubjectSource):
     71    """A source for school subjects used in exam documentation.
     72    """
     73
     74    def getTitle(self, value):
     75        subjects_dict = getUtility(IKofaUtils).EXAM_SUBJECTS_DICT
     76        return "%s" % subjects_dict[value]
     77
    3678# Fields to be omitted in all display forms. course_admitted is
    3779# rendered separately.
     
    4183
    4284# UG students are all undergraduate students.
    43 UG_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS
     85UG_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + ('jamb_subjects_list',)
    4486UG_OMIT_PDF_FIELDS = UG_OMIT_DISPLAY_FIELDS + ('phone',)
    45 UG_OMIT_MANAGE_FIELDS = ('special_application',)
     87UG_OMIT_MANAGE_FIELDS = ('special_application','jamb_subjects_list',)
    4688UG_OMIT_EDIT_FIELDS = UG_OMIT_MANAGE_FIELDS + OMIT_DISPLAY_FIELDS + (
    4789    'student_id',
     
    5092    'screening_venue',
    5193    'screening_date',
    52     #'jamb_age',
     94    'jamb_age',
    5395    'jamb_subjects',
    5496    'jamb_score',
     
    61103    'hq_degree', 'hq_school',
    62104    'hq_session', 'hq_disc',
    63     'aggregate')
     105    'aggregate', 'jamb_subjects')
    64106CBT_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + CBT_OMIT_FIELDS
    65 CBT_OMIT_MANAGE_FIELDS = UG_OMIT_MANAGE_FIELDS + CBT_OMIT_FIELDS
    66 CBT_OMIT_EDIT_FIELDS = UG_OMIT_MANAGE_FIELDS + OMIT_DISPLAY_FIELDS + CBT_OMIT_FIELDS + (
     107CBT_OMIT_MANAGE_FIELDS = CBT_OMIT_FIELDS + ('special_application',)
     108CBT_OMIT_EDIT_FIELDS = OMIT_DISPLAY_FIELDS + CBT_OMIT_FIELDS + (
     109    'special_application',
    67110    'student_id',
    68111    'notice',
     
    81124    'hq_type', 'hq_matric_no',
    82125    'hq_degree', 'hq_school',
    83     'hq_session', 'hq_disc',)
     126    'hq_session', 'hq_disc', 'jamb_subjects_list')
    84127PUTME_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + PUTME_OMIT_FIELDS
    85128PUTME_OMIT_MANAGE_FIELDS = UG_OMIT_MANAGE_FIELDS + PUTME_OMIT_FIELDS
     
    97140# PUDE is a subgroup of UG with the same interface.
    98141PUDE_OMIT_FIELDS = (
    99     'jamb_subjects','jamb_score', 'jamb_age', 'aggregate')
     142    'jamb_subjects','jamb_score', 'jamb_age', 'aggregate', 'jamb_subjects_list')
    100143PUDE_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + PUDE_OMIT_FIELDS
    101144PUDE_OMIT_MANAGE_FIELDS = UG_OMIT_MANAGE_FIELDS + PUDE_OMIT_FIELDS
     
    188231        required = False,
    189232        )
     233    jamb_subjects_list = schema.List(
     234        title = _(u'JAMB Subjects'),
     235        default = ['english',],
     236        required = False,
     237        value_type = schema.Choice(
     238            vocabulary = jambsubjects
     239            #source = JAMBSubjectSource(),
     240            ),
     241        )
    190242    jamb_score = schema.Int(
    191243        title = _(u'Total JAMB Score'),
     
    523575        show_year = True,
    524576        )
    525     jamb_subjects = schema.Text(
    526         title = _(u'Subjects and Scores'),
    527         description = _(u'Enter all four subjects, one subject with score per line!'),
    528         required = True,
     577    jamb_subjects_list = schema.List(
     578        title = _(u'JAMB Subjects'),
     579        description = _(u'Select four subjects.'),
     580        default = ['english',],
     581        required = True,
     582        value_type = schema.Choice(
     583            vocabulary = jambsubjects
     584            #source = JAMBSubjectSource(),
     585            ),
    529586        )
    530587
     
    534591    'email'].order = INigeriaUGApplicant['email'].order
    535592INigeriaUGApplicantEdit[
    536     'jamb_subjects'].order = INigeriaUGApplicant['jamb_subjects'].order
     593    'jamb_subjects_list'].order = INigeriaUGApplicant['jamb_subjects_list'].order
    537594
    538595class INigeriaPGApplicantEdit(INigeriaPGApplicant):
Note: See TracChangeset for help on using the changeset viewer.