## $Id: viewlets.py 14913 2017-11-29 10:57:30Z henrik $ ## ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## import grok from zope.component import getUtility from waeup.kofa.interfaces import REQUESTED from waeup.kofa.browser.viewlets import ManageActionButton from waeup.kofa.students.interfaces import IStudentsUtils from kofacustom.dspg.students.interfaces import ( ICustomStudentStudyCourse, ICustomStudentStudyLevel) from waeup.kofa.students.fileviewlets import ( StudentFileDisplay, StudentFileUpload, StudentImage) from waeup.kofa.students.browser import ( ExportPDFClearanceSlip, StudyCourseDisplayFormPage, StudyLevelDisplayFormPage) from kofacustom.nigeria.interfaces import MessageFactory as _ # ND Result class NDResultDisplay(StudentFileDisplay): """ND Result display viewlet. """ grok.order(19) label = _(u'ND Result') title = _(u'ND Result') download_name = u'nd_result' class NDResultSlip(NDResultDisplay): grok.view(ExportPDFClearanceSlip) class NDResultUpload(StudentFileUpload): """ND Result upload viewlet. """ grok.order(19) label = _(u'ND Result') title = _(u'ND Result Scan') mus = 1024 * 250 download_name = u'nd_result' @property def show_viewlet(self): students_utils = getUtility(IStudentsUtils) if self.__name__ in students_utils.SKIP_UPLOAD_VIEWLETS: return False cm = getattr(self.context,'current_mode', None) return cm and cm.startswith('hnd') class NDResultImage(StudentImage): """Renders ND Result scan. """ grok.name('nd_result') download_name = u'nd_result' # O Level Result class OLevelResultDisplay(StudentFileDisplay): """O Level Result display viewlet. """ grok.order(19) label = _(u'O Level Result') title = _(u'O Level Result') download_name = u'o_level_result' class OLevelResultSlip(OLevelResultDisplay): grok.view(ExportPDFClearanceSlip) class OLevelResultUpload(StudentFileUpload): """O Level Result upload viewlet. """ grok.order(19) label = _(u'O Level Result') title = _(u'O Level Result Scan') mus = 1024 * 250 download_name = u'o_level_result' class OLevelResultImage(StudentImage): """Renders O Level Result scan. """ grok.name('o_level_result') download_name = u'o_level_result' # IT Letter class ITLetterDisplay(StudentFileDisplay): """IT Letter display viewlet. """ grok.order(19) label = _(u'IT Letter') title = _(u'IT Letter') download_name = u'it_letter' class ITLetterSlip(ITLetterDisplay): grok.view(ExportPDFClearanceSlip) class ITLetterUpload(StudentFileUpload): """IT Letter upload viewlet. """ grok.order(19) label = _(u'IT Letter') title = _(u'IT Letter Scan') mus = 1024 * 250 download_name = u'it_letter' @property def show_viewlet(self): students_utils = getUtility(IStudentsUtils) if self.__name__ in students_utils.SKIP_UPLOAD_VIEWLETS: return False cm = getattr(self.context,'current_mode', None) return cm and cm.startswith('hnd') class ITLetterImage(StudentImage): """Renders IT Letter scan. """ grok.name('it_letter') download_name = u'it_letter' # JAMB Result class JAMBResultDisplay(StudentFileDisplay): """JAMB Result display viewlet. """ grok.order(19) label = _(u'JAMB Result') title = _(u'JAMB Result') download_name = u'jamb_result' class JAMBResultSlip(JAMBResultDisplay): grok.view(ExportPDFClearanceSlip) class JAMBResultUpload(StudentFileUpload): """JAMB Result upload viewlet. """ grok.order(19) title = _(u'JAMB Result Scan') mus = 1024 * 250 download_name = u'jamb_result' @property def label(self): cm = getattr(self.context,'current_mode', None) if cm and cm.startswith('hnd'): return u'JAMB Result / ND Admission Letter (optional)' else: return u'JAMB Result' class JAMBResultImage(StudentImage): """Renders JAMB Result scan. """ grok.name('jamb_result') download_name = u'jamb_result' # Additional Document class AdditionalDocDisplay(StudentFileDisplay): """Additional Document display viewlet. """ grok.order(19) label = _(u'Additional Document') title = _(u'Additional Document') download_name = u'additional_doc' class AdditionalDocSlip(AdditionalDocDisplay): grok.view(ExportPDFClearanceSlip) class AdditionalDocUpload(StudentFileUpload): """Additional Document upload viewlet. """ grok.order(19) title = _(u'Additional Document Scan') mus = 1024 * 250 download_name = u'additional_doc' label = _(u'Additional Document') class AdditionalDocImage(StudentImage): """Renders Additional Document scan. """ grok.name('additional_doc') download_name = u'additional_doc'