Index: openacs-4/packages/ajaxhelper/www/resources/yui/container/container-debug.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajaxhelper/www/resources/yui/container/container-debug.js,v diff -u -r1.3 -r1.4 --- openacs-4/packages/ajaxhelper/www/resources/yui/container/container-debug.js 8 Sep 2007 14:22:01 -0000 1.3 +++ openacs-4/packages/ajaxhelper/www/resources/yui/container/container-debug.js 9 Apr 2009 17:03:49 -0000 1.4 @@ -1,8 +1,8 @@ /* -Copyright (c) 2007, Yahoo! Inc. All rights reserved. +Copyright (c) 2009, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt -version: 2.3.0 +version: 2.7.0 */ (function () { @@ -18,27 +18,21 @@ * @param {Object} owner The owner Object to which this Config Object belongs */ YAHOO.util.Config = function (owner) { - + if (owner) { - this.init(owner); - } - - if (!owner) { - - YAHOO.log("No owner specified for Config object", "error"); - - } - + + if (!owner) { YAHOO.log("No owner specified for Config object", "error", "Config"); } + }; var Lang = YAHOO.lang, - CustomEvent = YAHOO.util.CustomEvent, + CustomEvent = YAHOO.util.CustomEvent, Config = YAHOO.util.Config; - + /** * Constant representing the CustomEvent type for the config changed event. * @property YAHOO.util.Config.CONFIG_CHANGED_EVENT @@ -157,7 +151,7 @@ * @param {value} Object The value of the correct type for the property */ fireEvent: function ( key, value ) { - YAHOO.log("Firing Config event: " + key + "=" + value, "info"); + YAHOO.log("Firing Config event: " + key + "=" + value, "info", "Config"); var property = this.config[key]; if (property && property.event) { @@ -174,7 +168,7 @@ */ addProperty: function ( key, propertyObject ) { key = key.toLowerCase(); - YAHOO.log("Added property: " + key, "info"); + YAHOO.log("Added property: " + key, "info", "Config"); this.config[key] = propertyObject; @@ -206,16 +200,19 @@ getConfig: function () { var cfg = {}, + currCfg = this.config, prop, property; - for (prop in this.config) { - property = this.config[prop]; - if (property && property.event) { - cfg[prop] = property.value; + for (prop in currCfg) { + if (Lang.hasOwnProperty(currCfg, prop)) { + property = currCfg[prop]; + if (property && property.event) { + cfg[prop] = property.value; + } } } - + return cfg; }, @@ -279,7 +276,7 @@ var property; key = key.toLowerCase(); - YAHOO.log("setProperty: " + key + "=" + value, "info"); + YAHOO.log("setProperty: " + key + "=" + value, "info", "Config"); if (this.queueInProgress && ! silent) { // Currently running through a queue... @@ -318,7 +315,7 @@ queueProperty: function (key, value) { key = key.toLowerCase(); - YAHOO.log("queueProperty: " + key + "=" + value, "info"); + YAHOO.log("queueProperty: " + key + "=" + value, "info", "Config"); var property = this.config[key], foundDuplicate = false, @@ -358,7 +355,7 @@ if (queueItem) { queueItemKey = queueItem[0]; queueItemValue = queueItem[1]; - + if (queueItemKey == key) { /* @@ -386,38 +383,38 @@ } if (property.supercedes) { - + sLen = property.supercedes.length; - + for (s = 0; s < sLen; s++) { - + supercedesCheck = property.supercedes[s]; qLen = this.eventQueue.length; - + for (q = 0; q < qLen; q++) { queueItemCheck = this.eventQueue[q]; - + if (queueItemCheck) { queueItemCheckKey = queueItemCheck[0]; queueItemCheckValue = queueItemCheck[1]; - + if (queueItemCheckKey == supercedesCheck.toLowerCase() ) { - + this.eventQueue.push([queueItemCheckKey, queueItemCheckValue]); - + this.eventQueue[q] = null; break; - + } } } } } - YAHOO.log("Config event queue: " + this.outputEventQueue(), "info"); - + YAHOO.log("Config event queue: " + this.outputEventQueue(), "info", "Config"); + return true; } else { return false; @@ -466,37 +463,23 @@ applyConfig: function (userConfig, init) { var sKey, - oValue, oConfig; if (init) { - oConfig = {}; - for (sKey in userConfig) { - if (Lang.hasOwnProperty(userConfig, sKey)) { - oConfig[sKey.toLowerCase()] = userConfig[sKey]; - } - } - this.initialConfig = oConfig; - } for (sKey in userConfig) { - if (Lang.hasOwnProperty(userConfig, sKey)) { - this.queueProperty(sKey, userConfig[sKey]); - } - } - }, /** @@ -505,11 +488,13 @@ * @method refresh */ refresh: function () { - + var prop; - + for (prop in this.config) { - this.refireEvent(prop); + if (Lang.hasOwnProperty(this.config, prop)) { + this.refireEvent(prop); + } } }, @@ -533,9 +518,14 @@ key = queueItem[0]; value = queueItem[1]; property = this.config[key]; - + property.value = value; - + + // Clear out queue entry, to avoid it being + // re-added to the queue by any queueProperty/supercedes + // calls which are invoked during fireEvent + this.eventQueue[i] = null; + this.fireEvent(key,value); } } @@ -563,19 +553,12 @@ var property = this.config[key.toLowerCase()]; if (property && property.event) { - if (!Config.alreadySubscribed(property.event, handler, obj)) { - property.event.subscribe(handler, obj, override); - } - return true; - } else { - return false; - } }, @@ -695,31 +678,24 @@ i; if (nSubscribers > 0) { - i = nSubscribers - 1; - do { - subsc = evt.subscribers[i]; - if (subsc && subsc.obj == obj && subsc.fn == fn) { - return true; - - } - + } } while (i--); - } - + return false; - + }; - + YAHOO.lang.augmentProto(Config, YAHOO.util.EventProvider); }()); + (function () { /** @@ -752,27 +728,21 @@ * documentation for more details. */ YAHOO.widget.Module = function (el, userConfig) { - if (el) { - this.init(el, userConfig); - } else { - YAHOO.log("No element or element ID specified" + " for Module instantiation", "error"); - } - }; - var Dom = YAHOO.util.Dom, Config = YAHOO.util.Config, Event = YAHOO.util.Event, CustomEvent = YAHOO.util.CustomEvent, Module = YAHOO.widget.Module, - + UA = YAHOO.env.ua, + m_oModuleTemplate, m_oHeaderTemplate, m_oBodyTemplate, @@ -786,7 +756,6 @@ * @type Object */ EVENT_TYPES = { - "BEFORE_INIT": "beforeInit", "INIT": "init", "APPEND": "append", @@ -801,7 +770,6 @@ "SHOW": "show", "BEFORE_HIDE": "beforeHide", "HIDE": "hide" - }, /** @@ -818,21 +786,24 @@ value: true, validator: YAHOO.lang.isBoolean }, - - "EFFECT": { - key: "effect", - suppressEvent: true, - supercedes: ["visible"] + + "EFFECT": { + key: "effect", + suppressEvent: true, + supercedes: ["visible"] }, - - "MONITOR_RESIZE": { - key: "monitorresize", - value: true + + "MONITOR_RESIZE": { + key: "monitorresize", + value: true + }, + + "APPEND_TO_DOCUMENT_BODY": { + key: "appendtodocumentbody", + value: false } - }; - /** * Constant representing the prefix path to use for non-secure images * @property YAHOO.widget.Module.IMG_ROOT @@ -868,7 +839,7 @@ * @type String */ Module.CSS_HEADER = "hd"; - + /** * Constant representing the module body * @property YAHOO.widget.Module.CSS_BODY @@ -896,20 +867,46 @@ * @type String */ Module.RESIZE_MONITOR_SECURE_URL = "javascript:false;"; - + /** + * Constant representing the buffer amount (in pixels) to use when positioning + * the text resize monitor offscreen. The resize monitor is positioned + * offscreen by an amount eqaul to its offsetHeight + the buffer value. + * + * @property YAHOO.widget.Module.RESIZE_MONITOR_BUFFER + * @static + * @type Number + */ + // Set to 1, to work around pixel offset in IE8, which increases when zoom is used + Module.RESIZE_MONITOR_BUFFER = 1; + + /** * Singleton CustomEvent fired when the font size is changed in the browser. * Opera's "zoom" functionality currently does not support text * size detection. * @event YAHOO.widget.Module.textResizeEvent */ Module.textResizeEvent = new CustomEvent("textResize"); + /** + * Helper utility method, which forces a document level + * redraw for Opera, which can help remove repaint + * irregularities after applying DOM changes. + * + * @method YAHOO.widget.Module.forceDocumentRedraw + * @static + */ + Module.forceDocumentRedraw = function() { + var docEl = document.documentElement; + if (docEl) { + docEl.className += " "; + docEl.className = YAHOO.lang.trim(docEl.className); + } + }; function createModuleTemplate() { if (!m_oModuleTemplate) { - m_oModuleTemplate = document.createElement("div"); m_oModuleTemplate.innerHTML = ("