From 4fcebd2f937f13308d36ce6c21894a4ccfd9317b Mon Sep 17 00:00:00 2001 From: nathangray Date: Mon, 28 Aug 2017 10:01:27 -0600 Subject: [PATCH] * Calendar - add preference to view month as a time grid, same as other views --- calendar/inc/class.calendar_hooks.inc.php | 3 ++- calendar/js/app.js | 4 ---- calendar/setup/setup.inc.php | 2 +- calendar/setup/tables_update.inc.php | 18 ++++++++++++++++++ 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/calendar/inc/class.calendar_hooks.inc.php b/calendar/inc/class.calendar_hooks.inc.php index 5cd92d9f23..ce54816136 100644 --- a/calendar/inc/class.calendar_hooks.inc.php +++ b/calendar/inc/class.calendar_hooks.inc.php @@ -118,6 +118,7 @@ class calendar_hooks ); $list_views = array( 0 => lang('None'), + 'month' => lang('Month view'), 'weekN' => lang('Multiple week view'), 'week' => lang('Weekview'), 'day4' => lang('Four days view'), @@ -353,7 +354,7 @@ class calendar_hooks 'help' => 'For which views should calendar just a list of events instead of distinct lines with a fixed time interval.', 'xmlrpc' => True, 'admin' => False, - 'default' => ['weekN'], + 'default' => ['weekN', 'month'], ), 'link_title' => array( 'type' => 'multiselect', diff --git a/calendar/js/app.js b/calendar/js/app.js index f5fb85280b..9934ac12ba 100644 --- a/calendar/js/app.js +++ b/calendar/js/app.js @@ -3987,10 +3987,6 @@ jQuery.extend(app.classes.calendar,{ d.setUTCSeconds(d.getUTCSeconds()-1); return app.calendar.date.end_of_week(d); }, - granularity: function(state) { - // Always a list, not a grid - return 0; - }, scroll: function(delta) { var d = new Date(app.calendar.state.date); diff --git a/calendar/setup/setup.inc.php b/calendar/setup/setup.inc.php index 8323255f75..0116cb6a1f 100755 --- a/calendar/setup/setup.inc.php +++ b/calendar/setup/setup.inc.php @@ -10,7 +10,7 @@ */ $setup_info['calendar']['name'] = 'calendar'; -$setup_info['calendar']['version'] = '16.1.002'; +$setup_info['calendar']['version'] = '16.1.003'; $setup_info['calendar']['app_order'] = 3; $setup_info['calendar']['enable'] = 1; $setup_info['calendar']['index'] = 'calendar.calendar_uiviews.index&ajax=true'; diff --git a/calendar/setup/tables_update.inc.php b/calendar/setup/tables_update.inc.php index 991a65ca55..3546a9d448 100644 --- a/calendar/setup/tables_update.inc.php +++ b/calendar/setup/tables_update.inc.php @@ -2732,3 +2732,21 @@ function calendar_upgrade16_1_001() return $GLOBALS['setup_info']['calendar']['currentver'] = '16.1.002'; } + +function calendar_upgrade16_1_002() +{ + // Explicitly add months as showing list of events, no times + $change = function($attr, $old_value, $owner) { + if($owner == Api\Preferences::FORCED_ID) return; + if(is_array($old_value) && !in_array('month', $old_value)) + { + $old_value[] = 'month'; + } + else if (strpos($old_value, 'month') === FALSE) + { + return $old_value ? $old_value.',month' : 'month'; + } + }; + Api\Preferences::change_preference('calendar', 'use_time_grid', $change); + return $GLOBALS['setup_info']['calendar']['currentver'] = '16.1.003'; +} \ No newline at end of file