diff --git a/resources/inc/class.resources_hooks.inc.php b/resources/inc/class.resources_hooks.inc.php index 8f2093924a..628fdd28db 100644 --- a/resources/inc/class.resources_hooks.inc.php +++ b/resources/inc/class.resources_hooks.inc.php @@ -182,14 +182,38 @@ class resources_hooks */ public static function categories($data) { - if ($GLOBALS['egw_info']['user']['apps']['admin']) + if($GLOBALS['egw_info']['user']['apps']['admin']) { return array( - 'menuaction' => 'admin.admin_categories.index', - 'appname' => $appname, - 'global_cats'=> true + 'menuaction' => 'admin.admin_categories.index', + 'appname' => $appname, + 'global_cats' => true ); } return false; } + + /** + * populates $settings for the Api\Preferences + * + * @return array + */ + static function settings() + { + $settings[] = array( + 'type' => 'section', + 'title' => lang('Data exchange settings'), + 'no_lang' => true, + 'xmlrpc' => False, + 'admin' => False + ); + + // Merge print + if($GLOBALS['egw_info']['user']['apps']['filemanager']) + { + $merge = new resources_merge(); + $settings += $merge->merge_preferences(); + } + return $settings; + } } diff --git a/resources/inc/class.resources_merge.inc.php b/resources/inc/class.resources_merge.inc.php index 3f9266e3bb..f4185a5ac1 100644 --- a/resources/inc/class.resources_merge.inc.php +++ b/resources/inc/class.resources_merge.inc.php @@ -96,17 +96,17 @@ class resources_merge extends Api\Storage\Merge $array = $record->get_record_array(); // Set any missing custom fields, or the marker will stay - foreach($this->bo->customfields as $name => $field) + foreach(\EGroupware\Api\Storage\Customfields::get('resources') as $name => $field) { - if (empty($array['#'.$name])) + if(empty($array['#' . $name])) { - $array['#'.$name] = ''; + $array['#' . $name] = ''; } // Format date cfs per user Api\Preferences - if($array['#'.$name] && ($field['type'] == 'date' || $field['type'] == 'date-time')) + if($array['#' . $name] && ($field['type'] == 'date' || $field['type'] == 'date-time')) { - $this->date_fields[] = '#'.$name; - $array['#'.$name] = Api\DateTime::to($array['#'.$name], $field['type'] == 'date' ? true : ''); + $this->date_fields[] = '#' . $name; + $array['#' . $name] = Api\DateTime::to($array['#' . $name], $field['type'] == 'date' ? true : ''); } } diff --git a/resources/inc/class.resources_ui.inc.php b/resources/inc/class.resources_ui.inc.php index 6084f05cd3..1bbef26ef7 100755 --- a/resources/inc/class.resources_ui.inc.php +++ b/resources/inc/class.resources_ui.inc.php @@ -187,16 +187,17 @@ class resources_ui */ public function get_actions() { + $prefs = $GLOBALS['egw_info']['user']['preferences']['resources']; $actions = array( - 'edit' => array( - 'default' => true, - 'caption' => 'open', - 'allowOnMultiple' => false, - 'url' => 'menuaction=resources.resources_ui.edit&res_id=$id', - 'popup' => Link::get_registry('resources', 'add_popup'), - 'group' => $group=1, - 'disableClass' => 'rowNoEdit', - 'onExecute' => Api\Header\UserAgent::mobile()?'javaScript:app.resources.viewEntry':'', + 'edit' => array( + 'default' => true, + 'caption' => 'open', + 'allowOnMultiple' => false, + 'url' => 'menuaction=resources.resources_ui.edit&res_id=$id', + 'popup' => Link::get_registry('resources', 'add_popup'), + 'group' => $group = 1, + 'disableClass' => 'rowNoEdit', + 'onExecute' => Api\Header\UserAgent::mobile() ? 'javaScript:app.resources.viewEntry' : '', 'mobileViewTemplate' => 'view?'.filemtime(Api\Etemplate\Widget\Template::rel2path('/resources/templates/mobile/view.xet')) ), 'add' => array( @@ -247,8 +248,8 @@ class resources_ui 'onExecute' => 'javaScript:app.resources.book', ), 'documents'=> resources_merge::document_action( - $this->prefs['document_dir'], ++$group, 'Insert in document', 'document_', - $this->prefs['default_document'] + $prefs['document_dir'], ++$group, 'Insert in document', 'document_', + $prefs['default_document'] ), 'delete' => array( 'caption' => 'Delete', diff --git a/resources/setup/setup.inc.php b/resources/setup/setup.inc.php index ce736621f3..a270400ba2 100644 --- a/resources/setup/setup.inc.php +++ b/resources/setup/setup.inc.php @@ -27,7 +27,8 @@ $setup_info['resources']['maintainer'] = array( 'email' => 'info@egroupware.org' ); -$setup_info['resources']['hooks']['categories'] = 'resources_hooks::categories'; +$setup_info['resources']['hooks']['settings'] = 'resources_hooks::settings'; +$setup_info['resources']['hooks']['categories'] = 'resources_hooks::categories'; $setup_info['resources']['hooks']['admin'] = 'resources.resources_hooks.admin_prefs_sidebox'; $setup_info['resources']['hooks']['sidebox_menu'] = 'resources.resources_hooks.admin_prefs_sidebox'; $setup_info['resources']['hooks']['search_link'] = 'resources.resources_hooks.search_link';