Ignore:
Timestamp:
19 Nov 2019, 13:07:22 (5 years ago)
Author:
Henrik Bettermann
Message:

Move viewlet classes.

Location:
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/browser.py

    r15796 r15826  
    4242    BedTicketAddPage)
    4343from waeup.kofa.students.interfaces import IStudentsUtils
    44 from waeup.kofa.students.viewlets import (
    45     PaymentReceiptActionButton, StudentPassportActionButton)
    4644from kofacustom.nigeria.students.interfaces import (
    4745    INigeriaStudentBase, INigeriaStudent, INigeriaStudentPersonal,
     
    5755    """
    5856    grok.context(INigeriaStudentOnlinePayment)
    59 
    60 class PaymentReceiptActionButton(PaymentReceiptActionButton):
    61     grok.order(4)
    62     grok.context(INigeriaStudentOnlinePayment)
    63 
    64     @property
    65     def target_url(self):
    66         if not self.context.r_company:
    67             return ''
    68         return self.view.url(self.view.context, self.target)
    69 
    7057
    7158class NigeriaStudentBaseDisplayFormPage(StudentBaseDisplayFormPage):
     
    253240        'phone', 'adm_code', 'email', 'date_of_birth', 'current_level',
    254241        'flash_notice')
    255 
    256 class StudentPassportActionButton(StudentPassportActionButton):
    257 
    258     @property
    259     def target_url(self):
    260         # Passport pictures must not be editable if application slip
    261         # exists.
    262         slip = getUtility(IExtFileStore).getFileByContext(
    263             self.context, 'application_slip')
    264         PORTRAIT_CHANGE_STATES = getUtility(IStudentsUtils).PORTRAIT_CHANGE_STATES
    265         if self.context.state not in PORTRAIT_CHANGE_STATES or slip is not None:
    266             return ''
    267         return self.view.url(self.view.context, self.target)
    268242
    269243class NigeriaStudentFilesUploadPage(StudentFilesUploadPage):
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/viewlets.py

    r15651 r15826  
    1919import grok
    2020from zope.component import getUtility
     21from waeup.kofa.interfaces import IExtFileStore
    2122from waeup.kofa.browser.viewlets import ManageActionButton
    2223from waeup.kofa.students.interfaces import IStudentsUtils
     24from waeup.kofa.students.viewlets import (
     25    PaymentReceiptActionButton, StudentPassportActionButton)
    2326from waeup.kofa.students.fileviewlets import (
    2427    StudentFileDisplay, StudentFileUpload, StudentImage)
    2528from waeup.kofa.students.browser import ExportPDFClearanceSlip
    26 
    27 from kofacustom.nigeria.students.interfaces import INigeriaStudent
     29from kofacustom.nigeria.students.interfaces import (
     30    INigeriaStudent, INigeriaStudentOnlinePayment)
    2831from kofacustom.nigeria.students.browser import NigeriaStudentBaseDisplayFormPage
    2932from kofacustom.nigeria.interfaces import MessageFactory as _
     
    3841    return False
    3942
     43class StudentPassportActionButton(StudentPassportActionButton):
     44
     45    @property
     46    def target_url(self):
     47        # Passport pictures must not be editable if application slip
     48        # exists.
     49        slip = getUtility(IExtFileStore).getFileByContext(
     50            self.context, 'application_slip')
     51        PORTRAIT_CHANGE_STATES = getUtility(IStudentsUtils).PORTRAIT_CHANGE_STATES
     52        if self.context.state not in PORTRAIT_CHANGE_STATES or slip is not None:
     53            return ''
     54        return self.view.url(self.view.context, self.target)
     55
     56class PaymentReceiptActionButton(PaymentReceiptActionButton):
     57    grok.order(4)
     58    grok.context(INigeriaStudentOnlinePayment)
     59
     60    @property
     61    def target_url(self):
     62        if not self.context.r_company:
     63            return ''
     64        return self.view.url(self.view.context, self.target)
     65
    4066# Financial Clearance Officer buttons
    4167
Note: See TracChangeset for help on using the changeset viewer.