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();