Ignore:
Timestamp:
21 Dec 2015, 21:41:28 (9 years ago)
Author:
Henrik Bettermann
Message:

Render second logo on Akoka application slips.

Location:
main/waeup.uniben/trunk/src/waeup/uniben
Files:
1 added
1 deleted
3 edited

Legend:

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

    r13557 r13558  
    3333from waeup.kofa.applicants.interfaces import (
    3434    ISpecialApplicant, IApplicantsUtils)
     35from waeup.kofa.browser.interfaces import IPDFCreator
    3536from kofacustom.nigeria.applicants.browser import (
    3637    NigeriaApplicantDisplayFormPage,
     
    275276class CustomPDFApplicationSlip(NigeriaPDFApplicationSlip):
    276277
     278    def _getPDFCreator(self):
     279        if 'afak' in self.target:
     280            return getUtility(IPDFCreator, name='akoka_pdfcreator')
     281        return getUtility(IPDFCreator)
     282
    277283    @property
    278284    def title(self):
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/tests/test_browser.py

    r13557 r13558  
    164164        return
    165165
    166     def test_asaba_application_slip(self):
    167 
    168         # Remove required FieldProperty attribute first ...
    169         delattr(ApplicantsContainer, 'prefix')
    170         # ... and replace by asaba
    171         self.applicantscontainer.prefix = 'afas'
     166    def test_application_slip(self):
     167
    172168        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    173169        self.slip_path = self.view_path + '/application_slip.pdf'
     
    185181        open(path, 'wb').write(self.browser.contents)
    186182        print "Sample application_slip.pdf written to %s" % path
     183
     184    def test_akoka_application_slip(self):
     185
     186        # Remove required FieldProperty attribute first ...
     187        delattr(ApplicantsContainer, 'prefix')
     188        # ... and replace by akoka
     189        self.applicantscontainer.prefix = 'afak'
     190        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     191        self.slip_path = self.view_path + '/application_slip.pdf'
     192        self.browser.open(self.manage_path)
     193        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     194        self.fill_correct_values()
     195        self.browser.getControl("Save").click()
     196        IWorkflowState(self.applicant).setState('submitted')
     197        self.browser.open(self.manage_path)
     198        self.browser.getLink("Download application slip").click()
     199        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     200        self.assertEqual(self.browser.headers['Content-Type'],
     201                         'application/pdf')
     202        path = os.path.join(samples_dir(), 'akoka_application_slip.pdf')
     203        open(path, 'wb').write(self.browser.contents)
     204        print "Sample akoka_application_slip.pdf written to %s" % path
  • main/waeup.uniben/trunk/src/waeup/uniben/browser/pdf.py

    r8204 r13558  
    2121
    2222import os
     23import grok
    2324from waeup.kofa.browser.pdf import PDFCreator
    2425
     
    3435    watermark_pos = [-25, 100]
    3536    logo_pos = [507, 720, 40]
     37
     38
     39class AkokaPDFCreator(PDFCreator):
     40
     41    grok.name('akoka_pdfcreator')
     42
     43    watermark_path = os.path.join(
     44        os.path.dirname(__file__), 'static', 'pdf_watermark.jpg')
     45
     46    watermark_pos = [-25, 100]
     47
     48    # right (default) logo
     49    header_logo_path = os.path.join(
     50        os.path.dirname(__file__), 'static', 'pdf_logo.jpg')
     51
     52    logo_pos = [507, 720, 40]
     53
     54    # left logo
     55    header_logo_left_path = os.path.join(
     56        os.path.dirname(__file__), 'static', 'pdf_logo_akoka.jpg')
     57
     58    logo_left_pos = [50, 680, 30]
Note: See TracChangeset for help on using the changeset viewer.