source: main/waeup.fceokene/trunk/src/waeup/fceokene/students/browser.py @ 15509

Last change on this file since 15509 was 15509, checked in by Henrik Bettermann, 5 years ago

Condense text.

  • Property svn:keywords set to Id
File size: 7.7 KB
Line 
1## $Id: browser.py 15509 2019-07-22 19:29:52Z henrik $
2##
3## Copyright (C) 2012 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##
18import grok
19from zope.i18n import translate
20from zope.component import getUtility
21from zope.security import checkPermission
22from hurry.workflow.interfaces import IWorkflowInfo
23from waeup.kofa.interfaces import ADMITTED, IKofaUtils
24from waeup.kofa.interfaces import MessageFactory as _
25from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget
26from waeup.kofa.students.interfaces import IStudentsUtils
27from waeup.kofa.students.browser import (
28    StartClearancePage, BedTicketAddPage,
29    ExportPDFAdmissionSlip, StudyLevelDisplayFormPage,
30    PaymentsManageFormPage)
31from kofacustom.nigeria.students.browser import (
32    NigeriaOnlinePaymentDisplayFormPage,
33    NigeriaOnlinePaymentAddFormPage,
34    NigeriaExportPDFPaymentSlip,
35    NigeriaStudentClearanceEditFormPage,
36    NigeriaExportPDFClearanceSlip,
37    NigeriaExportPDFCourseRegistrationSlip
38    )
39
40from waeup.fceokene.students.interfaces import (
41    ICustomStudentOnlinePayment, ICustomUGStudentClearance,
42    ICustomStudentStudyLevel)
43
44class CustomExportPDFAdmissionSlip(ExportPDFAdmissionSlip):
45    """Deliver a PDF Admission slip.
46    """
47
48    @property
49    def label(self):
50        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
51        line0 = ''
52        if self.context.student.current_mode.startswith('ug'):
53            line0 = 'IN AFFILIATION WITH UNIVERSITY OF IBADAN\n'
54        line1 = translate(_('Admission Letter of'),
55            'waeup.kofa', target_language=portal_language) \
56            + ' %s' % self.context.display_fullname
57        return '%s%s' % (line0, line1)
58
59    @property
60    def _post_text(self):
61        return """You should note the following as conditions for admission:
62
631. At the point of registration, you will be required to present the originals of your certificate(s), Jamb Original Result, a Birth Certificate or a Declaration of Age Certificate and Evidence of Citizenship Certificate.
642. Please note that the name by which you are hereby admitted and by which you will be registered is the one which will appear on any certificate that the Federal College of Education, Okene may issue to you on successful completion of your programme except there was a change of name by sworn affidavit or marriage certificate in addition to newspaper publication.
653. You are hereby informed that all fees must be paid at the beginning of the academic session. The current school fees can be obtained from the College website.
664. You will present at the time of registration the Medical Certificate of Fitness from the Federal College of Education, Okene Medical Centre.
675. Please, note that due to shortage of accommodations, students shall be given accommodations on first come, first serve basis.
686. The offer is not transferable to another session.
697. You will sign a declaration of good conduct except by deferment on your arrival at the College.
70
71Accept my congratulations.
72
73Yours faithfully
74
75M. S. Adoke
76Deputy Registrar (Admissions)
77For: Registrar
78"""
79
80
81    def render(self):
82        students_utils = getUtility(IStudentsUtils)
83        return students_utils.renderPDFAdmissionLetter(self,
84            self.context.student, omit_fields=self.omit_fields,
85            post_text=self._post_text)
86
87class CustomOnlinePaymentDisplayFormPage(NigeriaOnlinePaymentDisplayFormPage):
88    """ Page to view an online payment ticket
89    """
90    grok.context(ICustomStudentOnlinePayment)
91    form_fields = grok.AutoFields(ICustomStudentOnlinePayment).omit(
92        'provider_amt', 'gateway_amt', 'thirdparty_amt', 'p_item')
93    form_fields[
94        'creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
95    form_fields[
96        'payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
97
98class CustomOnlinePaymentAddFormPage(NigeriaOnlinePaymentAddFormPage):
99    """ Page to add an online payment ticket
100    """
101    form_fields = grok.AutoFields(ICustomStudentOnlinePayment).select(
102        'p_category')
103
104class CustomExportPDFPaymentSlip(NigeriaExportPDFPaymentSlip):
105    """Deliver a PDF slip of the context.
106    """
107    grok.context(ICustomStudentOnlinePayment)
108    form_fields = grok.AutoFields(ICustomStudentOnlinePayment).omit(
109        'provider_amt', 'gateway_amt', 'thirdparty_amt', 'p_item')
110    form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
111    form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
112
113    note = '''
114
115
116The total authorized amount includes an Interswitch transaction charge of 150 Nairas.
117'''
118
119class CustomStartClearancePage(StartClearancePage):
120
121    @property
122    def with_ac(self):
123        mode = getattr(self.context, 'current_mode', None)
124        if mode and mode.startswith('ug'):
125            return True
126        return False
127
128class CustomExportPDFClearanceSlip(NigeriaExportPDFClearanceSlip):
129    """Deliver a PDF slip of the context.
130    """
131
132    @property
133    def form_fields(self):
134        if self.context.is_postgrad:
135            form_fields = grok.AutoFields(
136                ICustomPGStudentClearance).omit('clearance_locked')
137        else:
138            form_fields = grok.AutoFields(
139                ICustomUGStudentClearance).omit('clearance_locked')
140        if not getattr(self.context, 'officer_comment'):
141            form_fields = form_fields.omit('officer_comment')
142        return form_fields
143
144    @property
145    def label(self):
146        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
147
148        line0 = ''
149        if self.context.student.current_mode.startswith('ug'):
150            line0 = 'Directorate of Undergraduate Programme\n'
151        line1 = translate(_('Clearance Slip of'),
152            'waeup.kofa', target_language=portal_language) \
153            + ' %s' % self.context.display_fullname
154        return '%s%s' % (line0, line1)
155
156
157class CustomStudentClearanceEditFormPage(NigeriaStudentClearanceEditFormPage):
158    """ View to edit student clearance data by student
159    """
160
161    def dataNotComplete(self):
162        return False
163
164class CustomBedTicketAddPage(BedTicketAddPage):
165    """ Page to add an online payment ticket
166    """
167    buttonname = _('Create bed ticket')
168    notice = ''
169    with_ac = False
170
171class CustomStudyLevelDisplayFormPage(StudyLevelDisplayFormPage):
172    """ Page to display student study levels
173    """
174    grok.context(ICustomStudentStudyLevel)
175    form_fields = grok.AutoFields(ICustomStudentStudyLevel).omit('level')
176    form_fields[
177        'validation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
178
179class CustomExportPDFCourseRegistrationSlip(
180    NigeriaExportPDFCourseRegistrationSlip):
181    """Deliver a PDF slip of the context.
182    """
183    grok.context(ICustomStudentStudyLevel)
184    form_fields = grok.AutoFields(ICustomStudentStudyLevel).omit('level')
185
186class CustomPaymentsManageFormPage(PaymentsManageFormPage):
187    """ Page to manage the student payments. This manage form page is for
188    both students and students officers. FCEOkene does not allow students
189    to remove any payment ticket.
190    """
191    @property
192    def manage_payments_allowed(self):
193        return checkPermission('waeup.manageStudent', self.context)
Note: See TracBrowser for help on using the repository browser.