Ignore:
Timestamp:
26 Jun 2012, 07:46:32 (12 years ago)
Author:
Henrik Bettermann
Message:

Merged with waeup.uniben 8802:HEAD.

Location:
main/waeup.aaue/trunk/src/waeup/aaue
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue

  • main/waeup.aaue/trunk/src/waeup/aaue/applicants/browser.py

    r8711 r8805  
    3333    ApplicantBaseDisplayFormPage)
    3434from waeup.kofa.applicants.viewlets import (
    35     PaymentReceiptActionButton)
     35    PaymentReceiptActionButton, PDFActionButton)
    3636from waeup.kofa.applicants.pdf import PDFApplicationSlip
    3737from waeup.aaue.applicants.interfaces import (
     
    4141    UG_OMIT_PDF_FIELDS, PG_OMIT_PDF_FIELDS,
    4242    UG_OMIT_MANAGE_FIELDS, PG_OMIT_MANAGE_FIELDS,
    43     UG_OMIT_EDIT_FIELDS, PG_OMIT_EDIT_FIELDS, PUTME_OMIT_EDIT_FIELDS)
     43    UG_OMIT_EDIT_FIELDS, PG_OMIT_EDIT_FIELDS, PUTME_OMIT_EDIT_FIELDS,
     44    UG_OMIT_RESULT_SLIP_FIELDS)
    4445from waeup.aaue.interfaces import MessageFactory as _
    4546
     
    6364    grok.context(ICustomApplicantOnlinePayment)
    6465
     66class PDFActionButton(PDFActionButton):
     67
     68    @property
     69    def text(self):
     70        if getattr(self.context, 'result_uploaded', False):
     71            return _('Download result slip')
     72        return _('Download application slip')
     73
     74
    6575class CustomPDFApplicationSlip(PDFApplicationSlip):
    6676
    67     note = _(u'<br /><br /><br />'
    68               'Comfirm your exam venue 72 hours to the exam.')
     77    def _reduced_slip(self):
     78        return getattr(self.context, 'result_uploaded', False)
     79
     80    @property
     81    def note(self):
     82        target = getattr(self.context.__parent__, 'prefix', None)
     83        if target is not None and not target.startswith('pg') \
     84            and not self._reduced_slip():
     85            return _(u'<br /><br /><br />'
     86                      'Comfirm your exam venue 72 hours to the exam.')
     87        return
    6988
    7089    @property
     
    7796        else:
    7897            form_fields = grok.AutoFields(IUGApplicant)
    79             for field in UG_OMIT_PDF_FIELDS:
    80                 form_fields = form_fields.omit(field)
     98            if self._reduced_slip():
     99                for field in UG_OMIT_RESULT_SLIP_FIELDS:
     100                    form_fields = form_fields.omit(field)
     101            else:
     102                for field in UG_OMIT_PDF_FIELDS:
     103                    form_fields = form_fields.omit(field)
     104        if not getattr(self.context, 'student_id'):
     105            form_fields = form_fields.omit('student_id')
    81106        return form_fields
    82107
Note: See TracChangeset for help on using the changeset viewer.