* Calendar - add preference to display birthdays as events as well as holidays

This commit is contained in:
nathangray 2018-03-05 15:07:37 -07:00
parent d2859d5cee
commit 04c4cd9d7a
4 changed files with 24 additions and 10 deletions

View File

@ -161,6 +161,11 @@ class calendar_hooks
'Sunday' => lang('Sunday'),
'Saturday' => lang('Saturday')
);
$birthdays_as_events = array(
0 => lang('None'),
'birthday' => lang('Birthdays'),
'holiday' => lang('Holidays')
);
if (!isset($hook_data['setup']))
{
@ -315,7 +320,8 @@ class calendar_hooks
'admin' => False
),
'birthdays_as_events' => array(
'type' => 'checkbox',
'type' => 'multiselect',
'values' => $birthdays_as_events,
'label' => 'Show birthdays as events',
'name' => 'birthdays_as_events',
'help' => 'Show birthdays as all day non-blocking events as well as via mouseover of the date.',

View File

@ -416,6 +416,14 @@ var et2_calendar_daycol = (function(){ "use strict"; return et2_valueWidget.exte
// Holidays and birthdays
var holidays = et2_calendar_view.get_holidays(this,this.options.date.substring(0,4));
var holiday_list = [];
var holiday_pref = (egw.preference('birthdays_as_events','calendar')||'').split(',');
debugger;
// Show holidays as events on mobile or by preference
var holidays_as_events = egwIsMobile() || egw.preference('birthdays_as_events','calendar') === true ||
holiday_pref.indexOf('holiday') >= 0;
var birthdays_as_events = egwIsMobile() || holiday_pref.indexOf('birthday') >= 0;
if(holidays && holidays[this.options.date])
{
holidays = holidays[this.options.date];
@ -423,8 +431,8 @@ var et2_calendar_daycol = (function(){ "use strict"; return et2_valueWidget.exte
{
if (typeof holidays[i]['birthyear'] !== 'undefined')
{
// Show holidays as events on mobile or by preference
if(egwIsMobile() || egw.preference('birthdays_as_events','calendar'))
// Show birthdays as events on mobile or by preference
if(birthdays_as_events)
{
// Create event
this._parent.date_helper.set_value(this.options.date.substring(0,4)+'-'+
@ -460,7 +468,7 @@ var et2_calendar_daycol = (function(){ "use strict"; return et2_valueWidget.exte
else
{
// Show holidays as events on mobile
if(egwIsMobile())
if(holidays_as_events)
{
// Create event
this._parent.date_helper.set_value(this.options.date.substring(0,4)+'-'+
@ -564,7 +572,7 @@ var et2_calendar_daycol = (function(){ "use strict"; return et2_valueWidget.exte
{
this.day_class_holiday();
}
// Apply styles to hidden events
this._out_of_view();
},
@ -926,7 +934,7 @@ var et2_calendar_daycol = (function(){ "use strict"; return et2_valueWidget.exte
{
// If hidden, skip it - it takes too long
if(!this.div.is(':visible')) return;
// Sort events into minimally-overlapping columns
var columns = this._spread_events();
@ -1106,7 +1114,7 @@ var et2_calendar_daycol = (function(){ "use strict"; return et2_valueWidget.exte
app.calendar.update_state({view: 'day',date: this.date.toJSON()});
return false;
}
},
/**

View File

@ -251,7 +251,7 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten
this._actionObject.id = 'calendar::' + id;
}
this._need_actions_linked = true;
this._need_actions_linked = !this.options.readonly;
// Make sure category stuff is there
// Fake it to use the cache / call - if already there, these will return

View File

@ -493,8 +493,8 @@ show all status incl. rejected events calendar en Show all status incl. rejected
show all status, but rejected calendar en Show all status, but rejected
show all status, but unknown calendar en Show all status, but unknown
show also events just owned by selected user calendar en Show also events just owned by selected user
show birthdays as all day non-blocking events as well as via mouseover of the date. calendar en Show birthdays as all day non-blocking events as well as via mouseover of the date.
show birthdays as events calendar en Show birthdays as events
show birthdays as all day non-blocking events as well as via mouseover of the date. calendar en Show as all day non-blocking events as well as via mouseover of the date.
show birthdays as events calendar en Show as events
show birthdays from addressbook admin en Show birthdays from address book
show default view on main screen calendar en Show calendar on main screen
show empty rows in planner calendar en Show empty rows in planner