Changeset 7330


Ignore:
Timestamp:
11 Dec 2011, 14:03:36 (13 years ago)
Author:
Henrik Bettermann
Message:

See last revision. Do the same for applicants.

Do not show select box for payment ticket removal if state doesn't allow to remove any ticket.

File:
1 edited

Legend:

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

    r7322 r7330  
    3939from waeup.sirp.browser.layout import NullValidator
    4040from waeup.sirp.browser.pages import add_local_role, del_local_roles
    41 from waeup.sirp.browser.resources import datepicker, tabs, datatable
     41from waeup.sirp.browser.resources import datepicker, tabs, datatable, warning
    4242from waeup.sirp.browser.viewlets import ManageActionButton, PrimaryNavTab
     43from waeup.sirp.browser.layout import jsaction, JSAction
    4344from waeup.sirp.interfaces import (
    4445    ISIRPObject, ILocalRolesAssignable, IExtFileStore,
     
    5758    MAX_UPLOAD_SIZE, IApplicantOnlinePayment,
    5859    )
    59 from waeup.sirp.applicants.workflow import INITIALIZED, STARTED, PAID
     60from waeup.sirp.applicants.workflow import INITIALIZED, STARTED, PAID, SUBMITTED
    6061from waeup.sirp.students.viewlets import PrimaryStudentNavTab
    6162from waeup.sirp.students.interfaces import IStudentsUtils
     
    9899        tabs.need()
    99100        datatable.need()
     101        warning.need()
    100102        return super(ApplicantsRootManageFormPage, self).update()
    101103
     
    114116        return get_users_with_local_roles(self.context)
    115117
    116     # ToDo: Show warning message before deletion
    117     @grok.action('Remove selected')
     118    @jsaction('Remove selected')
    118119    def delApplicantsContainers(self, **data):
    119120        form = self.request.form
     
    339340        datepicker.need() # Enable jQuery datepicker in date fields.
    340341        tabs.need()
     342        warning.need()
    341343        datatable.need()  # Enable jQurey datatables for contents listing
    342344        return super(ApplicantsContainerManageFormPage, self).update()
     
    362364        return
    363365
    364     # ToDo: Show warning message before deletion
    365     @grok.action('Remove selected')
     366    @jsaction('Remove selected')
    366367    def delApplicant(self, **data):
    367368        form = self.request.form
     
    820821    def update(self):
    821822        datepicker.need() # Enable jQuery datepicker in date fields.
     823        warning.need()
    822824        super(ApplicantManageFormPage, self).update()
    823825        self.wf_info = IWorkflowInfo(self.context)
     
    888890
    889891    def unremovable(self, ticket):
    890         usertype = getattr(self.request.principal, 'user_type', None)
    891         if not usertype:
    892             return False
    893         return self.request.principal.user_type == 'applicant' and ticket.r_code
     892        return False
    894893
    895894    # This method is also used by the ApplicantEditFormPage
     
    928927        return
    929928
    930     @grok.action('Remove selected tickets')
     929    @jsaction('Remove selected tickets')
    931930    def removePaymentTickets(self, **data):
    932931        self.delPaymentTickets(**data)
     
    964963        return actions
    965964
     965    def unremovable(self, ticket):
     966        state = IWorkflowState(self.context).getState()
     967        return ticket.r_code or state in (INITIALIZED, SUBMITTED)
     968
    966969    def emit_lock_message(self):
    967970        self.flash('The requested form is locked (read-only).')
     
    973976            self.emit_lock_message()
    974977            return
    975         datepicker.need() # Enable jQuery datepicker in date fields.
    976978        super(ApplicantEditFormPage, self).update()
    977979        return
     
    993995        return
    994996
    995     @grok.action('Remove selected tickets')
     997    @jsaction('Remove selected tickets')
    996998    def removePaymentTickets(self, **data):
    997999        self.delPaymentTickets(**data)
     
    10011003    @grok.action('Save')
    10021004    def save(self, **data):
    1003         #import pdb; pdb.set_trace()
    10041005        if self.passport_changed is False:  # False is not None!
    10051006            return # error during image upload. Ignore other values
Note: See TracChangeset for help on using the changeset viewer.