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 | ## |
---|
18 | import grok |
---|
19 | from zope.i18n import translate |
---|
20 | from zope.schema.interfaces import ConstraintNotSatisfied |
---|
21 | from zope.component import getUtility |
---|
22 | from hurry.workflow.interfaces import IWorkflowInfo |
---|
23 | from waeup.kofa.interfaces import (REQUESTED, IExtFileStore, IKofaUtils, |
---|
24 | academic_sessions_vocab) |
---|
25 | from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget |
---|
26 | from waeup.kofa.browser.layout import ( |
---|
27 | action, jsaction, UtilityView, KofaEditFormPage) |
---|
28 | from waeup.kofa.students.browser import ( |
---|
29 | StudyLevelEditFormPage, StudyLevelDisplayFormPage, |
---|
30 | StudentBasePDFFormPage, ExportPDFCourseRegistrationSlip, |
---|
31 | CourseTicketDisplayFormPage, StudentTriggerTransitionFormPage, |
---|
32 | StartClearancePage, BalancePaymentAddFormPage, |
---|
33 | ExportPDFAdmissionSlip, |
---|
34 | msave, emit_lock_message) |
---|
35 | from waeup.kofa.students.interfaces import ( |
---|
36 | IStudentsUtils, ICourseTicket, IStudent) |
---|
37 | from waeup.kofa.students.vocabularies import StudyLevelSource |
---|
38 | from waeup.kofa.students.workflow import FORBIDDEN_POSTGRAD_TRANS |
---|
39 | from kofacustom.nigeria.students.browser import ( |
---|
40 | NigeriaOnlinePaymentDisplayFormPage, |
---|
41 | NigeriaStudentBaseDisplayFormPage, |
---|
42 | NigeriaStudentBaseManageFormPage, |
---|
43 | NigeriaStudentClearanceEditFormPage, |
---|
44 | NigeriaOnlinePaymentAddFormPage, |
---|
45 | NigeriaExportPDFPaymentSlip, |
---|
46 | NigeriaExportPDFClearanceSlip, |
---|
47 | NigeriaExportPDFCourseRegistrationSlip, |
---|
48 | NigeriaStudentBaseEditFormPage, |
---|
49 | NigeriaBedTicketAddPage, |
---|
50 | NigeriaAccommodationManageFormPage, |
---|
51 | NigeriaAccommodationDisplayFormPage, |
---|
52 | ) |
---|
53 | |
---|
54 | from kofacustom.iuokada.students.interfaces import ( |
---|
55 | ICustomStudentOnlinePayment, ICustomStudentStudyCourse, |
---|
56 | ICustomStudentStudyLevel, ICustomStudentBase, ICustomStudent) |
---|
57 | from kofacustom.iuokada.interfaces import MessageFactory as _ |
---|
58 | |
---|
59 | class 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 | |
---|
65 | class CustomStudentBaseManageFormPage(NigeriaStudentBaseManageFormPage): |
---|
66 | """ View to manage student base data |
---|
67 | """ |
---|
68 | form_fields = grok.AutoFields(ICustomStudentBase).omit( |
---|
69 | 'student_id', 'adm_code', 'suspended', |
---|
70 | 'financially_cleared_by', 'financial_clearance_date') |
---|
71 | |
---|
72 | class StudentBaseEditFormPage(NigeriaStudentBaseEditFormPage): |
---|
73 | """ View to edit student base data |
---|
74 | """ |
---|
75 | form_fields = grok.AutoFields(ICustomStudentBase).select( |
---|
76 | 'email', 'email2', 'parents_email', 'phone',) |
---|
77 | |
---|
78 | class 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 | # ) |
---|
97 | # return () |
---|
98 | |
---|
99 | class CustomAccommodationDisplayFormPage(NigeriaAccommodationDisplayFormPage): |
---|
100 | """ Page to view bed tickets. |
---|
101 | """ |
---|
102 | with_hostel_selection = True |
---|
103 | |
---|
104 | class 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 | |
---|
110 | class CustomBedTicketAddPage(NigeriaBedTicketAddPage): |
---|
111 | """ Page to add a bed ticket |
---|
112 | """ |
---|
113 | with_ac = False |
---|
114 | with_bedselection = True |
---|
115 | |
---|
116 | class StudentGetMatricNumberPage(UtilityView, grok.View): |
---|
117 | """ Construct and set the matriculation number. |
---|
118 | """ |
---|
119 | grok.context(IStudent) |
---|
120 | grok.name('get_matric_number') |
---|
121 | grok.require('waeup.manageStudent') |
---|
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): |
---|
135 | return |
---|
136 | |
---|
137 | class 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 | |
---|
159 | class 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'> |
---|
198 | This 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(), |
---|
217 | note=self.note) |
---|
218 | |
---|
219 | class CustomStartClearancePage(StartClearancePage): |
---|
220 | with_ac = False |
---|
221 | |
---|
222 | class CustomBalancePaymentAddFormPage(BalancePaymentAddFormPage): |
---|
223 | grok.require('waeup.payStudent') |
---|
224 | |
---|
225 | class 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 """ |
---|
258 | Please 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. |
---|
259 | |
---|
260 | All 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. |
---|
261 | |
---|
262 | You are required to show evidence of the result/credentials you presented on application for admission. |
---|
263 | |
---|
264 | Fees can be paid using any of the following options: |
---|
265 | |
---|
266 | 1. 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. |
---|
267 | 2. 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. |
---|
268 | |
---|
269 | Kindly note the following: |
---|
270 | |
---|
271 | 1. Fees indicated on the fee structure page are valid for the current session only. |
---|
272 | 2. Your Student Id (indicated above) is your login to the university portal. |
---|
273 | 3. 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. |
---|
274 | 4. 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. |
---|
275 | 5. Fees once paid are not refundable. |
---|
276 | 6. It is advisable that you keep the original receipts of fees paid and present them on demand. |
---|
277 | |
---|
278 | Accommodation: 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. |
---|
279 | |
---|
280 | Food: Food is available in cafeteria on "pay-as-you-eat" basis. |
---|
281 | |
---|
282 | Resumption Date: The University opens for fresh students on Saturday, 28th September, 2020. All newly admitted students are expected to report on that date. |
---|
283 | |
---|
284 | Registration/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. |
---|
285 | |
---|
286 | Transport Facility: The university provides a compulsory shuttle bus service to all students at a fee already included in the other charges. |
---|
287 | |
---|
288 | Kindly note that fresh students are not allowed the use of private vehicles. |
---|
289 | |
---|
290 | Conduct: 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 | |
---|
292 | We wish you a successful academic career In Igbinedion University. |
---|
293 | |
---|
294 | Congratulations! |
---|
295 | |
---|
296 | L.P.E. Jagbedia |
---|
297 | Ag. Registrar |
---|
298 | registrar@iuokada.edo.ng |
---|
299 | 08037349527 |
---|
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) |
---|