- Timestamp:
- 7 Aug 2013, 06:46:25 (11 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 1 added
- 2 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r10458 r10459 1064 1064 return 1065 1065 1066 class Student RequestTranscriptPage(KofaPage):1066 class StudentTranscriptRequestPage(KofaPage): 1067 1067 """ Page to transcript by student 1068 1068 """ … … 1070 1070 grok.name('request_transcript') 1071 1071 grok.require('waeup.handleStudent') 1072 grok.template(' requesttranscript')1072 grok.template('transcriptrequest') 1073 1073 label = _('Request transcript') 1074 1074 ac_prefix = 'TSC' … … 1079 1079 1080 1080 def update(self, SUBMIT=None): 1081 super(StudentTranscriptRequestPage, self).update() 1082 tabs.need() 1083 self.tab1 = self.tab2 = '' 1084 qs = self.request.get('QUERY_STRING', '') 1085 if not qs: 1086 qs = 'tab1' 1087 setattr(self, qs, 'active') 1081 1088 if not self.context.state == GRADUATED: 1082 1089 self.flash(_("Wrong state")) … … 1134 1141 return 1135 1142 1136 class Student RequestTranscriptManageFormPage(KofaEditFormPage):1137 """ Page to edit personal data by student1143 class StudentTranscriptRequestProcessFormPage(KofaEditFormPage): 1144 """ Page to process transcript requests 1138 1145 """ 1139 1146 grok.context(IStudent) 1140 grok.name(' manage_transcript_request')1147 grok.name('process_transcript_request') 1141 1148 grok.require('waeup.manageStudent') 1149 grok.template('transcriptprocess') 1142 1150 form_fields = grok.AutoFields(IStudentTranscript) 1143 label = _('Manage transcript request') 1144 pnav = 4 1145 1146 def update(self): 1147 super(StudentRequestTranscriptManageFormPage, self).update() 1151 label = _('Process transcript request') 1152 buttonname = _('Save comment and mark as processed') 1153 pnav = 4 1154 1155 def update(self, SUBMIT=None): 1156 super(StudentTranscriptRequestProcessFormPage, self).update() 1157 tabs.need() 1158 self.tab1 = self.tab2 = '' 1159 qs = self.request.get('QUERY_STRING', '') 1160 if not qs: 1161 qs = 'tab1' 1162 setattr(self, qs, 'active') 1148 1163 if self.context.state != TRANSCRIPT: 1149 self.flash(_("Wrong state"))1150 self.redirect(self.url(self.context))1151 return1152 1153 #@action(_('Save'), style='primary')1154 #def save(self, **data):1155 # msave(self, **data)1156 # return1157 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 1164 self.flash(_('Student is in wrong state.')) 1166 1165 self.redirect(self.url(self.context)) 1167 1166 return 1168 self.applyData(self.context, **data) 1169 comment = data['transcript_comment'] 1167 if self.context.transcript_comment is not None: 1168 self.correspondence = self.context.transcript_comment.replace( 1169 '\n', '<br>') 1170 else: 1171 self.correspondence = '' 1172 if SUBMIT is None: 1173 return 1174 IWorkflowInfo(self.context).fireTransition('process_transcript') 1175 self.flash(_('Transcript request processed.')) 1176 comment = self.request.form.get('comment', '').replace('\r', '') 1177 tz = getattr(queryUtility(IKofaUtils), 'tzinfo', pytz.utc) 1178 today = now(tz).strftime('%d/%m/%Y %H:%M:%S %Z') 1179 old_transcript_comment = self.context.transcript_comment 1180 if old_transcript_comment == None: 1181 old_transcript_comment = '' 1182 self.context.transcript_comment = '''On %s %s wrote: 1183 1184 %s 1185 1186 %s''' % (today, self.request.principal.id, comment, 1187 old_transcript_comment) 1188 self.context.writeLogMessage( 1189 self, 'comment: %s' % comment.replace('\n', '<br>')) 1190 subject = _('Transcript processed') 1170 1191 if comment: 1171 1192 self.context.writeLogMessage( 1172 1193 self, 'comment: %s' % 1173 1194 comment.replace('\r\n', '<br>')) 1174 args = {'subject': message, 'body':comment}1175 else: 1176 args = {'subject': message,}1195 args = {'subject':subject, 'body':comment} 1196 else: 1197 args = {'subject':subject,} 1177 1198 self.redirect(self.url(self.context) + 1178 1199 '/contactstudent?%s' % urlencode(args)) -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/transcriptrequest.pt
r10458 r10459 1 1 <form method="POST" i18n:domain="waeup.kofa"> 2 <table class="form-table" tal:condition="view/with_ac">3 <tbody>4 <tr>5 <td i18n:translate="">6 Comment:7 </td>8 <td>9 <textarea cols="60" name="comment" rows="6"></textarea>10 </td>11 </tr>12 <tr>13 <td i18n:translate="">14 Dispatch Address:15 </td>16 <td>17 <textarea cols="60" name="address" rows="6"></textarea>18 </td>19 </tr>20 <tr>21 <td i18n:translate="">22 Activation Code:23 </td>24 <td>25 <span tal:replace="view/ac_prefix">PIN Prefix</span> -26 <input name="ac_series" type="text" class="span1" maxlength="3"27 value="" tal:attributes="value view/ac_series"/> -28 <input name="ac_number" type="text" class="span3" maxlength="10"29 value="" tal:attributes="value view/ac_number" />30 <font color="red"><span tal:replace="view/notice">Notice</span>31 </font>32 </td>33 </tr>34 <tr>35 <td> </td>36 <td i18n:translate="">37 The activation code can be found on the payment slip.38 </td>39 </tr>40 <tr>41 <td colspan="2">42 <input type="submit" name="SUBMIT" class="btn primary"43 tal:attributes="value view/buttonname" />44 </td>45 </tr>46 </tbody>47 </table>48 2 49 <span tal:omit-tag="" tal:condition="not: view/with_ac"> 50 <input type="submit" name="SUBMIT" class="btn primary" 51 tal:attributes="value view/buttonname" /> 52 </span> 3 <ul class="tabs" data-tabs="tabs"> 4 <li tal:attributes="class view/tab1"><a href="#tab-1"> 5 <span i18n:translate="">Send new request</span></a></li> 6 <li tal:attributes="class view/tab2"><a href="#tab-2"> 7 <span i18n:translate="">View correspondence</span></a></li> 8 </ul> 53 9 54 <h1 i18n:translate="">Correspondence</h1> 55 <p tal:content="structure view/correspondence"></p> 10 <div class="tab-content"> 11 <div id="tab-1" tal:attributes="class view/tab1"> 12 13 <table class="form-table" tal:condition="view/with_ac"> 14 <tbody> 15 <tr> 16 <td i18n:translate=""> 17 Comment: 18 </td> 19 <td> 20 <textarea cols="60" name="comment" rows="6"></textarea> 21 </td> 22 </tr> 23 <tr> 24 <td i18n:translate=""> 25 Dispatch Address: 26 </td> 27 <td> 28 <textarea cols="60" name="address" rows="6"></textarea> 29 </td> 30 </tr> 31 <tr> 32 <td i18n:translate=""> 33 Activation Code: 34 </td> 35 <td> 36 <span tal:replace="view/ac_prefix">PIN Prefix</span> - 37 <input name="ac_series" type="text" class="span1" maxlength="3" 38 value="" tal:attributes="value view/ac_series"/> - 39 <input name="ac_number" type="text" class="span3" maxlength="10" 40 value="" tal:attributes="value view/ac_number" /> 41 <font color="red"><span tal:replace="view/notice">Notice</span> 42 </font> 43 </td> 44 </tr> 45 <tr> 46 <td> </td> 47 <td i18n:translate=""> 48 The activation code can be found on the payment slip. 49 </td> 50 </tr> 51 <tr> 52 <td colspan="2"> 53 <input type="submit" name="SUBMIT" class="btn primary" 54 tal:attributes="value view/buttonname" /> 55 </td> 56 </tr> 57 </tbody> 58 </table> 59 <span tal:omit-tag="" tal:condition="not: view/with_ac"> 60 <input type="submit" name="SUBMIT" class="btn primary" 61 tal:attributes="value view/buttonname" /> 62 </span> 63 </div> 64 65 <div id="tab-2" tal:attributes="class view/tab2"> 66 <p tal:content="structure view/correspondence"></p> 67 </div> 68 </div> 56 69 57 70 </form> -
main/waeup.kofa/trunk/src/waeup/kofa/students/viewlets.py
r10458 r10459 692 692 return self.view.url(self.view.context, self.target) 693 693 694 class ManageTranscriptRequestActionButton(ManageActionButton):694 class ProcessTranscriptRequestActionButton(ManageActionButton): 695 695 grok.order(9) 696 696 grok.context(IStudent) 697 697 grok.view(StudentBaseDisplayFormPage) 698 grok.require('waeup. manageStudent')698 grok.require('waeup.viewTranscript') 699 699 text = _('Manage transcript request') 700 target = ' manage_transcript_request'700 target = 'process_transcript_request' 701 701 icon = 'actionicon_transcript.png' 702 702
Note: See TracChangeset for help on using the changeset viewer.