folder fixes

This commit is contained in:
SJ 2013-03-31 14:50:21 +02:00
parent 5d7a349741
commit 26d18671da
9 changed files with 118 additions and 87 deletions

View File

@ -188,6 +188,11 @@ class ModelFolderFolder extends Model {
if($name == '') { return -1; }
$query = $this->db->query("INSERT INTO " . TABLE_FOLDER_EXTRA . " (uid, name) VALUES(?,?)", array($_SESSION['uid'], $name));
$last_id = $this->db->getLastId();
if(!isset($_SESSION['extra_folders'][$last_id])) { array_push($_SESSION['extra_folders'], $last_id); }
return $this->db->countAffected();
}

View File

@ -302,7 +302,9 @@ class ModelSearchSearch extends Model {
if(count($__folders) > 0) {
$folders = "folder IN (" . implode(",", $__folders) . ") AND ";
}
else {
$folders = "folder IN (" . implode(",", $_SESSION['folders']) . ") AND ";
}
}

View File

@ -12,6 +12,10 @@ var Piler =
piler_ui_lang: '<?php LANG == 'en' ? print 'en-GB' : print LANG; ?>',
prev_message_id: 0,
pos: -1,
current_message_id: 0,
folders: '',
extra_folders: '',
/*
* variables used at search listing
@ -401,6 +405,7 @@ var Piler =
Piler.Messages = u;
Piler.pos = -1;
Piler.prev_message_id = 0;
Piler.current_message_id = 0;
},
@ -470,10 +475,14 @@ var Piler =
Piler.Shared.page = 0;
Piler.Shared.type = 'search';
Piler.assemble_folder_restrictions();
Piler.Searches.Expert = {
search : $('input#_search').val().trim(),
searchtype : 'expert',
ref: $('#ref').val()
ref: $('#ref').val(),
folders: Piler.folders,
extra_folders: Piler.extra_folders
}
$('#ref').val('');
@ -503,6 +512,8 @@ var Piler =
Piler.Shared.page = 0;
Piler.Shared.type = 'search';
Piler.assemble_folder_restrictions();
Piler.Searches.Complex = {
from : $('input#xfrom', z).val().trim(),
to : $('input#xto', z).val().trim(),
@ -758,6 +769,81 @@ var Piler =
});
},
assemble_folder_restrictions: function()
{
Piler.log("[assemble_folder_restrictions]");
Piler.folders = '';
Piler.extra_folders = '';
a = document.getElementById('folders');
if(!a) { return false; }
childNodeArray = a.getElementsByTagName('*');
if(childNodeArray) {
for(i=0; i<childNodeArray.length; i++) {
b = childNodeArray[i];
if(b.name && b.name.substring(0, 7) == 'folder_' && b.checked) {
Piler.folders = Piler.folders + " " + b.name.substring(7);
}
if(b.name && b.name.substring(0, 13) == 'extra_folder_' && b.checked) {
Piler.extra_folders = Piler.extra_folders + " " + b.name.substring(13);
}
}
}
if(Piler.folders) {
Piler.folders = Piler.folders.substring(1);
}
if(Piler.extra_folders) {
Piler.extra_folders = Piler.extra_folders.substring(1);
}
Piler.log("[folder/extra_folders]", Piler.folders, Piler.extra_folders);
},
copy_message_to_folder: function(folder_id, id, msg)
{
Piler.log("[copy_message_to_folder]", folder_id, id);
if(id <= 0) { return 0; }
var folder_copy_url = '<?php print SITE_URL; ?>/index.php?route=folder/copy'
jQuery.ajax('index.php?route=folder/copy', {
data: { folder_id: folder_id, id: id },
type: "POST"
})
.done( function(a) {})
.fail(function(a, b) { alert("Problem retrieving XML data:" + b) });
Piler.show_message('messagebox1', msg, 0.85);
Piler.current_message_id = 0;
},
open_folder: function(id)
{
$('#fldr_' + id).show();
$('#fldr_collapse_' + id).show();
$('#fldr_open_' + id).hide();
},
close_folder: function(id)
{
$('#fldr_' + id).hide();
$('#fldr_collapse_' + id).hide();
$('#fldr_open_' + id).show();
}

View File

@ -28,7 +28,7 @@
#main { margin: 0px 40px 20px 40px; width: 100%; text-align: left; float: left; clear: both; }
.slick { margin:0; padding:0; }
.sleek { margin:0; padding:0; }
.center { text-align: center; }
#expertsearch { position: absolute; border: 0px solid black; right: 20px; left: 20px; text-align: left; font: normal 19px Arial, sans-serif; margin-top: 10px; }
@ -105,10 +105,6 @@
.auditcell.ref { width: 90px; }
.auditcell.header { height: 30px; font: bold 12px Arial, sans-serif; color: black; }
/*.cellaudit { display: table-cell; height: 14px; text-align: left; font: normal 12px Arial, sans-serif; padding: 0; margin: 0; vertical-align: middle;}
.cellaudit.date { width: 120px; }
.cellaudit.title { font: bold 12px Arial, sans-serif;}*/
#health1 { display: table-cell; margin-top: 10px; margin-bottom: 0; }
#health2 { display: table-cell; text-align: right; }
@ -124,15 +120,10 @@
#pagingcenter { display: table-cell; float: left; text-align: center; width: 145px; border: 0px solid red; }
#pagingright { display: table-cell; float: left; text-align: right; width: 60px; border: 0px solid red; }
//#tagbox { display: table-cell; float: left; text-align: right; vertical-align: top; width: 725px; border: 0px solid red; }
.messagelink { border-bottom: 1px solid gray; color: #850505; }
.messagelink.spam { border-bottom: 1px solid gray; color: #aaa; }
#results a:hover { color: black; }
//.restore_to_mailbox { font: normal 12px Arial, sans-serif; color: #850505; padding: 0; margin:0; height: 18px; border: 0px; background: #eee; vertical-align: middle; }
input[type=textarea] { height:80px; }
@ -143,17 +134,12 @@
#messagepopup { margin: 10px 20px 10px 20px; padding: 0; background-color: white; text-align: left; }
#restorebox { position: absolute; top: 20px; left: 15%; border: 3px solid red; display: none; background: orange; color: #000000; font-weight: bold; padding: 15px; z-index: 1; }
//#note { width: 500px; padding: 0; margin: 0px; color: #000000; }
//.mynote { height: 10px; font: 9px Arial, sans-serif; }
.domainrow { display: table-row; border: 2px solid gray; padding: 10px; }
.domaincell { display: table-cell; font: bold 12px Arial, sans-serif; border: 1px solid gray; padding: 5px; vertical-align: top; }
.logincell { display: table-cell; font: bold 12px Arial, sans-serif; padding: 5px; vertical-align: top; }
.domain { font: normal 12px Arial, sans-serif; font-weight: bold; text-align:left; width: 408px;}
//p.error { margin-bottom: 20px; color: red; font-weight: bold; }
.extra_folder { color: #850505; font-weight: bold; border: none; width: 70%; background: transparent; }
.folder { margin: 0 0 5px 10px; }
.bold { font-weight: bold; }
.left { text-align: left; }

View File

@ -1,53 +0,0 @@
<?php if(Registry::get('username')) { ?>
<div class="row">
<div class="leftcell">
<div id="ss1">
<div class="row">
<div class="mcell">
<ul class="dropdown">
<li class="search_li"><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&timespan=daily"><?php print $text_statistics; ?></a></li>
<li><a href="index.php?route=health/health"><?php print $text_health; ?></a></li>
<li><a href="index.php?route=accounting/accounting&view=email"><?php print $text_accounting; ?></a></li>
<?php if(ENABLE_AUDIT == 1) { ?>
<li><a href="index.php?route=audit/audit"><?php print $text_audit; ?></a></li>
<?php } ?>
</ul>
</li>
<li class="search_li"><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_users; ?></a></li>
<li><a href="index.php?route=group/list"><?php print $text_groups; ?></a></li>
<li><a href="index.php?route=domain/domain"><?php print $text_domain; ?></a></li>
<li><a href="index.php?route=policy/archiving"><?php print $text_archiving_rules; ?></a></li>
<li><a href="index.php?route=policy/retention"><?php print $text_retention_rules; ?></a></li>
</ul>
</li>
<li class="last_li"><a href="settings.php"<?php if(strstr($_SERVER['REQUEST_URI'], "settings.php")){ ?> id="active"<?php } ?>><?php print $text_settings; ?></a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="rightcell">
<div class="logout22">
<?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>
</div>
<?php } ?>

View File

@ -39,6 +39,9 @@
<?php } else { ?>
<li<?php if($_SERVER['REQUEST_URI'] == '/' || strstr($_SERVER['REQUEST_URI'], "search.php")){ ?> class="active"<?php } ?>><a href="search.php"><?php print $text_search; ?></a></li>
<?php if(ENABLE_FOLDER_RESTRICTIONS == 1) { ?>
<li<?php if($_SERVER['REQUEST_URI'] == '/' || strstr($_SERVER['REQUEST_URI'], "folders.php")){ ?> class="active"<?php } ?>><a href="folders.php"><?php print $text_folder; ?></a></li>
<?php } ?>
<?php } ?>

View File

@ -16,7 +16,7 @@
<div class="row">
<div class="cell1">&nbsp;</div>
<div class="cell2"><input type="submit" value="<?php print $text_add; ?>" /> <input type="reset" value="<?php print $text_cancel; ?>" /></div>
<div class="cell2"><input type="submit" class="btn btn-primary" value="<?php print $text_add; ?>" /> <input type="reset" class="btn" value="<?php print $text_cancel; ?>" /></div>
</div>
</div>

View File

@ -1,11 +1,13 @@
<p style="text-align:left; font-weight: bold; "><?php print $text_folders; ?>:</p>
<p class="bold"><?php print $text_folders; ?>:</p>
<div id="folders" style="text-align:left;">
<div id="folders">
<?php foreach ($extra_folders as $folder) { ?>
<blockquote style="border: 0px solid red; margin: 0 0 5px 10px;">
<img src="<?php print ICON_EMPTY; ?>" width="12" height="12" alt="" /> <input type="checkbox" id="extra_folder_<?php print $folder['id']; ?>" name="extra_folder_<?php print $folder['id']; ?>" /> <input type="text" ondrop="copy_message_to_folder('<?php print $folder['id']; ?>', current_message_id, '<?php print $text_copied; ?>'); return false;" class="extra_folder" value="<?php print $folder['name']; ?>" />
<blockquote class="folder">
<form class="form-search sleek">
<img src="<?php print ICON_EMPTY; ?>" width="12" height="12" alt="" /> <input type="checkbox" id="extra_folder_<?php print $folder['id']; ?>" name="extra_folder_<?php print $folder['id']; ?>" /> <input type="text" ondrop="Piler.copy_message_to_folder('<?php print $folder['id']; ?>', Piler.current_message_id, '<?php print $text_copied; ?>'); return false;" class="input-small bold" style="color: #850505; border:none; background: transparent; " value="<?php print $folder['name']; ?>" />
</form>
</blockquote>
<?php } ?>
@ -16,7 +18,7 @@
function display_folders($arr = array(), &$i) {
?>
<blockquote id="fldr_<?php print $i; ?>" style="border: 0px solid red; margin: 0 0 5px 10px;">
<blockquote id="fldr_<?php print $i; ?>" class="folder">
<?php
$i++;
@ -24,8 +26,8 @@ function display_folders($arr = array(), &$i) {
?>
<?php if(count($a['children']) > 0) { ?>
<a id="fldr_collapse_<?php print $i; ?>" href="#" onclick="close_folder(<?php print $i; ?>); return false;"><img src="<?php print ICON_MINUS; ?>" alt="" /></a>
<a id="fldr_open_<?php print $i; ?>" href="#" onclick="open_folder(<?php print $i; ?>); return false;" style="display:none;"><img src="<?php print ICON_PLUS; ?>" alt="" /></a>
<a id="fldr_collapse_<?php print $i; ?>" href="#" onclick="Piler.close_folder(<?php print $i; ?>); return false;"><img src="<?php print ICON_MINUS; ?>" alt="" /></a>
<a id="fldr_open_<?php print $i; ?>" href="#" onclick="Piler.open_folder(<?php print $i; ?>); return false;" style="display:none;"><img src="<?php print ICON_PLUS; ?>" alt="" /></a>
<?php } else { ?> <img src="<?php print ICON_EMPTY; ?>" width="12" height="12" alt="" /> <?php } ?>
<input type="checkbox" id="folder_<?php print $a['id']; ?>" name="folder_<?php print $a['id']; ?>" /> <?php print $a['name']; ?><br />

View File

@ -45,7 +45,7 @@
<tbody>
<?php $i=0; foreach ($messages as $message) { ?>
<tr id="e_<?php print $message['id']; ?>" class="resultrow new<?php if($i % 2) { ?> odd<?php } ?><?php if($message['spam'] == 1) { ?> spam<?php } ?>">
<tr onmouseover="Piler.current_message_id = <?php print $message['id']; ?>; return false;" id="e_<?php print $message['id']; ?>" class="resultrow new<?php if($i % 2) { ?> odd<?php } ?><?php if($message['spam'] == 1) { ?> spam<?php } ?>">
<td><input type="checkbox" id="r_<?php print $message['id']; ?>" name="r_<?php print $message['id']; ?>" value="iiii" <?php if(SEARCH_RESULT_CHECKBOX_CHECKED == 1) { ?>checked="checked"<?php } ?> /></td>
<td><a href="#" onclick="Piler.view_message_by_pos(<?php print $i; ?>);"><?php print ($page*$page_len) + $i + 1; ?>.</a></td>
<td><?php print $message['date']; ?></td>
@ -82,7 +82,7 @@
<div class="boxfooter">
<form class="form-inline slick" name="tagging">
<form class="form-inline sleek" name="tagging">
<?php if($n >= $page_len){ ?>
<span class="piler-right-margin">