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