summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1cbba14)
raw | patch | inline | side by side (parent: 1cbba14)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 10 Sep 2008 09:07:21 +0000 (09:07 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 10 Sep 2008 09:07:21 +0000 (09:07 +0000) |
-Still not finished.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12389 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12389 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 a4ced417a762b3423ae6cb6713138efd6d2d05da..8030879adfd3639af992b52262c21f706ca0f51e 100644 (file)
******************/
$action = $server = $entry = "";
- $types = array("delete","hold","unhold","header","requeue");
+ $types = array(
+ "all_del" => "del",
+ "all_hold" => "hold",
+ "all_unhold" => "unhold",
+ "all_requeue" => "requeue");
+ foreach($_POST as $name => $value){
+ foreach($types as $type => $target){
+ if(preg_match("/^".$type."/",$name)){
+ $entry = $this->list_get_selected_items();
+ $action = $target;
+ break;
+ }
+ }
+ if(!empty($action)) break;
+ }
+
+
+ $types = array("del","hold","unhold","header","requeue");
foreach($_POST as $name => $value){
foreach($types as $type){
if(preg_match("/^".$type."__/",$name)){
$action = $type;
- $entry = preg_replace("/^".$type."__([^_]*)__.*/","\\1",$name);
$server = preg_replace("/^".$type."__[^_]*__([^_]*)_.*/","\\1",$name);
+ $entry[$server][] = preg_replace("/^".$type."__([^_]*)__.*/","\\1",$name);
break;
}
}
+ if(!empty($action)) break;
}
/* Send action for given mail id */
- if(in_array($action,array("hold","unhold","requeue"))){
- $this->si_queue->send_queue_action(array($entry),$server,$action);
+ if(in_array($action,array("del","hold","unhold","requeue"))){
+ foreach($entry as $server => $entries){
+ $this->si_queue->send_queue_action($entries,$server,$action);
+ }
}
******************/
if($action == "header"){
+ $server = key($entry);
+ $entry = $entry[$server];
/* Create table which displays the header informations */
$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);
+ $this->disp_header = FALSE;
}
}
Query mailqueues
******************/
+ $within_minutes = -1;
+ if($this->Time != "nolimit"){
+ $within_minutes = 60*60*$this->Time;
+ }
+
if($this->Server == "all"){
$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));
+ $entries = array_merge($entries,$this->si_queue->query_mailqueue(
+ $mac,$this->OrderBy,$this->SortType,$this->Search,$within_minutes));
if($this->si_queue->is_error()){
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);
+ $entries = $this->si_queue->query_mailqueue(
+ $this->Server,$this->OrderBy,$this->SortType,$this->Search,$within_minutes);
if($this->si_queue->is_error()){
msg_dialog::display(_("Error"),msgPool::siError($this->si_queue->get_error()),ERROR_DIALOG);
}
));
}
+ function list_get_selected_items()
+ {
+ $ids = array();
+ foreach($_POST as $name => $value){
+ if(preg_match("/^selected_*/",$name)){
+ $server = preg_replace("/^selected_.*_/","",$name) ;
+ $ids[$server][] = preg_replace("/^selected_([^_]*)_.*$/","\\1",$name);
+ }
+ }
+ return($ids);
+ }
+
}
diff --git a/gosa-plugins/mail/addons/mailqueue/class_si_mailqueue.inc b/gosa-plugins/mail/addons/mailqueue/class_si_mailqueue.inc
index 58443fbad0558559462d30aa495effad2c2e55b3..3ef982717138712464b7d848950fbdbf8ab3d4ea 100644 (file)
/*! \brief Returns a list of all mail queue entries
@return Array s.a.
*/
- public function query_mailqueue($server,$sortby,$direction)
+ public function query_mailqueue($server,$sortby,$direction,$search_str,$time)
{
$attrs = array("Size","Recipient","Sender","Arrival","MailID","Hold","Active","Error","Server");
$direction = "down";
}
+ /* Prepare search filter
+ */
+ $search_str = preg_replace("/\\\\\*/",".*",normalizePreg($search_str));
+
/* Query mailqueue
*/
$ids = array();
$items = array();
if(isset($res['XML'][0])){
foreach($res['XML'][0] as $name => $entry){
+
if(preg_match("/^ANSWER[0-9]*$/",$name)){
$attrs = array(
"MSG_SIZE" => "Size",
$val['Server'] = $server;
$val['Arrival'] = strtotime($val['Arrival']);
- $n = $val[$sortby]."-".microtime(1);
- while(isset($items[$n])){
- $n = $val[$sortby]."-".microtime(1);
+
+ /* Check arrival time.
+ */
+ if($time != -1 && !empty($val['Arrival'])){
+ if( ! ($val['Arrival'] > (time() - $time))){
+ continue;
+ }
+ }
+
+ /* Check if search string matches
+ */
+ $found = FALSE;
+ foreach($val as $name => $value){
+ if(preg_match("/^".$search_str."$/",$value)){
+ $found =TRUE;
+ break;
+ }
+ }
+
+ if($found){
+ $n = uniqid($val[$sortby]);
+ $items[$n] = $val;
}
- $items[$n] = $val;
}
}
}
}
$data['msg_id'] = $msg_ids;
- $this->send_data("gosa_mailqueue_".$action,$this->target,$data,FALSE);
+
+ print_a(array("gosa_mailqueue_".$action,$server,$data));;
+ $this->send_data("gosa_mailqueue_".$action,$server,$data,FALSE);
// There is no answer for this requests
}
}
diff --git a/gosa-plugins/mail/addons/mailqueue/contents.tpl b/gosa-plugins/mail/addons/mailqueue/contents.tpl
index 81acb66711c78e102f30f5527e2e84b60f6f2eb5..dbd5c5988ae10a7e97b5c52d787c83c33a71ac83 100644 (file)
<input name="search" value="{t}Search{/t}" type="submit">
</td>
<td style="border-left:1px solid #A0A0A0; text-align:right;">
- <input name="del_all" src="images/lists/trash.png" value="{t}Remove all messages{/t}" type="image"
+ <input name="all_del" src="images/lists/trash.png"
+ value="{t}Remove all messages{/t}" type="image"
title="{t}Remove all messages from selected servers queue{/t}">
- <input name="hold_all" src="plugins/mail/images/mailq_hold.png" value="{t}Hold all messages{/t}" type="image"
+ <input name="all_hold" src="plugins/mail/images/mailq_hold.png"
+ value="{t}Hold all messages{/t}" type="image"
title="{t}Hold all messages in selected servers queue{/t}">
- <input name="unhold_all" src="plugins/mail/images/mailq_unhold.png" value="{t}Release all messages{/t}" type="image"
+ <input name="all_unhold" src="plugins/mail/images/mailq_unhold.png"
+ value="{t}Release all messages{/t}" type="image"
title="{t}Release all messages in selected servers queue{/t}">
- <input name="requeue_all" src="images/lists/reload.png" value="{t}Requeue all messages{/t}" type="image"
+ <input name="all_requeue" src="images/lists/reload.png"
+ value="{t}Requeue all messages{/t}" type="image"
title="{t}Requeue all messages in selected servers queue{/t}">
</td>
</tr>
<table style="border: 1px solid rgb(176, 176, 176); width: 100%; vertical-align: top; text-align: left;" summary=""
border="0" cellpadding="2" cellspacing="1" rules="cols">
<tr style="background-color: rgb(232, 232, 232); height: 26px; font-weight: bold;">
+ <td style='width:20px'>
+ <input type='checkbox' id='select_all' name='select_all' title='"._("Select all")."'
+ onClick="toggle_all_('^selected_.*$','select_all');"></td>
<td><a href="{$plug}&sort=MailID" >{t}ID{/t} {if $OrderBy == "MailID"} {$SortType}{/if}</a></td>
<td><a href="{$plug}&sort=Server" >{t}Server{/t} {if $OrderBy == "Server"} {$SortType}{/if}</a></td>
<td><a href="{$plug}&sort=Size" >{t}Size{/t} {if $OrderBy == "Size"} {$SortType}{/if}</a></td>
{else}
<tr style="height: 22px; background-color: rgb(245, 245, 245);">
{/if}
+ <td><input id="selected_{$entries[$key].MailID}" type='checkbox' name='selected_{$entries[$key].MailID}_{$entries[$key].Server}' class='center'></td>
<td >
-<!-- onlick="javascript: document.mainform.header_server.value='{$entries[$key].Server}';
- document.mainform.header_id.value='{$entries[$key].MailID}';
- document.mainform.submit();"
--->
{if $entries[$key].Active == true}
<img class="center" src="plugins/mail/images/mailq_active.png" border=0 alt="{t}Active{/t}">
{/if}
-
{$entries[$key].MailID}</td>
- <td>
-<!-- onclick="javascript: document.location.href='{$plug}&act=header&id={$entries[$key].MailID}&server={$entries[$key].Server}'"-->
- {$entries[$key].ServerName}
- </td>
- <td>
- {$entries[$key].Size}</td>
- <td>
- {$entries[$key].Arrival}</td>
- <td>
- {$entries[$key].Sender}</td>
- <td>
- {$entries[$key].Recipient}</td>
+ <td>{$entries[$key].ServerName}</td>
+ <td>{$entries[$key].Size}</td>
+ <td>{$entries[$key].Arrival}</td>
+ <td>{$entries[$key].Sender}</td>
+ <td>{$entries[$key].Recipient}</td>
<td >{$entries[$key].Error}</td>
<td style="text-align:right">
- <input type='image' name='delete__{$entries[$key].MailID}__{$entries[$key].Server}' class="center"
+ <input type='image' name='del__{$entries[$key].MailID}__{$entries[$key].Server}' class="center"
src="images/lists/trash.png" alt="{t}delete{/t}" title="{t}Delete this message{/t}">
{if $entries[$key].Hold == true}
<input type='image' name='unhold__{$entries[$key].MailID}__{$entries[$key].Server}' class="center"