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

Last change on this file since 11150 was 9858, checked in by Henrik Bettermann, 12 years ago

Course result slips can also be downloaded for previous study courses.

  • Property svn:keywords set to Id
File size: 3.6 KB
Line 
1## $Id: viewlets.py 9858 2013-01-10 07:05:59Z 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'cert'
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'cert'
80
81class JAMBLetterImage(Image):
82    """Renders JAMB Letter scan.
83    """
84    grok.name('cert')
85    download_name = u'cert'
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 ResultStatementImage(Image):
110    """Renders Affidavit of Non-Membership of Secret Cults scan.
111    """
112    grok.name('secr_cults')
113    download_name = u'secr_cults'
Note: See TracBrowser for help on using the repository browser.