Fix bug where tags (in the tags cloud) were not selected in search mode (#4792)

I.e. on message view page and when returning from it in mail UI
This commit is contained in:
Aleksander Machniak 2016-03-01 10:56:18 +01:00
parent 2c06015bd0
commit 05b1c5c8b9

View file

@ -73,6 +73,11 @@ class kolab_tags_engine
// load miniColors
jqueryui::miniColors();
// Modify search filter (and set selected tags)
if ($this->rc->action == 'show' || !$this->rc->action) {
$this->search_filter_mods();
}
}
/**
@ -443,6 +448,26 @@ class kolab_tags_engine
return $args;
}
/**
* Get selected tags when in search-mode
*/
protected function search_filter_mods()
{
if (!empty($_REQUEST['_search']) && !empty($_SESSION['search'])
&& $_SESSION['search_request'] == $_REQUEST['_search']
&& ($filter = $_SESSION['search_filter'])
) {
if (preg_match('/^(kolab_tags_[0-9]{10,}:([^:]+):)/', $filter, $m)) {
$search_tags = explode(',', $m[2]);
$search_filter = substr($filter, strlen($m[1]));
// send current search properties to the browser
$this->rc->output->set_env('search_filter_selected', $search_filter);
$this->rc->output->set_env('selected_tags', $search_tags);
}
}
}
/**
* "Convert" tag object to simple array for use in javascript
*/