source: main/waeup.uniben/trunk/src/waeup/uniben/students/viewlets.py @ 11752

Last change on this file since 11752 was 11613, checked in by Henrik Bettermann, 11 years ago

Only managers are allowed to upload fingerprint data.

  • Property svn:keywords set to Id
File size: 4.5 KB
Line 
1## $Id: viewlets.py 11613 2014-04-30 14:38:41Z henrik $
2##
3## Copyright (C) 2011 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
19import grok
20from waeup.kofa.interfaces import REQUESTED
21from waeup.kofa.browser.viewlets import ManageActionButton
22from waeup.uniben.students.interfaces import (
23    ICustomStudentStudyCourse, ICustomStudentStudyLevel)
24from waeup.kofa.students.viewlets import (
25    FileDisplay, FileUpload, Image)
26from waeup.kofa.students.browser import (
27    ExportPDFClearanceSlipPage, StudyCourseDisplayFormPage,
28    StudyLevelDisplayFormPage)
29
30from kofacustom.nigeria.interfaces import MessageFactory as _
31
32class StudyCourseEditActionButton(ManageActionButton):
33    grok.order(1)
34    grok.context(ICustomStudentStudyCourse)
35    grok.view(StudyCourseDisplayFormPage)
36    grok.require('waeup.clearStudent')
37    text = _('Edit level')
38    target = 'edit_level'
39
40    @property
41    def target_url(self):
42        if self.context.is_current and self.context.student.state == REQUESTED:
43            return self.view.url(self.view.context, self.target)
44        return False
45
46class CourseResultSlipActionButton(ManageActionButton):
47    grok.order(6)
48    grok.context(ICustomStudentStudyLevel)
49    grok.view(StudyLevelDisplayFormPage)
50    grok.require('waeup.viewStudent')
51    icon = 'actionicon_pdf.png'
52    text = _('Download course result slip')
53    target = 'course_result_slip.pdf'
54
55    @property
56    def target_url(self):
57        return self.view.url(self.view.context, self.target)
58
59# JAMB Letter
60
61class JAMBLetterDisplay(FileDisplay):
62    """JAMB Letter display viewlet.
63    """
64    grok.order(19)
65    label = _(u'JAMB Letter')
66    title = _(u'JAMB Letter')
67    download_name = u'jamb_letter'
68
69class JAMBLetterSlip(JAMBLetterDisplay):
70    grok.view(ExportPDFClearanceSlipPage)
71
72class JAMBLetterUpload(FileUpload):
73    """JAMB Letter upload viewlet.
74    """
75    grok.order(19)
76    label = _(u'JAMB Letter')
77    title = _(u'JAMB Letter Scan')
78    mus = 1024 * 150
79    download_name = u'jamb_letter'
80
81class JAMBLetterImage(Image):
82    """Renders JAMB Letter scan.
83    """
84    grok.name('jamb_letter')
85    download_name = u'jamb_letter'
86
87# Affidavit of Non-Membership of Secret Cults
88
89class SecrCultsStatementDisplay(FileDisplay):
90    """Affidavit of Non-Membership of Secret Cults display viewlet.
91    """
92    grok.order(20)
93    label = _(u'Affidavit of Non-Membership of Secret Cults')
94    title = _(u'Affidavit of Non-Membership of Secret Cults')
95    download_name = u'secr_cults'
96
97class SecrCultsStatementSlip(SecrCultsStatementDisplay):
98    grok.view(ExportPDFClearanceSlipPage)
99
100class SecrCultsStatementUpload(FileUpload):
101    """Affidavit of Non-Membership of Secret Cults upload viewlet.
102    """
103    grok.order(20)
104    label = _(u'Affidavit of Non-Membership of Secret Cults')
105    title = _(u'Affidavit of Non-Membership of Secret Cults Scan')
106    mus = 1024 * 150
107    download_name = u'secr_cults'
108
109class SecrCultsStatementImage(Image):
110    """Renders Affidavit of Non-Membership of Secret Cults scan.
111    """
112    grok.name('secr_cults')
113    download_name = u'secr_cults'
114
115# Fingerprints
116
117class LeftThumbPrintDisplay(FileDisplay):
118    """Left thumb fingerprint display viewlet.
119    """
120    grok.order(21)
121    label = _(u'Left Thumb Fingerprint')
122    title = _(u'Left Thumb Fingerprint Minutiae')
123    download_name = u'finger1.fpm'
124
125class LeftThumbPrintSlip(LeftThumbPrintDisplay):
126    """Mentions scanned fingerprint on slip.
127
128    Fingerprint minutiae is not printet.
129    """
130    grok.view(ExportPDFClearanceSlipPage)
131
132class LeftThumbPrintUpload(FileUpload):
133    """Left thumb fingerprint upload viewlet.
134    """
135    grok.order(21)
136    grok.require('waeup.manageStudent')
137    label = _(u'Left Thumb Fingerprint')
138    title = _(u'Left Thumb Fingerprint Minutiae')
139    mus = 1024 * 5
140    download_name = u'finger1.fpm'
141
142class LeftThumbPrintImage(Image):
143    """Renders left thumb fingerprint minutiae for download.
144    """
145    grok.name('finger1.fpm')
146    download_name = u'finger1.fpm'
Note: See TracBrowser for help on using the repository browser.