mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-18 11:58:24 +01:00
Allow filtering for multiple categories
This commit is contained in:
parent
541eae19ca
commit
dd40662229
@ -696,10 +696,43 @@ class calendar_ui
|
|||||||
{
|
{
|
||||||
$baseurl = egw::link('/index.php',array('menuaction'=>'calendar.calendar_uiviews.index'),false);
|
$baseurl = egw::link('/index.php',array('menuaction'=>'calendar.calendar_uiviews.index'),false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Category Selection
|
// Category Selection
|
||||||
$file[++$n] = $this->_select_box('Category','cat_id',
|
$onchange = "var value = '';
|
||||||
'<option value="0">'.lang('All categories').'</option>'.
|
if(selectBox = document.getElementById('cat_id')) {
|
||||||
$this->categories->formatted_list('select','all',$this->cat_id,'True'),$baseurl ? $baseurl.'&cat_id=' : '');
|
for(i=0; i < selectBox.length; ++i) {
|
||||||
|
if (selectBox.options[i].selected) {
|
||||||
|
value += (value ? ',' : '') + selectBox.options[i].value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}";
|
||||||
|
if ($baseurl) // we append the value to the baseurl
|
||||||
|
{
|
||||||
|
$cat_baseurl = $baseurl ? $baseurl.'&cat_id=' : '';
|
||||||
|
if (substr($cat_baseurl,-1) != '=') $cat_baseurl .= strpos($cat_baseurl,'?') === False ? '?' : '&';
|
||||||
|
$onchange.="egw_appWindow('calendar').location='$cat_baseurl'+value;";
|
||||||
|
}
|
||||||
|
else // we add $name=value to the actual location
|
||||||
|
{
|
||||||
|
$onchange.="var win=egw_appWindow('calendar'); win.location=win.location+(win.location.search.length ? '&' : '?')+'cat_id='+value;";
|
||||||
|
}
|
||||||
|
|
||||||
|
$cat_id = explode(',',$this->cat_id);
|
||||||
|
$options = '<option value="0">'.lang('All categories').'</option>'.
|
||||||
|
$this->categories->formatted_list('select','all',$cat_id,'True');
|
||||||
|
$icon_onclick = "if(selectBox = document.getElementById('cat_id')) {
|
||||||
|
if (!selectBox.multiple) {selectBox.size=4; selectBox.multiple=true;}}";
|
||||||
|
|
||||||
|
$select = ' <select style="width: 87%;" id="cat_id" name="cat_id" onchange="'.$onchange.'" title="'.
|
||||||
|
lang('Select a %1',lang('Category')). '"'.($cat_id && count($cat_id) > 1 ? ' multiple=true size=4':''). '>'.
|
||||||
|
$options."</select>\n" . html::image('phpgwapi','attach','','onclick="'.$icon_onclick.'"');
|
||||||
|
|
||||||
|
$file[++$n] = array(
|
||||||
|
'text' => $select,
|
||||||
|
'no_lang' => True,
|
||||||
|
'link' => False
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Filter all or hideprivate
|
// Filter all or hideprivate
|
||||||
$options = '';
|
$options = '';
|
||||||
|
@ -162,7 +162,7 @@ class calendar_uiviews extends calendar_ui
|
|||||||
$this->owner = str_replace('%2C',',',$this->owner);
|
$this->owner = str_replace('%2C',',',$this->owner);
|
||||||
$this->search_params = array(
|
$this->search_params = array(
|
||||||
'start' => $this->date,
|
'start' => $this->date,
|
||||||
'cat_id' => $this->cat_id,
|
'cat_id' => explode(',',$this->cat_id),
|
||||||
'users' => explode(',',$this->owner),
|
'users' => explode(',',$this->owner),
|
||||||
'filter' => $this->filter,
|
'filter' => $this->filter,
|
||||||
'daywise' => True,
|
'daywise' => True,
|
||||||
|
Loading…
Reference in New Issue
Block a user