implement search, with simple filter options as filter2; give title on popup display of message

This commit is contained in:
Klaus Leithoff 2013-07-17 12:01:01 +00:00
parent 0bba8fd032
commit c439cfbc72
2 changed files with 49 additions and 10 deletions

View File

@ -58,13 +58,45 @@ class mail_ui
*/
var $mail_bo;
/**
* definition of available / supported search types
*
* @var array
*/
var $searchTypes = array(
'quick' => 'quicksearch',
'subject' => 'subject',
'body' => 'message body',
'from' => 'from',
'to' => 'to',
'cc' => 'cc',
);
/**
* definition of available / supported status types
*
* @var array
*/
var $statusTypes = array(
'any' => 'any status',
'flagged' => 'flagged',
'unseen' => 'unread',
'answered' => 'replied',
'seen' => 'read',
'deleted' => 'deleted',
);
/**
* Constructor
*
*/
function __construct()
{
if (!isset($GLOBALS['egw_info']['flags']['js_link_registry']))
{
error_log(__METHOD__.__LINE__.' js_link_registry not set, force it:'.array2string($GLOBALS['egw_info']['flags']['js_link_registry']));
$GLOBALS['egw_info']['flags']['js_link_registry']=true;
}
// no autohide of the sidebox, as we use it for folderlist now.
unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']);
if (!empty($_GET["resetConnection"])) $connectionReset = html::purify($_GET["resetConnection"]);
@ -190,6 +222,7 @@ class mail_ui
if (!isset($content['nm']['selectedFolder'])) $content['nm']['selectedFolder'] = $this->mail_bo->profileID.self::$delimiter.'INBOX';
$content['nm']['foldertree'] = $content['nm']['selectedFolder'];
$sel_options['cat_id'] = array(1=>'none');
$sel_options['filter2'] = $this->searchTypes;
if (!isset($content['nm']['cat_id'])) $content['nm']['cat_id'] = 'All';
$etpl = new etemplate_new('mail.index');
@ -233,7 +266,9 @@ class mail_ui
'onExecute' => 'javaScript:app.mail.mail_DeleteFolder'
)
));
//error_log(__METHOD__.__LINE__.array2string($content));
if (empty($content['nm']['filter2']) || empty($content['nm']['search'])) $content['nm']['filter2']='quick';
$readonlys = $preserv = $sel_options;
return $etpl->exec('mail.mail_ui.index',$content,$sel_options,$readonlys,$preserv);
}
@ -974,6 +1009,7 @@ class mail_ui
function get_rows($query,&$rows,&$readonlys)
{
unset($query['actions']);
//_debug_array($query);
//error_log(__METHOD__.__LINE__.array2string($query));
//error_log(__METHOD__.__LINE__.' SelectedFolder:'.$query['selectedFolder'].' Start:'.$query['start'].' NumRows:'.$query['num_rows']);
$starttime = microtime(true);
@ -1009,7 +1045,7 @@ unset($query['actions']);
if (!empty($query['search']))
{
//([filterName] => Schnellsuche[type] => quick[string] => ebay[status] => any
$filter = array('filterName' => lang('quicksearch'),'type' => 'quick','string' => $query['search'],'status' => 'any');
$filter = array('filterName' => lang('quicksearch'),'type' => ($query['filter2']?$query['filter2']:'quick'),'string' => $query['search'],'status' => 'any');
}
else
{
@ -1557,7 +1593,7 @@ unset($query['actions']);
}
if (empty($subject)) $subject = lang('no subject');
$content['msg'] = $subject.(is_array($error_msg)?implode("<br>",$error_msg):$error_msg);
$content['msg'] = (is_array($error_msg)?implode("<br>",$error_msg):$error_msg);
$content['mail_displaydate'] = mail_bo::_strtotime($headers['DATE'],'ts',true);
$content['mail_displaysubject'] = $subject;
$content['mail_displaybody'] = $mailBody;

View File

@ -116,7 +116,7 @@ app.mail = AppJS.extend(
* @param _senders - the representation of the elements(s) the action is to be performed on
*/
mail_open: function(_action, _senders) {
console.log("mail_open",_action, _senders);
//console.log("mail_open",_action, _senders);
var _id = _senders[0].id;
// reinitialize the buffer-info on selected mails
this.mail_selectedMails = [];
@ -126,7 +126,10 @@ app.mail = AppJS.extend(
var dataElem = egw.dataGetUIDdata(_id);
var subject = dataElem.data.subject;
//alert('Open Message:'+_id+' '+subject);
egw().open( _id,'mail','view',null,'view'+_id );
var h = egw().open( _id,'mail','view','view'+_id );
egw(h).ready(function() {
h.document.title = subject;
});
},
/**
@ -216,7 +219,7 @@ app.mail = AppJS.extend(
* @param selected Array Selected row IDs. May be empty if user unselected all rows.
*/
mail_preview: function(nextmatch, selected) {
console.log("mail_preview",nextmatch, selected);
//console.log("mail_preview",nextmatch, selected);
// Empty values, just in case selected is empty (user cleared selection)
var dataElem = {data:{subject:"",fromaddress:"",toaddress:"",date:"",subject:""}};
if(typeof selected != 'undefined' && selected.length == 1)
@ -255,7 +258,7 @@ app.mail = AppJS.extend(
},
mail_setMailBody: function(content) {
console.log('mail_setMailBody',content);
//console.log('mail_setMailBody',content);
var IframeHandle = etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('messageIFRAME');
IframeHandle.set_value('');
},
@ -376,7 +379,7 @@ app.mail = AppJS.extend(
* multiple sets can be passed to mail_deleteLeaf
*/
mail_removeLeaf: function(_status) {
console.log('mail_removeLeaf',_status);
//console.log('mail_removeLeaf',_status);
var ftree = etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('nm[foldertree]');
var selectedNode = ftree.getSelectedNode();
for (var i in _status)
@ -402,7 +405,7 @@ app.mail = AppJS.extend(
* multiple sets can be passed to mail_deleteLeaf
*/
mail_reloadNode: function(_status) {
console.log('mail_reloadNode',_status);
//console.log('mail_reloadNode',_status);
var ftree = etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('nm[foldertree]');
var selectedNode = ftree.getSelectedNode();
for (var i in _status)