Changeset 621


Ignore:
Timestamp:
10/21/08 09:17:00 (5 years ago)
Author:
aculapov
Message:
  • for the change_type operation if we don't have a type declared in the oforge-workflow then hide this operation from the system
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/workflowcontrollerplugin/workflowcontroller/controller.py

    r620 r621  
    170170                    if actions.has_key(remove_action) : 
    171171                        actions.pop(remove_action) 
     172         
     173        # now remove the actions that have the change_type operation and  
     174        #if we don't have the type defined 
     175         
     176        # check to see if we have the type defined 
     177        type_flag = True 
     178        for key in self.workflow_fields.keys() : 
     179            field_name, value, option = key 
     180            if ticket['type'] == value :  
     181                type_flag = False 
     182                break 
     183         
     184        if type_flag : 
     185            for action in self.actions.keys(): 
     186                if 'change_type' in self.actions[action]['operations'] : 
     187                    # if we have more than one operation then just  
     188                    # delete the operation 
     189                    if len(self.actions[action]['operations']) > 1 : 
     190                        self.actions[action]['operations'].remove('change_type') 
     191                    else : 
     192                        # delete the action 
     193                        actions.pop(action) 
     194         
    172195        # transform into a list of tuples 
    173196        return_actions = [] 
    174197        for key in actions.keys() : 
    175198            return_actions.append(( actions[key], key)) 
    176         # log the processing 
    177         # self.log.warning('actions for state ' + ticket.values['status'] + ':  '  
    178         #                  + str(return_actions)) 
     199         
    179200        # return the list 
    180201        return return_actions 
     
    198219         
    199220        # call the parent 
    200         action_name, parent_tags, parent_hints = self.parent.render_ticket_action_control(req, ticket, action) 
     221        action_name, parent_tags, parent_hints = self.parent \ 
     222            .render_ticket_action_control(req, ticket, action) 
    201223         
    202224        this_action = self.actions[action]       
     
    210232                tag_element = None 
    211233                if len(owners) == 1 : 
    212                     tag_element = tag(['to ', tag.input(type='text', value=owners[0], id=id, 
    213                                                      name=id, )]) 
     234                    tag_element = tag(['to ',  
     235                                       tag.input(type='text',  
     236                                                 value=owners[0],  
     237                                                 id=id, name=id, )]) 
    214238                elif len(owners) > 1: 
    215239                    tag_element = tag([_("to "), tag.select( 
     
    283307                        id=id, name=id)])) 
    284308                    hints.append(_("The resolution will be set. ")) 
     309         
    285310        # if we computed some new control          
    286311        if len(control) > 0: 
     
    317342            h = _("The %s will be set to %s. ") % (field_name, field_values[0]) 
    318343        else: 
    319             id = self._create_id_for_tag(action, 'resolve_resolution') 
    320             selected_option = req.args.get(id, ticket['resolution']) 
     344            id = self._create_id_for_tag(action, 'change_type') 
     345            selected_option = req.args.get(id, ticket['field_name']) 
    321346            c = tag(['as ', tag.select( 
    322347                [tag.option(x, selected=(x == selected_option or None)) 
Note: See TracChangeset for help on using the changeset viewer.