reflect change in filters (additional details/no details) in app.js refreshFilter2Options refreshCatIdOptions

This commit is contained in:
Klaus Leithoff 2016-02-25 12:26:50 +00:00
parent 91f3671be4
commit 20a27ad0fe
2 changed files with 31 additions and 3 deletions

View File

@ -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'));
}

View File

@ -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.