Ignore:
Timestamp:
28 Jun 2016, 11:25:21 (8 years ago)
Author:
Henrik Bettermann
Message:

Enable screening data. Add ExportScreeningInvitationLetter? view.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/applicants/browser.py

    r13977 r13996  
    2020import grok
    2121import os
    22 from zope.component import getUtility
     22from zope.component import getUtility, getAdapter
     23from zope.i18n import translate
    2324from waeup.kofa.interfaces import (
    24     IExtFileStore, IFileStoreNameChooser)
     25    IExtFileStore, IFileStoreNameChooser, IKofaUtils)
    2526from zope.formlib.textwidgets import BytesDisplayWidget
    2627from waeup.kofa.utils.helpers import string_from_bytes, file_size
    27 from waeup.kofa.applicants.browser import ApplicantCheckStatusPage
     28from waeup.kofa.applicants.browser import (
     29    ApplicantCheckStatusPage, ApplicantBaseDisplayFormPage)
    2830from waeup.kofa.applicants.viewlets import PDFActionButton
     31from waeup.kofa.browser.layout import UtilityView
     32from waeup.kofa.students.interfaces import IStudentsUtils
     33from waeup.kofa.interfaces import IPDF
     34from waeup.kofa.applicants.interfaces import IApplicant
    2935from waeup.aaue.interfaces import MessageFactory as _
    3036from kofacustom.nigeria.applicants.browser import (
     
    4046    ICustomUGApplicant,
    4147    ICustomUGApplicantEdit,
    42     ITranscriptApplicant
     48    ITranscriptApplicant,
     49    ICustomApplicant
    4350    )
    4451
     
    8895    'course1',
    8996    'master_sheet_number',
     97    'screening_venue',
     98    'screening_score',
     99    'screening_date'
    90100    )
    91101
     
    333343    """
    334344    grok.template('applicantcheckstatus')
     345
     346
     347class ExportScreeningInvitationLetter(UtilityView, grok.View):
     348    """Deliver a slip with only screening data.
     349    This form page is available only in AAUE.
     350    """
     351    grok.context(IApplicant)
     352    grok.name('screening_invitation.pdf')
     353    grok.require('waeup.viewApplication')
     354    prefix = 'form'
     355
     356    label = u'Screening Invitation Letter'
     357
     358    form_fields = []
     359
     360    @property
     361    def note(self):
     362        if self.context.screening_date:
     363            return """
     364<br /><br /><br /><br /><font size='12'>
     365Dear %s,
     366<br /><br /><br />
     367You are invited for your screening exercise on:
     368<br /><br />
     369<strong>%s</strong>.
     370<br /><br />
     371Please bring along this letter of invitation to the %s
     372<br /><br />
     373on your screening date.
     374<br /><br /><br />
     375Signed,
     376<br /><br />
     377xyz<br />
     378</font>
     379
     380""" % (self.context.display_fullname,
     381       self.context.screening_date,
     382       self.context.screening_venue)
     383        return
     384
     385    @property
     386    def title(self):
     387        return None
     388
     389    def update(self):
     390        if not self.context.screening_date:
     391            self.flash(_('Forbidden'), type="warning")
     392            self.redirect(self.url(self.context))
     393
     394    def render(self):
     395        applicantview = ApplicantBaseDisplayFormPage(self.context, self.request)
     396        students_utils = getUtility(IStudentsUtils)
     397        return students_utils.renderPDF(self,'screening_data.pdf',
     398            self.context, applicantview, note=self.note)
Note: See TracChangeset for help on using the changeset viewer.