Code

Added highlighting for same task_id ... very ugly colors
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 24 Oct 2007 11:55:35 +0000 (11:55 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 24 Oct 2007 11:55:35 +0000 (11:55 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7639 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_hostActionQueue.inc
plugins/addons/gotomasses/class_divListMasses.inc
plugins/addons/gotomasses/class_gotomasses.inc

index a6aa4a697e22212c13d20e361d96a50fe9c0ae78..efe3359a4e12e59e74139848cdb8356728ae902c 100644 (file)
@@ -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;
index 92bf31e3584b25ac8a10870b2c7a0f0190a74499..ea4794b685f46e67a673187e335d1aae5d952c3a 100644 (file)
@@ -96,6 +96,7 @@ class divListMasses extends MultiSelectWindow
       }
 
       $id = $task['ID'];
+      $color= "background-color: #".$task['color'];
  
       $action = "<input type='image' src='images/edit.png' name='edit_task_".$id."' class='center' alt='"._("Edit")."'>";
       if($this->parent->acl_is_removeable()){
@@ -105,10 +106,11 @@ class divListMasses extends MultiSelectWindow
       $field0 = array("string" => "<input type='checkbox' id='item_selected_".$id."' name='item_selected_".$id."'>" ,
           "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));
     }
   }
index a71170fd7a395a335d7c8ec7124bbe5f3089c892..2b304d31ff4f7c89ce6f5b34664a51969f190fc2 100644 (file)
@@ -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)
   {