diff --git a/resources/inc/class.resources_hooks.inc.php b/resources/inc/class.resources_hooks.inc.php index 409d5ed5aa..2b8e1b437b 100644 --- a/resources/inc/class.resources_hooks.inc.php +++ b/resources/inc/class.resources_hooks.inc.php @@ -39,12 +39,14 @@ class resources_hooks display_sidebox($appname,$title,$file); } -/* if ($GLOBALS['egw_info']['user']['apps']['preferences'] && $location != 'admin') + if ($GLOBALS['egw_info']['user']['apps']['preferences'] && $location != 'admin' + && $GLOBALS['egw_info']['user']['apps']['importexport']) // Only one preference right now, need this to prevent errors { $file = array( 'Preferences' => egw::link('/preferences/preferences.php','appname='.$appname), - 'Grant Access' => egw::link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname), - 'Edit Categories' => egw::link('/index.php','menuaction=preferences.uicategories.index&cats_app=' . $appname . '&cats_level=True&global_cats=True') + // Categories control access, not regular ACL system + // 'Grant Access' => egw::link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname), + // 'Edit Categories' => egw::link('/index.php','menuaction=preferences.uicategories.index&cats_app=' . $appname . '&cats_level=True&global_cats=True') ); if ($location == 'preferences') { @@ -55,7 +57,7 @@ class resources_hooks display_sidebox($appname,lang('Preferences'),$file); } } -*/ + if ($GLOBALS['egw_info']['user']['apps']['admin'] && $location != 'preferences') { $file = Array( @@ -170,4 +172,54 @@ class resources_hooks $bo->save($resource); } } + + /** + * populates $settings for the preferences + * + * @param array|string $hook_data + * @return array + */ + static function settings($hook_data) + { + $settings = array(); + + if ($GLOBALS['egw_info']['user']['apps']['importexport']) + { + $definitions = new importexport_definitions_bo(array( + 'type' => 'export', + 'application' => 'resources' + )); + $options = array(); + $default_def = 'export-resources'; + foreach ((array)$definitions->get_definitions() as $identifier) + { + try + { + $definition = new importexport_definition($identifier); + } + catch (Exception $e) + { + // permission error + continue; + } + if ($title = $definition->get_title()) + { + $options[$title] = $title; + } + unset($definition); + } + $settings['nextmatch-export-definition'] = array( + 'type' => 'select', + 'values' => $options, + 'label' => 'Export definitition to use for nextmatch export', + 'name' => 'nextmatch-export-definition', + 'help' => lang('If you specify an export definition, it will be used when you export'), + 'run_lang' => false, + 'xmlrpc' => True, + 'admin' => False, + 'default'=> isset($options[$default_def]) ? $default_def : false, + ); + } + return $settings; + } } diff --git a/resources/setup/setup.inc.php b/resources/setup/setup.inc.php index cb4594ed0a..049042e37c 100755 --- a/resources/setup/setup.inc.php +++ b/resources/setup/setup.inc.php @@ -33,6 +33,7 @@ $setup_info['resources']['hooks']['sidebox_menu'] = 'resources.resources_hooks.a $setup_info['resources']['hooks']['search_link'] = 'resources.resources_hooks.search_link'; $setup_info['resources']['hooks']['calendar_resources'] = 'resources.resources_hooks.calendar_resources'; $setup_info['resources']['hooks']['delete_category'] = 'resources.resources_hooks.delete_category'; +$setup_info['resources']['hooks']['settings'] = 'resources_hooks::settings'; // $setup_info['resources']['hooks'][] = 'home'; // $setup_info['resources']['hooks'][] = 'settings';