added bulk download feature

This commit is contained in:
SJ
2012-05-11 23:42:55 +02:00
parent 9212dff26b
commit 078742e4a3
10 changed files with 152 additions and 12 deletions

View File

@ -385,7 +385,7 @@ function tag_search_results(url){
}
function restore_selected_emails(url) {
function assemble_idlist() {
var a = document.getElementById('results');
var idlist = "";
@ -407,6 +407,14 @@ function restore_selected_emails(url) {
}
}
return idlist;
}
function restore_selected_emails(url) {
var idlist = assemble_idlist();
if(idlist) {
var http = getXMLHttp();
@ -414,10 +422,9 @@ function restore_selected_emails(url) {
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;
params = "idlist=" + idlist + "&download=0";
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", params.length);
@ -438,7 +445,69 @@ function restore_selected_emails(url) {
http.send(params);
}
//document.getElementById('A1').innerHTML = '&nbsp;';
}
function download_selected_emails(url) {
var hiddenField;
var idlist = assemble_idlist();
if(idlist) {
var form = document.createElement("form");
form.setAttribute("method", "post");
form.setAttribute("action", url);
form.setAttribute("name", "download");
hiddenField = document.createElement("input");
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", "download");
hiddenField.setAttribute("value", "1");
form.appendChild(hiddenField);
hiddenField = document.createElement("input");
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", "idlist");
hiddenField.setAttribute("value", idlist);
form.appendChild(hiddenField);
document.body.appendChild(form);
form.submit();
}
}
function toggle_bulk_check() {
var isChecked = document.getElementById('bulkcheck').value;
var a = document.getElementById('results');
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(isChecked == 1) { b.checked = 0; }
else { b.checked = 1; }
}
}
if(isChecked == 1) {
document.getElementById('bulkcheck').checked = 0;
document.getElementById('bulkcheck').value = 0;
}
else {
document.getElementById('bulkcheck').checked = 1;
document.getElementById('bulkcheck').value = 1;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -80,7 +80,7 @@
.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; }
.cell1r { display: table-cell; height: 25px; text-align: left; padding: 0px; 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; }

View File

@ -38,8 +38,8 @@
<div class="resultrow">
<?php if($n > 0){ ?>
<div class="cell1r">&nbsp;</div>
<div class="cell1q">&nbsp;</div>
<div class="cell1r" style="vertical-align:middle;"><input type="checkbox" id="bulkcheck" name="bulkcheck" value="1" checked="checked" class="restorebox" onchange="javascript:toggle_bulk_check(); return false;" /></div>
<div class="cell1q" style="text-align: center;"><a href="#" onclick="javascript: download_selected_emails('<?php print BULK_RESTORE_URL; ?>'); return false;"><img style="margin: 0px 0 -2px 0; border: 0px solid black;" src="<?php print ICON_DOWNLOAD; ?>" width="18" height="18" alt="aaa" border="0"></a></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>
@ -79,7 +79,7 @@
<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("/&/", "&amp;", $message['from']); ?>', BALLOON, true, ABOVE, true)" onmouseout="UnTip();"><?php print $message['shortfrom']; ?></span><?php } else { print $message['from']; } ?></div>
<div class="cell5 subject"><a class="messagelink<?php if($message['spam'] == 1) { ?> spam<?php } ?>" href="<?php print SITE_URL; ?>message.php/<?php print $message['piler_id']; ?>"><?php if($message['subject'] != $message['shortsubject']) { ?><span onmouseover="Tip('<?php print preg_replace("/&/", "&amp;", $message['subject']); ?>', BALLOON, true, ABOVE, true)" onmouseout="UnTip();"><?php print $message['shortsubject']; ?></span><?php } else { print $message['subject']; } ?></a><?php if($message['reference']) { ?> <a href="#" onclick="script:add_message_reference_to_form('<?php print $message['reference']; ?>'); load_search_results('<?php print SEARCH_HELPER_URL; ?>', assemble_search_term(count), 0); a = document.getElementById('ref'); a.value=''; return false;"><span onmouseover="Tip('<?php print $text_conversation_available; ?>', BALLOON, true, ABOVE, true)" onmouseout="UnTip();">[+]</span></a><?php } ?></div>
<div class="cell5 subject"><a class="messagelink<?php if($message['spam'] == 1) { ?> spam<?php } ?>" href="<?php print SITE_URL; ?>message.php/<?php print $message['piler_id']; ?>"><?php if($message['subject'] != $message['shortsubject']) { ?><span onmouseover="Tip('<?php print preg_replace("/&/", "&amp;", $message['subject']); ?>', BALLOON, true, ABOVE, true)" onmouseout="UnTip();"><?php print $message['shortsubject']; ?></span><?php } else { print $message['subject']; } ?></a><?php if($message['reference']) { ?> <a href="#" onclick="script:add_message_reference_to_form('<?php print $message['reference']; ?>'); load_search_results('<?php print SEARCH_HELPER_URL; ?>', assemble_search_term(count), 0); a = document.getElementById('ref'); a.value=''; return false;"><span onmouseover="Tip('<?php print $text_conversation_available; ?>', BALLOON, true, ABOVE, true);" onmouseout="UnTip();">[+]</span></a><?php } ?></div>
<div class="cell5 size"><?php print $message['size']; ?></div>
<div class="cell5"><?php if($message['attachments'] > 0) { ?><img src="<?php print ICON_ATTACHMENT; ?>" alt="" width="16" height="18" /><?php } else { ?>&nbsp;<?php } ?></div>
<div class="cell5"><?php if($message['tag']) { ?><span onmouseover="Tip('<?php print $message['tag']; ?>', BALLOON, true, ABOVE, true)" onmouseout="UnTip();"><img src="<?php print ICON_TAG; ?>" alt="" /></span><?php } else { ?>&nbsp;<?php } ?></div>