From 6cb27a76527c3fe7fbd82ddc51c55059b77e1043 Mon Sep 17 00:00:00 2001 From: nathangray Date: Mon, 12 Jun 2017 12:35:12 -0600 Subject: [PATCH] Calendar - fix some bugs setting calendar owner via URL when calendar app is not yet loaded --- calendar/inc/class.calendar_owner_etemplate_widget.inc.php | 5 ++++- calendar/inc/class.calendar_ui.inc.php | 1 + calendar/inc/class.calendar_uilist.inc.php | 4 ++++ calendar/inc/class.calendar_uiviews.inc.php | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/calendar/inc/class.calendar_owner_etemplate_widget.inc.php b/calendar/inc/class.calendar_owner_etemplate_widget.inc.php index e56c251d5f..1e40782d4f 100644 --- a/calendar/inc/class.calendar_owner_etemplate_widget.inc.php +++ b/calendar/inc/class.calendar_owner_etemplate_widget.inc.php @@ -41,7 +41,10 @@ class calendar_owner_etemplate_widget extends Etemplate\Widget\Taglist $form_name = self::form_name($cname, $this->id, $expand); $value =& self::get_array(self::$request->content, $form_name); - if(!is_array($value)) $value = array(); + if(!is_array($value)) + { + $value = explode(',', $value); + } if (!is_array(self::$request->sel_options[$form_name])) { self::$request->sel_options[$form_name] = array(); diff --git a/calendar/inc/class.calendar_ui.inc.php b/calendar/inc/class.calendar_ui.inc.php index a00ecc09df..bcf8890dd9 100644 --- a/calendar/inc/class.calendar_ui.inc.php +++ b/calendar/inc/class.calendar_ui.inc.php @@ -559,6 +559,7 @@ class calendar_ui if (!is_array($cont)) $cont = array(); $cont['view'] = $this->view ? $this->view : 'week'; $cont['date'] = $this->date ? $this->date : new Api\DateTime(); + $cont['owner'] = $this->owner ? $this->owner : $cont['owner']; $cont['year'] = (int)Api\DateTime::to($cont['date'],'Y'); $cont['holidays'] = $this->bo->read_holidays($cont['year']); diff --git a/calendar/inc/class.calendar_uilist.inc.php b/calendar/inc/class.calendar_uilist.inc.php index 02e30908ef..2d3b54ff4c 100644 --- a/calendar/inc/class.calendar_uilist.inc.php +++ b/calendar/inc/class.calendar_uilist.inc.php @@ -159,6 +159,10 @@ class calendar_uilist extends calendar_ui { $content['nm']['search'] = $_GET['search']; } + if($this->owner) + { + $content['nm']['col_filter']['participant'] = is_array($this->owner) ? $this->owner : explode(',',$this->owner); + } // search via jdots ajax_exec uses $_REQUEST['json_data'] instead of regular GET parameters if (isset($_REQUEST['json_data']) && ($json_data = json_decode($_REQUEST['json_data'], true)) && !empty($json_data['request']['parameters'][0])) diff --git a/calendar/inc/class.calendar_uiviews.inc.php b/calendar/inc/class.calendar_uiviews.inc.php index b2eec51d84..3d96206a9b 100644 --- a/calendar/inc/class.calendar_uiviews.inc.php +++ b/calendar/inc/class.calendar_uiviews.inc.php @@ -144,6 +144,7 @@ class calendar_uiviews extends calendar_ui 'start' => $this->date, 'cat_id' => $this->cat_id ? (is_array($this->cat_id)?$this->cat_id:explode(',',$this->cat_id)) : 0, 'users' => explode(',',$this->owner), + 'owner' => explode(',',$this->owner), 'filter' => $this->filter, 'daywise' => True, 'use_so_events' => $this->test === 'true',