Changeset 10818


Ignore:
Timestamp:
29 Nov 2013, 11:35:34 (11 years ago)
Author:
Henrik Bettermann
Message:

Customize MyStudentDataTab?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.ekodisco/trunk/src/kofacustom/ekodisco/students/viewlets.py

    r10812 r10818  
    1717##
    1818
     19import grok
     20from zope.component import getUtility
     21from waeup.kofa.interfaces import IExtFileStore
     22
    1923from waeup.kofa.students.viewlets import (
    2024    StudentsTab, AdmissionSlipActionButton, StudentManageClearanceLink,
    2125    StudentManagePersonalLink, StudentManageAccommodationLink,
    2226    AddBalancePaymentActionButton,
    23     AddPreviousPaymentActionButton)
     27    AddPreviousPaymentActionButton,
     28    MyStudentDataTab)
    2429
    2530from kofacustom.ekodisco.interfaces import MessageFactory as _
    2631
    27 class CustomStudentsTab(StudentsTab):
    28     """Students tab in primary navigation does not show up.
    29     """
    30 
    31     #@property
    32     #def link_target(self):
    33     #    return None
    3432
    3533class AdmissionSlipActionButton(AdmissionSlipActionButton):
     
    5048class CustomAddPreviousPaymentActionButton(AddPreviousPaymentActionButton):
    5149    target = ''
     50
     51class 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
Note: See TracChangeset for help on using the changeset viewer.