Changeset 6792 for main/waeup.sirp/trunk/src/waeup
- Timestamp:
- 18 Sep 2011, 17:59:59 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/students
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
r6790 r6792 566 566 form_fields = grok.AutoFields(IStudentStudyLevel) 567 567 grok.template('studylevelpage') 568 title = 'Study Level' 569 pnav = 4 568 pnav = 4 569 570 @property 571 def title(self): 572 return 'Study Level %s' % self.context.level_title 570 573 571 574 @property … … 573 576 return '%s: Study Level %s' % ( 574 577 self.context.getStudent().name,self.context.level_title) 578 579 class StudyLevelManageActionButton(ManageActionButton): 580 grok.order(1) 581 grok.context(IStudentStudyLevel) 582 grok.view(StudyLevelDisplayFormPage) 583 grok.require('waeup.manageStudents') 584 text = 'Manage' 585 target = 'manage' 586 587 class StudyLevelManageFormPage(WAeUPEditFormPage): 588 """ Page to edit the student study level data 589 """ 590 grok.context(IStudentStudyLevel) 591 grok.name('manage') 592 grok.require('waeup.manageStudents') 593 grok.template('studylevelmanagepage') 594 form_fields = grok.AutoFields(IStudentStudyLevel) 595 pnav = 4 596 taboneactions = ['Save','Cancel'] 597 tabtwoactions = ['Remove selected tickets','Cancel'] 598 tabthreeactions = ['Add course ticket'] 599 600 def update(self): 601 super(StudyLevelManageFormPage, self).update() 602 tabs.need() 603 datatable.need() 604 return 605 606 @property 607 def title(self): 608 return 'Study Level %s' % self.context.level_title 609 610 @property 611 def label(self): 612 return 'Manage study level %s' % self.context.level_title 613 614 @grok.action('Save') 615 def save(self, **data): 616 msave(self, **data) 617 return 618 619 @grok.action('Add course ticket') 620 def addStudyLevel(self, **data): 621 # We need a ticket catalog 622 return 623 624 #course_code = self.request.form.get('addticket', None) 625 #try: 626 # self.context.addCourseTicket( 627 # self.context.certificate,studylevel) 628 #except KeyError: 629 # self.flash('This ticket exists.') 630 #self.redirect(self.url(self.context, u'@@manage')+'#tab-2') 631 #return 632 633 @grok.action('Remove selected tickets') 634 def delCourseTicket(self, **data): 635 form = self.request.form 636 if form.has_key('val_id'): 637 child_id = form['val_id'] 638 else: 639 self.flash('No ticket selected.') 640 self.redirect(self.url(self.context, '@@manage')+'#tab-2') 641 return 642 if not isinstance(child_id, list): 643 child_id = [child_id] 644 deleted = [] 645 for id in child_id: 646 try: 647 del self.context[id] 648 deleted.append(id) 649 except: 650 self.flash('Could not delete %s: %s: %s' % ( 651 id, sys.exc_info()[0], sys.exc_info()[1])) 652 if len(deleted): 653 self.flash('Successfully removed: %s' % ', '.join(deleted)) 654 self.redirect(self.url(self.context, u'@@manage')+'#tab-2') 655 return 575 656 576 657 class PaymentsDisplayFormPage(WAeUPDisplayFormPage):
Note: See TracChangeset for help on using the changeset viewer.