source: main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/browser.py @ 16142

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

Fix some typos.

  • Property svn:keywords set to Id
File size: 12.4 KB
RevLine 
[10765]1## $Id: browser.py 16128 2020-06-25 05:24:54Z 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.schema.interfaces import ConstraintNotSatisfied
21from zope.component import getUtility
22from hurry.workflow.interfaces import IWorkflowInfo
[16127]23from waeup.kofa.interfaces import (REQUESTED, IExtFileStore, IKofaUtils,
24    academic_sessions_vocab)
[10765]25from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget
[15802]26from waeup.kofa.browser.layout import (
27    action, jsaction, UtilityView, KofaEditFormPage)
[10765]28from waeup.kofa.students.browser import (
29    StudyLevelEditFormPage, StudyLevelDisplayFormPage,
[13062]30    StudentBasePDFFormPage, ExportPDFCourseRegistrationSlip,
[10765]31    CourseTicketDisplayFormPage, StudentTriggerTransitionFormPage,
[16015]32    StartClearancePage, BalancePaymentAddFormPage,
[16127]33    ExportPDFAdmissionSlip,
[10765]34    msave, emit_lock_message)
[15802]35from waeup.kofa.students.interfaces import (
36    IStudentsUtils, ICourseTicket, IStudent)
[16127]37from waeup.kofa.students.vocabularies import StudyLevelSource
[10765]38from waeup.kofa.students.workflow import FORBIDDEN_POSTGRAD_TRANS
39from kofacustom.nigeria.students.browser import (
40    NigeriaOnlinePaymentDisplayFormPage,
[15704]41    NigeriaStudentBaseDisplayFormPage,
[10765]42    NigeriaStudentBaseManageFormPage,
43    NigeriaStudentClearanceEditFormPage,
44    NigeriaOnlinePaymentAddFormPage,
[13062]45    NigeriaExportPDFPaymentSlip,
46    NigeriaExportPDFClearanceSlip,
[15696]47    NigeriaExportPDFCourseRegistrationSlip,
[15704]48    NigeriaStudentBaseEditFormPage,
[15722]49    NigeriaBedTicketAddPage,
[15999]50    NigeriaAccommodationManageFormPage,
51    NigeriaAccommodationDisplayFormPage,
[10765]52    )
53
[15563]54from kofacustom.iuokada.students.interfaces import (
[10765]55    ICustomStudentOnlinePayment, ICustomStudentStudyCourse,
[15859]56    ICustomStudentStudyLevel, ICustomStudentBase, ICustomStudent)
[15563]57from kofacustom.iuokada.interfaces import MessageFactory as _
[10765]58
[15704]59class CustomStudentBaseDisplayFormPage(NigeriaStudentBaseDisplayFormPage):
60    """ Page to display student base data
61    """
62    form_fields = grok.AutoFields(ICustomStudentBase).omit(
63        'password', 'suspended', 'suspended_comment', 'flash_notice')
64
65class CustomStudentBaseManageFormPage(NigeriaStudentBaseManageFormPage):
66    """ View to manage student base data
67    """
68    form_fields = grok.AutoFields(ICustomStudentBase).omit(
[15870]69        'student_id', 'adm_code', 'suspended',
70        'financially_cleared_by', 'financial_clearance_date')
[15704]71
72class StudentBaseEditFormPage(NigeriaStudentBaseEditFormPage):
73    """ View to edit student base data
74    """
75    form_fields = grok.AutoFields(ICustomStudentBase).select(
76        'email', 'email2', 'parents_email', 'phone',)
77
[15696]78class CustomExportPDFCourseRegistrationSlip(
79    NigeriaExportPDFCourseRegistrationSlip):
80    """Deliver a PDF slip of the context.
81    """
82
83    def _signatures(self):
84        return (
85                ['Student Signature'],
86                ['HoD / Course Adviser Signature'],
87                ['College Officer Signature'],
88                ['Dean Signature']
89                )
90
91    #def _sigsInFooter(self):
92    #    return (_('Student'),
93    #            _('HoD / Course Adviser'),
94    #            _('College Officer'),
95    #            _('Dean'),
96    #            )
[15720]97    #    return ()
98
[15999]99class CustomAccommodationDisplayFormPage(NigeriaAccommodationDisplayFormPage):
100    """ Page to view bed tickets.
101    """
102    with_hostel_selection = True
103
[15722]104class CustomAccommodationManageFormPage(NigeriaAccommodationManageFormPage):
105    """ Page to manage bed tickets.
106    This manage form page is for both students and students officers.
107    """
108    with_hostel_selection = True
109
[15720]110class CustomBedTicketAddPage(NigeriaBedTicketAddPage):
111    """ Page to add a bed ticket
112    """
113    with_ac = False
[15802]114    with_bedselection = True
115
116class StudentGetMatricNumberPage(UtilityView, grok.View):
117    """ Construct and set the matriculation number.
118    """
119    grok.context(IStudent)
120    grok.name('get_matric_number')
[15805]121    grok.require('waeup.manageStudent')
[15802]122
123    def update(self):
124        students_utils = getUtility(IStudentsUtils)
125        msg, mnumber = students_utils.setMatricNumber(self.context)
126        if msg:
127            self.flash(msg, type="danger")
128        else:
129            self.flash(_('Matriculation number %s assigned.' % mnumber))
130            self.context.writeLogMessage(self, '%s assigned' % mnumber)
131        self.redirect(self.url(self.context))
132        return
133
134    def render(self):
[15859]135        return
136
137class SwitchLibraryAccessView(UtilityView, grok.View):
138    """ Switch the library attribute
139    """
140    grok.context(ICustomStudent)
141    grok.name('switch_library_access')
142    grok.require('waeup.switchLibraryAccess')
143
144    def update(self):
145        if self.context.library:
146            self.context.library = False
147            self.context.writeLogMessage(self, 'library access disabled')
148            self.flash(_('Library access disabled'))
149        else:
150            self.context.library = True
151            self.context.writeLogMessage(self, 'library access enabled')
152            self.flash(_('Library access enabled'))
153        self.redirect(self.url(self.context))
154        return
155
156    def render(self):
157        return
158
159class ExportLibIdCard(UtilityView, grok.View):
160    """Deliver an id card for the library.
161    """
162    grok.context(ICustomStudent)
163    grok.name('lib_idcard.pdf')
164    grok.require('waeup.viewStudent')
165    prefix = 'form'
166
167    label = u"Library Clearance"
168
169    omit_fields = (
170        'suspended', 'email', 'phone',
171        'adm_code', 'suspended_comment',
172        'date_of_birth',
173        'current_mode', 'certificate',
174        'entry_session',
175        'flash_notice')
176
177    form_fields = []
178
179    def _sigsInFooter(self):
180        isStudent = getattr(
181            self.request.principal, 'user_type', None) == 'student'
182        if isStudent:
183            return ''
184        return (_("Date, Reader's Signature"),
185                _("Date, Circulation Librarian's Signature"),
186                )
187
188    def update(self):
189        if not self.context.library:
190            self.flash(_('Forbidden!'), type="danger")
191            self.redirect(self.url(self.context))
192        return
193
194    @property
195    def note(self):
196        return """
197<br /><br /><br /><br /><font size='12'>
198This is to certify that the bearer whose photograph and other details appear
199 overleaf is a registered user of the <b>University Library</b>.
200 The card is not transferable. A replacement fee is charged for a loss,
201 mutilation or otherwise. If found, please, return to the University Library,
202 Igbinedion University, Okada.
203</font>
204
205"""
206        return
207
208    def render(self):
209        studentview = StudentBasePDFFormPage(self.context.student,
210            self.request, self.omit_fields)
211        students_utils = getUtility(IStudentsUtils)
212        return students_utils.renderPDF(
213            self, 'lib_idcard',
214            self.context.student, studentview,
215            omit_fields=self.omit_fields,
216            sigs_in_footer=self._sigsInFooter(),
[15937]217            note=self.note)
218
219class CustomStartClearancePage(StartClearancePage):
[16015]220    with_ac = False
221
222class CustomBalancePaymentAddFormPage(BalancePaymentAddFormPage):
[16127]223    grok.require('waeup.payStudent')
224
225class CustomExportPDFAdmissionSlip(ExportPDFAdmissionSlip):
226    """Deliver a PDF Admission slip.
227    """
228
229    omit_fields = ('date_of_birth', 'current_level', 'current_mode',
230                   'entry_session')
231
232    @property
233    def session(self):
234        return academic_sessions_vocab.getTerm(
235            self.context.entry_session).title
236
237    @property
238    def level(self):
239        studylevelsource = StudyLevelSource()
240        return studylevelsource.factory.getTitle(
241            self.context['studycourse'].certificate, self.context.current_level)
242
243    @property
244    def label(self):
245        return 'OFFER OF PROVISIONAL ADMISSION \nFOR %s SESSION' % self.session
246
247    @property
248    def pre_text(self):
249        return (
250            'Following your performance in the screening exercise '
251            'for the %s academic session, I am pleased to inform '
252            'you that you have been offered provisional admission into the '
253            'Igbinedion University, Okada as follows:' % self.session)
254
255    @property
256    def post_text(self):
257        return """
[16128]258Please note that at the point of registration for your programme of study (course), you will be required to present the following documents: Current UTME result slip, WAEC/NECO (0' Level) result, birth certificate or sworn affidavit of age, and health certificate from a recognized medical centre.
[16127]259
[16128]260All credentials (original) will be checked during registration. This admission will be cancelled at any point in time it is found that your claims in the application form are false.
[16127]261
[16128]262You are required to show evidence of the result/credentials you presented on application for admission.
[16127]263
[16128]264Fees can be paid using any of the following options:
[16127]265
2661. Fees can be paid on through you portal page. INSTRUCTIONS can be found below "FEES PAYMENT PROCEDURE" for the options you have to make your payment, as well as instructions on how to use your preferred payment option.
[16128]2672. If you choose to use the bank payment option, you can pay at any branch of the following banks through etranzact platform only: Access Bank, First Bank, Zenith Bank, and Keystone Bank.
[16127]268
269Kindly note the following:
270
[16128]2711. Fees indicated on the fee structure page are valid for the current session only.
2722. Your Student Id (indicated above) is your login to the university portal.
2733. As an indication of your acceptance of this offer of admission, you should pay a non-refundable acceptance deposit of N200,000. Further note that the N200,000 deposit is part of the tuition fee for the session. Failure to pay after the expiration of two weeks may lead to forfeiture of admission.
2744.      All fees must be paid in full at the beginning of the session, as basis for accommodation, registration and attendance of lectures. This is the rule for all students at all levels. Installmental payments of not more than two installments may be allowed under exceptional circumstances.
[16127]2755.      Fees once paid are not refundable.
2766. It is advisable that you keep the original receipts of fees paid and present them on demand.
277
[16128]278Accommodation: Accommodation in university hostels is compulsory for every student. No student is allowed to live outside the hostels. Any student who does so will be expelled from the university. For further details, please refer to the bursary for information on fees.
[16127]279
280Food: Food is available in cafeteria on "pay-as-you-eat" basis.
281
282Resumption Date: The University opens for fresh students on Saturday, 28th September, 2020. All newly admitted students are expected to report on that date.
283
[16128]284Registration/Orientation Programme: Orientation programme/registration for fresh students will start on Monday, 30th September 2020. Registration ends on 30th October. A late registration fee of N50,000 will be charged after this date. All credentials, O'Level Results, Birth Certificate/Age Declaration, UTME Result Slip (original) will be checked during registration. This admission will be cancelled at any point in time if it is found that any of your claims in the application form is false.
[16127]285
[16128]286Transport Facility: The university provides a compulsory shuttle bus service to all students at a fee already included in the other charges.
[16127]287
288Kindly note that fresh students are not allowed the use of private vehicles.
289
290Conduct: All students are expected to conduct themselves properly and dress decently on campus, as well as obey all rules and regulations as failure to comply will attract appropriate sanctions.
291
292We wish you a successful academic career In Igbinedion University.
293
294Congratulations!
295
296L.P.E. Jagbedia
297Ag. Registrar
298registrar@iuokada.edo.ng
29908037349527
300"""
301
302    def render(self):
303        students_utils = getUtility(IStudentsUtils)
304        return students_utils.renderPDFAdmissionLetter(self,
305            self.context.student, omit_fields=self.omit_fields,
306            pre_text=self.pre_text, post_text=self.post_text)
Note: See TracBrowser for help on using the repository browser.