From 20a27ad0fe65e2867374dba4c59f5bf06e04bf1d Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Thu, 25 Feb 2016 12:26:50 +0000 Subject: [PATCH] reflect change in filters (additional details/no details) in app.js refreshFilter2Options refreshCatIdOptions --- mail/inc/class.mail_ui.inc.php | 7 +++++-- mail/js/app.js | 27 ++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index a2aa24398a..af41c8ca92 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -90,6 +90,7 @@ class mail_ui 'to' => 'to', // lang('to') 'cc' => 'cc', // lang('cc') 'text' => 'whole message', // lang('whole message') +// 'custom' => 'Selected range',// lang('Selected range') ); /** @@ -398,6 +399,7 @@ class mail_ui */ function index(array $content=null,$msg=null) { + //error_log(__METHOD__.__LINE__.array2string($content)); try { //error_log(__METHOD__.__LINE__.function_backtrace()); if (mail_bo::$debugTimes) $starttime = microtime (true); @@ -1294,7 +1296,7 @@ class mail_ui $rowsFetched['messages'] = null; $offset = $query['start']+1; // we always start with 1 $maxMessages = $query['num_rows']; - //error_log(__METHOD__.__LINE__.$query['order']); + //error_log(__METHOD__.__LINE__.array2string($query)); $sort = ($query['order']=='address'?($toSchema?'toaddress':'fromaddress'):$query['order']); if (!empty($query['search'])) { @@ -4147,8 +4149,9 @@ class mail_ui } $response = egw_json_response::get(); - $response->call('app.mail.mail_refreshFilter2Options',$this->searchTypes); + $response->call('app.mail.mail_refreshCatIdOptions',$this->searchTypes); $response->call('app.mail.mail_refreshFilterOptions',$this->statusTypes); + $response->call('app.mail.mail_refreshFilter2Options',array(''=>'No details',1=>'Details')); } diff --git a/mail/js/app.js b/mail/js/app.js index 376d203c0d..fab33d6229 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -405,6 +405,7 @@ app.classes.mail = AppJS.extend( // using JSON.stringfy() directly gave a crash in Safari 7.0.4 return this.egw.jsonEncode({ selectedFolder: query_context.filters.selectedFolder || '', + cat_id: query_context.filters.cat_id || '', filter: query_context.filters.filter || '', filter2: query_context.filters.filter2 || '', sort: query_context.filters.sort @@ -1228,7 +1229,7 @@ app.classes.mail = AppJS.extend( { if (k==current) currentexists=true; } - if (!currentexists) filter2.set_value('subject'); + if (!currentexists) filter2.set_value(''); filter2.set_select_options(_data); }, @@ -1256,6 +1257,30 @@ app.classes.mail = AppJS.extend( }, + /** + * mail_refreshFilterOptions, function to call with appropriate data to refresh the filter options for the active server + * + * @param {object} _data + * + */ + mail_refreshCatIdOptions: function(_data) + { + //alert('mail_refreshFilterOptions'); + if (_data == null) return; + if (!this.et2 && !this.checkET2()) return; + + var filter = this.et2.getWidgetById('cat_id'); + var current = filter.value; + var currentexists=false; + for (var k in _data) + { + if (k==current) currentexists=true; + } + if (!currentexists) filter.set_value('quick'); + filter.set_select_options(_data); + + }, + /** * Queues a refreshFolderList request for 10ms. Actually this will just execute the * code after the calling script has finished.