added expand/collapse feature to webui folders

This commit is contained in:
SJ
2012-09-15 22:49:38 +02:00
parent b03ca2effb
commit fd27d17d24
8 changed files with 114 additions and 12 deletions

View File

@ -268,10 +268,10 @@ function assemble_search_term(n, prefix) {
e = document.getElementById(prefix + 'order');
if(e && e.value) { data = data + "&order=" + e.value; }
var a = document.getElementById('folders');
if(a) {
for(i=0; i<a.childNodes.length; i++) {
b = a.childNodes[i];
var childNodeArray = document.getElementById('folders').getElementsByTagName('*');
if(childNodeArray) {
for(i=0; i<childNodeArray.length; i++) {
b = childNodeArray[i];
if(b.name && b.name.substring(0, 7) == 'folder_' && b.checked) {
folders = folders + "+" + b.name.substring(7);
}
@ -697,7 +697,6 @@ $(document).ready(function() {
}
});
});
@ -776,3 +775,32 @@ function copy_message_to_folder(folder_id, id, copied) {
}
function open_folder(id) {
var a;
a = document.getElementById('fldr_' + id);
a.style.display = '';
a = document.getElementById('fldr_collapse_' + id);
a.style.display = '';
a = document.getElementById('fldr_open_' + id);
a.style.display = 'none';
}
function close_folder(id) {
var a;
a = document.getElementById('fldr_' + id);
a.style.display = 'none';
a = document.getElementById('fldr_collapse_' + id);
a.style.display = 'none';
a = document.getElementById('fldr_open_' + id);
a.style.display = '';
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 B

View File

@ -2,16 +2,47 @@
<div id="folders" style="text-align:left;">
<?php foreach ($folders as $folder) { ?>
<input type="checkbox" id="folder_<?php print $folder['id']; ?>" name="folder_<?php print $folder['id']; ?>" /> <?php print $folder['name']; ?><br />
<?php } ?>
<?php foreach ($extra_folders as $folder) { ?>
<input type="checkbox" id="extra_folder_<?php print $folder['id']; ?>" name="extra_folder_<?php print $folder['id']; ?>" /> <span style="color: blue; font-weight: bold;" onmouseover="javascript: copy_message_to_folder('<?php print $folder['id']; ?>', current_message_id, '<?php print $text_copied; ?>'); return false;"><?php print $folder['name']; ?></span><br />
<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']; ?>" /> <span style="color: blue; font-weight: bold;" onmouseover="javascript: copy_message_to_folder('<?php print $folder['id']; ?>', current_message_id); return false;"><?php print $folder['name']; ?>
</blockquote>
<?php } ?>
<?php
function display_folders($arr = array(), &$i) {
?>
<blockquote id="fldr_<?php print $i; ?>" style="border: 0px solid red; margin: 0 0 5px 10px;">
<?php
$i++;
foreach($arr as $a) {
?>
<?php if(count($a['children']) > 0) { ?>
<a id="fldr_collapse_<?php print $i; ?>" href="#" onclick="javascript:close_folder(<?php print $i; ?>); return false;"><img src="<?php print ICON_MINUS; ?>" alt="" /></a>
<a id="fldr_open_<?php print $i; ?>" href="#" onclick="javascript: 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 />
<?php
if(count($a['children'])) { display_folders($a['children'], $i); }
}
?>
</blockquote>
<?php
}
?>
<?php
$i = 0;
display_folders($folders_by_hier, $i);
?>
</div>