'No filters' blank favorite also clears advanced search

This commit is contained in:
nathangray 2016-06-09 15:05:25 -06:00
parent 9c7c53606a
commit 5ecd1c3c8e
2 changed files with 40 additions and 3 deletions

View File

@ -987,6 +987,20 @@ window.egw_LAB.wait(function() {
Api\Json\Response::get()->data($contact);
}
/**
* Disable / clear advanced search
*
* Advanced search is stored server side in session no matter what the nextmatch
* sends, so we have to clear it here.
*/
public static function ajax_clear_advanced_search()
{
$query = Api\Cache::getSession('addressbook', 'index');
unset($query['advanced_search']);
Api\Cache::setSession('addressbook','index',$query);
Api\Cache::setSession('addressbook', 'advanced_search', false);
}
/**
* apply an action to multiple contacts
*
@ -1363,7 +1377,8 @@ window.egw_LAB.wait(function() {
{
unset($store_query[$key]);
}
$old_state = Api\Cache::setSession('addressbook', $what, $store_query);
$old_state = $store_query;
Api\Cache::setSession('addressbook', $what, $store_query);
}
else
{
@ -1384,7 +1399,7 @@ window.egw_LAB.wait(function() {
//unset($query['advanced_search']);
if(!$query['search'] && $old_state['advanced_search']) $query['advanced_search'] = $old_state['advanced_search'];
}
elseif(!$query['search'] && $old_state['advanced_search']) // eg. paging in an advanced search
elseif(!$query['search'] && array_key_exists('advanced_search',$old_state)) // eg. paging in an advanced search
{
$query['advanced_search'] = $old_state['advanced_search'];
}

View File

@ -850,7 +850,29 @@ app.classes.addressbook = AppJS.extend(
egw.open('',this.appname,'list',{'favorite': safe_name},this.appname);
return false;
}
return this._super.apply(this, arguments);
else if (jQuery.isEmptyObject(state))
{
// Regular handling first to clear everything but advanced search
this._super.apply(this, arguments);
// Clear advanced search, which is in session and etemplate
egw.json('addressbook.addressbook_ui.ajax_clear_advanced_search',[], function() {
framework.setWebsiteTitle('addressbook','');
var index = etemplate2.getById('addressbook-index');
if(index && index.widgetContainer)
{
var nm = index.widgetContainer.getWidgetById('nm');
if(nm)
{
nm.applyFilters({
advanced_search: false
});
}
}
},this).sendRequest(true);
return false;
}
return
},
/**