From: hickert Date: Tue, 9 Sep 2008 13:51:19 +0000 (+0000) Subject: Updated mailQ X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=08583f97ab1d25b1731602de49c8075b0e21e914;p=gosa.git Updated mailQ -You can now vie Header informations -Page selector works now -Server name is correctly displyed. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12380 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/mail/addons/mailqueue/class_mailqueue.inc b/gosa-plugins/mail/addons/mailqueue/class_mailqueue.inc index b9dc7cf0f..a4ced417a 100644 --- a/gosa-plugins/mail/addons/mailqueue/class_mailqueue.inc +++ b/gosa-plugins/mail/addons/mailqueue/class_mailqueue.inc @@ -77,7 +77,11 @@ class mailqueue extends plugin if($action == "header"){ /* Create table which displays the header informations */ - $this->disp_header = $this->si_queue->header($entry); + $data = $this->si_queue->header($entry,$server); + $this->disp_header = $data; + if($this->si_queue->is_error()){ + msg_dialog::display(_("Error"),msgPool::siError($this->si_queue->get_error()),ERROR_DIALOG); + } } /* Back is posted from the header display page */ @@ -100,20 +104,27 @@ class mailqueue extends plugin $entries = array(); foreach($this->ServerList as $mac => $name){ if(!tests::is_mac($mac)) continue; - $entries = array_merge($entries,$this->si_queue->query_mailqueue($mac,$this->OrderBy,$this->SortType,$this->range)); + $entries = array_merge($entries,$this->si_queue->query_mailqueue($mac,$this->OrderBy,$this->SortType)); if($this->si_queue->is_error()){ - unset($this->ServerList[$mac]); - msg_dialog::display(_("Error"),sprintf(_("The server '%s' was removed from the server list, due to communication problems with the GOsa daemon, the error was: %s"),$name,"".msgPool::siError($this->si_queue->get_error()."")),ERROR_DIALOG); + msg_dialog::display(_("Error"),msgPool::siError($this->si_queue->get_error()),ERROR_DIALOG); } } }else{ - $entries = $this->si_queue->query_mailqueue($this->Server,$this->OrderBy,$this->SortType,$this->Limit); + $entries = $this->si_queue->query_mailqueue($this->Server,$this->OrderBy,$this->SortType); if($this->si_queue->is_error()){ msg_dialog::display(_("Error"),msgPool::siError($this->si_queue->get_error()),ERROR_DIALOG); } } - + $count = count($entries); + $entries = array_slice($entries,$this->Page,$this->range); + + /* Add ServerName to results + */ + foreach($entries as $key => $data){ + $entries[$key]['ServerName'] = $this->ServerList[$data['Server']]; + } + /****************** create html output ******************/ @@ -133,7 +144,7 @@ class mailqueue extends plugin $smarty->assign("p_times" , $this->getTimes()); $smarty->assign("p_timeKeys" , array_flip($this->getTimes())); $smarty->assign("search_for" , $this->Search); - $smarty->assign("range_selector", range_selector(count($entries), $this->Page, $this->range,"EntriesPerPage")); + $smarty->assign("range_selector", range_selector($count, $this->Page, $this->range,"EntriesPerPage")); $smarty->assign("OrderBy" , $this->OrderBy); /* Display sort arrow */ diff --git a/gosa-plugins/mail/addons/mailqueue/class_si_mailqueue.inc b/gosa-plugins/mail/addons/mailqueue/class_si_mailqueue.inc index 5f5721f38..58443fbad 100644 --- a/gosa-plugins/mail/addons/mailqueue/class_si_mailqueue.inc +++ b/gosa-plugins/mail/addons/mailqueue/class_si_mailqueue.inc @@ -32,7 +32,7 @@ class si_mailqueue extends gosaSupportDaemon /*! \brief Returns a list of all mail queue entries @return Array s.a. */ - public function query_mailqueue($server,$sortby,$direction, $Limit) + public function query_mailqueue($server,$sortby,$direction) { $attrs = array("Size","Recipient","Sender","Arrival","MailID","Hold","Active","Error","Server"); @@ -50,15 +50,9 @@ class si_mailqueue extends gosaSupportDaemon $direction = "down"; } - /* Check entry limit - */ - if(!is_numeric($Limit) || $Limit < 1){ - trigger_error("Invalid entry limt '".$Limit."'."); - $Limit = 20; - } - /* Query mailqueue */ + $ids = array(); $res = $this->send_data("gosa_mailqueue_query",$server,array(),TRUE); $items = array(); if(isset($res['XML'][0])){ @@ -74,6 +68,7 @@ class si_mailqueue extends gosaSupportDaemon foreach($attrs as $source => $dest){ $val[$dest] = $entry[0][$source][0]['VALUE']; } + $ids[] = $val['MailID']; $attrs = array( "MSG_HOLD" => "Hold", "MSG_ACTIVE" => "Active", @@ -88,7 +83,11 @@ class si_mailqueue extends gosaSupportDaemon $val['Server'] = $server; $val['Arrival'] = strtotime($val['Arrival']); - $items[$val[$sortby]] = $val; + $n = $val[$sortby]."-".microtime(1); + while(isset($items[$n])){ + $n = $val[$sortby]."-".microtime(1); + } + $items[$n] = $val; } } } @@ -100,7 +99,6 @@ class si_mailqueue extends gosaSupportDaemon }else{ krsort($items); } - return($items); } @@ -109,8 +107,23 @@ class si_mailqueue extends gosaSupportDaemon { $data = array(); $data['msg_id'] = $msg_id; - $res = $this->send_data("gosa_mailqueue_header",$this->target,$data,TRUE); - print_a($res); + $res = $this->send_data("gosa_mailqueue_header",$server,$data,TRUE); + + $attrs = array( + "RECIPIENT", + "SENDER", + "SUBJECT"); + + $data = array(); + if(isset($res['XML'])){ + foreach($attrs as $attr){ + $data[$attr] = ""; + if(isset($res['XML'][0][$attr])){ + $data[$attr] = $res['XML'][0][$attr][0]['VALUE']; + } + } + } + return($data); } diff --git a/gosa-plugins/mail/addons/mailqueue/contents.tpl b/gosa-plugins/mail/addons/mailqueue/contents.tpl index 5afe743cf..81acb6671 100644 --- a/gosa-plugins/mail/addons/mailqueue/contents.tpl +++ b/gosa-plugins/mail/addons/mailqueue/contents.tpl @@ -79,7 +79,8 @@ {$entries[$key].MailID} - {$entries[$key].Server} + {$entries[$key].ServerName} + {$entries[$key].Size} diff --git a/gosa-plugins/mail/addons/mailqueue/header.tpl b/gosa-plugins/mail/addons/mailqueue/header.tpl index 7e90c1159..fe88ee2d3 100644 --- a/gosa-plugins/mail/addons/mailqueue/header.tpl +++ b/gosa-plugins/mail/addons/mailqueue/header.tpl @@ -1,6 +1,19 @@ -{$header} + + + + + + + + + + + + + +
{t}Sender{/t} :{$header.SENDER}
{t}Recipient{/t} :{$header.RECIPIENT}
{t}Subject{/t} :{$header.SUBJECT}

 

-
+