Exemple #1
0
def in_edit_mode():
    """Is current UI view in mode "edit" i.e. are we modifying bungeni content?
    
    As general practice, to avoid user surprises, we do not allow a workflow 
    transition when UI is displaying the doc in "edit" mode (and possibly with
    unsaved modifications).
    """
    return IFormEditLayer.providedBy(common.get_request())
def in_edit_mode():
    """Is current UI view in mode "edit" i.e. are we modifying bungeni content?
    
    As general practice, to avoid user surprises, we do not allow a workflow 
    transition when UI is displaying the doc in "edit" mode (and possibly with
    unsaved modifications).
    """
    return IFormEditLayer.providedBy(common.get_request())
def response_allow_submit(context):
    # The "submit_response" workflow transition should NOT be displayed when
    # the UI is displaying the question in "edit" mode (as this transition
    # will cause deny of bungeni.Question.Edit to the Minister).
    request = common.get_request()
    if IFormEditLayer.providedBy(request):
        return False
    if context.response_text is None:
        return False
    else:
        return True
def response_allow_submit(context):
    # The "submit_response" workflow transition should NOT be displayed when 
    # the UI is displaying the question in "edit" mode (as this transition
    # will cause deny of bungeni.Question.Edit to the Minister).
    request = common.get_request()
    if IFormEditLayer.providedBy(request):
        return False
    if context.response_text is None:
        return False
    else:
        return True