## $Id: viewlets.py 11613 2014-04-30 14:38:41Z 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 waeup.kofa.interfaces import REQUESTED from waeup.kofa.browser.viewlets import ManageActionButton from waeup.uniben.students.interfaces import ( ICustomStudentStudyCourse, ICustomStudentStudyLevel) from waeup.kofa.students.viewlets import ( FileDisplay, FileUpload, Image) from waeup.kofa.students.browser import ( ExportPDFClearanceSlipPage, StudyCourseDisplayFormPage, StudyLevelDisplayFormPage) from kofacustom.nigeria.interfaces import MessageFactory as _ class StudyCourseEditActionButton(ManageActionButton): grok.order(1) grok.context(ICustomStudentStudyCourse) grok.view(StudyCourseDisplayFormPage) grok.require('waeup.clearStudent') text = _('Edit level') target = 'edit_level' @property def target_url(self): if self.context.is_current and self.context.student.state == REQUESTED: return self.view.url(self.view.context, self.target) return False class CourseResultSlipActionButton(ManageActionButton): grok.order(6) grok.context(ICustomStudentStudyLevel) grok.view(StudyLevelDisplayFormPage) grok.require('waeup.viewStudent') icon = 'actionicon_pdf.png' text = _('Download course result slip') target = 'course_result_slip.pdf' @property def target_url(self): return self.view.url(self.view.context, self.target) # JAMB Letter class JAMBLetterDisplay(FileDisplay): """JAMB Letter display viewlet. """ grok.order(19) label = _(u'JAMB Letter') title = _(u'JAMB Letter') download_name = u'jamb_letter' class JAMBLetterSlip(JAMBLetterDisplay): grok.view(ExportPDFClearanceSlipPage) class JAMBLetterUpload(FileUpload): """JAMB Letter upload viewlet. """ grok.order(19) label = _(u'JAMB Letter') title = _(u'JAMB Letter Scan') mus = 1024 * 150 download_name = u'jamb_letter' class JAMBLetterImage(Image): """Renders JAMB Letter scan. """ grok.name('jamb_letter') download_name = u'jamb_letter' # Affidavit of Non-Membership of Secret Cults class SecrCultsStatementDisplay(FileDisplay): """Affidavit of Non-Membership of Secret Cults display viewlet. """ grok.order(20) label = _(u'Affidavit of Non-Membership of Secret Cults') title = _(u'Affidavit of Non-Membership of Secret Cults') download_name = u'secr_cults' class SecrCultsStatementSlip(SecrCultsStatementDisplay): grok.view(ExportPDFClearanceSlipPage) class SecrCultsStatementUpload(FileUpload): """Affidavit of Non-Membership of Secret Cults upload viewlet. """ grok.order(20) label = _(u'Affidavit of Non-Membership of Secret Cults') title = _(u'Affidavit of Non-Membership of Secret Cults Scan') mus = 1024 * 150 download_name = u'secr_cults' class SecrCultsStatementImage(Image): """Renders Affidavit of Non-Membership of Secret Cults scan. """ grok.name('secr_cults') download_name = u'secr_cults' # Fingerprints class LeftThumbPrintDisplay(FileDisplay): """Left thumb fingerprint display viewlet. """ grok.order(21) label = _(u'Left Thumb Fingerprint') title = _(u'Left Thumb Fingerprint Minutiae') download_name = u'finger1.fpm' class LeftThumbPrintSlip(LeftThumbPrintDisplay): """Mentions scanned fingerprint on slip. Fingerprint minutiae is not printet. """ grok.view(ExportPDFClearanceSlipPage) class LeftThumbPrintUpload(FileUpload): """Left thumb fingerprint upload viewlet. """ grok.order(21) grok.require('waeup.manageStudent') label = _(u'Left Thumb Fingerprint') title = _(u'Left Thumb Fingerprint Minutiae') mus = 1024 * 5 download_name = u'finger1.fpm' class LeftThumbPrintImage(Image): """Renders left thumb fingerprint minutiae for download. """ grok.name('finger1.fpm') download_name = u'finger1.fpm'