1 | ## $Id: viewlets.py 10818 2013-11-29 11:35:34Z 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 | |
---|
19 | import grok |
---|
20 | from zope.component import getUtility |
---|
21 | from waeup.kofa.interfaces import IExtFileStore |
---|
22 | |
---|
23 | from waeup.kofa.students.viewlets import ( |
---|
24 | StudentsTab, AdmissionSlipActionButton, StudentManageClearanceLink, |
---|
25 | StudentManagePersonalLink, StudentManageAccommodationLink, |
---|
26 | AddBalancePaymentActionButton, |
---|
27 | AddPreviousPaymentActionButton, |
---|
28 | MyStudentDataTab) |
---|
29 | |
---|
30 | from kofacustom.ekodisco.interfaces import MessageFactory as _ |
---|
31 | |
---|
32 | |
---|
33 | class AdmissionSlipActionButton(AdmissionSlipActionButton): |
---|
34 | target = '' |
---|
35 | |
---|
36 | class StudentManageClearanceLink(StudentManageClearanceLink): |
---|
37 | link = '' |
---|
38 | |
---|
39 | class CustomStudentManagePersonalLink(StudentManagePersonalLink): |
---|
40 | link = '' |
---|
41 | |
---|
42 | class CustomStudentManageAccommodationLink(StudentManageAccommodationLink): |
---|
43 | link = '' |
---|
44 | |
---|
45 | class CustomAddBalancePaymentActionButton(AddBalancePaymentActionButton): |
---|
46 | target = '' |
---|
47 | |
---|
48 | class CustomAddPreviousPaymentActionButton(AddPreviousPaymentActionButton): |
---|
49 | target = '' |
---|
50 | |
---|
51 | class CustomMyStudentDataTab(MyStudentDataTab): |
---|
52 | """MyData dropdown tab in primary navigation. |
---|
53 | """ |
---|
54 | |
---|
55 | @property |
---|
56 | def targets(self): |
---|
57 | student = grok.getSite()['students'][self.request.principal.id] |
---|
58 | student_url = self.view.url(student) |
---|
59 | app_slip = getUtility(IExtFileStore).getFileByContext( |
---|
60 | student, 'application_slip') |
---|
61 | targets = [] |
---|
62 | if app_slip: |
---|
63 | targets = [{'url':student_url + '/application_slip', |
---|
64 | 'title':_('Subscription Slip')},] |
---|
65 | targets += [ |
---|
66 | {'url':student_url, 'title':'Base Data'}, |
---|
67 | {'url':student_url + '/studycourse', 'title':_('Main Contract')}, |
---|
68 | {'url':student_url + '/payments', 'title':_('Payments')}, |
---|
69 | {'url':student_url + '/history', 'title':_('History')}, |
---|
70 | ] |
---|
71 | return targets |
---|