Changeset 9484 for main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
- Timestamp:
- 31 Oct 2012, 16:01:42 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r9467 r9484 390 390 form_fields = grok.AutoFields(IContactForm).select('subject', 'body') 391 391 392 def update(self, subject=u'' ):392 def update(self, subject=u'', body=u''): 393 393 self.form_fields.get('subject').field.default = subject 394 self.form_fields.get('body').field.default = body 394 395 self.subject = subject 395 396 return … … 586 587 form_fields = grok.AutoFields( 587 588 IUGStudentClearance).omit('clearance_locked') 589 if not getattr(self.context, 'clearance_comment'): 590 form_fields = form_fields.omit('clearance_comment') 591 else: 592 form_fields['clearance_comment'].custom_widget = BytesDisplayWidget 588 593 return form_fields 589 594 … … 610 615 form_fields = grok.AutoFields( 611 616 IUGStudentClearance).omit('clearance_locked') 617 if not getattr(self.context, 'clearance_comment'): 618 form_fields = form_fields.omit('clearance_comment') 612 619 return form_fields 613 620 … … 694 701 return 695 702 696 class StudentRejectClearancePage( UtilityView, grok.View):703 class StudentRejectClearancePage(KofaEditFormPage): 697 704 """ Reject clearance by clearance officers 698 705 """ 699 706 grok.context(IStudent) 700 707 grok.name('reject_clearance') 708 label = _('Reject clearance') 701 709 grok.require('waeup.clearStudent') 702 703 def update(self): 710 form_fields = grok.AutoFields( 711 IUGStudentClearance).select('clearance_comment') 712 713 @action(_('Save comment and reject clearance now'), style='primary') 714 def reject(self, **data): 704 715 if self.context.state == CLEARED: 705 716 IWorkflowInfo(self.context).fireTransition('reset4') … … 714 725 self.redirect(self.url(self.context,'view_clearance')) 715 726 return 716 args = {'subject':message} 727 self.applyData(self.context, **data) 728 comment = data['clearance_comment'] 729 self.context.writeLogMessage( 730 self, 'comment: %s' % comment.replace('\n', '<br>')) 731 args = {'subject':message, 'body':comment} 717 732 self.redirect(self.url(self.context) + 718 733 '/contactstudent?%s' % urlencode(args)) 719 734 return 720 735 721 def render(self):722 return736 #def render(self): 737 # return 723 738 724 739 class StudentPersonalDisplayFormPage(KofaDisplayFormPage): … … 1938 1953 if self.context.is_postgrad: 1939 1954 form_fields = grok.AutoFields(IPGStudentClearance).omit( 1940 'clearance_locked', 'clr_code' )1955 'clearance_locked', 'clr_code', 'clearance_comment') 1941 1956 else: 1942 1957 form_fields = grok.AutoFields(IUGStudentClearance).omit( 1943 'clearance_locked', 'clr_code' )1958 'clearance_locked', 'clr_code', 'clearance_comment') 1944 1959 return form_fields 1945 1960
Note: See TracChangeset for help on using the changeset viewer.