Ignore:
Timestamp:
26 Apr 2011, 11:11:12 (14 years ago)
Author:
uli
Message:

Add a view for full editing of applicants.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py

    r5952 r5982  
    3535from waeup.sirp.browser.pages import LoginPage
    3636from waeup.sirp.interfaces import IWAeUPObject
    37 from waeup.sirp.browser.resources import datepicker
     37from waeup.sirp.browser.resources import datepicker, tabs
    3838from waeup.sirp.browser.viewlets import (
    3939    AddActionButton, ManageActionButton, PrimaryNavTab,
     
    249249    grok.context(IApplicantsContainer)
    250250    grok.name('manage')
     251    grok.template('form_manage_applicants_container')
    251252    form_fields = grok.AutoFields(IApplicantsContainer)
    252253    # Use friendlier date widget...
     
    267268    def update(self):
    268269        datepicker.need() # Enable jQuery datepicker in date fields.
     270        tabs.need()
    269271        return super(ManageApplicantsContainer, self).update()
    270272
     
    360362    pnav = 3
    361363
    362 class EditApplicant(WAeUPEditFormPage):
     364class EditApplicantStudent(WAeUPEditFormPage):
     365    """An applicant-centered edit view for applicant data.
     366    """
    363367    grok.context(IApplicant)
    364368    grok.name('edit')
     
    379383            self.emitLockMessage()
    380384            return
    381         super(EditApplicant, self).update()
     385        super(EditApplicantStudent, self).update()
    382386        return
    383387
     
    423427            return False
    424428        return True
     429
     430class EditApplicantFull(WAeUPEditFormPage):
     431    """A full edit view for applicant data.
     432
     433    This one is meant to be used by officers only.
     434    """
     435    grok.context(IApplicant)
     436    grok.name('edit_full')
     437    grok.require('waeup.editFullApplication')
     438    form_fields = grok.AutoFields(IApplicantPDEEditData).omit('locked')
     439    form_fields['passport'].custom_widget = EncodingImageFileWidget
     440    grok.template('form_edit_full')
     441
     442    def update(self):
     443        if self.context.locked:
     444            self.emitLockMessage()
     445            return
     446        super(EditApplicantFull, self).update()
     447        return
     448
     449    def filteredWidgets(self):
     450        for widget in self.widgets:
     451            if widget.name == 'form.confirm_passport':
     452                continue
     453            yield widget
     454
     455    @property
     456    def label(self):
     457        return 'Application for %s' % self.context.access_code
     458    title = 'Edit Application'
     459    pnav = 3
     460
     461    @grok.action('Save')
     462    def save(self, **data):
     463        self.applyData(self.context, **data)
     464        self.context._p_changed = True
     465        return
Note: See TracChangeset for help on using the changeset viewer.