- Timestamp:
- 25 Sep 2018, 11:45:47 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r15173 r15174 1146 1146 return 1147 1147 1148 class StudentTranscriptValidateView(UtilityView, grok.View):1149 """ View to validate transcript1150 """1151 grok.context(IStudentStudyCourse)1152 grok.name('validate_transcript')1153 grok.require('waeup.processTranscript')1154 1155 def update(self, SUBMIT=None):1156 if self.context.student.state != TRANSREQ:1157 self.flash(_('Student is in wrong state.'), type="warning")1158 self.redirect(self.url(self.context))1159 return1160 # Fire transition1161 IWorkflowInfo(self.context.student).fireTransition(1162 'validate_transcript')1163 self.flash(_('Transcript validated.'))1164 self.redirect(self.url(self.context) + '/transcript')1165 return1166 1167 def render(self):1168 return1169 1170 1148 class StudentTranscriptSignView(UtilityView, grok.View): 1171 1149 """ View to sign transcript … … 1208 1186 return 1209 1187 1188 class StudentTranscriptValidateFormPage(KofaEditFormPage): 1189 """ Page to validate transcript 1190 """ 1191 grok.context(IStudentStudyCourse) 1192 grok.name('validate_transcript') 1193 grok.require('waeup.processTranscript') 1194 grok.template('transcriptprocess') 1195 label = _('Validate transcript') 1196 buttonname = _('Save comment and validate transcript') 1197 pnav = 4 1198 1199 def update(self, SUBMIT=None): 1200 super(StudentTranscriptValidateFormPage, self).update() 1201 if self.context.student.state != TRANSREQ: 1202 self.flash(_('Student is in wrong state.'), type="warning") 1203 self.redirect(self.url(self.context)) 1204 return 1205 if getattr(self.context, 'transcript_comment', None) is not None: 1206 self.correspondence = self.context.transcript_comment.replace( 1207 '\n', '<br>') 1208 else: 1209 self.correspondence = '' 1210 if getattr(self.context, 'transcript_signees', None) is not None: 1211 self.signees = self.context.transcript_signees.replace( 1212 '\n', '<br><br>') 1213 else: 1214 self.signees = '' 1215 if SUBMIT is None: 1216 return 1217 # Fire transition 1218 IWorkflowInfo(self.context.student).fireTransition('validate_transcript') 1219 self.flash(_('Transcript validated.')) 1220 comment = self.request.form.get('comment', '').replace('\r', '') 1221 tz = getattr(queryUtility(IKofaUtils), 'tzinfo', pytz.utc) 1222 today = now(tz).strftime('%d/%m/%Y %H:%M:%S %Z') 1223 old_transcript_comment = getattr( 1224 self.context, 'transcript_comment', None) 1225 if old_transcript_comment == None: 1226 old_transcript_comment = '' 1227 self.context.transcript_comment = '''On %s %s wrote: 1228 1229 %s 1230 1231 %s''' % (today, self.request.principal.id, comment, 1232 old_transcript_comment) 1233 self.context.writeLogMessage( 1234 self, 'comment: %s' % comment.replace('\n', '<br>')) 1235 self.redirect(self.url(self.context) + '/transcript') 1236 return 1237 1210 1238 class StudentTranscriptReleaseFormPage(KofaEditFormPage): 1211 1239 """ Page to release transcript … … 1214 1242 grok.name('release_transcript') 1215 1243 grok.require('waeup.processTranscript') 1216 grok.template('transcript release')1244 grok.template('transcriptprocess') 1217 1245 label = _('Release transcript') 1218 1246 buttonname = _('Save comment and release transcript')
Note: See TracChangeset for help on using the changeset viewer.