From 2a6ab86a71c6f7a7c0db0d59497bb5b90646682a Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 7 Nov 2005 05:55:04 +0000 Subject: [PATCH] Some changes for mailQueue git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1841 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/addons/mailqueue/class_mailqueue.inc | 29 ++++++++++++++----- .../addons/mailqueue/class_parseMailQueue.inc | 4 +-- plugins/addons/mailqueue/contents.tpl | 4 +-- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/plugins/addons/mailqueue/class_mailqueue.inc b/plugins/addons/mailqueue/class_mailqueue.inc index f14094f31..a59fee6c0 100644 --- a/plugins/addons/mailqueue/class_mailqueue.inc +++ b/plugins/addons/mailqueue/class_mailqueue.inc @@ -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." "._("day ago"); + $ret[$i] = $i." "._("hour"); }else{ - $ret[$i] = $i." "._("days ago"); + $ret[$i] = $i." "._("hours"); } } return($ret); diff --git a/plugins/addons/mailqueue/class_parseMailQueue.inc b/plugins/addons/mailqueue/class_parseMailQueue.inc index 49c78752a..573fccf4a 100644 --- a/plugins/addons/mailqueue/class_parseMailQueue.inc +++ b/plugins/addons/mailqueue/class_parseMailQueue.inc @@ -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]); diff --git a/plugins/addons/mailqueue/contents.tpl b/plugins/addons/mailqueue/contents.tpl index c6f62aee6..29fb6401d 100644 --- a/plugins/addons/mailqueue/contents.tpl +++ b/plugins/addons/mailqueue/contents.tpl @@ -9,9 +9,9 @@  in -  {t}Select time periode{/t} +  {t}within the last{/t}  -- 2.30.2