From 096113f257759384342f91d221976a66dd629598 Mon Sep 17 00:00:00 2001 From: wolfgang Date: Tue, 7 Aug 2007 18:17:02 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1138 d1b88da0-ebda-0310-925b-ed51d893ca5b --- NEWS | 1 + .../JavascriptAPIExtensions.js | 10 +++- UI/WebServerResources/SchedulerUI.js | 60 +++++++++++-------- UI/WebServerResources/UIxAttendeesEditor.js | 2 +- UI/WebServerResources/UIxComponentEditor.js | 4 +- .../UIxContactsUserFolders.js | 7 ++- UI/WebServerResources/generic.js | 6 +- 7 files changed, 55 insertions(+), 35 deletions(-) diff --git a/NEWS b/NEWS index 0396e560..6df7a028 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,7 @@ - added support for limiting LDAP queries with the SOGoLDAPQueryLimit and the SOGoLDAPSizeLimit settings; - fixed a bug where folders starting with digits would not be displayed; +- improved IE7 and Safari support: priority menus, attendees selector. 0.9.0-20070713 -------------- diff --git a/UI/WebServerResources/JavascriptAPIExtensions.js b/UI/WebServerResources/JavascriptAPIExtensions.js index cc07602a..509b2ed8 100644 --- a/UI/WebServerResources/JavascriptAPIExtensions.js +++ b/UI/WebServerResources/JavascriptAPIExtensions.js @@ -96,7 +96,8 @@ Date.prototype.daysUpTo = function(otherDate) { } Date.prototype.getDayString = function() { - var newString = this.getYear() + 1900; + var newString = this.getYear(); + if (newString < 1000) newString += 1900; var month = '' + (this.getMonth() + 1); if (month.length == 1) month = '0' + month; @@ -132,15 +133,18 @@ Date.prototype.getDisplayHoursString = function() { Date.prototype.stringWithSeparator = function(separator) { var month = '' + (this.getMonth() + 1); var day = '' + this.getDate(); + var year = this.getYear(); + if (year < 1000) + year = '' + (year + 1900); if (month.length == 1) month = '0' + month; if (day.length == 1) day = '0' + day; if (separator == '-') - str = (this.getYear() + 1900) + '-' + month + '-' + day; + str = year + '-' + month + '-' + day; else - str = day + '/' + month + '/' + (this.getYear() + 1900); + str = day + '/' + month + '/' + year; return str; } diff --git a/UI/WebServerResources/SchedulerUI.js b/UI/WebServerResources/SchedulerUI.js index 757255c4..bf46fbd4 100644 --- a/UI/WebServerResources/SchedulerUI.js +++ b/UI/WebServerResources/SchedulerUI.js @@ -701,7 +701,7 @@ function drawCalendarEvent(eventData, sd, ed) { } } if (parentDiv) - parentDiv.appendChild(eventDiv); + parentDiv.appendChild(eventDiv); } } @@ -710,34 +710,34 @@ function newEventDIV(cname, owner, starts, lasts, var eventDiv = document.createElement("div"); eventDiv.cname = cname; eventDiv.owner = owner; - eventDiv.addClassName("event"); - eventDiv.addClassName("starts" + starts); - eventDiv.addClassName("lasts" + lasts); + $(eventDiv).addClassName("event"); + $(eventDiv).addClassName("starts" + starts); + $(eventDiv).addClassName("lasts" + lasts); for (var i = 1; i < 5; i++) { var shadowDiv = document.createElement("div"); eventDiv.appendChild(shadowDiv); - shadowDiv.addClassName("shadow"); - shadowDiv.addClassName("shadow" + i); + $(shadowDiv).addClassName("shadow"); + $(shadowDiv).addClassName("shadow" + i); } var innerDiv = document.createElement("div"); eventDiv.appendChild(innerDiv); - innerDiv.addClassName("eventInside"); - innerDiv.addClassName("ownerIs" + owner); + $(innerDiv).addClassName("eventInside"); + $(innerDiv).addClassName("ownerIs" + owner); var gradientDiv = document.createElement("div"); innerDiv.appendChild(gradientDiv); - gradientDiv.addClassName("gradient"); + $(gradientDiv).addClassName("gradient"); var gradientImg = document.createElement("img"); gradientDiv.appendChild(gradientImg); gradientImg.src = ResourcesURL + "/event-gradient.png"; var textDiv = document.createElement("div"); innerDiv.appendChild(textDiv); - textDiv.addClassName("text"); + $(textDiv).addClassName("text"); if (startHour) { var headerSpan = document.createElement("span"); textDiv.appendChild(headerSpan); - headerSpan.addClassName("eventHeader"); + $(headerSpan).addClassName("eventHeader"); headerSpan.appendChild(document.createTextNode(startHour + " - " + endHour)); textDiv.appendChild(document.createElement("br")); @@ -1089,7 +1089,7 @@ function findMonthCalendarSelectedCell(daysContainer) { while (!found && i < daysContainer.childNodes.length) { var currentNode = daysContainer.childNodes[i]; - if (currentNode instanceof HTMLDivElement + if (currentNode.tagName == 'DIV' && currentNode.hasClassName("selectedDay")) { daysContainer.selectedCell = currentNode; found = true; @@ -1122,7 +1122,9 @@ function updateTaskStatus(event) { var newStatus = (this.checked ? 1 : 0); var http = createHTTPClient(); -// log("update task status: " + taskId + " to " + this.checked); + if (isSafari()) + newStatus = (newStatus ? 0 : 1); + //log("update task status: " + taskId + " to " + this.checked); event.cancelBubble = true; url = (UserFolderURL + "../" + taskOwner @@ -1350,12 +1352,13 @@ function appendCalendar(folderName, folder) { var calendarList = $("calendarList"); var lis = calendarList.childNodesWithTag("li"); var color = indexColor(lis.length); - log ("color: " + color); + //log ("color: " + color); var li = document.createElement("li"); calendarList.appendChild(li); var checkBox = document.createElement("input"); + checkBox.setAttribute("type", "checkbox"); li.appendChild(checkBox); li.appendChild(document.createTextNode(" ")); @@ -1368,26 +1371,35 @@ function appendCalendar(folderName, folder) { li.setAttribute("id", folder); Event.observe(li, "mousedown", listRowMouseDownHandler); Event.observe(li, "click", onRowClick); - checkBox.addClassName("checkBox"); - checkBox.type = "checkbox"; + $(checkBox).addClassName("checkBox"); + Event.observe(checkBox, "click", updateCalendarStatus.bindAsEventListener(checkBox)); - - colorBox.addClassName("colorBox"); + + $(colorBox).addClassName("colorBox"); if (color) { - colorBox.setStyle({ color: color, - backgroundColor: color }); + $(colorBox).setStyle({ color: color, + backgroundColor: color }); } var contactId = folder.split(":")[0]; - var styles = document.getElementsByTagName("style"); - var url = URLForFolderID(folder) + "/canAccessContent"; triggerAjaxRequest(url, calendarEntryCallback, folder); - styles[0].innerHTML += ('.ownerIs' + contactId + ' {' + if (!document.styleSheets) return; + var theRules = new Array(); + var lastSheet = document.styleSheets[document.styleSheets.length - 1]; + if (lastSheet.insertRule) { // Mozilla + lastSheet.insertRule('.ownerIs' + contactId + ' {' + ' background-color: ' + color - + ' !important; }'); + + ' !important; }', 0); + } + else { // IE + lastSheet.addRule('.ownerIs' + contactId, + ' background-color: ' + + color + + ' !important; }'); + } } function onFolderSubscribeCB(folderData) { diff --git a/UI/WebServerResources/UIxAttendeesEditor.js b/UI/WebServerResources/UIxAttendeesEditor.js index 0c625255..f7f17be0 100644 --- a/UI/WebServerResources/UIxAttendeesEditor.js +++ b/UI/WebServerResources/UIxAttendeesEditor.js @@ -205,7 +205,7 @@ function newAttendee(event) { input.activate(); } -function checkAttendee() { log ("checkAttendee (loosing focus)"); +function checkAttendee() { this.focussed = false; var th = this.parentNode.parentNode; var tbody = th.parentNode; diff --git a/UI/WebServerResources/UIxComponentEditor.js b/UI/WebServerResources/UIxComponentEditor.js index e6fe548b..82213035 100644 --- a/UI/WebServerResources/UIxComponentEditor.js +++ b/UI/WebServerResources/UIxComponentEditor.js @@ -133,7 +133,7 @@ function initializePrivacyMenu() { var privacy = $("privacy").value.toUpperCase(); if (privacy.length > 0) { var privacyMenu = $("privacy-menu").childNodesWithTag("ul")[0]; - var menuEntries = privacyMenu.childNodesWithTag("li"); + var menuEntries = $(privacyMenu).childNodesWithTag("li"); var chosenNode; if (privacy == "CONFIDENTIAL") chosenNode = menuEntries[1]; @@ -142,7 +142,7 @@ function initializePrivacyMenu() { else chosenNode = menuEntries[0]; privacyMenu.chosenNode = chosenNode; - chosenNode.addClassName("_chosen"); + $(chosenNode).addClassName("_chosen"); } } diff --git a/UI/WebServerResources/UIxContactsUserFolders.js b/UI/WebServerResources/UIxContactsUserFolders.js index d87369e2..fdc56899 100644 --- a/UI/WebServerResources/UIxContactsUserFolders.js +++ b/UI/WebServerResources/UIxContactsUserFolders.js @@ -89,20 +89,23 @@ function onFolderTreeItemClick(event) { function userFoldersCallback(http) { if (http.readyState == 4) { document.userFoldersRequest = null; + var div = $("folders"); if (http.status == 200) { - var div = $("folders"); var response = http.responseText; div.innerHTML = buildTree(http.responseText); var nodes = document.getElementsByClassName("node", $("d")); for (i = 0; i < nodes.length; i++) Event.observe(nodes[i], "click", onFolderTreeItemClick.bindAsEventListener(nodes[i])); } + else if (http.status == 404) { + div.innerHTML = ""; + } } } function onConfirmFolderSelection(event) { var topNode = $("d"); - if (topNode.selectedEntry) { + if (topNode && topNode.selectedEntry) { var node = topNode.selectedEntry.parentNode; var folder = node.getAttribute("dataname"); var folderName; diff --git a/UI/WebServerResources/generic.js b/UI/WebServerResources/generic.js index 7c5aa1bd..37a8d4c6 100644 --- a/UI/WebServerResources/generic.js +++ b/UI/WebServerResources/generic.js @@ -145,7 +145,7 @@ function URLForFolderID(folderID) { var url; if (folderInfos.length > 1) { url = UserFolderURL + "../" + folderInfos[0]; - if (folderInfos[1][0] != '/') + if (!folderInfos[1].startsWith('/')) url += '/'; url += folderInfos[1]; } @@ -908,7 +908,7 @@ function popupToolbarMenu(node, menuId) { function folderSubscriptionCallback(http) { if (http.readyState == 4) { - if (http.status == 204) { + if (isHttpStatus204(http.status)) { if (http.callbackData) http.callbackData["method"](http.callbackData["data"]); } @@ -943,7 +943,7 @@ function subscribeToFolder(refreshCallback, refreshCallbackData) { function folderUnsubscriptionCallback(http) { if (http.readyState == 4) { - if (http.status == 204) { + if (isHttpStatus204(http.status)) { if (http.callbackData) http.callbackData["method"](http.callbackData["data"]); } -- 2.39.5