mark calendar (sidebox) menu as open by default and fix ide warnings

This commit is contained in:
Ralf Becker 2014-01-30 11:03:16 +00:00
parent 6b4bc0547c
commit 55524261dc
2 changed files with 22 additions and 17 deletions

View File

@ -5,7 +5,7 @@
* @link http://www.egroupware.org * @link http://www.egroupware.org
* @package calendar * @package calendar
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de> * @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @copyright (c) 2004-13 by RalfBecker-At-outdoor-training.de * @copyright (c) 2004-14 by RalfBecker-At-outdoor-training.de
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$ * @version $Id$
*/ */
@ -18,11 +18,12 @@ class calendar_hooks
/** /**
* Hook called by link-class to include calendar in the appregistry of the linkage * Hook called by link-class to include calendar in the appregistry of the linkage
* *
* @param array/string $location location and other parameters (not used) * @param array|string $location location and other parameters (not used)
* @return array with method-names * @return array with method-names
*/ */
static function search_link($location) static function search_link($location)
{ {
unset($location); // not used, but in function signature for hooks
return array( return array(
'query' => 'calendar.calendar_bo.link_query', 'query' => 'calendar.calendar_bo.link_query',
'title' => 'calendar.calendar_bo.link_title', 'title' => 'calendar.calendar_bo.link_title',
@ -55,11 +56,12 @@ class calendar_hooks
/** /**
* Hook called to retrieve a app specific exportLimit * Hook called to retrieve a app specific exportLimit
* *
* @param array/string $location location and other parameters (not used) * @param array|string $location location and other parameters (not used)
* @return the export_limit to be applied for the app, may be empty, int or string * @return the export_limit to be applied for the app, may be empty, int or string
*/ */
static function getAppExportLimit($location) static function getAppExportLimit($location)
{ {
unset($location); // not used, but in function signature for hooks
return $GLOBALS['egw_info']['server']['calendar_export_limit']; return $GLOBALS['egw_info']['server']['calendar_export_limit'];
} }
@ -634,10 +636,11 @@ class calendar_hooks
} }
catch (Exception $e) catch (Exception $e)
{ {
unset($e); // not used
// permission error // permission error
continue; continue;
} }
if ($title = $definition->get_title()) if (($title = $definition->get_title()))
{ {
$options[$title] = $title; $options[$title] = $title;
} }
@ -732,6 +735,7 @@ class calendar_hooks
*/ */
public static function categories($data) public static function categories($data)
{ {
unset($data); // not used, but in function signature for hooks
return true; return true;
} }
} }

View File

