Changeset 16609 for main/waeup.kofa/trunk/src
- Timestamp:
- 8 Sep 2021, 07:15:07 (3 years ago)
- Location:
- main/waeup.kofa/trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk
- Property svn:ignore
-
old new 21 21 faculties.csv 22 22 .mr.developer.cfg 23 dist
-
- Property svn:ignore
-
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r16520 r16609 2924 2924 2925 2925 class StudentFilesUploadPage(KofaPage): 2926 """ View to upload files by student 2926 """ View to upload passport picture by student. The class name 2927 is historical. The page is only used for the student's portrait. 2927 2928 """ 2928 2929 grok.context(IStudent) … … 2940 2941 return 2941 2942 super(StudentFilesUploadPage, self).update() 2943 return 2944 2945 class StudentSignatureUploadPage(KofaPage): 2946 """ View to upload scanned signature by student. Not active 2947 in base package. 2948 """ 2949 grok.context(IStudent) 2950 grok.name('change_signature') 2951 grok.require('waeup.uploadStudentFile') 2952 grok.template('filesuploadpage') 2953 label = _('Upload signature') 2954 pnav = 4 2955 2956 def update(self): 2957 SIGNATURE_CHANGE_STATES = getUtility(IStudentsUtils).SIGNATURE_CHANGE_STATES 2958 if self.context.student.state not in SIGNATURE_CHANGE_STATES: 2959 emit_lock_message(self, 2960 _('This form is locked. You are in the wrong state.')) 2961 return 2962 super(StudentSignatureUploadPage, self).update() 2942 2963 return 2943 2964 -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/basemanagepage.pt
r11254 r16609 10 10 <li> 11 11 <a href="#tab2" data-toggle="tab"> 12 <span i18n:translate=""> Passport Picture</span>12 <span i18n:translate="">Files</span> 13 13 </a> 14 14 </li> -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/imagedisplay.pt
r11254 r16609 1 <tr >1 <tr tal:condition="viewlet/file_exists"> 2 2 <td class="fieldname"> 3 3 <span tal:replace="viewlet/label">FILENAME</span>: -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/imageupload.pt
r11558 r16609 4 4 </td> 5 5 <td> 6 <img align="middle" height="125px" 7 tal:attributes="src python: view.url(context, viewlet.download_name)" /> 8 9 <input type="submit" tal:condition="viewlet/file_exists" 10 tal:attributes="id python:('delete_%s' % viewlet.input_name); 11 name python:('delete_%s' % viewlet.input_name)" 12 value="Delete" class="btn btn-danger" /> 13 <br /><br /> 14 6 <tal:file_exists condition="viewlet/file_exists"> 7 <img align="middle" height="125px" 8 tal:attributes="src python: view.url(context, viewlet.download_name)" /> 9 10 <input type="submit" 11 tal:attributes="id python:('delete_%s' % viewlet.input_name); 12 name python:('delete_%s' % viewlet.input_name)" 13 value="Delete" class="btn btn-danger" /> 14 <br /><br /> 15 </tal:file_exists> 15 16 <div class="input-group"> 16 17 <div class="input-group-btn"> -
main/waeup.kofa/trunk/src/waeup/kofa/students/fileviewlets.py
r15880 r16609 37 37 StudentBaseDisplayFormPage, StudentBaseManageFormPage, 38 38 StudentClearanceDisplayFormPage, StudentClearanceManageFormPage, 39 ExportPDFClearanceSlip, StudentFilesUploadPage )39 ExportPDFClearanceSlip, StudentFilesUploadPage, StudentSignatureUploadPage) 40 40 41 41 grok.context(IKofaObject) # Make IKofaObject the default context … … 83 83 84 84 85 # File viewlets for student base page85 # File viewlets for student base and clearance page 86 86 87 87 class PassportDisplay(StudentFileDisplay): … … 115 115 116 116 117 class SignatureDisplay(StudentFileDisplay): 118 """Signature display viewlet. 119 """ 120 grok.order(2) 121 grok.context(IStudent) 122 grok.view(StudentBaseDisplayFormPage) 123 grok.require('waeup.viewStudent') 124 grok.template('imagedisplay') 125 label = _(u'Scanned Signature') 126 download_name = u'signature.jpg' 127 128 129 class SignatureUploadManage(StudentFileUpload): 130 """Signature upload viewlet for officers. 131 """ 132 grok.order(2) 133 grok.context(IStudent) 134 grok.view(StudentBaseManageFormPage) 135 grok.require('waeup.manageStudent') 136 grok.template('imageupload') 137 label = _(u'Scanned Signature (jpg only)') 138 download_name = u'signature.jpg' 139 tab_redirect = '#tab2' 140 141 @property 142 def mus(self): 143 kofa_utils = getUtility(IKofaUtils) 144 return kofa_utils.MAX_PASSPORT_SIZE 145 146 117 147 class PassportUploadEdit(PassportUploadManage): 118 148 """Passport upload viewlet for students. 119 149 """ 120 150 grok.view(StudentFilesUploadPage) 151 grok.require('waeup.uploadStudentFile') 152 153 154 class SignatureUploadEdit(SignatureUploadManage): 155 """Signature upload viewlet for students. 156 """ 157 grok.view(StudentSignatureUploadPage) 121 158 grok.require('waeup.uploadStudentFile') 122 159 … … 152 189 grok.context(IStudent) 153 190 191 class Signature(StudentImage): 192 """Renders jpeg signature. 193 """ 194 grok.name('signature.jpg') 195 download_name = u'signature.jpg' 196 grok.context(IStudent) 154 197 155 198 class ApplicationSlipImage(StudentImage): -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r16526 r16609 681 681 # Only the Application Slip does not exist 682 682 self.assertFalse('Application Slip' in self.browser.contents) 683 return 684 685 def test_upload_files(self): 686 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 687 self.browser.open(self.manage_student_path) 688 self.browser.getControl(name="form.firstname").value = 'John' 689 self.browser.getControl(name="form.lastname").value = 'Tester' 690 self.browser.getControl(name="form.reg_number").value = '345' 691 self.browser.getControl(name="password").value = 'secret' 692 self.browser.getControl(name="control_password").value = 'secret' 693 self.browser.getControl("Save").click() 694 self.assertMatches('...Form has been saved...', 695 self.browser.contents) 696 ctrl = self.browser.getControl(name='passportuploadmanage') 697 file_obj = open(SAMPLE_IMAGE, 'rb') 698 file_ctrl = ctrl.mech_control 699 file_ctrl.add_file(file_obj, filename='my_photo.jpg') 700 self.browser.getControl( 701 name='upload_passportuploadmanage').click() 702 self.assertTrue( 703 'src="http://localhost/app/students/K1000000/passport.jpg"' 704 in self.browser.contents) 705 ctrl = self.browser.getControl(name='signatureuploadmanage') 706 file_obj = open(SAMPLE_IMAGE, 'rb') 707 file_ctrl = ctrl.mech_control 708 file_ctrl.add_file(file_obj, filename='my_signature.jpg') 709 self.browser.getControl( 710 name='upload_signatureuploadmanage').click() 711 self.assertTrue( 712 'src="http://localhost/app/students/K1000000/signature.jpg"' 713 in self.browser.contents) 683 714 return 684 715 -
main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py
r16442 r16609 1242 1242 PORTRAIT_CHANGE_STATES = (ADMITTED,) 1243 1243 1244 #: A tuple containing the names of registration states in which changing of 1245 #: scanned signatures is allowed. 1246 SIGNATURE_CHANGE_STATES = () 1247 1244 1248 #: A tuple containing all exporter names referring to students or 1245 1249 #: subobjects thereof. -
main/waeup.kofa/trunk/src/waeup/kofa/students/viewlets.py
r16523 r16609 623 623 return self.view.url(self.view.context, self.target) 624 624 625 class StudentSignatureActionButton(ManageActionButton): 626 grok.order(4) 627 grok.context(IStudent) 628 grok.view(StudentBaseDisplayFormPage) 629 grok.require('waeup.handleStudent') 630 icon = 'actionicon_signature.png' 631 text = _('Change signature') 632 target = 'change_signature' 633 634 @property 635 def target_url(self): 636 SIGNATURE_CHANGE_STATES = getUtility( 637 IStudentsUtils).SIGNATURE_CHANGE_STATES 638 if self.context.state not in SIGNATURE_CHANGE_STATES: 639 return '' 640 return self.view.url(self.view.context, self.target) 641 625 642 626 643 class StudentClearanceStartActionButton(ManageActionButton):
Note: See TracChangeset for help on using the changeset viewer.