Changeset 7277 for main/waeup.sirp/trunk


Ignore:
Timestamp:
6 Dec 2011, 07:39:04 (13 years ago)
Author:
Henrik Bettermann
Message:

Add first version of ExportPDFClearanceSlipPage.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py

    r7275 r7277  
    506506
    507507class StudentRejectClearanceActionButton(ManageActionButton):
    508     grok.order(2)
     508    grok.order(3)
    509509    grok.context(IStudent)
    510510    grok.view(StudentClearanceDisplayFormPage)
     
    519519            return ''
    520520        return self.view.url(self.view.context, self.target)
     521
     522class ClearanceSlipActionButton(ManageActionButton):
     523    grok.order(4)
     524    grok.context(IStudent)
     525    grok.view(StudentClearanceDisplayFormPage)
     526    grok.require('waeup.viewStudent')
     527    icon = 'actionicon_pdf.png'
     528    text = 'Download clearance slip'
     529    target = 'clearance.pdf'
     530
     531class ExportPDFClearanceSlipPage(grok.View):
     532    """Deliver a PDF slip of the context.
     533    """
     534    grok.context(IStudent)
     535    grok.name('clearance.pdf')
     536    grok.require('waeup.viewStudent')
     537    form_fields = grok.AutoFields(IStudentClearance).omit('clearance_locked')
     538    prefix = 'form'
     539
     540    @property
     541    def label(self):
     542        return 'Clearance Slip of %s' % self.context.fullname
     543
     544    def render(self):
     545        studentview = StudentBaseDisplayFormPage(self.context.getStudent(),
     546            self.request)
     547        students_utils = getUtility(IStudentsUtils)
     548        return students_utils.renderPDF(
     549            self,'Clearance', 'clearance.pdf',
     550            self.context.getStudent, studentview)
    521551
    522552class StudentClearanceManageFormPage(WAeUPEditFormPage):
Note: See TracChangeset for help on using the changeset viewer.