Changeset 17867 for main/waeup.kofa/trunk/src/waeup/kofa
- Timestamp:
- 2 Aug 2024, 19:10:34 (5 months ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r17823 r17867 659 659 grok.template('basemanagepage') 660 660 label = _('Manage base data') 661 deletion_warning = _('Are you sure?') 661 662 pnav = 4 662 663 … … 2993 2994 return 2994 2995 2996 class 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 2995 3018 class StartClearancePage(KofaPage): 2996 3019 grok.context(IStudent) -
main/waeup.kofa/trunk/src/waeup/kofa/students/fileviewlets.py
r16609 r17867 37 37 StudentBaseDisplayFormPage, StudentBaseManageFormPage, 38 38 StudentClearanceDisplayFormPage, StudentClearanceManageFormPage, 39 ExportPDFClearanceSlip, StudentFilesUploadPage, StudentSignatureUploadPage) 39 ExportPDFClearanceSlip, StudentFilesUploadPage, StudentSignatureUploadPage, 40 StudentFinalClearanceUploadPage) 40 41 41 42 grok.context(IKofaObject) # Make IKofaObject the default context … … 114 115 return kofa_utils.MAX_PASSPORT_SIZE 115 116 117 class PassportUploadEdit(PassportUploadManage): 118 """Passport upload viewlet for students. 119 """ 120 grok.view(StudentFilesUploadPage) 121 grok.require('waeup.uploadStudentFile') 116 122 117 123 class SignatureDisplay(StudentFileDisplay): … … 125 131 label = _(u'Scanned Signature') 126 132 download_name = u'signature.jpg' 127 128 133 129 134 class SignatureUploadManage(StudentFileUpload): … … 137 142 label = _(u'Scanned Signature (jpg only)') 138 143 download_name = u'signature.jpg' 139 tab_redirect = '#tab2'140 144 141 145 @property … … 145 149 146 150 147 class PassportUploadEdit(PassportUploadManage):148 """Passport upload viewlet for students.149 """150 grok.view(StudentFilesUploadPage)151 grok.require('waeup.uploadStudentFile')152 153 154 151 class SignatureUploadEdit(SignatureUploadManage): 155 152 """Signature upload viewlet for students. … … 158 155 grok.require('waeup.uploadStudentFile') 159 156 157 158 class 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 169 class 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 179 class FinalClearanceUploadEdit(FinalClearanceUploadManage): 180 """Final Clearance Form upload viewlet for students. 181 """ 182 grok.view(StudentFinalClearanceUploadPage) 183 grok.require('waeup.uploadStudentFile') 160 184 161 185 class BirthCertificateDisplay(StudentFileDisplay): … … 196 220 grok.context(IStudent) 197 221 222 class FinalClearance(StudentImage): 223 """Renders pdf slip. 224 """ 225 grok.name('routingslip') 226 download_name = u'routingslip' 227 198 228 class ApplicationSlipImage(StudentImage): 199 229 """Renders application slip scan. -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r17650 r17867 60 60 61 61 SAMPLE_IMAGE = os.path.join(os.path.dirname(__file__), 'test_image.jpg') 62 SAMPLE_PDF = os.path.join(os.path.dirname(__file__), 'test_pdf.pdf') 62 63 SAMPLE_IMAGE_BMP = os.path.join(os.path.dirname(__file__), 'test_image.bmp') 63 64 URL_LECTURER_LANDING = 'http://localhost/app/my_courses' … … 711 712 self.assertTrue( 712 713 '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"' 713 723 in self.browser.contents) 714 724 return -
main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py
r17863 r17867 1267 1267 return number 1268 1268 1269 def final_clearance_enabled(self, student): 1270 # disabled in base package 1271 return True 1272 1269 1273 #: A dictionary which maps widget names to headlines. The headline 1270 1274 #: is rendered in forms and on pdf slips above the respective -
main/waeup.kofa/trunk/src/waeup/kofa/students/viewlets.py
r17402 r17867 638 638 return self.view.url(self.view.context, self.target) 639 639 640 class 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 640 657 641 658 class StudentClearanceStartActionButton(ManageActionButton):
Note: See TracChangeset for help on using the changeset viewer.