Changeset 10458
- Timestamp:
- 6 Aug 2013, 20:32:53 (11 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/browser/layout.py
r9703 r10458 224 224 self.widgets['next_kin_address'].cssClass = 'span8' 225 225 self.widgets['next_kin_address'].height = 6 226 if self.widgets.get('transcript_comment'): 227 self.widgets['transcript_comment'].cssClass = 'span8' 228 self.widgets['transcript_comment'].height = 6 226 229 if self.widgets.get('notice'): 227 230 self.widgets['notice'].cssClass = 'span8' -
main/waeup.kofa/trunk/src/waeup/kofa/browser/tests/test_browser.py
r10453 r10458 338 338 'nationality,officer_comment,perm_address,personal_updated,' 339 339 'phone,reg_number,sex,student_id,suspended,suspended_comment,' 340 'transcript_ address,'340 'transcript_comment,' 341 341 'password,state,history,certcode,is_postgrad,current_level,' 342 342 'current_session\r\n') -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r10440 r10458 20 20 import sys 21 21 import grok 22 import pytz 22 23 from urllib import urlencode 23 24 from datetime import datetime … … 64 65 from waeup.kofa.university.vocabularies import course_levels 65 66 from waeup.kofa.utils.batching import VirtualExportJobContainer 66 from waeup.kofa.utils.helpers import get_current_principal, to_timezone 67 from waeup.kofa.utils.helpers import get_current_principal, to_timezone, now 67 68 from waeup.kofa.widgets.restwidget import ReSTDisplayWidget 68 69 from waeup.kofa.students.interfaces import ( … … 74 75 ICourseTicket, ICourseTicketAdd, IStudentPaymentsContainer, 75 76 IStudentOnlinePayment, IStudentPreviousPayment, IStudentBalancePayment, 76 IBedTicket, IStudentsUtils, IStudentRequestPW 77 IBedTicket, IStudentsUtils, IStudentRequestPW, IStudentTranscript 77 78 ) 78 79 from waeup.kofa.students.catalog import search, StudentQueryResultItem … … 82 83 from waeup.kofa.students.workflow import (CREATED, ADMITTED, PAID, 83 84 CLEARANCE, REQUESTED, RETURNING, CLEARED, REGISTERED, VALIDATED, 84 FORBIDDEN_POSTGRAD_TRANS)85 GRADUATED, TRANSCRIPT, FORBIDDEN_POSTGRAD_TRANS) 85 86 86 87 … … 1061 1062 self,'removed: %s' % ', '.join(deleted)) 1062 1063 self.redirect(self.url(self.context, u'@@manage')+'?tab2') 1064 return 1065 1066 class StudentRequestTranscriptPage(KofaPage): 1067 """ Page to transcript by student 1068 """ 1069 grok.context(IStudent) 1070 grok.name('request_transcript') 1071 grok.require('waeup.handleStudent') 1072 grok.template('requesttranscript') 1073 label = _('Request transcript') 1074 ac_prefix = 'TSC' 1075 notice = '' 1076 pnav = 4 1077 buttonname = _('Request transcript now') 1078 with_ac = True 1079 1080 def update(self, SUBMIT=None): 1081 if not self.context.state == GRADUATED: 1082 self.flash(_("Wrong state")) 1083 self.redirect(self.url(self.context)) 1084 return 1085 if self.with_ac: 1086 self.ac_series = self.request.form.get('ac_series', None) 1087 self.ac_number = self.request.form.get('ac_number', None) 1088 if self.context.transcript_comment is not None: 1089 self.correspondence = self.context.transcript_comment.replace( 1090 '\n', '<br>') 1091 else: 1092 self.correspondence = '' 1093 if SUBMIT is None: 1094 return 1095 if self.with_ac: 1096 pin = '%s-%s-%s' % (self.ac_prefix, self.ac_series, self.ac_number) 1097 code = get_access_code(pin) 1098 if not code: 1099 self.flash(_('Activation code is invalid.')) 1100 return 1101 if code.state == USED: 1102 self.flash(_('Activation code has already been used.')) 1103 return 1104 # Mark pin as used (this also fires a pin related transition) 1105 # and fire transition start_clearance 1106 comment = _(u"invalidated") 1107 # Here we know that the ac is in state initialized so we do not 1108 # expect an exception, but the owner might be different 1109 if not invalidate_accesscode(pin, comment, self.context.student_id): 1110 self.flash(_('You are not the owner of this access code.')) 1111 return 1112 self.context.clr_code = pin 1113 IWorkflowInfo(self.context).fireTransition('request_transcript') 1114 comment = self.request.form.get('comment', '').replace('\r', '') 1115 address = self.request.form.get('address', '').replace('\r', '') 1116 tz = getattr(queryUtility(IKofaUtils), 'tzinfo', pytz.utc) 1117 today = now(tz).strftime('%d/%m/%Y %H:%M:%S %Z') 1118 old_transcript_comment = self.context.transcript_comment 1119 if old_transcript_comment == None: 1120 old_transcript_comment = '' 1121 self.context.transcript_comment = '''On %s %s wrote: 1122 1123 %s 1124 1125 Dispatch Address: 1126 %s 1127 1128 %s''' % (today, self.request.principal.id, comment, address, 1129 old_transcript_comment) 1130 self.context.writeLogMessage( 1131 self, 'comment: %s' % comment.replace('\n', '<br>')) 1132 self.flash(_('Transcript processing has been started.')) 1133 self.redirect(self.url(self.context)) 1134 return 1135 1136 class StudentRequestTranscriptManageFormPage(KofaEditFormPage): 1137 """ Page to edit personal data by student 1138 """ 1139 grok.context(IStudent) 1140 grok.name('manage_transcript_request') 1141 grok.require('waeup.manageStudent') 1142 form_fields = grok.AutoFields(IStudentTranscript) 1143 label = _('Manage transcript request') 1144 pnav = 4 1145 1146 def update(self): 1147 super(StudentRequestTranscriptManageFormPage, self).update() 1148 if self.context.state != TRANSCRIPT: 1149 self.flash(_("Wrong state")) 1150 self.redirect(self.url(self.context)) 1151 return 1152 1153 #@action(_('Save'), style='primary') 1154 #def save(self, **data): 1155 # msave(self, **data) 1156 # return 1157 1158 @action(_('Save comment and mark as processed'), style='primary') 1159 def process(self, **data): 1160 if self.context.state == TRANSCRIPT: 1161 IWorkflowInfo(self.context).fireTransition('process_transcript') 1162 message = _('Transcript request processed.') 1163 self.flash(message) 1164 else: 1165 self.flash(_('Student is in wrong state.')) 1166 self.redirect(self.url(self.context)) 1167 return 1168 self.applyData(self.context, **data) 1169 comment = data['transcript_comment'] 1170 if comment: 1171 self.context.writeLogMessage( 1172 self, 'comment: %s' % 1173 comment.replace('\r\n', '<br>')) 1174 args = {'subject':message, 'body':comment} 1175 else: 1176 args = {'subject':message,} 1177 self.redirect(self.url(self.context) + 1178 '/contactstudent?%s' % urlencode(args)) 1063 1179 return 1064 1180 -
main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py
r10452 r10458 336 336 """ 337 337 338 transcript_address = schema.Text( 339 title = _(u'Address'), 340 required = False, 341 description = _( 342 u'Enter address the transcript has been shipped to.'), 338 transcript_comment = schema.Text( 339 title = _(u'Comment'), 340 required = False, 343 341 ) 344 342 -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py
r10455 r10458 141 141 'nationality,officer_comment,perm_address,personal_updated,' 142 142 'phone,reg_number,sex,student_id,suspended,suspended_comment,' 143 'transcript_ address,password,state,history,certcode,is_postgrad,'143 'transcript_comment,password,state,history,certcode,is_postgrad,' 144 144 'current_level,current_session\r\n' 145 145 'my adm code,0,my clr code,' … … 163 163 'nationality,officer_comment,perm_address,personal_updated,' 164 164 'phone,reg_number,sex,student_id,suspended,suspended_comment,' 165 'transcript_ address,password,state,history,certcode,'165 'transcript_comment,password,state,history,certcode,' 166 166 'is_postgrad,current_level,current_session\r\n' 167 167 'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,' … … 183 183 'nationality,officer_comment,perm_address,personal_updated,' 184 184 'phone,reg_number,sex,student_id,suspended,suspended_comment,' 185 'transcript_ address,password,state,history,certcode,'185 'transcript_comment,password,state,history,certcode,' 186 186 'is_postgrad,current_level,current_session\r\n' 187 187 'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,' -
main/waeup.kofa/trunk/src/waeup/kofa/students/viewlets.py
r10278 r10458 33 33 from waeup.kofa.students.workflow import ( 34 34 ADMITTED, PAID, REQUESTED, RETURNING, CLEARED, REGISTERED, 35 VALIDATED )35 VALIDATED, GRADUATED, TRANSCRIPT) 36 36 from waeup.kofa.students.browser import ( 37 37 clearance_disabled_message, … … 675 675 @property 676 676 def target_url(self): 677 return self.view.url(self.view.context, self.target) 678 679 class RequestTranscriptActionButton(ManageActionButton): 680 grok.order(8) 681 grok.context(IStudent) 682 grok.view(StudentBaseDisplayFormPage) 683 grok.require('waeup.handleStudent') 684 text = _('Request transcript') 685 target = 'request_transcript' 686 icon = 'actionicon_transcript.png' 687 688 @property 689 def target_url(self): 690 if self.context.state != GRADUATED: 691 return '' 692 return self.view.url(self.view.context, self.target) 693 694 class ManageTranscriptRequestActionButton(ManageActionButton): 695 grok.order(9) 696 grok.context(IStudent) 697 grok.view(StudentBaseDisplayFormPage) 698 grok.require('waeup.manageStudent') 699 text = _('Manage transcript request') 700 target = 'manage_transcript_request' 701 icon = 'actionicon_transcript.png' 702 703 @property 704 def target_url(self): 705 if self.context.state != TRANSCRIPT: 706 return '' 677 707 return self.view.url(self.view.context, self.target) 678 708
Note: See TracChangeset for help on using the changeset viewer.