From 0a3dfef4f69ee5d58c39f0467f5a20278b1bfd8c Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Fri, 25 May 2007 15:40:05 +0000 Subject: [PATCH 1/3] Monotone-Parent: 32ac613ce54828e76c41d1e1457a982917bf0b8e Monotone-Revision: 0f36b33a495ffd3bef8582e162ec509cf0681dd4 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2007-05-25T15:40:05 Monotone-Branch: ca.inverse.sogo --- UI/WebServerResources/SOGoDragHandles.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/UI/WebServerResources/SOGoDragHandles.js b/UI/WebServerResources/SOGoDragHandles.js index 82502a776..0e5ea642a 100644 --- a/UI/WebServerResources/SOGoDragHandles.js +++ b/UI/WebServerResources/SOGoDragHandles.js @@ -15,8 +15,8 @@ var SOGoDragHandlesInterface = { stopHandleDraggingBinded: null, moveBinded: null, bind: function () { - this.startHandleDraggingBinded = this.startHandleDragging.bindAsEventListener(this); - Event.observe(this, "mousedown", this.startHandleDraggingBinded, false); + this.startHandleDraggingBound = this.startHandleDragging.bindAsEventListener(this); + Event.observe(this, "mousedown", this.startHandleDraggingBound, false); this.onmousedown = function() { return false } }, _determineType: function () { @@ -49,10 +49,10 @@ var SOGoDragHandlesInterface = { this.origLower = this.lowerBlock.offsetTop - 5; document.body.style.cursor = "n-resize"; } - this.stopHandleDraggingBinded = this.stopHandleDragging.bindAsEventListener(this); - Event.observe(document.body, "mouseup", this.stopHandleDraggingBinded, true); - this.moveBinded = this.move.bindAsEventListener(this); - Event.observe(document.body, "mousemove", this.moveBinded, true); + this.stopHandleDraggingBound = this.stopHandleDragging.bindAsEventListener(this); + Event.observe(document.body, "mouseup", this.stopHandleDraggingBound, true); + this.moveBound = this.move.bindAsEventListener(this); + Event.observe(document.body, "mousemove", this.moveBound, true); this.move(event); event.cancelBubble = true; } @@ -74,8 +74,8 @@ var SOGoDragHandlesInterface = { this.upperBlock.style.height = (this.origUpper + deltaY - delta) + 'px'; } - Event.stopObserving(document.body, "mouseup", this.stopHandleDraggingBinded, true); - Event.stopObserving(document.body, "mousemove", this.moveBinded, true); + Event.stopObserving(document.body, "mouseup", this.stopHandleDraggingBound, true); + Event.stopObserving(document.body, "mousemove", this.moveBound, true); document.body.setAttribute('style', ''); From 963a02d94dfde92b02a3bf2cfcdb6904854a7daf Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Fri, 25 May 2007 15:43:49 +0000 Subject: [PATCH 2/3] Monotone-Parent: 0f36b33a495ffd3bef8582e162ec509cf0681dd4 Monotone-Revision: 1057850effbed29e0ea381ea8448d9080cd17cd2 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2007-05-25T15:43:49 Monotone-Branch: ca.inverse.sogo --- UI/WebServerResources/UIxComponentEditor.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/UI/WebServerResources/UIxComponentEditor.js b/UI/WebServerResources/UIxComponentEditor.js index beeac618a..a490e25ad 100644 --- a/UI/WebServerResources/UIxComponentEditor.js +++ b/UI/WebServerResources/UIxComponentEditor.js @@ -25,14 +25,14 @@ function onPopupUrlWindow(event) { if (documentHref.childNodes.length > 0) { documentHref.childNodes[0].nodeValue = newUrl; if (newUrl.length > 0) - documentLabel.style.display = "block;"; + documentLabel.setStyle({ display: "block" }); else - documentLabel.style.display = "none;"; + documentLabel.setStyle({ display: "none" }); } else { documentHref.appendChild(document.createTextNode(newUrl)); if (newUrl.length > 0) - documentLabel.style.display = "block;"; + documentLabel.setStyle({ display: "block" }); } urlInput.value = newUrl; } @@ -88,10 +88,10 @@ function refreshAttendees() { if (attendeesNames.value.length > 0) { attendeesHref.appendChild(document.createTextNode(attendeesNames.value)); - attendeesLabel.style.display = "block;"; + attendeesLabel.setStyle({ display: "block" }); } else - attendeesLabel.style.display = "none;"; + attendeesLabel.setStyle({ display: "none" }); } function initializeAttendeesHref() { @@ -101,10 +101,9 @@ function initializeAttendeesHref() { attendeesHref.addEventListener("click", onPopupAttendeesWindow, false); if (attendeesNames.value.length > 0) { - attendeesHref.style.textDecoration = "underline;"; - attendeesHref.style.color = "#00f;"; + attendeesHref.setStyle({ textDecoration: "underline", color: "#00f" }); attendeesHref.appendChild(document.createTextNode(attendeesNames.value)); - attendeesLabel.style.display = "block;"; + attendeesLabel.setStyle({ display: "block" }); } } @@ -114,11 +113,10 @@ function initializeDocumentHref() { var documentUrl = $("url"); documentHref.addEventListener("click", onPopupDocumentWindow, false); - documentHref.style.textDecoration = "underline;"; - documentHref.style.color = "#00f;"; + documentHref.setStyle({ textDecoration: "underline", color: "#00f" }); if (documentUrl.value.length > 0) { documentHref.appendChild(document.createTextNode(documentUrl.value)); - documentLabel.style.display = "block;"; + documentLabel.setStyle({ display: "block" }); } var changeUrlButton = $("changeUrlButton"); From adfafc777b74ff9d78012455c5d88002c8393508 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Fri, 25 May 2007 15:49:51 +0000 Subject: [PATCH 3/3] Monotone-Parent: 1057850effbed29e0ea381ea8448d9080cd17cd2 Monotone-Revision: 92d5ab2719da70823dc4cd47a37ba4c74f093c11 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2007-05-25T15:49:51 Monotone-Branch: ca.inverse.sogo --- UI/WebServerResources/generic.js | 88 ++++++++++++++++++++------------ 1 file changed, 54 insertions(+), 34 deletions(-) diff --git a/UI/WebServerResources/generic.js b/UI/WebServerResources/generic.js index f162736ea..8f14fe40d 100644 --- a/UI/WebServerResources/generic.js +++ b/UI/WebServerResources/generic.js @@ -258,12 +258,13 @@ function checkAjaxRequestsState() { document.busyAnim = anim; anim.id = "progressIndicator"; anim.src = ResourcesURL + "/busy.gif"; - anim.style.visibility = "hidden;"; + anim.setStyle({ visibility: "hidden" }); toolbar.appendChild(anim); - anim.style.visibility = "visible;"; + anim.setStyle({ visibility: "visible" }); } else if (activeAjaxRequests == 0 - && document.busyAnim) { + && document.busyAnim + && document.busyAnim.parentNode) { document.busyAnim.parentNode.removeChild(document.busyAnim); document.busyAnim = null; } @@ -410,12 +411,19 @@ function onRowClick(event) { if (startSelection != node.parentNode.getSelectedNodes()) { var parentNode = node.parentNode; - log("onRowClick " + parentNode.tagName); if (parentNode.tagName == 'TBODY') parentNode = parentNode.parentNode; - var onSelectionChangeEvent = document.createEvent("UIEvents"); - onSelectionChangeEvent.initEvent("selectionchange", true, true); - parentNode.dispatchEvent(onSelectionChangeEvent); + log("onRowClick: parentNode = " + parentNode.tagName); + if (document.createEvent) { + var onSelectionChangeEvent = document.createEvent("UIEvents"); + onSelectionChangeEvent.initEvent("selectionchange", true, true); + parentNode.dispatchEvent(onSelectionChangeEvent); + } + else if (document.createEventObject) { + // TODO: add support for IE + //parentNode.fireEvent("change"); + //parentNode is UL or TABLE + } } } @@ -444,9 +452,9 @@ function popupMenu(event, menuId, target) { if (leftDiff < 0) menuLeft -= popup.offsetWidth; - popup.style.top = menuTop + "px;"; - popup.style.left = menuLeft + "px;"; - popup.style.visibility = "visible;"; + popup.setStyle({ top: menuTop + "px", + left: menuLeft + "px", + visibility: "visible" }); bodyOnClick = "" + document.body.getAttribute("onclick"); document.body.setAttribute("onclick", "onBodyClick(event);"); @@ -491,7 +499,8 @@ function hideMenu(event, menuNode) { menuNode.submenu = null; } - menuNode.style.visibility = "hidden"; + //menuNode.setStyle({ visibility: "hidden" }); + $(menuNode).hide(); if (menuNode.parentMenuItem) { menuNode.parentMenuItem.setAttribute('class', 'submenu'); menuNode.parentMenuItem = null; @@ -501,9 +510,14 @@ function hideMenu(event, menuNode) { menuNode.parentMenu = null; } - var onhideEvent = document.createEvent("UIEvents"); - onhideEvent.initEvent("hideMenu", false, true); - menuNode.dispatchEvent(onhideEvent); + if (document.initEvent) { + var onhideEvent = document.createEvent("UIEvents"); + onhideEvent.initEvent("hideMenu", false, true); + menuNode.dispatchEvent(onhideEvent); + } + else if (document.createEventObject) { + // TODO: add support for IE + } } function onMenuEntryClick(event) { @@ -627,9 +641,9 @@ function dropDownSubmenu(event) { parentNode.setAttribute('onmousemove', 'checkDropDown(event);'); node.setAttribute('class', 'submenu-selected'); - submenuNode.style.top = menuTop + "px;"; - submenuNode.style.left = menuLeft + "px;"; - submenuNode.style.visibility = "visible;"; + submenuNode.setStyle({ top: menuTop + "px", + left: menuLeft + "px", + visibility: "visible" }); } } @@ -671,9 +685,9 @@ function popupSearchMenu(event) { hideMenu(event, document.currentPopupMenu); var popup = document.getElementById(menuId); - popup.style.top = node.offsetHeight + "px"; - popup.style.left = (node.offsetLeft + 3) + "px"; - popup.style.visibility = "visible"; + popup.setStyle({ top: node.offsetHeight + "px", + left: (node.offsetLeft + 3) + "px", + visibility: "visible" }); bodyOnClick = "" + document.body.getAttribute("onclick"); document.body.setAttribute("onclick", "onBodyClick('" + menuId + "');"); @@ -723,7 +737,7 @@ function onSearchFocus() { this.select(); } - this.style.color = "#000"; + this.setStyle({ color: "#000" }); } function onSearchBlur(event) { @@ -731,14 +745,14 @@ function onSearchBlur(event) { // log ("search blur: '" + this.value + "'"); if (!this.value) { this.setAttribute("modified", ""); - this.style.color = "#aaa"; + this.setStyle({ color: "#aaa" }); this.value = ghostPhrase; } else if (this.value == ghostPhrase) { this.setAttribute("modified", ""); - this.style.color = "#aaa"; + this.setStyle({ color: "#aaa" }); } else { this.setAttribute("modified", "yes"); - this.style.color = "#000"; + this.setStyle({ color: "#000" }); } } @@ -767,7 +781,7 @@ function initCriteria() { if (searchValue.value == '') { searchValue.value = firstOption.innerHTML; searchValue.setAttribute("modified", ""); - searchValue.style.color = "#aaa"; + searchValue.setStyle({ color: "#aaa" }); } } } @@ -789,9 +803,9 @@ function popupToolbarMenu(event, menuId) { var popup = document.getElementById(menuId); var top = node.offsetTop + node.offsetHeight - 2; - popup.style.top = top + "px"; - popup.style.left = node.cascadeLeftOffset() + "px"; - popup.style.visibility = "visible"; + popup.setStyle({ top: top + "px", + left: node.cascadeLeftOffset() + "px", + visibility: "visible" }); bodyOnClick = "" + document.body.getAttribute("onclick"); document.body.setAttribute("onclick", "onBodyClick('" + menuId + "');"); @@ -883,15 +897,21 @@ function initTabs() { var containers = document.getElementsByClassName("tabsContainer"); for (var x = 0; x < containers.length; x++) { var container = containers[x]; - var nodes = container.childNodes[1].childNodes; - - var firstTab; + var firstTab = null; + for (var i = 0; i < container.childNodes.length; i++) { + if (container.childNodes[i].tagName == 'UL') { + if (!firstTab) + firstTab = i; + } + } + var nodes = container.childNodes[firstTab].childNodes; + + firstTab = null; for (var i = 0; i < nodes.length; i++) { if (nodes[i].tagName == 'LI') { - if (!firstTab) { + if (!firstTab) firstTab = i; - } - Event.observe(nodes[i], "mousedown", onTabMouseDown, true); + Event.observe(nodes[i], "mousedown", onTabMouseDown, true); Event.observe(nodes[i], "click", onTabClick, true); } }