示例#1
0
    def __call__(self, headless=False, transition=None):
        method = self.request["REQUEST_METHOD"]
        if transition:
            wf = interfaces.IWorkflow(self.context)
            state_transition = wf.getTransitionById(transition)
            require_confirmation = getattr(state_transition, "require_confirmation", False)
            self.update(transition)
        else:
            self.update()

        if transition and require_confirmation is False and method == "POST":
            actions = bindTransitions(self.action_viewlet, (transition,), None, interfaces.IWorkflow(self.context))
            assert len(actions) == 1

            # execute action
            result = actions[0].success({})

        if headless is True:
            actions = get_actions("context_workflow", self.context, self.request)
            state_title = IWorkflowInfo(self.context).workflow().workflow.states[self.context.status].title
            result = self.ajax_template(actions=actions, state_title=state_title)

            if require_confirmation is True:
                self.request.response.setStatus(403)
            else:
                self.request.response.setStatus(200)
                self.request.response.setResult(result)
                self.request.response.setHeader("Content-Type", "text/xml")

            return result

        template = self.template()
        return template
示例#2
0
    def __call__(self, transition_id=None, headless=False):
        # parameters coming in via URL querystring or post vars !
        method = self.request["REQUEST_METHOD"]
        # !+ALWAYS_POST(mr, sep-2011) requests coming from link clicks (GETs)
        # from the bungeni Web UI seem to always be intercepted and switched
        # into POSTs.
        workflow = interfaces.IWorkflow(self.context)

        require_confirmation = True
        if transition_id is not None:
            self.update(transition_id)
            require_confirmation = workflow.get_transition(
                transition_id).require_confirmation
        else:
            self.update()

        if (ILegislativeContent.providedBy(self.context)
                and get_mask(self.context) == "manual"
                and not self.context.registry_number):
            require_confirmation = True

        if (not require_confirmation and method == "POST"):
            actions = bindTransitions(self.action_viewlet, (transition_id, ),
                                      workflow)
            assert len(actions) == 1
            # execute action
            # !+ should pass self.request.form as data? e.g. value is:
            # {u"next_url": u"...", u"transition": u"submit_response"}
            result = actions[0].success({})
            # !+UNUSED(mr, jun-2011) this result is never used!

        if headless:
            actions = get_actions("context_workflow", self.context,
                                  self.request)
            state_title = workflow.get_state(self.context.status).title
            result = self.ajax_template(actions=actions,
                                        state_title=state_title)
            if require_confirmation:
                self.request.response.setStatus(403)
            else:
                self.request.response.setStatus(200)
                self.request.response.setResult(result)
                self.request.response.setHeader("Content-Type", "text/xml")
            return result

        template = self.template()
        return template
示例#3
0
 def __call__(self, transition_id=None, headless=False):
     # parameters coming in via URL querystring or post vars !
     method = self.request["REQUEST_METHOD"]
     # !+ALWAYS_POST(mr, sep-2011) requests coming from link clicks (GETs) 
     # from the bungeni Web UI seem to always be intercepted and switched 
     # into POSTs.
     workflow = interfaces.IWorkflow(self.context)
     
     require_confirmation = True
     if transition_id is not None: 
         self.update(transition_id)
         require_confirmation = workflow.get_transition(transition_id
             ).require_confirmation
     else:
         self.update()
     
     if (ILegislativeContent.providedBy(self.context) and
             get_mask(self.context) == "manual" and 
             not self.context.registry_number
         ):
         require_confirmation = True
     
     if (not require_confirmation and method == "POST"):
         actions = bindTransitions(
             self.action_viewlet, (transition_id,), workflow)
         assert len(actions) == 1
         # execute action
         # !+ should pass self.request.form as data? e.g. value is:
         # {u"next_url": u"...", u"transition": u"submit_response"}
         result = actions[0].success({})
         # !+UNUSED(mr, jun-2011) this result is never used!
     
     if headless:
         actions = get_actions("context_workflow", self.context, self.request)
         state_title = workflow.get_state(self.context.status).title
         result = self.ajax_template(actions=actions, state_title=state_title)
         if require_confirmation:
             self.request.response.setStatus(403)
         else:
             self.request.response.setStatus(200)
             self.request.response.setResult(result)
             self.request.response.setHeader("Content-Type", "text/xml")
         return result
         
     template = self.template()
     return template
