Changeset 13039


Ignore:
Timestamp:
5 Jun 2015, 17:06:01 (10 years ago)
Author:
Henrik Bettermann
Message:

Hide action button if pdf is not exportable.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/students/viewlets.py

    r12975 r13039  
    1919import grok
    2020from zope.component import getUtility
     21from waeup.kofa.interfaces import REGISTERED
    2122from waeup.kofa.students.interfaces import IStudent, IStudentsUtils
    2223from waeup.kofa.students.workflow import PAID
     
    2425    AddPreviousPaymentActionButton, AddBalancePaymentActionButton,
    2526    ManageActionButton, StudentBaseDisplayFormPage)
     27from waeup.kofa.students.browser import StudyLevelDisplayFormPage
    2628
     29from waeup.aaue.students.interfaces import ICustomStudentStudyLevel
    2730from waeup.aaue.interfaces import MessageFactory as _
    2831
     
    7477            return ''
    7578        return self.view.url(self.view.context, self.target)
     79
     80class CourseRegistrationSlipActionButton(ManageActionButton):
     81    grok.order(5)
     82    grok.context(ICustomStudentStudyLevel)
     83    grok.view(StudyLevelDisplayFormPage)
     84    grok.require('waeup.viewStudent')
     85    icon = 'actionicon_pdf.png'
     86    text = _('Download course registration slip')
     87    target = 'course_registration_slip.pdf'
     88
     89    @property
     90    def target_url(self):
     91        is_current = self.context.__parent__.is_current
     92        if not is_current:
     93            return ''
     94        if self.context.student.state != REGISTERED \
     95            or self.context.student.current_level != self.context.level:
     96            return ''
     97        return self.view.url(self.view.context, self.target)
Note: See TracChangeset for help on using the changeset viewer.