Example #1
0
    def update(self, transition=None):
        self.adapters = {
            self.IWorkflowComment: WorkflowComment(),
            }

        wf = interfaces.IWorkflow(self.context) 
        
        if transition is not None:
            state_transition = wf.getTransitionById(transition)
            self.status = _(
                u"Confirmation required for workflow transition: '${title}'",
                mapping={'title': _(state_transition.title)})

        self.setupActions(transition)
        super(WorkflowActionViewlet, self).update()

        # after we transition we have different actions
        self.setupActions(transition)
        # only display the notes field to comment if there is an action
        # and a log table
        auditor = audit.getAuditor( self.context )
        if len(self.actions) == 0: 
            self.form_fields = self.form_fields.omit('note')
        elif auditor is None:
            self.form_fields = self.form_fields.omit('note')
        else:
            note_widget = TextAreaWidget
            note_widget.height = 1
            self.form_fields['note'].custom_widget = note_widget
                        
        self.setUpWidgets()
Example #2
0
    def update(self, transition=None):
        self.adapters = {self.IWorkflowComment: WorkflowComment()}

        wf = interfaces.IWorkflow(self.context)

        if transition is not None:
            state_transition = wf.getTransitionById(transition)
            self.status = _(
                u"Confirmation required for workflow transition: '${title}'",
                mapping={"title": _(state_transition.title)},
            )

        self.setupActions(transition)
        super(WorkflowActionViewlet, self).update()

        # after we transition we have different actions
        self.setupActions(transition)
        # only display the notes field to comment if there is an action
        # and a log table
        auditor = audit.getAuditor(self.context)
        if len(self.actions) == 0:
            self.form_fields = self.form_fields.omit("note")
        elif auditor is None:
            self.form_fields = self.form_fields.omit("note")
        else:
            note_widget = TextAreaWidget
            note_widget.height = 1
            self.form_fields["note"].custom_widget = note_widget

        self.setUpWidgets()
Example #3
0
    def update(self, transition=None):
        self.adapters = {
            self.IWorkflowComment: self.WorkflowComment(),
        }
        wf = interfaces.IWorkflow(self.context)

        if transition is not None:
            state_transition = wf.getTransitionById(transition)
            self.status = _(
                u"Confirmation required for workflow transition: '${title}'",
                mapping={"title": _(state_transition.title)})

        self.setupActions(transition)
        super(WorkflowActionViewlet, self).update()

        # after we transition we have different actions
        self.setupActions(transition)
        # only display the notes field to comment if there is an action
        # and a log table
        auditor = audit.getAuditor(self.context)
        if len(self.actions) == 0:
            self.form_fields = self.form_fields.omit("note", "date_active")
        elif auditor is None:
            self.form_fields = self.form_fields.omit("note", "date_active")
        else:
            # note widget
            note_widget = TextAreaWidget
            note_widget.height = 1
            self.form_fields["note"].custom_widget = note_widget
            # date_active widget
            self.form_fields["date_active"].custom_widget = TextDateTimeWidget
            # !+ for "past data entry" mode, the default "date_active" value
            # should be gotten from a "pseudo_current_date" service utility
        self.setUpWidgets()
        # update form status in case of any errors
        # !+ follow the "bungeni descriptor schema_invariants" way of doing
        # this, i.e. displaying widget-specific errors next to each widget
        if self.errors:
            if self.status is None:
                self.status = _("Errors")
            self.status = "%s: %s " % (
                self.status,
                " / ".join([
                    e.message  #or e.__class__.__name__ 
                    for e in self.errors
                ]))
Example #4
0
 def update(self, transition=None):
     self.adapters = {
         self.IWorkflowComment: self.WorkflowComment(),
     }
     wf = interfaces.IWorkflow(self.context) 
     
     if transition is not None:
         state_transition = wf.getTransitionById(transition)
         self.status = _(
             u"Confirmation required for workflow transition: '${title}'",
             mapping={"title": _(state_transition.title)})
     
     self.setupActions(transition)
     super(WorkflowActionViewlet, self).update()
     
     # after we transition we have different actions
     self.setupActions(transition)
     # only display the notes field to comment if there is an action
     # and a log table
     auditor = audit.getAuditor(self.context)
     if len(self.actions)==0: 
         self.form_fields = self.form_fields.omit("note", "date_active")
     elif auditor is None:
         self.form_fields = self.form_fields.omit("note", "date_active")
     else:
         # note widget
         note_widget = TextAreaWidget
         note_widget.height = 1
         self.form_fields["note"].custom_widget = note_widget
         # date_active widget
         self.form_fields["date_active"].custom_widget = TextDateTimeWidget
         # !+ for "past data entry" mode, the default "date_active" value
         # should be gotten from a "pseudo_current_date" service utility
     self.setUpWidgets()
     # update form status in case of any errors
     # !+ follow the "bungeni descriptor schema_invariants" way of doing 
     # this, i.e. displaying widget-specific errors next to each widget
     if self.errors:
         if self.status is None: 
             self.status = _("Errors")
         self.status = "%s: %s " % (self.status, 
                         " / ".join([ e.message #or e.__class__.__name__ 
                                      for e in self.errors ]))
Example #5
0
 def _change_object(self):
     auditor = audit.getAuditor(self.context)
     return auditor.change_object
Example #6
0
 def _log_table(self):
     auditor = audit.getAuditor(self.context)
     if auditor is not None:
         return auditor.change_table
Example #7
0
 def _log_table(self):
     auditor = audit.getAuditor(self.context)
     return auditor.change_table
Example #8
0
 def _log_table( self ):
     auditor = audit.getAuditor( self.context )
     if auditor is not None:
         return auditor.change_table
Example #9
0
 def _change_object(self):
     auditor = audit.getAuditor(self.context)
     return auditor.change_object
Example #10
0
 def _log_table( self ):
     auditor = audit.getAuditor( self.context )
     return auditor.change_table