[7419] | 1 | ## $Id: interfaces.py 8535 2012-05-28 05:24:43Z henrik $
|
---|
[6923] | 2 | ##
|
---|
[7419] | 3 | ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
|
---|
| 4 | ## This program is free software; you can redistribute it and/or modify
|
---|
| 5 | ## it under the terms of the GNU General Public License as published by
|
---|
| 6 | ## the Free Software Foundation; either version 2 of the License, or
|
---|
| 7 | ## (at your option) any later version.
|
---|
| 8 | ##
|
---|
| 9 | ## This program is distributed in the hope that it will be useful,
|
---|
| 10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 12 | ## GNU General Public License for more details.
|
---|
| 13 | ##
|
---|
| 14 | ## You should have received a copy of the GNU General Public License
|
---|
| 15 | ## along with this program; if not, write to the Free Software
|
---|
| 16 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
| 17 | ##
|
---|
[7695] | 18 |
|
---|
| 19 | import zope.i18nmessageid
|
---|
[6923] | 20 | from zope import schema
|
---|
[8502] | 21 | from zc.sourcefactory.basic import BasicSourceFactory
|
---|
[8071] | 22 | from waeup.kofa.interfaces import (SimpleKofaVocabulary,
|
---|
[7505] | 23 | ISessionConfiguration, academic_sessions_vocab)
|
---|
[8071] | 24 | from waeup.uniben.utils.lgas import LGAS
|
---|
[6923] | 25 |
|
---|
[8441] | 26 | _ = MessageFactory = zope.i18nmessageid.MessageFactory('waeup.custom')
|
---|
[7695] | 27 |
|
---|
[8101] | 28 | high_qual = SimpleKofaVocabulary(
|
---|
| 29 | ('National Certificate of Education','nce'),
|
---|
| 30 | ('Pre Degree Programme','pre'),
|
---|
| 31 | ('Diploma Programme','dip'),
|
---|
| 32 | ('Ordinary National Diploma','ond'),
|
---|
| 33 | ('Bachelors Degree','bd'),
|
---|
| 34 | ('Masters Degree','md'),
|
---|
| 35 | ('Professional Qualification','pq'),
|
---|
| 36 | ('Other Certification','oc'),
|
---|
| 37 | ('Higher National Diploma','hnd'),
|
---|
| 38 | ('NCE AL OTH','nce_al_oth'),
|
---|
| 39 | ('National Defence Academy','nda'),
|
---|
| 40 | ('Awaiting Results','a_rslt'),
|
---|
| 41 | ('RMC','rmc'),
|
---|
| 42 | )
|
---|
| 43 |
|
---|
| 44 | high_grade = SimpleKofaVocabulary(
|
---|
| 45 | ('Upper Credit','upper_credit'),
|
---|
| 46 | ('Distinction','distinction'),
|
---|
| 47 | ('Credit','credit'),
|
---|
| 48 | ('Merit','merit'),
|
---|
| 49 | ('Lower Credit','lower_credit'),
|
---|
| 50 | ('First Class','first_class'),
|
---|
| 51 | ('Second Class Upper','second_class_upper'),
|
---|
| 52 | ('Second Class Lower','second_class_lower'),
|
---|
| 53 | ('Third Class','third_class'),
|
---|
| 54 | ('Pass','pass'),
|
---|
| 55 | ('Awaiting Results','a_rslt'),
|
---|
| 56 | ('A Levels','al'),
|
---|
| 57 | )
|
---|
| 58 |
|
---|
| 59 | exam_types = SimpleKofaVocabulary(
|
---|
| 60 | ('SSCE','ssce'),
|
---|
| 61 | ('WAEC','waec'),
|
---|
| 62 | ('GCE O\' LEVEL','gce_o_level'),
|
---|
| 63 | ('TC II','tc_ii'),
|
---|
| 64 | ('RSA','rsa'),
|
---|
| 65 | ('NABTEB','nabteb'),
|
---|
| 66 | ('NECO','neco'),
|
---|
| 67 | ('ACE','ace'),
|
---|
| 68 | ('GCE A\' LEVEL','gce_a_level'),
|
---|
| 69 | ('IGCSE','igcse'),
|
---|
| 70 | )
|
---|
| 71 |
|
---|
[8502] | 72 | #lgas_vocab = SimpleKofaVocabulary(
|
---|
| 73 | # *sorted([(x[1],x[0]) for x in LGAS]))
|
---|
[8101] | 74 |
|
---|
[8502] | 75 | class LGASource(BasicSourceFactory):
|
---|
| 76 | """A source for school subjects used in exam documentation.
|
---|
| 77 | """
|
---|
| 78 | lga_dict = dict(LGAS)
|
---|
[8071] | 79 |
|
---|
[8502] | 80 | def getValues(self):
|
---|
| 81 | return sorted(self.lga_dict.keys())
|
---|
| 82 |
|
---|
| 83 | def getToken(self, value):
|
---|
| 84 | return str(value)
|
---|
| 85 |
|
---|
| 86 | def getTitle(self, value):
|
---|
| 87 | return self.lga_dict.get(value,
|
---|
| 88 | _('Invalid key: ${a}', mapping = {'a':value}))
|
---|
| 89 |
|
---|
[7021] | 90 | # It's recommended to replicate all fields from the base package here.
|
---|
[8204] | 91 | class ICustomSessionConfiguration(ISessionConfiguration):
|
---|
[6923] | 92 | """A session configuration object.
|
---|
| 93 | """
|
---|
| 94 |
|
---|
[7880] | 95 | # Base fees, do not remove.
|
---|
| 96 |
|
---|
[7928] | 97 | school_fee_base = schema.Float(
|
---|
[7695] | 98 | title = _(u'School Fee (ignored)'),
|
---|
[7928] | 99 | default = 0.0,
|
---|
[7880] | 100 | required = False,
|
---|
[6923] | 101 | )
|
---|
| 102 |
|
---|
[8263] | 103 | application_fee = schema.Float(
|
---|
[8535] | 104 | title = _(u'Application Fee (fallback)'),
|
---|
[7928] | 105 | default = 0.0,
|
---|
[7880] | 106 | required = False,
|
---|
[6923] | 107 | )
|
---|
| 108 |
|
---|
[7928] | 109 | clearance_fee = schema.Float(
|
---|
[8294] | 110 | title = _(u'Clearance Fee (ignored)'),
|
---|
[7928] | 111 | default = 0.0,
|
---|
[7880] | 112 | required = False,
|
---|
[6923] | 113 | )
|
---|
| 114 |
|
---|
[7928] | 115 | booking_fee = schema.Float(
|
---|
[7695] | 116 | title = _(u'Booking Fee'),
|
---|
[7928] | 117 | default = 0.0,
|
---|
[7880] | 118 | required = False,
|
---|
[6923] | 119 | )
|
---|
| 120 |
|
---|
[8441] | 121 | # Additional fees in custom package
|
---|
[7880] | 122 |
|
---|
[7928] | 123 | maint_fee = schema.Float(
|
---|
[8294] | 124 | title = _(u'Maintenance Fee (ignored)'),
|
---|
[7928] | 125 | default = 0.0,
|
---|
[7880] | 126 | required = False,
|
---|
[6950] | 127 | )
|
---|
| 128 |
|
---|
[7928] | 129 | gown = schema.Float(
|
---|
[7695] | 130 | title = _(u'Gown Fee'),
|
---|
[7928] | 131 | default = 0.0,
|
---|
[7880] | 132 | required = False,
|
---|
[7021] | 133 | )
|
---|
| 134 |
|
---|
[7928] | 135 | transfer = schema.Float(
|
---|
[7695] | 136 | title = _(u'Transfer Fee'),
|
---|
[7928] | 137 | default = 0.0,
|
---|
[7880] | 138 | required = False,
|
---|
[7021] | 139 | )
|
---|
| 140 |
|
---|
[6923] | 141 | def getSessionString():
|
---|
| 142 | """Returns the session string from the vocabulary.
|
---|
| 143 | """
|
---|
| 144 |
|
---|
| 145 |
|
---|
[8253] | 146 | class ICustomSessionConfigurationAdd(ICustomSessionConfiguration):
|
---|
[6923] | 147 | """A session configuration object in add mode.
|
---|
| 148 | """
|
---|
| 149 |
|
---|
| 150 | academic_session = schema.Choice(
|
---|
[7695] | 151 | title = _(u'Academic Session'),
|
---|
[6923] | 152 | source = academic_sessions_vocab,
|
---|
| 153 | default = None,
|
---|
| 154 | required = True,
|
---|
| 155 | readonly = False,
|
---|
| 156 | )
|
---|
| 157 |
|
---|
[8204] | 158 | ICustomSessionConfigurationAdd[
|
---|
| 159 | 'academic_session'].order = ICustomSessionConfiguration[
|
---|
[6923] | 160 | 'academic_session'].order |
---|