webui detailed search fixes

This commit is contained in:
SJ 2012-09-19 15:50:22 +02:00
parent 4d4982a9c6
commit d037e730c8
6 changed files with 38 additions and 20 deletions

View File

@ -13,7 +13,7 @@
#define VERSION "0.1.21" #define VERSION "0.1.21"
#define BUILD 705 #define BUILD 706
#define HOSTID "mailarchiver" #define HOSTID "mailarchiver"

View File

@ -87,6 +87,14 @@ class ControllerSearchHelper extends Controller {
private function fixup_post_simple_request() { private function fixup_post_simple_request() {
if(!isset($this->request->post['from'])) { $this->request->post['from'] = ''; }
if(!isset($this->request->post['to'])) { $this->request->post['to'] = ''; }
if(!isset($this->request->post['subject'])) { $this->request->post['subject'] = ''; }
if(!isset($this->request->post['body'])) { $this->request->post['body'] = ''; }
if(!isset($this->request->post['tag'])) { $this->request->post['tag'] = ''; }
if(!isset($this->request->post['note'])) { $this->request->post['note'] = ''; }
if(!isset($this->request->post['any'])) { $this->request->post['any'] = ''; }
if(!isset($this->request->post['attachment_type'])) { $this->request->post['attachment_type'] = ''; }
if(!isset($this->request->post['date1'])) { $this->request->post['date1'] = ''; } if(!isset($this->request->post['date1'])) { $this->request->post['date1'] = ''; }
if(!isset($this->request->post['date2'])) { $this->request->post['date2'] = ''; } if(!isset($this->request->post['date2'])) { $this->request->post['date2'] = ''; }
} }

View File

@ -212,7 +212,8 @@ function add_message_reference_to_form(s) {
} }
function assemble_search_term(n, prefix) { function assemble_search_term(n) {
var prefix = '';
var data = ''; var data = '';
var attachment_type = ''; var attachment_type = '';
var e; var e;
@ -220,6 +221,9 @@ function assemble_search_term(n, prefix) {
var extra_folders = ''; var extra_folders = '';
var childNodeArray = new Array(); var childNodeArray = new Array();
e = document.getElementById('prefix');
if(e && e.value) { prefix = e.value; }
e = document.getElementById(prefix + 'searchtype'); e = document.getElementById(prefix + 'searchtype');
if(e && e.value) { data = data + "searchtype=" + e.value; } if(e && e.value) { data = data + "searchtype=" + e.value; }

View File

@ -64,7 +64,12 @@
}); });
shortcut.add("Enter", function() { shortcut.add("Enter", function() {
var a=document.getElementById('ref'); if(a) a.value=''; load_search_results('<?php print SEARCH_HELPER_URL; ?>', assemble_search_term(count, ''), 0); var a;
a = document.getElementById('ref');
if(a) a.value='';
a = document.getElementById('prefix');
if(a) a.value='';
load_search_results('<?php print SEARCH_HELPER_URL; ?>', assemble_search_term(count), 0);
},{ },{
'type':'keydown', 'type':'keydown',
'propagate':true, 'propagate':true,
@ -98,6 +103,7 @@
<input type="hidden" name="sort" id="sort" value="date" /> <input type="hidden" name="sort" id="sort" value="date" />
<input type="hidden" name="order" id="order" value="0" /> <input type="hidden" name="order" id="order" value="0" />
<input type="hidden" name="ref" id="ref" value="" /> <input type="hidden" name="ref" id="ref" value="" />
<input type="hidden" name="prefix" id="prefix" value="" />
<span style="font-weight: bold;"><?php print $text_search; ?>:</span> <span style="font-weight: bold;"><?php print $text_search; ?>:</span>
@ -107,9 +113,9 @@
<div class="aoq"></div> <div class="aoq"></div>
</div> </div>
<button id="button_search" class="active" style="margin-left: 10px; margin-right: 0px; height: 20px; width: 70px;" onclick="script:var a=document.getElementById('ref'); if(a) a.value=''; load_search_results('<?php print SEARCH_HELPER_URL; ?>', assemble_search_term(count, ''), 0);"><?php print $text_search; ?></button> <button id="button_search" class="active" style="margin-left: 10px; margin-right: 0px; height: 20px; width: 70px;" onclick="script:var a=document.getElementById('ref'); if(a) a.value=''; a = document.getElementById('prefix'); if(a) a.value=''; load_search_results('<?php print SEARCH_HELPER_URL; ?>', assemble_search_term(count), 0);"><?php print $text_search; ?></button>
<input type="button" class="advsecondary" style="height: 20px; width: 70px;" onclick="javascript:var a=document.getElementById('_search'); a.value=''; a = document.getElementById('ref'); a.value=''; return false;" value="<?php print $text_cancel; ?>" /> <input type="button" class="advsecondary" style="height: 20px; width: 70px;" onclick="javascript:var a=document.getElementById('_search'); a.value=''; a = document.getElementById('ref'); a.value=''; return false;" value="<?php print $text_cancel; ?>" />
<input type="button" class="advsecondary" style="height: 20px; width: 70px;" value="<?php print $text_save; ?>" onclick="javascript:send_ajax_post_request('<?php print SAVE_SEARCH_URL; ?>', assemble_search_term(0, '') + '&save=1'); show_message('messagebox1', '<p><?php print $text_saved; ?></p>', 0.85);" /> <input type="button" class="advsecondary" style="height: 20px; width: 70px;" value="<?php print $text_save; ?>" onclick="javascript:send_ajax_post_request('<?php print SAVE_SEARCH_URL; ?>', assemble_search_term(0) + '&save=1'); show_message('messagebox1', '<p><?php print $text_saved; ?></p>', 0.85);" />
<input type="button" class="advsecondary" style="height: 20px; width: 70px;" value="<?php print $text_load; ?>" onclick="javascript:load_saved_search_terms('<?php print LOAD_SAVED_SEARCH_URL; ?>');" /> <input type="button" class="advsecondary" style="height: 20px; width: 70px;" value="<?php print $text_load; ?>" onclick="javascript:load_saved_search_terms('<?php print LOAD_SAVED_SEARCH_URL; ?>');" />

View File

@ -9,23 +9,23 @@
<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="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"> <div class="cell3 date">
<?php print $text_date; ?> <?php print $text_date; ?>
<a href="#" onclick="script:fix_search_order('date', 1); <?php if(isset($_POST['ref'])) { ?>add_message_reference_to_form('<?php print $_POST['ref']; ?>');<?php } ?> 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> <a href="#" onclick="script:fix_search_order('date', 1); <?php if(isset($_POST['ref'])) { ?>add_message_reference_to_form('<?php print $_POST['ref']; ?>');<?php } ?> 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>
<a href="#" onclick="script:fix_search_order('date', 0); <?php if(isset($_POST['ref'])) { ?>add_message_reference_to_form('<?php print $_POST['ref']; ?>');<?php } ?> load_search_results('<?php print SEARCH_HELPER_URL; ?>', assemble_search_term(count, ''), 0); return false;"><img src="<?php print ICON_ARROW_DOWN; ?>" alt="" border="0"></a> <a href="#" onclick="script:fix_search_order('date', 0); <?php if(isset($_POST['ref'])) { ?>add_message_reference_to_form('<?php print $_POST['ref']; ?>');<?php } ?> load_search_results('<?php print SEARCH_HELPER_URL; ?>', assemble_search_term(count), 0); return false;"><img src="<?php print ICON_ARROW_DOWN; ?>" alt="" border="0"></a>
</div> </div>
<div class="cell3 title"> <div class="cell3 title">
<?php print $text_from; ?> <?php print $text_from; ?>
<a href="#" onclick="script:fix_search_order('from', 1); <?php if(isset($_POST['ref'])) { ?>add_message_reference_to_form('<?php print $_POST['ref']; ?>');<?php } ?> 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> <a href="#" onclick="script:fix_search_order('from', 1); <?php if(isset($_POST['ref'])) { ?>add_message_reference_to_form('<?php print $_POST['ref']; ?>');<?php } ?> 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>
<a href="#" onclick="script:fix_search_order('from', 0); <?php if(isset($_POST['ref'])) { ?>add_message_reference_to_form('<?php print $_POST['ref']; ?>');<?php } ?> load_search_results('<?php print SEARCH_HELPER_URL; ?>', assemble_search_term(count, ''), 0); return false;"><img src="<?php print ICON_ARROW_DOWN; ?>" alt="" border="0"></a> <a href="#" onclick="script:fix_search_order('from', 0); <?php if(isset($_POST['ref'])) { ?>add_message_reference_to_form('<?php print $_POST['ref']; ?>');<?php } ?> load_search_results('<?php print SEARCH_HELPER_URL; ?>', assemble_search_term(count), 0); return false;"><img src="<?php print ICON_ARROW_DOWN; ?>" alt="" border="0"></a>
</div> </div>
<div class="cell3 title"> <div class="cell3 title">
<?php print $text_subject; ?> <?php print $text_subject; ?>
<a href="#" onclick="script:fix_search_order('subj', 1); <?php if(isset($_POST['ref'])) { ?>add_message_reference_to_form('<?php print $_POST['ref']; ?>');<?php } ?> 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> <a href="#" onclick="script:fix_search_order('subj', 1); <?php if(isset($_POST['ref'])) { ?>add_message_reference_to_form('<?php print $_POST['ref']; ?>');<?php } ?> 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>
<a href="#" onclick="script:fix_search_order('subj', 0); <?php if(isset($_POST['ref'])) { ?>add_message_reference_to_form('<?php print $_POST['ref']; ?>');<?php } ?> load_search_results('<?php print SEARCH_HELPER_URL; ?>', assemble_search_term(count, ''), 0); return false;"><img src="<?php print ICON_ARROW_DOWN; ?>" alt="" border="0"></a> <a href="#" onclick="script:fix_search_order('subj', 0); <?php if(isset($_POST['ref'])) { ?>add_message_reference_to_form('<?php print $_POST['ref']; ?>');<?php } ?> load_search_results('<?php print SEARCH_HELPER_URL; ?>', assemble_search_term(count), 0); return false;"><img src="<?php print ICON_ARROW_DOWN; ?>" alt="" border="0"></a>
</div> </div>
<div class="cell3 title"> <div class="cell3 title">
<?php print $text_size; ?> <?php print $text_size; ?>
<a href="#" onclick="script:fix_search_order('size', 1); <?php if(isset($_POST['ref'])) { ?>add_message_reference_to_form('<?php print $_POST['ref']; ?>');<?php } ?> 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> <a href="#" onclick="script:fix_search_order('size', 1); <?php if(isset($_POST['ref'])) { ?>add_message_reference_to_form('<?php print $_POST['ref']; ?>');<?php } ?> 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>
<a href="#" onclick="script:fix_search_order('size', 0); <?php if(isset($_POST['ref'])) { ?>add_message_reference_to_form('<?php print $_POST['ref']; ?>');<?php } ?> load_search_results('<?php print SEARCH_HELPER_URL; ?>', assemble_search_term(count, ''), 0); return false;"><img src="<?php print ICON_ARROW_DOWN; ?>" alt="" border="0"></a> <a href="#" onclick="script:fix_search_order('size', 0); <?php if(isset($_POST['ref'])) { ?>add_message_reference_to_form('<?php print $_POST['ref']; ?>');<?php } ?> load_search_results('<?php print SEARCH_HELPER_URL; ?>', assemble_search_term(count), 0); return false;"><img src="<?php print ICON_ARROW_DOWN; ?>" alt="" border="0"></a>
</div> </div>
<div class="cell3">&nbsp;</div> <div class="cell3">&nbsp;</div>
<div class="cell3">&nbsp;</div> <div class="cell3">&nbsp;</div>
@ -47,7 +47,7 @@
<div class="cell5 id"><a href="#" onmouseover="javascript: current_message_id = <?php print $message['id']; ?>; return false;" onclick="script:highlight_message_by_position(<?php print $i; ?>); current_message_id = <?php print $message['id']; ?>; return false;"><?php print ($page*$page_len) + $i; ?>.</a></div> <div class="cell5 id"><a href="#" onmouseover="javascript: current_message_id = <?php print $message['id']; ?>; return false;" onclick="script:highlight_message_by_position(<?php print $i; ?>); current_message_id = <?php print $message['id']; ?>; return false;"><?php print ($page*$page_len) + $i; ?>.</a></div>
<div class="cell5 date"><?php print $message['date']; ?></div> <div class="cell5 date"><?php print $message['date']; ?></div>
<div class="cell5 from"><?php if($message['from'] != $message['shortfrom']) { ?><a href="#" title="<?php print preg_replace("/&/", "&amp;", $message['from']); ?>"><?php print $message['shortfrom']; ?></a><?php } else { print $message['from']; } ?></div> <div class="cell5 from"><?php if($message['from'] != $message['shortfrom']) { ?><a href="#" title="<?php print preg_replace("/&/", "&amp;", $message['from']); ?>"><?php print $message['shortfrom']; ?></a><?php } else { print $message['from']; } ?></div>
<div class="cell5 subject"><a href="#" <?php if($message['subject'] != $message['shortsubject']) { ?>title="<?php print preg_replace("/&/", "&amp;", $message['subject']); ?>"<?php } ?> onmouseover="javascript: current_message_id = <?php print $message['id']; ?>; return false;" onclick="script:highlight_message_by_position(<?php print $i; ?>); current_message_id = <?php print $message['id']; ?>; return false;"><?php if($message['subject'] != $message['shortsubject']) { print $message['shortsubject']; } else { print $message['subject']; } ?></a><?php if($message['reference']) { ?> <a href="#" title="<?php print $text_conversation_available; ?>" 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></a><?php } ?></div> <div class="cell5 subject"><a href="#" <?php if($message['subject'] != $message['shortsubject']) { ?>title="<?php print preg_replace("/&/", "&amp;", $message['subject']); ?>"<?php } ?> onmouseover="javascript: current_message_id = <?php print $message['id']; ?>; return false;" onclick="script:highlight_message_by_position(<?php print $i; ?>); current_message_id = <?php print $message['id']; ?>; return false;"><?php if($message['subject'] != $message['shortsubject']) { print $message['shortsubject']; } else { print $message['subject']; } ?></a><?php if($message['reference']) { ?> <a href="#" title="<?php print $text_conversation_available; ?>" 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></a><?php } ?></div>
<div class="cell5 size"><?php print $message['size']; ?></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['attachments'] > 0) { ?><img src="<?php print ICON_ATTACHMENT; ?>" alt="" width="16" height="18" /><?php } else { ?>&nbsp;<?php } ?></div>
@ -72,8 +72,8 @@
<div class="navrow"> <div class="navrow">
<?php if($n >= $page_len){ ?> <?php if($n >= $page_len){ ?>
<div id="pagingleft"> <div id="pagingleft">
<?php if($page > 0) { ?><a href="#" class="navlink" onclick="script:load_search_results('<?php print SEARCH_HELPER_URL; ?>', assemble_search_term(count, ''), 0); return false;">&lt;&lt;</a> &nbsp; <?php } else { ?><span class="navlink">&lt;&lt; &nbsp; </span><?php } ?> <?php if($page > 0) { ?><a href="#" class="navlink" onclick="script:load_search_results('<?php print SEARCH_HELPER_URL; ?>', assemble_search_term(count), 0); return false;">&lt;&lt;</a> &nbsp; <?php } else { ?><span class="navlink">&lt;&lt; &nbsp; </span><?php } ?>
<?php if($page > 0) { ?><a href="#" class="navlink" onclick="script:load_search_results('<?php print SEARCH_HELPER_URL; ?>', assemble_search_term(count, ''), <?php print $prev_page; ?>); return false;"> &lt; </a> <?php } else { ?><span class="navlink"> &lt; </span><?php } ?> <?php if($page > 0) { ?><a href="#" class="navlink" onclick="script:load_search_results('<?php print SEARCH_HELPER_URL; ?>', assemble_search_term(count), <?php print $prev_page; ?>); return false;"> &lt; </a> <?php } else { ?><span class="navlink"> &lt; </span><?php } ?>
</div> </div>
<div id="pagingcenter"> <div id="pagingcenter">
@ -81,8 +81,8 @@
</div> </div>
<div id="pagingright"> <div id="pagingright">
<?php if($next_page <= $total_pages){ ?><a href="#" class="navlink" onclick="script:load_search_results('<?php print SEARCH_HELPER_URL; ?>', assemble_search_term(count, ''), <?php print $next_page; ?>); return false;">&gt; </a> <?php } else { ?><span class="navlink">&gt; </span><?php } ?> <?php if($next_page <= $total_pages){ ?><a href="#" class="navlink" onclick="script:load_search_results('<?php print SEARCH_HELPER_URL; ?>', assemble_search_term(count), <?php print $next_page; ?>); return false;">&gt; </a> <?php } else { ?><span class="navlink">&gt; </span><?php } ?>
<?php if($page < $total_pages) { ?> &nbsp; <a href="#" class="navlink" onclick="script:load_search_results('<?php print SEARCH_HELPER_URL; ?>', assemble_search_term(count, ''), <?php print $total_pages; ?>); return false;"> &gt;&gt; </a><?php } else { ?> <span class="navlink"> &nbsp; &gt;&gt;</span><?php } ?> <?php if($page < $total_pages) { ?> &nbsp; <a href="#" class="navlink" onclick="script:load_search_results('<?php print SEARCH_HELPER_URL; ?>', assemble_search_term(count), <?php print $total_pages; ?>); return false;"> &gt;&gt; </a><?php } else { ?> <span class="navlink"> &nbsp; &gt;&gt;</span><?php } ?>
</div> </div>
<?php } else { ?>&nbsp;<?php } ?> <?php } else { ?>&nbsp;<?php } ?>
@ -92,7 +92,7 @@
<input type="button" class="restore" value="<?php print $text_bulk_restore_selected_emails; ?>" onclick="javascript: restore_selected_emails('<?php print BULK_RESTORE_URL; ?>'); show_message('messagebox1', '<p><?php print $text_restored; ?></p>', 0.8); " /> <input type="button" class="restore" value="<?php print $text_bulk_restore_selected_emails; ?>" onclick="javascript: restore_selected_emails('<?php print BULK_RESTORE_URL; ?>'); show_message('messagebox1', '<p><?php print $text_restored; ?></p>', 0.8); " />
<?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; ?>'); show_message('messagebox1', '<p><?php print $text_tagged; ?></p>', 0.8); 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" /> <?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; ?>'); show_message('messagebox1', '<p><?php print $text_tagged; ?></p>', 0.8); 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> </div>

View File

@ -58,7 +58,7 @@
<div class="row"> <div class="row">
<div class="cell1"></div> <div class="cell1"></div>
<div class="cell2" style="text-align: left;"> <div class="cell2" style="text-align: left;">
<button id="button_search" class="active" style="width: 100px; margin: 0px;" onclick="script:load_search_results('<?php print SEARCH_HELPER_URL; ?>', assemble_search_term(count, 'x'), 0); document.getElementById('searchpopup1').style.display = 'none'; document.getElementById('_search').value='';"><?php print $text_search; ?></button> <input type="button" class="advsecondary" onclick="javascript:reset_simple_form(); return false;" value="<?php print $text_cancel; ?>" /> <button id="button_search" class="active" style="width: 100px; margin: 0px;" onclick="script:a = document.getElementById('prefix'); if(a) a.value='x'; load_search_results('<?php print SEARCH_HELPER_URL; ?>', assemble_search_term(count), 0); document.getElementById('searchpopup1').style.display = 'none'; document.getElementById('_search').value='';"><?php print $text_search; ?></button> <input type="button" class="advsecondary" onclick="javascript:reset_simple_form(); return false;" value="<?php print $text_cancel; ?>" />
</div> </div>
</div> </div>