Ignore:
Timestamp:
13 Apr 2015, 14:55:28 (10 years ago)
Author:
Henrik Bettermann
Message:

Students are only allowed to download course registration slips if they are
in state 'registered' and their current level corresponds with the course
registration level.

File:
1 edited

Legend:

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

    r12452 r12855  
    1818
    1919import grok
    20 from waeup.kofa.interfaces import REQUESTED
     20from waeup.kofa.interfaces import REQUESTED, REGISTERED
    2121from waeup.kofa.browser.viewlets import ManageActionButton
    2222from waeup.uniben.students.interfaces import (
     
    4444            return self.view.url(self.view.context, self.target)
    4545        return False
     46
     47class CourseRegistrationSlipActionButton(ManageActionButton):
     48    grok.order(5)
     49    grok.context(ICustomStudentStudyLevel)
     50    grok.view(StudyLevelDisplayFormPage)
     51    grok.require('waeup.viewStudent')
     52    icon = 'actionicon_pdf.png'
     53    text = _('Download course registration slip')
     54    target = 'course_registration_slip.pdf'
     55
     56    @property
     57    def target_url(self):
     58        is_current = self.context.__parent__.is_current
     59        if not is_current:
     60            return ''
     61        if self.context.student.state != REGISTERED \
     62            or self.context.student.current_level != self.context.level:
     63            return ''
     64        return self.view.url(self.view.context, self.target)
    4665
    4766class CourseResultSlipActionButton(ManageActionButton):
Note: See TracChangeset for help on using the changeset viewer.