* Calendar - add preference to view month as a time grid, same as other views

Note: you need to update Calendar via Setup
This commit is contained in:
nathangray 2017-08-28 10:01:27 -06:00
parent 74433c96e4
commit f378f8b205
4 changed files with 21 additions and 6 deletions

View File

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

View File

@ -3999,10 +3999,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);

View File

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

View File

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