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

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

Fix typo.

Add course result slip and remove grade column from course registration slip.

  • Property svn:keywords set to Id
File size: 3.7 KB
Line 
1## $Id: viewlets.py 9848 2013-01-09 09:33:01Z 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        is_current = self.context.__parent__.is_current
58        if not is_current:
59            return ''
60        return self.view.url(self.view.context, self.target)
61
62# JAMB Letter
63
64class JAMBLetterDisplay(FileDisplay):
65    """JAMB Letter display viewlet.
66    """
67    grok.order(19)
68    label = _(u'JAMB Letter')
69    title = _(u'JAMB Letter')
70    download_name = u'cert'
71
72class JAMBLetterSlip(JAMBLetterDisplay):
73    grok.view(ExportPDFClearanceSlipPage)
74
75class JAMBLetterUpload(FileUpload):
76    """JAMB Letter upload viewlet.
77    """
78    grok.order(19)
79    label = _(u'JAMB Letter')
80    title = _(u'JAMB Letter Scan')
81    mus = 1024 * 150
82    download_name = u'cert'
83
84class JAMBLetterImage(Image):
85    """Renders JAMB Letter scan.
86    """
87    grok.name('cert')
88    download_name = u'cert'
89
90# Affidavit of Non-Membership of Secret Cults
91
92class SecrCultsStatementDisplay(FileDisplay):
93    """Affidavit of Non-Membership of Secret Cults display viewlet.
94    """
95    grok.order(20)
96    label = _(u'Affidavit of Non-Membership of Secret Cults')
97    title = _(u'Affidavit of Non-Membership of Secret Cults')
98    download_name = u'secr_cults'
99
100class SecrCultsStatementSlip(SecrCultsStatementDisplay):
101    grok.view(ExportPDFClearanceSlipPage)
102
103class SecrCultsStatementUpload(FileUpload):
104    """Affidavit of Non-Membership of Secret Cults upload viewlet.
105    """
106    grok.order(20)
107    label = _(u'Affidavit of Non-Membership of Secret Cults')
108    title = _(u'Affidavit of Non-Membership of Secret Cults Scan')
109    mus = 1024 * 150
110    download_name = u'secr_cults'
111
112class ResultStatementImage(Image):
113    """Renders Affidavit of Non-Membership of Secret Cults scan.
114    """
115    grok.name('secr_cults')
116    download_name = u'secr_cults'
Note: See TracBrowser for help on using the repository browser.