Changeset 15849


Ignore:
Timestamp:
25 Nov 2019, 16:06:33 (5 years ago)
Author:
Henrik Bettermann
Message:

Add signature download button.

File:
1 edited

Legend:

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

    r15805 r15849  
    1919import grok
    2020from zope.component import getUtility
    21 from waeup.kofa.interfaces import REQUESTED
     21from waeup.kofa.interfaces import REQUESTED, IExtFileStore
    2222from waeup.kofa.browser.viewlets import ManageActionButton
    2323from waeup.kofa.students.interfaces import IStudent, IStudentsUtils
     
    7979    download_name = u'signature'
    8080
     81class SignatureDownloadButton(ManageActionButton):
     82
     83    grok.order(12)
     84    grok.context(IStudent)
     85    grok.view(StudentBaseDisplayFormPage)
     86    grok.require('waeup.manageStudent')
     87    target = 'signature'
     88    text = _('Signature')
     89    icon = 'actionicon_signature.png'
     90
     91    @property
     92    def target_url(self):
     93        image = getUtility(IExtFileStore).getFileByContext(
     94            self.context, attr='signature')
     95        if not image:
     96            return ''
     97        return self.view.url(self.view.context, self.target)
     98
    8199# JAMB Result
    82100
Note: See TracChangeset for help on using the changeset viewer.