From 74b279c21f428715d7a59a32f9f8454d96d78d78 Mon Sep 17 00:00:00 2001 From: nathangray Date: Fri, 29 Jul 2016 09:35:24 -0600 Subject: [PATCH] - Add preference to display birthdays as events (still always on for mobile) - Add cake icon to header on birthdays --- calendar/inc/class.calendar_hooks.inc.php | 7 +++++++ calendar/js/et2_widget_daycol.js | 10 +++++----- calendar/templates/default/app.css | 6 ++++++ calendar/templates/pixelegg/app.css | 6 ++++++ 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/calendar/inc/class.calendar_hooks.inc.php b/calendar/inc/class.calendar_hooks.inc.php index b91b88f5ab..44e4c0ea82 100644 --- a/calendar/inc/class.calendar_hooks.inc.php +++ b/calendar/inc/class.calendar_hooks.inc.php @@ -306,6 +306,13 @@ class calendar_hooks 'xmlrpc' => True, 'admin' => False ), + 'birthdays_as_events' => array( + 'type' => 'checkbox', + 'label' => 'Show birthdays as events', + 'name' => 'birthdays_as_events', + 'help' => 'Show birthdays as all day non-blocking events instead of via mouseover of the date.', + 'default'=> FALSE + ), 'limit_all_day_lines' => array( 'type' => 'input', 'size' => 5, diff --git a/calendar/js/et2_widget_daycol.js b/calendar/js/et2_widget_daycol.js index 0bc10bf4c8..600a2cd8ea 100644 --- a/calendar/js/et2_widget_daycol.js +++ b/calendar/js/et2_widget_daycol.js @@ -418,8 +418,8 @@ var et2_calendar_daycol = (function(){ "use strict"; return et2_valueWidget.exte { if (typeof holidays[i]['birthyear'] !== 'undefined') { - // Show holidays as events on mobile - if(egwIsMobile()) + // Show holidays as events on mobile or by preference + if(egwIsMobile() || egw.preference('birthdays_as_events','calendar')) { // Create event this._parent.date_helper.set_value(this.options.date.substring(0,4)+'-'+ @@ -472,7 +472,7 @@ var et2_calendar_daycol = (function(){ "use strict"; return et2_valueWidget.exte owner: this.options.owner, participants: this.options.owner, app: 'calendar', - class: 'calendar_calBirthday' + class: 'calendar_calHoliday' }, readonly: true, class: 'calendar_calHoliday' @@ -554,8 +554,8 @@ var et2_calendar_daycol = (function(){ "use strict"; return et2_valueWidget.exte } - // Show holidays as events on mobile - if(egwIsMobile()) + // Show holidays as events on mobile or by preference + if(egwIsMobile() || egw.preference('birthdays_as_events','calendar')) { this.day_class_holiday(); } diff --git a/calendar/templates/default/app.css b/calendar/templates/default/app.css index 54fe181399..c10dd3fb0b 100644 --- a/calendar/templates/default/app.css +++ b/calendar/templates/default/app.css @@ -253,6 +253,12 @@ e.g. the div with class calendar_calTimeGrid is generated by the timeGridWidget .calendar_calBirthday,.calendar_calBirthday a{ color: #626161; } +#calendar-view .calendar_calBirthday { + background-image: url(images/cake.png); + background-repeat: no-repeat; + background-size: 16px; + background-position: 10px center; +} /* Supress tooltips on holidays shown as events */ .calendar_calEventTooltip.calendar_calBirthday, .calendar_calEventTooltip.calendar_calHoliday { display: none; diff --git a/calendar/templates/pixelegg/app.css b/calendar/templates/pixelegg/app.css index 098aac4359..c4c92b6cdc 100755 --- a/calendar/templates/pixelegg/app.css +++ b/calendar/templates/pixelegg/app.css @@ -259,6 +259,12 @@ e.g. the div with class calendar_calTimeGrid is generated by the timeGridWidget .calendar_calBirthday a { color: #626161; } +#calendar-view .calendar_calBirthday { + background-image: url(images/cake.png); + background-repeat: no-repeat; + background-size: 16px; + background-position: 10px center; +} /* Supress tooltips on holidays shown as events */ .calendar_calEventTooltip.calendar_calBirthday, .calendar_calEventTooltip.calendar_calHoliday {