From: hickert Date: Wed, 24 Oct 2007 11:55:35 +0000 (+0000) Subject: Added highlighting for same task_id ... very ugly colors X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=86bdde8b5659ed7d7ac4d694712c442e0e3fcb6d;p=gosa.git Added highlighting for same task_id ... very ugly colors git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7639 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/class_hostActionQueue.inc b/include/class_hostActionQueue.inc index a6aa4a697..efe3359a4 100644 --- a/include/class_hostActionQueue.inc +++ b/include/class_hostActionQueue.inc @@ -120,10 +120,10 @@ class hostActionQueue { $entry_id=preg_replace("/^.*entryid:([0-9]*).*$/","\\1",$comment); $desc =preg_replace("/^.*desc:(.*)$/","\\1",$comment); } - if($task_id == 0 || !is_numeric($task_id)){ + if($task_id == 0 || empty($task_id)){ $task_id = preg_replace("/[^0-9]*/","",microtime()); } - if($entry_id == 0 || !is_numeric($entry_id)){ + if($entry_id == 0 || empty($entry_id)){ $entry_id = preg_replace("/[^0-9]*/","",microtime()); } @@ -245,11 +245,11 @@ class hostActionQueue { private function _add_entry($entry,$task_id = 0) { - if($task_id == 0 || !is_numeric($task_id) || !isset($entry['TASK_ID']) || !is_numeric($entry['TASK_ID'])){ + if($task_id == 0 || empty($task_id)){ $task_id=preg_replace("/[^0-9]*/","",microtime()); - $entry['TASK_ID'] = $task_id; } - if(!isset($entry['ID']) || !is_numeric($entry['ID'])){ + $entry['TASK_ID'] = $task_id; + if(!isset($entry['ID']) || empty($entry['ID']) || !isset($entry['ID']) || empty($entry['ID'])){ $entry['ID'] = preg_replace("/[^0-9]*/","",microtime()); } $this->a_queue[] = $entry; diff --git a/plugins/addons/gotomasses/class_divListMasses.inc b/plugins/addons/gotomasses/class_divListMasses.inc index 92bf31e35..ea4794b68 100644 --- a/plugins/addons/gotomasses/class_divListMasses.inc +++ b/plugins/addons/gotomasses/class_divListMasses.inc @@ -96,6 +96,7 @@ class divListMasses extends MultiSelectWindow } $id = $task['ID']; + $color= "background-color: #".$task['color']; $action = ""; if($this->parent->acl_is_removeable()){ @@ -105,10 +106,11 @@ class divListMasses extends MultiSelectWindow $field0 = array("string" => "" , "attach" => "style='width:20px;'"); - $field1 = array("string" => preg_replace(array("/%id%/","/%str%/"),array($id,$this->parent->target_to_string($task)),$edit_link)); - $field2 = array("string" => $this->parent->time_to_string($task),"attach" => "style='width:100px;'"); - $field3 = array("string" => $this->parent->action_to_string($task),"attach" => "style='width:80px;'"); - $field4 = array("string" => $action,"attach" => "style='text-align:right;width:40px;border-right:0px;'"); + $field1 = array("string" => preg_replace(array("/%id%/","/%str%/"),array($id,$this->parent->target_to_string($task)),$edit_link), + "attach" => "style='".$color."'"); + $field2 = array("string" => $this->parent->time_to_string($task),"attach" => "style='".$color.";width:100px;'"); + $field3 = array("string" => $this->parent->action_to_string($task),"attach" => "style='".$color.";width:80px;'"); + $field4 = array("string" => $action,"attach" => "style='".$color.";text-align:right;width:40px;border-right:0px;'"); $this->AddElement(array($field0,$field1,$field2,$field3,$field4)); } } diff --git a/plugins/addons/gotomasses/class_gotomasses.inc b/plugins/addons/gotomasses/class_gotomasses.inc index a71170fd7..2b304d31f 100644 --- a/plugins/addons/gotomasses/class_gotomasses.inc +++ b/plugins/addons/gotomasses/class_gotomasses.inc @@ -166,17 +166,25 @@ class gotomasses extends plugin function get_queue_entries() { - if(!$this->o_queue->load()){ - print_red("ERROR:".$this->o_queue->get_error()); - return(FALSE); - } + if(!$this->o_queue->load()){ + print_red("ERROR:".$this->o_queue->get_error()); + return(FALSE); + } + + $tasks = array(); $ret = array(); while($entry = $this->o_queue->fetch()){ + $task = $entry['TASK_ID']; + if(!isset($tasks[$task])){ + $tasks[$task] = dechex(rand(100,240)).dechex(rand(100,240)).dechex(rand(100,240)); + } + + $entry['color'] = $tasks[$task]; $ret[]= $entry; } return($ret); } - + function target_to_string($data) {