source: main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/viewlets.py @ 15284

Last change on this file since 15284 was 14913, checked in by Henrik Bettermann, 7 years ago

Add viewlet.

  • Property svn:keywords set to Id
File size: 5.5 KB
Line 
1## $Id: viewlets.py 14913 2017-11-29 10:57:30Z 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 zope.component import getUtility
21from waeup.kofa.interfaces import REQUESTED
22from waeup.kofa.browser.viewlets import ManageActionButton
23from waeup.kofa.students.interfaces import IStudentsUtils
24from kofacustom.dspg.students.interfaces import (
25    ICustomStudentStudyCourse, ICustomStudentStudyLevel)
26from waeup.kofa.students.fileviewlets import (
27    StudentFileDisplay, StudentFileUpload, StudentImage)
28from waeup.kofa.students.browser import (
29    ExportPDFClearanceSlip, StudyCourseDisplayFormPage,
30    StudyLevelDisplayFormPage)
31
32from kofacustom.nigeria.interfaces import MessageFactory as _
33
34# ND Result
35
36class NDResultDisplay(StudentFileDisplay):
37    """ND Result display viewlet.
38    """
39    grok.order(19)
40    label = _(u'ND Result')
41    title = _(u'ND Result')
42    download_name = u'nd_result'
43
44class NDResultSlip(NDResultDisplay):
45    grok.view(ExportPDFClearanceSlip)
46
47class NDResultUpload(StudentFileUpload):
48    """ND Result upload viewlet.
49    """
50    grok.order(19)
51    label = _(u'ND Result')
52    title = _(u'ND Result Scan')
53    mus = 1024 * 250
54    download_name = u'nd_result'
55
56    @property
57    def show_viewlet(self):
58        students_utils = getUtility(IStudentsUtils)
59        if self.__name__ in students_utils.SKIP_UPLOAD_VIEWLETS:
60            return False
61        cm = getattr(self.context,'current_mode', None)
62        return cm and cm.startswith('hnd')
63
64class NDResultImage(StudentImage):
65    """Renders ND Result scan.
66    """
67    grok.name('nd_result')
68    download_name = u'nd_result'
69
70# O Level Result
71
72class OLevelResultDisplay(StudentFileDisplay):
73    """O Level Result display viewlet.
74    """
75    grok.order(19)
76    label = _(u'O Level Result')
77    title = _(u'O Level Result')
78    download_name = u'o_level_result'
79
80class OLevelResultSlip(OLevelResultDisplay):
81    grok.view(ExportPDFClearanceSlip)
82
83class OLevelResultUpload(StudentFileUpload):
84    """O Level Result upload viewlet.
85    """
86    grok.order(19)
87    label = _(u'O Level Result')
88    title = _(u'O Level Result Scan')
89    mus = 1024 * 250
90    download_name = u'o_level_result'
91
92class OLevelResultImage(StudentImage):
93    """Renders O Level Result scan.
94    """
95    grok.name('o_level_result')
96    download_name = u'o_level_result'
97
98# IT Letter
99
100class ITLetterDisplay(StudentFileDisplay):
101    """IT Letter display viewlet.
102    """
103    grok.order(19)
104    label = _(u'IT Letter')
105    title = _(u'IT Letter')
106    download_name = u'it_letter'
107
108class ITLetterSlip(ITLetterDisplay):
109    grok.view(ExportPDFClearanceSlip)
110
111class ITLetterUpload(StudentFileUpload):
112    """IT Letter upload viewlet.
113    """
114    grok.order(19)
115    label = _(u'IT Letter')
116    title = _(u'IT Letter Scan')
117    mus = 1024 * 250
118    download_name = u'it_letter'
119
120    @property
121    def show_viewlet(self):
122        students_utils = getUtility(IStudentsUtils)
123        if self.__name__ in students_utils.SKIP_UPLOAD_VIEWLETS:
124            return False
125        cm = getattr(self.context,'current_mode', None)
126        return cm and cm.startswith('hnd')
127
128class ITLetterImage(StudentImage):
129    """Renders IT Letter scan.
130    """
131    grok.name('it_letter')
132    download_name = u'it_letter'
133
134# JAMB Result
135
136class JAMBResultDisplay(StudentFileDisplay):
137    """JAMB Result display viewlet.
138    """
139    grok.order(19)
140    label = _(u'JAMB Result')
141    title = _(u'JAMB Result')
142    download_name = u'jamb_result'
143
144class JAMBResultSlip(JAMBResultDisplay):
145    grok.view(ExportPDFClearanceSlip)
146
147class JAMBResultUpload(StudentFileUpload):
148    """JAMB Result upload viewlet.
149    """
150    grok.order(19)
151    title = _(u'JAMB Result Scan')
152    mus = 1024 * 250
153    download_name = u'jamb_result'
154
155    @property
156    def label(self):
157        cm = getattr(self.context,'current_mode', None)
158        if cm and cm.startswith('hnd'):
159            return u'JAMB Result / ND Admission Letter (optional)'
160        else:
161            return u'JAMB Result'
162
163class JAMBResultImage(StudentImage):
164    """Renders JAMB Result scan.
165    """
166    grok.name('jamb_result')
167    download_name = u'jamb_result'
168
169# Additional Document
170
171class AdditionalDocDisplay(StudentFileDisplay):
172    """Additional Document display viewlet.
173    """
174    grok.order(19)
175    label = _(u'Additional Document')
176    title = _(u'Additional Document')
177    download_name = u'additional_doc'
178
179class AdditionalDocSlip(AdditionalDocDisplay):
180    grok.view(ExportPDFClearanceSlip)
181
182class AdditionalDocUpload(StudentFileUpload):
183    """Additional Document upload viewlet.
184    """
185    grok.order(19)
186    title = _(u'Additional Document Scan')
187    mus = 1024 * 250
188    download_name = u'additional_doc'
189    label = _(u'Additional Document')
190
191class AdditionalDocImage(StudentImage):
192    """Renders Additional Document scan.
193    """
194    grok.name('additional_doc')
195    download_name = u'additional_doc'
Note: See TracBrowser for help on using the repository browser.