From d9cb5ab88c15fa73a2a32d843074b837d346c6e6 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 1 Sep 2004 12:58:09 +0000 Subject: [PATCH] fix for bug [ 1014883 ] Sidebox with Add New Entry even if now permissions to add --- calendar/inc/class.bocalendar.inc.php | 5 ++ calendar/inc/hook_sidebox_menu.inc.php | 73 ++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 calendar/inc/hook_sidebox_menu.inc.php diff --git a/calendar/inc/class.bocalendar.inc.php b/calendar/inc/class.bocalendar.inc.php index fd725dace2..39951ac6c4 100755 --- a/calendar/inc/class.bocalendar.inc.php +++ b/calendar/inc/class.bocalendar.inc.php @@ -325,6 +325,11 @@ } } $this->xmlrpc = is_object($GLOBALS['server']) && $GLOBALS['server']->last_method; + + if (!is_object($GLOBALS['phpgw']->bocalendar)) + { + $GLOBALS['phpgw']->bocalendar =& $this; // make the bocalendar object availible for the sidebox menu hook + } } function list_methods($_type='xmlrpc') diff --git a/calendar/inc/hook_sidebox_menu.inc.php b/calendar/inc/hook_sidebox_menu.inc.php new file mode 100644 index 0000000000..18000b952d --- /dev/null +++ b/calendar/inc/hook_sidebox_menu.inc.php @@ -0,0 +1,73 @@ + * + * -------------------------------------------- * + * This program is free software; you can redistribute it and/or modify it * + * under the terms of the GNU General Public License as published by the * + * Free Software Foundation; either version 2 of the License, or (at your * + * option) any later version. * + \**************************************************************************/ + + /* $Id$ */ +{ + + /* + This hookfile is for generating an app-specific side menu used in the idots + template set. + + $menu_title speaks for itself + $file is the array with link to app functions + + display_sidebox can be called as much as you like + */ + + $menu_title = $GLOBALS['phpgw_info']['apps'][$appname]['title'] . ' '. lang('Menu'); + $file = Array( + 'New Entry' => $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uicalendar.add'), + '_NewLine_', // give a newline + 'Today'=>$GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uicalendar.day'), + 'This week'=>$GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uicalendar.week'), + 'This month'=>$GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uicalendar.month'), + 'This year'=>$GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uicalendar.year'), + 'Group Planner'=>$GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uicalendar.planner'), + 'Daily Matrix View'=>$GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uicalendar.matrixselect'), + 'Export'=>$GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uicalendar.export'), + 'Import'=>$GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uiicalendar.import') + ); + + if (is_object($GLOBALS['phpgw']->bocalendar) && $GLOBALS['phpgw']->bocalendar->owner != $GLOBALS['phpgw_info']['user']['acount_id'] && + !$GLOBALS['phpgw']->bocalendar->check_perms(PHPGW_ACL_ADD)) + { + echo "

owner=".$GLOBALS['phpgw']->bocalendar->owner."=".$GLOBALS['phpgw']->accounts->id2name($GLOBALS['phpgw']->bocalendar->owner)."

\n"; + unset($file['New Entry']); // dont display add icon + unset($file[0]); + } + display_sidebox($appname,$menu_title,$file); + + if ($GLOBALS['phpgw_info']['user']['apps']['preferences']) + { + $menu_title = lang('Preferences'); + $file = Array( + 'Calendar preferences'=>$GLOBALS['phpgw']->link('/preferences/preferences.php','appname=calendar'), + 'Grant Access'=>$GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app=calendar'), + 'Edit Categories' =>$GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uicategories.index&cats_app=calendar&cats_level=True&global_cats=True'), + ); + display_sidebox($appname,$menu_title,$file); + } + + if ($GLOBALS['phpgw_info']['user']['apps']['admin']) + { + $menu_title = lang('Administration'); + $file = Array( + 'Configuration'=>$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index&appname=calendar'), + 'Custom Fields'=>$GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uicustom_fields.index'), + 'Holiday Management'=>$GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uiholiday.admin'), + 'Import CSV-File' => $GLOBALS['phpgw']->link('/calendar/csv_import.php'), + 'Global Categories' =>$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.index&appname=calendar'), + ); + display_sidebox($appname,$menu_title,$file); + } +} +?>