Code

Some changes for mailQueue
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 7 Nov 2005 05:55:04 +0000 (05:55 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 7 Nov 2005 05:55:04 +0000 (05:55 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1841 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/addons/mailqueue/class_mailqueue.inc
plugins/addons/mailqueue/class_parseMailQueue.inc
plugins/addons/mailqueue/contents.tpl

index f14094f318154fa4879b8ad245358c6ccf4c9539..a59fee6c09312b6e07af8227a6d1cdc845b638d1 100644 (file)
@@ -13,7 +13,7 @@ class mailqueue extends plugin
   var $QueryCommand = "";
   var $RemoveCommand= "";
 
-  var $Server         = "none";
+  var $Server         = "all";
   var $Time           = 0;
   var $Search         = "*";
   var $Page           = 0;
@@ -30,7 +30,7 @@ class mailqueue extends plugin
     $this->QueryCommand = search_config($this->config->data['MENU'], "mailqueue", "MAILQUEUE_QUERY_COMMAND");
     $this->RemoveCommand= search_config($this->config->data['MENU'], "mailqueue", "MAILQUEUE_REMOVE_COMMAND");
 
-    $this->Server = "none";
+    $this->Server = "all";
   }
 
   function execute()
@@ -38,9 +38,20 @@ class mailqueue extends plugin
     /* Call parent execute */
     plugin::execute();
     $smarty= get_smarty();
+     
+    $q_cmd = preg_replace("/%server/",$this->Server,$this->QueryCommand);
 
-    if($str = @shell_exec ($this->QueryCommand)){      
+    if($str = @shell_exec ($q_cmd)){   
       $mailQueueParser = new parseMailQueue($str);
+
+      if(isset($_GET['del'])){
+        if($mailQueueParser->IDExists($_GET['del'])){
+          $r_cmd = preg_replace("/%server/", $this->Server,$this->RemoveCommand);  
+          $r_cmd = preg_replace("/%id/",     $_GET['del'] ,$r_cmd);  
+          print $r_cmd;
+        }
+      }
+
       $mailQueueParser->OrderBy($this->OrderBy,$this->SortType);
       $mailQueueParser->OnlyDaysAgo($this->Time);
       $mailQueueParser->CreateDate();
@@ -51,6 +62,7 @@ class mailqueue extends plugin
       $smarty->assign("plug","?plug=".$_GET['plug']);
       $smarty->assign("p_server",$this->Server);
       $smarty->assign("p_servers",$this->getServer());
+      $smarty->assign("p_serverKeys",array_flip($this->getServer()));
       $smarty->assign("p_time", $this->Time);
       $smarty->assign("p_times",$this->getTimes());
       $smarty->assign("p_timeKeys",array_flip($this->getTimes()));
@@ -72,7 +84,7 @@ class mailqueue extends plugin
 
   function getServer()
   {
-    $ret= array("none",_("none"));
+    $ret= array("all"=>_("All"));
     $ldap = $this->config->get_ldap_link();
     $ldap->cd($this->config->current['BASE']);    
     $ldap->search("(objectClass=goMailServer)",array("cn"));
@@ -84,12 +96,13 @@ class mailqueue extends plugin
 
   function getTimes()
   {
-    $ret = array("all"=>_("all"));
-    for($i = 0 ; $i < 10 ; $i ++ ){
+    $ret = array();
+    $ret['nolimit']=_("no limit"); 
+    foreach(array(1,2,4,8,12,24,36,48) as $i){
       if($i == 1){
-        $ret[$i] = $i."&nbsp;"._("day ago");
+        $ret[$i] = $i."&nbsp;"._("hour");
       }else{
-        $ret[$i] = $i."&nbsp;"._("days ago");
+        $ret[$i] = $i."&nbsp;"._("hours");
       }
     }
     return($ret);
index 49c78752a0696d64c4d8894c024c06b933789bdf..573fccf4a8bc8bb0e8bb3d98dc0837bea9785de1 100644 (file)
@@ -18,8 +18,8 @@ class parseMailQueue
   function OnlyDaysAgo($str)
   {
     $cur = time();
-    if(is_numeric($str)){
-      $cur = $cur - ($str*(60*60*24));
+    if((is_numeric($str))&&($str != 0)){
+      $cur = $cur - ($str*(60*60));
       foreach($this->a_parsedData as $key => $data){
         if($data['Arrival'] < $cur){
           unset($this->a_parsedData[$key]);
index c6f62aee675f000f6fdf831065bd144f60ed3250..29fb6401d314bd6412feea0d60b0422cf0c11e89 100644 (file)
@@ -9,9 +9,9 @@
        <input name="search_for" size="25" maxlength="60" value="{$search_for}" title="{t}Please enter a search string here.{/t}" onchange="mainform.submit()">
                &nbsp;in 
        <select size="1" name="p_server" title="{t}Select a server{/t}" onchange="mainform.submit()">
-               {html_options values=$p_servers output=$p_servers selected=$p_server}
+               {html_options values=$p_serverKeys output=$p_servers selected=$p_server}
        </select>
-               &nbsp;{t}Select time periode{/t}
+               &nbsp;{t}within the last{/t}&nbsp;
        <select size="1" name="p_time" onchange="mainform.submit()">
                {html_options values=$p_timeKeys output=$p_times selected=$p_time}
        </select>