added To: data to search results

This commit is contained in:
SJ 2013-01-14 14:46:34 +01:00
parent 04a39461d3
commit e633d03fb6
4 changed files with 25 additions and 1 deletions

View File

@ -163,6 +163,7 @@ define('TABLE_FOLDER_EXTRA', 'folder_extra');
define('TABLE_FOLDER_MESSAGE', 'folder_message');
define('TABLE_EMAIL', 'email');
define('TABLE_META', 'metadata');
define('TABLE_RCPT', 'rcpt');
define('TABLE_ATTACHMENT', 'attachment');
define('TABLE_SEARCH', 'search');
define('TABLE_EMAIL_LIST', 'email_groups');

View File

@ -443,6 +443,7 @@ class ModelSearchSearch extends Model {
private function get_meta_data($ids = array(), $q = '', $sortorder = '') {
$messages = array();
$rcpt = $srcpt = array();
$tag = array();
$note = array();
@ -455,6 +456,21 @@ class ModelSearchSearch extends Model {
if(isset($m['meta'])) { return unserialize($m['meta']); }
}
$query = $this->db->query("SELECT `id`, `to` FROM `" . TABLE_RCPT . "` WHERE `id` IN ($q)", $ids);
if(isset($query->rows)) {
foreach($query->rows as $r) {
if(!isset($rcpt[$r['id']])) {
$srcpt[$r['id']] = $r['to'];
$rcpt[$r['id']] .= $r['to'];
}
else {
$rcpt[$r['id']] .= ",\n" . $r['to'];
}
}
}
$query = $this->db->query("SELECT `id`, `from`, `subject`, `piler_id`, `reference`, `size`, `spam`, `sent`, `arrived`, `attachments` FROM `" . TABLE_META . "` WHERE `id` IN ($q) $sortorder", $ids);
if(isset($query->rows)) {
@ -478,6 +494,9 @@ class ModelSearchSearch extends Model {
foreach($query->rows as $m) {
$m['shortfrom'] = make_short_string($m['from'], MAX_CGI_FROM_SUBJ_LEN);
$m['shortto'] = $srcpt[$m['id']];
$m['to'] = $rcpt[$m['id']];
if($m['subject'] == "") { $m['subject'] = "<" . $lang->data['text_no_subject'] . ">"; }
$m['subject'] = escape_gt_lt_quote_symbols($m['subject']);

View File

@ -59,7 +59,7 @@
#resultscontainer { float: left; width: 990px; padding: 0; padding-bottom: 5px; height: auto; margin-top: 0px; margin-bottom: 0px; border-top: 3px solid black; border-bottom: 3px solid black; overflow:auto; }
#resultscontainer.empty { border-bottom: 0px solid black; height: auto; overflow:auto; }
#results { float: left; width: 950px; margin-top: 0px; margin-bottom: 0px; border-collapse: collapse; display: table; clear: both; }
#results { float: left; width: 1120px; margin-top: 0px; margin-bottom: 0px; border-collapse: collapse; display: table; clear: both; }
#auditresultscontainer { float: left; width: 990px; padding: 0; margin-top: 0px; margin-bottom: 0px; border-top: 3px solid black; border-bottom: 3px solid black; height: 580px; overflow: auto; }

View File

@ -17,6 +17,9 @@
<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>
</div>
<div class="cell3 title">
<?php print $text_to; ?>
</div>
<div class="cell3 title">
<?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>
@ -47,6 +50,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 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 to"><?php if($message['to'] != $message['shortto']) { ?><a href="#" title="<?php print preg_replace("/&/", "&amp;", $message['to']); ?>"><?php print $message['shortto']; ?></a><?php } else { print $message['to']; } ?></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>