Changeset 15155
- Timestamp:
- 20 Sep 2018, 07:04:17 (6 years ago)
- Location:
- main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/browser/pages.py
r15154 r15155 1039 1039 grok.context(IUniversity) 1040 1040 grok.template('mytranscriptrequests') 1041 label =_('My T ranscript Requests')1041 label =_('My ToDoList') 1042 1042 1043 1043 @property -
main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/browser/tests/test_browser.py
r15143 r15155 439 439 'nationality,officer_comment,perm_address,personal_updated,' 440 440 'phone,reg_number,sex,student_id,suspended,suspended_comment,' 441 'transcript_comment,transcript_signees,'442 441 'password,state,history,certcode,is_postgrad,current_level,' 443 442 'current_session\r\n') -
main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/browser/viewlets.py
r14286 r15155 365 365 return '' 366 366 367 class TranscriptOfficerStudents(ManageLink): 368 """A link to transcript requests. 369 """ 370 grok.order(6) 371 grok.require('waeup.Authenticated') 372 373 link = u'my_transcript_requests' 374 text = _(u'My ToDoList') 375 376 def render(self): 377 user_account = get_user_account(self.request) 378 if user_account: 379 local_roles = user_account.getLocalRoles() 380 if local_roles.has_key('waeup.local.TranscriptOfficer'): 381 url = self.view.url(grok.getSite(), self.link) 382 text = translate(self.text, context=self.request) 383 return u'<li><a href="%s">%s</a></li>' % (url, text) 384 return '' 385 367 386 class MyPreferences(ManageLink): 368 387 """A link to personal preferences, placed in upper left box. -
main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/permissions.py
r15153 r15155 393 393 """The LocalTranscriptOfficer role can be assigned at faculty 394 394 level. The role allows to view, to validate and to 395 release student transcripts. 395 release student transcripts at faculty level. 396 Local Transcript Officers get the TranscriptOfficer role 397 for this subset of students. 396 398 """ 397 399 grok.name('waeup.local.TranscriptOfficer') 398 400 grok.title(u'Transcript Officer') 399 grok.permissions('waeup.viewAcademics', 400 'waeup.viewTranscript', 401 'waeup.processTranscript', 402 'waeup.viewStudent', 403 ) 401 grok.permissions('waeup.viewAcademics',) 404 402 405 403 406 404 class LocalTranscriptSignee(grok.Role): 407 405 """The LocalTranscriptSignee role can be assigned at faculty 408 level. The role allows to view and to sign student transcripts. 406 level. The role allows to view and to sign student transcripts 407 at faculty level. Local Transcript Signees get the TranscriptSignee role 408 for this subset of students. 409 409 """ 410 410 grok.name('waeup.local.TranscriptSignee') 411 411 grok.title(u'Transcript Signee') 412 grok.permissions('waeup.viewAcademics', 413 'waeup.viewTranscript', 414 'waeup.signTranscript', 415 'waeup.viewStudent', 416 'waeup.viewStudentsContainer', 417 ) 412 grok.permissions('waeup.viewAcademics',) 418 413 419 414 -
main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/browser.py
r15150 r15155 68 68 IStudentsContainer, IStudent, IUGStudentClearance, IPGStudentClearance, 69 69 IStudentPersonal, IStudentPersonalEdit, IStudentBase, IStudentStudyCourse, 70 IStudentStudyCourseTransfer, IStudentStudyCourseTranscript,70 IStudentStudyCourseTransfer, 71 71 IStudentAccommodation, IStudentStudyLevel, ICourseTicket, ICourseTicketAdd, 72 72 IStudentPaymentsContainer, IStudentOnlinePayment, IStudentPreviousPayment, … … 1074 1074 """ Page to request transcript by student 1075 1075 """ 1076 grok.context(IStudent Transcript)1076 grok.context(IStudent) 1077 1077 grok.name('request_transcript') 1078 1078 grok.require('waeup.handleStudent') … … 1094 1094 self.ac_series = self.request.form.get('ac_series', None) 1095 1095 self.ac_number = self.request.form.get('ac_number', None) 1096 if self.context.transcript_comment is not None: 1097 self.correspondence = self.context.transcript_comment.replace( 1098 '\n', '<br>') 1096 if getattr( 1097 self.context['studycourse'], 'transcript_comment', None) is not None: 1098 self.correspondence = self.context[ 1099 'studycourse'].transcript_comment.replace( 1100 '\n', '<br>') 1099 1101 else: 1100 1102 self.correspondence = '' … … 1126 1128 tz = getattr(queryUtility(IKofaUtils), 'tzinfo', pytz.utc) 1127 1129 today = now(tz).strftime('%d/%m/%Y %H:%M:%S %Z') 1128 old_transcript_comment = self.context.transcript_comment 1130 old_transcript_comment = getattr( 1131 self.context['studycourse'], 'transcript_comment', None) 1129 1132 if old_transcript_comment == None: 1130 1133 old_transcript_comment = '' 1131 self.context .transcript_comment = '''On %s %s wrote:1134 self.context['studycourse'].transcript_comment = '''On %s %s wrote: 1132 1135 1133 1136 %s … … 1147 1150 """ View to validate transcript 1148 1151 """ 1149 grok.context(IStudent Transcript)1152 grok.context(IStudentStudyCourse) 1150 1153 grok.name('validate_transcript') 1151 1154 grok.require('waeup.processTranscript') … … 1157 1160 return 1158 1161 # Fire transition 1159 IWorkflowInfo(self.context).fireTransition('validate_transcript') 1162 IWorkflowInfo(self.context.student).fireTransition( 1163 'validate_transcript') 1160 1164 self.flash(_('Transcript validated.')) 1161 1165 self.redirect(self.url(self.context)) … … 1185 1189 tz = getattr(queryUtility(IKofaUtils), 'tzinfo', pytz.utc) 1186 1190 today = now(tz).strftime('%d/%m/%Y %H:%M:%S %Z') 1187 prev_transcript_signees = self.context.student.transcript_signees 1191 prev_transcript_signees = getattr( 1192 self.context, 'transcript_signees', None) 1188 1193 if prev_transcript_signees == None: 1189 1194 prev_transcript_signees = '' 1190 self.context. student.transcript_signees = (1195 self.context.transcript_signees = ( 1191 1196 u"Electronically signed by %s (%s) on %s\n%s" 1192 1197 % (self.request.principal.title, self.request.principal.id, today, … … 1201 1206 """ Page to release transcript 1202 1207 """ 1203 grok.context(IStudent Transcript)1208 grok.context(IStudentStudyCourse) 1204 1209 grok.name('release_transcript') 1205 1210 grok.require('waeup.processTranscript') 1206 1211 grok.template('transcriptrelease') 1207 form_fields = grok.AutoFields(IStudentTranscript)1208 1212 label = _('Release transcript') 1209 1213 buttonname = _('Save comment and release transcript') … … 1212 1216 def update(self, SUBMIT=None): 1213 1217 super(StudentTranscriptReleaseFormPage, self).update() 1214 if self.context.st ate != TRANSVAL:1218 if self.context.student.state != TRANSVAL: 1215 1219 self.flash(_('Student is in wrong state.'), type="warning") 1216 1220 self.redirect(self.url(self.context)) 1217 1221 return 1218 if self.context.transcript_commentis not None:1222 if getattr(self.context, 'transcript_comment', None) is not None: 1219 1223 self.correspondence = self.context.transcript_comment.replace( 1220 1224 '\n', '<br>') 1221 1225 else: 1222 1226 self.correspondence = '' 1223 if self.context.transcript_signeesis not None:1227 if getattr(self.context, 'transcript_signees', None) is not None: 1224 1228 self.signees = self.context.transcript_signees.replace( 1225 1229 '\n', '<br><br>') … … 1229 1233 return 1230 1234 # Fire transition 1231 IWorkflowInfo(self.context ).fireTransition('release_transcript')1235 IWorkflowInfo(self.context.student).fireTransition('release_transcript') 1232 1236 self.flash(_('Transcript released and final transcript file saved.')) 1233 1237 comment = self.request.form.get('comment', '').replace('\r', '') … … 1246 1250 self, 'comment: %s' % comment.replace('\n', '<br>')) 1247 1251 # Produce transcript file 1248 self.redirect(self.url(self.context) + '/ studycourse/transcript.pdf')1252 self.redirect(self.url(self.context) + '/transcript.pdf') 1249 1253 return 1250 1254 … … 1253 1257 for this page. It's an emergency page. 1254 1258 """ 1255 grok.context(IStudent Transcript)1259 grok.context(IStudentStudyCourse) 1256 1260 grok.name('manage_transcript_request') 1257 1261 grok.require('waeup.processTranscript') … … 1301 1305 grok.name('transcript.pdf') 1302 1306 grok.require('waeup.viewTranscript') 1303 form_fields = grok.AutoFields(IStudentStudyCourseTranscript)1304 1307 prefix = 'form' 1305 1308 omit_fields = ( … … 1332 1335 1333 1336 def _sigsInFooter(self): 1334 if self.context.student.transcript_signees: 1337 if getattr( 1338 self.context.student['studycourse'], 'transcript_signees', None): 1335 1339 return () 1336 1340 return (_('CERTIFIED TRUE COPY'),) … … 1340 1344 1341 1345 def _digital_sigs(self): 1342 if self.context.student.transcript_signees: 1343 return self.context.student.transcript_signees #.split('\n') 1346 if getattr( 1347 self.context.student['studycourse'], 'transcript_signees', None): 1348 return self.context.student['studycourse'].transcript_signees 1344 1349 return () 1345 1350 -
main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/dynamicroles.py
r11254 r15155 46 46 'waeup.local.LocalStudentsManager': 'waeup.StudentsManager', 47 47 'waeup.local.LocalWorkflowManager': 'waeup.WorkflowManager', 48 'waeup.local.TranscriptOfficer': 'waeup.TranscriptOfficer', 48 49 } 49 50 -
main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/interfaces.py
r15143 r15155 374 374 375 375 class IStudentTranscript(IKofaObject): 376 """Representation of student transcript data. 376 """Representation of student transcript data. Only used for 377 StudentTranscriptRequestManageFormPage. 377 378 """ 378 379 … … 389 390 390 391 class IStudent(IStudentBase,IUGStudentClearance,IPGStudentClearance, 391 IStudentPersonal , IStudentTranscript):392 IStudentPersonal): 392 393 """Representation of a student. 393 394 """ … … 536 537 IStudentStudyCourseTransfer['current_level'].order = IStudentStudyCourse[ 537 538 'current_level'].order 538 539 class IStudentStudyCourseTranscript(IKofaObject):540 """An interface for student transcripts.541 """542 entry_mode = schema.Choice(543 title = _(u'Entry Mode'),544 source = StudyModeSource(),545 required = True,546 readonly = False,547 )548 549 entry_session = schema.Choice(550 title = _(u'Entry Session'),551 source = academic_sessions_vocab,552 #default = datetime.now().year,553 required = True,554 readonly = False,555 )556 539 557 540 class IStudentVerdictUpdate(IKofaObject): -
main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/permissions.py
r15141 r15155 159 159 """The Transcript Officer is allowed to view, to validate and to 160 160 release student transcripts. The officer is also allowed to 161 manage student data (global role only).161 manage student data. 162 162 """ 163 163 grok.name('waeup.TranscriptOfficer') … … 181 181 'waeup.signTranscript', 182 182 'waeup.viewStudent', 183 'waeup.viewStudentsContainer',184 183 ) 185 184 -
main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/studycourse.py
r14382 r15155 26 26 from waeup.kofa.students.interfaces import ( 27 27 IStudentStudyCourse, IStudentNavigation, IStudentStudyLevel, 28 IStudent StudyCourseTranscript)28 IStudentTranscript) 29 29 from waeup.kofa.students.studylevel import CourseTicket 30 30 from waeup.kofa.students.workflow import CLEARED, RETURNING, PAID … … 34 34 """This is a container for study levels. 35 35 """ 36 grok.implements(IStudentStudyCourse, IStudentNavigation, 37 IStudentStudyCourseTranscript) 36 grok.implements(IStudentStudyCourse, IStudentNavigation) 38 37 grok.provides(IStudentStudyCourse) 39 38 -
main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/tests/test_browser.py
r15154 r15155 2123 2123 IWorkflowState(self.student).setState('transcript requested') 2124 2124 notify(grok.ObjectModifiedEvent(self.student)) 2125 self.student .transcript_comment = (2125 self.student['studycourse'].transcript_comment = ( 2126 2126 u'On 07/08/2013 08:59:54 UTC K1000000 wrote:\n\nComment line 1 \n' 2127 2127 'Comment line2\n\nDispatch Address:\nAddress line 1 \n' … … 2175 2175 self.assertTrue('Form has been saved' in self.browser.contents) 2176 2176 # Officer can validate the transcript 2177 self.browser.open(self.stud ent_path)2177 self.browser.open(self.studycourse_path + '/transcript') 2178 2178 self.browser.getLink("Validate transcript").click() 2179 2179 # After validation all manage forms are locked. … … 2207 2207 self.assertTrue( 2208 2208 u'Electronically signed by Ruth Gordon (mrtranscript) on ' 2209 in self.student .transcript_signees)2209 in self.student['studycourse'].transcript_signees) 2210 2210 # Officer can release the transcript 2211 self.browser.open(self.stud ent_path)2211 self.browser.open(self.studycourse_path + '/transcript') 2212 2212 self.browser.getLink("Release transcript").click() 2213 2213 self.assertTrue(' UTC K1000000 wrote:<br><br>Comment line 1 <br>' … … 2220 2220 'UTC mrtranscript wrote:\n\nHello,\nYour transcript has ' 2221 2221 'been sent to the address provided.\n\n' 2222 in self.student .transcript_comment)2222 in self.student['studycourse'].transcript_comment) 2223 2223 # The comment has been logged 2224 2224 logfile = os.path.join( … … 2250 2250 'application/pdf') 2251 2251 # Transcript views are no longer accesssible 2252 self.browser.open(self.student_path)2253 self.assertFalse('studycourse/transcript' in self.browser.contents)2254 2252 self.browser.open(self.studycourse_path) 2255 2253 self.assertFalse('studycourse/transcript' in self.browser.contents) … … 2264 2262 self.assertFalse('Final Transcript' in self.browser.contents) 2265 2263 # ... and transcript process information has been removed 2266 self.assertEqual(self.student .transcript_comment, None)2267 self.assertEqual(self.student .transcript_signees, None)2264 self.assertEqual(self.student['studycourse'].transcript_comment, None) 2265 self.assertEqual(self.student['studycourse'].transcript_signees, None) 2268 2266 2269 2267 def test_landingpage_transcript_officer(self): … … 3430 3428 '... UTC K1000000 wrote:\n\nComment line 1 \n' 3431 3429 'Comment line2\n\nDispatch Address:\nAddress line 1 \n' 3432 'Address line2\n\n', self.student .transcript_comment)3430 'Address line2\n\n', self.student['studycourse'].transcript_comment) 3433 3431 # The comment has been logged 3434 3432 logfile = os.path.join( … … 3699 3697 'firstname,flash_notice,lastname,matric_number,middlename,nationality,' 3700 3698 'officer_comment,perm_address,personal_updated,phone,reg_number,' 3701 'sex,student_id,suspended,suspended_comment, transcript_comment,'3702 ' transcript_signees,password,state,history,certcode,is_postgrad,'3699 'sex,student_id,suspended,suspended_comment,' 3700 'password,state,history,certcode,is_postgrad,' 3703 3701 'current_level,current_session\r\n' 3704 3702 ',,1981-02-04#,aa@aa.ng,,Anna,,Tester,234,,,,,,' 3705 '1234#,123,m,K1000000,0,, ,,{SSHA}' in self.browser.contents)3703 '1234#,123,m,K1000000,0,,{SSHA}' in self.browser.contents) 3706 3704 3707 3705 def test_payment_dates(self): … … 3805 3803 'firstname,flash_notice,lastname,matric_number,middlename,nationality,' 3806 3804 'officer_comment,perm_address,personal_updated,phone,reg_number,' 3807 'sex,student_id,suspended,suspended_comment, transcript_comment,'3808 ' transcript_signees,password,state,history,certcode,is_postgrad,'3805 'sex,student_id,suspended,suspended_comment,' 3806 'password,state,history,certcode,is_postgrad,' 3809 3807 'current_level,current_session\r\n' 3810 3808 ',,1981-02-04#,aa@aa.ng,,Anna,,Tester,234,,,,,,' 3811 '1234#,123,m,K1000000,0,, ,,{SSHA}' in self.browser.contents)3809 '1234#,123,m,K1000000,0,,{SSHA}' in self.browser.contents) 3812 3810 self.assertEqual(len(self.app['datacenter'].running_exports), 1) 3813 3811 job_id = self.app['datacenter'].running_exports[0][0] -
main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/tests/test_export.py
r15143 r15155 127 127 'my adm code,my clr code,1981-02-04#,anna@sample.com,,' 128 128 'Anna,,Tester,234,M.,NG,,"Studentroad 21\nLagos 123456\n",,' 129 '+234-123-12345#,123,f,A111111,0,,, ,,created'129 '+234-123-12345#,123,f,A111111,0,,,created' 130 130 ) 131 131 … … 160 160 'nationality,officer_comment,perm_address,personal_updated,' 161 161 'phone,reg_number,sex,student_id,suspended,suspended_comment,' 162 ' transcript_comment,transcript_signees,password,state,history,'162 'password,state,history,' 163 163 'certcode,is_postgrad,current_level,current_session\r\n' 164 164 'my adm code,my clr code,' 165 165 '1981-02-04#,anna@sample.com,,Anna,,Tester,234,M.,NG,,' 166 166 '"Studentroad 21\nLagos 123456\n",,+234-123-12345#,123,f,' 167 'A111111,0,,, ,,created'167 'A111111,0,,,created' 168 168 in result 169 169 ) … … 182 182 'nationality,officer_comment,perm_address,personal_updated,' 183 183 'phone,reg_number,sex,student_id,suspended,suspended_comment,' 184 ' transcript_comment,transcript_signees,password,state,history,certcode,'184 'password,state,history,certcode,' 185 185 'is_postgrad,current_level,current_session\r\n' 186 186 'my adm code,my clr code,1981-02-04#,anna@sample.com,,' 187 187 'Anna,,Tester,234,M.,NG,,"Studentroad 21\nLagos 123456\n"' 188 ',,+234-123-12345#,123,f,A111111,0,,, ,,created'188 ',,+234-123-12345#,123,f,A111111,0,,,created' 189 189 in result 190 190 ) … … 202 202 'nationality,officer_comment,perm_address,personal_updated,' 203 203 'phone,reg_number,sex,student_id,suspended,suspended_comment,' 204 ' transcript_comment,transcript_signees,password,state,history,certcode,'204 'password,state,history,certcode,' 205 205 'is_postgrad,current_level,current_session\r\n' 206 206 'my adm code,my clr code,1981-02-04#,anna@sample.com,,' 207 207 'Anna,,Tester,234,M.,NG,,"Studentroad 21\nLagos 123456\n"' 208 ',,+234-123-12345#,123,f,A111111,0,,, ,,created'208 ',,+234-123-12345#,123,f,A111111,0,,,created' 209 209 in result 210 210 ) -
main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/viewlets.py
r15150 r15155 36 36 IStudentsContainer, IStudent, IStudentStudyCourse, IStudentStudyLevel, 37 37 ICourseTicket, IStudentOnlinePayment, IBedTicket, 38 IStudentPaymentsContainer, IStudentsUtils, IStudentTranscript38 IStudentPaymentsContainer, IStudentsUtils, 39 39 ) 40 40 from waeup.kofa.students.workflow import ( … … 747 747 class RequestTranscriptActionButton(ManageActionButton): 748 748 grok.order(8) 749 grok.context(IStudent Transcript)749 grok.context(IStudent) 750 750 grok.view(StudentBaseDisplayFormPage) 751 751 grok.require('waeup.handleStudent') … … 763 763 class ValidateTranscriptActionButton(ManageActionButton): 764 764 grok.order(8) 765 grok.context(IStudent Transcript)766 grok.view(Stud entBaseDisplayFormPage)765 grok.context(IStudentStudyCourse) 766 grok.view(StudyCourseTranscriptPage) 767 767 grok.require('waeup.processTranscript') 768 768 text = _('Validate transcript') … … 772 772 @property 773 773 def target_url(self): 774 if self.context.st ate != TRANSREQ:774 if self.context.student.state != TRANSREQ: 775 775 return '' 776 776 return self.view.url(self.view.context, self.target) … … 786 786 class ReleaseTranscriptActionButton(ManageActionButton): 787 787 grok.order(8) 788 grok.context(IStudent Transcript)789 grok.view(Stud entBaseDisplayFormPage)788 grok.context(IStudentStudyCourse) 789 grok.view(StudyCourseTranscriptPage) 790 790 grok.require('waeup.processTranscript') 791 791 text = _('Release transcript') … … 795 795 @property 796 796 def target_url(self): 797 if self.context.st ate != TRANSVAL:797 if self.context.student.state != TRANSVAL: 798 798 return '' 799 799 return self.view.url(self.view.context, self.target) -
main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/workflow.py
r15153 r15155 303 303 getUtility(IExtFileStore).deleteFileByContext( 304 304 obj, attr='final_transcript') 305 obj .transcript_comment = None306 obj .transcript_signees = None305 obj['studycourse'].transcript_comment = None 306 obj['studycourse'].transcript_signees = None 307 307 # In some tests we don't have a students container 308 308 try:
Note: See TracChangeset for help on using the changeset viewer.