Ignore:
Timestamp:
26 Oct 2017, 08:13:01 (7 years ago)
Author:
Henrik Bettermann
Message:

Customize file viewlets.

Location:
main/kofacustom.dspg/trunk/src/kofacustom/dspg
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.dspg/trunk/src/kofacustom/dspg/locales/en/LC_MESSAGES/waeup.kofa.po

    r14875 r14882  
    2929msgid "Foreigner Returning School Fee"
    3030msgstr "Returning School Fee (Non-Deltan)"
     31
     32msgid "Birth Certificate"
     33msgstr "Birth Certificate / Age Declaration"
  • main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/browser.py

    r14877 r14882  
    4646from kofacustom.dspg.interfaces import MessageFactory as _
    4747
     48class CustomStudentClearanceEditFormPage(NigeriaStudentClearanceEditFormPage):
     49    """ View to edit student clearance data by student
     50    """
     51
     52    def dataNotComplete(self):
     53        store = getUtility(IExtFileStore)
     54        if not store.getFileByContext(self.context, attr=u'birth_certificate.jpg'):
     55            return _('No birth certificate uploaded.')
     56        if not store.getFileByContext(self.context, attr=u'lga_ident.jpg'):
     57            return _('No LGA identification letter uploaded.')
     58        if not store.getFileByContext(self.context, attr=u'o_level_result.jpg'):
     59            return _('No O Level result uploaded.')
     60        if self.context.current_mode.startswith('nd'):
     61            if not store.getFileByContext(self.context, attr=u'jamb_result.jpg'):
     62                return _('No JAMB result uploaded.')
     63        elif self.context.current_mode.startswith('hnd'):
     64            if not store.getFileByContext(self.context, attr=u'nd_result.jpg'):
     65                return _('No ND result uploaded.')
     66            if not store.getFileByContext(self.context, attr=u'it_letter.jpg'):
     67                return _('No IT letter uploaded.')
     68        return False
  • main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/utils.py

    r14878 r14882  
    180180        payment.amount_auth = amount
    181181        return None, payment
     182
     183    #: A tuple containing names of file upload viewlets which are not shown
     184    #: on the `StudentClearanceManageFormPage`. Nothing is being skipped
     185    #: in the base package. This attribute makes only sense, if intermediate
     186    #: custom packages are being used, like we do for all Nigerian portals.
     187    SKIP_UPLOAD_VIEWLETS = ('acceptanceletterupload',
     188                            'higherqualificationresultupload',
     189                            'advancedlevelresultupload',
     190                            'evidencenameupload',
     191                            'refereeletterupload',
     192                            'statutorydeclarationupload',
     193                            'firstsittingresultupload',
     194                            'secondsittingresultupload',
     195                            'certificateupload',
     196                            'resultstatementupload',
     197                            )
  • main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/viewlets.py

    r14716 r14882  
    1818
    1919import grok
     20from zope.component import getUtility
    2021from waeup.kofa.interfaces import REQUESTED
    2122from waeup.kofa.browser.viewlets import ManageActionButton
     23from waeup.kofa.students.interfaces import IStudentsUtils
    2224from kofacustom.dspg.students.interfaces import (
    2325    ICustomStudentStudyCourse, ICustomStudentStudyLevel)
     
    2931
    3032from kofacustom.nigeria.interfaces import MessageFactory as _
     33
     34# ND Result
     35
     36class NDResultDisplay(StudentFileDisplay):
     37    """ND Result display viewlet.
     38    """
     39    grok.order(19)
     40    label = _(u'ND Result')
     41    title = _(u'ND Result')
     42    download_name = u'nd_result'
     43
     44class NDResultSlip(NDResultDisplay):
     45    grok.view(ExportPDFClearanceSlip)
     46
     47class NDResultUpload(StudentFileUpload):
     48    """ND Result upload viewlet.
     49    """
     50    grok.order(19)
     51    label = _(u'ND Result')
     52    title = _(u'ND Result Scan')
     53    mus = 1024 * 250
     54    download_name = u'nd_result'
     55
     56    @property
     57    def show_viewlet(self):
     58        students_utils = getUtility(IStudentsUtils)
     59        if self.__name__ in students_utils.SKIP_UPLOAD_VIEWLETS:
     60            return False
     61        return self.context.current_mode.startswith('hnd')
     62
     63class NDResultImage(StudentImage):
     64    """Renders ND Result scan.
     65    """
     66    grok.name('nd_result')
     67    download_name = u'nd_result'
     68
     69# O Level Result
     70
     71class OLevelResultDisplay(StudentFileDisplay):
     72    """O Level Result display viewlet.
     73    """
     74    grok.order(19)
     75    label = _(u'O Level Result')
     76    title = _(u'O Level Result')
     77    download_name = u'o_level_result'
     78
     79class OLevelResultSlip(OLevelResultDisplay):
     80    grok.view(ExportPDFClearanceSlip)
     81
     82class OLevelResultUpload(StudentFileUpload):
     83    """O Level Result upload viewlet.
     84    """
     85    grok.order(19)
     86    label = _(u'O Level Result')
     87    title = _(u'O Level Result Scan')
     88    mus = 1024 * 250
     89    download_name = u'o_level_result'
     90
     91class OLevelResultImage(StudentImage):
     92    """Renders O Level Result scan.
     93    """
     94    grok.name('o_level_result')
     95    download_name = u'o_level_result'
     96
     97# IT Letter
     98
     99class ITLetterDisplay(StudentFileDisplay):
     100    """IT Letter display viewlet.
     101    """
     102    grok.order(19)
     103    label = _(u'IT Letter')
     104    title = _(u'IT Letter')
     105    download_name = u'it_letter'
     106
     107class ITLetterSlip(ITLetterDisplay):
     108    grok.view(ExportPDFClearanceSlip)
     109
     110class ITLetterUpload(StudentFileUpload):
     111    """IT Letter upload viewlet.
     112    """
     113    grok.order(19)
     114    label = _(u'IT Letter')
     115    title = _(u'IT Letter Scan')
     116    mus = 1024 * 250
     117    download_name = u'it_letter'
     118
     119    @property
     120    def show_viewlet(self):
     121        students_utils = getUtility(IStudentsUtils)
     122        if self.__name__ in students_utils.SKIP_UPLOAD_VIEWLETS:
     123            return False
     124        return self.context.current_mode.startswith('hnd')
     125
     126class ITLetterImage(StudentImage):
     127    """Renders IT Letter scan.
     128    """
     129    grok.name('it_letter')
     130    download_name = u'it_letter'
     131
     132# JAMB Result
     133
     134class JAMBResultDisplay(StudentFileDisplay):
     135    """JAMB Result display viewlet.
     136    """
     137    grok.order(19)
     138    label = _(u'JAMB Result')
     139    title = _(u'JAMB Result')
     140    download_name = u'jamb_result'
     141
     142class JAMBResultSlip(JAMBResultDisplay):
     143    grok.view(ExportPDFClearanceSlip)
     144
     145class JAMBResultUpload(StudentFileUpload):
     146    """JAMB Result upload viewlet.
     147    """
     148    grok.order(19)
     149    title = _(u'JAMB Result Scan')
     150    mus = 1024 * 250
     151    download_name = u'jamb_result'
     152
     153    @property
     154    def label(self):
     155        if self.context.current_mode.startswith('hnd'):
     156            return u'JAMB Result / ND Admission Letter (optional)'
     157        else:
     158            return u'JAMB Result'
     159
     160class JAMBResultImage(StudentImage):
     161    """Renders JAMB Result scan.
     162    """
     163    grok.name('jamb_result')
     164    download_name = u'jamb_result'
Note: See TracChangeset for help on using the changeset viewer.