mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-24 19:30:12 +01:00
add bulk restore feature
This commit is contained in:
parent
77b22c7043
commit
f566bf5261
@ -6,6 +6,7 @@ RewriteRule ^expert.php /index.php?route=search/search&type=expert [L]
|
||||
RewriteRule ^search-helper.php /index.php?route=search/helper [L]
|
||||
RewriteRule ^audit-helper.php /index.php?route=audit/helper [L]
|
||||
RewriteRule ^message.php /index.php?route=message/view [L]
|
||||
RewriteRule ^bulkrestore.php /index.php?route=message/bulkrestore [L]
|
||||
RewriteRule ^settings.php /index.php?route=user/settings [L]
|
||||
RewriteRule ^login.php /index.php?route=login/login [L]
|
||||
RewriteRule ^logout.php /index.php?route=login/logout [L]
|
||||
|
@ -126,6 +126,7 @@ define('FROM_LENGTH_TO_SHOW', 28);
|
||||
|
||||
define('SEARCH_HELPER_URL', SITE_URL . 'search-helper.php');
|
||||
define('AUDIT_HELPER_URL', SITE_URL . 'audit-helper.php');
|
||||
define('BULK_RESTORE_URL', SITE_URL . 'bulkrestore.php');
|
||||
|
||||
define('SAVE_SEARCH_URL', SITE_URL . 'index.php?route=search/save');
|
||||
define('SEARCH_TAG_URL', SITE_URL . 'index.php?route=search/tag');
|
||||
|
54
webui/controller/message/bulkrestore.php
Normal file
54
webui/controller/message/bulkrestore.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
|
||||
class ControllerMessageBulkrestore extends Controller {
|
||||
|
||||
public function index(){
|
||||
|
||||
$this->id = "content";
|
||||
$this->template = "message/bulkrestore.tpl";
|
||||
$this->layout = "common/layout-empty";
|
||||
|
||||
$request = Registry::get('request');
|
||||
$db = Registry::get('db');
|
||||
|
||||
$this->load->model('search/search');
|
||||
$this->load->model('search/message');
|
||||
|
||||
$this->load->model('user/user');
|
||||
$this->load->model('mail/mail');
|
||||
|
||||
$this->document->title = $this->data['text_message'];
|
||||
|
||||
if(!isset($this->request->post['idlist']) || $this->request->post['idlist'] == '') { die("no idlist parameter given"); }
|
||||
|
||||
list($a, $idlist) = $this->model_search_search->check_your_permission_by_id_list(explode(",", $this->request->post['idlist']));
|
||||
|
||||
|
||||
$this->data['username'] = Registry::get('username');
|
||||
|
||||
$rcpt = array();
|
||||
|
||||
|
||||
array_push($rcpt, $_SESSION['email']);
|
||||
|
||||
|
||||
$this->data['restored'] = 0;
|
||||
|
||||
foreach($idlist as $id) {
|
||||
|
||||
AUDIT(ACTION_RESTORE_MESSAGE, '', '', $id, '');
|
||||
|
||||
/*$x = $this->model_mail_mail->send_smtp_email(SMARTHOST, SMARTHOST_PORT, SMTP_DOMAIN, SMTP_FROMADDR, $rcpt,
|
||||
"Received: by piler" . EOL . PILER_HEADER_FIELD . $id . EOL . $this->model_search_message->get_raw_message($id) );
|
||||
|
||||
if($x == 1) { $this->data['restored']++; }*/
|
||||
}
|
||||
|
||||
$this->render();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -23,7 +23,7 @@ class ControllerSearchTag extends Controller {
|
||||
|
||||
$q = '';
|
||||
|
||||
$ids = $this->model_search_search->check_your_permission_by_id_list($idlist);
|
||||
list($ids, $a) = $this->model_search_search->check_your_permission_by_id_list($idlist);
|
||||
|
||||
for($i=0; $i<count($ids); $i++) { $q .= ",?"; }
|
||||
$q = preg_replace("/^\,/", "", $q);
|
||||
|
@ -26,6 +26,7 @@ $_['text_audit'] = "Audit";
|
||||
$_['text_back'] = "Back";
|
||||
$_['text_body'] = "Body";
|
||||
$_['text_bulk_edit_selected_uids'] = "Bulk edit selected uids";
|
||||
$_['text_bulk_restore_selected_emails'] = "Bulk restore selected emails";
|
||||
$_['text_bulk_update_selected_uids'] = "Bulk update selected uids";
|
||||
|
||||
$_['text_cancel'] = "Cancel";
|
||||
|
@ -26,6 +26,7 @@ $_['text_audit'] = "Audit";
|
||||
$_['text_back'] = "Vissza";
|
||||
$_['text_body'] = "Szöveg";
|
||||
$_['text_bulk_edit_selected_uids'] = "Kiválasztott azonosítók szerkesztése";
|
||||
$_['text_bulk_restore_selected_emails'] = "Kiválasztott levelek visszaállítása";
|
||||
$_['text_bulk_update_selected_uids'] = "Kiválasztott azonosítók szerkesztése";
|
||||
|
||||
$_['text_cancel'] = "Mégse";
|
||||
|
@ -26,6 +26,7 @@ $_['text_audit'] = "Audit";
|
||||
$_['text_back'] = "Vissza";
|
||||
$_['text_body'] = "Szöveg";
|
||||
$_['text_bulk_edit_selected_uids'] = "Kiválasztott azonosítók szerkesztése";
|
||||
$_['text_bulk_restore_selected_emails'] = "Kiválasztott levelek visszaállítása";
|
||||
$_['text_bulk_update_selected_uids'] = "Kiválasztott azonosítók szerkesztése";
|
||||
|
||||
$_['text_cancel'] = "Mégse";
|
||||
|
@ -459,7 +459,7 @@ class ModelSearchSearch extends Model {
|
||||
|
||||
public function check_your_permission_by_id_list($id = array()) {
|
||||
$q = $q2 = '';
|
||||
$arr = $a = $result = array();
|
||||
$arr = $a = $result = $result2 = array();
|
||||
|
||||
if(count($id) < 1) { return array(); }
|
||||
|
||||
@ -485,15 +485,16 @@ class ModelSearchSearch extends Model {
|
||||
|
||||
$arr = array_merge($arr, $a, $a);
|
||||
|
||||
$query = $this->db->query("SELECT distinct id FROM " . VIEW_MESSAGES . " WHERE `id` IN ($q2) AND ( `from` IN ($q) OR `to` IN ($q) )", $arr);
|
||||
$query = $this->db->query("SELECT distinct id, piler_id FROM " . VIEW_MESSAGES . " WHERE `id` IN ($q2) AND ( `from` IN ($q) OR `to` IN ($q) )", $arr);
|
||||
|
||||
if($query->num_rows > 0) {
|
||||
foreach ($query->rows as $q) {
|
||||
array_push($result, $q['id']);
|
||||
array_push($result2, $q['piler_id']);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
return array($result, $result2);
|
||||
}
|
||||
|
||||
|
||||
|
@ -385,6 +385,62 @@ function tag_search_results(url){
|
||||
}
|
||||
|
||||
|
||||
function restore_selected_emails(url) {
|
||||
var a = document.getElementById('results');
|
||||
var idlist = "";
|
||||
|
||||
len = a.childNodes.length;
|
||||
|
||||
for(i=0; i<a.childNodes.length; i++) {
|
||||
|
||||
if(a.childNodes[i].nodeName == "DIV" && a.childNodes[i].id.substring(0, 2) == "e_") {
|
||||
|
||||
id = a.childNodes[i].id.substring(2,1000);
|
||||
|
||||
b = document.getElementById('r_' + id);
|
||||
|
||||
if(b.checked == true) {
|
||||
|
||||
if(idlist) { idlist += "," + id; }
|
||||
else { idlist = id; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(idlist) {
|
||||
var http = getXMLHttp();
|
||||
|
||||
if(http == null) { alert("Error creating XMLHttpRequest"); return; }
|
||||
|
||||
document.getElementById('A1').innerHTML = '<div class="restore_spinner"><img src="/view/theme/default/images/spinner.gif" id="spinner_restore" alt="spinner" /></div>';
|
||||
|
||||
|
||||
http.open("POST", url, true);
|
||||
|
||||
params = "idlist=" + idlist;
|
||||
|
||||
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
||||
http.setRequestHeader("Content-length", params.length);
|
||||
http.setRequestHeader("Connection", "close");
|
||||
|
||||
|
||||
http.onreadystatechange = function() {
|
||||
if(http.readyState == 4) {
|
||||
if(http.status == 200) {
|
||||
document.getElementById('A1').innerHTML = http.responseText;
|
||||
}
|
||||
else {
|
||||
alert("Problem retrieving XML data:" + http.statusText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
http.send(params);
|
||||
}
|
||||
|
||||
//document.getElementById('A1').innerHTML = ' ';
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
$.datepicker.setDefaults($.datepicker.regional[piler_ui_lang]);
|
||||
|
@ -16,6 +16,7 @@
|
||||
#menu .leftcell { display: table-cell; width: 490px; text-align: justify; }
|
||||
#menu .rightcell { display: table-cell; width: 490px; text-align: right; font: normal 12px Arial, sans-serif; margin: 0; padding: 0; }
|
||||
#menu .logout22 { float: right; text-align: right; }
|
||||
#menu .logout22_admin { float: right; text-align: right; font: normal 11px Arial, sans-serif; }
|
||||
#menu a:link.logout, a:visited.logout { color: #222; }
|
||||
#menu a:hover.logout { background: #F3D673; }
|
||||
|
||||
@ -60,11 +61,13 @@
|
||||
#auditresultscontainer.empty { border-bottom: 0px solid black; height: 580px; }
|
||||
|
||||
#spinner { margin-left: 480px; margin-top: 275px; }
|
||||
#spinner_restore { border: 0px solid red; margin-top: 60px; }
|
||||
.restore_spinner { text-align: center; border: 0px solid black; }
|
||||
|
||||
.text { font: normal 12px Arial, sans-serif; font-weight: bold; text-align:left; width: 408px; }
|
||||
.ruletext { font: normal 12px Arial, sans-serif; font-weight: bold; text-align:left; width: 365px; }
|
||||
.advtext { font: bold 12px Arial, sans-serif; font-weight: bold; text-align:left; width: 280px; }
|
||||
.tagtext { font: normal 10px Arial, sans-serif; font-weight: bold; text-align:left; width: 280px; }
|
||||
.tagtext { font: normal 10px Arial, sans-serif; font-weight: bold; text-align:left; width: 265px; }
|
||||
.advtextgrey { font: bold 12px Arial, sans-serif; color: #999; font-weight: bold; text-align:left; width: 280px; }
|
||||
.textregular { font: normal 12px Arial, sans-serif; font-weight: bold; text-align:left; }
|
||||
|
||||
@ -76,6 +79,8 @@
|
||||
|
||||
.cell1 { display: table-cell; height: 25px; text-align: left; padding: 3px; font: bold 12px Arial, sans-serif; width: 80px; }
|
||||
.cell1s { display: table-cell; height: 25px; text-align: left; padding: 3px; font: bold 12px Arial, sans-serif; width: 85px; }
|
||||
.cell1q { display: table-cell; height: 25px; text-align: left; padding: 3px; font: bold 12px Arial, sans-serif; width: 50px; }
|
||||
.cell1r { display: table-cell; height: 25px; text-align: left; padding: 3px; font: bold 12px Arial, sans-serif; width: 15px; }
|
||||
.cell3 { display: table-cell; height: 25px; text-align: left; padding: 0px; padding-top: 3px; font: bold 19px Arial, sans-serif; }
|
||||
|
||||
.cell3.title { color: black; text-align: left; }
|
||||
@ -88,7 +93,8 @@
|
||||
|
||||
.cell5 { display: table-cell; height: 25px; text-align: left; padding-bottom: 0px; padding-right: 3px; vertical-align: middle; }
|
||||
|
||||
.cell5.id { text-align: center; }
|
||||
.cell5.restore { text-align: left; border: 0px solid blue; }
|
||||
.cell5.id { text-align: center; border: 0px solid red; }
|
||||
.cell5.date { text-align: left; }
|
||||
.cell5.size { text-align: left; padding-right: 20px; }
|
||||
.cell5.verification { text-align: right; padding-right: 0px; }
|
||||
@ -138,8 +144,10 @@
|
||||
|
||||
input[type=button].short { margin: 0; background-color:#eee; color: gray; font: bold 12px Arial, sans-serif; width: 50px;}
|
||||
input[type=button].tag { margin: 0; background-color:#eee; color: gray; font: normal 10px Arial, sans-serif; }
|
||||
input[type=button].restore { margin: 0; background-color:yellow; color: black; font: normal 10px Arial, sans-serif; }
|
||||
|
||||
input[type=checkbox].attachmenttype { margin: 0; vertical-align: middle; }
|
||||
input[type=checkbox].restorebox { margin: 0; vertical-align: middle; }
|
||||
|
||||
#messagepopup { margin: 10px 20px 10px 20px; padding: 0; background-color: white; text-align: left; }
|
||||
|
||||
@ -156,7 +164,7 @@
|
||||
* dropdown menu
|
||||
*/
|
||||
|
||||
.mcell { display: table-cell; font: normal 12px Arial, sans-serif; vertical-align: top; }
|
||||
.mcell { display: table-cell; vertical-align: top; }
|
||||
|
||||
ul.dropdown { position: relative; }
|
||||
ul.dropdown li { font-weight: bold; float: left; background: #ffffff; text-align: center; padding-right: 40px; padding-left: 40px; border: 0px solid red; }
|
||||
@ -185,7 +193,7 @@
|
||||
|
||||
ul.sub_menu li { padding-left: 10px; padding-right: 10px; width: 140px; }
|
||||
|
||||
ul.dropdown ul li a { border-right: none; width: 100%; display: inline-block; text-align: left; }
|
||||
ul.dropdown ul li a { border-right: none; font: 11px normal Arial, sans-serif; width: 100%; display: inline-block; text-align: left; }
|
||||
|
||||
}
|
||||
|
||||
|
@ -11,11 +11,11 @@
|
||||
<div class="mcell" style="width: 350px; border: 0px solid red;">
|
||||
|
||||
<ul class="dropdown">
|
||||
<li class="search_li" style=""><a href="search.php"<?php if($_SERVER['REQUEST_URI'] == '/' || strstr($_SERVER['REQUEST_URI'], "search.php")){ ?> id="active"<?php } ?>><?php print $text_simple; ?></a> / </li>
|
||||
<li class="search_li" style=""><a href="advanced.php"<?php if(strstr($_SERVER['REQUEST_URI'], "advanced.php")){ ?> id="active"<?php } ?>><?php print $text_advanced; ?></a></li>
|
||||
<li class="no_search_li" style=""><?php print $text_search2; ?> | </li>
|
||||
<li class="search_li" style="font: 11px normal Arial, sans-serif;"><a href="search.php"<?php if($_SERVER['REQUEST_URI'] == '/' || strstr($_SERVER['REQUEST_URI'], "search.php")){ ?> id="active"<?php } ?>><?php print $text_simple; ?></a> / </li>
|
||||
<li class="search_li" style="font: 11px normal Arial, sans-serif;"><a href="advanced.php"<?php if(strstr($_SERVER['REQUEST_URI'], "advanced.php")){ ?> id="active"<?php } ?>><?php print $text_advanced; ?></a> </li>
|
||||
<li class="no_search_li" style="font: 11px normal Arial, sans-serif;"><?php print $text_search2; ?> | </li>
|
||||
|
||||
<li class="search_li" style=""><a class="hide" href="#"<?php if(strstr($_SERVER['QUERY_STRING'], "stat/") || strstr($_SERVER['QUERY_STRING'], "health/") || strstr($_SERVER['QUERY_STRING'], "audit/") ) { ?> id="active"<?php } ?>><?php print $text_monitor; ?></a> |
|
||||
<li class="search_li" style="font: 11px normal Arial, sans-serif;"><a class="hide" href="#"<?php if(strstr($_SERVER['QUERY_STRING'], "stat/") || strstr($_SERVER['QUERY_STRING'], "health/") || strstr($_SERVER['QUERY_STRING'], "audit/") ) { ?> id="active"<?php } ?>><?php print $text_monitor; ?></a> |
|
||||
<ul class="sub_menu">
|
||||
<li><a href="index.php?route=stat/stat×pan=daily"><?php print $text_statistics; ?></a></li>
|
||||
<li><a href="index.php?route=health/health"><?php print $text_health; ?></a></li>
|
||||
@ -23,7 +23,7 @@
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li class="search_li" style=""><a class="hide" href="#"<?php if(strstr($_SERVER['QUERY_STRING'], "domain/") || ($_SERVER['QUERY_STRING'] != "route=user/settings" && strstr($_SERVER['QUERY_STRING'], "user/")) || strstr($_SERVER['QUERY_STRING'], "policy/") || strstr($_SERVER['QUERY_STRING'], "import/")) { ?> id="active"<?php } ?>><?php print $text_administration; ?></a>
|
||||
<li class="search_li" style="font: 11px normal Arial, sans-serif;"><a class="hide" href="#"<?php if(strstr($_SERVER['QUERY_STRING'], "domain/") || ($_SERVER['QUERY_STRING'] != "route=user/settings" && strstr($_SERVER['QUERY_STRING'], "user/")) || strstr($_SERVER['QUERY_STRING'], "policy/") || strstr($_SERVER['QUERY_STRING'], "import/")) { ?> id="active"<?php } ?>><?php print $text_administration; ?></a>
|
||||
<ul class="sub_menu">
|
||||
<li><a href="index.php?route=user/list"><?php print $text_user_management; ?></a></li>
|
||||
<li><a href="index.php?route=domain/domain"><?php print $text_domain; ?></a></li>
|
||||
@ -36,7 +36,7 @@
|
||||
</div>
|
||||
<div class="mcell" style="width: 60px; border: 0px solid red;">
|
||||
<ul class="dropdown">
|
||||
<li class="last_li" style="text-align: right; float: right;"><a href="settings.php"<?php if(strstr($_SERVER['REQUEST_URI'], "settings.php")){ ?> id="active"<?php } ?>><?php print $text_settings; ?></a></li>
|
||||
<li class="last_li" style="text-align: right; float: right; font: 11px normal Arial, sans-serif;"><a href="settings.php"<?php if(strstr($_SERVER['REQUEST_URI'], "settings.php")){ ?> id="active"<?php } ?>><?php print $text_settings; ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@ -46,7 +46,7 @@
|
||||
</div>
|
||||
|
||||
<div class="rightcell">
|
||||
<div class="logout22">
|
||||
<div class="logout22_admin">
|
||||
<?php if(isset($_SESSION['realname'])) { print $text_realname; ?>: <?php print $_SESSION['realname']; ?>, <?php } ?> <a class="logout" href="logout.php"<?php if(strstr($_SERVER['QUERY_STRING'], "login/logout")){ ?> id="active"<?php } ?>><?php print $text_logout; ?></a>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -0,0 +1 @@
|
||||
<p><?php print $text_restored; ?>: <?php print $restored; ?></p>
|
@ -20,6 +20,8 @@
|
||||
<input type="hidden" id="tag_keys" name="tag_keys" value="<?php print $all_ids; ?>" />
|
||||
<input type="hidden" id="_ref" name="_ref" value="<?php if(isset($_ref)) { print $_ref; } ?>" />
|
||||
|
||||
<input type="button" class="restore" value="<?php print $text_bulk_restore_selected_emails; ?>" onclick="javascript: restore_selected_emails('<?php print BULK_RESTORE_URL; ?>');" />
|
||||
|
||||
<?php print $text_tag_search_results; ?>: <input type="text" id="tag_value" name="tag_value" class="tagtext" /> <input type="button" class="tag" onclick="javascript: tag_search_results('<?php print SEARCH_TAG_URL; ?>'); var __ref = document.getElementById('_ref').value; if(__ref) { add_message_reference_to_form(__ref); } load_search_results('<?php print SEARCH_HELPER_URL; ?>', assemble_search_term(count), 0); return false;" value="OK" />
|
||||
</div>
|
||||
|
||||
@ -36,7 +38,8 @@
|
||||
|
||||
<div class="resultrow">
|
||||
<?php if($n > 0){ ?>
|
||||
<div class="cell1"> </div>
|
||||
<div class="cell1r"> </div>
|
||||
<div class="cell1q"> </div>
|
||||
<div class="cell3 date">
|
||||
<?php print $text_date; ?>
|
||||
<a href="#" onclick="script:fix_search_order('date', 1); load_search_results('<?php print SEARCH_HELPER_URL; ?>', assemble_search_term(count), 0); return false;"><img src="<?php print ICON_ARROW_UP; ?>" alt="" border="0"></a>
|
||||
@ -72,6 +75,7 @@
|
||||
<?php $i=0; foreach ($messages as $message) { $i++; ?>
|
||||
|
||||
<div id="e_<?php print $message['id']; ?>" class="resultrow<?php if($i % 2) { ?> odd<?php } ?><?php if($message['spam'] == 1) { ?> spam<?php } ?>">
|
||||
<div class="cell5 restore"><input type="checkbox" id="r_<?php print $message['id']; ?>" name="r_<?php print $message['id']; ?>" value="iiii" checked="checked" class="restorebox" /></div>
|
||||
<div class="cell5 id"><?php print ($page*$page_len) + $i; ?>.</div>
|
||||
<div class="cell5 date"><?php print $message['date']; ?></div>
|
||||
<div class="cell5 from"><?php if($message['from'] != $message['shortfrom']) { ?><span onmouseover="Tip('<?php print preg_replace("/&/", "&", $message['from']); ?>', BALLOON, true, ABOVE, true)" onmouseout="UnTip();"><?php print $message['shortfrom']; ?></span><?php } else { print $message['from']; } ?></div>
|
||||
|
Loading…
Reference in New Issue
Block a user