From 59fc3c816887a2aa591e4c4237e2f4fff131bbb0 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Mon, 7 Jan 2019 12:26:04 +0000 Subject: [PATCH] Fix including moment.js --- plugins/calendar/calendar.php | 14 ++++---------- plugins/calendar/lib/calendar_ui.php | 18 ++++++++++++++---- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php index e4bf8903..e00805e9 100644 --- a/plugins/calendar/calendar.php +++ b/plugins/calendar/calendar.php @@ -2447,21 +2447,15 @@ class calendar extends rcube_plugin $title .= ' "' . $search . '"'; } - // Add CSS stylesheets to the page header - $skin_path = $this->local_skin_path(); - $this->include_stylesheet($skin_path . '/fullcalendar.css'); - $this->include_stylesheet($skin_path . '/print.css'); - - // Add JS files to the page header - $this->include_script('print.js'); - $this->include_script('lib/js/moment.js'); - $this->include_script('lib/js/fullcalendar.js'); + // Add CSS and JS to the page + $this->ui->addCSS(); + $this->ui->addJS(); $this->register_handler('plugin.calendar_css', array($this->ui, 'calendar_css')); $this->register_handler('plugin.calendar_list', array($this->ui, 'calendar_list')); $this->rc->output->set_pagetitle($title); - $this->rc->output->send("calendar.print"); + $this->rc->output->send('calendar.print'); } /** diff --git a/plugins/calendar/lib/calendar_ui.php b/plugins/calendar/lib/calendar_ui.php index 3e3d77ad..13c71b52 100644 --- a/plugins/calendar/lib/calendar_ui.php +++ b/plugins/calendar/lib/calendar_ui.php @@ -110,6 +110,10 @@ class calendar_ui { $skin_path = $this->cal->local_skin_path(); $this->cal->include_stylesheet($skin_path . '/fullcalendar.css'); + + if ($this->rc->task == 'calendar' && $this->rc->action == 'print') { + $this->cal->include_stylesheet($skin_path . '/print.css'); + } } /** @@ -117,12 +121,18 @@ class calendar_ui */ public function addJS() { - $this->cal->include_script('calendar_ui.js'); + $this->cal->include_script('lib/js/moment.js'); $this->cal->include_script('lib/js/fullcalendar.js'); - $this->rc->output->include_script('treelist.js'); - $this->cal->api->include_script('libkolab/libkolab.js'); - jqueryui::miniColors(); + if ($this->rc->task == 'calendar' && $this->rc->action == 'print') { + $this->cal->include_script('print.js'); + } + else { + $this->rc->output->include_script('treelist.js'); + $this->cal->api->include_script('libkolab/libkolab.js'); + $this->cal->include_script('calendar_ui.js'); + jqueryui::miniColors(); + } } /**