source: main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/viewlets.py @ 15449

Last change on this file since 15449 was 15185, checked in by Henrik Bettermann, 6 years ago

Add MedicalLaboratoryRequestForm?.

  • Property svn:keywords set to Id
File size: 3.1 KB
RevLine 
[10765]1## $Id: viewlets.py 15185 2018-10-12 15:51: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
[15177]20from zope.component import getUtility
[10765]21from waeup.kofa.interfaces import REQUESTED
22from waeup.kofa.browser.viewlets import ManageActionButton
[12430]23from waeup.kofa.students.fileviewlets import (
[12450]24    StudentFileDisplay, StudentFileUpload, StudentImage)
[10765]25from waeup.kofa.students.browser import (
[13062]26    ExportPDFClearanceSlip, StudyCourseDisplayFormPage,
[15176]27    StudyLevelDisplayFormPage, StudentBaseDisplayFormPage)
[15177]28from waeup.kofa.students.interfaces import IStudent, IStudentsUtils
29from waeup.kofa.students.workflow import PAID
[10765]30
[15176]31from kofacustom.edopoly.students.interfaces import (
32    ICustomStudentStudyCourse, ICustomStudentStudyLevel)
33
[10765]34from kofacustom.nigeria.interfaces import MessageFactory as _
[15176]35
36class GetMatricNumberActionButton(ManageActionButton):
37    grok.order(10)
38    grok.context(IStudent)
39    grok.view(StudentBaseDisplayFormPage)
40    grok.require('waeup.viewStudent')
41    #grok.require('waeup.manageStudent')
42    icon = 'actionicon_count.png'
43    text = _('Get Matriculation Number')
44
45    @property
46    def target_url(self):
47        students_utils = getUtility(IStudentsUtils)
48        if self.context.matric_number:
49            return ''
50        error, matric_number = students_utils.constructMatricNumber(
51            self.context)
52        if error:
53            return ''
54        return self.view.url(self.view.context, 'get_matric_number')
55
56class MatricNumberSlipActionButton(ManageActionButton):
57    grok.order(10)
58    grok.context(IStudent)
59    grok.view(StudentBaseDisplayFormPage)
60    grok.require('waeup.viewStudent')
61    icon = 'actionicon_pdf.png'
62    text = _('Download matriculation number slip')
63    target = 'matric_number_slip.pdf'
64
65    @property
66    def target_url(self):
67        if self.context.state not in (PAID,) or not self.context.is_fresh \
68            or not self.context.matric_number:
69            return ''
[15185]70        return self.view.url(self.view.context, self.target)
71
72class MedicalLaboratoryRequestFormActionButton(ManageActionButton):
73    grok.order(11)
74    grok.context(IStudent)
75    grok.view(StudentBaseDisplayFormPage)
76    grok.require('waeup.viewStudent')
77    icon = 'actionicon_pdf.png'
78    text = _('Download medical laboratory request form')
79    target = 'medical_laboratory_form.pdf'
80
81    @property
82    def target_url(self):
83        if not self.context.medical_fee_paid:
84            return ''
85        return self.view.url(self.view.context, self.target)
Note: See TracBrowser for help on using the repository browser.