示例#4
0
    def __call__(self, headless=False, transition=None):
        # !+RENAME(mr, apr-2011) should be transition_id
        method = self.request["REQUEST_METHOD"]
        workflow = interfaces.IWorkflow(self.context)

        # !+REWITE(mr, jun-2011) the following needs to be rewritten!
        if transition:
            state_transition = workflow.get_transition(transition)
            require_confirmation = getattr(state_transition,
                                           "require_confirmation", False)
            self.update(transition)
        else:
            self.update()

        if transition and require_confirmation is False and method == "POST":
            actions = bindTransitions(self.action_viewlet, (transition, ),
                                      None, workflow)
            assert len(actions) == 1
            # execute action
            # !+ should pass self.request.form as data? e.g. value is:
            # {u"next_url": u"...", u"transition": u"submit_response"}
            result = actions[0].success({})
            # !+REWITE(mr, jun-2011) this result is never used!

        if headless is True:
            actions = get_actions("context_workflow", self.context,
                                  self.request)
            state_title = workflow.get_state(self.context.status).title
            result = self.ajax_template(actions=actions,
                                        state_title=state_title)

            # !+REWITE(mr, jun-2011) require_confirmation only defined when
            # transition is True!
            if require_confirmation is True:
                self.request.response.setStatus(403)
            else:
                self.request.response.setStatus(200)
                self.request.response.setResult(result)
                self.request.response.setHeader("Content-Type", "text/xml")

            return result

        template = self.template()
        return template
示例#5
0
 def __call__(self, headless=False, transition=None):
     # !+RENAME(mr, apr-2011) should be transition_id
     method = self.request["REQUEST_METHOD"]
     workflow = interfaces.IWorkflow(self.context)
     
     # !+REWITE(mr, jun-2011) the following needs to be rewritten!
     if transition:
         state_transition = workflow.get_transition(transition)
         require_confirmation = getattr(
             state_transition, "require_confirmation", False)
         self.update(transition)
     else:
         self.update()
     
     if transition and require_confirmation is False and method == "POST":
         actions = bindTransitions(
             self.action_viewlet, (transition,), None, workflow)
         assert len(actions) == 1
         # execute action
         # !+ should pass self.request.form as data? e.g. value is:
         # {u"next_url": u"...", u"transition": u"submit_response"}
         result = actions[0].success({}) 
         # !+REWITE(mr, jun-2011) this result is never used!
     
     if headless is True:
         actions = get_actions("context_workflow", self.context, self.request)
         state_title = workflow.get_state(self.context.status).title
         result = self.ajax_template(actions=actions, state_title=state_title)
         
         # !+REWITE(mr, jun-2011) require_confirmation only defined when 
         # transition is True!
         if require_confirmation is True:
             self.request.response.setStatus(403)
         else:
             self.request.response.setStatus(200)
             self.request.response.setResult(result)
             self.request.response.setHeader("Content-Type", "text/xml")
         
         return result
         
     template = self.template()
     return template
示例#6
0
    def __call__(self, headless=False, transition=None):
        method = self.request["REQUEST_METHOD"]
        if transition:
            wf = interfaces.IWorkflow(self.context)
            state_transition = wf.getTransitionById(transition)
            require_confirmation = getattr(state_transition,
                                           "require_confirmation", False)
            self.update(transition)
        else:
            self.update()

        if transition and require_confirmation is False and method == "POST":
            actions = bindTransitions(self.action_viewlet, (transition, ),
                                      None, interfaces.IWorkflow(self.context))
            assert len(actions) == 1
            # execute action
            # !+ should pass self.request.form as data? e.g. value is:
            # {u"next_url": u"...", u"transition": u"submit_response"}
            result = actions[0].success({})

        if headless is True:
            actions = get_actions("context_workflow", self.context,
                                  self.request)
            state_title = IWorkflowInfo(
                self.context).workflow().workflow.states[
                    self.context.status].title
            result = self.ajax_template(actions=actions,
                                        state_title=state_title)

            if require_confirmation is True:
                self.request.response.setStatus(403)
            else:
                self.request.response.setStatus(200)
                self.request.response.setResult(result)
                self.request.response.setHeader("Content-Type", "text/xml")

            return result

        template = self.template()
        return template
示例#7
0
def get_sitting_actions(context, request):
    return get_actions("sitting_actions", context, request)
示例#8
0
def get_workflow_actions(context, request):
    return get_actions("context_workflow", context, request)
示例#9
0
def get_discussion_actions(context, request):
    return get_actions("discussion_actions", context, request)
示例#10
0
def get_sitting_actions(context, request):
    return get_actions("sitting_actions", context, request)
示例#11
0
def get_scheduling_actions(context, request):
    return get_actions("scheduling_actions", context, request)
示例#12
0
def get_workflow_actions(context, request):
    return get_actions("context_workflow", context, request)
示例#13
0
def get_discussion_actions(context, request):
    return get_actions("discussion_actions", context, request)
示例#14
0
def get_scheduling_actions(context, request):
    return get_actions("scheduling_actions", context, request)