Changeset 15150 for main/waeup.kofa/branches/henrik-transcript-workflow
- Timestamp:
- 19 Sep 2018, 11:11:38 (6 years ago)
- Location:
- main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/browser.py
r15149 r15150 1188 1188 if prev_transcript_signees == None: 1189 1189 prev_transcript_signees = '' 1190 self.context.student.transcript_signees = '''Signed by %s (%s) on %s 1191 1192 %s''' % (self.request.principal.title, self.request.principal.id, today, 1193 prev_transcript_signees) 1190 self.context.student.transcript_signees = ( 1191 u"Electronically signed by %s (%s) on %s\n%s" 1192 % (self.request.principal.title, self.request.principal.id, today, 1193 prev_transcript_signees)) 1194 self.redirect(self.url(self.context) + '/transcript') 1194 1195 return 1195 1196 … … 1221 1222 self.correspondence = '' 1222 1223 if self.context.transcript_signees is not None: 1223 self.signees = self.context.transcript_signees.replace('\n', '<br>') 1224 self.signees = self.context.transcript_signees.replace( 1225 '\n', '<br><br>') 1224 1226 else: 1225 1227 self.signees = '' … … 1243 1245 self.context.writeLogMessage( 1244 1246 self, 'comment: %s' % comment.replace('\n', '<br>')) 1245 # Show and produce transcript file1247 # Produce transcript file 1246 1248 self.redirect(self.url(self.context) + '/studycourse/transcript.pdf') 1247 1249 return … … 1273 1275 1274 1276 def update(self): 1275 if not self.context.student.transcript_enabled: 1276 self.flash(_('You are not allowed to view the transcript.'), 1277 type="warning") 1277 final_slip = getUtility(IExtFileStore).getFileByContext( 1278 self.context.student, attr='final_transcript') 1279 if not self.context.student.transcript_enabled or final_slip: 1280 self.flash(_('Forbidden!'), type="warning") 1278 1281 self.redirect(self.url(self.context)) 1279 1282 return … … 1306 1309 1307 1310 def update(self): 1308 if not self.context.student.transcript_enabled: 1309 self.flash(_('You are not allowed to download the transcript.'), 1310 type="warning") 1311 final_slip = getUtility(IExtFileStore).getFileByContext( 1312 self.context.student, attr='final_transcript') 1313 if not self.context.student.transcript_enabled \ 1314 or final_slip: 1315 self.flash(_('Forbidden!'), type="warning") 1311 1316 self.redirect(self.url(self.context)) 1312 1317 return … … 1327 1332 1328 1333 def _sigsInFooter(self): 1334 if self.context.student.transcript_signees: 1335 return () 1329 1336 return (_('CERTIFIED TRUE COPY'),) 1330 1337 1331 1338 def _signatures(self): 1332 return None 1339 return () 1340 1341 def _digital_sigs(self): 1342 if self.context.student.transcript_signees: 1343 return self.context.student.transcript_signees #.split('\n') 1344 return () 1333 1345 1334 1346 def _save_file(self): … … 1364 1376 signatures=self._signatures(), 1365 1377 sigs_in_footer=self._sigsInFooter(), 1378 digital_sigs=self._digital_sigs(), 1366 1379 save_file=self._save_file(), 1367 1380 ) -
main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/tests/test_browser.py
r15148 r15150 2192 2192 prmglobal.assignRoleToPrincipal('waeup.TranscriptSignee', 'mrtranscript') 2193 2193 self.browser.open(self.studycourse_path + '/transcript') 2194 self.browser.getLink("Sign transcript ").click()2194 self.browser.getLink("Sign transcript electronically").click() 2195 2195 # Transcript signing has been logged ... 2196 2196 logfile = os.path.join( … … 2200 2200 'mrtranscript - students.browser.StudentTranscriptSignView - ' 2201 2201 'K1000000 - Transcript signed' in logcontent) 2202 # ... a nd appears in the student's history2202 # ... appears in the student's history ... 2203 2203 self.browser.open(self.history_path) 2204 2204 self.assertTrue('Transcript signed by Ruth Gordon' 2205 2205 in self.browser.contents) 2206 # ... and is also stored in the transcript_signee attribute. 2207 self.assertTrue( 2208 u'Electronically signed by Ruth Gordon (mrtranscript) on ' 2209 in self.student.transcript_signees) 2206 2210 # Officer can release the transcript 2207 2211 self.browser.open(self.student_path) … … 2245 2249 self.assertEqual(self.browser.headers['Content-Type'], 2246 2250 'application/pdf') 2251 # Transcript views are no longer accesssible 2252 self.browser.open(self.student_path) 2253 self.assertFalse('studycourse/transcript' in self.browser.contents) 2254 self.browser.open(self.studycourse_path) 2255 self.assertFalse('studycourse/transcript' in self.browser.contents) 2256 self.browser.open(self.studycourse_path + '/transcript') 2257 self.assertTrue('Forbidden!' in self.browser.contents) 2258 self.browser.open(self.studycourse_path + '/transcript.pdf') 2259 self.assertTrue('Forbidden!' in self.browser.contents) 2260 # If we reset the transcript process 2261 # (can't be done by transcript officer), the file will be deleted 2262 IWorkflowInfo(self.student).fireTransition('reset11') 2263 self.browser.open(self.student_path) 2264 self.assertFalse('Final Transcript' in self.browser.contents) 2265 2247 2266 2248 2267 class StudentUITests(StudentsFullSetup): -
main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/utils.py
r15140 r15150 867 867 student=None, 868 868 studentview=None, 869 note=None, signatures=None, sigs_in_footer=(), 869 note=None, 870 signatures=(), 871 sigs_in_footer=(), 872 digital_sigs=(), 870 873 show_scans=True, topMargin=1.5, 871 874 omit_fields=(), … … 967 970 signaturetables = get_signature_tables(signature) 968 971 data.append(signaturetables[0]) 972 973 # Insert digital signatures 974 if digital_sigs: 975 data.append(Spacer(1, 20)) 976 sigs = digital_sigs.split('\n') 977 for sig in sigs: 978 data.append(Paragraph(sig, NOTE_STYLE)) 969 979 970 980 view.response.setHeader( -
main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/viewlets.py
r15147 r15150 40 40 from waeup.kofa.students.workflow import ( 41 41 ADMITTED, PAID, REQUESTED, CLEARED, REGISTERED, VALIDATED, GRADUATED, 42 TRANSREQ, TRANSVAL )42 TRANSREQ, TRANSVAL, TRANSREL) 43 43 from waeup.kofa.university.interfaces import ICourse 44 44 … … 738 738 @property 739 739 def target_url(self): 740 if self.context.student.transcript_enabled: 740 final_slip = getUtility(IExtFileStore).getFileByContext( 741 self.context.student, attr='final_transcript') 742 if self.context.student.transcript_enabled and not final_slip: 741 743 return self.view.url(self.view.context, self.target) 742 744 return False … … 810 812 @property 811 813 def target_url(self): 812 if self.context.student.transcript_enabled: 814 final_slip = getUtility(IExtFileStore).getFileByContext( 815 self.context.student, attr='final_transcript') 816 if self.context.student.transcript_enabled \ 817 and not final_slip: 813 818 return self.view.url(self.view.context, self.target) 814 819 return False … … 820 825 grok.view(StudyCourseTranscriptPage) 821 826 grok.require('waeup.signTranscript') 822 text = _('Sign transcript ')827 text = _('Sign transcript electronically') 823 828 target = 'sign_transcript' 824 829 icon = 'actionicon_transcript.png' … … 833 838 def onclick(self): 834 839 return "return window.confirm(%s);" % _( 835 "'Signing a transcript cannot be revoked."836 " \\n\\n"840 "'Signing a transcript electronically cannot be revoked. " 841 "The electronic signature replaces your handwritten signature.\\n\\n" 837 842 "You really want to sign the transcript?'") 838 843 -
main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/workflow.py
r15140 r15150 9 9 IObjectHistory, IKofaWorkflowInfo, IKofaUtils, 10 10 CREATED, ADMITTED, CLEARANCE, REQUESTED, CLEARED, PAID, RETURNING, 11 REGISTERED, VALIDATED, GRADUATED, TRANSREQ, TRANSVAL, TRANSREL) 11 REGISTERED, VALIDATED, GRADUATED, TRANSREQ, TRANSVAL, TRANSREL, 12 IExtFileStore) 12 13 from waeup.kofa.interfaces import MessageFactory as _ 13 14 from waeup.kofa.workflow import KofaWorkflow, KofaWorkflowInfo … … 296 297 level_object.validated_by = None 297 298 level_object.validation_date = None 299 elif event.transition.transition_id == 'reset11': 300 transcript_file = getUtility(IExtFileStore).getFileByContext( 301 obj, attr='final_transcript') 302 if transcript_file: 303 getUtility(IExtFileStore).deleteFileByContext( 304 obj, attr='final_transcript') 298 305 # In some tests we don't have a students container 299 306 try:
Note: See TracChangeset for help on using the changeset viewer.