@ -368,7 +368,7 @@ class calendar_ui
// set the actual view as return_to // set the actual view as return_to
if (isset($_GET['menuaction'])) if (isset($_GET['menuaction']))
{ {
list($app,$class,$func) = explode('.',$_GET['menuaction']); list(,$class,$func) = explode('.',$_GET['menuaction']);
if ($func == 'index') if ($func == 'index')
{ {
$func = $this->view; $this->view = 'index'; // switch to the default view $func = $this->view; $this->view = 'index'; // switch to the default view
@ -448,7 +448,6 @@ class calendar_ui
function event_icons($event) function event_icons($event)
{ {
$is_private = !$event['public'] && !$this->bo->check_perms(EGW_ACL_READ,$event); $is_private = !$event['public'] && !$this->bo->check_perms(EGW_ACL_READ,$event);
$viewable = !$this->bo->printer_friendly && $this->bo->check_perms(EGW_ACL_READ,$event);
$icons = array(); $icons = array();
if (!$is_private) if (!$is_private)
@ -462,7 +461,7 @@ class calendar_ui
$icons[] = html::image('calendar','recur',lang('recurring event')); $icons[] = html::image('calendar','recur',lang('recurring event'));
} }
// icons for single user, multiple users or group(s) and resources // icons for single user, multiple users or group(s) and resources
foreach($event['participants'] as $uid => $status) foreach(array_keys($event['participants']) as $uid)
{ {
if(is_numeric($uid) || !isset($this->bo->resources[$uid[0]]['icon'])) if(is_numeric($uid) || !isset($this->bo->resources[$uid[0]]['icon']))
{ {
@ -508,7 +507,7 @@ class calendar_ui
* Create a select-box item in the sidebox-menu * Create a select-box item in the sidebox-menu
* @privat used only by sidebox_menu ! * @privat used only by sidebox_menu !
*/ */
function _select_box($title,$name,$options,$baseurl='') function _select_box($title,$name,$options)
{ {
$select = ' <select style="width: 99%;" name="'.$name.'" id="calendar_'.$name.'" title="'. $select = ' <select style="width: 99%;" name="'.$name.'" id="calendar_'.$name.'" title="'.
lang('Select a %1',lang($title)).'">'. lang('Select a %1',lang($title)).'">'.
@ -569,6 +568,7 @@ class calendar_ui
$link_vars = array(); $link_vars = array();
// Magic etemplate2 favorites menu (from nextmatch widget) // Magic etemplate2 favorites menu (from nextmatch widget)
display_sidebox('calendar',lang('Favorites'),array( display_sidebox('calendar',lang('Favorites'),array(
'menuOpened' => true, // menu open by default
array( array(
'no_lang' => true, 'no_lang' => true,
'text'=> egw_framework::favorite_list('calendar',false), 'text'=> egw_framework::favorite_list('calendar',false),
@ -577,6 +577,7 @@ class calendar_ui
) )
)); ));
$file = array('menuOpened' => true); // menu open by default
$n = 0; // index for file-array $n = 0; // index for file-array
$planner_days_for_view = false; $planner_days_for_view = false;
@ -599,11 +600,11 @@ class calendar_ui
'list' => array('icon'=>'list','text'=>'Listview','menuaction'=>'calendar.calendar_uilist.listview','ajax'=>'true'), 'list' => array('icon'=>'list','text'=>'Listview','menuaction'=>'calendar.calendar_uilist.listview','ajax'=>'true'),
) as $view => $data) ) as $view => $data)
{ {
$icon = array_shift($data); $icon_name = array_shift($data);
$title = array_shift($data); $title = array_shift($data);
$vars = array_merge($link_vars,$data); $vars = array_merge($link_vars,$data);
$icon = html::image('calendar',$icon,lang($title),"class=sideboxstar"); //to avoid jscadender from not displaying with pngfix $icon = html::image('calendar',$icon_name,lang($title),"class=sideboxstar"); //to avoid jscadender from not displaying with pngfix
if ($view == 'add') if ($view == 'add')
{ {
$link = html::a_href($icon,'javascript:'.$this->popup(egw::link('/index.php',array( $link = html::a_href($icon,'javascript:'.$this->popup(egw::link('/index.php',array(
@ -752,12 +753,12 @@ class calendar_ui
// Category Selection // Category Selection
$cat_id = explode(',',$this->cat_id); $cat_id = explode(',',$this->cat_id);
$options = '<option value="0">'.lang('All categories').'</option>'.
$this->categories->formatted_list('select','all',$cat_id,'True');
$select = ' <select style="width: 87%;" id="calendar_cat_id" name="cat_id" title="'. $select = ' <select style="width: 87%;" id="calendar_cat_id" name="cat_id" title="'.
lang('Select a %1',lang('Category')). '"'.($cat_id && count($cat_id) > 1 ? ' multiple=true size=4':''). '>'. lang('Select a %1',lang('Category')). '"'.($cat_id && count($cat_id) > 1 ? ' multiple=true size=4':''). '>'.
$options."</select>\n" . html::image('phpgwapi','attach','','id="calendar_cat_id_multiple"'); '<option value="0">'.lang('All categories').'</option>'.
$this->categories->formatted_list('select','all',$cat_id,'True').
"</select>\n" . html::image('phpgwapi','attach','','id="calendar_cat_id_multiple"');
$file[++$n] = array( $file[++$n] = array(
'text' => $select, 'text' => $select,
@ -768,7 +769,7 @@ class calendar_ui
// Filter all or hideprivate // Filter all or hideprivate
$options = ''; $filter_options = '';
foreach(array( foreach(array(
'default' => array(lang('Not rejected'), lang('Show all status, but rejected')), 'default' => array(lang('Not rejected'), lang('Show all status, but rejected')),
'accepted' => array(lang('Accepted'), lang('Show only accepted events')), 'accepted' => array(lang('Accepted'), lang('Show only accepted events')),
@ -785,14 +786,14 @@ class calendar_ui
) as $value => $label) ) as $value => $label)
{ {
list($label,$title) = $label; list($label,$title) = $label;
$options .= '<option value="'.$value.'"'.($this->filter == $value ? ' selected="selected"' : '').' title="'.$title.'">'.$label.'</options>'."\n"; $filter_options .= '<option value="'.$value.'"'.($this->filter == $value ? ' selected="selected"' : '').' title="'.$title.'">'.$label.'</options>'."\n";
} }
// add deleted filter, if history logging is activated // add deleted filter, if history logging is activated
if($GLOBALS['egw_info']['server']['calendar_delete_history']) if($GLOBALS['egw_info']['server']['calendar_delete_history'])
{ {
$options .= '<option value="deleted"'.($this->filter == 'deleted' ? ' selected="selected"' : '').' title="'.lang('Show events that have been deleted').'">'.lang('Deleted').'</options>'."\n"; $filter_options .= '<option value="deleted"'.($this->filter == 'deleted' ? ' selected="selected"' : '').' title="'.lang('Show events that have been deleted').'">'.lang('Deleted').'</options>'."\n";
} }
$file[] = $this->_select_box('Filter','filter',$options,$baseurl ? $baseurl.'&filter=' : ''); $file[] = $this->_select_box('Filter','filter',$filter_options,$baseurl ? $baseurl.'&filter=' : '');
// Calendarselection: User or Group // Calendarselection: User or Group
if(count($this->bo->grants) > 0 && $this->accountsel->account_selection != 'none') if(count($this->bo->grants) > 0 && $this->accountsel->account_selection != 'none')