mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-23 21:51:14 +01:00
Add preferences so default export definition can be set
This commit is contained in:
parent
53bb18041e
commit
e5bb02d799
@ -39,12 +39,14 @@ class resources_hooks
|
|||||||
display_sidebox($appname,$title,$file);
|
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(
|
$file = array(
|
||||||
'Preferences' => egw::link('/preferences/preferences.php','appname='.$appname),
|
'Preferences' => egw::link('/preferences/preferences.php','appname='.$appname),
|
||||||
'Grant Access' => egw::link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname),
|
// Categories control access, not regular ACL system
|
||||||
'Edit Categories' => egw::link('/index.php','menuaction=preferences.uicategories.index&cats_app=' . $appname . '&cats_level=True&global_cats=True')
|
// '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')
|
if ($location == 'preferences')
|
||||||
{
|
{
|
||||||
@ -55,7 +57,7 @@ class resources_hooks
|
|||||||
display_sidebox($appname,lang('Preferences'),$file);
|
display_sidebox($appname,lang('Preferences'),$file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
if ($GLOBALS['egw_info']['user']['apps']['admin'] && $location != 'preferences')
|
if ($GLOBALS['egw_info']['user']['apps']['admin'] && $location != 'preferences')
|
||||||
{
|
{
|
||||||
$file = Array(
|
$file = Array(
|
||||||
@ -170,4 +172,54 @@ class resources_hooks
|
|||||||
$bo->save($resource);
|
$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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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']['search_link'] = 'resources.resources_hooks.search_link';
|
||||||
$setup_info['resources']['hooks']['calendar_resources'] = 'resources.resources_hooks.calendar_resources';
|
$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']['delete_category'] = 'resources.resources_hooks.delete_category';
|
||||||
|
$setup_info['resources']['hooks']['settings'] = 'resources_hooks::settings';
|
||||||
// $setup_info['resources']['hooks'][] = 'home';
|
// $setup_info['resources']['hooks'][] = 'home';
|
||||||
// $setup_info['resources']['hooks'][] = 'settings';
|
// $setup_info['resources']['hooks'][] = 'settings';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user