Ignore:
Timestamp:
31 Oct 2012, 16:01:42 (12 years ago)
Author:
Henrik Bettermann
Message:

Add clearance_comment attribute. When CO rejects clearance she is requested to enter a comment. This comment is stored with the student object and logged. The contact form is pre-filled with the comment. When a student is cleared the comment will be automatically removed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r9467 r9484  
    390390    form_fields = grok.AutoFields(IContactForm).select('subject', 'body')
    391391
    392     def update(self, subject=u''):
     392    def update(self, subject=u'', body=u''):
    393393        self.form_fields.get('subject').field.default = subject
     394        self.form_fields.get('body').field.default = body
    394395        self.subject = subject
    395396        return
     
    586587            form_fields = grok.AutoFields(
    587588                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
    588593        return form_fields
    589594
     
    610615            form_fields = grok.AutoFields(
    611616                IUGStudentClearance).omit('clearance_locked')
     617        if not getattr(self.context, 'clearance_comment'):
     618            form_fields = form_fields.omit('clearance_comment')
    612619        return form_fields
    613620
     
    694701        return
    695702
    696 class StudentRejectClearancePage(UtilityView, grok.View):
     703class StudentRejectClearancePage(KofaEditFormPage):
    697704    """ Reject clearance by clearance officers
    698705    """
    699706    grok.context(IStudent)
    700707    grok.name('reject_clearance')
     708    label = _('Reject clearance')
    701709    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):
    704715        if self.context.state == CLEARED:
    705716            IWorkflowInfo(self.context).fireTransition('reset4')
     
    714725            self.redirect(self.url(self.context,'view_clearance'))
    715726            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}
    717732        self.redirect(self.url(self.context) +
    718733            '/contactstudent?%s' % urlencode(args))
    719734        return
    720735
    721     def render(self):
    722         return
     736    #def render(self):
     737    #    return
    723738
    724739class StudentPersonalDisplayFormPage(KofaDisplayFormPage):
     
    19381953        if self.context.is_postgrad:
    19391954            form_fields = grok.AutoFields(IPGStudentClearance).omit(
    1940                 'clearance_locked', 'clr_code')
     1955                'clearance_locked', 'clr_code', 'clearance_comment')
    19411956        else:
    19421957            form_fields = grok.AutoFields(IUGStudentClearance).omit(
    1943                 'clearance_locked', 'clr_code')
     1958                'clearance_locked', 'clr_code', 'clearance_comment')
    19441959        return form_fields
    19451960
Note: See TracChangeset for help on using the changeset viewer.