[8911] | 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 | ## |
---|
| 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 ( |
---|
[14591] | 28 | StartClearancePage, BedTicketAddPage, |
---|
[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, |
---|
| 37 | NigeriaExportPDFCourseRegistrationSlip |
---|
[9190] | 38 | ) |
---|
[8911] | 39 | |
---|
[10019] | 40 | from waeup.fceokene.students.interfaces import ( |
---|
[14591] | 41 | ICustomStudentOnlinePayment, ICustomUGStudentClearance, |
---|
| 42 | ICustomStudentStudyLevel) |
---|
[8911] | 43 | |
---|
[13060] | 44 | class CustomExportPDFAdmissionSlip(ExportPDFAdmissionSlip): |
---|
[9945] | 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 | |
---|
[15507] | 59 | @property |
---|
| 60 | def _post_text(self): |
---|
| 61 | return """You should note the following as conditions for admission: |
---|
| 62 | |
---|
[15509] | 63 | 1. 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. |
---|
| 64 | 2. 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. |
---|
| 65 | 3. 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. |
---|
| 66 | 4. You will present at the time of registration the Medical Certificate of Fitness from the Federal College of Education, Okene Medical Centre. |
---|
| 67 | 5. Please, note that due to shortage of accommodations, students shall be given accommodations on first come, first serve basis. |
---|
| 68 | 6. The offer is not transferable to another session. |
---|
| 69 | 7. You will sign a declaration of good conduct except by deferment on your arrival at the College. |
---|
[15507] | 70 | |
---|
| 71 | Accept my congratulations. |
---|
| 72 | |
---|
| 73 | Yours faithfully |
---|
| 74 | |
---|
| 75 | M. S. Adoke |
---|
| 76 | Deputy Registrar (Admissions) |
---|
| 77 | For: 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 | |
---|
[8911] | 87 | class CustomOnlinePaymentDisplayFormPage(NigeriaOnlinePaymentDisplayFormPage): |
---|
| 88 | """ Page to view an online payment ticket |
---|
| 89 | """ |
---|
| 90 | grok.context(ICustomStudentOnlinePayment) |
---|
[9780] | 91 | form_fields = grok.AutoFields(ICustomStudentOnlinePayment).omit( |
---|
[9986] | 92 | 'provider_amt', 'gateway_amt', 'thirdparty_amt', 'p_item') |
---|
[8911] | 93 | form_fields[ |
---|
| 94 | 'creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
| 95 | form_fields[ |
---|
| 96 | 'payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
| 97 | |
---|
| 98 | class CustomOnlinePaymentAddFormPage(NigeriaOnlinePaymentAddFormPage): |
---|
| 99 | """ Page to add an online payment ticket |
---|
| 100 | """ |
---|
| 101 | form_fields = grok.AutoFields(ICustomStudentOnlinePayment).select( |
---|
| 102 | 'p_category') |
---|
| 103 | |
---|
[13060] | 104 | class CustomExportPDFPaymentSlip(NigeriaExportPDFPaymentSlip): |
---|
[8911] | 105 | """Deliver a PDF slip of the context. |
---|
| 106 | """ |
---|
| 107 | grok.context(ICustomStudentOnlinePayment) |
---|
[9780] | 108 | form_fields = grok.AutoFields(ICustomStudentOnlinePayment).omit( |
---|
[9986] | 109 | 'provider_amt', 'gateway_amt', 'thirdparty_amt', 'p_item') |
---|
[8911] | 110 | form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
[9156] | 111 | form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
| 112 | |
---|
[10529] | 113 | note = ''' |
---|
| 114 | |
---|
| 115 | |
---|
| 116 | The total authorized amount includes an Interswitch transaction charge of 150 Nairas. |
---|
| 117 | ''' |
---|
| 118 | |
---|
[9156] | 119 | class CustomStartClearancePage(StartClearancePage): |
---|
| 120 | |
---|
[9953] | 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 |
---|
[9156] | 127 | |
---|
[13060] | 128 | class CustomExportPDFClearanceSlip(NigeriaExportPDFClearanceSlip): |
---|
[10019] | 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 | |
---|
[9181] | 157 | class CustomStudentClearanceEditFormPage(NigeriaStudentClearanceEditFormPage): |
---|
| 158 | """ View to edit student clearance data by student |
---|
| 159 | """ |
---|
| 160 | |
---|
| 161 | def dataNotComplete(self): |
---|
[9190] | 162 | return False |
---|
| 163 | |
---|
[9406] | 164 | class CustomBedTicketAddPage(BedTicketAddPage): |
---|
[9190] | 165 | """ Page to add an online payment ticket |
---|
| 166 | """ |
---|
| 167 | buttonname = _('Create bed ticket') |
---|
| 168 | notice = '' |
---|
[14591] | 169 | with_ac = False |
---|
| 170 | |
---|
| 171 | class 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 | |
---|
| 179 | class CustomExportPDFCourseRegistrationSlip( |
---|
| 180 | NigeriaExportPDFCourseRegistrationSlip): |
---|
| 181 | """Deliver a PDF slip of the context. |
---|
| 182 | """ |
---|
| 183 | grok.context(ICustomStudentStudyLevel) |
---|
[15304] | 184 | form_fields = grok.AutoFields(ICustomStudentStudyLevel).omit('level') |
---|
| 185 | |
---|
| 186 | class 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) |
---|