From 60bc11a66e45aaa440b5ba2630f3d8eba29bf4a6 Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 1 Dec 2021 10:32:32 -0700 Subject: [PATCH] * Projectmanager: Add calendar integration so projects can be shown as events in calendar --- api/src/Etemplate.php | 8 ++-- calendar/inc/class.calendar_ui.inc.php | 20 +++++++++- calendar/templates/default/sidebox.xet | 55 +++++++++++++++++++------- 3 files changed, 62 insertions(+), 21 deletions(-) diff --git a/api/src/Etemplate.php b/api/src/Etemplate.php index 6fa616e6e0..a99575f528 100644 --- a/api/src/Etemplate.php +++ b/api/src/Etemplate.php @@ -119,22 +119,22 @@ class Etemplate extends Etemplate\Widget\Template { if (!empty($extra['data']) && is_array($extra['data'])) { - $content = array_merge($content, $extra['data']); + $content = array_merge_recursive($content, $extra['data']); } if (!empty($extra['preserve']) && is_array($extra['preserve'])) { - $preserv = array_merge($preserv, $extra['preserve']); + $preserv = array_merge_recursive($preserv, $extra['preserve']); } if (!empty($extra['readonlys']) && is_array($extra['readonlys'])) { - $readonlys = array_merge($readonlys, $extra['readonlys']); + $readonlys = array_merge_recursive($readonlys, $extra['readonlys']); } if (!empty($extra['sel_options']) && is_array($extra['sel_options'])) { - $sel_options = array_merge($sel_options, $extra['sel_options']); + $sel_options = array_merge_recursive($sel_options, $extra['sel_options']); } } } diff --git a/calendar/inc/class.calendar_ui.inc.php b/calendar/inc/class.calendar_ui.inc.php index 0a03fafd66..33e2260ca9 100644 --- a/calendar/inc/class.calendar_ui.inc.php +++ b/calendar/inc/class.calendar_ui.inc.php @@ -578,9 +578,9 @@ class calendar_ui // ignore failed discovery unset($e); } - if ($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir']) + if($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir']) { - $sel_options['merge'] = calendar_merge::get_documents($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir'], '', null,'calendar'); + $sel_options['merge'] = calendar_merge::get_documents($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir'], '', null, 'calendar'); } else @@ -588,6 +588,22 @@ class calendar_ui $readonlys['merge'] = true; } + // Add integration UI into sidemenu + $integration_data = Api\Hooks::process(array('location' => 'calendar_search_union')); + foreach($integration_data as $app => $app_hooks) + { + foreach($app_hooks as $data) + { + // App might have multiple hooks, let it specify something else + $app = $data['selects']['app'] ?: $app; + + if(array_key_exists('sidebox_template', $data)) + { + $cont['integration'][] = ['template' => $data['sidebox_template'], 'app' => $app]; + } + } + } + // Sidebox? $sidebox->exec('calendar.calendar_ui.sidebox_etemplate', $cont, $sel_options, $readonlys); } diff --git a/calendar/templates/default/sidebox.xet b/calendar/templates/default/sidebox.xet index e9b49be025..52d0fa1153 100644 --- a/calendar/templates/default/sidebox.xet +++ b/calendar/templates/default/sidebox.xet @@ -14,27 +14,52 @@ Egroupware