Changeset 10266 for main/waeup.kofa/trunk
- Timestamp:
- 31 May 2013, 17:48:29 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r10262 r10266 166 166 return True 167 167 168 def level_dict(studycourse): 169 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 170 level_dict = {} 171 studylevelsource = StudyLevelSource().factory 172 for code in studylevelsource.getValues(studycourse): 173 title = translate(studylevelsource.getTitle(studycourse, code), 174 'waeup.kofa', target_language=portal_language) 175 level_dict[code] = title 176 return level_dict 177 168 178 class StudentsBreadcrumb(Breadcrumb): 169 179 """A breadcrumb for the students container. … … 991 1001 992 1002 @property 993 def level_dict (self):1003 def level_dicts(self): 994 1004 studylevelsource = StudyLevelSource().factory 995 1005 for code in studylevelsource.getValues(self.context): … … 998 1008 999 1009 @property 1000 def session_dict (self):1010 def session_dicts(self): 1001 1011 yield(dict(code='', title='--')) 1002 1012 for item in academic_sessions(): … … 1058 1068 1059 1069 def update(self): 1070 if not self.context.student.transcript_enabled: 1071 self.flash(_('You are not allowed to view the transcript.')) 1072 self.redirect(self.url(self.context)) 1073 return 1060 1074 super(StudyCourseTranscriptPage, self).update() 1061 1075 self.semester_dict = getUtility(IKofaUtils).SEMESTER_DICT 1076 self.level_dict = level_dict(self.context) 1062 1077 self.session_dict = dict( 1063 1078 [(item[1], item[0]) for item in academic_sessions()]) 1064 self.course_levels = course_levels1065 1079 self.studymode_dict = getUtility(IKofaUtils).STUDY_MODES_DICT 1066 1080 return … … 1087 1101 1088 1102 def update(self): 1103 if not self.context.student.transcript_enabled: 1104 self.flash(_('You are not allowed to download the transcript.')) 1105 self.redirect(self.url(self.context)) 1106 return 1089 1107 super(ExportPDFTranscriptPage, self).update() 1090 1108 self.semester_dict = getUtility(IKofaUtils).SEMESTER_DICT 1109 self.level_dict = level_dict(self.context) 1091 1110 self.session_dict = dict( 1092 1111 [(item[1], item[0]) for item in academic_sessions()]) 1093 self.course_levels = course_levels1094 1112 self.studymode_dict = getUtility(IKofaUtils).STUDY_MODES_DICT 1095 1113 return -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/studycoursemanagepage.pt
r9437 r10266 71 71 </span> 72 72 <select id="addlevel" name="addlevel" class='span5'> 73 <option tal:attributes="value level/code" tal:repeat="level view/level_dict ">73 <option tal:attributes="value level/code" tal:repeat="level view/level_dicts"> 74 74 <span tal:replace="level/title">LEVELTITLE 75 75 </span> … … 78 78 <span i18n:translate="">in session</span> 79 79 <select id="level_session" name="level_session" class='span3'> 80 <option tal:attributes="value session/code" tal:repeat="session view/session_dict ">80 <option tal:attributes="value session/code" tal:repeat="session view/session_dicts"> 81 81 <span tal:replace="session/title">LEVELSESSION 82 82 </span> -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/transcript.pt
r10262 r10266 46 46 level['tickets_2'], level['tickets_3'])"> 47 47 <tr tal:repeat="ticket semester_tickets" class="gradeC"> 48 <td tal:content="python: view. course_levels.getTerm(ticket.level).title">LEVEL</td>48 <td tal:content="python: view.level_dict[ticket.level]">LEVEL</td> 49 49 <td tal:content="python: view.session_dict[ticket.level_session]">SESSION</td> 50 50 <td tal:content="python: view.semester_dict[ticket.semester]">SEMESTER</td> -
main/waeup.kofa/trunk/src/waeup/kofa/students/student.py
r10245 r10266 232 232 return False 233 233 234 @property 235 def transcript_enabled(self): 236 return True 237 234 238 def transfer(self, certificate, current_session=None, 235 239 current_level=None, current_verdict=None, previous_verdict=None): -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r10260 r10266 2205 2205 self.assertTrue('Course list has been registered' in self.browser.contents) 2206 2206 self.assertEqual(self.student.state, 'courses registered') 2207 # Students can open the pdf transcript 2208 self.browser.open(self.student_path + '/studycourse/transcript.pdf') 2207 # Students can view the transcript 2208 self.browser.open(self.studycourse_path) 2209 self.browser.getLink("Transcript").click() 2210 self.browser.getLink("Academic Transcript").click() 2209 2211 self.assertEqual(self.browser.headers['Status'], '200 Ok') 2210 2212 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') -
main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py
r10262 r10266 216 216 data = [] 217 217 style = getSampleStyleSheet() 218 219 218 for level in levels_data: 220 219 level_obj = level['level'] … … 226 225 view.session_dict[level_obj.level_session], 227 226 trans(_('Level'), lang), 228 view. course_levels.getTerm(level_obj.level).title)227 view.level_dict[level_obj.level]) 229 228 data.append(Paragraph(subheader, HEADING_STYLE)) 230 229 for element in tableheader: -
main/waeup.kofa/trunk/src/waeup/kofa/students/viewlets.py
r10080 r10266 45 45 AccommodationManageFormPage, BedTicketDisplayFormPage, 46 46 StudentClearanceEditFormPage, StudentPersonalEditFormPage, 47 PaymentsManageFormPage )47 PaymentsManageFormPage, StudyCourseTranscriptPage) 48 48 from waeup.kofa.students.interfaces import ( 49 49 IStudentsContainer, IStudent, IStudentStudyCourse, IStudentAccommodation, … … 341 341 def target_url(self): 342 342 if self.context.is_current: 343 return self.view.url(self.view.context, self.target) 344 return False 345 346 class StudyCourseTranscriptActionButton(ManageActionButton): 347 grok.order(2) 348 grok.context(IStudentStudyCourse) 349 grok.view(StudyCourseDisplayFormPage) 350 grok.require('waeup.viewStudent') 351 text = _('Transcript') 352 target = 'transcript' 353 icon = 'actionicon_transcript.png' 354 355 @property 356 def target_url(self): 357 if self.context.student.transcript_enabled: 358 return self.view.url(self.view.context, self.target) 359 return False 360 361 class TranscriptSlipActionButton(ManageActionButton): 362 grok.order(1) 363 grok.context(IStudentStudyCourse) 364 grok.view(StudyCourseTranscriptPage) 365 grok.require('waeup.viewStudent') 366 text = _('Academic Transcript') 367 target = 'transcript.pdf' 368 icon = 'actionicon_pdf.png' 369 370 @property 371 def target_url(self): 372 if self.context.student.transcript_enabled: 343 373 return self.view.url(self.view.context, self.target) 344 374 return False
Note: See TracChangeset for help on using the changeset viewer.