From be4b5bbb2a486747bef822ff0679254ac9ed03e3 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Mon, 23 Oct 2006 21:37:22 +0000 Subject: [PATCH] Monotone-Parent: 3763045346dc745f788d643351451debf6ce0626 Monotone-Revision: 11701b15db10c26f527b23aa39f6d4ba7256523d Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-10-23T21:37:22 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 3 +++ UI/WebServerResources/generic.js | 36 ++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/ChangeLog b/ChangeLog index f3ed17f45..b84524237 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2006-10-23 Wolfgang Sourdeau + * UI/WebServerResources/generic.js: added code to enable or + disable anchor visually (following our internal algorithm). + * UI/Scheduler/UIxComponentEditor.m ([UIxComponentEditor -init]): added new "url" ivar with its classic accessors. ([UIxComponentEditor -urlButtonClasses]): new method that returns diff --git a/UI/WebServerResources/generic.js b/UI/WebServerResources/generic.js index a8cdb4b08..074676df8 100644 --- a/UI/WebServerResources/generic.js +++ b/UI/WebServerResources/generic.js @@ -1002,6 +1002,42 @@ function onTabClick(event) { return false; } +function enableAnchor(anchor) { + var classStr = '' + anchor.getAttribute("class"); + var position = classStr.indexOf("_disabled", 0); + if (position > -1) { + var disabledHref = anchor.getAttribute("disabled-href"); + if (disabledHref) + anchor.setAttribute("href", disabledHref); + var disabledOnclick = anchor.getAttribute("disabled-onclick"); + if (disabledOnclick) + anchor.setAttribute("onclick", disabledOnclick); + anchor.removeClassName("_disabled"); + anchor.setAttribute("disabled-href", null); + anchor.setAttribute("disabled-onclick", null); + anchor.disabled = 0; + anchor.enabled = 1; + } +} + +function disableAnchor(anchor) { + var classStr = '' + anchor.getAttribute("class"); + var position = classStr.indexOf("_disabled", 0); + if (position < 0) { + var href = anchor.getAttribute("href"); + if (href) + anchor.setAttribute("disabled-href", href); + var onclick = anchor.getAttribute("onclick"); + if (onclick) + anchor.setAttribute("disabled-onclick", onclick); + anchor.addClassName("_disabled"); + anchor.setAttribute("href", null); + anchor.setAttribute("onclick", null); + anchor.disabled = 1; + anchor.enabled = 0; + } +} + /* custom extensions to the DOM api */ HTMLElement.prototype.childNodesWithTag = function(tagName) { var matchingNodes = new Array();