From: hickert
Date: Tue, 22 Nov 2005 13:35:44 +0000 (+0000)
Subject: Some additional functions for mail_queue
X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d699a6c453c7bde2e65f8442cb1639b6a1fedf64;p=gosa.git
Some additional functions for mail_queue
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2008 594d385d-05f5-0310-b6e9-bd551577e9d8
---
diff --git a/plugins/addons/mailqueue/class_mailqueue.inc b/plugins/addons/mailqueue/class_mailqueue.inc
index 086bfc158..a296c68af 100644
--- a/plugins/addons/mailqueue/class_mailqueue.inc
+++ b/plugins/addons/mailqueue/class_mailqueue.inc
@@ -10,8 +10,7 @@ class mailqueue extends plugin
var $attributes= array();
var $objectclasses= array();
- var $QueryCommand = "";
- var $RemoveCommand= "";
+ var $mailQueueScript = "";
var $Server = "all";
var $Time = 0;
@@ -28,9 +27,8 @@ class mailqueue extends plugin
$this->config= $config;
/* get the query cmd */
- $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->mailQueueScript = $this->config->current['MAILQUEUESCRIPTPATH'];
+
$this->Server = "all";
}
@@ -42,7 +40,7 @@ class mailqueue extends plugin
$error =false;
- if(empty($this->QueryCommand)){
+ if(empty($this->mailQueueScript)){
print_red(_("Please check your 'gosa.conf', there is no 'MAILQUEUE_QUERY_COMMAND' specified."));
$error = true;
}else{
@@ -54,7 +52,9 @@ class mailqueue extends plugin
if($this->Server != "all"){
/* Create Query cmd */
- $q_cmd = preg_replace("/%server/",$this->Server,$this->QueryCommand);
+ $q_cmd = preg_replace("/%action/" ,"query" ,$this->mailQueueScript);
+ $q_cmd = preg_replace("/%server/" ,$this->Server,$q_cmd);
+ $q_cmd = preg_replace("/%id/" ,"" ,$q_cmd);
/* Only display this if the query cmd is executeable */
if($str = @shell_exec ($q_cmd)){
@@ -75,7 +75,9 @@ class mailqueue extends plugin
foreach($this->getServer() as $ServerID=>$ServerName){
if($ServerID == "all") continue;
- $q_cmd = preg_replace("/%server/",$ServerName,$this->QueryCommand);
+ $q_cmd = preg_replace("/%action/" ,"query" ,$this->mailQueueScript);
+ $q_cmd = preg_replace("/%server/" ,$ServerName ,$q_cmd);
+ $q_cmd = preg_replace("/%id/" ,"" ,$q_cmd);
if($str = @shell_exec ($q_cmd)){
if($mailQueueParser == NULL){
@@ -92,16 +94,58 @@ class mailqueue extends plugin
}
if(!$error){
-
/* Delete entry if requested */
- 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);
+ if((isset($_GET['act']))&&($_GET['act']=="del")){
+ if($mailQueueParser->IDExists($_GET['id'])){
+ $r_cmd = preg_replace("/%action/" ,"remove" ,$this->mailQueueScript);
+ $r_cmd = preg_replace("/%server/" ,$_GET['server'] ,$r_cmd);
+ $r_cmd = preg_replace("/%id/" ,$_GET['id'] ,$r_cmd);
print $r_cmd;
}
}
+ /* Hold entry if requested */
+ if((isset($_GET['act']))&&($_GET['act']=="hold")){
+ if($mailQueueParser->IDExists($_GET['id'])){
+ $r_cmd = preg_replace("/%action/" ,"hold" ,$this->mailQueueScript);
+ $r_cmd = preg_replace("/%server/" ,$_GET['server'] ,$r_cmd);
+ $r_cmd = preg_replace("/%id/" ,$_GET['id'] ,$r_cmd);
+ print $r_cmd;
+ }
+ }
+
+ /* Requeue entry if requested */
+ if((isset($_GET['act']))&&($_GET['act']=="requeue")){
+ if($mailQueueParser->IDExists($_GET['id'])){
+ $r_cmd = preg_replace("/%action/" ,"requeue" ,$this->mailQueueScript);
+ $r_cmd = preg_replace("/%server/" ,$_GET['server'] ,$r_cmd);
+ $r_cmd = preg_replace("/%id/" ,$_GET['id'] ,$r_cmd);
+ print $r_cmd;
+ }
+ }
+
+ if(isset($_POST['requeue_all'])){
+ $r_cmd = preg_replace("/%action/" ,"requeue" ,$this->mailQueueScript);
+ $r_cmd = preg_replace("/%server/" ,$this->Server ,$r_cmd);
+ $r_cmd = preg_replace("/%id/" ,"all" ,$r_cmd);
+ print $r_cmd;
+
+ }
+ if(isset($_POST['hold_all'])){
+ $r_cmd = preg_replace("/%action/" ,"hold" ,$this->mailQueueScript);
+ $r_cmd = preg_replace("/%server/" ,$this->Server ,$r_cmd);
+ $r_cmd = preg_replace("/%id/" ,"all" ,$r_cmd);
+ print $r_cmd;
+
+ }
+ if(isset($_POST['remove_all'])){
+ $r_cmd = preg_replace("/%action/" ,"remove" ,$this->mailQueueScript);
+ $r_cmd = preg_replace("/%server/" ,$this->Server,$r_cmd);
+ $r_cmd = preg_replace("/%id/" ,"" ,$r_cmd);
+ print $r_cmd;
+
+ }
+
/* Filter data with the given */
$mailQueueParser->OrderBy($this->OrderBy,$this->SortType);
$mailQueueParser->OnlyDaysAgo($this->Time);
diff --git a/plugins/addons/mailqueue/class_parseMailQueue.inc b/plugins/addons/mailqueue/class_parseMailQueue.inc
index c7f687e8d..0d0b6def4 100644
--- a/plugins/addons/mailqueue/class_parseMailQueue.inc
+++ b/plugins/addons/mailqueue/class_parseMailQueue.inc
@@ -116,7 +116,10 @@ class parseMailQueue
/* Checks if the given MailID exists */
function IDExists($id)
{
- return(((isset($this->a_parsedData[$id]))&&(is_array($this->a_parsedData[$id]))));
+ foreach($this->a_parsedData as $entry){
+ if($entry['MailID'] == $id) return(true);
+ }
+ return(false);
}
function parseAdditionalQueue($str, $server)
diff --git a/plugins/addons/mailqueue/contents.tpl b/plugins/addons/mailqueue/contents.tpl
index 0100fafb7..c950f53fd 100644
--- a/plugins/addons/mailqueue/contents.tpl
+++ b/plugins/addons/mailqueue/contents.tpl
@@ -17,6 +17,9 @@
+
+
+
@@ -36,6 +39,8 @@
{t}Recipient{/t} {if $OrderBy == "Recipient"}{$SortType}{/if} |
{t}Error{/t} {if $OrderBy == "Error"} {$SortType}{/if} |
|
+ |
+ |
{counter start=0 assign=i start=1}
@@ -53,7 +58,9 @@
{$entries[$key].Sender} |
{$entries[$key].Recipient} |
{$entries[$key].Error} |
- |
+ |
+ |
+ |
{counter}
{/foreach}