From ea44308aa3d95d150b6d6565cdf4dbdc79e5c64e Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Tue, 29 Jul 2014 16:05:46 -0400 Subject: [PATCH] Fix all-day events display in IE It also fixes the display of the event categories for all-day events in IE. --- NEWS | 1 + UI/WebServerResources/SchedulerUI.css | 5 ++-- UI/WebServerResources/SchedulerUI.js | 39 ++++++++++++++------------- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/NEWS b/NEWS index 30bc834fd..a1d08734e 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,7 @@ Enhancements Bug fixes - fixed weekdays translation in the datepicker - fixed event categories display + - fixed all-day events display in IE - fixed rename of calendars - we now correctly add the "METHOD:REPLY" when sending out ITIP messages from DAV clients - fixed refresh of message headers when forwarding a message (#2818) diff --git a/UI/WebServerResources/SchedulerUI.css b/UI/WebServerResources/SchedulerUI.css index 537b1e7de..c02294761 100644 --- a/UI/WebServerResources/SchedulerUI.css +++ b/UI/WebServerResources/SchedulerUI.css @@ -400,7 +400,7 @@ DIV#daysView border-top: 1px solid #ccc; overflow: auto; overflow-x: hidden; - right: 0px;} + right: 0px; } DIV#calendarHeader { top: 25px; @@ -1298,9 +1298,10 @@ DIV#daysView DIV.event.lasts96 DIV.event > DIV.eventInside { position: absolute; overflow: hidden; - width:100%; top: 0px; bottom: 0px; + left: 0px; + right: 0px; -webkit-border-radius: 2px; border-radius: 2px; cursor:move; } diff --git a/UI/WebServerResources/SchedulerUI.js b/UI/WebServerResources/SchedulerUI.js index ec7e53548..7110e66a1 100644 --- a/UI/WebServerResources/SchedulerUI.js +++ b/UI/WebServerResources/SchedulerUI.js @@ -1762,7 +1762,9 @@ function _setupEventsDragAndDrop(events) { var blocks = occurrences[j].blocks; var dragController = new SOGoEventDragController(); dragController.updateDropCallback = updateEventFromDragging; - dragController.attachToEventCells(blocks); + if (blocks.length > 0) + // Ignore events that have no visible blocks + dragController.attachToEventCells(blocks); } setupFlags[setupId] = true; } @@ -1826,25 +1828,27 @@ function resetCategoriesStyles() { var selectors = []; var rules = []; categoriesStyles.keys().each(function(category) { - var color = UserDefaults['SOGoCalendarCategoriesColors'][category]; - if (color) { - rules[rules.length] = '{ border-right: 8px solid ' + color + '; }'; - selectors[selectors.length] = 'DIV.' + categoriesStyles.get(category); - } - }); + var color = UserDefaults['SOGoCalendarCategoriesColors'][category]; + if (color) { + rules.push('border-right: 8px solid ' + color); + selectors.push('DIV.' + categoriesStyles.get(category)); + } + }); if (selectors.length > 0) { if (categoriesStyleSheet.styleSheet && categoriesStyleSheet.styleSheet.addRule) { // IE - for (var i = 0; i < selectors.length; i++) + for (var i = 0; i < selectors.length; i++) { categoriesStyleSheet.styleSheet.addRule(selectors[i], rules[i]); + } } else { // Mozilla + Safari - for (var i = 0; i < selectors.length; i++) + for (var i = 0; i < selectors.length; i++) { categoriesStyleSheet.appendChild(document.createTextNode(selectors[i] + - ' ' + rules[i])); + ' { ' + rules[i] + '; }')); + } } } } @@ -1953,7 +1957,7 @@ function newBaseEventDIV(eventRep, event, eventText) { } event.blocks.push(eventCell); - + return eventCell; } @@ -2099,8 +2103,6 @@ function newEventDIV(eventRep, event) { var left = eventRep.position * pc; eventCell.style.left = left + "%"; var right = 100 - (eventRep.position + 1) * pc; - if (event[10] != null) - eventCell.style.borderRight = "8px solid white"; eventCell.style.right = right + "%"; eventCell.addClassName("starts" + eventRep.start); @@ -2115,7 +2117,7 @@ function newEventDIV(eventRep, event) { span.update(text); textDiv.appendChild(span); } - + return eventCell; } @@ -2142,9 +2144,7 @@ function newMonthEventDIV(eventRep, event) { var eventCell = newBaseEventDIV(eventRep, event, eventText); - if (event[10] != null) - eventCell.style.borderRight = "8px solid white"; - + return eventCell; } @@ -2176,8 +2176,9 @@ function adjustCalendarHeaderDIV() { var rule = ("right: " + delta + "px"); if (styleElement.styleSheet && styleElement.styleSheet.addRule) { // IE - styleElement.styleSheet.addRule(selectors[0], rule); - styleElement.styleSheet.addRule(selectors[1], rule); + for (var i = 0; i < selectors.length; i++) { + styleElement.styleSheet.addRule(selectors[i], rule); + } } else { // Mozilla + Firefox var styleText = selectors.join(",") + " { " + rule + "; }";