Resources: Fix missing merge documents

It was missing the directory preference
This commit is contained in:
nathan 2023-01-16 09:44:34 -07:00
parent 19c02fc91c
commit 4a3fcec432
4 changed files with 48 additions and 22 deletions

View File

@ -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;
}
}

View File

@ -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 : '');
}
}

View File

@ -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',

View File

@ -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';