Code

Some changes
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 14 Jan 2008 10:06:23 +0000 (10:06 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 14 Jan 2008 10:06:23 +0000 (10:06 +0000)
-Still not working correclty

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8319 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_gosaSupportDaemon.inc
gosa-core/include/class_socketClient.inc
gosa-core/plugins/addons/gotomasses/class_divListMasses.inc
gosa-core/plugins/addons/gotomasses/class_gotomasses.inc

index 93381e07b72d94dd8b853d069fde43d9bb38396e..f3d903329b674b72fa70309a1f40389ee5bbc68f 100755 (executable)
@@ -5,7 +5,7 @@ class gosaSupportDaemon
   private $o_sock       = NULL;
   private $s_host       = "";
   private $i_port       = 0;
-  private $i_timeout    = 1;
+  private $f_timeout    = 0.2;
 
   private $is_connected     = FALSE;
   private $s_encryption_key = "";
@@ -16,17 +16,17 @@ class gosaSupportDaemon
   private $s_error  = "";
   private $b_error  = FALSE;
 
-  public function __construct($host,$port,$key="secret-gosa-password",$connect=TRUE,$timeout=1)
+  public function __construct($host,$port,$key="secret-gosa-password",$connect=TRUE,$timeout=0.2)
        {
     $this->s_host    = $host;
     $this->i_port    = $port;
-    $this->i_timeout = $timeout;
+    $this->f_timeout = $timeout;
     $this->s_encryption_key = $key;
   }
   
   public function connect()
   {
-    $this->o_sock = new Socket_Client($this->s_host,$this->i_port,TRUE,$this->i_timeout);
+    $this->o_sock = new Socket_Client($this->s_host,$this->i_port,TRUE,$this->f_timeout);
     $this->o_sock->setEncryptionKey($this->s_encryption_key); 
     if($this->o_sock->connected()){ 
       $this->is_connected = TRUE;
@@ -46,6 +46,7 @@ class gosaSupportDaemon
   {
     echo "<b>Reload</b>";
     $this->entries = array();
+    $this->pointer = 0;
     $xml_msg = "<xml><header>gosa_query_jobdb</header><where><status>*</status></where></xml>";
     $this->connect();
     if($this->is_connected){
index 73a0da5f68e22948d9ea9b2f65491b35518f603b..653fc12d6a1f0936ba6fd0ec482a74da3145f209 100644 (file)
@@ -113,6 +113,8 @@ class Socket_Client
                $str = FALSE;
                if($this->handle){
 
+                       syslog(0,"----------------------------------------HIER----------------------------------");
+       
                        /* Check if there is something to read for us */
                        $read = array("0"=>$this->handle);
                        $write = array();
@@ -149,8 +151,5 @@ class Socket_Client
                /* Terminate decryption handle and close module */
                mcrypt_generic_deinit($this->td);
        }
-
 }
-
-
 ?>
index 615c333c4db0ebc45ecdd8d355d462d86feddc01..61bcb1111f9ea7c54509624dee919b1309c2e1f9 100644 (file)
@@ -109,25 +109,15 @@ class divListMasses extends MultiSelectWindow
   
     foreach($tasks as $key => $task){
 
-
+      $color = "";
       /* Skip unchecked actions */ 
 #      if(!in_array($task['Action'],$allowed_action)){
 #        continue;
 #      }
 
-      /* Handle coloring */
-      $color="";
-      if($this->parent->sort_by == "TaskID"){
-        if(!in_array($task['TASK_ID'],$c_keys)){
-          $c_keys[] = $task['TASK_ID'];
-          $last_c = !$last_c;
-        }
-        $color = "background-color: ".$colors[$last_c];
-      }
-
       /* Create actions */
       $id         = $task['ROWID'];
-      $queue_pos  = $task['Queue_Position'];
+      $queue_pos  = $id;
       $prio_actions = "<input class='center' type='image' src='images/prio_top.png'      name='prio_top_".$id."'>&nbsp;";
       $prio_actions.= "<input class='center' type='image' src='images/prio_increase.png' name='prio_increase_".$id."'>&nbsp;";
       $prio_actions.= "<input class='center' type='image' src='images/prio_decrease.png' name='prio_decrease_".$id."'>&nbsp;";
index 775a28483864af8e4cefeb8d825d37351f5b09fc..5c8efebcfea7760b74aa10875286105e499a280d 100644 (file)
@@ -24,7 +24,7 @@ class gotomasses extends plugin
     /* Include config object */
     $this->config= &$config;
     $this->divlist = new divListMasses($this->config,$this);
-    $this->o_queue = new gosaSupportDaemon("10.3.67.111","20082","secret-gosa-password",FALSE,2);
+    $this->o_queue = new gosaSupportDaemon("10.3.67.111","20082","secret-gosa-password",FALSE,1);
   }
 
 
@@ -222,7 +222,8 @@ class gotomasses extends plugin
      ************/
 
     $this->divlist->execute();
-    $this->divlist->SetEntries($this->get_queue_entries()); 
+    $entries = $this->get_queue_entries();
+    $this->divlist->SetEntries($entries);
     return($this->divlist->Draw());
   }
 
@@ -240,10 +241,26 @@ class gotomasses extends plugin
     $ret = array();
     while($entry = $this->o_queue->fetch()){
       $task = $entry['ROWID']; 
-      $entry['Queue_Position'] = $task;
       $ret[]= $entry;
     }
-    return($ret);
+    $map = array("QueuePosition" => "ROWID",
+                 "Action"        => "STATUS",
+                 "TaskID"        => "HEADERTAG",
+                 "TargetName"    => "MACADDRESS",
+                 "Schedule"      => "TIMESTAMP");
+    $sort_tmp = array();
+    foreach($ret as $entry_id => $entry){
+      $sort_tmp[$entry_id] = $entry[$map[$this->sort_by]];
+    } 
+    natcasesort($sort_tmp);
+    $return = array();
+    foreach($sort_tmp as $entry_id => $value){
+      $return[] = $ret[$entry_id];
+    } 
+    if($this->sort_dir != "up"){
+      $return = array_reverse($return);
+    } 
+    return($return);
   }