def handle_td(my, td): sobject = my.get_current_sobject() value = my.get_value() color = Task.get_default_color(value) if color: td.add_style("background-color: %s" % color) super(SObjectStatusElementWdg, my).handle_td(td)
def handle_td(my, td): sobject = my.get_current_sobject() # find the pipeline code of the task pipeline_code = sobject.get_value('pipeline_code', no_exception=True) parent_pipeline_code = '' if my.parent: parent_pipeline_code = my.parent.get_value('pipeline_code', no_exception=True) # if not find the pipeline of the parent and match the process if not pipeline_code: task_process = sobject.get_value("process") if task_process: parent = my.parent if parent: parent_pipeline_code = parent.get_value('pipeline_code', no_exception=True) pipeline = Pipeline.get_by_code(parent_pipeline_code) if pipeline: attributes = pipeline.get_process_attrs(task_process) pipeline_code = attributes.get('task_pipeline') value = my.get_value() color = Task.get_default_color(value) # If task status pipeline is chosen, # use color attribute from status (process) if pipeline_code: td.set_attr("spt_pipeline_code", pipeline_code) pipeline = Pipeline.get_by_code(pipeline_code) if pipeline: #attributes = pipeline.get_process_attrs(value) #color = attributes.get("color") process = pipeline.get_process(value) if process: color = process.get_color() if not color: process_sobject = pipeline.get_process_sobject(value) if process_sobject: color = process_sobject.get_value("color") if color: td.add_style("background-color: %s" % color) if parent_pipeline_code: td.set_attr("spt_parent_pipeline_code", parent_pipeline_code) super(TaskStatusElementWdg, my).handle_td(td)
def handle_td(self, td): sobject = self.get_current_sobject() edit_scope = self.get_option("edit_scope") if edit_scope == "assigned": login = Environment.get_user_name() user = Environment.get_login() security = Environment.get_security() if not security.is_admin() and login != sobject.get_value("assigned"): td.add_class("spt_cell_no_edit") # find the pipeline code of the task pipeline_code = sobject.get_value('pipeline_code', no_exception=True) parent_pipeline_code = '' if self.parent: parent_pipeline_code = self.parent.get_value('pipeline_code', no_exception=True) if sobject.get_base_search_type() == "sthpw/snapshot": pipeline_code = "snapshot" # if not find the pipeline of the parent and match the process if not pipeline_code: task_process = sobject.get_value("process") if task_process: parent = self.parent if parent: parent_pipeline_code = parent.get_value('pipeline_code', no_exception=True) pipeline = Pipeline.get_by_code(parent_pipeline_code) if pipeline: attributes = pipeline.get_process_attrs(task_process) pipeline_code = attributes.get('task_pipeline') value = self.get_value() color = Task.get_default_color(value) # If task status pipeline is chosen, # use color attribute from status (process) if pipeline_code: td.set_attr("spt_pipeline_code", pipeline_code) pipeline = Pipeline.get_by_code(pipeline_code) if pipeline: #attributes = pipeline.get_process_attrs(value) #color = attributes.get("color") process = pipeline.get_process(value) if process: color = process.get_color() if not color: process_sobject = pipeline.get_process_sobject(value) if process_sobject: color = process_sobject.get_value("color") if color: td.add_style("background-color: %s" % color) if parent_pipeline_code: td.set_attr("spt_parent_pipeline_code", parent_pipeline_code) super(TaskStatusElementWdg, self).handle_td(td)