Changeset 17867 for main


Ignore:
Timestamp:
2 Aug 2024, 19:10:34 (5 months ago)
Author:
Henrik Bettermann
Message:

Implement Final Year Clearance Routing Slip upload (not active in base package).

Location:
main/waeup.kofa/trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/CHANGES.txt

    r17863 r17867  
    441.8.2.dev0 (unreleased)
    55=======================
     6
     7* Implement Final Year Clearance Routing Slip upload (not active in base package).
    68
    79* Add student's current session to base data block on slips (requested by Uniben)
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r17823 r17867  
    659659    grok.template('basemanagepage')
    660660    label = _('Manage base data')
     661    deletion_warning = _('Are you sure?')
    661662    pnav = 4
    662663
     
    29932994        return
    29942995
     2996class StudentFinalClearanceUploadPage(KofaPage):
     2997    """View to upload scanned final clearance routing slip by student. Not active
     2998    in base package.
     2999    """
     3000    grok.context(IStudent)
     3001    grok.name('routing_slip_upload')
     3002    grok.require('waeup.uploadStudentFile')
     3003    grok.template('finalclearanceuploadpage')
     3004    label = _('Upload final clearance routing slip')
     3005    deletion_warning = _('Are you sure?')
     3006    pnav = 4
     3007
     3008    def update(self):
     3009        final_clearance_enabled = getUtility(
     3010            IStudentsUtils).final_clearance_enabled(self.context)
     3011        if not final_clearance_enabled:
     3012            emit_lock_message(self,
     3013                _('This form is locked.'))
     3014            return
     3015        super(StudentFinalClearanceUploadPage, self).update()
     3016        return
     3017
    29953018class StartClearancePage(KofaPage):
    29963019    grok.context(IStudent)
  • main/waeup.kofa/trunk/src/waeup/kofa/students/fileviewlets.py

    r16609 r17867  
    3737    StudentBaseDisplayFormPage, StudentBaseManageFormPage,
    3838    StudentClearanceDisplayFormPage, StudentClearanceManageFormPage,
    39     ExportPDFClearanceSlip, StudentFilesUploadPage, StudentSignatureUploadPage)
     39    ExportPDFClearanceSlip, StudentFilesUploadPage, StudentSignatureUploadPage,
     40    StudentFinalClearanceUploadPage)
    4041
    4142grok.context(IKofaObject) # Make IKofaObject the default context
     
    114115        return kofa_utils.MAX_PASSPORT_SIZE
    115116
     117class PassportUploadEdit(PassportUploadManage):
     118    """Passport upload viewlet for students.
     119    """
     120    grok.view(StudentFilesUploadPage)
     121    grok.require('waeup.uploadStudentFile')
    116122
    117123class SignatureDisplay(StudentFileDisplay):
     
    125131    label = _(u'Scanned Signature')
    126132    download_name = u'signature.jpg'
    127 
    128133
    129134class SignatureUploadManage(StudentFileUpload):
     
    137142    label = _(u'Scanned Signature (jpg only)')
    138143    download_name = u'signature.jpg'
    139     tab_redirect = '#tab2'
    140144
    141145    @property
     
    145149
    146150
    147 class PassportUploadEdit(PassportUploadManage):
    148     """Passport upload viewlet for students.
    149     """
    150     grok.view(StudentFilesUploadPage)
    151     grok.require('waeup.uploadStudentFile')
    152 
    153 
    154151class SignatureUploadEdit(SignatureUploadManage):
    155152    """Signature upload viewlet for students.
     
    158155    grok.require('waeup.uploadStudentFile')
    159156
     157
     158class FinalClearanceDisplay(StudentFileDisplay):
     159    """Final Clearance Routing Slip display viewlet.
     160    """
     161    grok.order(4)
     162    grok.context(IStudent)
     163    grok.view(StudentBaseDisplayFormPage)
     164    grok.require('waeup.viewStudent')
     165    label = _(u'Scanned Final Clearance Routing Slip ')
     166    download_name = u'routingslip'
     167
     168
     169class FinalClearanceUploadManage(StudentFileUpload):
     170    """Final Clearance Routing Slip upload viewlet for officers.
     171    """
     172    grok.order(4)
     173    grok.context(IStudent)
     174    grok.view(StudentBaseManageFormPage)
     175    grok.require('waeup.manageStudent')
     176    label = _(u'Scanned Final Clearance Routing Slip (pdf preferred)')
     177    download_name = u'routingslip'
     178
     179class FinalClearanceUploadEdit(FinalClearanceUploadManage):
     180    """Final Clearance Form upload viewlet for students.
     181    """
     182    grok.view(StudentFinalClearanceUploadPage)
     183    grok.require('waeup.uploadStudentFile')
    160184
    161185class BirthCertificateDisplay(StudentFileDisplay):
     
    196220    grok.context(IStudent)
    197221
     222class FinalClearance(StudentImage):
     223    """Renders pdf slip.
     224    """
     225    grok.name('routingslip')
     226    download_name = u'routingslip'
     227
    198228class ApplicationSlipImage(StudentImage):
    199229    """Renders application slip scan.
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r17650 r17867  
    6060
    6161SAMPLE_IMAGE = os.path.join(os.path.dirname(__file__), 'test_image.jpg')
     62SAMPLE_PDF = os.path.join(os.path.dirname(__file__), 'test_pdf.pdf')
    6263SAMPLE_IMAGE_BMP = os.path.join(os.path.dirname(__file__), 'test_image.bmp')
    6364URL_LECTURER_LANDING = 'http://localhost/app/my_courses'
     
    711712        self.assertTrue(
    712713            'src="http://localhost/app/students/K1000000/signature.jpg"'
     714            in self.browser.contents)
     715        ctrl = self.browser.getControl(name='finalclearanceuploadmanage')
     716        file_obj = open(SAMPLE_PDF, 'rb')
     717        file_ctrl = ctrl.mech_control
     718        file_ctrl.add_file(file_obj, filename='routing_slip.pdf')
     719        self.browser.getControl(
     720            name='upload_finalclearanceuploadmanage').click()
     721        self.assertTrue(
     722            'href="http://localhost/app/students/K1000000/routingslip"'
    713723            in self.browser.contents)
    714724        return
  • main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py

    r17863 r17867  
    12671267        return number
    12681268
     1269    def final_clearance_enabled(self, student):
     1270        # disabled in base package
     1271        return True
     1272
    12691273    #: A dictionary which maps widget names to headlines. The headline
    12701274    #: is rendered in forms and on pdf slips above the respective
  • main/waeup.kofa/trunk/src/waeup/kofa/students/viewlets.py

    r17402 r17867  
    638638        return self.view.url(self.view.context, self.target)
    639639
     640class StudentFinalClearanceFormActionButton(ManageActionButton):
     641    grok.order(5)
     642    grok.context(IStudent)
     643    grok.view(StudentBaseDisplayFormPage)
     644    grok.require('waeup.handleStudent')
     645    icon = 'actionicon_signature.png'
     646    text = _('Upload final clearance routing slip')
     647    target = 'routing_slip_upload'
     648
     649    @property
     650    def target_url(self):
     651        final_clearance_enabled = getUtility(
     652            IStudentsUtils).final_clearance_enabled(self.context)
     653        if not final_clearance_enabled:
     654            return ''
     655        return self.view.url(self.view.context, self.target)
     656
    640657
    641658class StudentClearanceStartActionButton(ManageActionButton):
Note: See TracChangeset for help on using the changeset viewer.