Changeset 15140 for main/waeup.kofa/branches
- Timestamp:
- 18 Sep 2018, 05:53:44 (6 years ago)
- Location:
- main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/batching.py
r15066 r15140 528 528 problems. 529 529 """ 530 if obj.student.studycourse_locked: 531 return 'Studycourse is locked.' 530 532 certificate = getattr(obj, 'certificate', None) 531 533 entry_session = getattr(obj, 'entry_session', None) … … 619 621 return 620 622 623 def checkUpdateRequirements(self, obj, row, site): 624 """ 625 """ 626 if obj.student.studycourse_locked: 627 return 'Studylevel is locked.' 628 return None 629 621 630 class CourseTicketProcessor(StudentProcessorBase): 622 631 """The Course Ticket Processor imports course tickets, the subobjects … … 714 723 del parent[ticket.code] 715 724 return 725 726 def checkUpdateRequirements(self, obj, row, site): 727 """ 728 """ 729 if obj.student.studycourse_locked: 730 return 'Studycourse is locked.' 731 return None 716 732 717 733 def checkConversion(self, row, mode='ignore'): -
main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/browser.py
r15134 r15140 996 996 997 997 def update(self): 998 if not self.context.is_current: 998 if not self.context.is_current \ 999 or self.context.student.studycourse_locked: 999 1000 emit_lock_message(self) 1000 1001 return … … 1076 1077 """ Page to request transcript by student 1077 1078 """ 1078 grok.context(IStudent )1079 grok.context(IStudentTranscript) 1079 1080 grok.name('request_transcript') 1080 1081 grok.require('waeup.handleStudent') … … 1146 1147 return 1147 1148 1148 class StudentTranscriptReleasesFormPage(KofaEditFormPage): 1149 class StudentTranscriptValidateView(UtilityView, grok.View): 1150 """ View to validate transcript 1151 """ 1152 grok.context(IStudentTranscript) 1153 grok.name('validate_transcript') 1154 grok.require('waeup.processTranscript') 1155 form_fields = grok.AutoFields(IStudentTranscript) 1156 1157 def update(self, SUBMIT=None): 1158 if self.context.student.state != TRANSREQ: 1159 self.flash(_('Student is in wrong state.'), type="warning") 1160 self.redirect(self.url(self.context)) 1161 return 1162 # Fire transition 1163 IWorkflowInfo(self.context).fireTransition('validate_transcript') 1164 self.flash(_('Transcript validated.')) 1165 self.redirect(self.url(self.context)) 1166 return 1167 1168 def render(self): 1169 return 1170 1171 class StudentTranscriptReleaseFormPage(KofaEditFormPage): 1149 1172 """ Page to release transcript 1150 1173 """ 1151 grok.context(IStudent )1174 grok.context(IStudentTranscript) 1152 1175 grok.name('release_transcript') 1153 1176 grok.require('waeup.processTranscript') … … 1155 1178 form_fields = grok.AutoFields(IStudentTranscript) 1156 1179 label = _('Release transcript') 1157 buttonname = _('Save comment and mark as released')1180 buttonname = _('Save comment and release transcript') 1158 1181 pnav = 4 1159 1182 1160 1183 def update(self, SUBMIT=None): 1161 super(StudentTranscriptRelease sFormPage, self).update()1184 super(StudentTranscriptReleaseFormPage, self).update() 1162 1185 if self.context.state != TRANSVAL: 1163 1186 self.flash(_('Student is in wrong state.'), type="warning") … … 1173 1196 # Fire transition 1174 1197 IWorkflowInfo(self.context).fireTransition('release_transcript') 1175 self.flash(_('Transcript released .'))1198 self.flash(_('Transcript released and final transcript file saved.')) 1176 1199 comment = self.request.form.get('comment', '').replace('\r', '') 1177 1200 tz = getattr(queryUtility(IKofaUtils), 'tzinfo', pytz.utc) … … 1190 1213 # Show and produce transcript file 1191 1214 self.redirect(self.url(self.context) + '/studycourse/transcript.pdf') 1192 1193 #subject = _('Transcript released')1194 #args = {'subject':subject, 'body':comment}1195 #self.redirect(self.url(self.context) +1196 # '/contactstudent?%s' % urlencode(args))1197 1198 1215 return 1199 1216 … … 1202 1219 for this page. It's an emergency page. 1203 1220 """ 1204 grok.context(IStudent )1221 grok.context(IStudentTranscript) 1205 1222 grok.name('manage_transcript_request') 1206 1223 grok.require('waeup.processTranscript') … … 1308 1325 ] 1309 1326 1310 returnstudents_utils.renderPDFTranscript(1327 pdfstream = students_utils.renderPDFTranscript( 1311 1328 self, 'transcript.pdf', 1312 1329 self.context.student, studentview, … … 1317 1334 save_file=self._save_file(), 1318 1335 ) 1336 if not pdfstream: 1337 self.redirect(self.url(self.context.student)) 1338 return 1339 return pdfstream 1319 1340 1320 1341 class StudentTransferFormPage(KofaAddFormPage): … … 1494 1515 1495 1516 def update(self, ADD=None, course=None): 1496 if not self.context.__parent__.is_current: 1517 if not self.context.__parent__.is_current \ 1518 or self.context.student.studycourse_locked: 1497 1519 emit_lock_message(self) 1498 1520 return … … 1566 1588 emit_lock_message(self) 1567 1589 return 1568 if str(self.context. __parent__.current_level) != self.context.__name__:1590 if str(self.context.student.current_level) != self.context.__name__: 1569 1591 self.flash(_('This is not the student\'s current level.'), 1570 1592 type="danger") … … 1662 1684 1663 1685 def update(self): 1664 if not self.context.__parent__.is_current: 1686 if not self.context.__parent__.is_current \ 1687 or self.context.student.studycourse_locked: 1665 1688 emit_lock_message(self) 1666 1689 return … … 1714 1737 pnav = 4 1715 1738 grok.template('courseticketmanagepage') 1739 1740 def update(self): 1741 if not self.context.__parent__.__parent__.is_current \ 1742 or self.context.student.studycourse_locked: 1743 emit_lock_message(self) 1744 return 1745 super(CourseTicketManageFormPage, self).update() 1746 return 1716 1747 1717 1748 @property … … 2642 2673 2643 2674 def update(self): 2644 if not self.context.is_current: 2675 if not self.context.is_current \ 2676 or self.context.student.studycourse_locked: 2645 2677 emit_lock_message(self) 2646 2678 return -
main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/fileviewlets.py
r14880 r15140 153 153 154 154 155 class FinalTranscriptImage(StudentImage): 156 """Renders final transcript. 157 """ 158 grok.name('final_transcript') 159 download_name = u'final_transcript' 160 161 155 162 class BirthCertificateImage(StudentImage): 156 163 """Renders birth certificate scan. -
main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/student.py
r14169 r15140 38 38 IKofaUtils, registration_states_vocab, IExtFileStore, 39 39 CREATED, ADMITTED, CLEARANCE, PAID, REGISTERED, VALIDATED, RETURNING, 40 GRADUATED )40 GRADUATED, TRANSVAL, TRANSREL) 41 41 from waeup.kofa.students.accommodation import StudentAccommodation 42 42 from waeup.kofa.students.interfaces import ( … … 239 239 def transcript_enabled(self): 240 240 return True 241 242 @property 243 def studycourse_locked(self): 244 return self.state in (GRADUATED, TRANSREL, TRANSVAL) 241 245 242 246 @property -
main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/tests/test_browser.py
r15128 r15140 2151 2151 self.browser.getLink("K1000000").click() 2152 2152 self.assertFalse('Release transcript request' in self.browser.contents) 2153 # ToDo: Somebody has to validate the transcript 2154 2155 2156 2157 IWorkflowState(self.student).setState('transcript validated') 2158 2159 2160 2161 self.browser.open(self.student_path) 2153 # Officer has to validate the transcript 2154 self.browser.getLink("Validate transcript").click() 2155 2156 2157 2158 2162 2159 self.assertTrue('Release transcript' in self.browser.contents) 2163 2160 # Now the transcript can be released. … … 2168 2165 self.browser.getControl(name="comment").value = ( 2169 2166 'Hello,\nYour transcript has been sent to the address provided.') 2170 self.browser.getControl("Save comment and mark as released").click()2167 self.browser.getControl("Save comment and release transcript").click() 2171 2168 self.assertTrue( 2172 2169 'UTC mrtranscript wrote:\n\nHello,\nYour transcript has ' … … 2178 2175 logcontent = open(logfile).read() 2179 2176 self.assertTrue( 2180 'mrtranscript - students.browser.StudentTranscriptRelease sFormPage - '2177 'mrtranscript - students.browser.StudentTranscriptReleaseFormPage - ' 2181 2178 'K1000000 - comment: Hello,<br>' 2182 2179 'Your transcript has been sent to the address provided' … … 2186 2183 storage = getUtility(IExtFileStore) 2187 2184 file_id = IFileStoreNameChooser( 2188 self.student).chooseName(attr=' transcript.pdf')2185 self.student).chooseName(attr='final_transcript.pdf') 2189 2186 pdf = storage.getFile(file_id).read() 2190 2187 self.assertTrue(len(pdf) > 0) -
main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/utils.py
r15128 r15140 860 860 file_store = getUtility(IExtFileStore) 861 861 file_id = IFileStoreNameChooser(student).chooseName( 862 attr=" transcript.pdf")862 attr="final_transcript.pdf") 863 863 file_store.createFile(file_id, StringIO(transcript)) 864 864 return … … 979 979 if save_file: 980 980 self._saveTranscriptPDF(student, pdf_stream) 981 return 981 982 return pdf_stream 982 983 -
main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/viewlets.py
r15134 r15140 32 32 OnlinePaymentDisplayFormPage, BedTicketDisplayFormPage, 33 33 StudentClearanceEditFormPage, StudentPersonalEditFormPage, 34 PaymentsManageFormPage, StudyCourseTranscriptPage, EditScoresPage )34 PaymentsManageFormPage, StudyCourseTranscriptPage, EditScoresPage,) 35 35 from waeup.kofa.students.interfaces import ( 36 36 IStudentsContainer, IStudent, IStudentStudyCourse, IStudentStudyLevel, 37 37 ICourseTicket, IStudentOnlinePayment, IBedTicket, 38 IStudentPaymentsContainer, IStudentsUtils 38 IStudentPaymentsContainer, IStudentsUtils, IStudentTranscript 39 39 ) 40 40 from waeup.kofa.students.workflow import ( … … 145 145 class StudentManageTranscriptLink(StudentManageLink): 146 146 grok.order(9) 147 link = ' transcript.pdf'147 link = 'final_transcript' 148 148 text = _(u'Final Transcript') 149 149 … … 155 155 text = translate( 156 156 self.text, 'waeup.kofa', target_language=lang) 157 url = self.view.url(self.context.student ['studycourse'], self.link)157 url = self.view.url(self.context.student, self.link) 158 158 return u'<li><a href="%s">%s</a></li>' % ( 159 159 url, text) … … 762 762 class RequestTranscriptActionButton(ManageActionButton): 763 763 grok.order(8) 764 grok.context(IStudent )764 grok.context(IStudentTranscript) 765 765 grok.view(StudentBaseDisplayFormPage) 766 766 grok.require('waeup.handleStudent') … … 776 776 777 777 778 class ValidateTranscriptActionButton(ManageActionButton): 779 grok.order(9) 780 grok.context(IStudentTranscript) 781 grok.view(StudentBaseDisplayFormPage) 782 grok.require('waeup.processTranscript') 783 text = _('Validate transcript') 784 target = 'validate_transcript' 785 icon = 'actionicon_transcript.png' 786 787 @property 788 def target_url(self): 789 if self.context.state != TRANSREQ: 790 return '' 791 return self.view.url(self.view.context, self.target) 792 793 @property 794 def onclick(self): 795 return "return window.confirm(%s);" % _( 796 "'Course results cannot be changed after transcript " 797 "validation. \\n\\n" 798 "You really want to validate the transcript?'") 799 800 778 801 class ReleaseTranscriptActionButton(ManageActionButton): 779 802 grok.order(9) 780 grok.context(IStudent )803 grok.context(IStudentTranscript) 781 804 grok.view(StudentBaseDisplayFormPage) 782 805 grok.require('waeup.processTranscript') -
main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/workflow.py
r15128 r15140 209 209 Transition( 210 210 transition_id = 'validate_transcript', 211 title = _(' Transcript validated'),211 title = _('Validate transcript'), 212 212 msg = _("Transcript validated"), 213 213 source = TRANSREQ, … … 216 216 Transition( 217 217 transition_id = 'release_transcript', 218 title = _(' Transcript released'),218 title = _('Release transcript'), 219 219 msg = _("Transcript released"), 220 220 source = TRANSVAL, 221 221 destination = TRANSREL), 222 223 Transition( 224 transition_id = 'reset11', 225 title = _('Reset to graduated'), 226 msg = _("Transcript process reset"), 227 source = TRANSREL, 228 destination = GRADUATED), 222 229 ) 223 230
Note: See TracChangeset for help on using the changeset viewer.