- Timestamp:
- 14 Feb 2019, 15:55:27 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.aaue/trunk/src/waeup/aaue/students/browser.py
r15317 r15330 29 29 from zope.formlib.textwidgets import BytesDisplayWidget 30 30 from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState 31 from waeup.kofa.browser.layout import UtilityView 31 from waeup.kofa.browser.layout import UtilityView, KofaEditFormPage, jsaction 32 32 from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget 33 33 from waeup.kofa.interfaces import ( 34 34 IKofaUtils, academic_sessions_vocab, ICSVExporter, IKofaObject) 35 35 from waeup.kofa.students.interfaces import ( 36 IStudentsUtils, IStudent, IStudentRequestPW )36 IStudentsUtils, IStudent, IStudentRequestPW, IStudentStudyLevel) 37 37 from waeup.kofa.students.workflow import PAID, REGISTERED, RETURNING 38 38 from waeup.kofa.students.browser import ( … … 56 56 StudentRequestPasswordPage, 57 57 StudyCourseManageFormPage, 58 UnregisterCoursesView 58 UnregisterCoursesView, 59 addCourseTicket, 60 emit_lock_message 59 61 ) 60 62 from kofacustom.nigeria.students.browser import ( … … 391 393 'Student ID Card Fee, ' 392 394 'Student Union Dues, ' 395 'Sports Fee, ' 396 'Library Levy, ' 393 397 'Student Welfare Assurance Fee and ') 394 398 else: … … 401 405 text += ('School Fee, ' 402 406 'Student Union Dues, ' 407 'Sports Development Fee, ' 408 'Library Development Levy, ' 403 409 'Student Welfare Assurance Fee and ') 404 410 elif self.context.p_category in ( … … 512 518 """ 513 519 grok.context(ICustomStudentStudyLevel) 520 521 class StudyLevelRepairFormPage(KofaEditFormPage): 522 """ Page to repair the student study level data by students 523 """ 524 grok.context(IStudentStudyLevel) 525 grok.name('repair') 526 grok.require('waeup.editStudyLevel') 527 grok.template('studylevelrepairpage') 528 pnav = 4 529 placeholder = _('Enter valid course code') 530 531 def update(self, ADD=None, course=None): 532 try: 533 studylevel_repair_enabled = grok.getSite()['configuration'][ 534 str(self.context.level_session)].studylevel_repair_enabled 535 except KeyError: 536 emit_lock_message(self) 537 return 538 if not studylevel_repair_enabled: 539 emit_lock_message(self) 540 return 541 super(StudyLevelRepairFormPage, self).update() 542 if ADD is not None: 543 if not course: 544 self.flash(_('No valid course code entered.'), type="warning") 545 return 546 cat = queryUtility(ICatalog, name='courses_catalog') 547 result = cat.searchResults(code=(course, course)) 548 if len(result) != 1: 549 self.flash(_('Course not found.'), type="warning") 550 return 551 course = list(result)[0] 552 addCourseTicket(self, course) 553 return 554 555 @property 556 def label(self): 557 # Here we know that the cookie has been set 558 lang = self.request.cookies.get('kofa.language') 559 level_title = translate(self.context.level_title, 'waeup.kofa', 560 target_language=lang) 561 return _('Repair course list of ${a}', 562 mapping = {'a':level_title}) 563 564 @property 565 def translated_values(self): 566 return translated_values(self) 567 568 def _delCourseTicket(self, **data): 569 form = self.request.form 570 if 'val_id' in form: 571 child_id = form['val_id'] 572 else: 573 self.flash(_('No ticket selected.'), type="warning") 574 self.redirect(self.url(self.context, '@@edit')) 575 return 576 if not isinstance(child_id, list): 577 child_id = [child_id] 578 deleted = [] 579 for id in child_id: 580 # Students are not allowed to remove core tickets 581 if id in self.context and \ 582 self.context[id].removable_by_student: 583 del self.context[id] 584 deleted.append(id) 585 if len(deleted): 586 self.flash(_('Successfully removed: ${a}', 587 mapping = {'a':', '.join(deleted)})) 588 self.context.writeLogMessage( 589 self,'removed: %s at %s' % 590 (', '.join(deleted), self.context.level)) 591 self.redirect(self.url(self.context, u'@@repair')) 592 return 593 594 @jsaction(_('Remove selected tickets')) 595 def delCourseTicket(self, **data): 596 self._delCourseTicket(**data) 597 return 514 598 515 599 class CustomExportPDFCourseRegistrationSlip(
Note: See TracChangeset for help on using the changeset viewer.