From 464f76ae73af7a4a16091d0269b3b311450a2de7 Mon Sep 17 00:00:00 2001 From: vyshane Date: Mon, 8 Jan 2007 08:47:49 +0000 Subject: [PATCH] Updated YUI to version 0.12.1. --- lib/yui/README.txt | 1 + lib/yui/animation/README | 3 + lib/yui/animation/animation-debug.js | 8 +- lib/yui/animation/animation-min.js | 51 +- lib/yui/animation/animation.js | 8 +- lib/yui/autocomplete/README | 6 + lib/yui/autocomplete/autocomplete-debug.js | 114 +- lib/yui/autocomplete/autocomplete-min.js | 5 +- lib/yui/autocomplete/autocomplete.js | 114 +- lib/yui/calendar/README | 104 +- lib/yui/calendar/assets/calendar.css | 6 +- lib/yui/calendar/calendar-debug.js | 25 +- lib/yui/calendar/calendar-min.js | 6 +- lib/yui/calendar/calendar.js | 24 +- lib/yui/connection/README | 6 + lib/yui/connection/connection-debug.js | 27 +- lib/yui/connection/connection-min.js | 4 +- lib/yui/connection/connection.js | 6 +- lib/yui/container/README | 104 +- lib/yui/container/assets/container.css | 8 +- lib/yui/container/container-debug.js | 116 +- lib/yui/container/container-min.js | 32 +- lib/yui/container/container.js | 115 +- lib/yui/container/container_core-debug.js | 64 +- lib/yui/container/container_core-min.js | 16 +- lib/yui/container/container_core.js | 63 +- lib/yui/dom/README | 8 +- lib/yui/dom/dom-debug.js | 24 +- lib/yui/dom/dom-min.js | 54 +- lib/yui/dom/dom.js | 24 +- lib/yui/dragdrop/README | 10 + lib/yui/dragdrop/dragdrop-debug.js | 500 +- lib/yui/dragdrop/dragdrop-min.js | 88 +- lib/yui/dragdrop/dragdrop.js | 478 +- lib/yui/event/README | 8 + lib/yui/event/event-debug.js | 271 +- lib/yui/event/event-min.js | 63 +- lib/yui/event/event.js | 55 +- lib/yui/fonts/README | 4 + lib/yui/fonts/fonts-min.css | 2 +- lib/yui/fonts/fonts.css | 2 +- lib/yui/grids/README | 4 + lib/yui/grids/grids-min.css | 2 +- lib/yui/grids/grids.css | 59 +- lib/yui/logger/README | 10 +- lib/yui/logger/assets/logger.css | 6 + lib/yui/logger/logger-debug.js | 39 +- lib/yui/logger/logger-min.js | 9 +- lib/yui/logger/logger.js | 39 +- lib/yui/menu/README | 25 +- lib/yui/menu/assets/menu.css | 2 +- lib/yui/menu/menu-debug.js | 7748 +++++++++-------- lib/yui/menu/menu-min.js | 215 +- lib/yui/menu/menu.js | 7472 ++++++++-------- lib/yui/reset-fonts-grids/README | 4 + .../reset-fonts-grids/reset-fonts-grids.css | 178 +- lib/yui/reset/README | 4 + lib/yui/reset/reset-min.css | 2 +- lib/yui/reset/reset.css | 2 +- lib/yui/slider/README | 5 + lib/yui/slider/slider-debug.js | 464 +- lib/yui/slider/slider-min.js | 30 +- lib/yui/slider/slider.js | 347 +- lib/yui/tabview/README | 9 +- lib/yui/tabview/assets/border_tabs.css | 30 +- lib/yui/tabview/tabview-debug.js | 8 +- lib/yui/tabview/tabview-min.js | 55 +- lib/yui/tabview/tabview.js | 26 +- lib/yui/treeview/README | 13 + lib/yui/treeview/assets/tree.css | 71 +- lib/yui/treeview/treeview-debug.js | 287 +- lib/yui/treeview/treeview-min.js | 66 +- lib/yui/treeview/treeview.js | 90 +- lib/yui/utilities/README | 4 + lib/yui/utilities/utilities.js | 262 +- lib/yui/yahoo-dom-event/README | 6 +- lib/yui/yahoo-dom-event/yahoo-dom-event.js | 119 +- lib/yui/yahoo/README | 3 + lib/yui/yahoo/yahoo-debug.js | 25 +- lib/yui/yahoo/yahoo-min.js | 6 +- lib/yui/yahoo/yahoo.js | 15 +- 81 files changed, 11078 insertions(+), 9310 deletions(-) diff --git a/lib/yui/README.txt b/lib/yui/README.txt index ea9fdf57e7..10db7aa9d0 100644 --- a/lib/yui/README.txt +++ b/lib/yui/README.txt @@ -7,3 +7,4 @@ from: Added to Moodle 13 July 2006 Updated to YUI 0.12.0, 23 November 2006 +Updated to YUI 0.12.1, 8 January 2007 diff --git a/lib/yui/animation/README b/lib/yui/animation/README index e0f99516e1..f79c1c30c6 100755 --- a/lib/yui/animation/README +++ b/lib/yui/animation/README @@ -1,5 +1,8 @@ Animation Release Notes +*** version 0.12.1 *** +* minified version no longer strips line breaks + *** version 0.12.0 *** * added boolean finish argument to Anim.stop() diff --git a/lib/yui/animation/animation-debug.js b/lib/yui/animation/animation-debug.js index 1a4c89c33d..915941f403 100755 --- a/lib/yui/animation/animation-debug.js +++ b/lib/yui/animation/animation-debug.js @@ -2,7 +2,7 @@ Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt -version: 0.12.0 +version: 0.12.1 */ /** @@ -640,6 +640,7 @@ YAHOO.util.Bezier = new function() }; }; +(function() { /** * Anim subclass for color transitions. *

Usage: var myAnim = new Y.ColorAnim(el, { backgroundColor: { from: '#FF0000', to: '#FFFFFF' } }, 1, Y.Easing.easeOut); Color values can be specified with either 112233, #112233, @@ -662,7 +663,6 @@ YAHOO.util.Bezier = new function() * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method) */ -(function() { YAHOO.util.ColorAnim = function(el, attributes, duration, method) { YAHOO.util.ColorAnim.superclass.constructor.call(this, el, attributes, duration, method); }; @@ -1040,6 +1040,7 @@ YAHOO.util.Easing = { } }; +(function() { /** * Anim subclass for moving elements along a path defined by the "points" * member of "attributes". All "points" are arrays with x, y coordinates. @@ -1063,7 +1064,6 @@ YAHOO.util.Easing = { * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method) */ -(function() { YAHOO.util.Motion = function(el, attributes, duration, method) { if (el) { // dont break existing subclasses not using YAHOO.extend YAHOO.util.Motion.superclass.constructor.call(this, el, attributes, duration, method); @@ -1192,6 +1192,7 @@ YAHOO.util.Easing = { return (typeof prop !== 'undefined'); }; })(); +(function() { /** * Anim subclass for scrolling elements to a position defined by the "scroll" * member of "attributes". All "scroll" members are arrays with x, y scroll positions. @@ -1215,7 +1216,6 @@ YAHOO.util.Easing = { * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method) */ -(function() { YAHOO.util.Scroll = function(el, attributes, duration, method) { if (el) { // dont break existing subclasses not using YAHOO.extend YAHOO.util.Scroll.superclass.constructor.call(this, el, attributes, duration, method); diff --git a/lib/yui/animation/animation-min.js b/lib/yui/animation/animation-min.js index 353f3a3783..87a42cf079 100755 --- a/lib/yui/animation/animation-min.js +++ b/lib/yui/animation/animation-min.js @@ -1 +1,50 @@ -/* Copyright (c) 2006, Yahoo! Inc. All rights reserved.Code licensed under the BSD License:http://developer.yahoo.net/yui/license.txtversion: 0.12.0 */ YAHOO.util.Anim=function(el,attributes,duration,method){if(el){this.init(el,attributes,duration,method);}};YAHOO.util.Anim.prototype={toString:function(){var el=this.getEl();var id=el.id||el.tagName;return("Anim "+id);},patterns:{noNegatives:/width|height|opacity|padding/i,offsetAttribute:/^((width|height)|(top|left))$/,defaultUnit:/width|height|top$|bottom$|left$|right$/i,offsetUnit:/\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i},doMethod:function(attr,start,end){return this.method(this.currentFrame,start,end-start,this.totalFrames);},setAttribute:function(attr,val,unit){if(this.patterns.noNegatives.test(attr)){val=(val>0)?val:0;}YAHOO.util.Dom.setStyle(this.getEl(),attr,val+unit);},getAttribute:function(attr){var el=this.getEl();var val=YAHOO.util.Dom.getStyle(el,attr);if(val!=='auto'&&!this.patterns.offsetUnit.test(val)){return parseFloat(val);}var a=this.patterns.offsetAttribute.exec(attr)||[];var pos=!!(a[3]);var box=!!(a[2]);if(box||(YAHOO.util.Dom.getStyle(el,'position')=='absolute'&&pos)){val=el['offset'+a[0].charAt(0).toUpperCase()+a[0].substr(1)];}else{val=0;}return val;},getDefaultUnit:function(attr){if(this.patterns.defaultUnit.test(attr)){return'px';}return'';},setRuntimeAttribute:function(attr){var start;var end;var attributes=this.attributes;this.runtimeAttributes[attr]={};var isset=function(prop){return(typeof prop!=='undefined');};if(!isset(attributes[attr]['to'])&&!isset(attributes[attr]['by'])){return false;}start=(isset(attributes[attr]['from']))?attributes[attr]['from']:this.getAttribute(attr);if(isset(attributes[attr]['to'])){end=attributes[attr]['to'];}else if(isset(attributes[attr]['by'])){if(start.constructor==Array){end=[];for(var i=0,len=start.length;i0&&isFinite(tweak)){if(tween.currentFrame+tweak>=frames){tweak=frames-(frame+1);}tween.currentFrame+=tweak;}};};YAHOO.util.Bezier=new function(){this.getPosition=function(points,t){var n=points.length;var tmp=[];for(var i=0;i0&&!(control[0]instanceof Array)){control=[control];}else{var tmp=[];for(i=0,len=control.length;i0){this.runtimeAttributes[attr]=this.runtimeAttributes[attr].concat(control);}this.runtimeAttributes[attr][this.runtimeAttributes[attr].length]=end;}else{superclass.setRuntimeAttribute.call(this,attr);}};var translateValues=function(val,start){var pageXY=Y.Dom.getXY(this.getEl());val=[val[0]-pageXY[0]+start[0],val[1]-pageXY[1]+start[1]];return val;};var isset=function(prop){return(typeof prop!=='undefined');};})();(function(){YAHOO.util.Scroll=function(el,attributes,duration,method){if(el){YAHOO.util.Scroll.superclass.constructor.call(this,el,attributes,duration,method);}};YAHOO.extend(YAHOO.util.Scroll,YAHOO.util.ColorAnim);var Y=YAHOO.util;var superclass=Y.Scroll.superclass;var proto=Y.Scroll.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("Scroll "+id);};proto.doMethod=function(attr,start,end){var val=null;if(attr=='scroll'){val=[this.method(this.currentFrame,start[0],end[0]-start[0],this.totalFrames),this.method(this.currentFrame,start[1],end[1]-start[1],this.totalFrames)];}else{val=superclass.doMethod.call(this,attr,start,end);}return val;};proto.getAttribute=function(attr){var val=null;var el=this.getEl();if(attr=='scroll'){val=[el.scrollLeft,el.scrollTop];}else{val=superclass.getAttribute.call(this,attr);}return val;};proto.setAttribute=function(attr,val,unit){var el=this.getEl();if(attr=='scroll'){el.scrollLeft=val[0];el.scrollTop=val[1];}else{superclass.setAttribute.call(this,attr,val,unit);}};})(); \ No newline at end of file +/* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt version: 0.12.1 */ +YAHOO.util.Anim=function(el,attributes,duration,method){if(el){this.init(el,attributes,duration,method);}};YAHOO.util.Anim.prototype={toString:function(){var el=this.getEl();var id=el.id||el.tagName;return("Anim "+id);},patterns:{noNegatives:/width|height|opacity|padding/i,offsetAttribute:/^((width|height)|(top|left))$/,defaultUnit:/width|height|top$|bottom$|left$|right$/i,offsetUnit:/\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i},doMethod:function(attr,start,end){return this.method(this.currentFrame,start,end-start,this.totalFrames);},setAttribute:function(attr,val,unit){if(this.patterns.noNegatives.test(attr)){val=(val>0)?val:0;} +YAHOO.util.Dom.setStyle(this.getEl(),attr,val+unit);},getAttribute:function(attr){var el=this.getEl();var val=YAHOO.util.Dom.getStyle(el,attr);if(val!=='auto'&&!this.patterns.offsetUnit.test(val)){return parseFloat(val);} +var a=this.patterns.offsetAttribute.exec(attr)||[];var pos=!!(a[3]);var box=!!(a[2]);if(box||(YAHOO.util.Dom.getStyle(el,'position')=='absolute'&&pos)){val=el['offset'+a[0].charAt(0).toUpperCase()+a[0].substr(1)];}else{val=0;} +return val;},getDefaultUnit:function(attr){if(this.patterns.defaultUnit.test(attr)){return'px';} +return'';},setRuntimeAttribute:function(attr){var start;var end;var attributes=this.attributes;this.runtimeAttributes[attr]={};var isset=function(prop){return(typeof prop!=='undefined');};if(!isset(attributes[attr]['to'])&&!isset(attributes[attr]['by'])){return false;} +start=(isset(attributes[attr]['from']))?attributes[attr]['from']:this.getAttribute(attr);if(isset(attributes[attr]['to'])){end=attributes[attr]['to'];}else if(isset(attributes[attr]['by'])){if(start.constructor==Array){end=[];for(var i=0,len=start.length;i0&&isFinite(tweak)){if(tween.currentFrame+tweak>=frames){tweak=frames-(frame+1);} +tween.currentFrame+=tweak;}};};YAHOO.util.Bezier=new function() +{this.getPosition=function(points,t) +{var n=points.length;var tmp=[];for(var i=0;i0&&!(control[0]instanceof Array)){control=[control];}else{var tmp=[];for(i=0,len=control.length;i0){this.runtimeAttributes[attr]=this.runtimeAttributes[attr].concat(control);} +this.runtimeAttributes[attr][this.runtimeAttributes[attr].length]=end;} +else{superclass.setRuntimeAttribute.call(this,attr);}};var translateValues=function(val,start){var pageXY=Y.Dom.getXY(this.getEl());val=[val[0]-pageXY[0]+start[0],val[1]-pageXY[1]+start[1]];return val;};var isset=function(prop){return(typeof prop!=='undefined');};})();(function(){YAHOO.util.Scroll=function(el,attributes,duration,method){if(el){YAHOO.util.Scroll.superclass.constructor.call(this,el,attributes,duration,method);}};YAHOO.extend(YAHOO.util.Scroll,YAHOO.util.ColorAnim);var Y=YAHOO.util;var superclass=Y.Scroll.superclass;var proto=Y.Scroll.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("Scroll "+id);};proto.doMethod=function(attr,start,end){var val=null;if(attr=='scroll'){val=[this.method(this.currentFrame,start[0],end[0]-start[0],this.totalFrames),this.method(this.currentFrame,start[1],end[1]-start[1],this.totalFrames)];}else{val=superclass.doMethod.call(this,attr,start,end);} +return val;};proto.getAttribute=function(attr){var val=null;var el=this.getEl();if(attr=='scroll'){val=[el.scrollLeft,el.scrollTop];}else{val=superclass.getAttribute.call(this,attr);} +return val;};proto.setAttribute=function(attr,val,unit){var el=this.getEl();if(attr=='scroll'){el.scrollLeft=val[0];el.scrollTop=val[1];}else{superclass.setAttribute.call(this,attr,val,unit);}};})(); \ No newline at end of file diff --git a/lib/yui/animation/animation.js b/lib/yui/animation/animation.js index 333f946903..79443906a1 100755 --- a/lib/yui/animation/animation.js +++ b/lib/yui/animation/animation.js @@ -2,7 +2,7 @@ Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt -version: 0.12.0 +version: 0.12.1 */ /** @@ -637,6 +637,7 @@ YAHOO.util.Bezier = new function() }; }; +(function() { /** * Anim subclass for color transitions. *

Usage: var myAnim = new Y.ColorAnim(el, { backgroundColor: { from: '#FF0000', to: '#FFFFFF' } }, 1, Y.Easing.easeOut); Color values can be specified with either 112233, #112233, @@ -659,7 +660,6 @@ YAHOO.util.Bezier = new function() * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method) */ -(function() { YAHOO.util.ColorAnim = function(el, attributes, duration, method) { YAHOO.util.ColorAnim.superclass.constructor.call(this, el, attributes, duration, method); }; @@ -1036,6 +1036,7 @@ YAHOO.util.Easing = { } }; +(function() { /** * Anim subclass for moving elements along a path defined by the "points" * member of "attributes". All "points" are arrays with x, y coordinates. @@ -1059,7 +1060,6 @@ YAHOO.util.Easing = { * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method) */ -(function() { YAHOO.util.Motion = function(el, attributes, duration, method) { if (el) { // dont break existing subclasses not using YAHOO.extend YAHOO.util.Motion.superclass.constructor.call(this, el, attributes, duration, method); @@ -1188,6 +1188,7 @@ YAHOO.util.Easing = { return (typeof prop !== 'undefined'); }; })(); +(function() { /** * Anim subclass for scrolling elements to a position defined by the "scroll" * member of "attributes". All "scroll" members are arrays with x, y scroll positions. @@ -1211,7 +1212,6 @@ YAHOO.util.Easing = { * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method) */ -(function() { YAHOO.util.Scroll = function(el, attributes, duration, method) { if (el) { // dont break existing subclasses not using YAHOO.extend YAHOO.util.Scroll.superclass.constructor.call(this, el, attributes, duration, method); diff --git a/lib/yui/autocomplete/README b/lib/yui/autocomplete/README index 4470be23f2..01cad9d227 100755 --- a/lib/yui/autocomplete/README +++ b/lib/yui/autocomplete/README @@ -1,5 +1,11 @@ AutoComplete Release Notes +*** version 0.12.1 *** + +* No longer trigger typeAhead feature when user is backspacing on input text. + + + *** version 0.12.0 *** * The following constants must be defined as static class properties and are no longer diff --git a/lib/yui/autocomplete/autocomplete-debug.js b/lib/yui/autocomplete/autocomplete-debug.js index 62fd2b73bd..d6c3ac3616 100755 --- a/lib/yui/autocomplete/autocomplete-debug.js +++ b/lib/yui/autocomplete/autocomplete-debug.js @@ -2,7 +2,7 @@ Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.txt -version: 0.12.0 +version: 0.12.1 */ /** @@ -33,12 +33,12 @@ version: 0.12.0 * * @class AutoComplete * @constructor - * @param elInput {HTMLElement} DOM element reference of an input field - * @param elInput {String} String ID of an input field - * @param elContainer {HTMLElement} DOM element reference of an existing DIV - * @param elContainer {String} String ID of an existing DIV - * @param oDataSource {Object} Instance of YAHOO.widget.DataSource for query/results - * @param oConfigs {Object} (optional) Object literal of configuration params + * @param elInput {HTMLElement} DOM element reference of an input field. + * @param elInput {String} String ID of an input field. + * @param elContainer {HTMLElement} DOM element reference of an existing DIV. + * @param elContainer {String} String ID of an existing DIV. + * @param oDataSource {Object} Instance of YAHOO.widget.DataSource for query/results. + * @param oConfigs {Object} (optional) Object literal of configuration params. */ YAHOO.widget.AutoComplete = function(elInput,elContainer,oDataSource,oConfigs) { if(elInput && elContainer && oDataSource) { @@ -138,7 +138,7 @@ YAHOO.widget.AutoComplete = function(elInput,elContainer,oDataSource,oConfigs) { this.selectionEnforceEvent = new YAHOO.util.CustomEvent("selectionEnforce", this); this.containerCollapseEvent = new YAHOO.util.CustomEvent("containerCollapse", this); this.textboxBlurEvent = new YAHOO.util.CustomEvent("textboxBlur", this); - + // Finish up oTextbox.setAttribute("autocomplete","off"); YAHOO.widget.AutoComplete._nIndex++; @@ -516,7 +516,7 @@ YAHOO.widget.AutoComplete.prototype.textboxKeyEvent = null; /** * Fired when the AutoComplete instance makes a query to the DataSource. - * + * * @event dataRequestEvent * @param oSelf {Object} The AutoComplete instance. * @param sQuery {String} The query string. @@ -554,7 +554,7 @@ YAHOO.widget.AutoComplete.prototype.containerExpandEvent = null; /** * Fired when the input field has been prefilled by the type-ahead - * feature. + * feature. * * @event typeAheadEvent * @param oSelf {Object} The AutoComplete instance. @@ -582,7 +582,7 @@ YAHOO.widget.AutoComplete.prototype.itemMouseOverEvent = null; YAHOO.widget.AutoComplete.prototype.itemMouseOutEvent = null; /** - * Fired when result item has been arrowed to. + * Fired when result item has been arrowed to. * * @event itemArrowToEvent * @param oSelf {Object} The AutoComplete instance. @@ -613,7 +613,7 @@ YAHOO.widget.AutoComplete.prototype.itemSelectEvent = null; /** * Fired when a user selection does not match any of the displayed result items. * Note that this event may not behave as expected when delimiter characters - * have been defined. + * have been defined. * * @event unmatchedItemSelectEvent * @param oSelf {Object} The AutoComplete instance. @@ -1275,7 +1275,7 @@ YAHOO.widget.AutoComplete.prototype._textMatchesOption = function() { */ YAHOO.widget.AutoComplete.prototype._typeAhead = function(oItem, sQuery) { // Don't update if turned off - if (!this.typeAhead) { + if (!this.typeAhead || (this._nKeyCode == 8)) { return; } @@ -1370,7 +1370,7 @@ YAHOO.widget.AutoComplete.prototype._toggleContainer = function(bShow) { if(this.alwaysShowContainer && this._bContainerOpen) { return; } - + // Clear contents of container if(!bShow) { this._oContainer._oContent.scrollTop = 0; @@ -2022,11 +2022,11 @@ YAHOO.widget.AutoComplete.prototype._onFormSubmit = function(v,oSelf) { * database. Supported data include local JavaScript arrays and objects and databases * accessible via XHR connections. Supported response formats include JavaScript arrays, * JSON, XML, and flat-file textual data. - * + * * @class DataSource * @constructor */ -YAHOO.widget.DataSource = function() { +YAHOO.widget.DataSource = function() { /* abstract class */ }; @@ -2142,10 +2142,10 @@ YAHOO.widget.DataSource.prototype.toString = function() { * @param oParent {Object} The object instance that has requested data. */ YAHOO.widget.DataSource.prototype.getResults = function(oCallbackFn, sQuery, oParent) { - + // First look in cache var aResults = this._doQueryCache(oCallbackFn,sQuery,oParent); - + // Not in cache, so get results from server if(aResults.length === 0) { this.queryEvent.fire(this, oParent, sQuery); @@ -2164,7 +2164,7 @@ YAHOO.widget.DataSource.prototype.getResults = function(oCallbackFn, sQuery, oPa * @param oParent {Object} The object instance that has requested data. */ YAHOO.widget.DataSource.prototype.doQuery = function(oCallbackFn, sQuery, oParent) { - /* override this */ + /* override this */ }; /** @@ -2218,7 +2218,7 @@ YAHOO.widget.DataSource.prototype.cacheQueryEvent = null; * @param aResults {Object[]} Array of result objects. */ YAHOO.widget.DataSource.prototype.getResultsEvent = null; - + /** * Fired when data is retrieved from the local cache. * @@ -2292,7 +2292,7 @@ YAHOO.widget.DataSource.prototype._aCache = null; /** * Initializes DataSource instance. - * + * * @method _init * @private */ @@ -2306,10 +2306,10 @@ YAHOO.widget.DataSource.prototype._init = function() { if(maxCacheEntries > 0 && !this._aCache) { this._aCache = []; } - + this._sName = "instance" + YAHOO.widget.DataSource._nIndex; YAHOO.widget.DataSource._nIndex++; - + this.queryEvent = new YAHOO.util.CustomEvent("query", this); this.cacheQueryEvent = new YAHOO.util.CustomEvent("cacheQuery", this); this.getResultsEvent = new YAHOO.util.CustomEvent("getResults", this); @@ -2319,9 +2319,9 @@ YAHOO.widget.DataSource.prototype._init = function() { }; /** - * Adds a result object to the local cache, evicting the oldest element if the + * Adds a result object to the local cache, evicting the oldest element if the * cache is full. Newer items will have higher indexes, the oldest item will have - * index of 0. + * index of 0. * * @method _addCacheElem * @param oResult {Object} Data result object, including array of results. @@ -2333,12 +2333,12 @@ YAHOO.widget.DataSource.prototype._addCacheElem = function(oResult) { if(!aCache || !oResult || !oResult.query || !oResult.results) { return; } - + // If the cache is full, make room by removing from index=0 if(aCache.length >= this.maxCacheEntries) { aCache.shift(); } - + // Add to cache, at the end of the array aCache.push(oResult); }; @@ -2346,14 +2346,14 @@ YAHOO.widget.DataSource.prototype._addCacheElem = function(oResult) { /** * Queries the local cache for results. If query has been cached, the callback * function is called with the results, and the cached is refreshed so that it - * is now the newest element. + * is now the newest element. * * @method _doQueryCache * @param oCallbackFn {HTMLFunction} Callback function defined by oParent object to which to return results. * @param sQuery {String} Query string. * @param oParent {Object} The object instance that has requested data. * @return aResults {Object[]} Array of results from local cache if found, otherwise null. - * @private + * @private */ YAHOO.widget.DataSource.prototype._doQueryCache = function(oCallbackFn, sQuery, oParent) { var aResults = []; @@ -2361,7 +2361,7 @@ YAHOO.widget.DataSource.prototype._doQueryCache = function(oCallbackFn, sQuery, var aCache = this._aCache; var nCacheLength = (aCache) ? aCache.length : 0; var bMatchContains = this.queryMatchContains; - + // If cache is enabled... if((this.maxCacheEntries > 0) && aCache && (nCacheLength > 0)) { this.cacheQueryEvent.fire(this, oParent, sQuery); @@ -2379,16 +2379,16 @@ YAHOO.widget.DataSource.prototype._doQueryCache = function(oCallbackFn, sQuery, var matchKey = (!this.queryMatchCase) ? encodeURIComponent(resultObj.query).toLowerCase(): encodeURIComponent(resultObj.query); - + // If a cached match key exactly matches the query... if(matchKey == sQuery) { // Stash all result objects into aResult[] and stop looping through the cache. bMatchFound = true; aResults = aAllResultItems; - + // The matching cache element was not the most recent, // so now we need to refresh the cache. - if(i != nCacheLength-1) { + if(i != nCacheLength-1) { // Remove element from its original location aCache.splice(i,1); // Add element as newest @@ -2401,18 +2401,18 @@ YAHOO.widget.DataSource.prototype._doQueryCache = function(oCallbackFn, sQuery, // Loop through substrings of each cached element's query property... for(var j = sQuery.length-1; j >= 0 ; j--) { var subQuery = sQuery.substr(0,j); - + // If a substring of a cached sQuery exactly matches the query... - if(matchKey == subQuery) { + if(matchKey == subQuery) { bMatchFound = true; - + // Go through each cached result object to match against the query... for(var k = aAllResultItems.length-1; k >= 0; k--) { var aRecord = aAllResultItems[k]; var sKeyIndex = (this.queryMatchCase) ? encodeURIComponent(aRecord[0]).indexOf(sQuery): encodeURIComponent(aRecord[0]).toLowerCase().indexOf(sQuery); - + // A STARTSWITH match is when the query is found at the beginning of the key string... if((!bMatchContains && (sKeyIndex === 0)) || // A CONTAINS match is when the query is found anywhere within the key string... @@ -2421,7 +2421,7 @@ YAHOO.widget.DataSource.prototype._doQueryCache = function(oCallbackFn, sQuery, aResults.unshift(aRecord); } } - + // Add the subset match result set object as the newest element to cache, // and stop looping through the cache. resultObj = {}; @@ -2436,7 +2436,7 @@ YAHOO.widget.DataSource.prototype._doQueryCache = function(oCallbackFn, sQuery, } } } - + // If there was a match, send along the results. if(bMatchFound) { this.getCachedResultsEvent.fire(this, oParent, sOrigQuery, aResults); @@ -2454,7 +2454,7 @@ YAHOO.widget.DataSource.prototype._doQueryCache = function(oCallbackFn, sQuery, /** * Implementation of YAHOO.widget.DataSource using XML HTTP requests that return * query results. - * + * * @class DS_XHR * @extends YAHOO.widget.DataSource * @requires connection @@ -2471,7 +2471,7 @@ YAHOO.widget.DS_XHR = function(sScriptURI, aSchema, oConfigs) { this[sConfig] = oConfigs[sConfig]; } } - + // Initialization sequence if(!aSchema || (aSchema.constructor != Array)) { YAHOO.log("Could not instantiate XHR DataSource due to invalid arguments", "error", this.toString()); @@ -2621,7 +2621,7 @@ YAHOO.widget.DS_XHR.prototype.responseStripAfter = "\n 0) { oCallback.timeout = this.connTimeout; } - + if(this._oConn) { this.connMgr.abort(this._oConn); } - + oSelf._oConn = this.connMgr.asyncRequest("GET", sUri, oCallback, null); }; /** * Parses raw response data into an array of result objects. The result data key - * is always stashed in the [0] element of each result object. + * is always stashed in the [0] element of each result object. * * @method parseResponse * @param sQuery {String} Query string. @@ -2795,7 +2795,7 @@ YAHOO.widget.DS_XHR.prototype.parseResponse = function(sQuery, oResponse, oParen if(jsonList.constructor != Array) { jsonList = [jsonList]; } - + // Loop through the array of all responses... for(var i = jsonList.length-1; i >= 0 ; i--) { var aResultItem = []; @@ -2884,7 +2884,7 @@ YAHOO.widget.DS_XHR.prototype.parseResponse = function(sQuery, oResponse, oParen else { return aResults; } -}; +}; ///////////////////////////////////////////////////////////////////////////// // @@ -2909,11 +2909,11 @@ YAHOO.widget.DS_XHR.prototype._oConn = null; /** * Implementation of YAHOO.widget.DataSource using a native Javascript function as * its live data source. - * + * * @class DS_JSFunction * @constructor * @extends YAHOO.widget.DataSource - * @param oFunction {String} In-memory Javascript function that returns query results as an array of objects. + * @param oFunction {HTMLFunction} In-memory Javascript function that returns query results as an array of objects. * @param oConfigs {Object} (optional) Object literal of config params. */ YAHOO.widget.DS_JSFunction = function(oFunction, oConfigs) { @@ -2961,7 +2961,7 @@ YAHOO.widget.DS_JSFunction.prototype.dataFunction = null; /** * Queries the live data source defined by function for results. Results are * passed back to a callback function. - * + * * @method doQuery * @param oCallbackFn {HTMLFunction} Callback function defined by oParent object to which to return results. * @param sQuery {String} Query string. @@ -2970,19 +2970,19 @@ YAHOO.widget.DS_JSFunction.prototype.dataFunction = null; YAHOO.widget.DS_JSFunction.prototype.doQuery = function(oCallbackFn, sQuery, oParent) { var oFunction = this.dataFunction; var aResults = []; - + aResults = oFunction(sQuery); if(aResults === null) { this.dataErrorEvent.fire(this, oParent, sQuery, YAHOO.widget.DataSource.ERROR_DATANULL); YAHOO.log(YAHOO.widget.DataSource.ERROR_DATANULL, "error", this.toString()); return; } - + var resultObj = {}; resultObj.query = decodeURIComponent(sQuery); resultObj.results = aResults; this._addCacheElem(resultObj); - + this.getResultsEvent.fire(this, oParent, sQuery, aResults); oCallbackFn(sQuery, aResults, oParent); return; diff --git a/lib/yui/autocomplete/autocomplete-min.js b/lib/yui/autocomplete/autocomplete-min.js index 05c9d8b990..4d03d7dc74 100755 --- a/lib/yui/autocomplete/autocomplete-min.js +++ b/lib/yui/autocomplete/autocomplete-min.js @@ -1,4 +1,5 @@ -/* Copyright (c) 2006, Yahoo! Inc. All rights reserved.Code licensed under the BSD License:http://developer.yahoo.net/yui/license.txt version: 0.12.0 */ +/* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.txt version: 0.12.1 */ + YAHOO.widget.AutoComplete=function(elInput,elContainer,oDataSource,oConfigs){if(elInput&&elContainer&&oDataSource){if(oDataSource&&(oDataSource instanceof YAHOO.widget.DataSource)){this.dataSource=oDataSource;} else{return;} if(YAHOO.util.Dom.inDocument(elInput)){if(typeof elInput=="string"){this._sName="instance"+YAHOO.widget.AutoComplete._nIndex+" "+elInput;this._oTextbox=document.getElementById(elInput);} @@ -51,7 +52,7 @@ else{oSelf._toggleContainer(false);} oSelf.dataReturnEvent.fire(oSelf,sQuery,aResults);};YAHOO.widget.AutoComplete.prototype._clearSelection=function(){var sValue=this._oTextbox.value;var sChar=(this.delimChar)?this.delimChar[0]:null;var nIndex=(sChar)?sValue.lastIndexOf(sChar,sValue.length-2):-1;if(nIndex>-1){this._oTextbox.value=sValue.substring(0,nIndex);} else{this._oTextbox.value="";} this._sSavedQuery=this._oTextbox.value;this.selectionEnforceEvent.fire(this);};YAHOO.widget.AutoComplete.prototype._textMatchesOption=function(){var foundMatch=false;for(var i=this._nDisplayedItems-1;i>=0;i--){var oItem=this._aListItems[i];var sMatch=oItem._sResultKey.toLowerCase();if(sMatch==this._sCurQuery.toLowerCase()){foundMatch=true;break;}} -return(foundMatch);};YAHOO.widget.AutoComplete.prototype._typeAhead=function(oItem,sQuery){if(!this.typeAhead){return;} +return(foundMatch);};YAHOO.widget.AutoComplete.prototype._typeAhead=function(oItem,sQuery){if(!this.typeAhead||(this._nKeyCode==8)){return;} var oTextbox=this._oTextbox;var sValue=this._oTextbox.value;if(!oTextbox.setSelectionRange&&!oTextbox.createTextRange){return;} var nStart=sValue.length;this._updateValue(oItem);var nEnd=oTextbox.value.length;this._selectText(oTextbox,nStart,nEnd);var sPrefill=oTextbox.value.substr(nStart,nEnd);this.typeAheadEvent.fire(this,sQuery,sPrefill);};YAHOO.widget.AutoComplete.prototype._selectText=function(oTextbox,nStart,nEnd){if(oTextbox.setSelectionRange){oTextbox.setSelectionRange(nStart,nEnd);} else if(oTextbox.createTextRange){var oTextRange=oTextbox.createTextRange();oTextRange.moveStart("character",nStart);oTextRange.moveEnd("character",nEnd-oTextbox.value.length);oTextRange.select();} diff --git a/lib/yui/autocomplete/autocomplete.js b/lib/yui/autocomplete/autocomplete.js index a5722cc58d..548fff1201 100755 --- a/lib/yui/autocomplete/autocomplete.js +++ b/lib/yui/autocomplete/autocomplete.js @@ -2,7 +2,7 @@ Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.txt -version: 0.12.0 +version: 0.12.1 */ /** @@ -33,12 +33,12 @@ version: 0.12.0 * * @class AutoComplete * @constructor - * @param elInput {HTMLElement} DOM element reference of an input field - * @param elInput {String} String ID of an input field - * @param elContainer {HTMLElement} DOM element reference of an existing DIV - * @param elContainer {String} String ID of an existing DIV - * @param oDataSource {Object} Instance of YAHOO.widget.DataSource for query/results - * @param oConfigs {Object} (optional) Object literal of configuration params + * @param elInput {HTMLElement} DOM element reference of an input field. + * @param elInput {String} String ID of an input field. + * @param elContainer {HTMLElement} DOM element reference of an existing DIV. + * @param elContainer {String} String ID of an existing DIV. + * @param oDataSource {Object} Instance of YAHOO.widget.DataSource for query/results. + * @param oConfigs {Object} (optional) Object literal of configuration params. */ YAHOO.widget.AutoComplete = function(elInput,elContainer,oDataSource,oConfigs) { if(elInput && elContainer && oDataSource) { @@ -134,7 +134,7 @@ YAHOO.widget.AutoComplete = function(elInput,elContainer,oDataSource,oConfigs) { this.selectionEnforceEvent = new YAHOO.util.CustomEvent("selectionEnforce", this); this.containerCollapseEvent = new YAHOO.util.CustomEvent("containerCollapse", this); this.textboxBlurEvent = new YAHOO.util.CustomEvent("textboxBlur", this); - + // Finish up oTextbox.setAttribute("autocomplete","off"); YAHOO.widget.AutoComplete._nIndex++; @@ -510,7 +510,7 @@ YAHOO.widget.AutoComplete.prototype.textboxKeyEvent = null; /** * Fired when the AutoComplete instance makes a query to the DataSource. - * + * * @event dataRequestEvent * @param oSelf {Object} The AutoComplete instance. * @param sQuery {String} The query string. @@ -548,7 +548,7 @@ YAHOO.widget.AutoComplete.prototype.containerExpandEvent = null; /** * Fired when the input field has been prefilled by the type-ahead - * feature. + * feature. * * @event typeAheadEvent * @param oSelf {Object} The AutoComplete instance. @@ -576,7 +576,7 @@ YAHOO.widget.AutoComplete.prototype.itemMouseOverEvent = null; YAHOO.widget.AutoComplete.prototype.itemMouseOutEvent = null; /** - * Fired when result item has been arrowed to. + * Fired when result item has been arrowed to. * * @event itemArrowToEvent * @param oSelf {Object} The AutoComplete instance. @@ -607,7 +607,7 @@ YAHOO.widget.AutoComplete.prototype.itemSelectEvent = null; /** * Fired when a user selection does not match any of the displayed result items. * Note that this event may not behave as expected when delimiter characters - * have been defined. + * have been defined. * * @event unmatchedItemSelectEvent * @param oSelf {Object} The AutoComplete instance. @@ -1265,7 +1265,7 @@ YAHOO.widget.AutoComplete.prototype._textMatchesOption = function() { */ YAHOO.widget.AutoComplete.prototype._typeAhead = function(oItem, sQuery) { // Don't update if turned off - if (!this.typeAhead) { + if (!this.typeAhead || (this._nKeyCode == 8)) { return; } @@ -1360,7 +1360,7 @@ YAHOO.widget.AutoComplete.prototype._toggleContainer = function(bShow) { if(this.alwaysShowContainer && this._bContainerOpen) { return; } - + // Clear contents of container if(!bShow) { this._oContainer._oContent.scrollTop = 0; @@ -2011,11 +2011,11 @@ YAHOO.widget.AutoComplete.prototype._onFormSubmit = function(v,oSelf) { * database. Supported data include local JavaScript arrays and objects and databases * accessible via XHR connections. Supported response formats include JavaScript arrays, * JSON, XML, and flat-file textual data. - * + * * @class DataSource * @constructor */ -YAHOO.widget.DataSource = function() { +YAHOO.widget.DataSource = function() { /* abstract class */ }; @@ -2131,10 +2131,10 @@ YAHOO.widget.DataSource.prototype.toString = function() { * @param oParent {Object} The object instance that has requested data. */ YAHOO.widget.DataSource.prototype.getResults = function(oCallbackFn, sQuery, oParent) { - + // First look in cache var aResults = this._doQueryCache(oCallbackFn,sQuery,oParent); - + // Not in cache, so get results from server if(aResults.length === 0) { this.queryEvent.fire(this, oParent, sQuery); @@ -2153,7 +2153,7 @@ YAHOO.widget.DataSource.prototype.getResults = function(oCallbackFn, sQuery, oPa * @param oParent {Object} The object instance that has requested data. */ YAHOO.widget.DataSource.prototype.doQuery = function(oCallbackFn, sQuery, oParent) { - /* override this */ + /* override this */ }; /** @@ -2207,7 +2207,7 @@ YAHOO.widget.DataSource.prototype.cacheQueryEvent = null; * @param aResults {Object[]} Array of result objects. */ YAHOO.widget.DataSource.prototype.getResultsEvent = null; - + /** * Fired when data is retrieved from the local cache. * @@ -2281,7 +2281,7 @@ YAHOO.widget.DataSource.prototype._aCache = null; /** * Initializes DataSource instance. - * + * * @method _init * @private */ @@ -2295,10 +2295,10 @@ YAHOO.widget.DataSource.prototype._init = function() { if(maxCacheEntries > 0 && !this._aCache) { this._aCache = []; } - + this._sName = "instance" + YAHOO.widget.DataSource._nIndex; YAHOO.widget.DataSource._nIndex++; - + this.queryEvent = new YAHOO.util.CustomEvent("query", this); this.cacheQueryEvent = new YAHOO.util.CustomEvent("cacheQuery", this); this.getResultsEvent = new YAHOO.util.CustomEvent("getResults", this); @@ -2308,9 +2308,9 @@ YAHOO.widget.DataSource.prototype._init = function() { }; /** - * Adds a result object to the local cache, evicting the oldest element if the + * Adds a result object to the local cache, evicting the oldest element if the * cache is full. Newer items will have higher indexes, the oldest item will have - * index of 0. + * index of 0. * * @method _addCacheElem * @param oResult {Object} Data result object, including array of results. @@ -2322,12 +2322,12 @@ YAHOO.widget.DataSource.prototype._addCacheElem = function(oResult) { if(!aCache || !oResult || !oResult.query || !oResult.results) { return; } - + // If the cache is full, make room by removing from index=0 if(aCache.length >= this.maxCacheEntries) { aCache.shift(); } - + // Add to cache, at the end of the array aCache.push(oResult); }; @@ -2335,14 +2335,14 @@ YAHOO.widget.DataSource.prototype._addCacheElem = function(oResult) { /** * Queries the local cache for results. If query has been cached, the callback * function is called with the results, and the cached is refreshed so that it - * is now the newest element. + * is now the newest element. * * @method _doQueryCache * @param oCallbackFn {HTMLFunction} Callback function defined by oParent object to which to return results. * @param sQuery {String} Query string. * @param oParent {Object} The object instance that has requested data. * @return aResults {Object[]} Array of results from local cache if found, otherwise null. - * @private + * @private */ YAHOO.widget.DataSource.prototype._doQueryCache = function(oCallbackFn, sQuery, oParent) { var aResults = []; @@ -2350,7 +2350,7 @@ YAHOO.widget.DataSource.prototype._doQueryCache = function(oCallbackFn, sQuery, var aCache = this._aCache; var nCacheLength = (aCache) ? aCache.length : 0; var bMatchContains = this.queryMatchContains; - + // If cache is enabled... if((this.maxCacheEntries > 0) && aCache && (nCacheLength > 0)) { this.cacheQueryEvent.fire(this, oParent, sQuery); @@ -2368,16 +2368,16 @@ YAHOO.widget.DataSource.prototype._doQueryCache = function(oCallbackFn, sQuery, var matchKey = (!this.queryMatchCase) ? encodeURIComponent(resultObj.query).toLowerCase(): encodeURIComponent(resultObj.query); - + // If a cached match key exactly matches the query... if(matchKey == sQuery) { // Stash all result objects into aResult[] and stop looping through the cache. bMatchFound = true; aResults = aAllResultItems; - + // The matching cache element was not the most recent, // so now we need to refresh the cache. - if(i != nCacheLength-1) { + if(i != nCacheLength-1) { // Remove element from its original location aCache.splice(i,1); // Add element as newest @@ -2390,18 +2390,18 @@ YAHOO.widget.DataSource.prototype._doQueryCache = function(oCallbackFn, sQuery, // Loop through substrings of each cached element's query property... for(var j = sQuery.length-1; j >= 0 ; j--) { var subQuery = sQuery.substr(0,j); - + // If a substring of a cached sQuery exactly matches the query... - if(matchKey == subQuery) { + if(matchKey == subQuery) { bMatchFound = true; - + // Go through each cached result object to match against the query... for(var k = aAllResultItems.length-1; k >= 0; k--) { var aRecord = aAllResultItems[k]; var sKeyIndex = (this.queryMatchCase) ? encodeURIComponent(aRecord[0]).indexOf(sQuery): encodeURIComponent(aRecord[0]).toLowerCase().indexOf(sQuery); - + // A STARTSWITH match is when the query is found at the beginning of the key string... if((!bMatchContains && (sKeyIndex === 0)) || // A CONTAINS match is when the query is found anywhere within the key string... @@ -2410,7 +2410,7 @@ YAHOO.widget.DataSource.prototype._doQueryCache = function(oCallbackFn, sQuery, aResults.unshift(aRecord); } } - + // Add the subset match result set object as the newest element to cache, // and stop looping through the cache. resultObj = {}; @@ -2425,7 +2425,7 @@ YAHOO.widget.DataSource.prototype._doQueryCache = function(oCallbackFn, sQuery, } } } - + // If there was a match, send along the results. if(bMatchFound) { this.getCachedResultsEvent.fire(this, oParent, sOrigQuery, aResults); @@ -2443,7 +2443,7 @@ YAHOO.widget.DataSource.prototype._doQueryCache = function(oCallbackFn, sQuery, /** * Implementation of YAHOO.widget.DataSource using XML HTTP requests that return * query results. - * + * * @class DS_XHR * @extends YAHOO.widget.DataSource * @requires connection @@ -2460,7 +2460,7 @@ YAHOO.widget.DS_XHR = function(sScriptURI, aSchema, oConfigs) { this[sConfig] = oConfigs[sConfig]; } } - + // Initialization sequence if(!aSchema || (aSchema.constructor != Array)) { return; @@ -2608,7 +2608,7 @@ YAHOO.widget.DS_XHR.prototype.responseStripAfter = "\n 0) { oCallback.timeout = this.connTimeout; } - + if(this._oConn) { this.connMgr.abort(this._oConn); } - + oSelf._oConn = this.connMgr.asyncRequest("GET", sUri, oCallback, null); }; /** * Parses raw response data into an array of result objects. The result data key - * is always stashed in the [0] element of each result object. + * is always stashed in the [0] element of each result object. * * @method parseResponse * @param sQuery {String} Query string. @@ -2774,7 +2774,7 @@ YAHOO.widget.DS_XHR.prototype.parseResponse = function(sQuery, oResponse, oParen if(jsonList.constructor != Array) { jsonList = [jsonList]; } - + // Loop through the array of all responses... for(var i = jsonList.length-1; i >= 0 ; i--) { var aResultItem = []; @@ -2857,7 +2857,7 @@ YAHOO.widget.DS_XHR.prototype.parseResponse = function(sQuery, oResponse, oParen else { return aResults; } -}; +}; ///////////////////////////////////////////////////////////////////////////// // @@ -2882,11 +2882,11 @@ YAHOO.widget.DS_XHR.prototype._oConn = null; /** * Implementation of YAHOO.widget.DataSource using a native Javascript function as * its live data source. - * + * * @class DS_JSFunction * @constructor * @extends YAHOO.widget.DataSource - * @param oFunction {String} In-memory Javascript function that returns query results as an array of objects. + * @param oFunction {HTMLFunction} In-memory Javascript function that returns query results as an array of objects. * @param oConfigs {Object} (optional) Object literal of config params. */ YAHOO.widget.DS_JSFunction = function(oFunction, oConfigs) { @@ -2932,7 +2932,7 @@ YAHOO.widget.DS_JSFunction.prototype.dataFunction = null; /** * Queries the live data source defined by function for results. Results are * passed back to a callback function. - * + * * @method doQuery * @param oCallbackFn {HTMLFunction} Callback function defined by oParent object to which to return results. * @param sQuery {String} Query string. @@ -2941,18 +2941,18 @@ YAHOO.widget.DS_JSFunction.prototype.dataFunction = null; YAHOO.widget.DS_JSFunction.prototype.doQuery = function(oCallbackFn, sQuery, oParent) { var oFunction = this.dataFunction; var aResults = []; - + aResults = oFunction(sQuery); if(aResults === null) { this.dataErrorEvent.fire(this, oParent, sQuery, YAHOO.widget.DataSource.ERROR_DATANULL); return; } - + var resultObj = {}; resultObj.query = decodeURIComponent(sQuery); resultObj.results = aResults; this._addCacheElem(resultObj); - + this.getResultsEvent.fire(this, oParent, sQuery, aResults); oCallbackFn(sQuery, aResults, oParent); return; diff --git a/lib/yui/calendar/README b/lib/yui/calendar/README index de02c14a02..eaeb49202c 100755 --- a/lib/yui/calendar/README +++ b/lib/yui/calendar/README @@ -1,107 +1,73 @@ Calendar Release Notes +*** version 0.12.1 *** + + - Calendar and CalendarGroup now automatically parse the argument passed to setMonth and setYear into an integer, eliminating potential concatenation bugs. + *** version 0.12 *** - New documentation format implemented - - Calendar2up and Calendar_Core are now deprecated. Now, Calendar alone - represents the single Calendar instance, and CalendarGroup represents an - n-up instance, defaulting to 2up - - Added semantic style classes to Calendar elements to allow for custom - styling solely using CSS. - - Remapped all configuration properties to use the Config object - (familiar to those who use the Container collection of controls). - Property names are the same as their previous counterparts, but wrapped - into Calendar.cfg, allowing for runtime reconfiguration of most - properties. + - Calendar2up and Calendar_Core are now deprecated. Now, Calendar alone represents the single Calendar instance, and CalendarGroup represents an n-up instance, defaulting to 2up + - Added semantic style classes to Calendar elements to allow for custom styling solely using CSS. + - Remapped all configuration properties to use the Config object (familiar to those who use the Container collection of controls). Property names are the same as their previous counterparts, but wrapped into Calendar.cfg, allowing for runtime reconfiguration of most properties - Added "title" property for setting the Calendar title - Added "close" property for enabling and disabling the close icon - - Added "iframe" property for enabling an iframe shim in Internet - Explorer 6 and below to fix the select bleed-through bug + - Added "iframe" property for enabling an iframe shim in Internet Explorer 6 and below to fix the select bleed-through bug - pageDate moved to property: "pagedate" - selectedDates moved to property: "selected" - - minDate moved to property : "mindate", which accepts a JavaScript Date - object like its predecessor, but also supports string dates - - maxDate moved to property : "maxdate", which accepts a JavaScript Date - object like its predecessor, but also supports string dates + - minDate moved to property : "mindate", which accepts a JavaScript Date object like its predecessor, but also supports string dates + - maxDate moved to property : "maxdate", which accepts a JavaScript Date object like its predecessor, but also supports string dates - Moved style declarations to initStyles function - - Optimized event handling in - doSelectCell/doCellMouseOver/doCellMouseOut by only attaching the - listener to the outer Calendar container, and only reacting to events on - cells with the "selectable" CSS class. - - Added domEventMap field for applying DOM event listeners to cells - containing specific class and tag combinations. + - Optimized event handling in doSelectCell/doCellMouseOver/doCellMouseOut by only attaching the listener to the outer Calendar container, and only reacting to events on cells with the "selectable" CSS class. + - Added domEventMap field for applying DOM event listeners to cells containing specific class and tag combinations. - Moved all cell DOM event attachment to applyListeners function - Added getDateByCellId / getDateFieldsByCellId helper functions - - Corrected DateMath.getWeekNumber to comply with ISO week number - handling - - Separated renderCellDefault style portions into styleCellDefault - function for easy extension - - Deprecated onBeforeSelect. Created beforeSelectEvent which - automatically subscribes to its deprecated predecessor. - - Deprecated onSelect. Created selectEvent, which automatically - subscribes to its deprecated predecessor. - - Deprecated onBeforeDeselect. Created beforeSelectEvent which - automatically subscribes to its deprecated predecessor. - - Deprecated onDeselect. Created beforeDeselectEvent, which - automatically subscribes to its deprecated predecessor. - - Deprecated onChangePage. Created changePageEvent, which automatically - subscribes to its deprecated predecessor. - - Deprecated onRender. Created renderEvent, which automatically - subscribes to its deprecated predecessor. - - Deprecated onReset. Created resetEvent, which automatically subscribes - to its deprecated predecessor. - - Deprecated onClear. Created clearEvent, which automatically subscribes - to its deprecated predecessor. + - Corrected DateMath.getWeekNumber to comply with ISO week number handling + - Separated renderCellDefault style portions into styleCellDefault function for easy extension + - Deprecated onBeforeSelect. Created beforeSelectEvent which automatically subscribes to its deprecated predecessor. + - Deprecated onSelect. Created selectEvent, which automatically subscribes to its deprecated predecessor. + - Deprecated onBeforeDeselect. Created beforeSelectEvent which automatically subscribes to its deprecated predecessor. + - Deprecated onDeselect. Created beforeDeselectEvent, which automatically subscribes to its deprecated predecessor. + - Deprecated onChangePage. Created changePageEvent, which automatically subscribes to its deprecated predecessor. + - Deprecated onRender. Created renderEvent, which automatically subscribes to its deprecated predecessor. + - Deprecated onReset. Created resetEvent, which automatically subscribes to its deprecated predecessor. + - Deprecated onClear. Created clearEvent, which automatically subscribes to its deprecated predecessor. - Corrected setMonth documentation to refer to 0-11 indexed months. - - Added show and hide methods to Calendar for setting the Calendar's - display property. - - Optimized internal render classes to use innerHTML and string buffers + - Added show and hide methods to Calendar for setting the Calendar's display property. + - Optimized internal render classes to use innerHTML and string buffers - Removed wireCustomEvents function - Removed wireDefaultEvents function - Removed doNextMonth / doPreviousMonth - - Removed all buildShell (header, body, footer) functions, since the - Calendar shell is now built dynamically on each render - - Wired all CalendarGroup events and configuration properties to be - properly delegated to Calendar - - Augmented CalendarGroup with all built-in renderers, label functions, - hide, show, and initStyles, creating API transparency between Calendar - and CalendarGroup. + - Removed all buildShell (header, body, footer) functions, since the Calendar shell is now built dynamically on each render + - Wired all CalendarGroup events and configuration properties to be properly delegated to Calendar + - Augmented CalendarGroup with all built-in renderers, label functions, hide, show, and initStyles, creating API transparency between Calendar and CalendarGroup. - Made all tagName, createElement, and entity references XHTML compliant - Fixed Daylight Saving Time bug for Brazilian time zone *** version 0.11.3 *** - - Calendar_Core: Added arguments for selected/deselected dates to - onSelect/onDeselect - - CalendarGroup: Fixed bug where selected dates passed to constructor - were not represented in selectedDates + - Calendar_Core: Added arguments for selected/deselected dates to onSelect/onDeselect + - CalendarGroup: Fixed bug where selected dates passed to constructor were not represented in selectedDates - Calendar2up: Now displays correctly in Opera 9 *** version 0.11.0 *** - DateMath: DateMath.add now properly adds weeks - DateMath: between() function added - - DateMath: getWeekNumber() fixed to take starting day of week into - account - - All references to Calendar's built in CSS class handlers are removed, - replaced with calls to Dom utility (addClass, removeClass) + - DateMath: getWeekNumber() fixed to take starting day of week into account + - All references to Calendar's built in CSS class handlers are removed, replaced with calls to Dom utility (addClass, removeClass) - Several CSS class constants now have clearer names - All CSS classes are now properly namespaced to avoid CSS conflicts - Fixed table:hover bug in CSS - - Calendar no longer requires the container ID and variable name to - match in order for month navigation to function properly - - Calendar month navigation arrows are now represented as background - images + - Calendar no longer requires the container ID and variable name to match in order for month navigation to function properly + - Calendar month navigation arrows are now represented as background images *** version 0.10.0 *** - - Major performance improvements from attaching DOM events to associated - table cells only once, when the Calendar shell is built - - DOM events for mouseover/mouseout are now fired for all browsers (not - just Internet Explorer) + - Major performance improvements from attaching DOM events to associated table cells only once, when the Calendar shell is built + - DOM events for mouseover/mouseout are now fired for all browsers (not just Internet Explorer) - Reset functionality bug fixed for 2-up Calendar view *** version 0.9.0 *** * Initial release - diff --git a/lib/yui/calendar/assets/calendar.css b/lib/yui/calendar/assets/calendar.css index 0723f9430f..79f0a3282e 100755 --- a/lib/yui/calendar/assets/calendar.css +++ b/lib/yui/calendar/assets/calendar.css @@ -2,7 +2,7 @@ Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt -Version 0.12 +version 0.12.1 */ .yui-calcontainer { @@ -78,7 +78,7 @@ Version 0.12 top:2px; bottom:0; width:9px; - height:12px; + height:12px; left:2px; z-index:1; } @@ -90,7 +90,7 @@ Version 0.12 top:2px; bottom:0; width:9px; - height:12px; + height:12px; right:2px; z-index:1; } diff --git a/lib/yui/calendar/calendar-debug.js b/lib/yui/calendar/calendar-debug.js index 3396980055..5fec1653cd 100755 --- a/lib/yui/calendar/calendar-debug.js +++ b/lib/yui/calendar/calendar-debug.js @@ -2,12 +2,13 @@ Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt -version 0.12.0 +version 0.12.1 */ /** * Config is a utility used within an Object to allow the implementer to maintain a list of local configuration properties and listen for changes to those properties dynamically using CustomEvent. The initial values are also maintained so that the configuration can be reset at any given point to its initial state. -* @class YAHOO.util.Config +* @namespace YAHOO.util +* @class Config * @constructor * @param {Object} owner The owner Object to which this Config Object belongs */ @@ -486,7 +487,8 @@ YAHOO.util.Config.alreadySubscribed = function(evt, fn, obj) { /** * YAHOO.widget.DateMath is used for simple date manipulation. The class is a static utility * used for adding, subtracting, and comparing dates. -* @class YAHOO.widget.DateMath +* @namespace YAHOO.widget +* @class DateMath */ YAHOO.widget.DateMath = { /** @@ -757,8 +759,8 @@ YAHOO.widget.DateMath = { /** * The Calendar component is a UI control that enables users to choose one or more dates from a graphical calendar presented in a one-month ("one-up") or two-month ("two-up") interface. Calendars are generated entirely via script and can be navigated without any page refreshes. -* @module Calendar -* @title Calendar Widget +* @module calendar +* @title Calendar * @namespace YAHOO.widget * @requires yahoo,dom,event */ @@ -1210,6 +1212,8 @@ YAHOO.widget.Calendar.prototype.doSelectCell = function(e, cal) { d = cal.cellDates[index]; date = new Date(d[0],d[1]-1,d[2]); + var link; + cal.logger.log("Selecting cell " + index + " via click", "info"); if (cal.Options.MULTI_SELECT) { @@ -3152,7 +3156,7 @@ YAHOO.widget.Calendar.prototype.clearAllBodyCellStyles = function(style) { */ YAHOO.widget.Calendar.prototype.setMonth = function(month) { var current = this.cfg.getProperty("pagedate"); - current.setMonth(month); + current.setMonth(parseInt(month, 10)); this.cfg.setProperty("pagedate", current); }; @@ -3163,7 +3167,7 @@ YAHOO.widget.Calendar.prototype.setMonth = function(month) { */ YAHOO.widget.Calendar.prototype.setYear = function(year) { var current = this.cfg.getProperty("pagedate"); - current.setFullYear(year); + current.setFullYear(parseInt(year, 10)); this.cfg.setProperty("pagedate", current); }; @@ -3878,11 +3882,13 @@ YAHOO.widget.CalendarGroup.prototype.constructChild = function(id,containerId,co /** * Sets the calendar group's month explicitly. This month will be set into the first -* @method setMonth * page of the multi-page calendar, and all other months will be iterated appropriately. +* @method setMonth * @param {Number} month The numeric month, from 0 (January) to 11 (December) */ YAHOO.widget.CalendarGroup.prototype.setMonth = function(month) { + month = parseInt(month, 10); + for (var p=0;p0){this.init(id,containerId,config);}};YAHOO.widget.CalendarGroup.prototype.init=function(id,containerId,config){this.initEvents();this.initStyles();this.pages=[];this.id=id;this.containerId=containerId;this.oDomContainer=document.getElementById(containerId);YAHOO.util.Dom.addClass(this.oDomContainer,YAHOO.widget.CalendarGroup.CSS_CONTAINER);YAHOO.util.Dom.addClass(this.oDomContainer,YAHOO.widget.CalendarGroup.CSS_MULTI_UP);this.cfg=new YAHOO.util.Config(this);this.Options={};this.Locale={};this.setupConfig();if(config){this.cfg.applyConfig(config,true);} this.cfg.fireQueue();if(this.browser=="opera"){var fixWidth=function(){var startW=this.oDomContainer.offsetWidth;var w=0;for(var p=0;p0){this.oDomContainer.style.width=w+"px";}};this.renderEvent.subscribe(fixWidth,this,true);}};YAHOO.widget.CalendarGroup.prototype.setupConfig=function(){this.cfg.addProperty("pages",{value:2,validator:this.cfg.checkNumber,handler:this.configPages});this.cfg.addProperty("pagedate",{value:new Date(),handler:this.configPageDate});this.cfg.addProperty("selected",{value:[],handler:this.delegateConfig});this.cfg.addProperty("title",{value:"",handler:this.configTitle});this.cfg.addProperty("close",{value:false,handler:this.configClose});this.cfg.addProperty("iframe",{value:true,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty("mindate",{value:null,handler:this.delegateConfig});this.cfg.addProperty("maxdate",{value:null,handler:this.delegateConfig});this.cfg.addProperty("MULTI_SELECT",{value:false,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty("START_WEEKDAY",{value:0,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty("SHOW_WEEKDAYS",{value:true,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty("SHOW_WEEK_HEADER",{value:false,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty("SHOW_WEEK_FOOTER",{value:false,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty("HIDE_BLANK_WEEKS",{value:false,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty("NAV_ARROW_LEFT",{value:YAHOO.widget.Calendar.IMG_ROOT+"us/tr/callt.gif",handler:this.delegateConfig});this.cfg.addProperty("NAV_ARROW_RIGHT",{value:YAHOO.widget.Calendar.IMG_ROOT+"us/tr/calrt.gif",handler:this.delegateConfig});this.cfg.addProperty("MONTHS_SHORT",{value:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],handler:this.delegateConfig});this.cfg.addProperty("MONTHS_LONG",{value:["January","February","March","April","May","June","July","August","September","October","November","December"],handler:this.delegateConfig});this.cfg.addProperty("WEEKDAYS_1CHAR",{value:["S","M","T","W","T","F","S"],handler:this.delegateConfig});this.cfg.addProperty("WEEKDAYS_SHORT",{value:["Su","Mo","Tu","We","Th","Fr","Sa"],handler:this.delegateConfig});this.cfg.addProperty("WEEKDAYS_MEDIUM",{value:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],handler:this.delegateConfig});this.cfg.addProperty("WEEKDAYS_LONG",{value:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],handler:this.delegateConfig});this.cfg.addProperty("LOCALE_MONTHS",{value:"long",handler:this.delegateConfig});this.cfg.addProperty("LOCALE_WEEKDAYS",{value:"short",handler:this.delegateConfig});this.cfg.addProperty("DATE_DELIMITER",{value:",",handler:this.delegateConfig});this.cfg.addProperty("DATE_FIELD_DELIMITER",{value:"/",handler:this.delegateConfig});this.cfg.addProperty("DATE_RANGE_DELIMITER",{value:"-",handler:this.delegateConfig});this.cfg.addProperty("MY_MONTH_POSITION",{value:1,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty("MY_YEAR_POSITION",{value:2,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty("MD_MONTH_POSITION",{value:1,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty("MD_DAY_POSITION",{value:2,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty("MDY_MONTH_POSITION",{value:1,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty("MDY_DAY_POSITION",{value:2,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty("MDY_YEAR_POSITION",{value:3,handler:this.delegateConfig,validator:this.cfg.checkNumber});};YAHOO.widget.CalendarGroup.prototype.initEvents=function(){var me=this;var sub=function(fn,obj,bOverride){for(var p=0;p0){year+=1;} +return new YAHOO.widget.Calendar(id,containerId,config);};YAHOO.widget.CalendarGroup.prototype.setMonth=function(month){month=parseInt(month,10);for(var p=0;p0){year+=1;} cal.setYear(year);}};YAHOO.widget.CalendarGroup.prototype.render=function(){this.renderHeader();for(var p=0;p

";this.body.innerHTML+=formHTML;form=this.element.getElementsByTagName("FORM")[0];} this.firstFormElement=function(){for(var f=0;f=0;f--){var el=form.elements[f];if(el.focus){if(el.type&&el.type!="hidden"){return el;}}} return null;}();this.form=form;if(this.cfg.getProperty("modal")&&this.form){var me=this;var firstElement=this.firstFormElement||this.firstButton;if(firstElement){this.preventBackTab=new YAHOO.util.KeyListener(firstElement,{shift:true,keys:9},{fn:me.focusLast,scope:me,correctScope:true});this.showEvent.subscribe(this.preventBackTab.enable,this.preventBackTab,true);this.hideEvent.subscribe(this.preventBackTab.disable,this.preventBackTab,true);} @@ -129,10 +131,10 @@ if(b==(buttons.length-1)){this.lastButton=button.htmlButton;}} this.setFooter(this.buttonSpan);this.cfg.refireEvent("iframe");this.cfg.refireEvent("underlay");}else{if(this.buttonSpan){if(this.buttonSpan.parentNode){this.buttonSpan.parentNode.removeChild(this.buttonSpan);} this.buttonSpan=null;this.firstButton=null;this.lastButton=null;this.defaultHtmlButton=null;}}};YAHOO.widget.Dialog.prototype.focusFirst=function(type,args,obj){if(args){var e=args[1];if(e){YAHOO.util.Event.stopEvent(e);}} if(this.firstFormElement){this.firstFormElement.focus();}else{this.focusDefaultButton();}};YAHOO.widget.Dialog.prototype.focusLast=function(type,args,obj){if(args){var e=args[1];if(e){YAHOO.util.Event.stopEvent(e);}} -var buttons=this.cfg.getProperty("buttons");if(buttons&&buttons instanceof Array){this.focusLastButton();}else{if(this.lastFormElement){this.lastFormElement.focus();}}};YAHOO.widget.Dialog.prototype.focusDefaultButton=function(){if(this.defaultHtmlButton){this.defaultHtmlButton.focus();}};YAHOO.widget.Dialog.prototype.blurButtons=function(){var buttons=this.cfg.getProperty("buttons");if(buttons&&buttons instanceof Array){var html=buttons[0].htmlButton;if(html){html.blur();}}};YAHOO.widget.Dialog.prototype.focusFirstButton=function(){var buttons=this.cfg.getProperty("buttons");if(buttons&&buttons instanceof Array){var html=buttons[0].htmlButton;if(html){html.focus();}}};YAHOO.widget.Dialog.prototype.focusLastButton=function(){var buttons=this.cfg.getProperty("buttons");if(buttons&&buttons instanceof Array){var html=buttons[buttons.length-1].htmlButton;if(html){html.focus();}}};YAHOO.widget.Dialog.prototype.validate=function(){return true;};YAHOO.widget.Dialog.prototype.submit=function(){if(this.validate()){this.beforeSubmitEvent.fire();this.doSubmit();this.submitEvent.fire();this.hide();return true;}else{return false;}};YAHOO.widget.Dialog.prototype.cancel=function(){this.cancelEvent.fire();this.hide();};YAHOO.widget.Dialog.prototype.getData=function(){var form=this.form;var data={};if(form){for(var i in this.form){var formItem=form[i];if(formItem){if(formItem.tagName){switch(formItem.tagName){case"INPUT":switch(formItem.type){case"checkbox":data[i]=formItem.checked;break;case"textbox":case"text":case"hidden":data[i]=formItem.value;break;} -break;case"TEXTAREA":data[i]=formItem.value;break;case"SELECT":var val=[];for(var x=0;xOR * @param {HTMLElement} el The element representing the Module @@ -556,6 +558,13 @@ YAHOO.widget.Module.CSS_FOOTER = "ft"; */ YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL = "javascript:false;"; +/** +* 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 +*/ +YAHOO.widget.Module.textResizeEvent = new YAHOO.util.CustomEvent("textResize"); + YAHOO.widget.Module.prototype = { /** * The class's constructor function @@ -913,15 +922,25 @@ YAHOO.widget.Module.prototype = { doc.close(); } - } - if(resizeMonitor && resizeMonitor.contentWindow) { + var fireTextResize = function() { + YAHOO.widget.Module.textResizeEvent.fire(); + }; + if(resizeMonitor && resizeMonitor.contentWindow) { this.resizeMonitor = resizeMonitor; - YAHOO.util.Event.addListener(this.resizeMonitor.contentWindow, "resize", this.onDomResize, this, true); + YAHOO.widget.Module.textResizeEvent.subscribe(this.onDomResize, this, true); + if (! YAHOO.widget.Module.textResizeInitialized) { + if (! YAHOO.util.Event.addListener(this.resizeMonitor.contentWindow, "resize", fireTextResize)) { + // This will fail in IE if document.domain has changed, so we must change the listener to + // use the resizeMonitor element instead + YAHOO.util.Event.addListener(this.resizeMonitor, "resize", fireTextResize); + } + YAHOO.widget.Module.textResizeInitialized = true; + } } } @@ -1132,8 +1151,11 @@ YAHOO.widget.Module.prototype = { * @method destroy */ destroy : function() { + var parent; + if (this.element) { - var parent = this.element.parentNode; + YAHOO.util.Event.purgeElement(this.element, true); + parent = this.element.parentNode; } if (parent) { parent.removeChild(this.element); @@ -1144,6 +1166,14 @@ YAHOO.widget.Module.prototype = { this.body = null; this.footer = null; + for (var e in this) { + if (e instanceof YAHOO.util.CustomEvent) { + e.unsubscribeAll(); + } + } + + YAHOO.widget.Module.textResizeEvent.unsubscribe(this.onDomResize, this); + this.destroyEvent.fire(); }, @@ -1215,8 +1245,8 @@ YAHOO.widget.Module.prototype.toString = function() { /** * Overlay is a Module that is absolutely positioned above the page flow. It has convenience methods for positioning and sizing, as well as options for controlling zIndex and constraining the Overlay's position to the current visible viewport. Overlay also contains a dynamicly generated IFRAME which is placed beneath it for Internet Explorer 6 and 5.x so that it will be properly rendered above SELECT elements. -* @class Overlay * @namespace YAHOO.widget +* @class Overlay * @extends YAHOO.widget.Module * @param {String} el The element ID representing the Overlay OR * @param {HTMLElement} el The element representing the Overlay @@ -1236,7 +1266,7 @@ YAHOO.extend(YAHOO.widget.Overlay, YAHOO.widget.Module); * @final * @type String */ -YAHOO.widget.Overlay.IFRAME_SRC = "javascript:false;" +YAHOO.widget.Overlay.IFRAME_SRC = "javascript:false;"; /** * Constant representing the top left corner of an element, used for configuring the context element alignment @@ -1784,7 +1814,7 @@ YAHOO.widget.Overlay.prototype.configIframe = function(type, args, obj) { if (! this.iframe) { this.iframe = document.createElement("iframe"); if (this.isSecure) { - this.iframe.src = this.imageRoot + YAHOO.widget.Overlay.IFRAME_SRC; + this.iframe.src = YAHOO.widget.Overlay.IFRAME_SRC; } var parent = this.element.parentNode; @@ -2047,6 +2077,9 @@ YAHOO.widget.Overlay.prototype.destroy = function() { this.iframe = null; + YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent, this); + YAHOO.widget.Overlay.windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent, this); + YAHOO.widget.Overlay.superclass.destroy.call(this); }; @@ -2985,18 +3018,22 @@ YAHOO.widget.Panel.prototype.init = function(el, userConfig) { var draggable = this.cfg.getProperty("draggable"); if (draggable) { if (! this.header) { - this.setHeader(" "); + this.setHeader(" "); } } }, this, true); var me = this; + var doBlur = function() { + this.blur(); + }; + this.showMaskEvent.subscribe(function() { var checkFocusable = function(el) { - if (el.tagName == "A" || el.tagName == "BUTTON" || el.tagName == "SELECT" || el.tagName == "INPUT" || el.tagName == "TEXTAREA" || el.tagName == "FORM") { + if ((el.tagName == "A" || el.tagName == "BUTTON" || el.tagName == "SELECT" || el.tagName == "INPUT" || el.tagName == "TEXTAREA" || el.tagName == "FORM") && el.type != "hidden") { if (! YAHOO.util.Dom.isAncestor(me.element, el)) { - YAHOO.util.Event.addListener(el, "focus", el.blur); + YAHOO.util.Event.addListener(el, "focus", doBlur, el, true); return true; } } else { @@ -3010,7 +3047,7 @@ YAHOO.widget.Panel.prototype.init = function(el, userConfig) { this.hideMaskEvent.subscribe(function() { for (var i=0;iOR * @param {HTMLElement} el The element representing the Module @@ -569,8 +571,14 @@ YAHOO.widget.Module.CSS_FOOTER = "ft"; */ YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL = "javascript:false;"; -YAHOO.widget.Module.prototype = { +/** +* 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 +*/ +YAHOO.widget.Module.textResizeEvent = new YAHOO.util.CustomEvent("textResize"); +YAHOO.widget.Module.prototype = { /** * The class's constructor function * @property contructor @@ -927,15 +935,25 @@ YAHOO.widget.Module.prototype = { doc.close(); } - } - if(resizeMonitor && resizeMonitor.contentWindow) { + var fireTextResize = function() { + YAHOO.widget.Module.textResizeEvent.fire(); + }; + if(resizeMonitor && resizeMonitor.contentWindow) { this.resizeMonitor = resizeMonitor; - YAHOO.util.Event.addListener(this.resizeMonitor.contentWindow, "resize", this.onDomResize, this, true); + YAHOO.widget.Module.textResizeEvent.subscribe(this.onDomResize, this, true); + if (! YAHOO.widget.Module.textResizeInitialized) { + if (! YAHOO.util.Event.addListener(this.resizeMonitor.contentWindow, "resize", fireTextResize)) { + // This will fail in IE if document.domain has changed, so we must change the listener to + // use the resizeMonitor element instead + YAHOO.util.Event.addListener(this.resizeMonitor, "resize", fireTextResize); + } + YAHOO.widget.Module.textResizeInitialized = true; + } } } @@ -1147,8 +1165,11 @@ YAHOO.widget.Module.prototype = { * @method destroy */ destroy : function() { + var parent; + if (this.element) { - var parent = this.element.parentNode; + YAHOO.util.Event.purgeElement(this.element, true); + parent = this.element.parentNode; } if (parent) { parent.removeChild(this.element); @@ -1159,6 +1180,14 @@ YAHOO.widget.Module.prototype = { this.body = null; this.footer = null; + for (var e in this) { + if (e instanceof YAHOO.util.CustomEvent) { + e.unsubscribeAll(); + } + } + + YAHOO.widget.Module.textResizeEvent.unsubscribe(this.onDomResize, this); + this.destroyEvent.fire(); }, @@ -1230,8 +1259,8 @@ YAHOO.widget.Module.prototype.toString = function() { /** * Overlay is a Module that is absolutely positioned above the page flow. It has convenience methods for positioning and sizing, as well as options for controlling zIndex and constraining the Overlay's position to the current visible viewport. Overlay also contains a dynamicly generated IFRAME which is placed beneath it for Internet Explorer 6 and 5.x so that it will be properly rendered above SELECT elements. -* @class Overlay * @namespace YAHOO.widget +* @class Overlay * @extends YAHOO.widget.Module * @param {String} el The element ID representing the Overlay OR * @param {HTMLElement} el The element representing the Overlay @@ -1251,7 +1280,7 @@ YAHOO.extend(YAHOO.widget.Overlay, YAHOO.widget.Module); * @final * @type String */ -YAHOO.widget.Overlay.IFRAME_SRC = "javascript:false;" +YAHOO.widget.Overlay.IFRAME_SRC = "javascript:false;"; /** * Constant representing the top left corner of an element, used for configuring the context element alignment @@ -1803,7 +1832,7 @@ YAHOO.widget.Overlay.prototype.configIframe = function(type, args, obj) { if (! this.iframe) { this.iframe = document.createElement("iframe"); if (this.isSecure) { - this.iframe.src = this.imageRoot + YAHOO.widget.Overlay.IFRAME_SRC; + this.iframe.src = YAHOO.widget.Overlay.IFRAME_SRC; } var parent = this.element.parentNode; @@ -2066,6 +2095,9 @@ YAHOO.widget.Overlay.prototype.destroy = function() { this.iframe = null; + YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent, this); + YAHOO.widget.Overlay.windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent, this); + YAHOO.widget.Overlay.superclass.destroy.call(this); }; @@ -2756,8 +2788,8 @@ YAHOO.widget.ContainerEffect.prototype.toString = function() { * A pre-configured ContainerEffect instance that can be used for fading an overlay in and out. * @method FADE * @static -* @param {Overlay} The Overlay object to animate -* @param {Number} The duration of the animation +* @param {Overlay} overlay The Overlay object to animate +* @param {Number} dur The duration of the animation * @return {ContainerEffect} The configured ContainerEffect object */ YAHOO.widget.ContainerEffect.FADE = function(overlay, dur) { @@ -2824,8 +2856,8 @@ YAHOO.widget.ContainerEffect.FADE = function(overlay, dur) { * A pre-configured ContainerEffect instance that can be used for sliding an overlay in and out. * @method SLIDE * @static -* @param {Overlay} The Overlay object to animate -* @param {Number} The duration of the animation +* @param {Overlay} overlay The Overlay object to animate +* @param {Number} dur The duration of the animation * @return {ContainerEffect} The configured ContainerEffect object */ YAHOO.widget.ContainerEffect.SLIDE = function(overlay, dur) { diff --git a/lib/yui/container/container_core-min.js b/lib/yui/container/container_core-min.js index fc368eeb68..9e6bce39cd 100755 --- a/lib/yui/container/container_core-min.js +++ b/lib/yui/container/container_core-min.js @@ -1,4 +1,4 @@ -/* Copyright (c) 2006, Yahoo! Inc. All rights reserved.Code licensed under the BSD License:http://developer.yahoo.net/yui/license.txt version: 0.12.0 */ +/* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt version 0.12.1 */ YAHOO.util.Config=function(owner){if(owner){this.init(owner);}};YAHOO.util.Config.prototype={owner:null,queueInProgress:false,checkBoolean:function(val){if(typeof val=='boolean'){return true;}else{return false;}},checkNumber:function(val){if(isNaN(val)){return false;}else{return true;}}};YAHOO.util.Config.prototype.init=function(owner){this.owner=owner;this.configChangedEvent=new YAHOO.util.CustomEvent("configChanged");this.queueInProgress=false;var config={};var initialConfig={};var eventQueue=[];var fireEvent=function(key,value){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){property.event.fire(value);}};this.addProperty=function(key,propertyObject){key=key.toLowerCase();config[key]=propertyObject;propertyObject.event=new YAHOO.util.CustomEvent(key);propertyObject.key=key;if(propertyObject.handler){propertyObject.event.subscribe(propertyObject.handler,this.owner,true);} this.setProperty(key,propertyObject.value,true);if(!propertyObject.suppressEvent){this.queueProperty(key,propertyObject.value);}};this.getConfig=function(){var cfg={};for(var prop in config){var property=config[prop];if(typeof property!='undefined'&&property.event){cfg[prop]=property.value;}} return cfg;};this.getProperty=function(key){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){return property.value;}else{return undefined;}};this.resetProperty=function(key){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){if(initialConfig[key]&&initialConfig[key]!='undefined'){this.setProperty(key,initialConfig[key]);} @@ -13,7 +13,7 @@ this.queueInProgress=false;eventQueue=[];};this.subscribeToConfigEvent=function( return true;}else{return false;}};this.unsubscribeFromConfigEvent=function(key,handler,obj){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){return property.event.unsubscribe(handler,obj);}else{return false;}};this.toString=function(){var output="Config";if(this.owner){output+=" ["+this.owner.toString()+"]";} return output;};this.outputEventQueue=function(){var output="";for(var q=0;qrightConstraint){x=rightConstraint;} if(ybottomConstraint){y=bottomConstraint;} this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.cfg.setProperty("xy",[x,y],true);};YAHOO.widget.Overlay.prototype.center=function(){var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;var viewPortWidth=YAHOO.util.Dom.getClientWidth();var viewPortHeight=YAHOO.util.Dom.getClientHeight();var elementWidth=this.element.offsetWidth;var elementHeight=this.element.offsetHeight;var x=(viewPortWidth/2)-(elementWidth/2)+scrollX;var y=(viewPortHeight/2)-(elementHeight/2)+scrollY;this.cfg.setProperty("xy",[parseInt(x,10),parseInt(y,10)]);this.cfg.refireEvent("iframe");};YAHOO.widget.Overlay.prototype.syncPosition=function(){var pos=YAHOO.util.Dom.getXY(this.element);this.cfg.setProperty("x",pos[0],true);this.cfg.setProperty("y",pos[1],true);this.cfg.setProperty("xy",pos,true);};YAHOO.widget.Overlay.prototype.onDomResize=function(e,obj){YAHOO.widget.Overlay.superclass.onDomResize.call(this,e,obj);var me=this;setTimeout(function(){me.syncPosition();me.cfg.refireEvent("iframe");me.cfg.refireEvent("context");},0);};YAHOO.widget.Overlay.prototype.destroy=function(){if(this.iframe){this.iframe.parentNode.removeChild(this.iframe);} -this.iframe=null;YAHOO.widget.Overlay.superclass.destroy.call(this);};YAHOO.widget.Overlay.prototype.toString=function(){return"Overlay "+this.id;};YAHOO.widget.Overlay.windowScrollEvent=new YAHOO.util.CustomEvent("windowScroll");YAHOO.widget.Overlay.windowResizeEvent=new YAHOO.util.CustomEvent("windowResize");YAHOO.widget.Overlay.windowScrollHandler=function(e){if(YAHOO.widget.Module.prototype.browser=="ie"||YAHOO.widget.Module.prototype.browser=="ie7"){if(!window.scrollEnd){window.scrollEnd=-1;} +this.iframe=null;YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent,this);YAHOO.widget.Overlay.windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent,this);YAHOO.widget.Overlay.superclass.destroy.call(this);};YAHOO.widget.Overlay.prototype.toString=function(){return"Overlay "+this.id;};YAHOO.widget.Overlay.windowScrollEvent=new YAHOO.util.CustomEvent("windowScroll");YAHOO.widget.Overlay.windowResizeEvent=new YAHOO.util.CustomEvent("windowResize");YAHOO.widget.Overlay.windowScrollHandler=function(e){if(YAHOO.widget.Module.prototype.browser=="ie"||YAHOO.widget.Module.prototype.browser=="ie7"){if(!window.scrollEnd){window.scrollEnd=-1;} clearTimeout(window.scrollEnd);window.scrollEnd=setTimeout(function(){YAHOO.widget.Overlay.windowScrollEvent.fire();},1);}else{YAHOO.widget.Overlay.windowScrollEvent.fire();}};YAHOO.widget.Overlay.windowResizeHandler=function(e){if(YAHOO.widget.Module.prototype.browser=="ie"||YAHOO.widget.Module.prototype.browser=="ie7"){if(!window.resizeEnd){window.resizeEnd=-1;} clearTimeout(window.resizeEnd);window.resizeEnd=setTimeout(function(){YAHOO.widget.Overlay.windowResizeEvent.fire();},100);}else{YAHOO.widget.Overlay.windowResizeEvent.fire();}};YAHOO.widget.Overlay._initialized=null;if(YAHOO.widget.Overlay._initialized===null){YAHOO.util.Event.addListener(window,"scroll",YAHOO.widget.Overlay.windowScrollHandler);YAHOO.util.Event.addListener(window,"resize",YAHOO.widget.Overlay.windowResizeHandler);YAHOO.widget.Overlay._initialized=true;} YAHOO.widget.OverlayManager=function(userConfig){this.init(userConfig);};YAHOO.widget.OverlayManager.CSS_FOCUSED="focused";YAHOO.widget.OverlayManager.prototype={constructor:YAHOO.widget.OverlayManager,overlays:null,initDefaultConfig:function(){this.cfg.addProperty("overlays",{suppressEvent:true});this.cfg.addProperty("focusevent",{value:"mousedown"});},init:function(userConfig){this.cfg=new YAHOO.util.Config(this);this.initDefaultConfig();if(userConfig){this.cfg.applyConfig(userConfig,true);} diff --git a/lib/yui/container/container_core.js b/lib/yui/container/container_core.js index 5041a96353..678421b95c 100755 --- a/lib/yui/container/container_core.js +++ b/lib/yui/container/container_core.js @@ -2,12 +2,13 @@ Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt -version 0.12.0 +version 0.12.1 */ /** * Config is a utility used within an Object to allow the implementer to maintain a list of local configuration properties and listen for changes to those properties dynamically using CustomEvent. The initial values are also maintained so that the configuration can be reset at any given point to its initial state. -* @class YAHOO.util.Config +* @namespace YAHOO.util +* @class Config * @constructor * @param {Object} owner The owner Object to which this Config Object belongs */ @@ -474,14 +475,15 @@ YAHOO.util.Config.alreadySubscribed = function(evt, fn, obj) { /** * The Container family of components is designed to enable developers to create different kinds of content-containing modules on the web. Module and Overlay are the most basic containers, and they can be used directly or extended to build custom containers. Also part of the Container family are four UI controls that extend Module and Overlay: Tooltip, Panel, Dialog, and SimpleDialog. -* @module Container +* @module container +* @title Container * @requires yahoo,dom,event,dragdrop,animation */ /** * Module is a JavaScript representation of the Standard Module Format. Standard Module Format is a simple standard for markup containers where child nodes representing the header, body, and footer of the content are denoted using the CSS classes "hd", "bd", and "ft" respectively. Module is the base class for all other classes in the YUI Container package. -* @class Module * @namespace YAHOO.widget +* @class Module * @constructor * @param {String} el The element ID representing the Module OR * @param {HTMLElement} el The element representing the Module @@ -556,6 +558,13 @@ YAHOO.widget.Module.CSS_FOOTER = "ft"; */ YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL = "javascript:false;"; +/** +* 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 +*/ +YAHOO.widget.Module.textResizeEvent = new YAHOO.util.CustomEvent("textResize"); + YAHOO.widget.Module.prototype = { /** * The class's constructor function @@ -913,15 +922,25 @@ YAHOO.widget.Module.prototype = { doc.close(); } - } - if(resizeMonitor && resizeMonitor.contentWindow) { + var fireTextResize = function() { + YAHOO.widget.Module.textResizeEvent.fire(); + }; + if(resizeMonitor && resizeMonitor.contentWindow) { this.resizeMonitor = resizeMonitor; - YAHOO.util.Event.addListener(this.resizeMonitor.contentWindow, "resize", this.onDomResize, this, true); + YAHOO.widget.Module.textResizeEvent.subscribe(this.onDomResize, this, true); + if (! YAHOO.widget.Module.textResizeInitialized) { + if (! YAHOO.util.Event.addListener(this.resizeMonitor.contentWindow, "resize", fireTextResize)) { + // This will fail in IE if document.domain has changed, so we must change the listener to + // use the resizeMonitor element instead + YAHOO.util.Event.addListener(this.resizeMonitor, "resize", fireTextResize); + } + YAHOO.widget.Module.textResizeInitialized = true; + } } } @@ -1132,8 +1151,11 @@ YAHOO.widget.Module.prototype = { * @method destroy */ destroy : function() { + var parent; + if (this.element) { - var parent = this.element.parentNode; + YAHOO.util.Event.purgeElement(this.element, true); + parent = this.element.parentNode; } if (parent) { parent.removeChild(this.element); @@ -1144,6 +1166,14 @@ YAHOO.widget.Module.prototype = { this.body = null; this.footer = null; + for (var e in this) { + if (e instanceof YAHOO.util.CustomEvent) { + e.unsubscribeAll(); + } + } + + YAHOO.widget.Module.textResizeEvent.unsubscribe(this.onDomResize, this); + this.destroyEvent.fire(); }, @@ -1215,8 +1245,8 @@ YAHOO.widget.Module.prototype.toString = function() { /** * Overlay is a Module that is absolutely positioned above the page flow. It has convenience methods for positioning and sizing, as well as options for controlling zIndex and constraining the Overlay's position to the current visible viewport. Overlay also contains a dynamicly generated IFRAME which is placed beneath it for Internet Explorer 6 and 5.x so that it will be properly rendered above SELECT elements. -* @class Overlay * @namespace YAHOO.widget +* @class Overlay * @extends YAHOO.widget.Module * @param {String} el The element ID representing the Overlay OR * @param {HTMLElement} el The element representing the Overlay @@ -1236,7 +1266,7 @@ YAHOO.extend(YAHOO.widget.Overlay, YAHOO.widget.Module); * @final * @type String */ -YAHOO.widget.Overlay.IFRAME_SRC = "javascript:false;" +YAHOO.widget.Overlay.IFRAME_SRC = "javascript:false;"; /** * Constant representing the top left corner of an element, used for configuring the context element alignment @@ -1784,7 +1814,7 @@ YAHOO.widget.Overlay.prototype.configIframe = function(type, args, obj) { if (! this.iframe) { this.iframe = document.createElement("iframe"); if (this.isSecure) { - this.iframe.src = this.imageRoot + YAHOO.widget.Overlay.IFRAME_SRC; + this.iframe.src = YAHOO.widget.Overlay.IFRAME_SRC; } var parent = this.element.parentNode; @@ -2047,6 +2077,9 @@ YAHOO.widget.Overlay.prototype.destroy = function() { this.iframe = null; + YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent, this); + YAHOO.widget.Overlay.windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent, this); + YAHOO.widget.Overlay.superclass.destroy.call(this); }; @@ -2729,8 +2762,8 @@ YAHOO.widget.ContainerEffect.prototype.toString = function() { * A pre-configured ContainerEffect instance that can be used for fading an overlay in and out. * @method FADE * @static -* @param {Overlay} The Overlay object to animate -* @param {Number} The duration of the animation +* @param {Overlay} overlay The Overlay object to animate +* @param {Number} dur The duration of the animation * @return {ContainerEffect} The configured ContainerEffect object */ YAHOO.widget.ContainerEffect.FADE = function(overlay, dur) { @@ -2797,8 +2830,8 @@ YAHOO.widget.ContainerEffect.FADE = function(overlay, dur) { * A pre-configured ContainerEffect instance that can be used for sliding an overlay in and out. * @method SLIDE * @static -* @param {Overlay} The Overlay object to animate -* @param {Number} The duration of the animation +* @param {Overlay} overlay The Overlay object to animate +* @param {Number} dur The duration of the animation * @return {ContainerEffect} The configured ContainerEffect object */ YAHOO.widget.ContainerEffect.SLIDE = function(overlay, dur) { diff --git a/lib/yui/dom/README b/lib/yui/dom/README index e7ec5f6e23..8beff84621 100755 --- a/lib/yui/dom/README +++ b/lib/yui/dom/README @@ -1,6 +1,12 @@ Dom Release Notes -*** version .12.0 *** +*** version 0.12.1 *** + +* getElementsByClassName no longer reverts to document when "root" not found +* setXY no longer makes a second call to getXY unless noRetry is false +* minified version no longer strips line breaks + +*** version 0.12.0 *** * fixed getXY for IE null parent * branching set/getStyle at load time instead of run time diff --git a/lib/yui/dom/dom-debug.js b/lib/yui/dom/dom-debug.js index b88a26138f..e41ad7f11b 100755 --- a/lib/yui/dom/dom-debug.js +++ b/lib/yui/dom/dom-debug.js @@ -2,7 +2,7 @@ Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt -version: 0.12.0 +version: 0.12.1 */ /** @@ -330,11 +330,14 @@ version: 0.12.0 if (pos[0] !== null) { el.style.left = pos[0] - pageXY[0] + delta[0] + 'px'; } if (pos[1] !== null) { el.style.top = pos[1] - pageXY[1] + delta[1] + 'px'; } - var newXY = this.getXY(el); + if (!noRetry) { + var newXY = this.getXY(el); - // if retry is true, try one more time if we miss - if (!noRetry && (newXY[0] != pos[0] || newXY[1] != pos[1]) ) { - this.setXY(el, pos, true); + // if retry is true, try one more time if we miss + if ( (pos[0] !== null && newXY[0] != pos[0]) || + (pos[1] !== null && newXY[1] != pos[1]) ) { + this.setXY(el, pos, true); + } } logger.log('setXY setting position to ' + pos, 'info', 'Dom'); @@ -609,9 +612,18 @@ version: 0.12.0 */ getElementsBy: function(method, tag, root) { tag = tag || '*'; - root = Y.Dom.get(root) || document; var nodes = []; + + if (root) { + root = Y.Dom.get(root); + if (!root) { // if no root node, then no children + return nodes; + } + } else { + root = document; + } + var elements = root.getElementsByTagName(tag); if ( !elements.length && (tag == '*' && root.all) ) { diff --git a/lib/yui/dom/dom-min.js b/lib/yui/dom/dom-min.js index 0f9d6ee4cf..1cbbc7aba5 100755 --- a/lib/yui/dom/dom-min.js +++ b/lib/yui/dom/dom-min.js @@ -1 +1,53 @@ -/* Copyright (c) 2006, Yahoo! Inc. All rights reserved.Code licensed under the BSD License:http://developer.yahoo.net/yui/license.txt version: 0.12.0 */(function(){var Y=YAHOO.util,getStyle,setStyle,id_counter=0,propertyCache={};var ua=navigator.userAgent.toLowerCase(),isOpera=(ua.indexOf('opera')>-1),isSafari=(ua.indexOf('safari')>-1),isGecko=(!isOpera&&!isSafari&&ua.indexOf('gecko')>-1),isIE=(!isOpera&&ua.indexOf('msie')>-1);var patterns={HYPHEN:/(-[a-z])/i};var toCamel=function(property){if(!patterns.HYPHEN.test(property)){return property;}if(propertyCache[property]){return propertyCache[property];}while(patterns.HYPHEN.exec(property)){property=property.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());}propertyCache[property]=property;return property;};if(document.defaultView&&document.defaultView.getComputedStyle){getStyle=function(el,property){var value=null;var computed=document.defaultView.getComputedStyle(el,'');if(computed){value=computed[toCamel(property)];}return el.style[property]||value;};}else if(document.documentElement.currentStyle&&isIE){getStyle=function(el,property){switch(toCamel(property)){case'opacity':var val=100;try{val=el.filters['DXImageTransform.Microsoft.Alpha'].opacity;}catch(e){try{val=el.filters('alpha').opacity;}catch(e){}}return val/100;break;default:var value=el.currentStyle?el.currentStyle[property]:null;return(el.style[property]||value);}};}else{getStyle=function(el,property){return el.style[property];};}if(isIE){setStyle=function(el,property,val){switch(property){case'opacity':if(typeof el.style.filter=='string'){el.style.filter='alpha(opacity='+val*100+')';if(!el.currentStyle||!el.currentStyle.hasLayout){el.style.zoom=1;}}break;default:el.style[property]=val;}};}else{setStyle=function(el,property,val){el.style[property]=val;};}YAHOO.util.Dom={get:function(el){if(!el){return null;}if(typeof el!='string'&&!(el instanceof Array)){return el;}if(typeof el=='string'){return document.getElementById(el);}else{var collection=[];for(var i=0,len=el.length;i=this.left&®ion.right<=this.right&®ion.top>=this.top&®ion.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(region){var t=Math.max(this.top,region.top);var r=Math.min(this.right,region.right);var b=Math.min(this.bottom,region.bottom);var l=Math.max(this.left,region.left);if(b>=t&&r>=l){return new YAHOO.util.Region(t,r,b,l);}else{return null;}};YAHOO.util.Region.prototype.union=function(region){var t=Math.min(this.top,region.top);var r=Math.max(this.right,region.right);var b=Math.max(this.bottom,region.bottom);var l=Math.min(this.left,region.left);return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}");};YAHOO.util.Region.getRegion=function(el){var p=YAHOO.util.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Point=function(x,y){if(x instanceof Array){y=x[1];x=x[0];}this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y;};YAHOO.util.Point.prototype=new YAHOO.util.Region(); \ No newline at end of file +/* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt version: 0.12.1 */ +(function(){var Y=YAHOO.util,getStyle,setStyle,id_counter=0,propertyCache={};var ua=navigator.userAgent.toLowerCase(),isOpera=(ua.indexOf('opera')>-1),isSafari=(ua.indexOf('safari')>-1),isGecko=(!isOpera&&!isSafari&&ua.indexOf('gecko')>-1),isIE=(!isOpera&&ua.indexOf('msie')>-1);var patterns={HYPHEN:/(-[a-z])/i};var toCamel=function(property){if(!patterns.HYPHEN.test(property)){return property;} +if(propertyCache[property]){return propertyCache[property];} +while(patterns.HYPHEN.exec(property)){property=property.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());} +propertyCache[property]=property;return property;};if(document.defaultView&&document.defaultView.getComputedStyle){getStyle=function(el,property){var value=null;var computed=document.defaultView.getComputedStyle(el,'');if(computed){value=computed[toCamel(property)];} +return el.style[property]||value;};}else if(document.documentElement.currentStyle&&isIE){getStyle=function(el,property){switch(toCamel(property)){case'opacity':var val=100;try{val=el.filters['DXImageTransform.Microsoft.Alpha'].opacity;}catch(e){try{val=el.filters('alpha').opacity;}catch(e){}} +return val/100;break;default:var value=el.currentStyle?el.currentStyle[property]:null;return(el.style[property]||value);}};}else{getStyle=function(el,property){return el.style[property];};} +if(isIE){setStyle=function(el,property,val){switch(property){case'opacity':if(typeof el.style.filter=='string'){el.style.filter='alpha(opacity='+val*100+')';if(!el.currentStyle||!el.currentStyle.hasLayout){el.style.zoom=1;}} +break;default:el.style[property]=val;}};}else{setStyle=function(el,property,val){el.style[property]=val;};} +YAHOO.util.Dom={get:function(el){if(!el){return null;} +if(typeof el!='string'&&!(el instanceof Array)){return el;} +if(typeof el=='string'){return document.getElementById(el);} +else{var collection=[];for(var i=0,len=el.length;i=this.left&®ion.right<=this.right&®ion.top>=this.top&®ion.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(region){var t=Math.max(this.top,region.top);var r=Math.min(this.right,region.right);var b=Math.min(this.bottom,region.bottom);var l=Math.max(this.left,region.left);if(b>=t&&r>=l){return new YAHOO.util.Region(t,r,b,l);}else{return null;}};YAHOO.util.Region.prototype.union=function(region){var t=Math.min(this.top,region.top);var r=Math.max(this.right,region.right);var b=Math.max(this.bottom,region.bottom);var l=Math.min(this.left,region.left);return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}");};YAHOO.util.Region.getRegion=function(el){var p=YAHOO.util.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Point=function(x,y){if(x instanceof Array){y=x[1];x=x[0];} +this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y;};YAHOO.util.Point.prototype=new YAHOO.util.Region(); \ No newline at end of file diff --git a/lib/yui/dom/dom.js b/lib/yui/dom/dom.js index 6f04c43166..a823018347 100755 --- a/lib/yui/dom/dom.js +++ b/lib/yui/dom/dom.js @@ -2,7 +2,7 @@ Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt -version: 0.12.0 +version: 0.12.1 */ /** @@ -317,11 +317,14 @@ version: 0.12.0 if (pos[0] !== null) { el.style.left = pos[0] - pageXY[0] + delta[0] + 'px'; } if (pos[1] !== null) { el.style.top = pos[1] - pageXY[1] + delta[1] + 'px'; } - var newXY = this.getXY(el); + if (!noRetry) { + var newXY = this.getXY(el); - // if retry is true, try one more time if we miss - if (!noRetry && (newXY[0] != pos[0] || newXY[1] != pos[1]) ) { - this.setXY(el, pos, true); + // if retry is true, try one more time if we miss + if ( (pos[0] !== null && newXY[0] != pos[0]) || + (pos[1] !== null && newXY[1] != pos[1]) ) { + this.setXY(el, pos, true); + } } }; @@ -583,9 +586,18 @@ version: 0.12.0 */ getElementsBy: function(method, tag, root) { tag = tag || '*'; - root = Y.Dom.get(root) || document; var nodes = []; + + if (root) { + root = Y.Dom.get(root); + if (!root) { // if no root node, then no children + return nodes; + } + } else { + root = document; + } + var elements = root.getElementsByTagName(tag); if ( !elements.length && (tag == '*' && root.all) ) { diff --git a/lib/yui/dragdrop/README b/lib/yui/dragdrop/README index c76e65cc44..763731b7fd 100755 --- a/lib/yui/dragdrop/README +++ b/lib/yui/dragdrop/README @@ -1,5 +1,15 @@ Drag and Drop Release Notes +0.12.1 + + * Added a STRICT_INTERSECT drag and drop interaction mode. This alters the + behavior of DDM::getBestMatch. INTERSECT mode first tests the cursor + location, and if it is over the target that target wins, otherwise it + tests the overlap of the elements. STRICT_INTERSECT mode tests only + the overlap, the largest overlap wins. + + * getBestMatch will work for targeted elements that have no overlap. + 0.12.0 * The logic to determine if a drag should be initiated has been isolated diff --git a/lib/yui/dragdrop/dragdrop-debug.js b/lib/yui/dragdrop/dragdrop-debug.js index e08f31d2b3..4ff7d68a4e 100755 --- a/lib/yui/dragdrop/dragdrop-debug.js +++ b/lib/yui/dragdrop/dragdrop-debug.js @@ -1,28 +1,27 @@ -/* +/* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt -version: 0.12.0 -*/ - +version: 0.12.1 +*/ (function() { -var Event=YAHOO.util.Event; +var Event=YAHOO.util.Event; var Dom=YAHOO.util.Dom; /** - * Defines the interface and base operation of items that that can be + * Defines the interface and base operation of items that that can be * dragged or can be drop targets. It was designed to be extended, overriding * the event handlers for startDrag, onDrag, onDragOver, onDragOut. * Up to three html elements can be associated with a DragDrop instance: *
    *
  • linked element: the element that is passed into the constructor. - * This is the element which defines the boundaries for interaction with + * This is the element which defines the boundaries for interaction with * other DragDrop objects.
  • - *
  • handle element(s): The drag operation only occurs if the element that - * was clicked matches a handle element. By default this is the linked - * element, but there are times that you will want only a portion of the - * linked element to initiate the drag operation, and the setHandleElId() + *
  • handle element(s): The drag operation only occurs if the element that + * was clicked matches a handle element. By default this is the linked + * element, but there are times that you will want only a portion of the + * linked element to initiate the drag operation, and the setHandleElId() * method provides a way to define this.
  • *
  • drag element: this represents an the element that would be moved along * with the cursor during a drag operation. By default, this is the linked @@ -32,14 +31,14 @@ var Dom=YAHOO.util.Dom; *
* This class should not be instantiated until the onload event to ensure that * the associated elements are available. - * The following would define a DragDrop obj that would interact with any + * The following would define a DragDrop obj that would interact with any * other DragDrop obj in the "group1" group: *
  *  dd = new YAHOO.util.DragDrop("div1", "group1");
  * 
- * Since none of the event handlers have been implemented, nothing would - * actually happen if you were to run the code above. Normally you would - * override this class or one of the default implementations, but you can + * Since none of the event handlers have been implemented, nothing would + * actually happen if you were to run the code above. Normally you would + * override this class or one of the default implementations, but you can * also override the methods you want on an instance of the class... *
  *  dd.onDragDrop = function(e, id) {
@@ -52,21 +51,21 @@ var Dom=YAHOO.util.Dom;
  * @param {String} id of the element that is linked to this instance
  * @param {String} sGroup the group of related DragDrop objects
  * @param {object} config an object containing configurable attributes
- *                Valid properties for DragDrop:
- *                    padding, isTarget, maintainOffset, primaryButtonOnly
+ *                Valid properties for DragDrop: 
+ *                    padding, isTarget, maintainOffset, primaryButtonOnly,
  */
 YAHOO.util.DragDrop = function(id, sGroup, config) {
     if (id) {
-        this.init(id, sGroup, config);
+        this.init(id, sGroup, config); 
     }
 };
 
 YAHOO.util.DragDrop.prototype = {
 
     /**
-     * The id of the element associated with this object.  This is what we
-     * refer to as the "linked element" because the size and position of
-     * this element is used to determine when the drag and drop objects have
+     * The id of the element associated with this object.  This is what we 
+     * refer to as the "linked element" because the size and position of 
+     * this element is used to determine when the drag and drop objects have 
      * interacted.
      * @property id
      * @type String
@@ -81,39 +80,39 @@ YAHOO.util.DragDrop.prototype = {
     config: null,
 
     /**
-     * The id of the element that will be dragged.  By default this is same
-     * as the linked element , but could be changed to another element. Ex:
+     * The id of the element that will be dragged.  By default this is same 
+     * as the linked element , but could be changed to another element. Ex: 
      * YAHOO.util.DDProxy
      * @property dragElId
      * @type String
      * @private
      */
-    dragElId: null,
+    dragElId: null, 
 
     /**
-     * the id of the element that initiates the drag operation.  By default
+     * the id of the element that initiates the drag operation.  By default 
      * this is the linked element, but could be changed to be a child of this
-     * element.  This lets us do things like only starting the drag when the
+     * element.  This lets us do things like only starting the drag when the 
      * header element within the linked html element is clicked.
      * @property handleElId
      * @type String
      * @private
      */
-    handleElId: null,
+    handleElId: null, 
 
     /**
      * An associative array of HTML tags that will be ignored if clicked.
      * @property invalidHandleTypes
      * @type {string: string}
      */
-    invalidHandleTypes: null,
+    invalidHandleTypes: null, 
 
     /**
      * An associative array of ids for elements that will be ignored if clicked
      * @property invalidHandleIds
      * @type {string: string}
      */
-    invalidHandleIds: null,
+    invalidHandleIds: null, 
 
     /**
      * An indexted array of css class names for elements that will be ignored
@@ -121,10 +120,10 @@ YAHOO.util.DragDrop.prototype = {
      * @property invalidHandleClasses
      * @type string[]
      */
-    invalidHandleClasses: null,
+    invalidHandleClasses: null, 
 
     /**
-     * The linked element's absolute X position at the time the drag was
+     * The linked element's absolute X position at the time the drag was 
      * started
      * @property startPageX
      * @type int
@@ -133,7 +132,7 @@ YAHOO.util.DragDrop.prototype = {
     startPageX: 0,
 
     /**
-     * The linked element's absolute X position at the time the drag was
+     * The linked element's absolute X position at the time the drag was 
      * started
      * @property startPageY
      * @type int
@@ -142,9 +141,9 @@ YAHOO.util.DragDrop.prototype = {
     startPageY: 0,
 
     /**
-     * The group defines a logical collection of DragDrop objects that are
-     * related.  Instances only get events when interacting with other
-     * DragDrop object in the same group.  This lets us define multiple
+     * The group defines a logical collection of DragDrop objects that are 
+     * related.  Instances only get events when interacting with other 
+     * DragDrop object in the same group.  This lets us define multiple 
      * groups using a single DragDrop subclass if we want.
      * @property groups
      * @type {string: string}
@@ -152,7 +151,7 @@ YAHOO.util.DragDrop.prototype = {
     groups: null,
 
     /**
-     * Individual drag/drop instances can be locked.  This will prevent
+     * Individual drag/drop instances can be locked.  This will prevent 
      * onmousedown start drag.
      * @property locked
      * @type boolean
@@ -235,7 +234,7 @@ YAHOO.util.DragDrop.prototype = {
     maxX: 0,
 
     /**
-     * The up constraint
+     * The up constraint 
      * @property minY
      * @type int
      * @type int
@@ -244,7 +243,7 @@ YAHOO.util.DragDrop.prototype = {
     minY: 0,
 
     /**
-     * The down constraint
+     * The down constraint 
      * @property maxY
      * @type int
      * @private
@@ -262,7 +261,7 @@ YAHOO.util.DragDrop.prototype = {
     maintainOffset: false,
 
     /**
-     * Array of pixel locations the element will snap to if we specified a
+     * Array of pixel locations the element will snap to if we specified a 
      * horizontal graduation/interval.  This array is generated automatically
      * when you define a tick interval.
      * @property xTicks
@@ -271,8 +270,8 @@ YAHOO.util.DragDrop.prototype = {
     xTicks: null,
 
     /**
-     * Array of pixel locations the element will snap to if we specified a
-     * vertical graduation/interval.  This array is generated automatically
+     * Array of pixel locations the element will snap to if we specified a 
+     * vertical graduation/interval.  This array is generated automatically 
      * when you define a tick interval.
      * @property yTicks
      * @type int[]
@@ -333,7 +332,7 @@ YAHOO.util.DragDrop.prototype = {
     b4Drag: function(e) { },
 
     /**
-     * Abstract method called during the onMouseMove event while dragging an
+     * Abstract method called during the onMouseMove event while dragging an 
      * object.
      * @method onDrag
      * @param {Event} e the mousemove event
@@ -341,12 +340,12 @@ YAHOO.util.DragDrop.prototype = {
     onDrag: function(e) { /* override this */ },
 
     /**
-     * Abstract method called when this element fist begins hovering over
+     * Abstract method called when this element fist begins hovering over 
      * another DragDrop obj
      * @method onDragEnter
      * @param {Event} e the mousemove event
      * @param {String|DragDrop[]} id In POINT mode, the element
-     * id this is hovering over.  In INTERSECT mode, an array of one or more
+     * id this is hovering over.  In INTERSECT mode, an array of one or more 
      * dragdrop items being hovered over.
      */
     onDragEnter: function(e, id) { /* override this */ },
@@ -359,12 +358,12 @@ YAHOO.util.DragDrop.prototype = {
     b4DragOver: function(e) { },
 
     /**
-     * Abstract method called when this element is hovering over another
+     * Abstract method called when this element is hovering over another 
      * DragDrop obj
      * @method onDragOver
      * @param {Event} e the mousemove event
      * @param {String|DragDrop[]} id In POINT mode, the element
-     * id this is hovering over.  In INTERSECT mode, an array of dd items
+     * id this is hovering over.  In INTERSECT mode, an array of dd items 
      * being hovered over.
      */
     onDragOver: function(e, id) { /* override this */ },
@@ -381,7 +380,7 @@ YAHOO.util.DragDrop.prototype = {
      * @method onDragOut
      * @param {Event} e the mousemove event
      * @param {String|DragDrop[]} id In POINT mode, the element
-     * id this was hovering over.  In INTERSECT mode, an array of dd items
+     * id this was hovering over.  In INTERSECT mode, an array of dd items 
      * that the mouse is no longer over.
      */
     onDragOut: function(e, id) { /* override this */ },
@@ -394,12 +393,12 @@ YAHOO.util.DragDrop.prototype = {
     b4DragDrop: function(e) { },
 
     /**
-     * Abstract method called when this item is dropped on another DragDrop
+     * Abstract method called when this item is dropped on another DragDrop 
      * obj
      * @method onDragDrop
      * @param {Event} e the mouseup event
      * @param {String|DragDrop[]} id In POINT mode, the element
-     * id this was dropped on.  In INTERSECT mode, an array of dd items this
+     * id this was dropped on.  In INTERSECT mode, an array of dd items this 
      * was dropped on.
      */
     onDragDrop: function(e, id) { /* override this */ },
@@ -447,24 +446,24 @@ YAHOO.util.DragDrop.prototype = {
      * @param {Event} e the mouseup event
      */
     onMouseUp: function(e) { /* override this */ },
-
+   
     /**
      * Override the onAvailable method to do what is needed after the initial
      * position was determined.
      * @method onAvailable
      */
-    onAvailable: function () {
-        this.logger.log("onAvailable (base)");
+    onAvailable: function () { 
+        this.logger.log("onAvailable (base)"); 
     },
 
     /**
      * Returns a reference to the linked element
      * @method getEl
-     * @return {HTMLElement} the html element
+     * @return {HTMLElement} the html element 
      */
-    getEl: function() {
+    getEl: function() { 
         if (!this._domRef) {
-            this._domRef = Dom.get(this.id);
+            this._domRef = Dom.get(this.id); 
         }
 
         return this._domRef;
@@ -472,10 +471,10 @@ YAHOO.util.DragDrop.prototype = {
 
     /**
      * Returns a reference to the actual element to drag.  By default this is
-     * the same as the html element, but it can be assigned to another
+     * the same as the html element, but it can be assigned to another 
      * element. An example of this can be found in YAHOO.util.DDProxy
      * @method getDragEl
-     * @return {HTMLElement} the html element
+     * @return {HTMLElement} the html element 
      */
     getDragEl: function() {
         return Dom.get(this.dragElId);
@@ -505,7 +504,7 @@ YAHOO.util.DragDrop.prototype = {
      */
     initTarget: function(id, sGroup, config) {
 
-        // configuration attributes
+        // configuration attributes 
         this.config = config || {};
 
         // create a local reference to the drag and drop manager
@@ -533,13 +532,13 @@ YAHOO.util.DragDrop.prototype = {
         Event.onAvailable(id, this.handleOnAvailable, this, true);
 
         // create a logger instance
-        this.logger = (YAHOO.widget.LogWriter) ?
+        this.logger = (YAHOO.widget.LogWriter) ? 
                 new YAHOO.widget.LogWriter(this.toString()) : YAHOO;
 
         // the linked element is the element that gets dragged by default
-        this.setDragElId(id);
+        this.setDragElId(id); 
 
-        // by default, clicked anchors will not start drag operations.
+        // by default, clicked anchors will not start drag operations. 
         // @TODO what else should be here?  Probably form fields.
         this.invalidHandleTypes = { A: "A" };
         this.invalidHandleIds = {};
@@ -551,14 +550,14 @@ YAHOO.util.DragDrop.prototype = {
     /**
      * Applies the configuration parameters that were passed into the constructor.
      * This is supposed to happen at each level through the inheritance chain.  So
-     * a DDProxy implentation will execute apply config on DDProxy, DD, and
+     * a DDProxy implentation will execute apply config on DDProxy, DD, and 
      * DragDrop in order to get all of the parameters that are available in
      * each object.
      * @method applyConfig
      */
     applyConfig: function() {
 
-        // configurable properties:
+        // configurable properties: 
         //    padding, isTarget, maintainOffset, primaryButtonOnly
         this.padding           = this.config.padding || [0, 0, 0, 0];
         this.isTarget          = (this.config.isTarget !== false);
@@ -581,7 +580,7 @@ YAHOO.util.DragDrop.prototype = {
 
      /**
      * Configures the padding for the target zone in px.  Effectively expands
-     * (or reduces) the virtual object size for targeting calculations.
+     * (or reduces) the virtual object size for targeting calculations.  
      * Supports css-style shorthand; if only one parameter is passed, all sides
      * will have that padding, and if only two are passed, the top and bottom
      * will have the first param, the left and right the second.
@@ -627,7 +626,7 @@ YAHOO.util.DragDrop.prototype = {
         this.lastPageX = p[0];
         this.lastPageY = p[1];
 
-        this.logger.log(this.id + " inital position: " + this.initPageX +
+        this.logger.log(this.id + " inital position: " + this.initPageX + 
                 ", " + this.initPageY);
 
 
@@ -643,6 +642,7 @@ YAHOO.util.DragDrop.prototype = {
      */
     setStartPosition: function(pos) {
         var p = pos || Dom.getXY( this.getEl() );
+
         this.deltaSetXY = null;
 
         this.startPageX = p[0];
@@ -650,8 +650,8 @@ YAHOO.util.DragDrop.prototype = {
     },
 
     /**
-     * Add this instance to a group of related drag/drop objects.  All
-     * instances belong to at least one group, and can belong to as many
+     * Add this instance to a group of related drag/drop objects.  All 
+     * instances belong to at least one group, and can belong to as many 
      * groups as needed.
      * @method addToGroup
      * @param sGroup {string} the name of the group
@@ -676,7 +676,7 @@ YAHOO.util.DragDrop.prototype = {
     },
 
     /**
-     * Allows you to specify that an element other than the linked element
+     * Allows you to specify that an element other than the linked element 
      * will be moved with the cursor during a drag
      * @method setDragElId
      * @param id {string} the id of the element that will be used to initiate the drag
@@ -686,14 +686,14 @@ YAHOO.util.DragDrop.prototype = {
     },
 
     /**
-     * Allows you to specify a child of the linked element that should be
-     * used to initiate the drag operation.  An example of this would be if
-     * you have a content div with text and links.  Clicking anywhere in the
+     * Allows you to specify a child of the linked element that should be 
+     * used to initiate the drag operation.  An example of this would be if 
+     * you have a content div with text and links.  Clicking anywhere in the 
      * content area would normally start the drag operation.  Use this method
-     * to specify that an element inside of the content div is the element
+     * to specify that an element inside of the content div is the element 
      * that starts the drag operation.
      * @method setHandleElId
-     * @param id {string} the id of the element that will be used to
+     * @param id {string} the id of the element that will be used to 
      * initiate the drag.
      */
     setHandleElId: function(id) {
@@ -706,7 +706,7 @@ YAHOO.util.DragDrop.prototype = {
     },
 
     /**
-     * Allows you to set an element outside of the linked element as a drag
+     * Allows you to set an element outside of the linked element as a drag 
      * handle
      * @method setOuterHandleElId
      * @param id the id of the element that will be used to initiate the drag
@@ -717,7 +717,7 @@ YAHOO.util.DragDrop.prototype = {
             id = Dom.generateId(id);
         }
         this.logger.log("Adding outer handle event: " + id);
-        Event.on(id, "mousedown",
+        Event.on(id, "mousedown", 
                 this.handleMouseDown, this, true);
         this.setHandleElId(id);
 
@@ -730,7 +730,7 @@ YAHOO.util.DragDrop.prototype = {
      */
     unreg: function() {
         this.logger.log("DragDrop obj cleanup " + this.id);
-        Event.removeListener(this.id, "mousedown",
+        Event.removeListener(this.id, "mousedown", 
                 this.handleMouseDown);
         this._domRef = null;
         this.DDM._remove(this);
@@ -740,7 +740,7 @@ YAHOO.util.DragDrop.prototype = {
      * Returns true if this instance is locked, or the drag drop mgr is locked
      * (meaning that all drag/drop is disabled on the page.)
      * @method isLocked
-     * @return {boolean} true if this obj or all drag/drop is locked, else
+     * @return {boolean} true if this obj or all drag/drop is locked, else 
      * false
      */
     isLocked: function() {
@@ -750,7 +750,7 @@ YAHOO.util.DragDrop.prototype = {
     /**
      * Fired when this object is clicked
      * @method handleMouseDown
-     * @param {Event} e
+     * @param {Event} e 
      * @param {YAHOO.util.DragDrop} oDD the clicked dd object (this dd obj)
      * @private
      */
@@ -774,12 +774,12 @@ YAHOO.util.DragDrop.prototype = {
         // var self = this;
         // setTimeout( function() { self.DDM.refreshCache(self.groups); }, 0);
 
-        // Only process the event if we really clicked within the linked
-        // element.  The reason we make this check is that in the case that
-        // another element was moved between the clicked element and the
-        // cursor in the time between the mousedown and mouseup events. When
-        // this happens, the element gets the next mousedown event
-        // regardless of where on the screen it happened.
+        // Only process the event if we really clicked within the linked 
+        // element.  The reason we make this check is that in the case that 
+        // another element was moved between the clicked element and the 
+        // cursor in the time between the mousedown and mouseup events. When 
+        // this happens, the element gets the next mousedown event 
+        // regardless of where on the screen it happened.  
         var pt = new YAHOO.util.Point(Event.getPageX(e), Event.getPageY(e));
         if (!this.hasOuterHandles && !this.DDM.isOverTarget(pt, this) )  {
                 this.logger.log("Click was not over the element: " + this.id);
@@ -809,7 +809,7 @@ this.logger.log("clickValidator returned false, drag not initiated");
     clickValidator: function(e) {
         var target = Event.getTarget(e);
         return ( this.isValidHandleChild(target) &&
-                    (this.id == this.handleElId ||
+                    (this.id == this.handleElId || 
                         this.DDM.handleWasClicked(target, this.id)) );
     },
 
@@ -859,7 +859,7 @@ this.logger.log("clickValidator returned false, drag not initiated");
         // this.invalidHandleTypes[type] = null;
         delete this.invalidHandleTypes[type];
     },
-
+    
     /**
      * Unsets an invalid handle id
      * @method removeInvalidHandleId
@@ -876,7 +876,7 @@ this.logger.log("clickValidator returned false, drag not initiated");
     /**
      * Unsets an invalid css class
      * @method removeInvalidHandleClass
-     * @param {string} cssClass the class of the element(s) you wish to
+     * @param {string} cssClass the class of the element(s) you wish to 
      * re-enable
      */
     removeInvalidHandleClass: function(cssClass) {
@@ -925,7 +925,7 @@ this.logger.log("clickValidator returned false, drag not initiated");
     setXTicks: function(iStartX, iTickSize) {
         this.xTicks = [];
         this.xTickSize = iTickSize;
-
+        
         var tickMap = {};
 
         for (var i = this.initPageX; i >= this.minX; i = i - iTickSize) {
@@ -947,7 +947,7 @@ this.logger.log("clickValidator returned false, drag not initiated");
     },
 
     /**
-     * Create the array of vertical tick marks if an interval was specified in
+     * Create the array of vertical tick marks if an interval was specified in 
      * setYConstraint().
      * @method setYTicks
      * @private
@@ -979,14 +979,14 @@ this.logger.log("clickValidator returned false, drag not initiated");
     },
 
     /**
-     * By default, the element can be dragged any place on the screen.  Use
-     * this method to limit the horizontal travel of the element.  Pass in
+     * By default, the element can be dragged any place on the screen.  Use 
+     * this method to limit the horizontal travel of the element.  Pass in 
      * 0,0 for the parameters if you want to lock the drag to the y axis.
      * @method setXConstraint
      * @param {int} iLeft the number of pixels the element can move to the left
-     * @param {int} iRight the number of pixels the element can move to the
+     * @param {int} iRight the number of pixels the element can move to the 
      * right
-     * @param {int} iTickSize optional parameter for specifying that the
+     * @param {int} iTickSize optional parameter for specifying that the 
      * element
      * should move iTickSize pixels at a time.
      */
@@ -999,7 +999,7 @@ this.logger.log("clickValidator returned false, drag not initiated");
         if (iTickSize) { this.setXTicks(this.initPageX, iTickSize); }
 
         this.constrainX = true;
-        this.logger.log("initPageX:" + this.initPageX + " minX:" + this.minX +
+        this.logger.log("initPageX:" + this.initPageX + " minX:" + this.minX + 
                 " maxX:" + this.maxX);
     },
 
@@ -1028,13 +1028,13 @@ this.logger.log("clickValidator returned false, drag not initiated");
     },
 
     /**
-     * By default, the element can be dragged any place on the screen.  Set
+     * By default, the element can be dragged any place on the screen.  Set 
      * this to limit the vertical travel of the element.  Pass in 0,0 for the
      * parameters if you want to lock the drag to the x axis.
      * @method setYConstraint
      * @param {int} iUp the number of pixels the element can move up
      * @param {int} iDown the number of pixels the element can move down
-     * @param {int} iTickSize optional parameter for specifying that the
+     * @param {int} iTickSize optional parameter for specifying that the 
      * element should move iTickSize pixels at a time.
      */
     setYConstraint: function(iUp, iDown, iTickSize) {
@@ -1047,8 +1047,8 @@ this.logger.log("clickValidator returned false, drag not initiated");
         if (iTickSize) { this.setYTicks(this.initPageY, iTickSize); }
 
         this.constrainY = true;
-
-        this.logger.log("initPageY:" + this.initPageY + " minY:" + this.minY +
+        
+        this.logger.log("initPageY:" + this.initPageY + " minY:" + this.minY + 
                 " maxY:" + this.maxY);
     },
 
@@ -1063,9 +1063,9 @@ this.logger.log("clickValidator returned false, drag not initiated");
 
         // Maintain offsets if necessary
         if (this.initPageX || this.initPageX === 0) {
-            this.logger.log("init pagexy: " + this.initPageX + ", " +
+            this.logger.log("init pagexy: " + this.initPageX + ", " + 
                                this.initPageY);
-            this.logger.log("last pagexy: " + this.lastPageX + ", " +
+            this.logger.log("last pagexy: " + this.lastPageX + ", " + 
                                this.lastPageY);
             // figure out how much this thing has moved
             var dx = (this.maintainOffset) ? this.lastPageX - this.initPageX : 0;
@@ -1079,21 +1079,21 @@ this.logger.log("clickValidator returned false, drag not initiated");
         }
 
         if (this.constrainX) {
-            this.setXConstraint( this.leftConstraint,
-                                 this.rightConstraint,
+            this.setXConstraint( this.leftConstraint, 
+                                 this.rightConstraint, 
                                  this.xTickSize        );
         }
 
         if (this.constrainY) {
-            this.setYConstraint( this.topConstraint,
-                                 this.bottomConstraint,
+            this.setYConstraint( this.topConstraint, 
+                                 this.bottomConstraint, 
                                  this.yTickSize         );
         }
     },
 
     /**
-     * Normally the drag element is moved pixel by pixel, but we can specify
-     * that it move a number of pixels at a time.  This method resolves the
+     * Normally the drag element is moved pixel by pixel, but we can specify 
+     * that it move a number of pixels at a time.  This method resolves the 
      * location when we have it set up like this.
      * @method getTick
      * @param {int} val where we want to place the object
@@ -1104,9 +1104,9 @@ this.logger.log("clickValidator returned false, drag not initiated");
     getTick: function(val, tickArray) {
 
         if (!tickArray) {
-            // If tick interval is not defined, it is effectively 1 pixel,
+            // If tick interval is not defined, it is effectively 1 pixel, 
             // so we return the value passed to us.
-            return val;
+            return val; 
         } else if (tickArray[0] >= val) {
             // The value is lower than the first tick, so we return the first
             // tick.
@@ -1151,14 +1151,14 @@ this.logger.log("clickValidator returned false, drag not initiated");
  * @namespace YAHOO.util
  */
 
-// Only load the library once.  Rewriting the manager class would orphan
+// Only load the library once.  Rewriting the manager class would orphan 
 // existing drag and drop instances.
 if (!YAHOO.util.DragDropMgr) {
 
 /**
- * DragDropMgr is a singleton that tracks the element interaction for
- * all DragDrop items in the window.  Generally, you will not call
- * this class directly, but it does have helper methods that could
+ * DragDropMgr is a singleton that tracks the element interaction for 
+ * all DragDrop items in the window.  Generally, you will not call 
+ * this class directly, but it does have helper methods that could 
  * be useful in your DragDrop implementations.
  * @class DragDropMgr
  * @static
@@ -1170,8 +1170,8 @@ YAHOO.util.DragDropMgr = function() {
     return {
 
         /**
-         * Two dimensional Array of registered DragDrop objects.  The first
-         * dimension is the DragDrop item group, the second the DragDrop
+         * Two dimensional Array of registered DragDrop objects.  The first 
+         * dimension is the DragDrop item group, the second the DragDrop 
          * object.
          * @property ids
          * @type {string: string}
@@ -1181,8 +1181,8 @@ YAHOO.util.DragDropMgr = function() {
         ids: {},
 
         /**
-         * Array of element ids defined as drag handles.  Used to determine
-         * if the element that generated the mousedown event is actually the
+         * Array of element ids defined as drag handles.  Used to determine 
+         * if the element that generated the mousedown event is actually the 
          * handle and not the html element itself.
          * @property handleIds
          * @type {string: string}
@@ -1229,7 +1229,7 @@ YAHOO.util.DragDropMgr = function() {
 
         /**
          * Flag to determine if we should prevent the default behavior of the
-         * events we define. By default this is true, but this can be set to
+         * events we define. By default this is true, but this can be set to 
          * false if you need the default behavior (not recommended)
          * @property preventDefault
          * @type boolean
@@ -1238,7 +1238,7 @@ YAHOO.util.DragDropMgr = function() {
         preventDefault: true,
 
         /**
-         * Flag to determine if we should stop the propagation of the events
+         * Flag to determine if we should stop the propagation of the events 
          * we generate. This is true by default but you may want to set it to
          * false if the html element contains other features that require the
          * mouse click.
@@ -1277,23 +1277,36 @@ YAHOO.util.DragDropMgr = function() {
         },
 
         /**
-         * In point mode, drag and drop interaction is defined by the
+         * In point mode, drag and drop interaction is defined by the 
          * location of the cursor during the drag/drop
          * @property POINT
          * @type int
          * @static
+         * @final
          */
         POINT: 0,
 
         /**
-         * In intersect mode, drag and drop interactio nis defined by the
-         * overlap of two or more drag and drop objects.
+         * In intersect mode, drag and drop interaction is defined by the 
+         * cursor position or the amount of overlap of two or more drag and 
+         * drop objects.
          * @property INTERSECT
          * @type int
          * @static
+         * @final
          */
         INTERSECT: 1,
 
+        /**
+         * In intersect mode, drag and drop interaction is defined only by the 
+         * overlap of two or more drag and drop objects.
+         * @property STRICT_INTERSECT
+         * @type int
+         * @static
+         * @final
+         */
+        STRICT_INTERSECT: 2,
+
         /**
          * The current drag and drop mode.  Default: POINT
          * @property mode
@@ -1392,7 +1405,7 @@ YAHOO.util.DragDropMgr = function() {
         useCache: true,
 
         /**
-         * The number of pixels that the mouse needs to move after the
+         * The number of pixels that the mouse needs to move after the 
          * mousedown before the drag is initiated.  Default=3;
          * @property clickPixelThresh
          * @type int
@@ -1410,7 +1423,7 @@ YAHOO.util.DragDropMgr = function() {
         clickTimeThresh: 1000,
 
         /**
-         * Flag that indicates that either the drag pixel threshold or the
+         * Flag that indicates that either the drag pixel threshold or the 
          * mousdown time threshold has been met
          * @property dragThreshMet
          * @type boolean
@@ -1429,7 +1442,7 @@ YAHOO.util.DragDropMgr = function() {
         clickTimeout: null,
 
         /**
-         * The X position of the mousedown event stored for later use when a
+         * The X position of the mousedown event stored for later use when a 
          * drag threshold is met.
          * @property startX
          * @type int
@@ -1439,7 +1452,7 @@ YAHOO.util.DragDropMgr = function() {
         startX: 0,
 
         /**
-         * The Y position of the mousedown event stored for later use when a
+         * The Y position of the mousedown event stored for later use when a 
          * drag threshold is met.
          * @property startY
          * @type int
@@ -1449,7 +1462,7 @@ YAHOO.util.DragDropMgr = function() {
         startY: 0,
 
         /**
-         * Each DragDrop instance must be registered with the DragDropMgr.
+         * Each DragDrop instance must be registered with the DragDropMgr.  
          * This is executed in DragDrop.init()
          * @method regDragDrop
          * @param {DragDrop} oDD the DragDrop object to register
@@ -1458,7 +1471,7 @@ YAHOO.util.DragDropMgr = function() {
          */
         regDragDrop: function(oDD, sGroup) {
             if (!this.initialized) { this.init(); }
-
+            
             if (!this.ids[sGroup]) {
                 this.ids[sGroup] = {};
             }
@@ -1484,7 +1497,7 @@ YAHOO.util.DragDropMgr = function() {
         },
 
         /**
-         * Unregisters a drag and drop item.  This is executed in
+         * Unregisters a drag and drop item.  This is executed in 
          * DragDrop.unreg, use that method instead of calling this directly.
          * @method _remove
          * @private
@@ -1505,7 +1518,7 @@ YAHOO.util.DragDropMgr = function() {
          * automatically when executing DragDrop.setHandleElId()
          * @method regHandle
          * @param {String} sDDId the DragDrop id this element is a handle for
-         * @param {String} sHandleId the id of the element that is the drag
+         * @param {String} sHandleId the id of the element that is the drag 
          * handle
          * @static
          */
@@ -1517,11 +1530,11 @@ YAHOO.util.DragDropMgr = function() {
         },
 
         /**
-         * Utility function to determine if a given element has been
+         * Utility function to determine if a given element has been 
          * registered as a drag drop item.
          * @method isDragDrop
          * @param {String} id the element id to check
-         * @return {boolean} true if this element is a DragDrop item,
+         * @return {boolean} true if this element is a DragDrop item, 
          * false otherwise
          * @static
          */
@@ -1556,12 +1569,12 @@ YAHOO.util.DragDropMgr = function() {
         },
 
         /**
-         * Returns true if the specified dd target is a legal target for
+         * Returns true if the specified dd target is a legal target for 
          * the specifice drag obj
          * @method isLegalTarget
          * @param {DragDrop} the drag obj
          * @param {DragDrop} the target
-         * @return {boolean} true if the target is a legal target for the
+         * @return {boolean} true if the target is a legal target for the 
          * dd obj
          * @static
          */
@@ -1578,7 +1591,7 @@ YAHOO.util.DragDropMgr = function() {
 
         /**
          * My goal is to be able to transparently determine if an object is
-         * typeof DragDrop, and the exact subclass of DragDrop.  typeof
+         * typeof DragDrop, and the exact subclass of DragDrop.  typeof 
          * returns "object", oDD.constructor.toString() always returns
          * "DragDrop" and not the name of the subclass.  So for now it just
          * evaluates a well-known variable in DragDrop.
@@ -1592,16 +1605,16 @@ YAHOO.util.DragDropMgr = function() {
         },
 
         /**
-         * Utility function to determine if a given element has been
+         * Utility function to determine if a given element has been 
          * registered as a drag drop handle for the given Drag Drop object.
          * @method isHandle
          * @param {String} id the element id to check
-         * @return {boolean} true if this element is a DragDrop handle, false
+         * @return {boolean} true if this element is a DragDrop handle, false 
          * otherwise
          * @static
          */
         isHandle: function(sDDId, sHandleId) {
-            return ( this.handleIds[sDDId] &&
+            return ( this.handleIds[sDDId] && 
                             this.handleIds[sDDId][sHandleId] );
         },
 
@@ -1648,16 +1661,16 @@ YAHOO.util.DragDropMgr = function() {
 
             this.dragThreshMet = false;
 
-            this.clickTimeout = setTimeout(
-                    function() {
+            this.clickTimeout = setTimeout( 
+                    function() { 
                         var DDM = YAHOO.util.DDM;
-                        DDM.startDrag(DDM.startX, DDM.startY);
-                    },
+                        DDM.startDrag(DDM.startX, DDM.startY); 
+                    }, 
                     this.clickTimeThresh );
         },
 
         /**
-         * Fired when either the drag pixel threshol or the mousedown hold
+         * Fired when either the drag pixel threshol or the mousedown hold 
          * time threshold has been met.
          * @method startDrag
          * @param x {int} the X position of the original mousedown
@@ -1675,7 +1688,7 @@ YAHOO.util.DragDropMgr = function() {
         },
 
         /**
-         * Internal function to handle the mouseup event.  Will be invoked
+         * Internal function to handle the mouseup event.  Will be invoked 
          * from the context of the document.
          * @method handleMouseUp
          * @param {Event} e the event
@@ -1703,7 +1716,7 @@ YAHOO.util.DragDropMgr = function() {
         },
 
         /**
-         * Utility to stop event propagation and event default, if these
+         * Utility to stop event propagation and event default, if these 
          * features are turned on.
          * @method stopEvent
          * @param {Event} e the event as returned by this.getEvent()
@@ -1719,8 +1732,8 @@ YAHOO.util.DragDropMgr = function() {
             }
         },
 
-        /**
-         * Internal function to clean up event handlers after the drag
+        /** 
+         * Internal function to clean up event handlers after the drag 
          * operation is complete
          * @method stopDrag
          * @param {Event} e the event
@@ -1747,14 +1760,14 @@ YAHOO.util.DragDropMgr = function() {
         },
 
 
-        /**
-         * Internal function to handle the mousemove event.  Will be invoked
+        /** 
+         * Internal function to handle the mousemove event.  Will be invoked 
          * from the context of the html element.
          *
-         * @TODO figure out what we can do about mouse events lost when the
-         * user drags objects beyond the window boundary.  Currently we can
-         * detect this in internet explorer by verifying that the mouse is
-         * down during the mousemove event.  Firefox doesn't give us the
+         * @TODO figure out what we can do about mouse events lost when the 
+         * user drags objects beyond the window boundary.  Currently we can 
+         * detect this in internet explorer by verifying that the mouse is 
+         * down during the mousemove event.  Firefox doesn't give us the 
          * button state on the mousemove event.
          * @method handleMouseMove
          * @param {Event} e the event
@@ -1782,7 +1795,7 @@ YAHOO.util.DragDropMgr = function() {
                 var diffX = Math.abs(this.startX - YAHOO.util.Event.getPageX(e));
                 var diffY = Math.abs(this.startY - YAHOO.util.Event.getPageY(e));
                 // this.logger.log("diffX: " + diffX + "diffY: " + diffY);
-                if (diffX > this.clickPixelThresh ||
+                if (diffX > this.clickPixelThresh || 
                             diffY > this.clickPixelThresh) {
                     this.logger.log("pixel threshold met");
                     this.startDrag(this.startX, this.startY);
@@ -1801,7 +1814,7 @@ YAHOO.util.DragDropMgr = function() {
         },
 
         /**
-         * Iterates over all of the DragDrop elements to find ones we are
+         * Iterates over all of the DragDrop elements to find ones we are 
          * hovering over or dropping on
          * @method fireEvents
          * @param {Event} e the event
@@ -1812,7 +1825,7 @@ YAHOO.util.DragDropMgr = function() {
         fireEvents: function(e, isDrop) {
             var dc = this.dragCurrent;
 
-            // If the user did the mouse up outside of the window, we could
+            // If the user did the mouse up outside of the window, we could 
             // get here even though we have ended the drag.
             if (!dc || dc.isLocked()) {
                 return;
@@ -1830,7 +1843,7 @@ YAHOO.util.DragDropMgr = function() {
             var dropEvts  = [];
             var enterEvts = [];
 
-            // Check to see if the object(s) we were hovering over is no longer
+            // Check to see if the object(s) we were hovering over is no longer 
             // being hovered over so we can fire the onDragOut event
             for (var i in this.dragOvers) {
 
@@ -1850,7 +1863,7 @@ YAHOO.util.DragDropMgr = function() {
 
             for (var sGroup in dc.groups) {
                 // this.logger.log("Processing group " + sGroup);
-
+                
                 if ("string" != typeof sGroup) {
                     continue;
                 }
@@ -1916,14 +1929,14 @@ YAHOO.util.DragDropMgr = function() {
                     dc.b4DragOut(e, outEvts[i].id);
                     dc.onDragOut(e, outEvts[i].id);
                 }
-
+                 
                 // fire enter events
                 for (i=0,len=enterEvts.length; i
          * YAHOO.util.DragDropMgr.refreshCache(ddinstance.groups);
@@ -2064,12 +2072,12 @@ YAHOO.util.DragDropMgr = function() {
 
             return false;
         },
-
+        
         /**
          * Returns a Region object containing the drag and drop element's position
          * and size, including the padding configured for it
          * @method getLocation
-         * @param {DragDrop} oDD the drag and drop object to get the
+         * @param {DragDrop} oDD the drag and drop object to get the 
          *                       location for
          * @return {YAHOO.util.Region} a Region object representing the total area
          *                             the element occupies, including any padding
@@ -2136,11 +2144,11 @@ YAHOO.util.DragDropMgr = function() {
 
             // DragDrop is using this as a sanity check for the initial mousedown
             // in this case we are done.  In POINT mode, if the drag obj has no
-            // contraints, we are also done. Otherwise we need to evaluate the
+            // contraints, we are also done. Otherwise we need to evaluate the 
             // location of the target as related to the actual location of the
             // dragged element.
             var dc = this.dragCurrent;
-            if (!dc || !dc.getTargetCoord ||
+            if (!dc || !dc.getTargetCoord || 
                     (!intersect && !dc.constrainX && !dc.constrainY)) {
                 return oTarget.cursorIsOver;
             }
@@ -2154,9 +2162,9 @@ YAHOO.util.DragDropMgr = function() {
             var pos = dc.getTargetCoord(pt.x, pt.y);
 
             var el = dc.getDragEl();
-            var curRegion = new YAHOO.util.Region( pos.y,
+            var curRegion = new YAHOO.util.Region( pos.y, 
                                                    pos.x + el.offsetWidth,
-                                                   pos.y + el.offsetHeight,
+                                                   pos.y + el.offsetHeight, 
                                                    pos.x );
 
             var overlap = curRegion.intersect(loc);
@@ -2210,7 +2218,7 @@ YAHOO.util.DragDropMgr = function() {
          * @static
          */
         elementCache: {},
-
+        
         /**
          * Get the wrapper for the DOM element specified
          * @method getElWrapper
@@ -2223,7 +2231,7 @@ YAHOO.util.DragDropMgr = function() {
         getElWrapper: function(id) {
             var oWrapper = this.elementCache[id];
             if (!oWrapper || !oWrapper.el) {
-                oWrapper = this.elementCache[id] =
+                oWrapper = this.elementCache[id] = 
                     new this.ElementWrapper(YAHOO.util.Dom.get(id));
             }
             return oWrapper;
@@ -2240,9 +2248,9 @@ YAHOO.util.DragDropMgr = function() {
         getElement: function(id) {
             return YAHOO.util.Dom.get(id);
         },
-
+        
         /**
-         * Returns the style property for the DOM element (i.e.,
+         * Returns the style property for the DOM element (i.e., 
          * document.getElById(id).style)
          * @method getCss
          * @param {String} id the id of the elment to get
@@ -2302,11 +2310,11 @@ YAHOO.util.DragDropMgr = function() {
          * @static
          */
         getPosY: function(el) {
-            return YAHOO.util.Dom.getY(el);
+            return YAHOO.util.Dom.getY(el); 
         },
 
         /**
-         * Swap two nodes.  In IE, we use the native method, for others we
+         * Swap two nodes.  In IE, we use the native method, for others we 
          * emulate the IE behavior
          * @method swapNode
          * @param n1 the first node to swap
@@ -2455,8 +2463,8 @@ YAHOO.util.DragDropMgr = function() {
         },
 
         /**
-         * Recursively searches the immediate parent and all child nodes for
-         * the handle element in order to determine wheter or not it was
+         * Recursively searches the immediate parent and all child nodes for 
+         * the handle element in order to determine wheter or not it was 
          * clicked.
          * @method handleWasClicked
          * @param node the html element to inspect
@@ -2495,15 +2503,15 @@ YAHOO.util.DDM._addListeners();
 }
 
 /**
- * A DragDrop implementation where the linked element follows the
+ * A DragDrop implementation where the linked element follows the 
  * mouse cursor during a drag.
  * @class DD
  * @extends YAHOO.util.DragDrop
  * @constructor
- * @param {String} id the id of the linked element
+ * @param {String} id the id of the linked element 
  * @param {String} sGroup the group of related DragDrop items
  * @param {object} config an object containing configurable attributes
- *                Valid properties for DD:
+ *                Valid properties for DD: 
  *                    scroll
  */
 YAHOO.util.DD = function(id, sGroup, config) {
@@ -2521,10 +2529,10 @@ YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {
      * @property scroll
      * @type boolean
      */
-    scroll: true,
+    scroll: true, 
 
     /**
-     * Sets the pointer offset to the distance between the linked element's top
+     * Sets the pointer offset to the distance between the linked element's top 
      * left corner and the location the element was clicked
      * @method autoOffset
      * @param {int} iPageX the X coordinate of the click
@@ -2537,9 +2545,9 @@ YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {
         // this.logger.log("autoOffset el pos: " + aCoord + ", delta: " + x + "," + y);
     },
 
-    /**
-     * Sets the pointer offset.  You can call this directly to force the
-     * offset to be in a particular location (e.g., pass in 0,0 to set it
+    /** 
+     * Sets the pointer offset.  You can call this directly to force the 
+     * offset to be in a particular location (e.g., pass in 0,0 to set it 
      * to the center of the object, as done in YAHOO.widget.Slider)
      * @method setDelta
      * @param {int} iDeltaX the distance from the left
@@ -2552,9 +2560,9 @@ YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {
     },
 
     /**
-     * Sets the drag element to the location of the mousedown or click event,
-     * maintaining the cursor location relative to the location on the element
-     * that was clicked.  Override this if you want to place the element in a
+     * Sets the drag element to the location of the mousedown or click event, 
+     * maintaining the cursor location relative to the location on the element 
+     * that was clicked.  Override this if you want to place the element in a 
      * location other than where the cursor is.
      * @method setDragElPos
      * @param {int} iPageX the X coordinate of the mousedown or drag event
@@ -2569,9 +2577,9 @@ YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {
     },
 
     /**
-     * Sets the element to the location of the mousedown or click event,
-     * maintaining the cursor location relative to the location on the element
-     * that was clicked.  Override this if you want to place the element in a
+     * Sets the element to the location of the mousedown or click event, 
+     * maintaining the cursor location relative to the location on the element 
+     * that was clicked.  Override this if you want to place the element in a 
      * location other than where the cursor is.
      * @method alignElWithMouse
      * @param {HTMLElement} el the element to move
@@ -2593,7 +2601,7 @@ YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {
             YAHOO.util.Dom.setStyle(el, "left", (oCoord.x + this.deltaSetXY[0]) + "px");
             YAHOO.util.Dom.setStyle(el, "top",  (oCoord.y + this.deltaSetXY[1]) + "px");
         }
-
+        
         this.cachePosition(oCoord.x, oCoord.y);
         this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth);
     },
@@ -2620,7 +2628,7 @@ YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {
     },
 
     /**
-     * Auto-scroll the window if the dragged object has been moved beyond the
+     * Auto-scroll the window if the dragged object has been moved beyond the 
      * visible window boundary.
      * @method autoScroll
      * @param {int} x the drag element's x position
@@ -2650,7 +2658,7 @@ YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {
             // Location of the right of the element
             var right = w + x;
 
-            // The distance from the cursor to the bottom of the visible area,
+            // The distance from the cursor to the bottom of the visible area, 
             // adjusted so that we don't scroll if the cursor is beyond the
             // element drag constraints
             var toBot = (clientH + st - y - this.deltaY);
@@ -2658,41 +2666,41 @@ YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {
             // The distance from the cursor to the right of the visible area
             var toRight = (clientW + sl - x - this.deltaX);
 
-            // this.logger.log( " x: " + x + " y: " + y + " h: " + h +
-            // " clientH: " + clientH + " clientW: " + clientW +
-            // " st: " + st + " sl: " + sl + " bot: " + bot +
+            // this.logger.log( " x: " + x + " y: " + y + " h: " + h + 
+            // " clientH: " + clientH + " clientW: " + clientW + 
+            // " st: " + st + " sl: " + sl + " bot: " + bot + 
             // " right: " + right + " toBot: " + toBot + " toRight: " + toRight);
 
             // How close to the edge the cursor must be before we scroll
             // var thresh = (document.all) ? 100 : 40;
             var thresh = 40;
 
-            // How many pixels to scroll per autoscroll op.  This helps to reduce
-            // clunky scrolling. IE is more sensitive about this ... it needs this
+            // How many pixels to scroll per autoscroll op.  This helps to reduce 
+            // clunky scrolling. IE is more sensitive about this ... it needs this 
             // value to be higher.
             var scrAmt = (document.all) ? 80 : 30;
 
-            // Scroll down if we are near the bottom of the visible page and the
+            // Scroll down if we are near the bottom of the visible page and the 
             // obj extends below the crease
-            if ( bot > clientH && toBot < thresh ) {
-                window.scrollTo(sl, st + scrAmt);
+            if ( bot > clientH && toBot < thresh ) { 
+                window.scrollTo(sl, st + scrAmt); 
             }
 
             // Scroll up if the window is scrolled down and the top of the object
             // goes above the top border
-            if ( y < st && st > 0 && y - st < thresh ) {
-                window.scrollTo(sl, st - scrAmt);
+            if ( y < st && st > 0 && y - st < thresh ) { 
+                window.scrollTo(sl, st - scrAmt); 
             }
 
             // Scroll right if the obj is beyond the right border and the cursor is
             // near the border.
-            if ( right > clientW && toRight < thresh ) {
-                window.scrollTo(sl + scrAmt, st);
+            if ( right > clientW && toRight < thresh ) { 
+                window.scrollTo(sl + scrAmt, st); 
             }
 
             // Scroll left if the window has been scrolled to the right and the obj
             // extends past the left border
-            if ( x < sl && sl > 0 && x - sl < thresh ) {
+            if ( x < sl && sl > 0 && x - sl < thresh ) { 
                 window.scrollTo(sl - scrAmt, st);
             }
         }
@@ -2727,7 +2735,7 @@ YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {
         x = this.getTick(x, this.xTicks);
         y = this.getTick(y, this.yTicks);
 
-        // this.logger.log("getTargetCoord " +
+        // this.logger.log("getTargetCoord " + 
                 // " iPageX: " + iPageX +
                 // " iPageY: " + iPageY +
                 // " x: " + x + ", y: " + y);
@@ -2737,7 +2745,7 @@ YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {
 
     /*
      * Sets up config options specific to this class. Overrides
-     * YAHOO.util.DragDrop, but all versions of this method through the
+     * YAHOO.util.DragDrop, but all versions of this method through the 
      * inheritance chain are called
      */
     applyConfig: function() {
@@ -2746,21 +2754,21 @@ YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {
     },
 
     /*
-     * Event that fires prior to the onMouseDown event.  Overrides
+     * Event that fires prior to the onMouseDown event.  Overrides 
      * YAHOO.util.DragDrop.
      */
     b4MouseDown: function(e) {
         // this.resetConstraints();
-        this.autoOffset(YAHOO.util.Event.getPageX(e),
+        this.autoOffset(YAHOO.util.Event.getPageX(e), 
                             YAHOO.util.Event.getPageY(e));
     },
 
     /*
-     * Event that fires prior to the onDrag event.  Overrides
+     * Event that fires prior to the onDrag event.  Overrides 
      * YAHOO.util.DragDrop.
      */
     b4Drag: function(e) {
-        this.setDragElPos(YAHOO.util.Event.getPageX(e),
+        this.setDragElPos(YAHOO.util.Event.getPageX(e), 
                             YAHOO.util.Event.getPageY(e));
     },
 
@@ -2819,13 +2827,13 @@ YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {
  * @param {String} id the id of the linked html element
  * @param {String} sGroup the group of related DragDrop objects
  * @param {object} config an object containing configurable attributes
- *                Valid properties for DDProxy in addition to those in DragDrop:
+ *                Valid properties for DDProxy in addition to those in DragDrop: 
  *                   resizeFrame, centerFrame, dragElId
  */
 YAHOO.util.DDProxy = function(id, sGroup, config) {
     if (id) {
         this.init(id, sGroup, config);
-        this.initFrame();
+        this.initFrame(); 
     }
 };
 
@@ -2885,7 +2893,7 @@ YAHOO.extend(YAHOO.util.DDProxy, YAHOO.util.DD, {
             s.zIndex     = 999;
 
             // appendChild can blow up IE if invoked prior to the window load event
-            // while rendering a table.  It is possible there are other scenarios
+            // while rendering a table.  It is possible there are other scenarios 
             // that would cause this to happen as well.
             body.insertBefore(div, body.firstChild);
         }
@@ -2910,7 +2918,7 @@ YAHOO.extend(YAHOO.util.DDProxy, YAHOO.util.DD, {
     },
 
     /**
-     * Resizes the drag frame to the dimensions of the clicked object, positions
+     * Resizes the drag frame to the dimensions of the clicked object, positions 
      * it over the object, and finally displays it
      * @method showFrame
      * @param {int} iPageX X click position
@@ -2925,13 +2933,13 @@ YAHOO.extend(YAHOO.util.DDProxy, YAHOO.util.DD, {
         this._resizeProxy();
 
         if (this.centerFrame) {
-            this.setDelta( Math.round(parseInt(s.width,  10)/2),
+            this.setDelta( Math.round(parseInt(s.width,  10)/2), 
                            Math.round(parseInt(s.height, 10)/2) );
         }
 
         this.setDragElPos(iPageX, iPageY);
 
-        YAHOO.util.Dom.setStyle(dragEl, "visibility", "visible");
+        YAHOO.util.Dom.setStyle(dragEl, "visibility", "visible"); 
     },
 
     /**
@@ -2958,7 +2966,7 @@ YAHOO.extend(YAHOO.util.DDProxy, YAHOO.util.DD, {
 
             this.logger.log("proxy size: " + bt + "  " + br + " " + bb + " " + bl);
 
-            var newWidth  = Math.max(0, el.offsetWidth  - br - bl);
+            var newWidth  = Math.max(0, el.offsetWidth  - br - bl);                                                                                           
             var newHeight = Math.max(0, el.offsetHeight - bt - bb);
 
             this.logger.log("Resizing proxy element");
@@ -2986,12 +2994,12 @@ YAHOO.extend(YAHOO.util.DDProxy, YAHOO.util.DD, {
     // overrides YAHOO.util.DragDrop
     b4EndDrag: function(e) {
         this.logger.log(this.id + " b4EndDrag");
-        YAHOO.util.Dom.setStyle(this.getDragEl(), "visibility", "hidden");
+        YAHOO.util.Dom.setStyle(this.getDragEl(), "visibility", "hidden"); 
     },
 
     // overrides YAHOO.util.DragDrop
-    // By default we try to move the element to the last location of the frame.
-    // This is so that the default behavior mirrors that of YAHOO.util.DD.
+    // By default we try to move the element to the last location of the frame.  
+    // This is so that the default behavior mirrors that of YAHOO.util.DD.  
     endDrag: function(e) {
         var DOM = YAHOO.util.Dom;
         this.logger.log(this.id + " endDrag");
@@ -3000,17 +3008,17 @@ YAHOO.extend(YAHOO.util.DDProxy, YAHOO.util.DD, {
 
         // Show the drag frame briefly so we can get its position
         // del.style.visibility = "";
-        DOM.setStyle(del, "visibility", "");
+        DOM.setStyle(del, "visibility", ""); 
 
-        // Hide the linked element before the move to get around a Safari
+        // Hide the linked element before the move to get around a Safari 
         // rendering bug.
         //lel.style.visibility = "hidden";
-        DOM.setStyle(lel, "visibility", "hidden");
+        DOM.setStyle(lel, "visibility", "hidden"); 
         YAHOO.util.DDM.moveToEl(lel, del);
         //del.style.visibility = "hidden";
-        DOM.setStyle(del, "visibility", "hidden");
+        DOM.setStyle(del, "visibility", "hidden"); 
         //lel.style.visibility = "";
-        DOM.setStyle(lel, "visibility", "");
+        DOM.setStyle(lel, "visibility", ""); 
     },
 
     toString: function() {
@@ -3019,18 +3027,18 @@ YAHOO.extend(YAHOO.util.DDProxy, YAHOO.util.DD, {
 
 });
 /**
- * A DragDrop implementation that does not move, but can be a drop
- * target.  You would get the same result by simply omitting implementation
- * for the event callbacks, but this way we reduce the processing cost of the
+ * A DragDrop implementation that does not move, but can be a drop 
+ * target.  You would get the same result by simply omitting implementation 
+ * for the event callbacks, but this way we reduce the processing cost of the 
  * event listener and the callbacks.
  * @class DDTarget
- * @extends YAHOO.util.DragDrop
+ * @extends YAHOO.util.DragDrop 
  * @constructor
  * @param {String} id the id of the element that is a drop target
  * @param {String} sGroup the group of related DragDrop objects
  * @param {object} config an object containing configurable attributes
- *                 Valid properties for DDTarget in addition to those in
- *                 DragDrop:
+ *                 Valid properties for DDTarget in addition to those in 
+ *                 DragDrop: 
  *                    none
  */
 YAHOO.util.DDTarget = function(id, sGroup, config) {
diff --git a/lib/yui/dragdrop/dragdrop-min.js b/lib/yui/dragdrop/dragdrop-min.js
index 56293cf8fa..2ee619ff6c 100755
--- a/lib/yui/dragdrop/dragdrop-min.js
+++ b/lib/yui/dragdrop/dragdrop-min.js
@@ -1 +1,87 @@
-/* Copyright (c) 2006, Yahoo! Inc. All rights reserved.Code licensed under the BSD License:http://developer.yahoo.net/yui/license.txt version: 0.12.0 */ (function(){var _1=YAHOO.util.Event;var _2=YAHOO.util.Dom;YAHOO.util.DragDrop=function(id,_4,_5){if(id){this.init(id,_4,_5);}};YAHOO.util.DragDrop.prototype={id:null,config:null,dragElId:null,handleElId:null,invalidHandleTypes:null,invalidHandleIds:null,invalidHandleClasses:null,startPageX:0,startPageY:0,groups:null,locked:false,lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isTarget:true,padding:null,_domRef:null,__ygDragDrop:true,constrainX:false,constrainY:false,minX:0,maxX:0,minY:0,maxY:0,maintainOffset:false,xTicks:null,yTicks:null,primaryButtonOnly:true,available:false,hasOuterHandles:false,b4StartDrag:function(x,y){},startDrag:function(x,y){},b4Drag:function(e){},onDrag:function(e){},onDragEnter:function(e,id){},b4DragOver:function(e){},onDragOver:function(e,id){},b4DragOut:function(e){},onDragOut:function(e,id){},b4DragDrop:function(e){},onDragDrop:function(e,id){},onInvalidDrop:function(e){},b4EndDrag:function(e){},endDrag:function(e){},b4MouseDown:function(e){},onMouseDown:function(e){},onMouseUp:function(e){},onAvailable:function(){},getEl:function(){if(!this._domRef){this._domRef=_2.get(this.id);}return this._domRef;},getDragEl:function(){return _2.get(this.dragElId);},init:function(id,_9,_10){this.initTarget(id,_9,_10);_1.on(this.id,"mousedown",this.handleMouseDown,this,true);},initTarget:function(id,_11,_12){this.config=_12||{};this.DDM=YAHOO.util.DDM;this.groups={};if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}this.id=id;this.addToGroup((_11)?_11:"default");this.handleElId=id;_1.onAvailable(id,this.handleOnAvailable,this,true);this.setDragElId(id);this.invalidHandleTypes={A:"A"};this.invalidHandleIds={};this.invalidHandleClasses=[];this.applyConfig();},applyConfig:function(){this.padding=this.config.padding||[0,0,0,0];this.isTarget=(this.config.isTarget!==false);this.maintainOffset=(this.config.maintainOffset);this.primaryButtonOnly=(this.config.primaryButtonOnly!==false);},handleOnAvailable:function(){this.available=true;this.resetConstraints();this.onAvailable();},setPadding:function(_13,_14,_15,_16){if(!_14&&0!==_14){this.padding=[_13,_13,_13,_13];}else{if(!_15&&0!==_15){this.padding=[_13,_14,_13,_14];}else{this.padding=[_13,_14,_15,_16];}}},setInitPosition:function(_17,_18){var el=this.getEl();if(!this.DDM.verifyEl(el)){return;}var dx=_17||0;var dy=_18||0;var p=_2.getXY(el);this.initPageX=p[0]-dx;this.initPageY=p[1]-dy;this.lastPageX=p[0];this.lastPageY=p[1];this.setStartPosition(p);},setStartPosition:function(pos){var p=pos||_2.getXY(this.getEl());this.deltaSetXY=null;this.startPageX=p[0];this.startPageY=p[1];},addToGroup:function(_24){this.groups[_24]=true;this.DDM.regDragDrop(this,_24);},removeFromGroup:function(_25){if(this.groups[_25]){delete this.groups[_25];}this.DDM.removeDDFromGroup(this,_25);},setDragElId:function(id){this.dragElId=id;},setHandleElId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}this.handleElId=id;this.DDM.regHandle(this.id,id);},setOuterHandleElId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}_1.on(id,"mousedown",this.handleMouseDown,this,true);this.setHandleElId(id);this.hasOuterHandles=true;},unreg:function(){_1.removeListener(this.id,"mousedown",this.handleMouseDown);this._domRef=null;this.DDM._remove(this);},isLocked:function(){return (this.DDM.isLocked()||this.locked);},handleMouseDown:function(e,oDD){var _27=e.which||e.button;if(this.primaryButtonOnly&&_27>1){return;}if(this.isLocked()){return;}this.DDM.refreshCache(this.groups);var pt=new YAHOO.util.Point(_1.getPageX(e),_1.getPageY(e));if(!this.hasOuterHandles&&!this.DDM.isOverTarget(pt,this)){}else{if(this.clickValidator(e)){this.setStartPosition();this.b4MouseDown(e);this.onMouseDown(e);this.DDM.handleMouseDown(e,this);this.DDM.stopEvent(e);}else{}}},clickValidator:function(e){var _29=_1.getTarget(e);return (this.isValidHandleChild(_29)&&(this.id==this.handleElId||this.DDM.handleWasClicked(_29,this.id)));},addInvalidHandleType:function(_30){var _31=_30.toUpperCase();this.invalidHandleTypes[_31]=_31;},addInvalidHandleId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}this.invalidHandleIds[id]=id;},addInvalidHandleClass:function(_32){this.invalidHandleClasses.push(_32);},removeInvalidHandleType:function(_33){var _34=_33.toUpperCase();delete this.invalidHandleTypes[_34];},removeInvalidHandleId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}delete this.invalidHandleIds[id];},removeInvalidHandleClass:function(_35){for(var i=0,len=this.invalidHandleClasses.length;i=this.minX;i=i-_41){if(!_42[i]){this.xTicks[this.xTicks.length]=i;_42[i]=true;}}for(i=this.initPageX;i<=this.maxX;i=i+_41){if(!_42[i]){this.xTicks[this.xTicks.length]=i;_42[i]=true;}}this.xTicks.sort(this.DDM.numericSort);},setYTicks:function(_43,_44){this.yTicks=[];this.yTickSize=_44;var _45={};for(var i=this.initPageY;i>=this.minY;i=i-_44){if(!_45[i]){this.yTicks[this.yTicks.length]=i;_45[i]=true;}}for(i=this.initPageY;i<=this.maxY;i=i+_44){if(!_45[i]){this.yTicks[this.yTicks.length]=i;_45[i]=true;}}this.yTicks.sort(this.DDM.numericSort);},setXConstraint:function(_46,_47,_48){this.leftConstraint=_46;this.rightConstraint=_47;this.minX=this.initPageX-_46;this.maxX=this.initPageX+_47;if(_48){this.setXTicks(this.initPageX,_48);}this.constrainX=true;},clearConstraints:function(){this.constrainX=false;this.constrainY=false;this.clearTicks();},clearTicks:function(){this.xTicks=null;this.yTicks=null;this.xTickSize=0;this.yTickSize=0;},setYConstraint:function(iUp,_50,_51){this.topConstraint=iUp;this.bottomConstraint=_50;this.minY=this.initPageY-iUp;this.maxY=this.initPageY+_50;if(_51){this.setYTicks(this.initPageY,_51);}this.constrainY=true;},resetConstraints:function(){if(this.initPageX||this.initPageX===0){var dx=(this.maintainOffset)?this.lastPageX-this.initPageX:0;var dy=(this.maintainOffset)?this.lastPageY-this.initPageY:0;this.setInitPosition(dx,dy);}else{this.setInitPosition();}if(this.constrainX){this.setXConstraint(this.leftConstraint,this.rightConstraint,this.xTickSize);}if(this.constrainY){this.setYConstraint(this.topConstraint,this.bottomConstraint,this.yTickSize);}},getTick:function(val,_53){if(!_53){return val;}else{if(_53[0]>=val){return _53[0];}else{for(var i=0,len=_53.length;i=val){var _55=val-_53[i];var _56=_53[_54]-val;return (_56>_55)?_53[i]:_53[_54];}}return _53[_53.length-1];}}},toString:function(){return ("DragDrop "+this.id);}};})();if(!YAHOO.util.DragDropMgr){YAHOO.util.DragDropMgr=function(){var _57=YAHOO.util.Event;return {ids:{},handleIds:{},dragCurrent:null,dragOvers:{},deltaX:0,deltaY:0,preventDefault:true,stopPropagation:true,initalized:false,locked:false,init:function(){this.initialized=true;},POINT:0,INTERSECT:1,mode:0,_execOnAll:function(_58,_59){for(var i in this.ids){for(var j in this.ids[i]){var oDD=this.ids[i][j];if(!this.isTypeOfDD(oDD)){continue;}oDD[_58].apply(oDD,_59);}}},_onLoad:function(){this.init();_57.on(document,"mouseup",this.handleMouseUp,this,true);_57.on(document,"mousemove",this.handleMouseMove,this,true);_57.on(window,"unload",this._onUnload,this,true);_57.on(window,"resize",this._onResize,this,true);},_onResize:function(e){this._execOnAll("resetConstraints",[]);},lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isLocked:function(){return this.locked;},locationCache:{},useCache:true,clickPixelThresh:3,clickTimeThresh:1000,dragThreshMet:false,clickTimeout:null,startX:0,startY:0,regDragDrop:function(oDD,_61){if(!this.initialized){this.init();}if(!this.ids[_61]){this.ids[_61]={};}this.ids[_61][oDD.id]=oDD;},removeDDFromGroup:function(oDD,_62){if(!this.ids[_62]){this.ids[_62]={};}var obj=this.ids[_62];if(obj&&obj[oDD.id]){delete obj[oDD.id];}},_remove:function(oDD){for(var g in oDD.groups){if(g&&this.ids[g][oDD.id]){delete this.ids[g][oDD.id];}}delete this.handleIds[oDD.id];},regHandle:function(_65,_66){if(!this.handleIds[_65]){this.handleIds[_65]={};}this.handleIds[_65][_66]=_66;},isDragDrop:function(id){return (this.getDDById(id))?true:false;},getRelated:function(_67,_68){var _69=[];for(var i in _67.groups){for(j in this.ids[i]){var dd=this.ids[i][j];if(!this.isTypeOfDD(dd)){continue;}if(!_68||dd.isTarget){_69[_69.length]=dd;}}}return _69;},isLegalTarget:function(oDD,_71){var _72=this.getRelated(oDD,true);for(var i=0,len=_72.length;ithis.clickPixelThresh||_77>this.clickPixelThresh){this.startDrag(this.startX,this.startY);}}if(this.dragThreshMet){this.dragCurrent.b4Drag(e);this.dragCurrent.onDrag(e);this.fireEvents(e,false);}this.stopEvent(e);return true;},fireEvents:function(e,_78){var dc=this.dragCurrent;if(!dc||dc.isLocked()){return;}var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);var pt=new YAHOO.util.Point(x,y);var _80=[];var _81=[];var _82=[];var _83=[];var _84=[];for(var i in this.dragOvers){var ddo=this.dragOvers[i];if(!this.isTypeOfDD(ddo)){continue;}if(!this.isOverTarget(pt,ddo,this.mode)){_81.push(ddo);}_80[i]=true;delete this.dragOvers[i];}for(var _86 in dc.groups){if("string"!=typeof _86){continue;}for(i in this.ids[_86]){var oDD=this.ids[_86][i];if(!this.isTypeOfDD(oDD)){continue;}if(oDD.isTarget&&!oDD.isLocked()&&oDD!=dc){if(this.isOverTarget(pt,oDD,this.mode)){if(_78){_83.push(oDD);}else{if(!_80[oDD.id]){_84.push(oDD);}else{_82.push(oDD);}this.dragOvers[oDD.id]=oDD;}}}}}if(this.mode){if(_81.length){dc.b4DragOut(e,_81);dc.onDragOut(e,_81);}if(_84.length){dc.onDragEnter(e,_84);}if(_82.length){dc.b4DragOver(e,_82);dc.onDragOver(e,_82);}if(_83.length){dc.b4DragDrop(e,_83);dc.onDragDrop(e,_83);}}else{var len=0;for(i=0,len=_81.length;i2000){}else{setTimeout(DDM._addListeners,10);if(document&&document.body){DDM._timeoutCount+=1;}}}},handleWasClicked:function(node,id){if(this.isHandle(id,node.id)){return true;}else{var p=node.parentNode;while(p){if(this.isHandle(id,p.id)){return true;}else{p=p.parentNode;}}}return false;}};}();YAHOO.util.DDM=YAHOO.util.DragDropMgr;YAHOO.util.DDM._addListeners();}YAHOO.util.DD=function(id,_111,_112){if(id){this.init(id,_111,_112);}};YAHOO.extend(YAHOO.util.DD,YAHOO.util.DragDrop,{scroll:true,autoOffset:function(_113,_114){var x=_113-this.startPageX;var y=_114-this.startPageY;this.setDelta(x,y);},setDelta:function(_115,_116){this.deltaX=_115;this.deltaY=_116;},setDragElPos:function(_117,_118){var el=this.getDragEl();this.alignElWithMouse(el,_117,_118);},alignElWithMouse:function(el,_119,_120){var _121=this.getTargetCoord(_119,_120);if(!this.deltaSetXY){var _122=[_121.x,_121.y];YAHOO.util.Dom.setXY(el,_122);var _123=parseInt(YAHOO.util.Dom.getStyle(el,"left"),10);var _124=parseInt(YAHOO.util.Dom.getStyle(el,"top"),10);this.deltaSetXY=[_123-_121.x,_124-_121.y];}else{YAHOO.util.Dom.setStyle(el,"left",(_121.x+this.deltaSetXY[0])+"px");YAHOO.util.Dom.setStyle(el,"top",(_121.y+this.deltaSetXY[1])+"px");}this.cachePosition(_121.x,_121.y);this.autoScroll(_121.x,_121.y,el.offsetHeight,el.offsetWidth);},cachePosition:function(_125,_126){if(_125){this.lastPageX=_125;this.lastPageY=_126;}else{var _127=YAHOO.util.Dom.getXY(this.getEl());this.lastPageX=_127[0];this.lastPageY=_127[1];}},autoScroll:function(x,y,h,w){if(this.scroll){var _130=this.DDM.getClientHeight();var _131=this.DDM.getClientWidth();var st=this.DDM.getScrollTop();var sl=this.DDM.getScrollLeft();var bot=h+y;var _135=w+x;var _136=(_130+st-y-this.deltaY);var _137=(_131+sl-x-this.deltaX);var _138=40;var _139=(document.all)?80:30;if(bot>_130&&_136<_138){window.scrollTo(sl,st+_139);}if(y0&&y-st<_138){window.scrollTo(sl,st-_139);}if(_135>_131&&_137<_138){window.scrollTo(sl+_139,st);}if(x0&&x-sl<_138){window.scrollTo(sl-_139,st);}}},getTargetCoord:function(_140,_141){var x=_140-this.deltaX;var y=_141-this.deltaY;if(this.constrainX){if(xthis.maxX){x=this.maxX;}}if(this.constrainY){if(ythis.maxY){y=this.maxY;}}x=this.getTick(x,this.xTicks);y=this.getTick(y,this.yTicks);return {x:x,y:y};},applyConfig:function(){YAHOO.util.DD.superclass.applyConfig.call(this);this.scroll=(this.config.scroll!==false);},b4MouseDown:function(e){this.autoOffset(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e));},b4Drag:function(e){this.setDragElPos(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e));},toString:function(){return ("DD "+this.id);}});YAHOO.util.DDProxy=function(id,_142,_143){if(id){this.init(id,_142,_143);this.initFrame();}};YAHOO.util.DDProxy.dragElId="ygddfdiv";YAHOO.extend(YAHOO.util.DDProxy,YAHOO.util.DD,{resizeFrame:true,centerFrame:false,createFrame:function(){var self=this;var body=document.body;if(!body||!body.firstChild){setTimeout(function(){self.createFrame();},50);return;}var div=this.getDragEl();if(!div){div=document.createElement("div");div.id=this.dragElId;var s=div.style;s.position="absolute";s.visibility="hidden";s.cursor="move";s.border="2px solid #aaa";s.zIndex=999;body.insertBefore(div,body.firstChild);}},initFrame:function(){this.createFrame();},applyConfig:function(){YAHOO.util.DDProxy.superclass.applyConfig.call(this);this.resizeFrame=(this.config.resizeFrame!==false);this.centerFrame=(this.config.centerFrame);this.setDragElId(this.config.dragElId||YAHOO.util.DDProxy.dragElId);},showFrame:function(_147,_148){var el=this.getEl();var _149=this.getDragEl();var s=_149.style;this._resizeProxy();if(this.centerFrame){this.setDelta(Math.round(parseInt(s.width,10)/2),Math.round(parseInt(s.height,10)/2));}this.setDragElPos(_147,_148);YAHOO.util.Dom.setStyle(_149,"visibility","visible");},_resizeProxy:function(){if(this.resizeFrame){var DOM=YAHOO.util.Dom;var el=this.getEl();var _151=this.getDragEl();var bt=parseInt(DOM.getStyle(_151,"borderTopWidth"),10);var br=parseInt(DOM.getStyle(_151,"borderRightWidth"),10);var bb=parseInt(DOM.getStyle(_151,"borderBottomWidth"),10);var bl=parseInt(DOM.getStyle(_151,"borderLeftWidth"),10);if(isNaN(bt)){bt=0;}if(isNaN(br)){br=0;}if(isNaN(bb)){bb=0;}if(isNaN(bl)){bl=0;}var _156=Math.max(0,el.offsetWidth-br-bl);var _157=Math.max(0,el.offsetHeight-bt-bb);DOM.setStyle(_151,"width",_156+"px");DOM.setStyle(_151,"height",_157+"px");}},b4MouseDown:function(e){var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);this.autoOffset(x,y);this.setDragElPos(x,y);},b4StartDrag:function(x,y){this.showFrame(x,y);},b4EndDrag:function(e){YAHOO.util.Dom.setStyle(this.getDragEl(),"visibility","hidden");},endDrag:function(e){var DOM=YAHOO.util.Dom;var lel=this.getEl();var del=this.getDragEl();DOM.setStyle(del,"visibility","");DOM.setStyle(lel,"visibility","hidden");YAHOO.util.DDM.moveToEl(lel,del);DOM.setStyle(del,"visibility","hidden");DOM.setStyle(lel,"visibility","");},toString:function(){return ("DDProxy "+this.id);}});YAHOO.util.DDTarget=function(id,_160,_161){if(id){this.initTarget(id,_160,_161);}};YAHOO.extend(YAHOO.util.DDTarget,YAHOO.util.DragDrop,{toString:function(){return ("DDTarget "+this.id);}});
\ No newline at end of file
+/* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt version: 0.12.1 */
+(function(){var Event=YAHOO.util.Event;var Dom=YAHOO.util.Dom;YAHOO.util.DragDrop=function(id,sGroup,config){if(id){this.init(id,sGroup,config);}};YAHOO.util.DragDrop.prototype={id:null,config:null,dragElId:null,handleElId:null,invalidHandleTypes:null,invalidHandleIds:null,invalidHandleClasses:null,startPageX:0,startPageY:0,groups:null,locked:false,lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isTarget:true,padding:null,_domRef:null,__ygDragDrop:true,constrainX:false,constrainY:false,minX:0,maxX:0,minY:0,maxY:0,maintainOffset:false,xTicks:null,yTicks:null,primaryButtonOnly:true,available:false,hasOuterHandles:false,b4StartDrag:function(x,y){},startDrag:function(x,y){},b4Drag:function(e){},onDrag:function(e){},onDragEnter:function(e,id){},b4DragOver:function(e){},onDragOver:function(e,id){},b4DragOut:function(e){},onDragOut:function(e,id){},b4DragDrop:function(e){},onDragDrop:function(e,id){},onInvalidDrop:function(e){},b4EndDrag:function(e){},endDrag:function(e){},b4MouseDown:function(e){},onMouseDown:function(e){},onMouseUp:function(e){},onAvailable:function(){},getEl:function(){if(!this._domRef){this._domRef=Dom.get(this.id);}
+return this._domRef;},getDragEl:function(){return Dom.get(this.dragElId);},init:function(id,sGroup,config){this.initTarget(id,sGroup,config);Event.on(this.id,"mousedown",this.handleMouseDown,this,true);},initTarget:function(id,sGroup,config){this.config=config||{};this.DDM=YAHOO.util.DDM;this.groups={};if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=Dom.generateId(id);}
+this.id=id;this.addToGroup((sGroup)?sGroup:"default");this.handleElId=id;Event.onAvailable(id,this.handleOnAvailable,this,true);this.setDragElId(id);this.invalidHandleTypes={A:"A"};this.invalidHandleIds={};this.invalidHandleClasses=[];this.applyConfig();},applyConfig:function(){this.padding=this.config.padding||[0,0,0,0];this.isTarget=(this.config.isTarget!==false);this.maintainOffset=(this.config.maintainOffset);this.primaryButtonOnly=(this.config.primaryButtonOnly!==false);},handleOnAvailable:function(){this.available=true;this.resetConstraints();this.onAvailable();},setPadding:function(iTop,iRight,iBot,iLeft){if(!iRight&&0!==iRight){this.padding=[iTop,iTop,iTop,iTop];}else if(!iBot&&0!==iBot){this.padding=[iTop,iRight,iTop,iRight];}else{this.padding=[iTop,iRight,iBot,iLeft];}},setInitPosition:function(diffX,diffY){var el=this.getEl();if(!this.DDM.verifyEl(el)){return;}
+var dx=diffX||0;var dy=diffY||0;var p=Dom.getXY(el);this.initPageX=p[0]-dx;this.initPageY=p[1]-dy;this.lastPageX=p[0];this.lastPageY=p[1];this.setStartPosition(p);},setStartPosition:function(pos){var p=pos||Dom.getXY(this.getEl());this.deltaSetXY=null;this.startPageX=p[0];this.startPageY=p[1];},addToGroup:function(sGroup){this.groups[sGroup]=true;this.DDM.regDragDrop(this,sGroup);},removeFromGroup:function(sGroup){if(this.groups[sGroup]){delete this.groups[sGroup];}
+this.DDM.removeDDFromGroup(this,sGroup);},setDragElId:function(id){this.dragElId=id;},setHandleElId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=Dom.generateId(id);}
+this.handleElId=id;this.DDM.regHandle(this.id,id);},setOuterHandleElId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=Dom.generateId(id);}
+Event.on(id,"mousedown",this.handleMouseDown,this,true);this.setHandleElId(id);this.hasOuterHandles=true;},unreg:function(){Event.removeListener(this.id,"mousedown",this.handleMouseDown);this._domRef=null;this.DDM._remove(this);},isLocked:function(){return(this.DDM.isLocked()||this.locked);},handleMouseDown:function(e,oDD){var button=e.which||e.button;if(this.primaryButtonOnly&&button>1){return;}
+if(this.isLocked()){return;}
+this.DDM.refreshCache(this.groups);var pt=new YAHOO.util.Point(Event.getPageX(e),Event.getPageY(e));if(!this.hasOuterHandles&&!this.DDM.isOverTarget(pt,this)){}else{if(this.clickValidator(e)){this.setStartPosition();this.b4MouseDown(e);this.onMouseDown(e);this.DDM.handleMouseDown(e,this);this.DDM.stopEvent(e);}else{}}},clickValidator:function(e){var target=Event.getTarget(e);return(this.isValidHandleChild(target)&&(this.id==this.handleElId||this.DDM.handleWasClicked(target,this.id)));},addInvalidHandleType:function(tagName){var type=tagName.toUpperCase();this.invalidHandleTypes[type]=type;},addInvalidHandleId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=Dom.generateId(id);}
+this.invalidHandleIds[id]=id;},addInvalidHandleClass:function(cssClass){this.invalidHandleClasses.push(cssClass);},removeInvalidHandleType:function(tagName){var type=tagName.toUpperCase();delete this.invalidHandleTypes[type];},removeInvalidHandleId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=Dom.generateId(id);}
+delete this.invalidHandleIds[id];},removeInvalidHandleClass:function(cssClass){for(var i=0,len=this.invalidHandleClasses.length;i=this.minX;i=i-iTickSize){if(!tickMap[i]){this.xTicks[this.xTicks.length]=i;tickMap[i]=true;}}
+for(i=this.initPageX;i<=this.maxX;i=i+iTickSize){if(!tickMap[i]){this.xTicks[this.xTicks.length]=i;tickMap[i]=true;}}
+this.xTicks.sort(this.DDM.numericSort);},setYTicks:function(iStartY,iTickSize){this.yTicks=[];this.yTickSize=iTickSize;var tickMap={};for(var i=this.initPageY;i>=this.minY;i=i-iTickSize){if(!tickMap[i]){this.yTicks[this.yTicks.length]=i;tickMap[i]=true;}}
+for(i=this.initPageY;i<=this.maxY;i=i+iTickSize){if(!tickMap[i]){this.yTicks[this.yTicks.length]=i;tickMap[i]=true;}}
+this.yTicks.sort(this.DDM.numericSort);},setXConstraint:function(iLeft,iRight,iTickSize){this.leftConstraint=iLeft;this.rightConstraint=iRight;this.minX=this.initPageX-iLeft;this.maxX=this.initPageX+iRight;if(iTickSize){this.setXTicks(this.initPageX,iTickSize);}
+this.constrainX=true;},clearConstraints:function(){this.constrainX=false;this.constrainY=false;this.clearTicks();},clearTicks:function(){this.xTicks=null;this.yTicks=null;this.xTickSize=0;this.yTickSize=0;},setYConstraint:function(iUp,iDown,iTickSize){this.topConstraint=iUp;this.bottomConstraint=iDown;this.minY=this.initPageY-iUp;this.maxY=this.initPageY+iDown;if(iTickSize){this.setYTicks(this.initPageY,iTickSize);}
+this.constrainY=true;},resetConstraints:function(){if(this.initPageX||this.initPageX===0){var dx=(this.maintainOffset)?this.lastPageX-this.initPageX:0;var dy=(this.maintainOffset)?this.lastPageY-this.initPageY:0;this.setInitPosition(dx,dy);}else{this.setInitPosition();}
+if(this.constrainX){this.setXConstraint(this.leftConstraint,this.rightConstraint,this.xTickSize);}
+if(this.constrainY){this.setYConstraint(this.topConstraint,this.bottomConstraint,this.yTickSize);}},getTick:function(val,tickArray){if(!tickArray){return val;}else if(tickArray[0]>=val){return tickArray[0];}else{for(var i=0,len=tickArray.length;i=val){var diff1=val-tickArray[i];var diff2=tickArray[next]-val;return(diff2>diff1)?tickArray[i]:tickArray[next];}}
+return tickArray[tickArray.length-1];}},toString:function(){return("DragDrop "+this.id);}};})();if(!YAHOO.util.DragDropMgr){YAHOO.util.DragDropMgr=function(){var Event=YAHOO.util.Event;return{ids:{},handleIds:{},dragCurrent:null,dragOvers:{},deltaX:0,deltaY:0,preventDefault:true,stopPropagation:true,initalized:false,locked:false,init:function(){this.initialized=true;},POINT:0,INTERSECT:1,STRICT_INTERSECT:2,mode:0,_execOnAll:function(sMethod,args){for(var i in this.ids){for(var j in this.ids[i]){var oDD=this.ids[i][j];if(!this.isTypeOfDD(oDD)){continue;}
+oDD[sMethod].apply(oDD,args);}}},_onLoad:function(){this.init();Event.on(document,"mouseup",this.handleMouseUp,this,true);Event.on(document,"mousemove",this.handleMouseMove,this,true);Event.on(window,"unload",this._onUnload,this,true);Event.on(window,"resize",this._onResize,this,true);},_onResize:function(e){this._execOnAll("resetConstraints",[]);},lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isLocked:function(){return this.locked;},locationCache:{},useCache:true,clickPixelThresh:3,clickTimeThresh:1000,dragThreshMet:false,clickTimeout:null,startX:0,startY:0,regDragDrop:function(oDD,sGroup){if(!this.initialized){this.init();}
+if(!this.ids[sGroup]){this.ids[sGroup]={};}
+this.ids[sGroup][oDD.id]=oDD;},removeDDFromGroup:function(oDD,sGroup){if(!this.ids[sGroup]){this.ids[sGroup]={};}
+var obj=this.ids[sGroup];if(obj&&obj[oDD.id]){delete obj[oDD.id];}},_remove:function(oDD){for(var g in oDD.groups){if(g&&this.ids[g][oDD.id]){delete this.ids[g][oDD.id];}}
+delete this.handleIds[oDD.id];},regHandle:function(sDDId,sHandleId){if(!this.handleIds[sDDId]){this.handleIds[sDDId]={};}
+this.handleIds[sDDId][sHandleId]=sHandleId;},isDragDrop:function(id){return(this.getDDById(id))?true:false;},getRelated:function(p_oDD,bTargetsOnly){var oDDs=[];for(var i in p_oDD.groups){for(j in this.ids[i]){var dd=this.ids[i][j];if(!this.isTypeOfDD(dd)){continue;}
+if(!bTargetsOnly||dd.isTarget){oDDs[oDDs.length]=dd;}}}
+return oDDs;},isLegalTarget:function(oDD,oTargetDD){var targets=this.getRelated(oDD,true);for(var i=0,len=targets.length;ithis.clickPixelThresh||diffY>this.clickPixelThresh){this.startDrag(this.startX,this.startY);}}
+if(this.dragThreshMet){this.dragCurrent.b4Drag(e);this.dragCurrent.onDrag(e);this.fireEvents(e,false);}
+this.stopEvent(e);return true;},fireEvents:function(e,isDrop){var dc=this.dragCurrent;if(!dc||dc.isLocked()){return;}
+var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);var pt=new YAHOO.util.Point(x,y);var oldOvers=[];var outEvts=[];var overEvts=[];var dropEvts=[];var enterEvts=[];for(var i in this.dragOvers){var ddo=this.dragOvers[i];if(!this.isTypeOfDD(ddo)){continue;}
+if(!this.isOverTarget(pt,ddo,this.mode)){outEvts.push(ddo);}
+oldOvers[i]=true;delete this.dragOvers[i];}
+for(var sGroup in dc.groups){if("string"!=typeof sGroup){continue;}
+for(i in this.ids[sGroup]){var oDD=this.ids[sGroup][i];if(!this.isTypeOfDD(oDD)){continue;}
+if(oDD.isTarget&&!oDD.isLocked()&&oDD!=dc){if(this.isOverTarget(pt,oDD,this.mode)){if(isDrop){dropEvts.push(oDD);}else{if(!oldOvers[oDD.id]){enterEvts.push(oDD);}else{overEvts.push(oDD);}
+this.dragOvers[oDD.id]=oDD;}}}}}
+if(this.mode){if(outEvts.length){dc.b4DragOut(e,outEvts);dc.onDragOut(e,outEvts);}
+if(enterEvts.length){dc.onDragEnter(e,enterEvts);}
+if(overEvts.length){dc.b4DragOver(e,overEvts);dc.onDragOver(e,overEvts);}
+if(dropEvts.length){dc.b4DragDrop(e,dropEvts);dc.onDragDrop(e,dropEvts);}}else{var len=0;for(i=0,len=outEvts.length;i2000){}else{setTimeout(DDM._addListeners,10);if(document&&document.body){DDM._timeoutCount+=1;}}}},handleWasClicked:function(node,id){if(this.isHandle(id,node.id)){return true;}else{var p=node.parentNode;while(p){if(this.isHandle(id,p.id)){return true;}else{p=p.parentNode;}}}
+return false;}};}();YAHOO.util.DDM=YAHOO.util.DragDropMgr;YAHOO.util.DDM._addListeners();}
+YAHOO.util.DD=function(id,sGroup,config){if(id){this.init(id,sGroup,config);}};YAHOO.extend(YAHOO.util.DD,YAHOO.util.DragDrop,{scroll:true,autoOffset:function(iPageX,iPageY){var x=iPageX-this.startPageX;var y=iPageY-this.startPageY;this.setDelta(x,y);},setDelta:function(iDeltaX,iDeltaY){this.deltaX=iDeltaX;this.deltaY=iDeltaY;},setDragElPos:function(iPageX,iPageY){var el=this.getDragEl();this.alignElWithMouse(el,iPageX,iPageY);},alignElWithMouse:function(el,iPageX,iPageY){var oCoord=this.getTargetCoord(iPageX,iPageY);if(!this.deltaSetXY){var aCoord=[oCoord.x,oCoord.y];YAHOO.util.Dom.setXY(el,aCoord);var newLeft=parseInt(YAHOO.util.Dom.getStyle(el,"left"),10);var newTop=parseInt(YAHOO.util.Dom.getStyle(el,"top"),10);this.deltaSetXY=[newLeft-oCoord.x,newTop-oCoord.y];}else{YAHOO.util.Dom.setStyle(el,"left",(oCoord.x+this.deltaSetXY[0])+"px");YAHOO.util.Dom.setStyle(el,"top",(oCoord.y+this.deltaSetXY[1])+"px");}
+this.cachePosition(oCoord.x,oCoord.y);this.autoScroll(oCoord.x,oCoord.y,el.offsetHeight,el.offsetWidth);},cachePosition:function(iPageX,iPageY){if(iPageX){this.lastPageX=iPageX;this.lastPageY=iPageY;}else{var aCoord=YAHOO.util.Dom.getXY(this.getEl());this.lastPageX=aCoord[0];this.lastPageY=aCoord[1];}},autoScroll:function(x,y,h,w){if(this.scroll){var clientH=this.DDM.getClientHeight();var clientW=this.DDM.getClientWidth();var st=this.DDM.getScrollTop();var sl=this.DDM.getScrollLeft();var bot=h+y;var right=w+x;var toBot=(clientH+st-y-this.deltaY);var toRight=(clientW+sl-x-this.deltaX);var thresh=40;var scrAmt=(document.all)?80:30;if(bot>clientH&&toBot0&&y-stclientW&&toRight0&&x-slthis.maxX){x=this.maxX;}}
+if(this.constrainY){if(ythis.maxY){y=this.maxY;}}
+x=this.getTick(x,this.xTicks);y=this.getTick(y,this.yTicks);return{x:x,y:y};},applyConfig:function(){YAHOO.util.DD.superclass.applyConfig.call(this);this.scroll=(this.config.scroll!==false);},b4MouseDown:function(e){this.autoOffset(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e));},b4Drag:function(e){this.setDragElPos(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e));},toString:function(){return("DD "+this.id);}});YAHOO.util.DDProxy=function(id,sGroup,config){if(id){this.init(id,sGroup,config);this.initFrame();}};YAHOO.util.DDProxy.dragElId="ygddfdiv";YAHOO.extend(YAHOO.util.DDProxy,YAHOO.util.DD,{resizeFrame:true,centerFrame:false,createFrame:function(){var self=this;var body=document.body;if(!body||!body.firstChild){setTimeout(function(){self.createFrame();},50);return;}
+var div=this.getDragEl();if(!div){div=document.createElement("div");div.id=this.dragElId;var s=div.style;s.position="absolute";s.visibility="hidden";s.cursor="move";s.border="2px solid #aaa";s.zIndex=999;body.insertBefore(div,body.firstChild);}},initFrame:function(){this.createFrame();},applyConfig:function(){YAHOO.util.DDProxy.superclass.applyConfig.call(this);this.resizeFrame=(this.config.resizeFrame!==false);this.centerFrame=(this.config.centerFrame);this.setDragElId(this.config.dragElId||YAHOO.util.DDProxy.dragElId);},showFrame:function(iPageX,iPageY){var el=this.getEl();var dragEl=this.getDragEl();var s=dragEl.style;this._resizeProxy();if(this.centerFrame){this.setDelta(Math.round(parseInt(s.width,10)/2),Math.round(parseInt(s.height,10)/2));}
+this.setDragElPos(iPageX,iPageY);YAHOO.util.Dom.setStyle(dragEl,"visibility","visible");},_resizeProxy:function(){if(this.resizeFrame){var DOM=YAHOO.util.Dom;var el=this.getEl();var dragEl=this.getDragEl();var bt=parseInt(DOM.getStyle(dragEl,"borderTopWidth"),10);var br=parseInt(DOM.getStyle(dragEl,"borderRightWidth"),10);var bb=parseInt(DOM.getStyle(dragEl,"borderBottomWidth"),10);var bl=parseInt(DOM.getStyle(dragEl,"borderLeftWidth"),10);if(isNaN(bt)){bt=0;}
+if(isNaN(br)){br=0;}
+if(isNaN(bb)){bb=0;}
+if(isNaN(bl)){bl=0;}
+var newWidth=Math.max(0,el.offsetWidth-br-bl);var newHeight=Math.max(0,el.offsetHeight-bt-bb);DOM.setStyle(dragEl,"width",newWidth+"px");DOM.setStyle(dragEl,"height",newHeight+"px");}},b4MouseDown:function(e){var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);this.autoOffset(x,y);this.setDragElPos(x,y);},b4StartDrag:function(x,y){this.showFrame(x,y);},b4EndDrag:function(e){YAHOO.util.Dom.setStyle(this.getDragEl(),"visibility","hidden");},endDrag:function(e){var DOM=YAHOO.util.Dom;var lel=this.getEl();var del=this.getDragEl();DOM.setStyle(del,"visibility","");DOM.setStyle(lel,"visibility","hidden");YAHOO.util.DDM.moveToEl(lel,del);DOM.setStyle(del,"visibility","hidden");DOM.setStyle(lel,"visibility","");},toString:function(){return("DDProxy "+this.id);}});YAHOO.util.DDTarget=function(id,sGroup,config){if(id){this.initTarget(id,sGroup,config);}};YAHOO.extend(YAHOO.util.DDTarget,YAHOO.util.DragDrop,{toString:function(){return("DDTarget "+this.id);}});
\ No newline at end of file
diff --git a/lib/yui/dragdrop/dragdrop.js b/lib/yui/dragdrop/dragdrop.js
index 43a0f61dc2..f571e2448a 100755
--- a/lib/yui/dragdrop/dragdrop.js
+++ b/lib/yui/dragdrop/dragdrop.js
@@ -1,28 +1,27 @@
-/*
+/*                                                                                                                                                      
 Copyright (c) 2006, Yahoo! Inc. All rights reserved.
 Code licensed under the BSD License:
 http://developer.yahoo.net/yui/license.txt
-version: 0.12.0
-*/
-
+version: 0.12.1
+*/ 
 (function() {
 
-var Event=YAHOO.util.Event;
+var Event=YAHOO.util.Event; 
 var Dom=YAHOO.util.Dom;
 
 /**
- * Defines the interface and base operation of items that that can be
+ * Defines the interface and base operation of items that that can be 
  * dragged or can be drop targets.  It was designed to be extended, overriding
  * the event handlers for startDrag, onDrag, onDragOver, onDragOut.
  * Up to three html elements can be associated with a DragDrop instance:
  * 
    *
  • linked element: the element that is passed into the constructor. - * This is the element which defines the boundaries for interaction with + * This is the element which defines the boundaries for interaction with * other DragDrop objects.
  • - *
  • handle element(s): The drag operation only occurs if the element that - * was clicked matches a handle element. By default this is the linked - * element, but there are times that you will want only a portion of the - * linked element to initiate the drag operation, and the setHandleElId() + *
  • handle element(s): The drag operation only occurs if the element that + * was clicked matches a handle element. By default this is the linked + * element, but there are times that you will want only a portion of the + * linked element to initiate the drag operation, and the setHandleElId() * method provides a way to define this.
  • *
  • drag element: this represents an the element that would be moved along * with the cursor during a drag operation. By default, this is the linked @@ -32,14 +31,14 @@ var Dom=YAHOO.util.Dom; *
* This class should not be instantiated until the onload event to ensure that * the associated elements are available. - * The following would define a DragDrop obj that would interact with any + * The following would define a DragDrop obj that would interact with any * other DragDrop obj in the "group1" group: *
  *  dd = new YAHOO.util.DragDrop("div1", "group1");
  * 
- * Since none of the event handlers have been implemented, nothing would - * actually happen if you were to run the code above. Normally you would - * override this class or one of the default implementations, but you can + * Since none of the event handlers have been implemented, nothing would + * actually happen if you were to run the code above. Normally you would + * override this class or one of the default implementations, but you can * also override the methods you want on an instance of the class... *
  *  dd.onDragDrop = function(e, id) {
@@ -52,21 +51,21 @@ var Dom=YAHOO.util.Dom;
  * @param {String} id of the element that is linked to this instance
  * @param {String} sGroup the group of related DragDrop objects
  * @param {object} config an object containing configurable attributes
- *                Valid properties for DragDrop:
- *                    padding, isTarget, maintainOffset, primaryButtonOnly
+ *                Valid properties for DragDrop: 
+ *                    padding, isTarget, maintainOffset, primaryButtonOnly,
  */
 YAHOO.util.DragDrop = function(id, sGroup, config) {
     if (id) {
-        this.init(id, sGroup, config);
+        this.init(id, sGroup, config); 
     }
 };
 
 YAHOO.util.DragDrop.prototype = {
 
     /**
-     * The id of the element associated with this object.  This is what we
-     * refer to as the "linked element" because the size and position of
-     * this element is used to determine when the drag and drop objects have
+     * The id of the element associated with this object.  This is what we 
+     * refer to as the "linked element" because the size and position of 
+     * this element is used to determine when the drag and drop objects have 
      * interacted.
      * @property id
      * @type String
@@ -81,39 +80,39 @@ YAHOO.util.DragDrop.prototype = {
     config: null,
 
     /**
-     * The id of the element that will be dragged.  By default this is same
-     * as the linked element , but could be changed to another element. Ex:
+     * The id of the element that will be dragged.  By default this is same 
+     * as the linked element , but could be changed to another element. Ex: 
      * YAHOO.util.DDProxy
      * @property dragElId
      * @type String
      * @private
      */
-    dragElId: null,
+    dragElId: null, 
 
     /**
-     * the id of the element that initiates the drag operation.  By default
+     * the id of the element that initiates the drag operation.  By default 
      * this is the linked element, but could be changed to be a child of this
-     * element.  This lets us do things like only starting the drag when the
+     * element.  This lets us do things like only starting the drag when the 
      * header element within the linked html element is clicked.
      * @property handleElId
      * @type String
      * @private
      */
-    handleElId: null,
+    handleElId: null, 
 
     /**
      * An associative array of HTML tags that will be ignored if clicked.
      * @property invalidHandleTypes
      * @type {string: string}
      */
-    invalidHandleTypes: null,
+    invalidHandleTypes: null, 
 
     /**
      * An associative array of ids for elements that will be ignored if clicked
      * @property invalidHandleIds
      * @type {string: string}
      */
-    invalidHandleIds: null,
+    invalidHandleIds: null, 
 
     /**
      * An indexted array of css class names for elements that will be ignored
@@ -121,10 +120,10 @@ YAHOO.util.DragDrop.prototype = {
      * @property invalidHandleClasses
      * @type string[]
      */
-    invalidHandleClasses: null,
+    invalidHandleClasses: null, 
 
     /**
-     * The linked element's absolute X position at the time the drag was
+     * The linked element's absolute X position at the time the drag was 
      * started
      * @property startPageX
      * @type int
@@ -133,7 +132,7 @@ YAHOO.util.DragDrop.prototype = {
     startPageX: 0,
 
     /**
-     * The linked element's absolute X position at the time the drag was
+     * The linked element's absolute X position at the time the drag was 
      * started
      * @property startPageY
      * @type int
@@ -142,9 +141,9 @@ YAHOO.util.DragDrop.prototype = {
     startPageY: 0,
 
     /**
-     * The group defines a logical collection of DragDrop objects that are
-     * related.  Instances only get events when interacting with other
-     * DragDrop object in the same group.  This lets us define multiple
+     * The group defines a logical collection of DragDrop objects that are 
+     * related.  Instances only get events when interacting with other 
+     * DragDrop object in the same group.  This lets us define multiple 
      * groups using a single DragDrop subclass if we want.
      * @property groups
      * @type {string: string}
@@ -152,7 +151,7 @@ YAHOO.util.DragDrop.prototype = {
     groups: null,
 
     /**
-     * Individual drag/drop instances can be locked.  This will prevent
+     * Individual drag/drop instances can be locked.  This will prevent 
      * onmousedown start drag.
      * @property locked
      * @type boolean
@@ -235,7 +234,7 @@ YAHOO.util.DragDrop.prototype = {
     maxX: 0,
 
     /**
-     * The up constraint
+     * The up constraint 
      * @property minY
      * @type int
      * @type int
@@ -244,7 +243,7 @@ YAHOO.util.DragDrop.prototype = {
     minY: 0,
 
     /**
-     * The down constraint
+     * The down constraint 
      * @property maxY
      * @type int
      * @private
@@ -262,7 +261,7 @@ YAHOO.util.DragDrop.prototype = {
     maintainOffset: false,
 
     /**
-     * Array of pixel locations the element will snap to if we specified a
+     * Array of pixel locations the element will snap to if we specified a 
      * horizontal graduation/interval.  This array is generated automatically
      * when you define a tick interval.
      * @property xTicks
@@ -271,8 +270,8 @@ YAHOO.util.DragDrop.prototype = {
     xTicks: null,
 
     /**
-     * Array of pixel locations the element will snap to if we specified a
-     * vertical graduation/interval.  This array is generated automatically
+     * Array of pixel locations the element will snap to if we specified a 
+     * vertical graduation/interval.  This array is generated automatically 
      * when you define a tick interval.
      * @property yTicks
      * @type int[]
@@ -333,7 +332,7 @@ YAHOO.util.DragDrop.prototype = {
     b4Drag: function(e) { },
 
     /**
-     * Abstract method called during the onMouseMove event while dragging an
+     * Abstract method called during the onMouseMove event while dragging an 
      * object.
      * @method onDrag
      * @param {Event} e the mousemove event
@@ -341,12 +340,12 @@ YAHOO.util.DragDrop.prototype = {
     onDrag: function(e) { /* override this */ },
 
     /**
-     * Abstract method called when this element fist begins hovering over
+     * Abstract method called when this element fist begins hovering over 
      * another DragDrop obj
      * @method onDragEnter
      * @param {Event} e the mousemove event
      * @param {String|DragDrop[]} id In POINT mode, the element
-     * id this is hovering over.  In INTERSECT mode, an array of one or more
+     * id this is hovering over.  In INTERSECT mode, an array of one or more 
      * dragdrop items being hovered over.
      */
     onDragEnter: function(e, id) { /* override this */ },
@@ -359,12 +358,12 @@ YAHOO.util.DragDrop.prototype = {
     b4DragOver: function(e) { },
 
     /**
-     * Abstract method called when this element is hovering over another
+     * Abstract method called when this element is hovering over another 
      * DragDrop obj
      * @method onDragOver
      * @param {Event} e the mousemove event
      * @param {String|DragDrop[]} id In POINT mode, the element
-     * id this is hovering over.  In INTERSECT mode, an array of dd items
+     * id this is hovering over.  In INTERSECT mode, an array of dd items 
      * being hovered over.
      */
     onDragOver: function(e, id) { /* override this */ },
@@ -381,7 +380,7 @@ YAHOO.util.DragDrop.prototype = {
      * @method onDragOut
      * @param {Event} e the mousemove event
      * @param {String|DragDrop[]} id In POINT mode, the element
-     * id this was hovering over.  In INTERSECT mode, an array of dd items
+     * id this was hovering over.  In INTERSECT mode, an array of dd items 
      * that the mouse is no longer over.
      */
     onDragOut: function(e, id) { /* override this */ },
@@ -394,12 +393,12 @@ YAHOO.util.DragDrop.prototype = {
     b4DragDrop: function(e) { },
 
     /**
-     * Abstract method called when this item is dropped on another DragDrop
+     * Abstract method called when this item is dropped on another DragDrop 
      * obj
      * @method onDragDrop
      * @param {Event} e the mouseup event
      * @param {String|DragDrop[]} id In POINT mode, the element
-     * id this was dropped on.  In INTERSECT mode, an array of dd items this
+     * id this was dropped on.  In INTERSECT mode, an array of dd items this 
      * was dropped on.
      */
     onDragDrop: function(e, id) { /* override this */ },
@@ -447,23 +446,23 @@ YAHOO.util.DragDrop.prototype = {
      * @param {Event} e the mouseup event
      */
     onMouseUp: function(e) { /* override this */ },
-
+   
     /**
      * Override the onAvailable method to do what is needed after the initial
      * position was determined.
      * @method onAvailable
      */
-    onAvailable: function () {
+    onAvailable: function () { 
     },
 
     /**
      * Returns a reference to the linked element
      * @method getEl
-     * @return {HTMLElement} the html element
+     * @return {HTMLElement} the html element 
      */
-    getEl: function() {
+    getEl: function() { 
         if (!this._domRef) {
-            this._domRef = Dom.get(this.id);
+            this._domRef = Dom.get(this.id); 
         }
 
         return this._domRef;
@@ -471,10 +470,10 @@ YAHOO.util.DragDrop.prototype = {
 
     /**
      * Returns a reference to the actual element to drag.  By default this is
-     * the same as the html element, but it can be assigned to another
+     * the same as the html element, but it can be assigned to another 
      * element. An example of this can be found in YAHOO.util.DDProxy
      * @method getDragEl
-     * @return {HTMLElement} the html element
+     * @return {HTMLElement} the html element 
      */
     getDragEl: function() {
         return Dom.get(this.dragElId);
@@ -504,7 +503,7 @@ YAHOO.util.DragDrop.prototype = {
      */
     initTarget: function(id, sGroup, config) {
 
-        // configuration attributes
+        // configuration attributes 
         this.config = config || {};
 
         // create a local reference to the drag and drop manager
@@ -533,9 +532,9 @@ YAHOO.util.DragDrop.prototype = {
 
 
         // the linked element is the element that gets dragged by default
-        this.setDragElId(id);
+        this.setDragElId(id); 
 
-        // by default, clicked anchors will not start drag operations.
+        // by default, clicked anchors will not start drag operations. 
         // @TODO what else should be here?  Probably form fields.
         this.invalidHandleTypes = { A: "A" };
         this.invalidHandleIds = {};
@@ -547,14 +546,14 @@ YAHOO.util.DragDrop.prototype = {
     /**
      * Applies the configuration parameters that were passed into the constructor.
      * This is supposed to happen at each level through the inheritance chain.  So
-     * a DDProxy implentation will execute apply config on DDProxy, DD, and
+     * a DDProxy implentation will execute apply config on DDProxy, DD, and 
      * DragDrop in order to get all of the parameters that are available in
      * each object.
      * @method applyConfig
      */
     applyConfig: function() {
 
-        // configurable properties:
+        // configurable properties: 
         //    padding, isTarget, maintainOffset, primaryButtonOnly
         this.padding           = this.config.padding || [0, 0, 0, 0];
         this.isTarget          = (this.config.isTarget !== false);
@@ -576,7 +575,7 @@ YAHOO.util.DragDrop.prototype = {
 
      /**
      * Configures the padding for the target zone in px.  Effectively expands
-     * (or reduces) the virtual object size for targeting calculations.
+     * (or reduces) the virtual object size for targeting calculations.  
      * Supports css-style shorthand; if only one parameter is passed, all sides
      * will have that padding, and if only two are passed, the top and bottom
      * will have the first param, the left and right the second.
@@ -634,6 +633,7 @@ YAHOO.util.DragDrop.prototype = {
      */
     setStartPosition: function(pos) {
         var p = pos || Dom.getXY( this.getEl() );
+
         this.deltaSetXY = null;
 
         this.startPageX = p[0];
@@ -641,8 +641,8 @@ YAHOO.util.DragDrop.prototype = {
     },
 
     /**
-     * Add this instance to a group of related drag/drop objects.  All
-     * instances belong to at least one group, and can belong to as many
+     * Add this instance to a group of related drag/drop objects.  All 
+     * instances belong to at least one group, and can belong to as many 
      * groups as needed.
      * @method addToGroup
      * @param sGroup {string} the name of the group
@@ -666,7 +666,7 @@ YAHOO.util.DragDrop.prototype = {
     },
 
     /**
-     * Allows you to specify that an element other than the linked element
+     * Allows you to specify that an element other than the linked element 
      * will be moved with the cursor during a drag
      * @method setDragElId
      * @param id {string} the id of the element that will be used to initiate the drag
@@ -676,14 +676,14 @@ YAHOO.util.DragDrop.prototype = {
     },
 
     /**
-     * Allows you to specify a child of the linked element that should be
-     * used to initiate the drag operation.  An example of this would be if
-     * you have a content div with text and links.  Clicking anywhere in the
+     * Allows you to specify a child of the linked element that should be 
+     * used to initiate the drag operation.  An example of this would be if 
+     * you have a content div with text and links.  Clicking anywhere in the 
      * content area would normally start the drag operation.  Use this method
-     * to specify that an element inside of the content div is the element
+     * to specify that an element inside of the content div is the element 
      * that starts the drag operation.
      * @method setHandleElId
-     * @param id {string} the id of the element that will be used to
+     * @param id {string} the id of the element that will be used to 
      * initiate the drag.
      */
     setHandleElId: function(id) {
@@ -696,7 +696,7 @@ YAHOO.util.DragDrop.prototype = {
     },
 
     /**
-     * Allows you to set an element outside of the linked element as a drag
+     * Allows you to set an element outside of the linked element as a drag 
      * handle
      * @method setOuterHandleElId
      * @param id the id of the element that will be used to initiate the drag
@@ -706,7 +706,7 @@ YAHOO.util.DragDrop.prototype = {
             YAHOO.log("id is not a string, assuming it is an HTMLElement");
             id = Dom.generateId(id);
         }
-        Event.on(id, "mousedown",
+        Event.on(id, "mousedown", 
                 this.handleMouseDown, this, true);
         this.setHandleElId(id);
 
@@ -718,7 +718,7 @@ YAHOO.util.DragDrop.prototype = {
      * @method unreg
      */
     unreg: function() {
-        Event.removeListener(this.id, "mousedown",
+        Event.removeListener(this.id, "mousedown", 
                 this.handleMouseDown);
         this._domRef = null;
         this.DDM._remove(this);
@@ -728,7 +728,7 @@ YAHOO.util.DragDrop.prototype = {
      * Returns true if this instance is locked, or the drag drop mgr is locked
      * (meaning that all drag/drop is disabled on the page.)
      * @method isLocked
-     * @return {boolean} true if this obj or all drag/drop is locked, else
+     * @return {boolean} true if this obj or all drag/drop is locked, else 
      * false
      */
     isLocked: function() {
@@ -738,7 +738,7 @@ YAHOO.util.DragDrop.prototype = {
     /**
      * Fired when this object is clicked
      * @method handleMouseDown
-     * @param {Event} e
+     * @param {Event} e 
      * @param {YAHOO.util.DragDrop} oDD the clicked dd object (this dd obj)
      * @private
      */
@@ -758,12 +758,12 @@ YAHOO.util.DragDrop.prototype = {
         // var self = this;
         // setTimeout( function() { self.DDM.refreshCache(self.groups); }, 0);
 
-        // Only process the event if we really clicked within the linked
-        // element.  The reason we make this check is that in the case that
-        // another element was moved between the clicked element and the
-        // cursor in the time between the mousedown and mouseup events. When
-        // this happens, the element gets the next mousedown event
-        // regardless of where on the screen it happened.
+        // Only process the event if we really clicked within the linked 
+        // element.  The reason we make this check is that in the case that 
+        // another element was moved between the clicked element and the 
+        // cursor in the time between the mousedown and mouseup events. When 
+        // this happens, the element gets the next mousedown event 
+        // regardless of where on the screen it happened.  
         var pt = new YAHOO.util.Point(Event.getPageX(e), Event.getPageY(e));
         if (!this.hasOuterHandles && !this.DDM.isOverTarget(pt, this) )  {
         } else {
@@ -789,7 +789,7 @@ YAHOO.util.DragDrop.prototype = {
     clickValidator: function(e) {
         var target = Event.getTarget(e);
         return ( this.isValidHandleChild(target) &&
-                    (this.id == this.handleElId ||
+                    (this.id == this.handleElId || 
                         this.DDM.handleWasClicked(target, this.id)) );
     },
 
@@ -838,7 +838,7 @@ YAHOO.util.DragDrop.prototype = {
         // this.invalidHandleTypes[type] = null;
         delete this.invalidHandleTypes[type];
     },
-
+    
     /**
      * Unsets an invalid handle id
      * @method removeInvalidHandleId
@@ -855,7 +855,7 @@ YAHOO.util.DragDrop.prototype = {
     /**
      * Unsets an invalid css class
      * @method removeInvalidHandleClass
-     * @param {string} cssClass the class of the element(s) you wish to
+     * @param {string} cssClass the class of the element(s) you wish to 
      * re-enable
      */
     removeInvalidHandleClass: function(cssClass) {
@@ -903,7 +903,7 @@ YAHOO.util.DragDrop.prototype = {
     setXTicks: function(iStartX, iTickSize) {
         this.xTicks = [];
         this.xTickSize = iTickSize;
-
+        
         var tickMap = {};
 
         for (var i = this.initPageX; i >= this.minX; i = i - iTickSize) {
@@ -924,7 +924,7 @@ YAHOO.util.DragDrop.prototype = {
     },
 
     /**
-     * Create the array of vertical tick marks if an interval was specified in
+     * Create the array of vertical tick marks if an interval was specified in 
      * setYConstraint().
      * @method setYTicks
      * @private
@@ -953,14 +953,14 @@ YAHOO.util.DragDrop.prototype = {
     },
 
     /**
-     * By default, the element can be dragged any place on the screen.  Use
-     * this method to limit the horizontal travel of the element.  Pass in
+     * By default, the element can be dragged any place on the screen.  Use 
+     * this method to limit the horizontal travel of the element.  Pass in 
      * 0,0 for the parameters if you want to lock the drag to the y axis.
      * @method setXConstraint
      * @param {int} iLeft the number of pixels the element can move to the left
-     * @param {int} iRight the number of pixels the element can move to the
+     * @param {int} iRight the number of pixels the element can move to the 
      * right
-     * @param {int} iTickSize optional parameter for specifying that the
+     * @param {int} iTickSize optional parameter for specifying that the 
      * element
      * should move iTickSize pixels at a time.
      */
@@ -998,13 +998,13 @@ YAHOO.util.DragDrop.prototype = {
     },
 
     /**
-     * By default, the element can be dragged any place on the screen.  Set
+     * By default, the element can be dragged any place on the screen.  Set 
      * this to limit the vertical travel of the element.  Pass in 0,0 for the
      * parameters if you want to lock the drag to the x axis.
      * @method setYConstraint
      * @param {int} iUp the number of pixels the element can move up
      * @param {int} iDown the number of pixels the element can move down
-     * @param {int} iTickSize optional parameter for specifying that the
+     * @param {int} iTickSize optional parameter for specifying that the 
      * element should move iTickSize pixels at a time.
      */
     setYConstraint: function(iUp, iDown, iTickSize) {
@@ -1016,7 +1016,7 @@ YAHOO.util.DragDrop.prototype = {
         if (iTickSize) { this.setYTicks(this.initPageY, iTickSize); }
 
         this.constrainY = true;
-
+        
     },
 
     /**
@@ -1041,21 +1041,21 @@ YAHOO.util.DragDrop.prototype = {
         }
 
         if (this.constrainX) {
-            this.setXConstraint( this.leftConstraint,
-                                 this.rightConstraint,
+            this.setXConstraint( this.leftConstraint, 
+                                 this.rightConstraint, 
                                  this.xTickSize        );
         }
 
         if (this.constrainY) {
-            this.setYConstraint( this.topConstraint,
-                                 this.bottomConstraint,
+            this.setYConstraint( this.topConstraint, 
+                                 this.bottomConstraint, 
                                  this.yTickSize         );
         }
     },
 
     /**
-     * Normally the drag element is moved pixel by pixel, but we can specify
-     * that it move a number of pixels at a time.  This method resolves the
+     * Normally the drag element is moved pixel by pixel, but we can specify 
+     * that it move a number of pixels at a time.  This method resolves the 
      * location when we have it set up like this.
      * @method getTick
      * @param {int} val where we want to place the object
@@ -1066,9 +1066,9 @@ YAHOO.util.DragDrop.prototype = {
     getTick: function(val, tickArray) {
 
         if (!tickArray) {
-            // If tick interval is not defined, it is effectively 1 pixel,
+            // If tick interval is not defined, it is effectively 1 pixel, 
             // so we return the value passed to us.
-            return val;
+            return val; 
         } else if (tickArray[0] >= val) {
             // The value is lower than the first tick, so we return the first
             // tick.
@@ -1113,14 +1113,14 @@ YAHOO.util.DragDrop.prototype = {
  * @namespace YAHOO.util
  */
 
-// Only load the library once.  Rewriting the manager class would orphan
+// Only load the library once.  Rewriting the manager class would orphan 
 // existing drag and drop instances.
 if (!YAHOO.util.DragDropMgr) {
 
 /**
- * DragDropMgr is a singleton that tracks the element interaction for
- * all DragDrop items in the window.  Generally, you will not call
- * this class directly, but it does have helper methods that could
+ * DragDropMgr is a singleton that tracks the element interaction for 
+ * all DragDrop items in the window.  Generally, you will not call 
+ * this class directly, but it does have helper methods that could 
  * be useful in your DragDrop implementations.
  * @class DragDropMgr
  * @static
@@ -1132,8 +1132,8 @@ YAHOO.util.DragDropMgr = function() {
     return {
 
         /**
-         * Two dimensional Array of registered DragDrop objects.  The first
-         * dimension is the DragDrop item group, the second the DragDrop
+         * Two dimensional Array of registered DragDrop objects.  The first 
+         * dimension is the DragDrop item group, the second the DragDrop 
          * object.
          * @property ids
          * @type {string: string}
@@ -1143,8 +1143,8 @@ YAHOO.util.DragDropMgr = function() {
         ids: {},
 
         /**
-         * Array of element ids defined as drag handles.  Used to determine
-         * if the element that generated the mousedown event is actually the
+         * Array of element ids defined as drag handles.  Used to determine 
+         * if the element that generated the mousedown event is actually the 
          * handle and not the html element itself.
          * @property handleIds
          * @type {string: string}
@@ -1191,7 +1191,7 @@ YAHOO.util.DragDropMgr = function() {
 
         /**
          * Flag to determine if we should prevent the default behavior of the
-         * events we define. By default this is true, but this can be set to
+         * events we define. By default this is true, but this can be set to 
          * false if you need the default behavior (not recommended)
          * @property preventDefault
          * @type boolean
@@ -1200,7 +1200,7 @@ YAHOO.util.DragDropMgr = function() {
         preventDefault: true,
 
         /**
-         * Flag to determine if we should stop the propagation of the events
+         * Flag to determine if we should stop the propagation of the events 
          * we generate. This is true by default but you may want to set it to
          * false if the html element contains other features that require the
          * mouse click.
@@ -1238,23 +1238,36 @@ YAHOO.util.DragDropMgr = function() {
         },
 
         /**
-         * In point mode, drag and drop interaction is defined by the
+         * In point mode, drag and drop interaction is defined by the 
          * location of the cursor during the drag/drop
          * @property POINT
          * @type int
          * @static
+         * @final
          */
         POINT: 0,
 
         /**
-         * In intersect mode, drag and drop interactio nis defined by the
-         * overlap of two or more drag and drop objects.
+         * In intersect mode, drag and drop interaction is defined by the 
+         * cursor position or the amount of overlap of two or more drag and 
+         * drop objects.
          * @property INTERSECT
          * @type int
          * @static
+         * @final
          */
         INTERSECT: 1,
 
+        /**
+         * In intersect mode, drag and drop interaction is defined only by the 
+         * overlap of two or more drag and drop objects.
+         * @property STRICT_INTERSECT
+         * @type int
+         * @static
+         * @final
+         */
+        STRICT_INTERSECT: 2,
+
         /**
          * The current drag and drop mode.  Default: POINT
          * @property mode
@@ -1351,7 +1364,7 @@ YAHOO.util.DragDropMgr = function() {
         useCache: true,
 
         /**
-         * The number of pixels that the mouse needs to move after the
+         * The number of pixels that the mouse needs to move after the 
          * mousedown before the drag is initiated.  Default=3;
          * @property clickPixelThresh
          * @type int
@@ -1369,7 +1382,7 @@ YAHOO.util.DragDropMgr = function() {
         clickTimeThresh: 1000,
 
         /**
-         * Flag that indicates that either the drag pixel threshold or the
+         * Flag that indicates that either the drag pixel threshold or the 
          * mousdown time threshold has been met
          * @property dragThreshMet
          * @type boolean
@@ -1388,7 +1401,7 @@ YAHOO.util.DragDropMgr = function() {
         clickTimeout: null,
 
         /**
-         * The X position of the mousedown event stored for later use when a
+         * The X position of the mousedown event stored for later use when a 
          * drag threshold is met.
          * @property startX
          * @type int
@@ -1398,7 +1411,7 @@ YAHOO.util.DragDropMgr = function() {
         startX: 0,
 
         /**
-         * The Y position of the mousedown event stored for later use when a
+         * The Y position of the mousedown event stored for later use when a 
          * drag threshold is met.
          * @property startY
          * @type int
@@ -1408,7 +1421,7 @@ YAHOO.util.DragDropMgr = function() {
         startY: 0,
 
         /**
-         * Each DragDrop instance must be registered with the DragDropMgr.
+         * Each DragDrop instance must be registered with the DragDropMgr.  
          * This is executed in DragDrop.init()
          * @method regDragDrop
          * @param {DragDrop} oDD the DragDrop object to register
@@ -1417,7 +1430,7 @@ YAHOO.util.DragDropMgr = function() {
          */
         regDragDrop: function(oDD, sGroup) {
             if (!this.initialized) { this.init(); }
-
+            
             if (!this.ids[sGroup]) {
                 this.ids[sGroup] = {};
             }
@@ -1443,7 +1456,7 @@ YAHOO.util.DragDropMgr = function() {
         },
 
         /**
-         * Unregisters a drag and drop item.  This is executed in
+         * Unregisters a drag and drop item.  This is executed in 
          * DragDrop.unreg, use that method instead of calling this directly.
          * @method _remove
          * @private
@@ -1463,7 +1476,7 @@ YAHOO.util.DragDropMgr = function() {
          * automatically when executing DragDrop.setHandleElId()
          * @method regHandle
          * @param {String} sDDId the DragDrop id this element is a handle for
-         * @param {String} sHandleId the id of the element that is the drag
+         * @param {String} sHandleId the id of the element that is the drag 
          * handle
          * @static
          */
@@ -1475,11 +1488,11 @@ YAHOO.util.DragDropMgr = function() {
         },
 
         /**
-         * Utility function to determine if a given element has been
+         * Utility function to determine if a given element has been 
          * registered as a drag drop item.
          * @method isDragDrop
          * @param {String} id the element id to check
-         * @return {boolean} true if this element is a DragDrop item,
+         * @return {boolean} true if this element is a DragDrop item, 
          * false otherwise
          * @static
          */
@@ -1514,12 +1527,12 @@ YAHOO.util.DragDropMgr = function() {
         },
 
         /**
-         * Returns true if the specified dd target is a legal target for
+         * Returns true if the specified dd target is a legal target for 
          * the specifice drag obj
          * @method isLegalTarget
          * @param {DragDrop} the drag obj
          * @param {DragDrop} the target
-         * @return {boolean} true if the target is a legal target for the
+         * @return {boolean} true if the target is a legal target for the 
          * dd obj
          * @static
          */
@@ -1536,7 +1549,7 @@ YAHOO.util.DragDropMgr = function() {
 
         /**
          * My goal is to be able to transparently determine if an object is
-         * typeof DragDrop, and the exact subclass of DragDrop.  typeof
+         * typeof DragDrop, and the exact subclass of DragDrop.  typeof 
          * returns "object", oDD.constructor.toString() always returns
          * "DragDrop" and not the name of the subclass.  So for now it just
          * evaluates a well-known variable in DragDrop.
@@ -1550,16 +1563,16 @@ YAHOO.util.DragDropMgr = function() {
         },
 
         /**
-         * Utility function to determine if a given element has been
+         * Utility function to determine if a given element has been 
          * registered as a drag drop handle for the given Drag Drop object.
          * @method isHandle
          * @param {String} id the element id to check
-         * @return {boolean} true if this element is a DragDrop handle, false
+         * @return {boolean} true if this element is a DragDrop handle, false 
          * otherwise
          * @static
          */
         isHandle: function(sDDId, sHandleId) {
-            return ( this.handleIds[sDDId] &&
+            return ( this.handleIds[sDDId] && 
                             this.handleIds[sDDId][sHandleId] );
         },
 
@@ -1605,16 +1618,16 @@ YAHOO.util.DragDropMgr = function() {
 
             this.dragThreshMet = false;
 
-            this.clickTimeout = setTimeout(
-                    function() {
+            this.clickTimeout = setTimeout( 
+                    function() { 
                         var DDM = YAHOO.util.DDM;
-                        DDM.startDrag(DDM.startX, DDM.startY);
-                    },
+                        DDM.startDrag(DDM.startX, DDM.startY); 
+                    }, 
                     this.clickTimeThresh );
         },
 
         /**
-         * Fired when either the drag pixel threshol or the mousedown hold
+         * Fired when either the drag pixel threshol or the mousedown hold 
          * time threshold has been met.
          * @method startDrag
          * @param x {int} the X position of the original mousedown
@@ -1631,7 +1644,7 @@ YAHOO.util.DragDropMgr = function() {
         },
 
         /**
-         * Internal function to handle the mouseup event.  Will be invoked
+         * Internal function to handle the mouseup event.  Will be invoked 
          * from the context of the document.
          * @method handleMouseUp
          * @param {Event} e the event
@@ -1657,7 +1670,7 @@ YAHOO.util.DragDropMgr = function() {
         },
 
         /**
-         * Utility to stop event propagation and event default, if these
+         * Utility to stop event propagation and event default, if these 
          * features are turned on.
          * @method stopEvent
          * @param {Event} e the event as returned by this.getEvent()
@@ -1673,8 +1686,8 @@ YAHOO.util.DragDropMgr = function() {
             }
         },
 
-        /**
-         * Internal function to clean up event handlers after the drag
+        /** 
+         * Internal function to clean up event handlers after the drag 
          * operation is complete
          * @method stopDrag
          * @param {Event} e the event
@@ -1697,14 +1710,14 @@ YAHOO.util.DragDropMgr = function() {
             this.dragOvers = {};
         },
 
-        /**
-         * Internal function to handle the mousemove event.  Will be invoked
+        /** 
+         * Internal function to handle the mousemove event.  Will be invoked 
          * from the context of the html element.
          *
-         * @TODO figure out what we can do about mouse events lost when the
-         * user drags objects beyond the window boundary.  Currently we can
-         * detect this in internet explorer by verifying that the mouse is
-         * down during the mousemove event.  Firefox doesn't give us the
+         * @TODO figure out what we can do about mouse events lost when the 
+         * user drags objects beyond the window boundary.  Currently we can 
+         * detect this in internet explorer by verifying that the mouse is 
+         * down during the mousemove event.  Firefox doesn't give us the 
          * button state on the mousemove event.
          * @method handleMouseMove
          * @param {Event} e the event
@@ -1727,7 +1740,7 @@ YAHOO.util.DragDropMgr = function() {
             if (!this.dragThreshMet) {
                 var diffX = Math.abs(this.startX - YAHOO.util.Event.getPageX(e));
                 var diffY = Math.abs(this.startY - YAHOO.util.Event.getPageY(e));
-                if (diffX > this.clickPixelThresh ||
+                if (diffX > this.clickPixelThresh || 
                             diffY > this.clickPixelThresh) {
                     this.startDrag(this.startX, this.startY);
                 }
@@ -1745,7 +1758,7 @@ YAHOO.util.DragDropMgr = function() {
         },
 
         /**
-         * Iterates over all of the DragDrop elements to find ones we are
+         * Iterates over all of the DragDrop elements to find ones we are 
          * hovering over or dropping on
          * @method fireEvents
          * @param {Event} e the event
@@ -1756,7 +1769,7 @@ YAHOO.util.DragDropMgr = function() {
         fireEvents: function(e, isDrop) {
             var dc = this.dragCurrent;
 
-            // If the user did the mouse up outside of the window, we could
+            // If the user did the mouse up outside of the window, we could 
             // get here even though we have ended the drag.
             if (!dc || dc.isLocked()) {
                 return;
@@ -1774,7 +1787,7 @@ YAHOO.util.DragDropMgr = function() {
             var dropEvts  = [];
             var enterEvts = [];
 
-            // Check to see if the object(s) we were hovering over is no longer
+            // Check to see if the object(s) we were hovering over is no longer 
             // being hovered over so we can fire the onDragOut event
             for (var i in this.dragOvers) {
 
@@ -1793,7 +1806,7 @@ YAHOO.util.DragDropMgr = function() {
             }
 
             for (var sGroup in dc.groups) {
-
+                
                 if ("string" != typeof sGroup) {
                     continue;
                 }
@@ -1854,13 +1867,13 @@ YAHOO.util.DragDropMgr = function() {
                     dc.b4DragOut(e, outEvts[i].id);
                     dc.onDragOut(e, outEvts[i].id);
                 }
-
+                 
                 // fire enter events
                 for (i=0,len=enterEvts.length; i
          * YAHOO.util.DragDropMgr.refreshCache(ddinstance.groups);
@@ -1994,12 +2002,12 @@ YAHOO.util.DragDropMgr = function() {
 
             return false;
         },
-
+        
         /**
          * Returns a Region object containing the drag and drop element's position
          * and size, including the padding configured for it
          * @method getLocation
-         * @param {DragDrop} oDD the drag and drop object to get the
+         * @param {DragDrop} oDD the drag and drop object to get the 
          *                       location for
          * @return {YAHOO.util.Region} a Region object representing the total area
          *                             the element occupies, including any padding
@@ -2060,11 +2068,11 @@ YAHOO.util.DragDropMgr = function() {
 
             // DragDrop is using this as a sanity check for the initial mousedown
             // in this case we are done.  In POINT mode, if the drag obj has no
-            // contraints, we are also done. Otherwise we need to evaluate the
+            // contraints, we are also done. Otherwise we need to evaluate the 
             // location of the target as related to the actual location of the
             // dragged element.
             var dc = this.dragCurrent;
-            if (!dc || !dc.getTargetCoord ||
+            if (!dc || !dc.getTargetCoord || 
                     (!intersect && !dc.constrainX && !dc.constrainY)) {
                 return oTarget.cursorIsOver;
             }
@@ -2078,9 +2086,9 @@ YAHOO.util.DragDropMgr = function() {
             var pos = dc.getTargetCoord(pt.x, pt.y);
 
             var el = dc.getDragEl();
-            var curRegion = new YAHOO.util.Region( pos.y,
+            var curRegion = new YAHOO.util.Region( pos.y, 
                                                    pos.x + el.offsetWidth,
-                                                   pos.y + el.offsetHeight,
+                                                   pos.y + el.offsetHeight, 
                                                    pos.x );
 
             var overlap = curRegion.intersect(loc);
@@ -2133,7 +2141,7 @@ YAHOO.util.DragDropMgr = function() {
          * @static
          */
         elementCache: {},
-
+        
         /**
          * Get the wrapper for the DOM element specified
          * @method getElWrapper
@@ -2146,7 +2154,7 @@ YAHOO.util.DragDropMgr = function() {
         getElWrapper: function(id) {
             var oWrapper = this.elementCache[id];
             if (!oWrapper || !oWrapper.el) {
-                oWrapper = this.elementCache[id] =
+                oWrapper = this.elementCache[id] = 
                     new this.ElementWrapper(YAHOO.util.Dom.get(id));
             }
             return oWrapper;
@@ -2163,9 +2171,9 @@ YAHOO.util.DragDropMgr = function() {
         getElement: function(id) {
             return YAHOO.util.Dom.get(id);
         },
-
+        
         /**
-         * Returns the style property for the DOM element (i.e.,
+         * Returns the style property for the DOM element (i.e., 
          * document.getElById(id).style)
          * @method getCss
          * @param {String} id the id of the elment to get
@@ -2225,11 +2233,11 @@ YAHOO.util.DragDropMgr = function() {
          * @static
          */
         getPosY: function(el) {
-            return YAHOO.util.Dom.getY(el);
+            return YAHOO.util.Dom.getY(el); 
         },
 
         /**
-         * Swap two nodes.  In IE, we use the native method, for others we
+         * Swap two nodes.  In IE, we use the native method, for others we 
          * emulate the IE behavior
          * @method swapNode
          * @param n1 the first node to swap
@@ -2376,8 +2384,8 @@ YAHOO.util.DragDropMgr = function() {
         },
 
         /**
-         * Recursively searches the immediate parent and all child nodes for
-         * the handle element in order to determine wheter or not it was
+         * Recursively searches the immediate parent and all child nodes for 
+         * the handle element in order to determine wheter or not it was 
          * clicked.
          * @method handleWasClicked
          * @param node the html element to inspect
@@ -2413,15 +2421,15 @@ YAHOO.util.DDM._addListeners();
 }
 
 /**
- * A DragDrop implementation where the linked element follows the
+ * A DragDrop implementation where the linked element follows the 
  * mouse cursor during a drag.
  * @class DD
  * @extends YAHOO.util.DragDrop
  * @constructor
- * @param {String} id the id of the linked element
+ * @param {String} id the id of the linked element 
  * @param {String} sGroup the group of related DragDrop items
  * @param {object} config an object containing configurable attributes
- *                Valid properties for DD:
+ *                Valid properties for DD: 
  *                    scroll
  */
 YAHOO.util.DD = function(id, sGroup, config) {
@@ -2439,10 +2447,10 @@ YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {
      * @property scroll
      * @type boolean
      */
-    scroll: true,
+    scroll: true, 
 
     /**
-     * Sets the pointer offset to the distance between the linked element's top
+     * Sets the pointer offset to the distance between the linked element's top 
      * left corner and the location the element was clicked
      * @method autoOffset
      * @param {int} iPageX the X coordinate of the click
@@ -2454,9 +2462,9 @@ YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {
         this.setDelta(x, y);
     },
 
-    /**
-     * Sets the pointer offset.  You can call this directly to force the
-     * offset to be in a particular location (e.g., pass in 0,0 to set it
+    /** 
+     * Sets the pointer offset.  You can call this directly to force the 
+     * offset to be in a particular location (e.g., pass in 0,0 to set it 
      * to the center of the object, as done in YAHOO.widget.Slider)
      * @method setDelta
      * @param {int} iDeltaX the distance from the left
@@ -2468,9 +2476,9 @@ YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {
     },
 
     /**
-     * Sets the drag element to the location of the mousedown or click event,
-     * maintaining the cursor location relative to the location on the element
-     * that was clicked.  Override this if you want to place the element in a
+     * Sets the drag element to the location of the mousedown or click event, 
+     * maintaining the cursor location relative to the location on the element 
+     * that was clicked.  Override this if you want to place the element in a 
      * location other than where the cursor is.
      * @method setDragElPos
      * @param {int} iPageX the X coordinate of the mousedown or drag event
@@ -2485,9 +2493,9 @@ YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {
     },
 
     /**
-     * Sets the element to the location of the mousedown or click event,
-     * maintaining the cursor location relative to the location on the element
-     * that was clicked.  Override this if you want to place the element in a
+     * Sets the element to the location of the mousedown or click event, 
+     * maintaining the cursor location relative to the location on the element 
+     * that was clicked.  Override this if you want to place the element in a 
      * location other than where the cursor is.
      * @method alignElWithMouse
      * @param {HTMLElement} el the element to move
@@ -2508,7 +2516,7 @@ YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {
             YAHOO.util.Dom.setStyle(el, "left", (oCoord.x + this.deltaSetXY[0]) + "px");
             YAHOO.util.Dom.setStyle(el, "top",  (oCoord.y + this.deltaSetXY[1]) + "px");
         }
-
+        
         this.cachePosition(oCoord.x, oCoord.y);
         this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth);
     },
@@ -2535,7 +2543,7 @@ YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {
     },
 
     /**
-     * Auto-scroll the window if the dragged object has been moved beyond the
+     * Auto-scroll the window if the dragged object has been moved beyond the 
      * visible window boundary.
      * @method autoScroll
      * @param {int} x the drag element's x position
@@ -2565,7 +2573,7 @@ YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {
             // Location of the right of the element
             var right = w + x;
 
-            // The distance from the cursor to the bottom of the visible area,
+            // The distance from the cursor to the bottom of the visible area, 
             // adjusted so that we don't scroll if the cursor is beyond the
             // element drag constraints
             var toBot = (clientH + st - y - this.deltaY);
@@ -2578,32 +2586,32 @@ YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {
             // var thresh = (document.all) ? 100 : 40;
             var thresh = 40;
 
-            // How many pixels to scroll per autoscroll op.  This helps to reduce
-            // clunky scrolling. IE is more sensitive about this ... it needs this
+            // How many pixels to scroll per autoscroll op.  This helps to reduce 
+            // clunky scrolling. IE is more sensitive about this ... it needs this 
             // value to be higher.
             var scrAmt = (document.all) ? 80 : 30;
 
-            // Scroll down if we are near the bottom of the visible page and the
+            // Scroll down if we are near the bottom of the visible page and the 
             // obj extends below the crease
-            if ( bot > clientH && toBot < thresh ) {
-                window.scrollTo(sl, st + scrAmt);
+            if ( bot > clientH && toBot < thresh ) { 
+                window.scrollTo(sl, st + scrAmt); 
             }
 
             // Scroll up if the window is scrolled down and the top of the object
             // goes above the top border
-            if ( y < st && st > 0 && y - st < thresh ) {
-                window.scrollTo(sl, st - scrAmt);
+            if ( y < st && st > 0 && y - st < thresh ) { 
+                window.scrollTo(sl, st - scrAmt); 
             }
 
             // Scroll right if the obj is beyond the right border and the cursor is
             // near the border.
-            if ( right > clientW && toRight < thresh ) {
-                window.scrollTo(sl + scrAmt, st);
+            if ( right > clientW && toRight < thresh ) { 
+                window.scrollTo(sl + scrAmt, st); 
             }
 
             // Scroll left if the window has been scrolled to the right and the obj
             // extends past the left border
-            if ( x < sl && sl > 0 && x - sl < thresh ) {
+            if ( x < sl && sl > 0 && x - sl < thresh ) { 
                 window.scrollTo(sl - scrAmt, st);
             }
         }
@@ -2643,7 +2651,7 @@ YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {
 
     /*
      * Sets up config options specific to this class. Overrides
-     * YAHOO.util.DragDrop, but all versions of this method through the
+     * YAHOO.util.DragDrop, but all versions of this method through the 
      * inheritance chain are called
      */
     applyConfig: function() {
@@ -2652,21 +2660,21 @@ YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {
     },
 
     /*
-     * Event that fires prior to the onMouseDown event.  Overrides
+     * Event that fires prior to the onMouseDown event.  Overrides 
      * YAHOO.util.DragDrop.
      */
     b4MouseDown: function(e) {
         // this.resetConstraints();
-        this.autoOffset(YAHOO.util.Event.getPageX(e),
+        this.autoOffset(YAHOO.util.Event.getPageX(e), 
                             YAHOO.util.Event.getPageY(e));
     },
 
     /*
-     * Event that fires prior to the onDrag event.  Overrides
+     * Event that fires prior to the onDrag event.  Overrides 
      * YAHOO.util.DragDrop.
      */
     b4Drag: function(e) {
-        this.setDragElPos(YAHOO.util.Event.getPageX(e),
+        this.setDragElPos(YAHOO.util.Event.getPageX(e), 
                             YAHOO.util.Event.getPageY(e));
     },
 
@@ -2718,13 +2726,13 @@ YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {
  * @param {String} id the id of the linked html element
  * @param {String} sGroup the group of related DragDrop objects
  * @param {object} config an object containing configurable attributes
- *                Valid properties for DDProxy in addition to those in DragDrop:
+ *                Valid properties for DDProxy in addition to those in DragDrop: 
  *                   resizeFrame, centerFrame, dragElId
  */
 YAHOO.util.DDProxy = function(id, sGroup, config) {
     if (id) {
         this.init(id, sGroup, config);
-        this.initFrame();
+        this.initFrame(); 
     }
 };
 
@@ -2784,7 +2792,7 @@ YAHOO.extend(YAHOO.util.DDProxy, YAHOO.util.DD, {
             s.zIndex     = 999;
 
             // appendChild can blow up IE if invoked prior to the window load event
-            // while rendering a table.  It is possible there are other scenarios
+            // while rendering a table.  It is possible there are other scenarios 
             // that would cause this to happen as well.
             body.insertBefore(div, body.firstChild);
         }
@@ -2808,7 +2816,7 @@ YAHOO.extend(YAHOO.util.DDProxy, YAHOO.util.DD, {
     },
 
     /**
-     * Resizes the drag frame to the dimensions of the clicked object, positions
+     * Resizes the drag frame to the dimensions of the clicked object, positions 
      * it over the object, and finally displays it
      * @method showFrame
      * @param {int} iPageX X click position
@@ -2823,13 +2831,13 @@ YAHOO.extend(YAHOO.util.DDProxy, YAHOO.util.DD, {
         this._resizeProxy();
 
         if (this.centerFrame) {
-            this.setDelta( Math.round(parseInt(s.width,  10)/2),
+            this.setDelta( Math.round(parseInt(s.width,  10)/2), 
                            Math.round(parseInt(s.height, 10)/2) );
         }
 
         this.setDragElPos(iPageX, iPageY);
 
-        YAHOO.util.Dom.setStyle(dragEl, "visibility", "visible");
+        YAHOO.util.Dom.setStyle(dragEl, "visibility", "visible"); 
     },
 
     /**
@@ -2855,7 +2863,7 @@ YAHOO.extend(YAHOO.util.DDProxy, YAHOO.util.DD, {
             if (isNaN(bl)) { bl = 0; }
 
 
-            var newWidth  = Math.max(0, el.offsetWidth  - br - bl);
+            var newWidth  = Math.max(0, el.offsetWidth  - br - bl);                                                                                           
             var newHeight = Math.max(0, el.offsetHeight - bt - bb);
 
 
@@ -2880,12 +2888,12 @@ YAHOO.extend(YAHOO.util.DDProxy, YAHOO.util.DD, {
 
     // overrides YAHOO.util.DragDrop
     b4EndDrag: function(e) {
-        YAHOO.util.Dom.setStyle(this.getDragEl(), "visibility", "hidden");
+        YAHOO.util.Dom.setStyle(this.getDragEl(), "visibility", "hidden"); 
     },
 
     // overrides YAHOO.util.DragDrop
-    // By default we try to move the element to the last location of the frame.
-    // This is so that the default behavior mirrors that of YAHOO.util.DD.
+    // By default we try to move the element to the last location of the frame.  
+    // This is so that the default behavior mirrors that of YAHOO.util.DD.  
     endDrag: function(e) {
         var DOM = YAHOO.util.Dom;
         var lel = this.getEl();
@@ -2893,17 +2901,17 @@ YAHOO.extend(YAHOO.util.DDProxy, YAHOO.util.DD, {
 
         // Show the drag frame briefly so we can get its position
         // del.style.visibility = "";
-        DOM.setStyle(del, "visibility", "");
+        DOM.setStyle(del, "visibility", ""); 
 
-        // Hide the linked element before the move to get around a Safari
+        // Hide the linked element before the move to get around a Safari 
         // rendering bug.
         //lel.style.visibility = "hidden";
-        DOM.setStyle(lel, "visibility", "hidden");
+        DOM.setStyle(lel, "visibility", "hidden"); 
         YAHOO.util.DDM.moveToEl(lel, del);
         //del.style.visibility = "hidden";
-        DOM.setStyle(del, "visibility", "hidden");
+        DOM.setStyle(del, "visibility", "hidden"); 
         //lel.style.visibility = "";
-        DOM.setStyle(lel, "visibility", "");
+        DOM.setStyle(lel, "visibility", ""); 
     },
 
     toString: function() {
@@ -2912,18 +2920,18 @@ YAHOO.extend(YAHOO.util.DDProxy, YAHOO.util.DD, {
 
 });
 /**
- * A DragDrop implementation that does not move, but can be a drop
- * target.  You would get the same result by simply omitting implementation
- * for the event callbacks, but this way we reduce the processing cost of the
+ * A DragDrop implementation that does not move, but can be a drop 
+ * target.  You would get the same result by simply omitting implementation 
+ * for the event callbacks, but this way we reduce the processing cost of the 
  * event listener and the callbacks.
  * @class DDTarget
- * @extends YAHOO.util.DragDrop
+ * @extends YAHOO.util.DragDrop 
  * @constructor
  * @param {String} id the id of the element that is a drop target
  * @param {String} sGroup the group of related DragDrop objects
  * @param {object} config an object containing configurable attributes
- *                 Valid properties for DDTarget in addition to those in
- *                 DragDrop:
+ *                 Valid properties for DDTarget in addition to those in 
+ *                 DragDrop: 
  *                    none
  */
 YAHOO.util.DDTarget = function(id, sGroup, config) {
diff --git a/lib/yui/event/README b/lib/yui/event/README
index e6b1f93497..c63ba0a889 100755
--- a/lib/yui/event/README
+++ b/lib/yui/event/README
@@ -1,6 +1,14 @@
 
 YUI Library - Event - Release Notes
 
+0.12.1
+
+  * If an error is thrown during the browser-specific add/remove lister call,
+    addListener/removeListener will catch the error and return false.
+
+  * onAvailable array items are nulled out instead of deleted when completed to
+    get around an Opera issue introduced in a recent version of the browser.
+
 0.12.0
 
    * If the function argument is not provided to Event.removeListener, all
diff --git a/lib/yui/event/event-debug.js b/lib/yui/event/event-debug.js
index 77094e3cb0..c80fa735a7 100755
--- a/lib/yui/event/event-debug.js
+++ b/lib/yui/event/event-debug.js
@@ -1,10 +1,9 @@
-/*
+/*                                                                                                                                                      
 Copyright (c) 2006, Yahoo! Inc. All rights reserved.
 Code licensed under the BSD License:
 http://developer.yahoo.net/yui/license.txt
-version: 0.12.0
-*/
-
+version: 0.12.1
+*/ 
 
 /**
  * The CustomEvent class lets you define events for your application
@@ -13,10 +12,14 @@ version: 0.12.0
  * @param {String}  type The type of event, which is passed to the callback
  *                  when the event fires
  * @param {Object}  oScope The context the event will fire from.  "this" will
- *                  refer to this object in the callback.  Default value:
+ *                  refer to this object in the callback.  Default value: 
  *                  the window object.  The listener can override this.
  * @param {boolean} silent pass true to prevent the event from writing to
- *                  the log system
+ *                  the debugsystem
+ * @param {int}     signature the signature that the custom event subscriber
+ *                  will receive. YAHOO.util.CustomEvent.LIST or 
+ *                  YAHOO.util.CustomEvent.FLAT.  The default is
+ *                  YAHOO.util.CustomEvent.LIST.
  * @namespace YAHOO.util
  * @class CustomEvent
  * @constructor
@@ -31,7 +34,7 @@ YAHOO.util.CustomEvent = function(type, oScope, silent, signature) {
     this.type = type;
 
     /**
-     * The scope the the event will fire from by default.  Defaults to the window
+     * The scope the the event will fire from by default.  Defaults to the window 
      * obj
      * @property scope
      * @type object
@@ -40,7 +43,7 @@ YAHOO.util.CustomEvent = function(type, oScope, silent, signature) {
 
     /**
      * By default all custom events are logged in the debug build, set silent
-     * to true to disable logging for this event.
+     * to true to disable debug outpu for this event.
      * @property silent
      * @type boolean
      */
@@ -48,9 +51,9 @@ YAHOO.util.CustomEvent = function(type, oScope, silent, signature) {
 
     /**
      * Custom events support two styles of arguments provided to the event
-     * subscribers.
+     * subscribers.  
      * 
    - *
  • YAHOO.util.CustomEvent.LIST: + *
  • YAHOO.util.CustomEvent.LIST: *
      *
    • param1: event name
    • *
    • param2: array of arguments sent to fire
    • @@ -83,7 +86,7 @@ YAHOO.util.CustomEvent = function(type, oScope, silent, signature) { var onsubscribeType = "_YUICEOnSubscribe"; - // Only add subscribe events for events that are not generated by + // Only add subscribe events for events that are not generated by // CustomEvent if (type !== onsubscribeType) { @@ -91,22 +94,22 @@ YAHOO.util.CustomEvent = function(type, oScope, silent, signature) { * Custom events provide a custom event that fires whenever there is * a new subscriber to the event. This provides an opportunity to * handle the case where there is a non-repeating event that has - * already fired has a new subscriber. + * already fired has a new subscriber. * * @event subscribeEvent * @type YAHOO.util.CustomEvent * @param {Function} fn The function to execute - * @param {Object} obj An object to be passed along when the event + * @param {Object} obj An object to be passed along when the event * fires - * @param {boolean|Object} override If true, the obj passed in becomes + * @param {boolean|Object} override If true, the obj passed in becomes * the execution scope of the listener. * if an object, that object becomes the * the execution scope. */ - this.subscribeEvent = + this.subscribeEvent = new YAHOO.util.CustomEvent(onsubscribeType, this, true); - } + } }; /** @@ -121,7 +124,7 @@ YAHOO.util.CustomEvent.LIST = 0; /** * Subscriber listener sigature constant. The FLAT type returns two - * parameters: the first argument passed to fire and the optional + * parameters: the first argument passed to fire and the optional * custom object * @property YAHOO.util.CustomEvent.FLAT * @static @@ -135,9 +138,9 @@ YAHOO.util.CustomEvent.prototype = { * Subscribes the caller to this event * @method subscribe * @param {Function} fn The function to execute - * @param {Object} obj An object to be passed along when the event + * @param {Object} obj An object to be passed along when the event * fires - * @param {boolean|Object} override If true, the obj passed in becomes + * @param {boolean|Object} override If true, the obj passed in becomes * the execution scope of the listener. * if an object, that object becomes the * the execution scope. @@ -172,17 +175,19 @@ YAHOO.util.CustomEvent.prototype = { /** * Notifies the subscribers. The callback functions will be executed - * from the scope specified when the event was created, and with the + * from the scope specified when the event was created, and with the * following parameters: *
        *
      • The type of event
      • *
      • All of the arguments fire() was executed with as an array
      • - *
      • The custom object (if any) that was passed into the subscribe() + *
      • The custom object (if any) that was passed into the subscribe() * method
      • *
      - * @method fire - * @param {Object*} arguments an arbitrary set of parameters to pass to + * @method fire + * @param {Object*} arguments an arbitrary set of parameters to pass to * the handler. + * @return {boolean} false if one of the subscribers returned false, + * true otherwise */ fire: function() { var len=this.subscribers.length; @@ -199,9 +204,9 @@ YAHOO.util.CustomEvent.prototype = { var argslength = args.length; if (!this.silent) { - YAHOO.log( "Firing " + this + ", " + + YAHOO.log( "Firing " + this + ", " + "args: " + args + ", " + - "subscribers: " + len, + "subscribers: " + len, "info", "Event" ); } @@ -209,7 +214,7 @@ YAHOO.util.CustomEvent.prototype = { var s = this.subscribers[i]; if (s) { if (!this.silent) { - YAHOO.log( this.type + "->" + (i+1) + ": " + s, + YAHOO.log( this.type + "->" + (i+1) + ": " + s, "info", "Event" ); } @@ -226,7 +231,7 @@ YAHOO.util.CustomEvent.prototype = { } if (false === ret) { if (!this.silent) { - YAHOO.log("Event cancelled, subscriber " + i + + YAHOO.log("Event cancelled, subscriber " + i + " of " + len); } @@ -268,7 +273,7 @@ YAHOO.util.CustomEvent.prototype = { * @method toString */ toString: function() { - return "CustomEvent: " + "'" + this.type + "', " + + return "CustomEvent: " + "'" + this.type + "', " + "scope: " + this.scope; } @@ -306,7 +311,7 @@ YAHOO.util.Subscriber = function(fn, obj, override) { * The default execution scope for the event listener is defined when the * event is created (usually the object which contains the event). * By setting override to true, the execution scope becomes the custom - * object passed in by the subscriber. If override is an object, that + * object passed in by the subscriber. If override is an object, that * object becomes the scope. * @property override * @type boolean|object @@ -341,7 +346,7 @@ YAHOO.util.Subscriber.prototype.getScope = function(defaultScope) { * @method contains * @param {Function} fn the function to execute * @param {Object} obj an object to be passed along when the event fires - * @return {boolean} true if the supplied arguments match this + * @return {boolean} true if the supplied arguments match this * subscriber's signature. */ YAHOO.util.Subscriber.prototype.contains = function(fn, obj) { @@ -356,7 +361,7 @@ YAHOO.util.Subscriber.prototype.contains = function(fn, obj) { * @method toString */ YAHOO.util.Subscriber.prototype.toString = function() { - return "Subscriber { obj: " + (this.obj || "") + + return "Subscriber { obj: " + (this.obj || "") + ", override: " + (this.override || "no") + " }"; }; @@ -523,7 +528,7 @@ if (!YAHOO.util.Event) { WFN: 3, /** - * Object passed in by the user that will be returned as a + * Object passed in by the user that will be returned as a * parameter to the callback, int constant * @property OBJ * @type int @@ -544,7 +549,7 @@ if (!YAHOO.util.Event) { /** * Safari detection is necessary to work around the preventDefault - * bug that makes it so you can't cancel a href click from the + * bug that makes it so you can't cancel a href click from the * handler. There is not a capabilities check we can use here. * @property isSafari * @private @@ -553,15 +558,15 @@ if (!YAHOO.util.Event) { isSafari: (/Safari|Konqueror|KHTML/gi).test(navigator.userAgent), /** - * IE detection needed to properly calculate pageX and pageY. - * capabilities checking didn't seem to work because another - * browser that does not provide the properties have the values + * IE detection needed to properly calculate pageX and pageY. + * capabilities checking didn't seem to work because another + * browser that does not provide the properties have the values * calculated in a different manner than IE. * @property isIE * @private * @static */ - isIE: (!this.isSafari && !navigator.userAgent.match(/opera/gi) && + isIE: (!this.isSafari && !navigator.userAgent.match(/opera/gi) && navigator.userAgent.match(/msie/gi)), /** @@ -605,10 +610,10 @@ if (!YAHOO.util.Event) { * @static */ onAvailable: function(p_id, p_fn, p_obj, p_override) { - onAvailStack.push( { id: p_id, - fn: p_fn, - obj: p_obj, - override: p_override, + onAvailStack.push( { id: p_id, + fn: p_fn, + obj: p_obj, + override: p_override, checkReady: false } ); retryCount = this.POLL_RETRYS; @@ -632,9 +637,9 @@ if (!YAHOO.util.Event) { * @static */ onContentReady: function(p_id, p_fn, p_obj, p_override) { - onAvailStack.push( { id: p_id, - fn: p_fn, - obj: p_obj, + onAvailStack.push( { id: p_id, + fn: p_fn, + obj: p_obj, override: p_override, checkReady: true } ); @@ -647,17 +652,18 @@ if (!YAHOO.util.Event) { * * @method addListener * - * @param {Object} el The html element to assign the + * @param {Object} el The html element to assign the * event to * @param {String} sType The type of event to append * @param {Function} fn The method the event invokes - * @param {Object} obj An arbitrary object that will be + * @param {Object} obj An arbitrary object that will be * passed as a parameter to the handler * @param {boolean} override If true, the obj passed in becomes * the execution scope of the listener * @return {boolean} True if the action was successful or defered, - * false if one or more of the elements - * could not have the event bound to it. + * false if one or more of the elements + * could not have the listener attached, + * or if the operation throws an exception. * @static */ addListener: function(el, sType, fn, obj, override) { @@ -672,22 +678,22 @@ if (!YAHOO.util.Event) { if ( this._isValidCollection(el)) { var ok = true; for (var i=0,len=el.length; i 0) { for (var i=0,len=listeners.length; i 0) { j = listeners.length; while (j) { index = j-1; l = listeners[index]; if (l) { - EU.removeListener(l[EU.EL], l[EU.TYPE], + EU.removeListener(l[EU.EL], l[EU.TYPE], l[EU.FN], index); - } + } j = j - 1; } l=null; @@ -1446,11 +1470,16 @@ if (!YAHOO.util.Event) { for (i=0,len=legacyEvents.length; i *
    • The first argument fire() was executed with
    • - *
    • The custom object (if any) that was passed into the subscribe() + *
    • The custom object (if any) that was passed into the subscribe() * method
    • *
    * @method fireEvent * @param p_type {string} the type, or name of the event - * @param arguments {Object*} an arbitrary set of parameters to pass to + * @param arguments {Object*} an arbitrary set of parameters to pass to * the handler. - * @return {boolean} the return value from CustomEvent.fire, or null if + * @return {boolean} the return value from CustomEvent.fire, or null if * the custom event does not exist. */ fireEvent: function(p_type, arg1, arg2, etc) { diff --git a/lib/yui/event/event-min.js b/lib/yui/event/event-min.js index 142a99735e..b937ca182e 100755 --- a/lib/yui/event/event-min.js +++ b/lib/yui/event/event-min.js @@ -1 +1,62 @@ -/* Copyright (c) 2006, Yahoo! Inc. All rights reserved.Code licensed under the BSD License:http://developer.yahoo.net/yui/license.txt version: 0.12.0 */ YAHOO.util.CustomEvent=function(_1,_2,_3,_4){this.type=_1;this.scope=_2||window;this.silent=_3;this.signature=_4||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}var _5="_YUICEOnSubscribe";if(_1!==_5){this.subscribeEvent=new YAHOO.util.CustomEvent(_5,this,true);}};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(fn,_7,_8){if(this.subscribeEvent){this.subscribeEvent.fire(fn,_7,_8);}this.subscribers.push(new YAHOO.util.Subscriber(fn,_7,_8));},unsubscribe:function(fn,_9){var _10=false;for(var i=0,len=this.subscribers.length;i0){_17=_14[0];}ret=s.fn.call(_16,_17,s.obj);}else{ret=s.fn.call(_16,this.type,_14,s.obj);}if(false===ret){if(!this.silent){}return false;}}}return true;},unsubscribeAll:function(){for(var i=0,len=this.subscribers.length;i=0){_60=_23[_61];}if(!el||!_60){return false;}if(this.useLegacyEvent(el,_59)){var _62=this.getLegacyIndex(el,_59);var _63=_26[_62];if(_63){for(i=0,len=_63.length;i0);}var _76=[];for(var i=0,len=_28.length;i0){for(var i=0,len=_23.length;i0){j=_23.length;while(j){index=j-1;l=_23[index];if(l){EU.removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],index);}j=j-1;}l=null;EU.clearCache();}for(i=0,len=_25.length;i0){param=args[0];} +ret=s.fn.call(scope,param,s.obj);}else{ret=s.fn.call(scope,this.type,args,s.obj);} +if(false===ret){if(!this.silent){} +return false;}}} +return true;},unsubscribeAll:function(){for(var i=0,len=this.subscribers.length;i=0){cacheItem=listeners[index];} +if(!el||!cacheItem){return false;} +if(this.useLegacyEvent(el,sType)){var legacyIndex=this.getLegacyIndex(el,sType);var llist=legacyHandlers[legacyIndex];if(llist){for(i=0,len=llist.length;i0);} +var notAvail=[];for(var i=0,len=onAvailStack.length;i0){for(var i=0,len=listeners.length;i0){j=listeners.length;while(j){index=j-1;l=listeners[index];if(l){EU.removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],index);} +j=j-1;} +l=null;EU.clearCache();} +for(i=0,len=legacyEvents.length;i 0) { j = listeners.length; while (j) { @@ -1421,11 +1449,16 @@ if (!YAHOO.util.Event) { for (i=0,len=legacyEvents.length; i thresholdMin) ? (entriesLen - thresholdMin) : 0; - - // Iterate through all log entries + + // Iterate through all log entries var sourceFiltersLen = this._sourceFilters.length; var categoryFiltersLen = this._categoryFilters.length; for(var i=entriesStartIndex; i thresholdMin) ? (entriesLen - thresholdMin) : 0; - - // Iterate through all log entries + + // Iterate through all log entries var sourceFiltersLen = this._sourceFilters.length; var categoryFiltersLen = this._categoryFilters.length; for(var i=entriesStartIndex; iThe Menu Library features a collection of widgets that make @@ -27,8 +29,8 @@ version: 0.12.0 */ (function() { -var Dom = YAHOO.util.Dom; -var Event = YAHOO.util.Event; +var Dom = YAHOO.util.Dom, + Event = YAHOO.util.Event; /** * Singleton that manages a collection of all menus and menu items. Listens for @@ -39,47 +41,50 @@ var Event = YAHOO.util.Event; * @class MenuManager * @static */ -YAHOO.widget.MenuManager = new function() { +YAHOO.widget.MenuManager = function() { // Private member variables // Flag indicating if the DOM event handlers have been attached - var m_bInitializedEventHandlers = false; + var m_bInitializedEventHandlers = false, - // Collection of menus + // Collection of menus - var m_oMenus = {}; + m_oMenus = {}, - // Collection of menu items + // Collection of menu items - var m_oItems = {}; + m_oItems = {}, - // Collection of visible menus + // Collection of visible menus - var m_oVisibleMenus = {}; + m_oVisibleMenus = {}, - // Logger + // Logger - var m_oLogger = new YAHOO.widget.LogWriter(this.toString()); + m_oLogger = new YAHOO.widget.LogWriter(this.toString()), + me = this; + // Private methods /** - * Adds an item to the collection of known menu items. + * @method addItem + * @description Adds an item to the collection of known menu items. * @private * @param {YAHOO.widget.MenuItem} p_oItem Object specifying the MenuItem * instance to be added. */ - var addItem = function(p_oItem) { + function addItem(p_oItem) { var sYUIId = Dom.generateId(); @@ -96,16 +101,17 @@ YAHOO.widget.MenuManager = new function() { } - }; + } /** - * Removes an item from the collection of known menu items. + * @method removeItem + * @description Removes an item from the collection of known menu items. * @private * @param {YAHOO.widget.MenuItem} p_oItem Object specifying the MenuItem * instance to be removed. */ - var removeItem = function(p_oItem) { + function removeItem(p_oItem) { var sYUIId = p_oItem.element.getAttribute("yuiid"); @@ -118,17 +124,19 @@ YAHOO.widget.MenuManager = new function() { } - }; + } /** - * Finds the root DIV node of a menu or the root LI node of a menu item. + * @method getMenuRootElement + * @description Finds the root DIV node of a menu or the root LI node of a + * menu item. * @private * @param {HTMLElement} p_oElement Object specifying * an HTML element. */ - var getMenuRootElement = function(p_oElement) { + function getMenuRootElement(p_oElement) { var oParentNode; @@ -180,7 +188,7 @@ YAHOO.widget.MenuManager = new function() { } - }; + } @@ -188,7 +196,8 @@ YAHOO.widget.MenuManager = new function() { /** - * Generic, global event handler for all of a menu's DOM-based + * @method onDOMEvent + * @description Generic, global event handler for all of a menu's DOM-based * events. This listens for events against the document object. If the * target of a given event is a member of a menu or menu item's DOM, the * instance's corresponding Custom Event is fired. @@ -196,19 +205,18 @@ YAHOO.widget.MenuManager = new function() { * @param {Event} p_oEvent Object representing the DOM event object passed * back by the event utility (YAHOO.util.Event). */ - var onDOMEvent = function(p_oEvent) { + function onDOMEvent(p_oEvent) { // Get the target node of the DOM event - var oTarget = Event.getTarget(p_oEvent); + var oTarget = Event.getTarget(p_oEvent), // See if the target of the event was a menu, or a menu item - var oElement = getMenuRootElement(oTarget); - - var oMenuItem; - var oMenu; + oElement = getMenuRootElement(oTarget), + oMenuItem, + oMenu; if(oElement) { @@ -252,9 +260,9 @@ YAHOO.widget.MenuManager = new function() { "keydown": "keyDownEvent", "keyup": "keyUpEvent", "keypress": "keyPressEvent" - }; + }, - var sCustomEventType = oEventTypes[p_oEvent.type]; + sCustomEventType = oEventTypes[p_oEvent.type]; // Fire the Custom Even that corresponds the current DOM event @@ -304,11 +312,12 @@ YAHOO.widget.MenuManager = new function() { } - }; + } /** - * "destroy" event handler for a menu. + * @method onMenuDestroy + * @description "destroy" event handler for a menu. * @private * @param {String} p_sType String representing the name of the event that * was fired. @@ -316,15 +325,23 @@ YAHOO.widget.MenuManager = new function() { * @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that * fired the event. */ - var onMenuDestroy = function(p_sType, p_aArgs, p_oMenu) { + function onMenuDestroy(p_sType, p_aArgs, p_oMenu) { - this.removeMenu(p_oMenu); + if(p_oMenu && m_oMenus[p_oMenu.id]) { - }; + delete m_oMenus[p_oMenu.id]; + + m_oLogger.log("Menu: " + + p_oMenu.toString() + " successfully unregistered."); + + } + + } /** - * "destroy" event handler for a MenuItem instance. + * @method onItemDestroy + * @description "destroy" event handler for a MenuItem instance. * @private * @param {String} p_sType String representing the name of the event that * was fired. @@ -332,7 +349,7 @@ YAHOO.widget.MenuManager = new function() { * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item * that fired the event. */ - var onItemDestroy = function(p_sType, p_aArgs, p_oItem) { + function onItemDestroy(p_sType, p_aArgs, p_oItem) { var sYUIId = p_oItem.element.getAttribute("yuiid"); @@ -342,11 +359,12 @@ YAHOO.widget.MenuManager = new function() { } - }; + } /** - * Event handler for when the "visible" configuration property + * @method onMenuVisibleConfigChange + * @description Event handler for when the "visible" configuration property * of a Menu instance changes. * @private * @param {String} p_sType String representing the name of the event that @@ -355,7 +373,7 @@ YAHOO.widget.MenuManager = new function() { * @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that * fired the event. */ - var onMenuVisibleConfigChange = function(p_sType, p_aArgs, p_oMenu) { + function onMenuVisibleConfigChange(p_sType, p_aArgs, p_oMenu) { var bVisible = p_aArgs[0]; @@ -374,3697 +392,3716 @@ YAHOO.widget.MenuManager = new function() { m_oLogger.log("Menu: " + p_oMenu.toString() + - " unregistered from the collection of visible menus."); - - } - - }; - - - /** - * "itemadded" event handler for a Menu instance. - * @private - * @param {String} p_sType String representing the name of the event that - * was fired. - * @param {Array} p_aArgs Array of arguments sent when the event was fired. - */ - var onItemAdded = function(p_sType, p_aArgs) { - - addItem(p_aArgs[0]); - - }; - - - /** - * "itemremoved" event handler for a Menu instance. - * @private - * @param {String} p_sType String representing the name of the event that - * was fired. - * @param {Array} p_aArgs Array of arguments sent when the event was fired. - */ - var onItemRemoved = function(p_sType, p_aArgs) { - - removeItem(p_aArgs[0]); - - }; - - - - // Privileged methods - - - /** - * @method addMenu - * @description Adds a menu to the collection of known menus. - * @param {YAHOO.widget.Menu} p_oMenu Object specifying the Menu instance - * to be added. - */ - this.addMenu = function(p_oMenu) { - - if(p_oMenu && p_oMenu.id && !m_oMenus[p_oMenu.id]) { - - m_oMenus[p_oMenu.id] = p_oMenu; - - - if(!m_bInitializedEventHandlers) { - - var oDoc = document; - - Event.addListener(oDoc, "mouseover", onDOMEvent, this, true); - Event.addListener(oDoc, "mouseout", onDOMEvent, this, true); - Event.addListener(oDoc, "mousedown", onDOMEvent, this, true); - Event.addListener(oDoc, "mouseup", onDOMEvent, this, true); - Event.addListener(oDoc, "click", onDOMEvent, this, true); - Event.addListener(oDoc, "keydown", onDOMEvent, this, true); - Event.addListener(oDoc, "keyup", onDOMEvent, this, true); - Event.addListener(oDoc, "keypress", onDOMEvent, this, true); - - m_bInitializedEventHandlers = true; - - m_oLogger.log("DOM event handlers initialized."); - - } - - p_oMenu.destroyEvent.subscribe(onMenuDestroy, p_oMenu, this); - - p_oMenu.cfg.subscribeToConfigEvent( - "visible", - onMenuVisibleConfigChange, - p_oMenu - ); - - p_oMenu.itemAddedEvent.subscribe(onItemAdded); - p_oMenu.itemRemovedEvent.subscribe(onItemRemoved); - - m_oLogger.log("Menu: " + - p_oMenu.toString() + " successfully registered."); - - } - - }; - - - /** - * @method removeMenu - * @description Removes a menu from the collection of known menus. - * @param {YAHOO.widget.Menu} p_oMenu Object specifying the Menu instance - * to be removed. - */ - this.removeMenu = function(p_oMenu) { - - if(p_oMenu && m_oMenus[p_oMenu.id]) { - - delete m_oMenus[p_oMenu.id]; - - m_oLogger.log("Menu: " + - p_oMenu.toString() + " successfully unregistered."); - - } - - }; - - - /** - * @method hideVisible - * @description Hides all visible, dynamically positioned menus. - */ - this.hideVisible = function() { - - var oMenu; - - for(var i in m_oVisibleMenus) { - - if(m_oVisibleMenus.hasOwnProperty(i)) { - - oMenu = m_oVisibleMenus[i]; - - if(oMenu.cfg.getProperty("position") == "dynamic") { - - oMenu.hide(); - - } - - } - - } - - }; - - - /** - * @method getMenus - * @description Returns an array of all menus registered with the - * menu manger. - * @return {Array} - */ - this.getMenus = function() { - - return m_oMenus; - - }; - - - /** - * @method getMenu - * @description Returns a menu with the specified id. - * @param {String} p_sId String specifying the id of the menu to - * be retrieved. - * @return {YAHOO.widget.Menu} - */ - this.getMenu = function(p_sId) { - - if(m_oMenus[p_sId]) { - - return m_oMenus[p_sId]; - - } - - }; - - - /** - * @method toString - * @description Returns a string representing the menu manager. - * @return {String} - */ - this.toString = function() { - - return ("MenuManager"); - - }; - -}; - -})(); - - -(function() { - -var Dom = YAHOO.util.Dom; -var Event = YAHOO.util.Event; - - -/** -* The Menu class creates a container that holds a vertical list representing -* a set of options or commands. Menu is the base class for all -* menu containers. -* @param {String} p_oElement String specifying the id attribute of the -* <div> element of the menu. -* @param {String} p_oElement String specifying the id attribute of the -* <select> element to be used as the data source -* for the menu. -* @param {HTMLDivElement} p_oElement Object -* specifying the <div> element of the menu. -* @param {HTMLSelectElement} p_oElement -* Object specifying the <select> element to be used as -* the data source for the menu. -* @param {Object} p_oConfig Optional. Object literal specifying the -* configuration for the menu. See configuration class documentation for -* more details. -* @namespace YAHOO.widget -* @class Menu -* @constructor -* @extends YAHOO.widget.Overlay -*/ -YAHOO.widget.Menu = function(p_oElement, p_oConfig) { - - if(p_oConfig) { - - this.parent = p_oConfig.parent; - - this.lazyLoad = p_oConfig.lazyLoad || p_oConfig.lazyload; - - this.itemData = p_oConfig.itemData || p_oConfig.itemdata; - - } - - - YAHOO.widget.Menu.superclass.constructor.call( - this, - p_oElement, - p_oConfig - ); - -}; - -YAHOO.extend(YAHOO.widget.Menu, YAHOO.widget.Overlay, { - - - -// Constants - - -/** -* @property CSS_CLASS_NAME -* @description String representing the CSS class(es) to be applied to the -* menu's <div> element. -* @default "yuimenu" -* @final -* @type String -*/ -CSS_CLASS_NAME: "yuimenu", - - -/** -* @property ITEM_TYPE -* @description Object representing the type of menu item to instantiate and -* add when parsing the child nodes (either <li> element, -* <optgroup> element or <option>) -* of the menu's source HTML element. -* @default YAHOO.widget.MenuItem -* @final -* @type YAHOO.widget.MenuItem -*/ -ITEM_TYPE: null, - - -/** -* @property GROUP_TITLE_TAG_NAME -* @description String representing the tagname of the HTML element used to -* title the menu's item groups. -* @default H6 -* @final -* @type String -*/ -GROUP_TITLE_TAG_NAME: "h6", - - - -// Private properties - - -/** -* @property _nHideDelayId -* @description Number representing the time-out setting used to cancel the -* hiding of a menu. -* @default null -* @private -* @type Number -*/ -_nHideDelayId: null, - - -/** -* @property _nShowDelayId -* @description Number representing the time-out setting used to cancel the -* showing of a menu. -* @default null -* @private -* @type Number -*/ -_nShowDelayId: null, - - -/** -* @property _hideDelayEventHandlersAssigned -* @description Boolean indicating if the "mouseover" and "mouseout" event -* handlers used for hiding the menu via a call to "window.setTimeout" have -* already been assigned. -* @default false -* @private -* @type Boolean -*/ -_hideDelayEventHandlersAssigned: false, - - -/** -* @property _bHandledMouseOverEvent -* @description Boolean indicating the current state of the menu's -* "mouseover" event. -* @default false -* @private -* @type Boolean -*/ -_bHandledMouseOverEvent: false, - - -/** -* @property _bHandledMouseOutEvent -* @description Boolean indicating the current state of the menu's -* "mouseout" event. -* @default false -* @private -* @type Boolean -*/ -_bHandledMouseOutEvent: false, - - -/** -* @property _aGroupTitleElements -* @description Array of HTML element used to title groups of menu items. -* @default [] -* @private -* @type Array -*/ -_aGroupTitleElements: null, - - -/** -* @property _aItemGroups -* @description Array of menu items. -* @default [] -* @private -* @type Array -*/ -_aItemGroups: null, - - -/** -* @property _aListElements -* @description Array of <ul> elements, each of which is -* the parent node for each item's <li> element. -* @default [] -* @private -* @type Array -*/ -_aListElements: null, - - - -// Public properties - - -/** -* @property lazyLoad -* @description Boolean indicating if the menu's "lazy load" feature is -* enabled. If set to "true," initialization and rendering of the menu's -* items will be deferred until the first time it is made visible. This -* property should be set via the constructor using the configuration -* object literal. -* @default false -* @type Boolean -*/ -lazyLoad: false, - - -/** -* @property itemData -* @description Array of items to be added to the menu. The array can contain -* strings representing the text for each item to be created, object literals -* representing the menu item configuration properties, or MenuItem instances. -* This property should be set via the constructor using the configuration -* object literal. -* @default null -* @type Array -*/ -itemData: null, - - -/** -* @property activeItem -* @description Object reference to the item in the menu that has focus. -* @default null -* @type YAHOO.widget.MenuItem -*/ -activeItem: null, - - -/** -* @property parent -* @description Object reference to the menu's parent menu or menu item. -* This property can be set via the constructor using the configuration -* object literal. -* @default null -* @type YAHOO.widget.MenuItem -*/ -parent: null, - - -/** -* @property srcElement -* @description Object reference to the HTML element (either -* <select> or <div>) used to -* create the menu. -* @default null -* @type HTMLSelectElement|HTMLDivElement -*/ -srcElement: null, - - - -// Events - - -/** -* @event mouseOverEvent -* @description Fires when the mouse has entered the menu. Passes back -* the DOM Event object as an argument. -*/ -mouseOverEvent: null, - - -/** -* @event mouseOutEvent -* @description Fires when the mouse has left the menu. Passes back the DOM -* Event object as an argument. -* @type YAHOO.util.CustomEvent -*/ -mouseOutEvent: null, - - -/** -* @event mouseDownEvent -* @description Fires when the user mouses down on the menu. Passes back the -* DOM Event object as an argument. -* @type YAHOO.util.CustomEvent -*/ -mouseDownEvent: null, - - -/** -* @event mouseUpEvent -* @description Fires when the user releases a mouse button while the mouse is -* over the menu. Passes back the DOM Event object as an argument. -* @type YAHOO.util.CustomEvent -*/ -mouseUpEvent: null, - - -/** -* @event clickEvent -* @description Fires when the user clicks the on the menu. Passes back the -* DOM Event object as an argument. -* @type YAHOO.util.CustomEvent -*/ -clickEvent: null, - - -/** -* @event keyPressEvent -* @description Fires when the user presses an alphanumeric key when one of the -* menu's items has focus. Passes back the DOM Event object as an argument. -* @type YAHOO.util.CustomEvent -*/ -keyPressEvent: null, - - -/** -* @event keyDownEvent -* @description Fires when the user presses a key when one of the menu's items -* has focus. Passes back the DOM Event object as an argument. -* @type YAHOO.util.CustomEvent -*/ -keyDownEvent: null, - - -/** -* @event keyUpEvent -* @description Fires when the user releases a key when one of the menu's items -* has focus. Passes back the DOM Event object as an argument. -* @type YAHOO.util.CustomEvent -*/ -keyUpEvent: null, - - -/** -* @event itemAddedEvent -* @description Fires when an item is added to the menu. -* @type YAHOO.util.CustomEvent -*/ -itemAddedEvent: null, - - -/** -* @event itemRemovedEvent -* @description Fires when an item is removed to the menu. -* @type YAHOO.util.CustomEvent -*/ -itemRemovedEvent: null, - - -/** -* @method init -* @description The Menu class's initialization method. This method is -* automatically called by the constructor, and sets up all DOM references -* for pre-existing markup, and creates required markup if it is not -* already present. -* @param {String} p_oElement String specifying the id attribute of the -* <div> element of the menu. -* @param {String} p_oElement String specifying the id attribute of the -* <select> element to be used as the data source -* for the menu. -* @param {HTMLDivElement} p_oElement Object -* specifying the <div> element of the menu. -* @param {HTMLSelectElement} p_oElement -* Object specifying the <select> element to be used as -* the data source for the menu. -* @param {Object} p_oConfig Optional. Object literal specifying the -* configuration for the menu. See configuration class documentation for -* more details. -*/ -init: function(p_oElement, p_oConfig) { - - this._aItemGroups = []; - this._aListElements = []; - this._aGroupTitleElements = []; - - - if(!this.ITEM_TYPE) { - - this.ITEM_TYPE = YAHOO.widget.MenuItem; - - } - - - var oElement; - - if(typeof p_oElement == "string") { - - oElement = document.getElementById(p_oElement); - - } - else if(p_oElement.tagName) { - - oElement = p_oElement; - - } - - - if(oElement && oElement.tagName) { - - switch(oElement.tagName.toUpperCase()) { - - case "DIV": - - this.srcElement = oElement; - - if(!oElement.id) { - - oElement.setAttribute("id", Dom.generateId()); - - } - - - /* - Note: we don't pass the user config in here yet - because we only want it executed once, at the lowest - subclass level. - */ - - YAHOO.widget.Menu.superclass.init.call(this, oElement); - - this.beforeInitEvent.fire(YAHOO.widget.Menu); - - this.logger = new YAHOO.widget.LogWriter(this.toString()); - - this.logger.log("Source element: " + this.srcElement.tagName); - - break; - - case "SELECT": - - this.srcElement = oElement; - - - /* - The source element is not something that we can use - outright, so we need to create a new Overlay - - Note: we don't pass the user config in here yet - because we only want it executed once, at the lowest - subclass level. - */ - - YAHOO.widget.Menu.superclass.init.call(this, Dom.generateId()); - - this.beforeInitEvent.fire(YAHOO.widget.Menu); - - this.logger = new YAHOO.widget.LogWriter(this.toString()); - - this.logger.log("Source element: " + this.srcElement.tagName); - - break; - - } - - } - else { - - /* - Note: we don't pass the user config in here yet - because we only want it executed once, at the lowest - subclass level. - */ - - YAHOO.widget.Menu.superclass.init.call(this, p_oElement); - - this.beforeInitEvent.fire(YAHOO.widget.Menu); - - this.logger = new YAHOO.widget.LogWriter(this.toString()); - - this.logger.log("No source element found. " + - "Created element with id: " + this.id); - - } - - - if(this.element) { - - var oEl = this.element; - - Dom.addClass(oEl, this.CSS_CLASS_NAME); - - - // Subscribe to Custom Events - - this.initEvent.subscribe(this._onInit, this, true); - this.beforeRenderEvent.subscribe(this._onBeforeRender, this, true); - this.renderEvent.subscribe(this._onRender, this, true); - this.beforeShowEvent.subscribe(this._onBeforeShow, this, true); - this.showEvent.subscribe(this._onShow, this, true); - this.beforeHideEvent.subscribe(this._onBeforeHide, this, true); - this.mouseOverEvent.subscribe(this._onMouseOver, this, true); - this.mouseOutEvent.subscribe(this._onMouseOut, this, true); - this.clickEvent.subscribe(this._onClick, this, true); - this.keyDownEvent.subscribe(this._onKeyDown, this, true); - - - if(p_oConfig) { - - this.cfg.applyConfig(p_oConfig, true); - - } - - - // Register the Menu instance with the MenuManager - - YAHOO.widget.MenuManager.addMenu(this); - - - this.initEvent.fire(YAHOO.widget.Menu); - - } - -}, - - - -// Private methods - - -/** -* @method _initSubTree -* @description Iterates the childNodes of the source element to find nodes -* used to instantiate menu and menu items. -* @private -*/ -_initSubTree: function() { - - var oNode; - - if(this.srcElement.tagName == "DIV") { - - /* - Populate the collection of item groups and item - group titles - */ - - oNode = this.body.firstChild; - - var nGroup = 0; - var sGroupTitleTagName = this.GROUP_TITLE_TAG_NAME.toUpperCase(); - - do { - - if(oNode && oNode.tagName) { - - switch(oNode.tagName.toUpperCase()) { - - case sGroupTitleTagName: - - this._aGroupTitleElements[nGroup] = oNode; - - break; - - case "UL": - - this._aListElements[nGroup] = oNode; - this._aItemGroups[nGroup] = []; - nGroup++; - - break; - - } - - } - - } - while((oNode = oNode.nextSibling)); - - - /* - Apply the "first-of-type" class to the first UL to mimic - the "first-of-type" CSS3 psuedo class. - */ - - if(this._aListElements[0]) { - - Dom.addClass(this._aListElements[0], "first-of-type"); - - } - - } - - - oNode = null; - - this.logger.log("Searching DOM for items to initialize."); - - if(this.srcElement.tagName) { - - switch(this.srcElement.tagName.toUpperCase()) { - - case "DIV": - - if(this._aListElements.length > 0) { - - this.logger.log("Found " + - this._aListElements.length + - " item groups to initialize."); - - var i = this._aListElements.length - 1; - - do { - - oNode = this._aListElements[i].firstChild; - - this.logger.log("Scanning " + - this._aListElements[i].childNodes.length + - " child nodes for items to initialize."); - - do { - - if(oNode && oNode.tagName) { - - switch(oNode.tagName.toUpperCase()) { - - case "LI": - - this.logger.log("Initializing " + - oNode.tagName + " node."); - - this.addItem( - new this.ITEM_TYPE( - oNode, - { parent: this } - ), - i - ); - - break; - - } - - } - - } - while((oNode = oNode.nextSibling)); - - } - while(i--); - - } - - break; - - case "SELECT": - - this.logger.log("Scanning " + - this.srcElement.childNodes.length + - " child nodes for items to initialize."); - - oNode = this.srcElement.firstChild; - - do { - - if(oNode && oNode.tagName) { - - switch(oNode.tagName.toUpperCase()) { - - case "OPTGROUP": - case "OPTION": - - this.logger.log("Initializing " + - oNode.tagName + " node."); - - this.addItem( - new this.ITEM_TYPE( - oNode, - { parent: this } - ) - ); - - break; - - } - - } - - } - while((oNode = oNode.nextSibling)); - - break; - - } - - } - -}, - - -/** -* @method _getFirstEnabledItem -* @description Returns the first enabled item in the menu. -* @return {YAHOO.widget.MenuItem} -* @private -*/ -_getFirstEnabledItem: function() { - - var nGroups = this._aItemGroups.length; - var oItem; - var aItemGroup; - - for(var i=0; i= aGroup.length); - - - if(aGroup[p_nItemIndex]) { - - aGroup.splice(p_nItemIndex, 0, oItem); - - } - else { - - aGroup[p_nItemIndex] = oItem; - - } - - - oGroupItem = aGroup[p_nItemIndex]; - - if(oGroupItem) { - - if( - bAppend && - ( - !oGroupItem.element.parentNode || - oGroupItem.element.parentNode.nodeType == 11 - ) - ) { - - this._aListElements[nGroupIndex].appendChild( - oGroupItem.element - ); - - } - else { - - - /** - * Returns the next sibling of an item in an array. - * @private - * @param {p_aArray} Array to search. - * @param {p_nStartIndex} Number indicating the index to - * start searching the array. - * @return {Object} - */ - var getNextItemSibling = - - function(p_aArray, p_nStartIndex) { - - return ( - p_aArray[p_nStartIndex] || - getNextItemSibling( - p_aArray, - (p_nStartIndex+1) - ) - ); - - }; - - - var oNextItemSibling = - getNextItemSibling(aGroup, (p_nItemIndex+1)); - - if( - oNextItemSibling && - ( - !oGroupItem.element.parentNode || - oGroupItem.element.parentNode.nodeType == 11 - ) - ) { - - this._aListElements[nGroupIndex].insertBefore( - oGroupItem.element, - oNextItemSibling.element - ); - - } - - } - - - oGroupItem.parent = this; - - this._subscribeToItemEvents(oGroupItem); - - this._configureSubmenu(oGroupItem); - - this._updateItemProperties(nGroupIndex); - - this.logger.log("Item inserted." + - " Text: " + oGroupItem.cfg.getProperty("text") + ", " + - " Index: " + oGroupItem.index + ", " + - " Group Index: " + oGroupItem.groupIndex); - - this.itemAddedEvent.fire(oGroupItem); - - return oGroupItem; - - } - - } - else { - - var nItemIndex = aGroup.length; - - aGroup[nItemIndex] = oItem; - - oGroupItem = aGroup[nItemIndex]; - - - if(oGroupItem) { - - if( - !Dom.isAncestor( - this._aListElements[nGroupIndex], - oGroupItem.element - ) - ) { - - this._aListElements[nGroupIndex].appendChild( - oGroupItem.element - ); - - } - - oGroupItem.element.setAttribute("groupindex", nGroupIndex); - oGroupItem.element.setAttribute("index", nItemIndex); - - oGroupItem.parent = this; - - oGroupItem.index = nItemIndex; - oGroupItem.groupIndex = nGroupIndex; - - this._subscribeToItemEvents(oGroupItem); - - this._configureSubmenu(oGroupItem); - - if(nItemIndex === 0) { - - Dom.addClass(oGroupItem.element, "first-of-type"); - - } - - this.logger.log("Item added." + - " Text: " + oGroupItem.cfg.getProperty("text") + ", " + - " Index: " + oGroupItem.index + ", " + - " Group Index: " + oGroupItem.groupIndex); - - - this.itemAddedEvent.fire(oGroupItem); - - return oGroupItem; - - } - - } - - } - -}, - - -/** -* @method _removeItemFromGroupByIndex -* @description Removes a menu item from a group by index. Returns the menu -* item that was removed. -* @private -* @param {Number} p_nGroupIndex Number indicating the group to which the menu -* item belongs. -* @param {Number} p_nItemIndex Number indicating the index of the menu item -* to be removed. -* @return {YAHOO.widget.MenuItem} -*/ -_removeItemFromGroupByIndex: function(p_nGroupIndex, p_nItemIndex) { - - var nGroupIndex = typeof p_nGroupIndex == "number" ? p_nGroupIndex : 0; - var aGroup = this._getItemGroup(nGroupIndex); - - if(aGroup) { - - var aArray = aGroup.splice(p_nItemIndex, 1); - var oItem = aArray[0]; - - if(oItem) { - - // Update the index and className properties of each member - - this._updateItemProperties(nGroupIndex); - - if(aGroup.length === 0) { - - // Remove the UL - - var oUL = this._aListElements[nGroupIndex]; - - if(this.body && oUL) { - - this.body.removeChild(oUL); - - } - - // Remove the group from the array of items - - this._aItemGroups.splice(nGroupIndex, 1); - - - // Remove the UL from the array of ULs - - this._aListElements.splice(nGroupIndex, 1); - - - /* - Assign the "first-of-type" class to the new first UL - in the collection - */ - - oUL = this._aListElements[0]; - - if(oUL) { - - Dom.addClass(oUL, "first-of-type"); - - } - - } - - - this.itemRemovedEvent.fire(oItem); - - - // Return a reference to the item that was removed - - return oItem; - - } - - } - -}, - - -/** -* @method _removeItemFromGroupByValue -* @description Removes a menu item from a group by reference. Returns the -* menu item that was removed. -* @private -* @param {Number} p_nGroupIndex Number indicating the group to which the -* menu item belongs. -* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem -* instance to be removed. -* @return {YAHOO.widget.MenuItem} -*/ -_removeItemFromGroupByValue: function(p_nGroupIndex, p_oItem) { - - var aGroup = this._getItemGroup(p_nGroupIndex); - - if(aGroup) { - - var nItems = aGroup.length; - var nItemIndex = -1; - - if(nItems > 0) { - - var i = nItems-1; - - do { - - if(aGroup[i] == p_oItem) { - - nItemIndex = i; - break; - - } - - } - while(i--); - - if(nItemIndex > -1) { - - return this._removeItemFromGroupByIndex( - p_nGroupIndex, - nItemIndex - ); - - } - - } - - } - -}, - - -/** -* @method _updateItemProperties -* @description Updates the "index," "groupindex," and "className" properties -* of the menu items in the specified group. -* @private -* @param {Number} p_nGroupIndex Number indicating the group of items to update. -*/ -_updateItemProperties: function(p_nGroupIndex) { - - var aGroup = this._getItemGroup(p_nGroupIndex); - var nItems = aGroup.length; - - if(nItems > 0) { - - var i = nItems - 1; - var oItem; - var oLI; - - // Update the index and className properties of each member - - do { - - oItem = aGroup[i]; - - if(oItem) { - - oLI = oItem.element; - - oItem.index = i; - oItem.groupIndex = p_nGroupIndex; - - oLI.setAttribute("groupindex", p_nGroupIndex); - oLI.setAttribute("index", i); - - Dom.removeClass(oLI, "first-of-type"); - - } - - } - while(i--); - - - if(oLI) { - - Dom.addClass(oLI, "first-of-type"); - - } - - } - -}, - - -/** -* @method _createItemGroup -* @description Creates a new menu item group (array) and its associated -* <ul> element. Returns an aray of menu item groups. -* @private -* @param {Number} p_nIndex Number indicating the group to create. -* @return {Array} -*/ -_createItemGroup: function(p_nIndex) { - - if(!this._aItemGroups[p_nIndex]) { - - this._aItemGroups[p_nIndex] = []; - - var oUL = document.createElement("ul"); - - this._aListElements[p_nIndex] = oUL; - - return this._aItemGroups[p_nIndex]; - - } - -}, - - -/** -* @method _getItemGroup -* @description Returns the menu item group at the specified index. -* @private -* @param {Number} p_nIndex Number indicating the index of the menu item group -* to be retrieved. -* @return {Array} -*/ -_getItemGroup: function(p_nIndex) { - - var nIndex = ((typeof p_nIndex == "number") ? p_nIndex : 0); - - return this._aItemGroups[nIndex]; - -}, - - -/** -* @method _configureSubmenu -* @description Subscribes the menu item's submenu to its parent menu's events. -* @private -* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem -* instance with the submenu to be configured. -*/ -_configureSubmenu: function(p_oItem) { - - var oSubmenu = p_oItem.cfg.getProperty("submenu"); - - if(oSubmenu) { - - /* - Listen for configuration changes to the parent menu - so they they can be applied to the submenu. - */ - - this.cfg.configChangedEvent.subscribe( - this._onParentMenuConfigChange, - oSubmenu, - true - ); - - this.renderEvent.subscribe( - this._onParentMenuRender, - oSubmenu, - true - ); - - oSubmenu.beforeShowEvent.subscribe( - this._onSubmenuBeforeShow, - oSubmenu, - true - ); - - oSubmenu.showEvent.subscribe( - this._onSubmenuShow, - oSubmenu, - true - ); - - oSubmenu.hideEvent.subscribe( - this._onSubmenuHide, - oSubmenu, - true - ); - - } - -}, - - -/** -* @method _subscribeToItemEvents -* @description Subscribes a menu to a menu item's event. -* @private -* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem -* instance whose events should be subscribed to. -*/ -_subscribeToItemEvents: function(p_oItem) { - - p_oItem.focusEvent.subscribe(this._onMenuItemFocus, p_oItem, this); - - p_oItem.blurEvent.subscribe(this._onMenuItemBlur, this, true); - - p_oItem.cfg.configChangedEvent.subscribe( - this._onMenuItemConfigChange, - p_oItem, - this - ); - -}, - - -/** -* @method _getOffsetWidth -* @description Returns the offset width of the menu's -* <div> element. -* @private -*/ -_getOffsetWidth: function() { - - var oClone = this.element.cloneNode(true); - - Dom.setStyle(oClone, "width", ""); - - document.body.appendChild(oClone); - - var sWidth = oClone.offsetWidth; - - document.body.removeChild(oClone); - - return sWidth; - -}, - - -/** -* @method _cancelHideDelay -* @description Cancels the call to "hideMenu." -* @private -*/ -_cancelHideDelay: function() { - - var oRoot = this.getRoot(); - - if(oRoot._nHideDelayId) { - - window.clearTimeout(oRoot._nHideDelayId); - - } - -}, - - -/** -* @method _execHideDelay -* @description Hides the menu after the number of milliseconds specified by -* the "hidedelay" configuration property. -* @private -*/ -_execHideDelay: function() { - - this._cancelHideDelay(); - - var oRoot = this.getRoot(); - var me = this; - - var hideMenu = function() { - - if(oRoot.activeItem) { - - oRoot.clearActiveItem(); - - } - - if(oRoot == me && me.cfg.getProperty("position") == "dynamic") { - - me.hide(); - - } - - }; - - - oRoot._nHideDelayId = - window.setTimeout(hideMenu, oRoot.cfg.getProperty("hidedelay")); - -}, - - -/** -* @method _cancelShowDelay -* @description Cancels the call to the "showMenu." -* @private -*/ -_cancelShowDelay: function() { - - var oRoot = this.getRoot(); - - if(oRoot._nShowDelayId) { - - window.clearTimeout(oRoot._nShowDelayId); - - } - -}, - - -/** -* @method _execShowDelay -* @description Shows the menu after the number of milliseconds specified by -* the "showdelay" configuration property have ellapsed. -* @private -* @param {YAHOO.widget.Menu} p_oMenu Object specifying the menu that should -* be made visible. -*/ -_execShowDelay: function(p_oMenu) { - - this._cancelShowDelay(); - - var oRoot = this.getRoot(); - - var showMenu = function() { - - p_oMenu.show(); - - }; - - - oRoot._nShowDelayId = - window.setTimeout(showMenu, oRoot.cfg.getProperty("showdelay")); - -}, - - - -// Protected methods - - -/** -* @method _onMouseOver -* @description "mouseover" event handler for the menu. -* @protected -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that -* fired the event. -*/ -_onMouseOver: function(p_sType, p_aArgs, p_oMenu) { - - var oEvent = p_aArgs[0]; - var oItem = p_aArgs[1]; - var oTarget = Event.getTarget(oEvent); - - if( - !this._bHandledMouseOverEvent && - (oTarget == this.element || Dom.isAncestor(this.element, oTarget)) - ) { - - // MENU MOUSEOVER LOGIC HERE - - this.clearActiveItem(); - - this._bHandledMouseOverEvent = true; - this._bHandledMouseOutEvent = false; - - } - - - if( - oItem && !oItem.handledMouseOverEvent && - (oTarget == oItem.element || Dom.isAncestor(oItem.element, oTarget)) - ) { - - var oItemCfg = oItem.cfg; - - // Select and focus the current menu item - - oItemCfg.setProperty("selected", true); - oItem.focus(); - - - if(this.cfg.getProperty("autosubmenudisplay")) { - - // Show the submenu this menu item - - var oSubmenu = oItemCfg.getProperty("submenu"); - - if(oSubmenu) { - - if(this.cfg.getProperty("showdelay") > 0) { - - this._execShowDelay(oSubmenu); - - } - else { - - oSubmenu.show(); - - } - - } - - } - - oItem.handledMouseOverEvent = true; - oItem.handledMouseOutEvent = false; - - } - -}, - - -/** -* @method _onMouseOut -* @description "mouseout" event handler for the menu. -* @protected -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that -* fired the event. -*/ -_onMouseOut: function(p_sType, p_aArgs, p_oMenu) { - - var oEvent = p_aArgs[0]; - var oItem = p_aArgs[1]; - var oRelatedTarget = Event.getRelatedTarget(oEvent); - var bMovingToSubmenu = false; - - if(oItem) { - - var oItemCfg = oItem.cfg; - var oSubmenu = oItemCfg.getProperty("submenu"); - - - if( - oSubmenu && - ( - oRelatedTarget == oSubmenu.element || - Dom.isAncestor(oSubmenu.element, oRelatedTarget) - ) - ) { - - bMovingToSubmenu = true; - - } - - - if( - !oItem.handledMouseOutEvent && - ( - ( - oRelatedTarget != oItem.element && - !Dom.isAncestor(oItem.element, oRelatedTarget) - ) || bMovingToSubmenu - ) - ) { - - - if(this.cfg.getProperty("showdelay") > 0) { - - this._cancelShowDelay(); - - } - - - if(!bMovingToSubmenu) { - - oItemCfg.setProperty("selected", false); - - } - - - if(this.cfg.getProperty("autosubmenudisplay")) { - - if(oSubmenu) { - - if( - !( - oRelatedTarget == oSubmenu.element || - YAHOO.util.Dom.isAncestor( - oSubmenu.element, - oRelatedTarget - ) - ) - ) { - - oSubmenu.hide(); - - } - - } - - } - - oItem.handledMouseOutEvent = true; - oItem.handledMouseOverEvent = false; - - } - - } - - - if( - !this._bHandledMouseOutEvent && - ( - ( - oRelatedTarget != this.element && - !Dom.isAncestor(this.element, oRelatedTarget) - ) - || bMovingToSubmenu - ) - ) { - - this._bHandledMouseOutEvent = true; - this._bHandledMouseOverEvent = false; - - } - -}, - - -/** -* @method _onClick -* @description "click" event handler for the menu. -* @protected -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that -* fired the event. -*/ -_onClick: function(p_sType, p_aArgs, p_oMenu) { - - var oEvent = p_aArgs[0]; - var oItem = p_aArgs[1]; - var oTarget = Event.getTarget(oEvent); - - if(oItem) { - - var oItemCfg = oItem.cfg; - var oSubmenu = oItemCfg.getProperty("submenu"); - - - /* - ACCESSIBILITY FEATURE FOR SCREEN READERS: - Expand/collapse the submenu when the user clicks - on the submenu indicator image. - */ - - if(oTarget == oItem.submenuIndicator && oSubmenu) { - - if(oSubmenu.cfg.getProperty("visible")) { - - oSubmenu.hide(); - - } - else { - - this.clearActiveItem(); - - this.activeItem = oItem; - - oItem.cfg.setProperty("selected", true); - - oSubmenu.show(); - - } - - } - else { - - var sURL = oItemCfg.getProperty("url"); - var bCurrentPageURL = (sURL.substr((sURL.length-1),1) == "#"); - var sTarget = oItemCfg.getProperty("target"); - var bHasTarget = (sTarget && sTarget.length > 0); - - /* - Prevent the browser from following links - equal to "#" - */ - - if( - oTarget.tagName.toUpperCase() == "A" && - bCurrentPageURL && !bHasTarget - ) { - - Event.preventDefault(oEvent); - - } - - if( - oTarget.tagName.toUpperCase() != "A" && - !bCurrentPageURL && !bHasTarget - ) { - - /* - Follow the URL of the item regardless of - whether or not the user clicked specifically - on the anchor element. - */ - - document.location = sURL; - - } - - - /* - If the item doesn't navigate to a URL and it doesn't have - a submenu, then collapse the menu tree. - */ - - if(bCurrentPageURL && !oSubmenu) { - - var oRoot = this.getRoot(); - - if(oRoot.cfg.getProperty("position") == "static") { - - oRoot.clearActiveItem(); - - } - else { - - oRoot.hide(); - - } - - } - - } - - } - -}, - - -/** -* @method _onKeyDown -* @description "keydown" event handler for the menu. -* @protected -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that -* fired the event. -*/ -_onKeyDown: function(p_sType, p_aArgs, p_oMenu) { - - var oEvent = p_aArgs[0]; - var oItem = p_aArgs[1]; - var oSubmenu; - - if(oItem) { - - var oItemCfg = oItem.cfg; - var oParentItem = this.parent; - var oRoot; - var oNextItem; - - - switch(oEvent.keyCode) { - - case 38: // Up arrow - case 40: // Down arrow - - if( - oItem == this.activeItem && - !oItemCfg.getProperty("selected") - ) { - - oItemCfg.setProperty("selected", true); - - } - else { - - oNextItem = (oEvent.keyCode == 38) ? - oItem.getPreviousEnabledSibling() : - oItem.getNextEnabledSibling(); - - if(oNextItem) { - - this.clearActiveItem(); - - oNextItem.cfg.setProperty("selected", true); - oNextItem.focus(); - - } - - } - - Event.preventDefault(oEvent); - - break; - - - case 39: // Right arrow - - oSubmenu = oItemCfg.getProperty("submenu"); - - if(oSubmenu) { - - if(!oItemCfg.getProperty("selected")) { - - oItemCfg.setProperty("selected", true); - - } - - oSubmenu.show(); - - oSubmenu.setInitialSelection(); - - } - else { - - oRoot = this.getRoot(); - - if(oRoot instanceof YAHOO.widget.MenuBar) { - - oNextItem = oRoot.activeItem.getNextEnabledSibling(); - - if(oNextItem) { - - oRoot.clearActiveItem(); - - oNextItem.cfg.setProperty("selected", true); - - oSubmenu = oNextItem.cfg.getProperty("submenu"); - - if(oSubmenu) { - - oSubmenu.show(); - - } - - oNextItem.focus(); - - } - - } - - } - - - Event.preventDefault(oEvent); - - break; - - - case 37: // Left arrow - - if(oParentItem) { - - var oParentMenu = oParentItem.parent; - - if(oParentMenu instanceof YAHOO.widget.MenuBar) { - - oNextItem = - oParentMenu.activeItem.getPreviousEnabledSibling(); - - if(oNextItem) { - - oParentMenu.clearActiveItem(); - - oNextItem.cfg.setProperty("selected", true); - - oSubmenu = oNextItem.cfg.getProperty("submenu"); - - if(oSubmenu) { - - oSubmenu.show(); - - } - - oNextItem.focus(); - - } - - } - else { - - this.hide(); - - oParentItem.focus(); - - } - - } - - Event.preventDefault(oEvent); - - break; - - } - - - } - - - if(oEvent.keyCode == 27) { // Esc key - - if(this.cfg.getProperty("position") == "dynamic") { - - this.hide(); - - if(this.parent) { - - this.parent.focus(); - - } - - } - else if(this.activeItem) { - - oSubmenu = this.activeItem.cfg.getProperty("submenu"); - - if(oSubmenu && oSubmenu.cfg.getProperty("visible")) { - - oSubmenu.hide(); - this.activeItem.focus(); - - } - else { - - this.activeItem.cfg.setProperty("selected", false); - this.activeItem.blur(); - - } - - } - - - Event.preventDefault(oEvent); - - } - -}, - - - -// Private methods - - -/** -* @method _onInit -* @description "init" event handler for the menu. -* @private -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that -* fired the event. -*/ -_onInit: function(p_sType, p_aArgs, p_oMenu) { - - if( - ( - (this.parent && !this.lazyLoad) || - (!this.parent && this.cfg.getProperty("position") == "static") || - ( - !this.parent && - !this.lazyLoad && - this.cfg.getProperty("position") == "dynamic" - ) - ) && - this.getItemGroups().length === 0 - ) { - - if(this.srcElement) { - - this._initSubTree(); - - } - - - if(this.itemData) { - - this.addItems(this.itemData); - - } - - } - else if(this.lazyLoad) { - - this.cfg.fireQueue(); - - } - -}, - - -/** -* @method _onBeforeRender -* @description "beforerender" event handler for the menu. Appends all of the -* <ul>, <li> and their accompanying -* title elements to the body element of the menu. -* @private -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that -* fired the event. -*/ -_onBeforeRender: function(p_sType, p_aArgs, p_oMenu) { - - var oConfig = this.cfg; - var oEl = this.element; - var nListElements = this._aListElements.length; - - - if(nListElements > 0) { - - var i = 0; - var bFirstList = true; - var oUL; - var oGroupTitle; - - - do { - - oUL = this._aListElements[i]; - - if(oUL) { - - if(bFirstList) { - - Dom.addClass(oUL, "first-of-type"); - bFirstList = false; - - } - - - if(!Dom.isAncestor(oEl, oUL)) { - - this.appendToBody(oUL); - - } - - - oGroupTitle = this._aGroupTitleElements[i]; - - if(oGroupTitle) { - - if(!Dom.isAncestor(oEl, oGroupTitle)) { - - oUL.parentNode.insertBefore(oGroupTitle, oUL); - - } - - - Dom.addClass(oUL, "hastitle"); - - } - - } - - i++; - - } - while(i < nListElements); - - } - -}, - - -/** -* @method _onRender -* @description "render" event handler for the menu. -* @private -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that -* fired the event. -*/ -_onRender: function(p_sType, p_aArgs, p_oMenu) { - - if(this.cfg.getProperty("position") == "dynamic") { - - var sWidth = - this.element.parentNode.tagName.toUpperCase() == "BODY" ? - this.element.offsetWidth : this._getOffsetWidth(); - - this.cfg.setProperty("width", (sWidth + "px")); - - } - -}, - - -/** -* @method _onBeforeShow -* @description "beforeshow" event handler for the menu. -* @private -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that -* fired the event. -*/ -_onBeforeShow: function(p_sType, p_aArgs, p_oMenu) { - - if(this.lazyLoad && this.getItemGroups().length === 0) { - - if(this.srcElement) { - - this._initSubTree(); - - } - - - if(this.itemData) { - - if( - this.parent && this.parent.parent && - this.parent.parent.srcElement && - this.parent.parent.srcElement.tagName.toUpperCase() == "SELECT" - ) { - - var nOptions = this.itemData.length; - - for(var n=0; n 0) { - - oConfig.showdelay = nShowDelay; - - } - - - var nHideDelay = oParentMenu.cfg.getProperty("hidedelay"); - - if(nHideDelay > 0) { - - oConfig.hidedelay = nHideDelay; - - } - - - /* - Only sync the "iframe" configuration property if the parent - menu's "position" configuration is the same. - */ - - if( - this.cfg.getProperty("position") == - oParentMenu.cfg.getProperty("position") - ) { - - oConfig.iframe = oParentMenu.cfg.getProperty("iframe"); - - } - - - p_oSubmenu.cfg.applyConfig(oConfig); - - - if(!this.lazyLoad) { - - if(Dom.inDocument(this.element)) { - - this.render(); - - } - else { - - this.render(this.parent.element); - - } - - } - -}, - - -/** -* @method _onSubmenuBeforeShow -* @description "beforeshow" event handler for a submenu. -* @private -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oSubmenu Object representing the submenu that -* subscribed to the event. -*/ -_onSubmenuBeforeShow: function(p_sType, p_aArgs, p_oSubmenu) { - - var oParent = this.parent; - var aAlignment = oParent.parent.cfg.getProperty("submenualignment"); - - this.cfg.setProperty( - "context", - [oParent.element, aAlignment[0], aAlignment[1]] - ); - - oParent.submenuIndicator.alt = oParent.EXPANDED_SUBMENU_INDICATOR_ALT_TEXT; - -}, - - -/** -* @method _onSubmenuShow -* @description "show" event handler for a submenu. -* @private -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oSubmenu Object representing the submenu that -* subscribed to the event. -*/ -_onSubmenuShow: function(p_sType, p_aArgs, p_oSubmenu) { - - var oParent = this.parent; - - oParent.submenuIndicator.alt = oParent.EXPANDED_SUBMENU_INDICATOR_ALT_TEXT; - -}, - - -/** -* @method _onSubmenuHide -* @description "hide" Custom Event handler for a submenu. -* @private -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oSubmenu Object representing the submenu that -* subscribed to the event. -*/ -_onSubmenuHide: function(p_sType, p_aArgs, p_oSubmenu) { - - var oParent = this.parent; - - oParent.submenuIndicator.alt = oParent.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT; - -}, - - -/** -* @method _onMenuItemFocus -* @description "focus" event handler for the menu's items. -* @private -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item -* that fired the event. -*/ -_onMenuItemFocus: function(p_sType, p_aArgs, p_oItem) { - - this.activeItem = p_oItem; - -}, - - -/** -* @method _onMenuItemBlur -* @description "blur" event handler for the menu's items. -* @private -* @param {String} p_sType String representing the name of the event -* that was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -*/ -_onMenuItemBlur: function(p_sType, p_aArgs) { - - this.activeItem = null; - -}, - - -/** -* @method _onMenuItemConfigChange -* @description "configchange" event handler for the menu's items. -* @private -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item -* that fired the event. -*/ -_onMenuItemConfigChange: function(p_sType, p_aArgs, p_oItem) { - - var sProperty = p_aArgs[0][0]; - - switch(sProperty) { - - case "submenu": - - var oSubmenu = p_aArgs[0][1]; - - if(oSubmenu) { - - this._configureSubmenu(p_oItem); - - } - - break; - - case "text": - case "helptext": - - /* - A change to an item's "text" or "helptext" - configuration properties requires the width of the parent - menu to be recalculated. - */ - - if(this.element.style.width) { - - var sWidth = this._getOffsetWidth() + "px"; - - Dom.setStyle(this.element, "width", sWidth); - - } - - break; - - } - -}, - - - -// Public event handlers for configuration properties - - -/** -* @method enforceConstraints -* @description The default event handler executed when the moveEvent is fired, -* if the "constraintoviewport" configuration property is set to true. -* @param {String} type The name of the event that was fired. -* @param {Array} args Collection of arguments sent when the -* event was fired. -* @param {Array} obj Array containing the current Menu instance -* and the item that fired the event. -*/ -enforceConstraints: function(type, args, obj) { - - var oConfig = this.cfg; - - var pos = args[0]; - - var x = pos[0]; - var y = pos[1]; - - var bod = document.getElementsByTagName('body')[0]; - var htm = document.getElementsByTagName('html')[0]; - - var bodyOverflow = Dom.getStyle(bod, "overflow"); - var htmOverflow = Dom.getStyle(htm, "overflow"); - - var offsetHeight = this.element.offsetHeight; - var offsetWidth = this.element.offsetWidth; - - var viewPortWidth = Dom.getClientWidth(); - var viewPortHeight = Dom.getClientHeight(); - - var scrollX = window.scrollX || document.body.scrollLeft; - var scrollY = window.scrollY || document.body.scrollTop; - - var topConstraint = scrollY + 10; - var leftConstraint = scrollX + 10; - var bottomConstraint = scrollY + viewPortHeight - offsetHeight - 10; - var rightConstraint = scrollX + viewPortWidth - offsetWidth - 10; - - var aContext = oConfig.getProperty("context"); - var oContextElement = aContext ? aContext[0] : null; - - - if (x < 10) { - - x = leftConstraint; - - } else if ((x + offsetWidth) > viewPortWidth) { - - if( - oContextElement && - ((x - oContextElement.offsetWidth) > offsetWidth) - ) { - - x = (x - (oContextElement.offsetWidth + offsetWidth)); - - } - else { - - x = rightConstraint; - - } - - } - - if (y < 10) { - - y = topConstraint; - - } else if (y > bottomConstraint) { - - if(oContextElement && (y > offsetHeight)) { - - y = ((y + oContextElement.offsetHeight) - offsetHeight); - - } - else { - - y = bottomConstraint; - - } - - } - - oConfig.setProperty("x", x, true); - oConfig.setProperty("y", y, true); - -}, - - -/** -* @method configVisible -* @description Event handler for when the "visible" configuration property -* the menu changes. -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that -* fired the event. -*/ -configVisible: function(p_sType, p_aArgs, p_oMenu) { - - if(this.cfg.getProperty("position") == "dynamic") { - - YAHOO.widget.Menu.superclass.configVisible.call( - this, - p_sType, - p_aArgs, - p_oMenu - ); - - } - else { - - var bVisible = p_aArgs[0]; - var sDisplay = Dom.getStyle(this.element, "display"); - - if(bVisible) { - - if(sDisplay != "block") { - this.beforeShowEvent.fire(); - Dom.setStyle(this.element, "display", "block"); - this.showEvent.fire(); - } - - } - else { - - if(sDisplay == "block") { - this.beforeHideEvent.fire(); - Dom.setStyle(this.element, "display", "none"); - this.hideEvent.fire(); - } - - } - - } - -}, - - -/** -* @method configPosition -* @description Event handler for when the "position" configuration property -* of the menu changes. -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that -* fired the event. -*/ -configPosition: function(p_sType, p_aArgs, p_oMenu) { - - var sCSSPosition = p_aArgs[0] == "static" ? "static" : "absolute"; - var oCfg = this.cfg; - - Dom.setStyle(this.element, "position", sCSSPosition); - - - if(sCSSPosition == "static") { - - /* - Remove the iframe for statically positioned menus since it will - intercept mouse events. - */ - - oCfg.setProperty("iframe", false); - - - // Statically positioned menus are visible by default - - Dom.setStyle(this.element, "display", "block"); - - oCfg.setProperty("visible", true); - - } - else { - - /* - Even though the "visible" property is queued to - "false" by default, we need to set the "visibility" property to - "hidden" since Overlay's "configVisible" implementation checks the - element's "visibility" style property before deciding whether - or not to show an Overlay instance. - */ - - Dom.setStyle(this.element, "visibility", "hidden"); - - } - - - if(sCSSPosition == "absolute") { - - var nZIndex = oCfg.getProperty("zindex"); - - if(!nZIndex || nZIndex === 0) { - - nZIndex = this.parent ? - (this.parent.parent.cfg.getProperty("zindex") + 1) : 1; - - oCfg.setProperty("zindex", nZIndex); - - } - - } - -}, - - -/** -* @method configIframe -* @description Event handler for when the "iframe" configuration property of -* the menu changes. -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that -* fired the event. -*/ -configIframe: function(p_sType, p_aArgs, p_oMenu) { - - if(this.cfg.getProperty("position") == "dynamic") { - - YAHOO.widget.Menu.superclass.configIframe.call( - this, - p_sType, - p_aArgs, - p_oMenu - ); - - } - -}, - - -/** -* @method configHideDelay -* @description Event handler for when the "hidedelay" configuration property -* of the menu changes. -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that -* fired the event. -*/ -configHideDelay: function(p_sType, p_aArgs, p_oMenu) { - - var nHideDelay = p_aArgs[0]; - var oMouseOutEvent = this.mouseOutEvent; - var oMouseOverEvent = this.mouseOverEvent; - var oKeyDownEvent = this.keyDownEvent; - - if(nHideDelay > 0) { - - /* - Only assign event handlers once. This way the user change - the value for the hidedelay as many times as they want. - */ - - if(!this._hideDelayEventHandlersAssigned) { - - oMouseOutEvent.subscribe(this._execHideDelay, true); - oMouseOverEvent.subscribe(this._cancelHideDelay, this, true); - oKeyDownEvent.subscribe(this._cancelHideDelay, this, true); - - this._hideDelayEventHandlersAssigned = true; - - } - - } - else { - - oMouseOutEvent.unsubscribe(this._execHideDelay, this); - oMouseOverEvent.unsubscribe(this._cancelHideDelay, this); - oKeyDownEvent.unsubscribe(this._cancelHideDelay, this); - - this._hideDelayEventHandlersAssigned = false; - - } - -}, - - -/** -* @method configContainer -* @description Event handler for when the "container" configuration property -of the menu changes. -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that -* fired the event. -*/ -configContainer: function(p_sType, p_aArgs, p_oMenu) { - - var oElement = p_aArgs[0]; - - if(typeof oElement == 'string') { - - this.cfg.setProperty( - "container", - document.getElementById(oElement), - true - ); - - } - -}, - - - -// Public methods - - -/** -* Event handler called when the resize monitor element's "resize" evet is fired. -*/ -onDomResize: function(e, obj) { - - if(!this._handleResize) { - - this._handleResize = true; - return; - - } - - var oConfig = this.cfg; - - if(oConfig.getProperty("position") == "dynamic") { - - oConfig.setProperty("width", (this._getOffsetWidth() + "px")); - - } - - YAHOO.widget.Menu.superclass.onDomResize.call(this, e, obj); - -}, - - -/** -* @method initEvents -* @description Initializes the custom events for the menu. -*/ -initEvents: function() { - - YAHOO.widget.Menu.superclass.initEvents.call(this); - - // Create custom events - - var CustomEvent = YAHOO.util.CustomEvent; - - this.mouseOverEvent = new CustomEvent("mouseOverEvent", this); - this.mouseOutEvent = new CustomEvent("mouseOutEvent", this); - this.mouseDownEvent = new CustomEvent("mouseDownEvent", this); - this.mouseUpEvent = new CustomEvent("mouseUpEvent", this); - this.clickEvent = new CustomEvent("clickEvent", this); - this.keyPressEvent = new CustomEvent("keyPressEvent", this); - this.keyDownEvent = new CustomEvent("keyDownEvent", this); - this.keyUpEvent = new CustomEvent("keyUpEvent", this); - this.itemAddedEvent = new CustomEvent("itemAddedEvent", this); - this.itemRemovedEvent = new CustomEvent("itemRemovedEvent", this); - -}, - - -/** -* @method getRoot -* @description Finds the menu's root menu. -*/ -getRoot: function() { - - var oItem = this.parent; - - if(oItem) { - - var oParentMenu = oItem.parent; - - return oParentMenu ? oParentMenu.getRoot() : this; - - } - else { - - return this; - - } - -}, - - -/** -* @method toString -* @description Returns a string representing the menu. -* @return {String} -*/ -toString: function() { - - return ("Menu " + this.id); - -}, - - -/** -* @method setItemGroupTitle -* @description Sets the title of a group of menu items. -* @param {String} p_sGroupTitle String specifying the title of the group. -* @param {Number} p_nGroupIndex Optional. Number specifying the group to which -* the title belongs. -*/ -setItemGroupTitle: function(p_sGroupTitle, p_nGroupIndex) { - - if(typeof p_sGroupTitle == "string" && p_sGroupTitle.length > 0) { - - var nGroupIndex = typeof p_nGroupIndex == "number" ? p_nGroupIndex : 0; - var oTitle = this._aGroupTitleElements[nGroupIndex]; - - - if(oTitle) { - - oTitle.innerHTML = p_sGroupTitle; - - } - else { - - oTitle = document.createElement(this.GROUP_TITLE_TAG_NAME); - - oTitle.innerHTML = p_sGroupTitle; - - this._aGroupTitleElements[nGroupIndex] = oTitle; - - } - - - var i = this._aGroupTitleElements.length - 1; - var nFirstIndex; - - do { - - if(this._aGroupTitleElements[i]) { - - Dom.removeClass(this._aGroupTitleElements[i], "first-of-type"); - - nFirstIndex = i; - - } - - } - while(i--); - - - if(nFirstIndex !== null) { - - Dom.addClass( - this._aGroupTitleElements[nFirstIndex], - "first-of-type" - ); - - } - - } - -}, - - - -/** -* @method addItem -* @description Appends an item to the menu. -* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem -* instance to be added to the menu. -* @param {String} p_oItem String specifying the text of the item to be added -* to the menu. -* @param {Object} p_oItem Object literal containing a set of menu item -* configuration properties. -* @param {Number} p_nGroupIndex Optional. Number indicating the group to -* which the item belongs. -* @return {YAHOO.widget.MenuItem} -*/ -addItem: function(p_oItem, p_nGroupIndex) { - - if(p_oItem) { - - return this._addItemToGroup(p_nGroupIndex, p_oItem); - - } - -}, - - -/** -* @method addItems -* @description Adds an array of items to the menu. -* @param {Array} p_aItems Array of items to be added to the menu. The array -* can contain strings specifying the text for each item to be created, object -* literals specifying each of the menu item configuration properties, -* or MenuItem instances. -* @param {Number} p_nGroupIndex Optional. Number specifying the group to -* which the items belongs. -* @return {Array} -*/ -addItems: function(p_aItems, p_nGroupIndex) { - - function isArray(p_oValue) { - - return (typeof p_oValue == "object" && p_oValue.constructor == Array); - - } - - - if(isArray(p_aItems)) { - - var nItems = p_aItems.length; - var aItems = []; - var oItem; - - - for(var i=0; i<div> element -* (and accompanying child nodes) from the document. -*/ -destroy: function() { - - // Remove Custom Event listeners - - this.mouseOverEvent.unsubscribeAll(); - this.mouseOutEvent.unsubscribeAll(); - this.mouseDownEvent.unsubscribeAll(); - this.mouseUpEvent.unsubscribeAll(); - this.clickEvent.unsubscribeAll(); - this.keyPressEvent.unsubscribeAll(); - this.keyDownEvent.unsubscribeAll(); - this.keyUpEvent.unsubscribeAll(); - - - var nItemGroups = this._aItemGroups.length; - var nItems; - var oItemGroup; - var oItem; - var i; - var n; - - - // Remove all items - - if(nItemGroups > 0) { - - i = nItemGroups - 1; - - do { - - oItemGroup = this._aItemGroups[i]; - - if(oItemGroup) { - - nItems = oItemGroup.length; - - if(nItems > 0) { - - n = nItems - 1; - - do { - - oItem = this._aItemGroups[i][n]; - - if(oItem) { - - oItem.destroy(); - } - - } - while(n--); - - } - - } + " unregistered from the collection of visible menus."); } - while(i--); } - // Continue with the superclass implementation of this method + /** + * @method onItemAdded + * @description "itemadded" event handler for a Menu instance. + * @private + * @param {String} p_sType String representing the name of the event that + * was fired. + * @param {Array} p_aArgs Array of arguments sent when the event was fired. + */ + function onItemAdded(p_sType, p_aArgs) { - YAHOO.widget.Menu.superclass.destroy.call(this); + addItem(p_aArgs[0]); - this.logger.log("Destroyed."); + } -}, + /** + * @method onItemRemoved + * @description "itemremoved" event handler for a Menu instance. + * @private + * @param {String} p_sType String representing the name of the event that + * was fired. + * @param {Array} p_aArgs Array of arguments sent when the event was fired. + */ + function onItemRemoved(p_sType, p_aArgs) { -/** -* @method setInitialFocus -* @description Sets focus to the menu's first enabled item. -*/ -setInitialFocus: function() { + removeItem(p_aArgs[0]); - var oItem = this._getFirstEnabledItem(); + } - if(oItem) { - oItem.focus(); - } -}, + return { + // Privileged methods -/** -* @method setInitialSelection -* @description Sets the "selected" configuration property of the menu's first -* enabled item to "true." -*/ -setInitialSelection: function() { - var oItem = this._getFirstEnabledItem(); + /** + * @method addMenu + * @description Adds a menu to the collection of known menus. + * @param {YAHOO.widget.Menu} p_oMenu Object specifying the Menu + * instance to be added. + */ + addMenu: function(p_oMenu) { - if(oItem) { + if(p_oMenu && p_oMenu.id && !m_oMenus[p_oMenu.id]) { - oItem.cfg.setProperty("selected", true); - } + m_oMenus[p_oMenu.id] = p_oMenu; -}, + if(!m_bInitializedEventHandlers) { -/** -* @method clearActiveItem -* @description Sets the "selected" configuration property of the menu's active -* item to "false" and hides the item's submenu. -* @param {Boolean} p_bBlur Boolean indicating if the menu's active item -* should be blurred. -*/ -clearActiveItem: function(p_bBlur) { + var oDoc = document; - if(this.cfg.getProperty("showdelay") > 0) { + Event.addListener(oDoc, "mouseover", onDOMEvent, me, true); + Event.addListener(oDoc, "mouseout", onDOMEvent, me, true); + Event.addListener(oDoc, "mousedown", onDOMEvent, me, true); + Event.addListener(oDoc, "mouseup", onDOMEvent, me, true); + Event.addListener(oDoc, "click", onDOMEvent, me, true); + Event.addListener(oDoc, "keydown", onDOMEvent, me, true); + Event.addListener(oDoc, "keyup", onDOMEvent, me, true); + Event.addListener(oDoc, "keypress", onDOMEvent, me, true); - this._cancelShowDelay(); + m_bInitializedEventHandlers = true; - } + m_oLogger.log("DOM event handlers initialized."); + } - var oActiveItem = this.activeItem; + p_oMenu.destroyEvent.subscribe(onMenuDestroy, p_oMenu, me); - if(oActiveItem) { + p_oMenu.cfg.subscribeToConfigEvent( + "visible", + onMenuVisibleConfigChange, + p_oMenu + ); - var oConfig = oActiveItem.cfg; + p_oMenu.itemAddedEvent.subscribe(onItemAdded); + p_oMenu.itemRemovedEvent.subscribe(onItemRemoved); - oConfig.setProperty("selected", false); + m_oLogger.log("Menu: " + + p_oMenu.toString() + " successfully registered."); - var oSubmenu = oConfig.getProperty("submenu"); + } - if(oSubmenu) { + }, - oSubmenu.hide(); - } + /** + * @method removeMenu + * @description Removes a menu from the collection of known menus. + * @param {YAHOO.widget.Menu} p_oMenu Object specifying the Menu + * instance to be removed. + */ + removeMenu: function(p_oMenu) { - if(p_bBlur) { + if(p_oMenu && m_oMenus[p_oMenu.id]) { - oActiveItem.blur(); + delete m_oMenus[p_oMenu.id]; - } + m_oLogger.log("Menu: " + + p_oMenu.toString() + " successfully unregistered."); - } + } -}, + }, -/** -* @description Initializes the class's configurable properties which can be -* changed using the menu's Config object ("cfg"). -* @method initDefaultConfig -*/ -initDefaultConfig: function() { + /** + * @method hideVisible + * @description Hides all visible, dynamically positioned menus. + */ + hideVisible: function() { - YAHOO.widget.Menu.superclass.initDefaultConfig.call(this); + var oMenu; - var oConfig = this.cfg; + for(var i in m_oVisibleMenus) { - // Add configuration properties + if(m_oVisibleMenus.hasOwnProperty(i)) { - /* - Change the default value for the "visible" configuration - property to "false" by re-adding the property. - */ + oMenu = m_oVisibleMenus[i]; - /** - * @config visible - * @description Boolean indicating whether or not the menu is visible. If - * the menu's "position" configuration property is set to "dynamic" (the - * default), this property toggles the menu's <div> - * element's "visibility" style property between "visible" (true) or - * "hidden" (false). If the menu's "position" configuration property is - * set to "static" this property toggles the menu's - * <div> element's "display" style property - * between "block" (true) or "none" (false). - * @default false - * @type Boolean - */ - oConfig.addProperty( - "visible", - { - value:false, - handler:this.configVisible, - validator:this.cfg.checkBoolean - } - ); + if(oMenu.cfg.getProperty("position") == "dynamic") { + oMenu.hide(); - /* - Change the default value for the "constraintoviewport" configuration - property to "true" by re-adding the property. - */ + } - /** - * @config constraintoviewport - * @description Boolean indicating if the menu will try to remain inside - * the boundaries of the size of viewport. - * @default true - * @type Boolean - */ - oConfig.addProperty( - "constraintoviewport", - { - value:true, - handler:this.configConstrainToViewport, - validator:this.cfg.checkBoolean, - supercedes:["iframe","x","y","xy"] - } - ); + } + } - /** - * @config position - * @description String indicating how a menu should be positioned on the - * screen. Possible values are "static" and "dynamic." Static menus are - * visible by default and reside in the normal flow of the document - * (CSS position: static). Dynamic menus are hidden by default, reside - * out of the normal flow of the document (CSS position: absolute), and - * can overlay other elements on the screen. - * @default dynamic - * @type String - */ - oConfig.addProperty( - "position", - { - value: "dynamic", - handler: this.configPosition, - validator: this._checkPosition, - supercedes: ["visible"] - } - ); + }, - /** - * @config submenualignment - * @description Array defining how submenus should be aligned to their - * parent menu item. The format is: [itemCorner, submenuCorner]. By default - * a submenu's top left corner is aligned to its parent menu item's top - * right corner. - * @default ["tl","tr"] - * @type Array - */ - oConfig.addProperty("submenualignment", { value: ["tl","tr"] } ); + /** + * @method getMenus + * @description Returns an array of all menus registered with the + * menu manger. + * @return {Array} + */ + getMenus: function() { + return m_oMenus; - /** - * @config autosubmenudisplay - * @description Boolean indicating if submenus are automatically made - * visible when the user mouses over the menu's items. - * @default true - * @type Boolean - */ - oConfig.addProperty( - "autosubmenudisplay", - { - value: true, - validator: oConfig.checkBoolean - } - ); + }, - /** - * @config showdelay - * @description Number indicating the time (in milliseconds) that should - * expire before a submenu is made visible when the user mouses over - * the menu's items. - * @default 0 - * @type Number - */ - oConfig.addProperty( - "showdelay", - { - value: 0, - validator: oConfig.checkNumber - } - ); + /** + * @method getMenu + * @description Returns a menu with the specified id. + * @param {String} p_sId String specifying the id of the menu to + * be retrieved. + * @return {YAHOO.widget.Menu} + */ + getMenu: function(p_sId) { + if(m_oMenus[p_sId]) { - /** - * @config hidedelay - * @description Number indicating the time (in milliseconds) that should - * expire before the menu is hidden. - * @default 0 - * @type Number - */ - oConfig.addProperty( - "hidedelay", - { - value: 0, - validator: oConfig.checkNumber, - handler: this.configHideDelay, - suppressEvent: true - } - ); + return m_oMenus[p_sId]; + } - /** - * @config clicktohide - * @description Boolean indicating if the menu will automatically be - * hidden if the user clicks outside of it. - * @default true - * @type Boolean - */ - oConfig.addProperty( - "clicktohide", - { - value: true, - validator: oConfig.checkBoolean - } - ); + }, - /** - * @config container - * @description HTML element reference or string specifying the id - * attribute of the HTML element that the menu's markup should be rendered into. - * @type HTMLElement|String - * @default document.body - */ - this.cfg.addProperty( - "container", - { value:document.body, handler:this.configContainer } - ); + /** + * @method toString + * @description Returns a string representing the menu manager. + * @return {String} + */ + toString: function() { -} + return ("MenuManager"); -}); // END YAHOO.extend + } + + }; +}(); + +})(); + + +(function() { + +var Dom = YAHOO.util.Dom, + Event = YAHOO.util.Event; + + +/** +* The Menu class creates a container that holds a vertical list representing +* a set of options or commands. Menu is the base class for all +* menu containers. +* @param {String} p_oElement String specifying the id attribute of the +* <div> element of the menu. +* @param {String} p_oElement String specifying the id attribute of the +* <select> element to be used as the data source +* for the menu. +* @param {HTMLDivElement} p_oElement Object +* specifying the <div> element of the menu. +* @param {HTMLSelectElement} p_oElement +* Object specifying the <select> element to be used as +* the data source for the menu. +* @param {Object} p_oConfig Optional. Object literal specifying the +* configuration for the menu. See configuration class documentation for +* more details. +* @namespace YAHOO.widget +* @class Menu +* @constructor +* @extends YAHOO.widget.Overlay +*/ +YAHOO.widget.Menu = function(p_oElement, p_oConfig) { + + if(p_oConfig) { + + this.parent = p_oConfig.parent; + + this.lazyLoad = p_oConfig.lazyLoad || p_oConfig.lazyload; + + this.itemData = p_oConfig.itemData || p_oConfig.itemdata; + + } + + + YAHOO.widget.Menu.superclass.constructor.call( + this, + p_oElement, + p_oConfig + ); + +}; + +YAHOO.extend(YAHOO.widget.Menu, YAHOO.widget.Overlay, { + + + +// Constants + + +/** +* @property CSS_CLASS_NAME +* @description String representing the CSS class(es) to be applied to the +* menu's <div> element. +* @default "yuimenu" +* @final +* @type String +*/ +CSS_CLASS_NAME: "yuimenu", + + +/** +* @property ITEM_TYPE +* @description Object representing the type of menu item to instantiate and +* add when parsing the child nodes (either <li> element, +* <optgroup> element or <option>) +* of the menu's source HTML element. +* @default YAHOO.widget.MenuItem +* @final +* @type YAHOO.widget.MenuItem +*/ +ITEM_TYPE: null, + + +/** +* @property GROUP_TITLE_TAG_NAME +* @description String representing the tagname of the HTML element used to +* title the menu's item groups. +* @default H6 +* @final +* @type String +*/ +GROUP_TITLE_TAG_NAME: "h6", + + + +// Private properties + + +/** +* @property _nHideDelayId +* @description Number representing the time-out setting used to cancel the +* hiding of a menu. +* @default null +* @private +* @type Number +*/ +_nHideDelayId: null, + + +/** +* @property _nShowDelayId +* @description Number representing the time-out setting used to cancel the +* showing of a menu. +* @default null +* @private +* @type Number +*/ +_nShowDelayId: null, + + +/** +* @property _hideDelayEventHandlersAssigned +* @description Boolean indicating if the "mouseover" and "mouseout" event +* handlers used for hiding the menu via a call to "window.setTimeout" have +* already been assigned. +* @default false +* @private +* @type Boolean +*/ +_hideDelayEventHandlersAssigned: false, + + +/** +* @property _bHandledMouseOverEvent +* @description Boolean indicating the current state of the menu's +* "mouseover" event. +* @default false +* @private +* @type Boolean +*/ +_bHandledMouseOverEvent: false, + + +/** +* @property _bHandledMouseOutEvent +* @description Boolean indicating the current state of the menu's +* "mouseout" event. +* @default false +* @private +* @type Boolean +*/ +_bHandledMouseOutEvent: false, + + +/** +* @property _aGroupTitleElements +* @description Array of HTML element used to title groups of menu items. +* @default [] +* @private +* @type Array +*/ +_aGroupTitleElements: null, + + +/** +* @property _aItemGroups +* @description Array of menu items. +* @default [] +* @private +* @type Array +*/ +_aItemGroups: null, + + +/** +* @property _aListElements +* @description Array of <ul> elements, each of which is +* the parent node for each item's <li> element. +* @default [] +* @private +* @type Array +*/ +_aListElements: null, + + + +// Public properties + + +/** +* @property lazyLoad +* @description Boolean indicating if the menu's "lazy load" feature is +* enabled. If set to "true," initialization and rendering of the menu's +* items will be deferred until the first time it is made visible. This +* property should be set via the constructor using the configuration +* object literal. +* @default false +* @type Boolean +*/ +lazyLoad: false, + + +/** +* @property itemData +* @description Array of items to be added to the menu. The array can contain +* strings representing the text for each item to be created, object literals +* representing the menu item configuration properties, or MenuItem instances. +* This property should be set via the constructor using the configuration +* object literal. +* @default null +* @type Array +*/ +itemData: null, + + +/** +* @property activeItem +* @description Object reference to the item in the menu that has focus. +* @default null +* @type YAHOO.widget.MenuItem +*/ +activeItem: null, + + +/** +* @property parent +* @description Object reference to the menu's parent menu or menu item. +* This property can be set via the constructor using the configuration +* object literal. +* @default null +* @type YAHOO.widget.MenuItem +*/ +parent: null, + + +/** +* @property srcElement +* @description Object reference to the HTML element (either +* <select> or <div>) used to +* create the menu. +* @default null +* @type HTMLSelectElement|HTMLDivElement +*/ +srcElement: null, + + + +// Events + + +/** +* @event mouseOverEvent +* @description Fires when the mouse has entered the menu. Passes back +* the DOM Event object as an argument. +*/ +mouseOverEvent: null, + + +/** +* @event mouseOutEvent +* @description Fires when the mouse has left the menu. Passes back the DOM +* Event object as an argument. +* @type YAHOO.util.CustomEvent +*/ +mouseOutEvent: null, + + +/** +* @event mouseDownEvent +* @description Fires when the user mouses down on the menu. Passes back the +* DOM Event object as an argument. +* @type YAHOO.util.CustomEvent +*/ +mouseDownEvent: null, + + +/** +* @event mouseUpEvent +* @description Fires when the user releases a mouse button while the mouse is +* over the menu. Passes back the DOM Event object as an argument. +* @type YAHOO.util.CustomEvent +*/ +mouseUpEvent: null, + + +/** +* @event clickEvent +* @description Fires when the user clicks the on the menu. Passes back the +* DOM Event object as an argument. +* @type YAHOO.util.CustomEvent +*/ +clickEvent: null, + + +/** +* @event keyPressEvent +* @description Fires when the user presses an alphanumeric key when one of the +* menu's items has focus. Passes back the DOM Event object as an argument. +* @type YAHOO.util.CustomEvent +*/ +keyPressEvent: null, + + +/** +* @event keyDownEvent +* @description Fires when the user presses a key when one of the menu's items +* has focus. Passes back the DOM Event object as an argument. +* @type YAHOO.util.CustomEvent +*/ +keyDownEvent: null, + + +/** +* @event keyUpEvent +* @description Fires when the user releases a key when one of the menu's items +* has focus. Passes back the DOM Event object as an argument. +* @type YAHOO.util.CustomEvent +*/ +keyUpEvent: null, + + +/** +* @event itemAddedEvent +* @description Fires when an item is added to the menu. +* @type YAHOO.util.CustomEvent +*/ +itemAddedEvent: null, + + +/** +* @event itemRemovedEvent +* @description Fires when an item is removed to the menu. +* @type YAHOO.util.CustomEvent +*/ +itemRemovedEvent: null, + + +/** +* @method init +* @description The Menu class's initialization method. This method is +* automatically called by the constructor, and sets up all DOM references +* for pre-existing markup, and creates required markup if it is not +* already present. +* @param {String} p_oElement String specifying the id attribute of the +* <div> element of the menu. +* @param {String} p_oElement String specifying the id attribute of the +* <select> element to be used as the data source +* for the menu. +* @param {HTMLDivElement} p_oElement Object +* specifying the <div> element of the menu. +* @param {HTMLSelectElement} p_oElement +* Object specifying the <select> element to be used as +* the data source for the menu. +* @param {Object} p_oConfig Optional. Object literal specifying the +* configuration for the menu. See configuration class documentation for +* more details. +*/ +init: function(p_oElement, p_oConfig) { + + this._aItemGroups = []; + this._aListElements = []; + this._aGroupTitleElements = []; + + + if(!this.ITEM_TYPE) { + + this.ITEM_TYPE = YAHOO.widget.MenuItem; + + } + + + var oElement; + + if(typeof p_oElement == "string") { + + oElement = document.getElementById(p_oElement); + + } + else if(p_oElement.tagName) { + + oElement = p_oElement; + + } + + + if(oElement && oElement.tagName) { + + switch(oElement.tagName.toUpperCase()) { + + case "DIV": + + this.srcElement = oElement; + + if(!oElement.id) { + + oElement.setAttribute("id", Dom.generateId()); + + } + + + /* + Note: we don't pass the user config in here yet + because we only want it executed once, at the lowest + subclass level. + */ + + YAHOO.widget.Menu.superclass.init.call(this, oElement); + + this.beforeInitEvent.fire(YAHOO.widget.Menu); + + this.logger = new YAHOO.widget.LogWriter(this.toString()); + + this.logger.log("Source element: " + this.srcElement.tagName); + + break; + + case "SELECT": + + this.srcElement = oElement; + + + /* + The source element is not something that we can use + outright, so we need to create a new Overlay + + Note: we don't pass the user config in here yet + because we only want it executed once, at the lowest + subclass level. + */ + + YAHOO.widget.Menu.superclass.init.call(this, Dom.generateId()); + + this.beforeInitEvent.fire(YAHOO.widget.Menu); + + this.logger = new YAHOO.widget.LogWriter(this.toString()); + + this.logger.log("Source element: " + this.srcElement.tagName); + + break; + + } + + } + else { + + /* + Note: we don't pass the user config in here yet + because we only want it executed once, at the lowest + subclass level. + */ + + YAHOO.widget.Menu.superclass.init.call(this, p_oElement); + + this.beforeInitEvent.fire(YAHOO.widget.Menu); + + this.logger = new YAHOO.widget.LogWriter(this.toString()); + + this.logger.log("No source element found. " + + "Created element with id: " + this.id); + + } + + + if(this.element) { + + var oEl = this.element; + + Dom.addClass(oEl, this.CSS_CLASS_NAME); + + + // Subscribe to Custom Events + + this.initEvent.subscribe(this._onInit, this, true); + this.beforeRenderEvent.subscribe(this._onBeforeRender, this, true); + this.renderEvent.subscribe(this._onRender, this, true); + this.beforeShowEvent.subscribe(this._onBeforeShow, this, true); + this.showEvent.subscribe(this._onShow, this, true); + this.beforeHideEvent.subscribe(this._onBeforeHide, this, true); + this.mouseOverEvent.subscribe(this._onMouseOver, this, true); + this.mouseOutEvent.subscribe(this._onMouseOut, this, true); + this.clickEvent.subscribe(this._onClick, this, true); + this.keyDownEvent.subscribe(this._onKeyDown, this, true); + + YAHOO.widget.Module.textResizeEvent.subscribe( + this._onTextResize, + this, + true + ); + + + if(p_oConfig) { + + this.cfg.applyConfig(p_oConfig, true); + + } + + + // Register the Menu instance with the MenuManager + + YAHOO.widget.MenuManager.addMenu(this); + + + this.initEvent.fire(YAHOO.widget.Menu); + + } + +}, + + + +// Private methods + + +/** +* @method _initSubTree +* @description Iterates the childNodes of the source element to find nodes +* used to instantiate menu and menu items. +* @private +*/ +_initSubTree: function() { + + var oNode; + + if(this.srcElement.tagName == "DIV") { + + /* + Populate the collection of item groups and item + group titles + */ + + oNode = this.body.firstChild; + + var nGroup = 0, + sGroupTitleTagName = this.GROUP_TITLE_TAG_NAME.toUpperCase(); + + do { + + if(oNode && oNode.tagName) { + + switch(oNode.tagName.toUpperCase()) { + + case sGroupTitleTagName: + + this._aGroupTitleElements[nGroup] = oNode; + + break; + + case "UL": + + this._aListElements[nGroup] = oNode; + this._aItemGroups[nGroup] = []; + nGroup++; + + break; + + } + + } + + } + while((oNode = oNode.nextSibling)); + + + /* + Apply the "first-of-type" class to the first UL to mimic + the "first-of-type" CSS3 psuedo class. + */ + + if(this._aListElements[0]) { + + Dom.addClass(this._aListElements[0], "first-of-type"); + + } + + } + + + oNode = null; + + this.logger.log("Searching DOM for items to initialize."); + + if(this.srcElement.tagName) { + + var sSrcElementTagName = this.srcElement.tagName.toUpperCase(); + + + switch(sSrcElementTagName) { + + case "DIV": + + if(this._aListElements.length > 0) { + + this.logger.log("Found " + + this._aListElements.length + + " item groups to initialize."); + + var i = this._aListElements.length - 1; + + do { + + oNode = this._aListElements[i].firstChild; + + this.logger.log("Scanning " + + this._aListElements[i].childNodes.length + + " child nodes for items to initialize."); + + do { + + if( + oNode && + oNode.tagName && + oNode.tagName.toUpperCase() == "LI" + ) { + + this.logger.log("Initializing " + + oNode.tagName + " node."); + + this.addItem( + new this.ITEM_TYPE( + oNode, + { parent: this } + ), + i + ); + + } + + } + while((oNode = oNode.nextSibling)); + + } + while(i--); + + } + + break; + + case "SELECT": + + this.logger.log("Scanning " + + this.srcElement.childNodes.length + + " child nodes for items to initialize."); + + oNode = this.srcElement.firstChild; + + do { + + if(oNode && oNode.tagName) { + + switch(oNode.tagName.toUpperCase()) { + + case "OPTGROUP": + case "OPTION": + + this.logger.log("Initializing " + + oNode.tagName + " node."); + + this.addItem( + new this.ITEM_TYPE( + oNode, + { parent: this } + ) + ); + + break; + + } + + } + + } + while((oNode = oNode.nextSibling)); + + break; + + } + + } + +}, + + +/** +* @method _getFirstEnabledItem +* @description Returns the first enabled item in the menu. +* @return {YAHOO.widget.MenuItem} +* @private +*/ +_getFirstEnabledItem: function() { + + var nGroups = this._aItemGroups.length, + oItem, + aItemGroup; + + for(var i=0; i= aGroup.length); + + + if(aGroup[p_nItemIndex]) { + + aGroup.splice(p_nItemIndex, 0, oItem); + + } + else { + + aGroup[p_nItemIndex] = oItem; + + } + + + oGroupItem = aGroup[p_nItemIndex]; + + if(oGroupItem) { + + if( + bAppend && + ( + !oGroupItem.element.parentNode || + oGroupItem.element.parentNode.nodeType == 11 + ) + ) { + + this._aListElements[nGroupIndex].appendChild( + oGroupItem.element + ); + + } + else { + + + /** + * Returns the next sibling of an item in an array. + * @private + * @param {p_aArray} Array to search. + * @param {p_nStartIndex} Number indicating the index to + * start searching the array. + * @return {Object} + */ + function getNextItemSibling(p_aArray, p_nStartIndex) { + + return ( + p_aArray[p_nStartIndex] || + getNextItemSibling( + p_aArray, + (p_nStartIndex+1) + ) + ); + + } + + + var oNextItemSibling = + getNextItemSibling(aGroup, (p_nItemIndex+1)); + + if( + oNextItemSibling && + ( + !oGroupItem.element.parentNode || + oGroupItem.element.parentNode.nodeType == 11 + ) + ) { + + this._aListElements[nGroupIndex].insertBefore( + oGroupItem.element, + oNextItemSibling.element + ); + + } + + } + + + oGroupItem.parent = this; + + this._subscribeToItemEvents(oGroupItem); + + this._configureSubmenu(oGroupItem); + + this._updateItemProperties(nGroupIndex); + + this.logger.log("Item inserted." + + " Text: " + oGroupItem.cfg.getProperty("text") + ", " + + " Index: " + oGroupItem.index + ", " + + " Group Index: " + oGroupItem.groupIndex); + + this.itemAddedEvent.fire(oGroupItem); + + return oGroupItem; + + } + + } + else { + + var nItemIndex = aGroup.length; + + aGroup[nItemIndex] = oItem; + + oGroupItem = aGroup[nItemIndex]; + + + if(oGroupItem) { + + if( + !Dom.isAncestor( + this._aListElements[nGroupIndex], + oGroupItem.element + ) + ) { + + this._aListElements[nGroupIndex].appendChild( + oGroupItem.element + ); + + } + + oGroupItem.element.setAttribute("groupindex", nGroupIndex); + oGroupItem.element.setAttribute("index", nItemIndex); + + oGroupItem.parent = this; + + oGroupItem.index = nItemIndex; + oGroupItem.groupIndex = nGroupIndex; + + this._subscribeToItemEvents(oGroupItem); + + this._configureSubmenu(oGroupItem); + + if(nItemIndex === 0) { + + Dom.addClass(oGroupItem.element, "first-of-type"); + + } + + this.logger.log("Item added." + + " Text: " + oGroupItem.cfg.getProperty("text") + ", " + + " Index: " + oGroupItem.index + ", " + + " Group Index: " + oGroupItem.groupIndex); + + + this.itemAddedEvent.fire(oGroupItem); + + return oGroupItem; + + } + + } + + } + +}, + + +/** +* @method _removeItemFromGroupByIndex +* @description Removes a menu item from a group by index. Returns the menu +* item that was removed. +* @private +* @param {Number} p_nGroupIndex Number indicating the group to which the menu +* item belongs. +* @param {Number} p_nItemIndex Number indicating the index of the menu item +* to be removed. +* @return {YAHOO.widget.MenuItem} +*/ +_removeItemFromGroupByIndex: function(p_nGroupIndex, p_nItemIndex) { + + var nGroupIndex = typeof p_nGroupIndex == "number" ? p_nGroupIndex : 0, + aGroup = this._getItemGroup(nGroupIndex); + + if(aGroup) { + + var aArray = aGroup.splice(p_nItemIndex, 1), + oItem = aArray[0]; + + if(oItem) { + + // Update the index and className properties of each member + + this._updateItemProperties(nGroupIndex); + + if(aGroup.length === 0) { + + // Remove the UL + + var oUL = this._aListElements[nGroupIndex]; + + if(this.body && oUL) { + + this.body.removeChild(oUL); + + } + + // Remove the group from the array of items + + this._aItemGroups.splice(nGroupIndex, 1); + + + // Remove the UL from the array of ULs + + this._aListElements.splice(nGroupIndex, 1); + + + /* + Assign the "first-of-type" class to the new first UL + in the collection + */ + + oUL = this._aListElements[0]; + + if(oUL) { + + Dom.addClass(oUL, "first-of-type"); + + } + + } + + + this.itemRemovedEvent.fire(oItem); + + + // Return a reference to the item that was removed + + return oItem; + + } + + } + +}, + + +/** +* @method _removeItemFromGroupByValue +* @description Removes a menu item from a group by reference. Returns the +* menu item that was removed. +* @private +* @param {Number} p_nGroupIndex Number indicating the group to which the +* menu item belongs. +* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem +* instance to be removed. +* @return {YAHOO.widget.MenuItem} +*/ +_removeItemFromGroupByValue: function(p_nGroupIndex, p_oItem) { + + var aGroup = this._getItemGroup(p_nGroupIndex); + + if(aGroup) { + + var nItems = aGroup.length, + nItemIndex = -1; + + if(nItems > 0) { + + var i = nItems-1; + + do { + + if(aGroup[i] == p_oItem) { + + nItemIndex = i; + break; + + } + + } + while(i--); + + if(nItemIndex > -1) { + + return this._removeItemFromGroupByIndex( + p_nGroupIndex, + nItemIndex + ); + + } + + } + + } + +}, + + +/** +* @method _updateItemProperties +* @description Updates the "index," "groupindex," and "className" properties +* of the menu items in the specified group. +* @private +* @param {Number} p_nGroupIndex Number indicating the group of items to update. +*/ +_updateItemProperties: function(p_nGroupIndex) { + + var aGroup = this._getItemGroup(p_nGroupIndex), + nItems = aGroup.length; + + if(nItems > 0) { + + var i = nItems - 1, + oItem, + oLI; + + // Update the index and className properties of each member + + do { + + oItem = aGroup[i]; + + if(oItem) { + + oLI = oItem.element; + + oItem.index = i; + oItem.groupIndex = p_nGroupIndex; + + oLI.setAttribute("groupindex", p_nGroupIndex); + oLI.setAttribute("index", i); + + Dom.removeClass(oLI, "first-of-type"); + + } + + } + while(i--); + + + if(oLI) { + + Dom.addClass(oLI, "first-of-type"); + + } + + } + +}, + + +/** +* @method _createItemGroup +* @description Creates a new menu item group (array) and its associated +* <ul> element. Returns an aray of menu item groups. +* @private +* @param {Number} p_nIndex Number indicating the group to create. +* @return {Array} +*/ +_createItemGroup: function(p_nIndex) { + + if(!this._aItemGroups[p_nIndex]) { + + this._aItemGroups[p_nIndex] = []; + + var oUL = document.createElement("ul"); + + this._aListElements[p_nIndex] = oUL; + + return this._aItemGroups[p_nIndex]; + + } + +}, + + +/** +* @method _getItemGroup +* @description Returns the menu item group at the specified index. +* @private +* @param {Number} p_nIndex Number indicating the index of the menu item group +* to be retrieved. +* @return {Array} +*/ +_getItemGroup: function(p_nIndex) { + + var nIndex = ((typeof p_nIndex == "number") ? p_nIndex : 0); + + return this._aItemGroups[nIndex]; + +}, + + +/** +* @method _configureSubmenu +* @description Subscribes the menu item's submenu to its parent menu's events. +* @private +* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem +* instance with the submenu to be configured. +*/ +_configureSubmenu: function(p_oItem) { + + var oSubmenu = p_oItem.cfg.getProperty("submenu"); + + if(oSubmenu) { + + /* + Listen for configuration changes to the parent menu + so they they can be applied to the submenu. + */ + + this.cfg.configChangedEvent.subscribe( + this._onParentMenuConfigChange, + oSubmenu, + true + ); + + this.renderEvent.subscribe( + this._onParentMenuRender, + oSubmenu, + true + ); + + oSubmenu.beforeShowEvent.subscribe( + this._onSubmenuBeforeShow, + oSubmenu, + true + ); + + oSubmenu.showEvent.subscribe( + this._onSubmenuShow, + oSubmenu, + true + ); + + oSubmenu.hideEvent.subscribe( + this._onSubmenuHide, + oSubmenu, + true + ); + + } + +}, + + +/** +* @method _subscribeToItemEvents +* @description Subscribes a menu to a menu item's event. +* @private +* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem +* instance whose events should be subscribed to. +*/ +_subscribeToItemEvents: function(p_oItem) { + + p_oItem.focusEvent.subscribe(this._onMenuItemFocus, p_oItem, this); + + p_oItem.blurEvent.subscribe(this._onMenuItemBlur, this, true); + + p_oItem.cfg.configChangedEvent.subscribe( + this._onMenuItemConfigChange, + p_oItem, + this + ); + +}, + + +/** +* @method _getOffsetWidth +* @description Returns the offset width of the menu's +* <div> element. +* @private +*/ +_getOffsetWidth: function() { + + var oClone = this.element.cloneNode(true); + + Dom.setStyle(oClone, "width", ""); + + document.body.appendChild(oClone); + + var sWidth = oClone.offsetWidth; + + document.body.removeChild(oClone); + + return sWidth; + +}, + + +/** +* @method _cancelHideDelay +* @description Cancels the call to "hideMenu." +* @private +*/ +_cancelHideDelay: function() { + + var oRoot = this.getRoot(); + + if(oRoot._nHideDelayId) { + + window.clearTimeout(oRoot._nHideDelayId); + + } + +}, + + +/** +* @method _execHideDelay +* @description Hides the menu after the number of milliseconds specified by +* the "hidedelay" configuration property. +* @private +*/ +_execHideDelay: function() { + + this._cancelHideDelay(); + + var oRoot = this.getRoot(), + me = this; + + function hideMenu() { + + if(oRoot.activeItem) { + + oRoot.clearActiveItem(); + + } + + if(oRoot == me && me.cfg.getProperty("position") == "dynamic") { + + me.hide(); + + } + + } + + + oRoot._nHideDelayId = + window.setTimeout(hideMenu, oRoot.cfg.getProperty("hidedelay")); + +}, + + +/** +* @method _cancelShowDelay +* @description Cancels the call to the "showMenu." +* @private +*/ +_cancelShowDelay: function() { + + var oRoot = this.getRoot(); + + if(oRoot._nShowDelayId) { + + window.clearTimeout(oRoot._nShowDelayId); + + } + +}, + + +/** +* @method _execShowDelay +* @description Shows the menu after the number of milliseconds specified by +* the "showdelay" configuration property have ellapsed. +* @private +* @param {YAHOO.widget.Menu} p_oMenu Object specifying the menu that should +* be made visible. +*/ +_execShowDelay: function(p_oMenu) { + + var oRoot = this.getRoot(); + + function showMenu() { + + p_oMenu.show(); + + } + + + oRoot._nShowDelayId = + window.setTimeout(showMenu, oRoot.cfg.getProperty("showdelay")); + +}, + + + +// Protected methods + + +/** +* @method _onMouseOver +* @description "mouseover" event handler for the menu. +* @protected +* @param {String} p_sType String representing the name of the event that +* was fired. +* @param {Array} p_aArgs Array of arguments sent when the event was fired. +* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that +* fired the event. +*/ +_onMouseOver: function(p_sType, p_aArgs, p_oMenu) { + + var oEvent = p_aArgs[0], + oItem = p_aArgs[1], + oTarget = Event.getTarget(oEvent); + + + if( + !this._bHandledMouseOverEvent && + (oTarget == this.element || Dom.isAncestor(this.element, oTarget)) + ) { + + this.clearActiveItem(); + + this._bHandledMouseOverEvent = true; + this._bHandledMouseOutEvent = false; + + } + + + if( + oItem && !oItem.handledMouseOverEvent && + !oItem.cfg.getProperty("disabled") && + (oTarget == oItem.element || Dom.isAncestor(oItem.element, oTarget)) + ) { + + var nShowDelay = this.cfg.getProperty("showdelay"), + bShowDelay = (nShowDelay > 0); + + + if(bShowDelay) { + + this._cancelShowDelay(); + + } + + + var oActiveItem = this.activeItem; + + if(oActiveItem) { + + oActiveItem.cfg.setProperty("selected", false); + + var oActiveSubmenu = oActiveItem.cfg.getProperty("submenu"); + + if(oActiveSubmenu) { + + oActiveSubmenu.hide(); + + } + + } + + + var oItemCfg = oItem.cfg; + + // Select and focus the current menu item + + oItemCfg.setProperty("selected", true); + oItem.focus(); + + + if(this.cfg.getProperty("autosubmenudisplay")) { + + // Show the submenu this menu item + + var oSubmenu = oItemCfg.getProperty("submenu"); + + if(oSubmenu) { + + if(bShowDelay) { + + this._execShowDelay(oSubmenu); + + } + else { + + oSubmenu.show(); + + } + + } + + } + + oItem.handledMouseOverEvent = true; + oItem.handledMouseOutEvent = false; + + } + +}, + + +/** +* @method _onMouseOut +* @description "mouseout" event handler for the menu. +* @protected +* @param {String} p_sType String representing the name of the event that +* was fired. +* @param {Array} p_aArgs Array of arguments sent when the event was fired. +* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that +* fired the event. +*/ +_onMouseOut: function(p_sType, p_aArgs, p_oMenu) { + + var oEvent = p_aArgs[0], + oItem = p_aArgs[1], + oRelatedTarget = Event.getRelatedTarget(oEvent), + bMovingToSubmenu = false; + + + if(oItem && !oItem.cfg.getProperty("disabled")) { + + var oItemCfg = oItem.cfg, + oSubmenu = oItemCfg.getProperty("submenu"); + + + if( + oSubmenu && + ( + oRelatedTarget == oSubmenu.element || + Dom.isAncestor(oSubmenu.element, oRelatedTarget) + ) + ) { + + bMovingToSubmenu = true; + + } + + + if( + !oItem.handledMouseOutEvent && + ( + ( + oRelatedTarget != oItem.element && + !Dom.isAncestor(oItem.element, oRelatedTarget) + ) || bMovingToSubmenu + ) + ) { + + if( + !oSubmenu || + (oSubmenu && !oSubmenu.cfg.getProperty("visible")) + ) { + + oItem.cfg.setProperty("selected", false); + + if( + oSubmenu && + oSubmenu.cfg.getProperty("showdelay") && + !oSubmenu.cfg.getProperty("visible") + ) { + + this._cancelShowDelay(); + + } + + } + + + oItem.handledMouseOutEvent = true; + oItem.handledMouseOverEvent = false; + + } + + } + + + if( + !this._bHandledMouseOutEvent && + ( + ( + oRelatedTarget != this.element && + !Dom.isAncestor(this.element, oRelatedTarget) + ) + || bMovingToSubmenu + ) + ) { + + this._bHandledMouseOutEvent = true; + this._bHandledMouseOverEvent = false; + + } + +}, + + +/** +* @method _onClick +* @description "click" event handler for the menu. +* @protected +* @param {String} p_sType String representing the name of the event that +* was fired. +* @param {Array} p_aArgs Array of arguments sent when the event was fired. +* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that +* fired the event. +*/ +_onClick: function(p_sType, p_aArgs, p_oMenu) { + + var oEvent = p_aArgs[0], + oItem = p_aArgs[1], + oTarget = Event.getTarget(oEvent); + + if(oItem && !oItem.cfg.getProperty("disabled")) { + + var oItemCfg = oItem.cfg, + oSubmenu = oItemCfg.getProperty("submenu"); + + + /* + ACCESSIBILITY FEATURE FOR SCREEN READERS: + Expand/collapse the submenu when the user clicks + on the submenu indicator image. + */ + + if(oTarget == oItem.submenuIndicator && oSubmenu) { + + if(oSubmenu.cfg.getProperty("visible")) { + + oSubmenu.hide(); + + } + else { + + this.clearActiveItem(); + + this.activeItem = oItem; + + oItem.cfg.setProperty("selected", true); + + oSubmenu.show(); + + } + + } + else { + + var sURL = oItemCfg.getProperty("url"), + bCurrentPageURL = (sURL.substr((sURL.length-1),1) == "#"), + sTarget = oItemCfg.getProperty("target"), + bHasTarget = (sTarget && sTarget.length > 0); + + /* + Prevent the browser from following links + equal to "#" + */ + + if( + oTarget.tagName.toUpperCase() == "A" && + bCurrentPageURL && !bHasTarget + ) { + + Event.preventDefault(oEvent); + + } + + if( + oTarget.tagName.toUpperCase() != "A" && + !bCurrentPageURL && !bHasTarget + ) { + + /* + Follow the URL of the item regardless of + whether or not the user clicked specifically + on the anchor element. + */ + + document.location = sURL; + + } + + + /* + If the item doesn't navigate to a URL and it doesn't have + a submenu, then collapse the menu tree. + */ + + if(bCurrentPageURL && !oSubmenu) { + + var oRoot = this.getRoot(); + + if(oRoot.cfg.getProperty("position") == "static") { + + oRoot.clearActiveItem(); + + } + else { + + oRoot.hide(); + + } + + } + + } + + } + +}, + + +/** +* @method _onKeyDown +* @description "keydown" event handler for the menu. +* @protected +* @param {String} p_sType String representing the name of the event that +* was fired. +* @param {Array} p_aArgs Array of arguments sent when the event was fired. +* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that +* fired the event. +*/ +_onKeyDown: function(p_sType, p_aArgs, p_oMenu) { + + var oEvent = p_aArgs[0], + oItem = p_aArgs[1], + oSubmenu; + + if(oItem && !oItem.cfg.getProperty("disabled")) { + + var oItemCfg = oItem.cfg, + oParentItem = this.parent, + oRoot, + oNextItem; + + + switch(oEvent.keyCode) { + + case 38: // Up arrow + case 40: // Down arrow + + if( + oItem == this.activeItem && + !oItemCfg.getProperty("selected") + ) { + + oItemCfg.setProperty("selected", true); + + } + else { + + oNextItem = (oEvent.keyCode == 38) ? + oItem.getPreviousEnabledSibling() : + oItem.getNextEnabledSibling(); + + if(oNextItem) { + + this.clearActiveItem(); + + oNextItem.cfg.setProperty("selected", true); + oNextItem.focus(); + + } + + } + + Event.preventDefault(oEvent); + + break; + + + case 39: // Right arrow + + oSubmenu = oItemCfg.getProperty("submenu"); + + if(oSubmenu) { + + if(!oItemCfg.getProperty("selected")) { + + oItemCfg.setProperty("selected", true); + + } + + oSubmenu.show(); + + oSubmenu.setInitialSelection(); + + } + else { + + oRoot = this.getRoot(); + + if(oRoot instanceof YAHOO.widget.MenuBar) { + + oNextItem = oRoot.activeItem.getNextEnabledSibling(); + + if(oNextItem) { + + oRoot.clearActiveItem(); + + oNextItem.cfg.setProperty("selected", true); + + oSubmenu = oNextItem.cfg.getProperty("submenu"); + + if(oSubmenu) { + + oSubmenu.show(); + + } + + oNextItem.focus(); + + } + + } + + } + + + Event.preventDefault(oEvent); + + break; + + + case 37: // Left arrow + + if(oParentItem) { + + var oParentMenu = oParentItem.parent; + + if(oParentMenu instanceof YAHOO.widget.MenuBar) { + + oNextItem = + oParentMenu.activeItem.getPreviousEnabledSibling(); + + if(oNextItem) { + + oParentMenu.clearActiveItem(); + + oNextItem.cfg.setProperty("selected", true); + + oSubmenu = oNextItem.cfg.getProperty("submenu"); + + if(oSubmenu) { + + oSubmenu.show(); + + } + + oNextItem.focus(); + + } + + } + else { + + this.hide(); + + oParentItem.focus(); + + } + + } + + Event.preventDefault(oEvent); + + break; + + } + + + } + + + if(oEvent.keyCode == 27) { // Esc key + + if(this.cfg.getProperty("position") == "dynamic") { + + this.hide(); + + if(this.parent) { + + this.parent.focus(); + + } + + } + else if(this.activeItem) { + + oSubmenu = this.activeItem.cfg.getProperty("submenu"); + + if(oSubmenu && oSubmenu.cfg.getProperty("visible")) { + + oSubmenu.hide(); + this.activeItem.focus(); + + } + else { + + this.activeItem.cfg.setProperty("selected", false); + this.activeItem.blur(); + + } + + } + + + Event.preventDefault(oEvent); + + } + +}, + + +/** +* @method _onTextResize +* @description "textresize" event handler for the menu. +* @protected +* @param {String} p_sType String representing the name of the event that +* was fired. +* @param {Array} p_aArgs Array of arguments sent when the event was fired. +* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that +* fired the event. +*/ +_onTextResize: function(p_sType, p_aArgs, p_oMenu) { + + if(this.browser == "gecko" && !this._handleResize) { + + this._handleResize = true; + return; + + } + + + var oConfig = this.cfg; + + if(oConfig.getProperty("position") == "dynamic") { + + oConfig.setProperty("width", (this._getOffsetWidth() + "px")); + + } + +}, + + + +// Private methods + + +/** +* @method _onInit +* @description "init" event handler for the menu. +* @private +* @param {String} p_sType String representing the name of the event that +* was fired. +* @param {Array} p_aArgs Array of arguments sent when the event was fired. +* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that +* fired the event. +*/ +_onInit: function(p_sType, p_aArgs, p_oMenu) { + + if( + ( + (this.parent && !this.lazyLoad) || + (!this.parent && this.cfg.getProperty("position") == "static") || + ( + !this.parent && + !this.lazyLoad && + this.cfg.getProperty("position") == "dynamic" + ) + ) && + this.getItemGroups().length === 0 + ) { + + if(this.srcElement) { + + this._initSubTree(); + + } + + + if(this.itemData) { + + this.addItems(this.itemData); + + } + + } + else if(this.lazyLoad) { + + this.cfg.fireQueue(); + + } + +}, + + +/** +* @method _onBeforeRender +* @description "beforerender" event handler for the menu. Appends all of the +* <ul>, <li> and their accompanying +* title elements to the body element of the menu. +* @private +* @param {String} p_sType String representing the name of the event that +* was fired. +* @param {Array} p_aArgs Array of arguments sent when the event was fired. +* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that +* fired the event. +*/ +_onBeforeRender: function(p_sType, p_aArgs, p_oMenu) { + + var oConfig = this.cfg, + oEl = this.element, + nListElements = this._aListElements.length; + + + if(nListElements > 0) { + + var i = 0, + bFirstList = true, + oUL, + oGroupTitle; + + + do { + + oUL = this._aListElements[i]; + + if(oUL) { + + if(bFirstList) { + + Dom.addClass(oUL, "first-of-type"); + bFirstList = false; + + } + + + if(!Dom.isAncestor(oEl, oUL)) { + + this.appendToBody(oUL); + + } + + + oGroupTitle = this._aGroupTitleElements[i]; + + if(oGroupTitle) { + + if(!Dom.isAncestor(oEl, oGroupTitle)) { + + oUL.parentNode.insertBefore(oGroupTitle, oUL); + + } + + + Dom.addClass(oUL, "hastitle"); + + } + + } + + i++; + + } + while(i < nListElements); + + } + +}, + + +/** +* @method _onRender +* @description "render" event handler for the menu. +* @private +* @param {String} p_sType String representing the name of the event that +* was fired. +* @param {Array} p_aArgs Array of arguments sent when the event was fired. +* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that +* fired the event. +*/ +_onRender: function(p_sType, p_aArgs, p_oMenu) { + + if(this.cfg.getProperty("position") == "dynamic") { + + var sWidth = + this.element.parentNode.tagName.toUpperCase() == "BODY" ? + this.element.offsetWidth : this._getOffsetWidth(); + + this.cfg.setProperty("width", (sWidth + "px")); + + } + +}, + + +/** +* @method _onBeforeShow +* @description "beforeshow" event handler for the menu. +* @private +* @param {String} p_sType String representing the name of the event that +* was fired. +* @param {Array} p_aArgs Array of arguments sent when the event was fired. +* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that +* fired the event. +*/ +_onBeforeShow: function(p_sType, p_aArgs, p_oMenu) { + + if(this.lazyLoad && this.getItemGroups().length === 0) { + + if(this.srcElement) { + + this._initSubTree(); + + } + + + if(this.itemData) { + + if( + this.parent && this.parent.parent && + this.parent.parent.srcElement && + this.parent.parent.srcElement.tagName.toUpperCase() == "SELECT" + ) { + + var nOptions = this.itemData.length; + + for(var n=0; n viewPortWidth) { + + if( + oContextElement && + ((x - oContextElement.offsetWidth) > offsetWidth) + ) { + + x = (x - (oContextElement.offsetWidth + offsetWidth)); + + } + else { + + x = rightConstraint; + + } + + } + + if (y < 10) { + + y = topConstraint; + + } else if (y > bottomConstraint) { + + if(oContextElement && (y > offsetHeight)) { + + y = ((y + oContextElement.offsetHeight) - offsetHeight); + + } + else { + + y = bottomConstraint; + + } + + } + + oConfig.setProperty("x", x, true); + oConfig.setProperty("y", y, true); + oConfig.setProperty("xy", [x,y], true); + +}, + + +/** +* @method configVisible +* @description Event handler for when the "visible" configuration property +* the menu changes. +* @param {String} p_sType String representing the name of the event that +* was fired. +* @param {Array} p_aArgs Array of arguments sent when the event was fired. +* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that +* fired the event. +*/ +configVisible: function(p_sType, p_aArgs, p_oMenu) { + + if(this.cfg.getProperty("position") == "dynamic") { + + YAHOO.widget.Menu.superclass.configVisible.call( + this, + p_sType, + p_aArgs, + p_oMenu + ); + + } + else { + + var bVisible = p_aArgs[0], + sDisplay = Dom.getStyle(this.element, "display"); + + if(bVisible) { + + if(sDisplay != "block") { + this.beforeShowEvent.fire(); + Dom.setStyle(this.element, "display", "block"); + this.showEvent.fire(); + } + + } + else { + + if(sDisplay == "block") { + this.beforeHideEvent.fire(); + Dom.setStyle(this.element, "display", "none"); + this.hideEvent.fire(); + } + + } + + } + +}, + + +/** +* @method configPosition +* @description Event handler for when the "position" configuration property +* of the menu changes. +* @param {String} p_sType String representing the name of the event that +* was fired. +* @param {Array} p_aArgs Array of arguments sent when the event was fired. +* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that +* fired the event. +*/ +configPosition: function(p_sType, p_aArgs, p_oMenu) { + + var sCSSPosition = p_aArgs[0] == "static" ? "static" : "absolute", + oCfg = this.cfg; + + Dom.setStyle(this.element, "position", sCSSPosition); + + + if(sCSSPosition == "static") { + + /* + Remove the iframe for statically positioned menus since it will + intercept mouse events. + */ + + oCfg.setProperty("iframe", false); + + + // Statically positioned menus are visible by default + + Dom.setStyle(this.element, "display", "block"); + + oCfg.setProperty("visible", true); + + } + else { + + /* + Even though the "visible" property is queued to + "false" by default, we need to set the "visibility" property to + "hidden" since Overlay's "configVisible" implementation checks the + element's "visibility" style property before deciding whether + or not to show an Overlay instance. + */ + + Dom.setStyle(this.element, "visibility", "hidden"); + + } + + + if(sCSSPosition == "absolute") { + + var nZIndex = oCfg.getProperty("zindex"); + + if(!nZIndex || nZIndex === 0) { + + nZIndex = this.parent ? + (this.parent.parent.cfg.getProperty("zindex") + 1) : 1; + + oCfg.setProperty("zindex", nZIndex); + + } + + } + +}, + + +/** +* @method configIframe +* @description Event handler for when the "iframe" configuration property of +* the menu changes. +* @param {String} p_sType String representing the name of the event that +* was fired. +* @param {Array} p_aArgs Array of arguments sent when the event was fired. +* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that +* fired the event. +*/ +configIframe: function(p_sType, p_aArgs, p_oMenu) { + + if(this.cfg.getProperty("position") == "dynamic") { + + YAHOO.widget.Menu.superclass.configIframe.call( + this, + p_sType, + p_aArgs, + p_oMenu + ); + + } + +}, + + +/** +* @method configHideDelay +* @description Event handler for when the "hidedelay" configuration property +* of the menu changes. +* @param {String} p_sType String representing the name of the event that +* was fired. +* @param {Array} p_aArgs Array of arguments sent when the event was fired. +* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that +* fired the event. +*/ +configHideDelay: function(p_sType, p_aArgs, p_oMenu) { + + var nHideDelay = p_aArgs[0], + oMouseOutEvent = this.mouseOutEvent, + oMouseOverEvent = this.mouseOverEvent, + oKeyDownEvent = this.keyDownEvent; + + if(nHideDelay > 0) { + + /* + Only assign event handlers once. This way the user change + the value for the hidedelay as many times as they want. + */ + + if(!this._hideDelayEventHandlersAssigned) { + + oMouseOutEvent.subscribe(this._execHideDelay, true); + oMouseOverEvent.subscribe(this._cancelHideDelay, this, true); + oKeyDownEvent.subscribe(this._cancelHideDelay, this, true); + + this._hideDelayEventHandlersAssigned = true; + + } + + } + else { + + oMouseOutEvent.unsubscribe(this._execHideDelay, this); + oMouseOverEvent.unsubscribe(this._cancelHideDelay, this); + oKeyDownEvent.unsubscribe(this._cancelHideDelay, this); + + this._hideDelayEventHandlersAssigned = false; + + } + +}, + + +/** +* @method configContainer +* @description Event handler for when the "container" configuration property +of the menu changes. +* @param {String} p_sType String representing the name of the event that +* was fired. +* @param {Array} p_aArgs Array of arguments sent when the event was fired. +* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that +* fired the event. +*/ +configContainer: function(p_sType, p_aArgs, p_oMenu) { + + var oElement = p_aArgs[0]; + + if(typeof oElement == 'string') { + + this.cfg.setProperty( + "container", + document.getElementById(oElement), + true + ); + + } + +}, + + + +// Public methods + + +/** +* @method initEvents +* @description Initializes the custom events for the menu. +*/ +initEvents: function() { + + YAHOO.widget.Menu.superclass.initEvents.call(this); + + // Create custom events + + var CustomEvent = YAHOO.util.CustomEvent; + + this.mouseOverEvent = new CustomEvent("mouseOverEvent", this); + this.mouseOutEvent = new CustomEvent("mouseOutEvent", this); + this.mouseDownEvent = new CustomEvent("mouseDownEvent", this); + this.mouseUpEvent = new CustomEvent("mouseUpEvent", this); + this.clickEvent = new CustomEvent("clickEvent", this); + this.keyPressEvent = new CustomEvent("keyPressEvent", this); + this.keyDownEvent = new CustomEvent("keyDownEvent", this); + this.keyUpEvent = new CustomEvent("keyUpEvent", this); + this.itemAddedEvent = new CustomEvent("itemAddedEvent", this); + this.itemRemovedEvent = new CustomEvent("itemRemovedEvent", this); + +}, + + +/** +* @method getRoot +* @description Finds the menu's root menu. +*/ +getRoot: function() { + + var oItem = this.parent; + + if(oItem) { + + var oParentMenu = oItem.parent; + + return oParentMenu ? oParentMenu.getRoot() : this; + + } + else { + + return this; + + } + +}, + + +/** +* @method toString +* @description Returns a string representing the menu. +* @return {String} +*/ +toString: function() { + + return ("Menu " + this.id); + +}, + + +/** +* @method setItemGroupTitle +* @description Sets the title of a group of menu items. +* @param {String} p_sGroupTitle String specifying the title of the group. +* @param {Number} p_nGroupIndex Optional. Number specifying the group to which +* the title belongs. +*/ +setItemGroupTitle: function(p_sGroupTitle, p_nGroupIndex) { + + if(typeof p_sGroupTitle == "string" && p_sGroupTitle.length > 0) { + + var nGroupIndex = typeof p_nGroupIndex == "number" ? p_nGroupIndex : 0, + oTitle = this._aGroupTitleElements[nGroupIndex]; + + + if(oTitle) { + + oTitle.innerHTML = p_sGroupTitle; + + } + else { + + oTitle = document.createElement(this.GROUP_TITLE_TAG_NAME); + + oTitle.innerHTML = p_sGroupTitle; + + this._aGroupTitleElements[nGroupIndex] = oTitle; + + } + + + var i = this._aGroupTitleElements.length - 1, + nFirstIndex; + + do { + + if(this._aGroupTitleElements[i]) { + + Dom.removeClass(this._aGroupTitleElements[i], "first-of-type"); + + nFirstIndex = i; + + } + + } + while(i--); + + + if(nFirstIndex !== null) { + + Dom.addClass( + this._aGroupTitleElements[nFirstIndex], + "first-of-type" + ); + + } + + } + +}, + + + +/** +* @method addItem +* @description Appends an item to the menu. +* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem +* instance to be added to the menu. +* @param {String} p_oItem String specifying the text of the item to be added +* to the menu. +* @param {Object} p_oItem Object literal containing a set of menu item +* configuration properties. +* @param {Number} p_nGroupIndex Optional. Number indicating the group to +* which the item belongs. +* @return {YAHOO.widget.MenuItem} +*/ +addItem: function(p_oItem, p_nGroupIndex) { + + if(p_oItem) { + + return this._addItemToGroup(p_nGroupIndex, p_oItem); + + } + +}, + + +/** +* @method addItems +* @description Adds an array of items to the menu. +* @param {Array} p_aItems Array of items to be added to the menu. The array +* can contain strings specifying the text for each item to be created, object +* literals specifying each of the menu item configuration properties, +* or MenuItem instances. +* @param {Number} p_nGroupIndex Optional. Number specifying the group to +* which the items belongs. +* @return {Array} +*/ +addItems: function(p_aItems, p_nGroupIndex) { + + function isArray(p_oValue) { + + return (typeof p_oValue == "object" && p_oValue.constructor == Array); + + } + + + if(isArray(p_aItems)) { + + var nItems = p_aItems.length, + aItems = [], + oItem; + + + for(var i=0; i<div> element +* (and accompanying child nodes) from the document. +*/ +destroy: function() { + + // Remove Custom Event listeners + + this.mouseOverEvent.unsubscribeAll(); + this.mouseOutEvent.unsubscribeAll(); + this.mouseDownEvent.unsubscribeAll(); + this.mouseUpEvent.unsubscribeAll(); + this.clickEvent.unsubscribeAll(); + this.keyPressEvent.unsubscribeAll(); + this.keyDownEvent.unsubscribeAll(); + this.keyUpEvent.unsubscribeAll(); + this.itemAddedEvent.unsubscribeAll(); + this.itemRemovedEvent.unsubscribeAll(); + + var nItemGroups = this._aItemGroups.length, + nItems, + oItemGroup, + oItem, + i, + n; + + + // Remove all items + + if(nItemGroups > 0) { + + i = nItemGroups - 1; + + do { + + oItemGroup = this._aItemGroups[i]; + + if(oItemGroup) { + + nItems = oItemGroup.length; + + if(nItems > 0) { + + n = nItems - 1; + + do { + + oItem = this._aItemGroups[i][n]; + + if(oItem) { + + oItem.destroy(); + } + + } + while(n--); + + } + + } + + } + while(i--); + + } + + + // Continue with the superclass implementation of this method + + YAHOO.widget.Menu.superclass.destroy.call(this); + + this.logger.log("Destroyed."); + +}, + + +/** +* @method setInitialFocus +* @description Sets focus to the menu's first enabled item. +*/ +setInitialFocus: function() { + + var oItem = this._getFirstEnabledItem(); + + if(oItem) { + + oItem.focus(); + } + +}, + + +/** +* @method setInitialSelection +* @description Sets the "selected" configuration property of the menu's first +* enabled item to "true." +*/ +setInitialSelection: function() { + + var oItem = this._getFirstEnabledItem(); + + if(oItem) { + + oItem.cfg.setProperty("selected", true); + } + +}, + + +/** +* @method clearActiveItem +* @description Sets the "selected" configuration property of the menu's active +* item to "false" and hides the item's submenu. +* @param {Boolean} p_bBlur Boolean indicating if the menu's active item +* should be blurred. +*/ +clearActiveItem: function(p_bBlur) { + + if(this.cfg.getProperty("showdelay") > 0) { + + this._cancelShowDelay(); + + } + + + var oActiveItem = this.activeItem; + + if(oActiveItem) { + + var oConfig = oActiveItem.cfg; + + oConfig.setProperty("selected", false); + + var oSubmenu = oConfig.getProperty("submenu"); + + if(oSubmenu) { + + oSubmenu.hide(); + + } + + if(p_bBlur) { + + oActiveItem.blur(); + + } + + } + +}, + + +/** +* @description Initializes the class's configurable properties which can be +* changed using the menu's Config object ("cfg"). +* @method initDefaultConfig +*/ +initDefaultConfig: function() { + + YAHOO.widget.Menu.superclass.initDefaultConfig.call(this); + + var oConfig = this.cfg; + + // Add configuration properties + + /* + Change the default value for the "visible" configuration + property to "false" by re-adding the property. + */ + + /** + * @config visible + * @description Boolean indicating whether or not the menu is visible. If + * the menu's "position" configuration property is set to "dynamic" (the + * default), this property toggles the menu's <div> + * element's "visibility" style property between "visible" (true) or + * "hidden" (false). If the menu's "position" configuration property is + * set to "static" this property toggles the menu's + * <div> element's "display" style property + * between "block" (true) or "none" (false). + * @default false + * @type Boolean + */ + oConfig.addProperty( + "visible", + { + value:false, + handler:this.configVisible, + validator:this.cfg.checkBoolean + } + ); + + + /* + Change the default value for the "constraintoviewport" configuration + property to "true" by re-adding the property. + */ + + /** + * @config constraintoviewport + * @description Boolean indicating if the menu will try to remain inside + * the boundaries of the size of viewport. + * @default true + * @type Boolean + */ + oConfig.addProperty( + "constraintoviewport", + { + value:true, + handler:this.configConstrainToViewport, + validator:this.cfg.checkBoolean, + supercedes:["iframe","x","y","xy"] + } + ); + + + /** + * @config position + * @description String indicating how a menu should be positioned on the + * screen. Possible values are "static" and "dynamic." Static menus are + * visible by default and reside in the normal flow of the document + * (CSS position: static). Dynamic menus are hidden by default, reside + * out of the normal flow of the document (CSS position: absolute), and + * can overlay other elements on the screen. + * @default dynamic + * @type String + */ + oConfig.addProperty( + "position", + { + value: "dynamic", + handler: this.configPosition, + validator: this._checkPosition, + supercedes: ["visible"] + } + ); + + + /** + * @config submenualignment + * @description Array defining how submenus should be aligned to their + * parent menu item. The format is: [itemCorner, submenuCorner]. By default + * a submenu's top left corner is aligned to its parent menu item's top + * right corner. + * @default ["tl","tr"] + * @type Array + */ + oConfig.addProperty("submenualignment", { value: ["tl","tr"] } ); + + + /** + * @config autosubmenudisplay + * @description Boolean indicating if submenus are automatically made + * visible when the user mouses over the menu's items. + * @default true + * @type Boolean + */ + oConfig.addProperty( + "autosubmenudisplay", + { + value: true, + validator: oConfig.checkBoolean + } + ); + + + /** + * @config showdelay + * @description Number indicating the time (in milliseconds) that should + * expire before a submenu is made visible when the user mouses over + * the menu's items. + * @default 0 + * @type Number + */ + oConfig.addProperty( + "showdelay", + { + value: 0, + validator: oConfig.checkNumber + } + ); + + + /** + * @config hidedelay + * @description Number indicating the time (in milliseconds) that should + * expire before the menu is hidden. + * @default 0 + * @type Number + */ + oConfig.addProperty( + "hidedelay", + { + value: 0, + validator: oConfig.checkNumber, + handler: this.configHideDelay, + suppressEvent: true + } + ); + + + /** + * @config clicktohide + * @description Boolean indicating if the menu will automatically be + * hidden if the user clicks outside of it. + * @default true + * @type Boolean + */ + oConfig.addProperty( + "clicktohide", + { + value: true, + validator: oConfig.checkBoolean + } + ); + + + /** + * @config container + * @description HTML element reference or string specifying the id + * attribute of the HTML element that the menu's markup should be rendered into. + * @type HTMLElement|String + * @default document.body + */ + this.cfg.addProperty( + "container", + { value:document.body, handler:this.configContainer } + ); + +} + +}); // END YAHOO.extend + })(); @@ -4098,9 +4135,9 @@ YAHOO.widget.MenuModule = YAHOO.widget.Menu; (function() { -var Dom = YAHOO.util.Dom; -var Module = YAHOO.widget.Module; -var Menu = YAHOO.widget.Menu; +var Dom = YAHOO.util.Dom, + Module = YAHOO.widget.Module, + Menu = YAHOO.widget.Menu; /** @@ -4663,10 +4700,10 @@ YAHOO.widget.MenuItem.prototype = { // Get the anchor node (if it exists) - var oAnchor = this._getFirstElement(p_oObject, "A"); - var sURL = "#"; - var sTarget = null; - var sText = null; + var oAnchor = this._getFirstElement(p_oObject, "A"), + sURL = "#", + sTarget, + sText; // Capture the "text" and/or the "URL" @@ -4716,9 +4753,9 @@ YAHOO.widget.MenuItem.prototype = { // Check if emphasis has been applied to the MenuItem - var oEmphasisNode = this._getFirstElement(oAnchor); - var bEmphasis = false; - var bStrongEmphasis = false; + var oEmphasisNode = this._getFirstElement(oAnchor), + bEmphasis = false, + bStrongEmphasis = false; if(oEmphasisNode) { @@ -4917,8 +4954,8 @@ YAHOO.widget.MenuItem.prototype = { */ _initSubTree: function() { - var oSrcEl = this.srcElement; - var oConfig = this.cfg; + var oSrcEl = this.srcElement, + oConfig = this.cfg; if(oSrcEl.childNodes.length > 0) { @@ -4937,8 +4974,8 @@ YAHOO.widget.MenuItem.prototype = { } else { - var oNode = oSrcEl.firstChild; - var aOptions = []; + var oNode = oSrcEl.firstChild, + aOptions = []; do { @@ -5055,12 +5092,12 @@ YAHOO.widget.MenuItem.prototype = { */ configHelpText: function(p_sType, p_aArgs, p_oItem) { - var me = this; - var oHelpText = p_aArgs[0]; - var oEl = this.element; - var oConfig = this.cfg; - var aNodes = [oEl, this._oAnchor]; - var oImg = this.submenuIndicator; + var me = this, + oHelpText = p_aArgs[0], + oEl = this.element, + oConfig = this.cfg, + aNodes = [oEl, this._oAnchor], + oImg = this.submenuIndicator; /** @@ -5068,7 +5105,7 @@ YAHOO.widget.MenuItem.prototype = { * "selected" and "disabled" configuration events. * @private */ - var initHelpText = function() { + function initHelpText() { Dom.addClass(aNodes, "hashelptext"); @@ -5084,21 +5121,21 @@ YAHOO.widget.MenuItem.prototype = { } - }; + } /** * Removes the "hashelptext" class and corresponding DOM element (EM). * @private */ - var removeHelpText = function() { + function removeHelpText() { Dom.removeClass(aNodes, "hashelptext"); oEl.removeChild(me._oHelpTextEM); me._oHelpTextEM = null; - }; + } if(this._checkDOMNode(oHelpText)) { @@ -5192,8 +5229,8 @@ YAHOO.widget.MenuItem.prototype = { */ configTarget: function(p_sType, p_aArgs, p_oItem) { - var sTarget = p_aArgs[0]; - var oAnchor = this._oAnchor; + var sTarget = p_aArgs[0], + oAnchor = this._oAnchor; if(sTarget && sTarget.length > 0) { @@ -5221,11 +5258,11 @@ YAHOO.widget.MenuItem.prototype = { */ configEmphasis: function(p_sType, p_aArgs, p_oItem) { - var bEmphasis = p_aArgs[0]; - var oAnchor = this._oAnchor; - var oText = this._oText; - var oConfig = this.cfg; - var oEM; + var bEmphasis = p_aArgs[0], + oAnchor = this._oAnchor, + oText = this._oText, + oConfig = this.cfg, + oEM; if(bEmphasis && oConfig.getProperty("strongemphasis")) { @@ -5249,8 +5286,12 @@ YAHOO.widget.MenuItem.prototype = { oEM = this._getFirstElement(oAnchor, "EM"); - oAnchor.removeChild(oEM); - oAnchor.appendChild(oText); + if(oEM) { + + oAnchor.removeChild(oEM); + oAnchor.appendChild(oText); + + } } @@ -5271,11 +5312,11 @@ YAHOO.widget.MenuItem.prototype = { */ configStrongEmphasis: function(p_sType, p_aArgs, p_oItem) { - var bStrongEmphasis = p_aArgs[0]; - var oAnchor = this._oAnchor; - var oText = this._oText; - var oConfig = this.cfg; - var oStrong; + var bStrongEmphasis = p_aArgs[0], + oAnchor = this._oAnchor, + oText = this._oText, + oConfig = this.cfg, + oStrong; if(bStrongEmphasis && oConfig.getProperty("emphasis")) { @@ -5297,8 +5338,12 @@ YAHOO.widget.MenuItem.prototype = { oStrong = this._getFirstElement(oAnchor, "STRONG"); - oAnchor.removeChild(oStrong); - oAnchor.appendChild(oText); + if(oStrong) { + + oAnchor.removeChild(oStrong); + oAnchor.appendChild(oText); + + } } @@ -5319,10 +5364,10 @@ YAHOO.widget.MenuItem.prototype = { */ configChecked: function(p_sType, p_aArgs, p_oItem) { - var bChecked = p_aArgs[0]; - var oEl = this.element; - var oConfig = this.cfg; - var oImg; + var bChecked = p_aArgs[0], + oEl = this.element, + oConfig = this.cfg, + oImg; if(bChecked) { @@ -5399,14 +5444,14 @@ YAHOO.widget.MenuItem.prototype = { */ configDisabled: function(p_sType, p_aArgs, p_oItem) { - var bDisabled = p_aArgs[0]; - var oAnchor = this._oAnchor; - var aNodes = [this.element, oAnchor]; - var oEM = this._oHelpTextEM; - var oConfig = this.cfg; - var oImg; - var sImgSrc; - var sImgAlt; + var bDisabled = p_aArgs[0], + oAnchor = this._oAnchor, + aNodes = [this.element, oAnchor], + oEM = this._oHelpTextEM, + oConfig = this.cfg, + oImg, + sImgSrc, + sImgAlt; if(oEM) { @@ -5489,11 +5534,11 @@ YAHOO.widget.MenuItem.prototype = { if(!this.cfg.getProperty("disabled")) { - var bSelected = p_aArgs[0]; - var oEM = this._oHelpTextEM; - var aNodes = [this.element, this._oAnchor]; - var oImg = this.submenuIndicator; - var sImgSrc; + var bSelected = p_aArgs[0], + oEM = this._oHelpTextEM, + aNodes = [this.element, this._oAnchor], + oImg = this.submenuIndicator, + sImgSrc; if(oEM) { @@ -5555,13 +5600,13 @@ YAHOO.widget.MenuItem.prototype = { */ configSubmenu: function(p_sType, p_aArgs, p_oItem) { - var oEl = this.element; - var oSubmenu = p_aArgs[0]; - var oImg = this.submenuIndicator; - var oConfig = this.cfg; - var aNodes = [this.element, this._oAnchor]; - var oMenu; - var bLazyLoad = this.parent && this.parent.lazyLoad; + var oEl = this.element, + oSubmenu = p_aArgs[0], + oImg = this.submenuIndicator, + oConfig = this.cfg, + aNodes = [this.element, this._oAnchor], + oMenu, + bLazyLoad = this.parent && this.parent.lazyLoad; if(oSubmenu) { @@ -5579,10 +5624,8 @@ YAHOO.widget.MenuItem.prototype = { !oSubmenu.nodeType ) { - var sSubmenuId = oSubmenu.id; - var oSubmenuConfig = oSubmenu; - - delete oSubmenu["id"]; + var sSubmenuId = oSubmenu.id, + oSubmenuConfig = oSubmenu; oSubmenuConfig.lazyload = bLazyLoad; oSubmenuConfig.parent = this; @@ -5686,8 +5729,8 @@ YAHOO.widget.MenuItem.prototype = { */ initDefaultConfig : function() { - var oConfig = this.cfg; - var CheckBoolean = oConfig.checkBoolean; + var oConfig = this.cfg, + CheckBoolean = oConfig.checkBoolean; // Define the config properties @@ -5889,16 +5932,16 @@ YAHOO.widget.MenuItem.prototype = { * start searching the array. * @return {Object} */ - var getNextArrayItem = function(p_aArray, p_nStartIndex) { + function getNextArrayItem(p_aArray, p_nStartIndex) { return p_aArray[p_nStartIndex] || getNextArrayItem(p_aArray, (p_nStartIndex+1)); - }; + } - var aItemGroups = this.parent.getItemGroups(); - var oNextItem; + var aItemGroups = this.parent.getItemGroups(), + oNextItem; if(this.index < (aItemGroups[nGroupIndex].length - 1)) { @@ -5962,12 +6005,12 @@ YAHOO.widget.MenuItem.prototype = { * start searching the array. * @return {Object} */ - var getPreviousArrayItem = function(p_aArray, p_nStartIndex) { + function getPreviousArrayItem(p_aArray, p_nStartIndex) { return p_aArray[p_nStartIndex] || getPreviousArrayItem(p_aArray, (p_nStartIndex-1)); - }; + } /** @@ -5978,16 +6021,16 @@ YAHOO.widget.MenuItem.prototype = { * start searching the array. * @return {Object} */ - var getFirstItemIndex = function(p_aArray, p_nStartIndex) { + function getFirstItemIndex(p_aArray, p_nStartIndex) { return p_aArray[p_nStartIndex] ? p_nStartIndex : getFirstItemIndex(p_aArray, (p_nStartIndex+1)); - }; + } - var aItemGroups = this.parent.getItemGroups(); - var oPreviousItem; + var aItemGroups = this.parent.getItemGroups(), + oPreviousItem; if( this.index > getFirstItemIndex(aItemGroups[nGroupIndex], 0) @@ -6044,9 +6087,24 @@ YAHOO.widget.MenuItem.prototype = { */ focus: function() { - var oParent = this.parent; - var oAnchor = this._oAnchor; - var oActiveItem = oParent.activeItem; + var oParent = this.parent, + oAnchor = this._oAnchor, + oActiveItem = oParent.activeItem; + + + function setFocus() { + + try { + + oAnchor.focus(); + + } + catch(e) { + + } + + } + if( !this.cfg.getProperty("disabled") && @@ -6061,14 +6119,14 @@ YAHOO.widget.MenuItem.prototype = { } - try { - - oAnchor.focus(); - } - catch(e) { + /* + Setting focus via a timer fixes a race condition in Firefox, IE + and Opera where the browser viewport jumps as it trys to + position and focus the menu. + */ - } + window.setTimeout(setFocus, 0); this.focusEvent.fire(); @@ -6112,6 +6170,18 @@ YAHOO.widget.MenuItem.prototype = { if(oEl) { + + // If the item has a submenu, destroy it first + + var oSubmenu = this.cfg.getProperty("submenu"); + + if(oSubmenu) { + + oSubmenu.destroy(); + + } + + // Remove CustomEvent listeners this.mouseOverEvent.unsubscribeAll(); @@ -6320,9 +6390,9 @@ init: function(p_oElement, p_oConfig) { */ _removeEventHandlers: function() { - var Event = YAHOO.util.Event; - var oTrigger = this._oTrigger; - var bOpera = (this.browser == "opera"); + var Event = YAHOO.util.Event, + oTrigger = this._oTrigger, + bOpera = (this.browser == "opera"); // Remove the event handlers from the trigger(s) @@ -6384,8 +6454,8 @@ _onTriggerContextMenu: function(p_oEvent, p_oMenu) { YAHOO.widget.MenuManager.hideVisible(); - var Event = YAHOO.util.Event; - var oConfig = this.cfg; + var Event = YAHOO.util.Event, + oConfig = this.cfg; if(p_oEvent.type == "mousedown" && !p_oEvent.ctrlKey) { @@ -6398,8 +6468,8 @@ _onTriggerContextMenu: function(p_oEvent, p_oMenu) { // Position and display the context menu - var nX = Event.getPageX(p_oEvent); - var nY = Event.getPageY(p_oEvent); + var nX = Event.getPageX(p_oEvent), + nY = Event.getPageY(p_oEvent); oConfig.applyConfig( { xy:[nX, nY], visible:true } ); @@ -6492,8 +6562,8 @@ destroy: function() { */ configTrigger: function(p_sType, p_aArgs, p_oMenu) { - var Event = YAHOO.util.Event; - var oTrigger = p_aArgs[0]; + var Event = YAHOO.util.Event, + oTrigger = p_aArgs[0]; if(oTrigger) { @@ -6775,132 +6845,122 @@ CSS_CLASS_NAME: "yuimenubar", */ _onKeyDown: function(p_sType, p_aArgs, p_oMenuBar) { - var Event = YAHOO.util.Event; - var oEvent = p_aArgs[0]; - var oItem = p_aArgs[1]; - var oItemCfg = oItem.cfg; - var oSubmenu; + var Event = YAHOO.util.Event, + oEvent = p_aArgs[0], + oItem = p_aArgs[1], + oSubmenu; - switch(oEvent.keyCode) { + if(oItem && !oItem.cfg.getProperty("disabled")) { - case 27: // Esc key + var oItemCfg = oItem.cfg; - if(this.cfg.getProperty("position") == "dynamic") { + switch(oEvent.keyCode) { - this.hide(); + case 37: // Left arrow + case 39: // Right arrow - if(this.parent) { + if( + oItem == this.activeItem && + !oItemCfg.getProperty("selected") + ) { - this.parent.focus(); + oItemCfg.setProperty("selected", true); } + else { - } - else if(this.activeItem) { + var oNextItem = (oEvent.keyCode == 37) ? + oItem.getPreviousEnabledSibling() : + oItem.getNextEnabledSibling(); - oSubmenu = this.activeItem.cfg.getProperty("submenu"); + if(oNextItem) { - if(oSubmenu && oSubmenu.cfg.getProperty("visible")) { + this.clearActiveItem(); - oSubmenu.hide(); - this.activeItem.focus(); + oNextItem.cfg.setProperty("selected", true); - } - else { - this.activeItem.cfg.setProperty("selected", false); - this.activeItem.blur(); + if(this.cfg.getProperty("autosubmenudisplay")) { - } + oSubmenu = oNextItem.cfg.getProperty("submenu"); - } + if(oSubmenu) { + oSubmenu.show(); + oSubmenu.activeItem.blur(); + oSubmenu.activeItem = null; - Event.preventDefault(oEvent); + } - break; + } - case 37: // Left arrow - case 39: // Right arrow + oNextItem.focus(); - if( - oItem == this.activeItem && - !oItemCfg.getProperty("selected") - ) { + } - oItemCfg.setProperty("selected", true); + } - } - else { + Event.preventDefault(oEvent); + + break; - var oNextItem = (oEvent.keyCode == 37) ? - oItem.getPreviousEnabledSibling() : - oItem.getNextEnabledSibling(); + case 40: // Down arrow - if(oNextItem) { + if(this.activeItem != oItem) { this.clearActiveItem(); - oNextItem.cfg.setProperty("selected", true); - + oItemCfg.setProperty("selected", true); + oItem.focus(); - if(this.cfg.getProperty("autosubmenudisplay")) { + } - oSubmenu = oNextItem.cfg.getProperty("submenu"); + oSubmenu = oItemCfg.getProperty("submenu"); - if(oSubmenu) { + if(oSubmenu) { - oSubmenu.show(); - oSubmenu.activeItem.blur(); - oSubmenu.activeItem = null; + if(oSubmenu.cfg.getProperty("visible")) { - } + oSubmenu.setInitialSelection(); + oSubmenu.setInitialFocus(); } + else { - oNextItem.focus(); - - } - - } - - Event.preventDefault(oEvent); - - break; + oSubmenu.show(); - case 40: // Down arrow + } - if(this.activeItem != oItem) { + } - this.clearActiveItem(); + Event.preventDefault(oEvent); - oItemCfg.setProperty("selected", true); - oItem.focus(); + break; - } + } - oSubmenu = oItemCfg.getProperty("submenu"); + } - if(oSubmenu) { - if(oSubmenu.cfg.getProperty("visible")) { + if(oEvent.keyCode == 27 && this.activeItem) { // Esc key - oSubmenu.setInitialSelection(); - oSubmenu.setInitialFocus(); + oSubmenu = this.activeItem.cfg.getProperty("submenu"); - } - else { + if(oSubmenu && oSubmenu.cfg.getProperty("visible")) { - oSubmenu.show(); + oSubmenu.hide(); + this.activeItem.focus(); - } + } + else { - } + this.activeItem.cfg.setProperty("selected", false); + this.activeItem.blur(); - Event.preventDefault(oEvent); + } - break; + Event.preventDefault(oEvent); } @@ -6929,16 +6989,16 @@ _onClick: function(p_sType, p_aArgs, p_oMenuBar) { var oItem = p_aArgs[1]; - if(oItem) { + if(oItem && !oItem.cfg.getProperty("disabled")) { - var Event = YAHOO.util.Event; - var Dom = YAHOO.util.Dom; + var Event = YAHOO.util.Event, + Dom = YAHOO.util.Dom, - var oEvent = p_aArgs[0]; - var oTarget = Event.getTarget(oEvent); + oEvent = p_aArgs[0], + oTarget = Event.getTarget(oEvent), - var oActiveItem = this.activeItem; - var oConfig = this.cfg; + oActiveItem = this.activeItem, + oConfig = this.cfg; // Hide any other submenus that might be visible diff --git a/lib/yui/menu/menu-min.js b/lib/yui/menu/menu-min.js index 479cfd7fd3..b82a960eec 100755 --- a/lib/yui/menu/menu-min.js +++ b/lib/yui/menu/menu-min.js @@ -1 +1,214 @@ -/* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt version: 0.12.0 */ (function(){var _1=YAHOO.util.Dom;var _2=YAHOO.util.Event;YAHOO.widget.MenuManager=new function(){var _3=false;var _4={};var _5={};var _6={};var _7=function(_8){var _9=_1.generateId();if(_8&&_5[_9]!=_8){_8.element.setAttribute("yuiid",_9);_5[_9]=_8;_8.destroyEvent.subscribe(onItemDestroy,_8);}};var _a=function(_b){var _c=_b.element.getAttribute("yuiid");if(_c&&_5[_c]){delete _5[_c];}};var _d=function(_e){var _f;if(_e&&_e.tagName){switch(_e.tagName.toUpperCase()){case "DIV":_f=_e.parentNode;if(_1.hasClass(_e,"bd")&&_f&&_f.tagName&&_f.tagName.toUpperCase()=="DIV"){return _f;}else{return _e;}break;case "LI":return _e;default:_f=_e.parentNode;if(_f){return _d(_f);}break;}}};var _10=function(_11){var _12=_2.getTarget(_11);var _13=_d(_12);var _14;var _15;if(_13){var _16=_13.tagName.toUpperCase();if(_16=="LI"){var _17=_13.getAttribute("yuiid");if(_17){_14=_5[_17];_15=_14.parent;}}else{if(_16=="DIV"){if(_13.id){_15=_4[_13.id];}}}}if(_15){var _18={"click":"clickEvent","mousedown":"mouseDownEvent","mouseup":"mouseUpEvent","mouseover":"mouseOverEvent","mouseout":"mouseOutEvent","keydown":"keyDownEvent","keyup":"keyUpEvent","keypress":"keyPressEvent"};var _19=_18[_11.type];if(_14&&!_14.cfg.getProperty("disabled")){_14[_19].fire(_11);}_15[_19].fire(_11,_14);}else{if(_11.type=="mousedown"){var _1a;for(var i in _4){if(_4.hasOwnProperty(i)){_15=_4[i];if(_15.cfg.getProperty("clicktohide")&&_15.cfg.getProperty("position")=="dynamic"){_15.hide();}else{_15.clearActiveItem(true);}}}}}};var _1c=function(_1d,_1e,_1f){this.removeMenu(_1f);};var _20=function(_21,_22,_23){var _24=_23.element.getAttribute("yuiid");if(_24){delete _5[_24];}};var _25=function(_26,_27,_28){var _29=_27[0];if(_29){_6[_28.id]=_28;}else{if(_6[_28.id]){delete _6[_28.id];}}};var _2a=function(_2b,_2c){_7(_2c[0]);};var _2d=function(_2e,_2f){_a(_2f[0]);};this.addMenu=function(_30){if(_30&&_30.id&&!_4[_30.id]){_4[_30.id]=_30;if(!_3){var _31=document;_2.addListener(_31,"mouseover",_10,this,true);_2.addListener(_31,"mouseout",_10,this,true);_2.addListener(_31,"mousedown",_10,this,true);_2.addListener(_31,"mouseup",_10,this,true);_2.addListener(_31,"click",_10,this,true);_2.addListener(_31,"keydown",_10,this,true);_2.addListener(_31,"keyup",_10,this,true);_2.addListener(_31,"keypress",_10,this,true);_3=true;}_30.destroyEvent.subscribe(_1c,_30,this);_30.cfg.subscribeToConfigEvent("visible",_25,_30);_30.itemAddedEvent.subscribe(_2a);_30.itemRemovedEvent.subscribe(_2d);}};this.removeMenu=function(_32){if(_32&&_4[_32.id]){delete _4[_32.id];}};this.hideVisible=function(){var _33;for(var i in _6){if(_6.hasOwnProperty(i)){_33=_6[i];if(_33.cfg.getProperty("position")=="dynamic"){_33.hide();}}}};this.getMenus=function(){return _4;};this.getMenu=function(_35){if(_4[_35]){return _4[_35];}};this.toString=function(){return ("MenuManager");};};})();(function(){var Dom=YAHOO.util.Dom;var _37=YAHOO.util.Event;YAHOO.widget.Menu=function(_38,_39){if(_39){this.parent=_39.parent;this.lazyLoad=_39.lazyLoad||_39.lazyload;this.itemData=_39.itemData||_39.itemdata;}YAHOO.widget.Menu.superclass.constructor.call(this,_38,_39);};YAHOO.extend(YAHOO.widget.Menu,YAHOO.widget.Overlay,{CSS_CLASS_NAME:"yuimenu",ITEM_TYPE:null,GROUP_TITLE_TAG_NAME:"h6",_nHideDelayId:null,_nShowDelayId:null,_hideDelayEventHandlersAssigned:false,_bHandledMouseOverEvent:false,_bHandledMouseOutEvent:false,_aGroupTitleElements:null,_aItemGroups:null,_aListElements:null,lazyLoad:false,itemData:null,activeItem:null,parent:null,srcElement:null,mouseOverEvent:null,mouseOutEvent:null,mouseDownEvent:null,mouseUpEvent:null,clickEvent:null,keyPressEvent:null,keyDownEvent:null,keyUpEvent:null,itemAddedEvent:null,itemRemovedEvent:null,init:function(_3a,_3b){this._aItemGroups=[];this._aListElements=[];this._aGroupTitleElements=[];if(!this.ITEM_TYPE){this.ITEM_TYPE=YAHOO.widget.MenuItem;}var _3c;if(typeof _3a=="string"){_3c=document.getElementById(_3a);}else{if(_3a.tagName){_3c=_3a;}}if(_3c&&_3c.tagName){switch(_3c.tagName.toUpperCase()){case "DIV":this.srcElement=_3c;if(!_3c.id){_3c.setAttribute("id",Dom.generateId());}YAHOO.widget.Menu.superclass.init.call(this,_3c);this.beforeInitEvent.fire(YAHOO.widget.Menu);break;case "SELECT":this.srcElement=_3c;YAHOO.widget.Menu.superclass.init.call(this,Dom.generateId());this.beforeInitEvent.fire(YAHOO.widget.Menu);break;}}else{YAHOO.widget.Menu.superclass.init.call(this,_3a);this.beforeInitEvent.fire(YAHOO.widget.Menu);}if(this.element){var oEl=this.element;Dom.addClass(oEl,this.CSS_CLASS_NAME);this.initEvent.subscribe(this._onInit,this,true);this.beforeRenderEvent.subscribe(this._onBeforeRender,this,true);this.renderEvent.subscribe(this._onRender,this,true);this.beforeShowEvent.subscribe(this._onBeforeShow,this,true);this.showEvent.subscribe(this._onShow,this,true);this.beforeHideEvent.subscribe(this._onBeforeHide,this,true);this.mouseOverEvent.subscribe(this._onMouseOver,this,true);this.mouseOutEvent.subscribe(this._onMouseOut,this,true);this.clickEvent.subscribe(this._onClick,this,true);this.keyDownEvent.subscribe(this._onKeyDown,this,true);if(_3b){this.cfg.applyConfig(_3b,true);}YAHOO.widget.MenuManager.addMenu(this);this.initEvent.fire(YAHOO.widget.Menu);}},_initSubTree:function(){var _3e;if(this.srcElement.tagName=="DIV"){_3e=this.body.firstChild;var _3f=0;var _40=this.GROUP_TITLE_TAG_NAME.toUpperCase();do{if(_3e&&_3e.tagName){switch(_3e.tagName.toUpperCase()){case _40:this._aGroupTitleElements[_3f]=_3e;break;case "UL":this._aListElements[_3f]=_3e;this._aItemGroups[_3f]=[];_3f++;break;}}}while((_3e=_3e.nextSibling));if(this._aListElements[0]){Dom.addClass(this._aListElements[0],"first-of-type");}}_3e=null;if(this.srcElement.tagName){switch(this.srcElement.tagName.toUpperCase()){case "DIV":if(this._aListElements.length>0){var i=this._aListElements.length-1;do{_3e=this._aListElements[i].firstChild;do{if(_3e&&_3e.tagName){switch(_3e.tagName.toUpperCase()){case "LI":this.addItem(new this.ITEM_TYPE(_3e,{parent:this}),i);break;}}}while((_3e=_3e.nextSibling));}while(i--);}break;case "SELECT":_3e=this.srcElement.firstChild;do{if(_3e&&_3e.tagName){switch(_3e.tagName.toUpperCase()){case "OPTGROUP":case "OPTION":this.addItem(new this.ITEM_TYPE(_3e,{parent:this}));break;}}}while((_3e=_3e.nextSibling));break;}}},_getFirstEnabledItem:function(){var _42=this._aItemGroups.length;var _43;var _44;for(var i=0;i<_42;i++){_44=this._aItemGroups[i];if(_44){var _46=_44.length;for(var n=0;n<_46;n++){_43=_44[n];if(!_43.cfg.getProperty("disabled")&&_43.element.style.display!="none"){return _43;}_43=null;}}}},_checkPosition:function(_48){if(typeof _48=="string"){var _49=_48.toLowerCase();return ("dynamic,static".indexOf(_49)!=-1);}},_addItemToGroup:function(_4a,_4b,_4c){var _4d;if(_4b instanceof this.ITEM_TYPE){_4d=_4b;_4d.parent=this;}else{if(typeof _4b=="string"){_4d=new this.ITEM_TYPE(_4b,{parent:this});}else{if(typeof _4b=="object"&&_4b.text){var _4e=_4b.text;delete _4b["text"];_4b.parent=this;_4d=new this.ITEM_TYPE(_4e,_4b);}}}if(_4d){var _4f=typeof _4a=="number"?_4a:0;var _50=this._getItemGroup(_4f);var _51;if(!_50){_50=this._createItemGroup(_4f);}if(typeof _4c=="number"){var _52=(_4c>=_50.length);if(_50[_4c]){_50.splice(_4c,0,_4d);}else{_50[_4c]=_4d;}_51=_50[_4c];if(_51){if(_52&&(!_51.element.parentNode||_51.element.parentNode.nodeType==11)){this._aListElements[_4f].appendChild(_51.element);}else{var _53=function(_54,_55){return (_54[_55]||_53(_54,(_55+1)));};var _56=_53(_50,(_4c+1));if(_56&&(!_51.element.parentNode||_51.element.parentNode.nodeType==11)){this._aListElements[_4f].insertBefore(_51.element,_56.element);}}_51.parent=this;this._subscribeToItemEvents(_51);this._configureSubmenu(_51);this._updateItemProperties(_4f);this.itemAddedEvent.fire(_51);return _51;}}else{var _57=_50.length;_50[_57]=_4d;_51=_50[_57];if(_51){if(!Dom.isAncestor(this._aListElements[_4f],_51.element)){this._aListElements[_4f].appendChild(_51.element);}_51.element.setAttribute("groupindex",_4f);_51.element.setAttribute("index",_57);_51.parent=this;_51.index=_57;_51.groupIndex=_4f;this._subscribeToItemEvents(_51);this._configureSubmenu(_51);if(_57===0){Dom.addClass(_51.element,"first-of-type");}this.itemAddedEvent.fire(_51);return _51;}}}},_removeItemFromGroupByIndex:function(_58,_59){var _5a=typeof _58=="number"?_58:0;var _5b=this._getItemGroup(_5a);if(_5b){var _5c=_5b.splice(_59,1);var _5d=_5c[0];if(_5d){this._updateItemProperties(_5a);if(_5b.length===0){var oUL=this._aListElements[_5a];if(this.body&&oUL){this.body.removeChild(oUL);}this._aItemGroups.splice(_5a,1);this._aListElements.splice(_5a,1);oUL=this._aListElements[0];if(oUL){Dom.addClass(oUL,"first-of-type");}}this.itemRemovedEvent.fire(_5d);return _5d;}}},_removeItemFromGroupByValue:function(_5f,_60){var _61=this._getItemGroup(_5f);if(_61){var _62=_61.length;var _63=-1;if(_62>0){var i=_62-1;do{if(_61[i]==_60){_63=i;break;}}while(i--);if(_63>-1){return this._removeItemFromGroupByIndex(_5f,_63);}}}},_updateItemProperties:function(_65){var _66=this._getItemGroup(_65);var _67=_66.length;if(_67>0){var i=_67-1;var _69;var oLI;do{_69=_66[i];if(_69){oLI=_69.element;_69.index=i;_69.groupIndex=_65;oLI.setAttribute("groupindex",_65);oLI.setAttribute("index",i);Dom.removeClass(oLI,"first-of-type");}}while(i--);if(oLI){Dom.addClass(oLI,"first-of-type");}}},_createItemGroup:function(_6b){if(!this._aItemGroups[_6b]){this._aItemGroups[_6b]=[];var oUL=document.createElement("ul");this._aListElements[_6b]=oUL;return this._aItemGroups[_6b];}},_getItemGroup:function(_6d){var _6e=((typeof _6d=="number")?_6d:0);return this._aItemGroups[_6e];},_configureSubmenu:function(_6f){var _70=_6f.cfg.getProperty("submenu");if(_70){this.cfg.configChangedEvent.subscribe(this._onParentMenuConfigChange,_70,true);this.renderEvent.subscribe(this._onParentMenuRender,_70,true);_70.beforeShowEvent.subscribe(this._onSubmenuBeforeShow,_70,true);_70.showEvent.subscribe(this._onSubmenuShow,_70,true);_70.hideEvent.subscribe(this._onSubmenuHide,_70,true);}},_subscribeToItemEvents:function(_71){_71.focusEvent.subscribe(this._onMenuItemFocus,_71,this);_71.blurEvent.subscribe(this._onMenuItemBlur,this,true);_71.cfg.configChangedEvent.subscribe(this._onMenuItemConfigChange,_71,this);},_getOffsetWidth:function(){var _72=this.element.cloneNode(true);Dom.setStyle(_72,"width","");document.body.appendChild(_72);var _73=_72.offsetWidth;document.body.removeChild(_72);return _73;},_cancelHideDelay:function(){var _74=this.getRoot();if(_74._nHideDelayId){window.clearTimeout(_74._nHideDelayId);}},_execHideDelay:function(){this._cancelHideDelay();var _75=this.getRoot();var me=this;var _77=function(){if(_75.activeItem){_75.clearActiveItem();}if(_75==me&&me.cfg.getProperty("position")=="dynamic"){me.hide();}};_75._nHideDelayId=window.setTimeout(_77,_75.cfg.getProperty("hidedelay"));},_cancelShowDelay:function(){var _78=this.getRoot();if(_78._nShowDelayId){window.clearTimeout(_78._nShowDelayId);}},_execShowDelay:function(_79){this._cancelShowDelay();var _7a=this.getRoot();var _7b=function(){_79.show();};_7a._nShowDelayId=window.setTimeout(_7b,_7a.cfg.getProperty("showdelay"));},_onMouseOver:function(_7c,_7d,_7e){var _7f=_7d[0];var _80=_7d[1];var _81=_37.getTarget(_7f);if(!this._bHandledMouseOverEvent&&(_81==this.element||Dom.isAncestor(this.element,_81))){this.clearActiveItem();this._bHandledMouseOverEvent=true;this._bHandledMouseOutEvent=false;}if(_80&&!_80.handledMouseOverEvent&&(_81==_80.element||Dom.isAncestor(_80.element,_81))){var _82=_80.cfg;_82.setProperty("selected",true);_80.focus();if(this.cfg.getProperty("autosubmenudisplay")){var _83=_82.getProperty("submenu");if(_83){if(this.cfg.getProperty("showdelay")>0){this._execShowDelay(_83);}else{_83.show();}}}_80.handledMouseOverEvent=true;_80.handledMouseOutEvent=false;}},_onMouseOut:function(_84,_85,_86){var _87=_85[0];var _88=_85[1];var _89=_37.getRelatedTarget(_87);var _8a=false;if(_88){var _8b=_88.cfg;var _8c=_8b.getProperty("submenu");if(_8c&&(_89==_8c.element||Dom.isAncestor(_8c.element,_89))){_8a=true;}if(!_88.handledMouseOutEvent&&((_89!=_88.element&&!Dom.isAncestor(_88.element,_89))||_8a)){if(this.cfg.getProperty("showdelay")>0){this._cancelShowDelay();}if(!_8a){_8b.setProperty("selected",false);}if(this.cfg.getProperty("autosubmenudisplay")){if(_8c){if(!(_89==_8c.element||YAHOO.util.Dom.isAncestor(_8c.element,_89))){_8c.hide();}}}_88.handledMouseOutEvent=true;_88.handledMouseOverEvent=false;}}if(!this._bHandledMouseOutEvent&&((_89!=this.element&&!Dom.isAncestor(this.element,_89))||_8a)){this._bHandledMouseOutEvent=true;this._bHandledMouseOverEvent=false;}},_onClick:function(_8d,_8e,_8f){var _90=_8e[0];var _91=_8e[1];var _92=_37.getTarget(_90);if(_91){var _93=_91.cfg;var _94=_93.getProperty("submenu");if(_92==_91.submenuIndicator&&_94){if(_94.cfg.getProperty("visible")){_94.hide();}else{this.clearActiveItem();this.activeItem=_91;_91.cfg.setProperty("selected",true);_94.show();}}else{var _95=_93.getProperty("url");var _96=(_95.substr((_95.length-1),1)=="#");var _97=_93.getProperty("target");var _98=(_97&&_97.length>0);if(_92.tagName.toUpperCase()=="A"&&_96&&!_98){_37.preventDefault(_90);}if(_92.tagName.toUpperCase()!="A"&&!_96&&!_98){document.location=_95;}if(_96&&!_94){var _99=this.getRoot();if(_99.cfg.getProperty("position")=="static"){_99.clearActiveItem();}else{_99.hide();}}}}},_onKeyDown:function(_9a,_9b,_9c){var _9d=_9b[0];var _9e=_9b[1];var _9f;if(_9e){var _a0=_9e.cfg;var _a1=this.parent;var _a2;var _a3;switch(_9d.keyCode){case 38:case 40:if(_9e==this.activeItem&&!_a0.getProperty("selected")){_a0.setProperty("selected",true);}else{_a3=(_9d.keyCode==38)?_9e.getPreviousEnabledSibling():_9e.getNextEnabledSibling();if(_a3){this.clearActiveItem();_a3.cfg.setProperty("selected",true);_a3.focus();}}_37.preventDefault(_9d);break;case 39:_9f=_a0.getProperty("submenu");if(_9f){if(!_a0.getProperty("selected")){_a0.setProperty("selected",true);}_9f.show();_9f.setInitialSelection();}else{_a2=this.getRoot();if(_a2 instanceof YAHOO.widget.MenuBar){_a3=_a2.activeItem.getNextEnabledSibling();if(_a3){_a2.clearActiveItem();_a3.cfg.setProperty("selected",true);_9f=_a3.cfg.getProperty("submenu");if(_9f){_9f.show();}_a3.focus();}}}_37.preventDefault(_9d);break;case 37:if(_a1){var _a4=_a1.parent;if(_a4 instanceof YAHOO.widget.MenuBar){_a3=_a4.activeItem.getPreviousEnabledSibling();if(_a3){_a4.clearActiveItem();_a3.cfg.setProperty("selected",true);_9f=_a3.cfg.getProperty("submenu");if(_9f){_9f.show();}_a3.focus();}}else{this.hide();_a1.focus();}}_37.preventDefault(_9d);break;}}if(_9d.keyCode==27){if(this.cfg.getProperty("position")=="dynamic"){this.hide();if(this.parent){this.parent.focus();}}else{if(this.activeItem){_9f=this.activeItem.cfg.getProperty("submenu");if(_9f&&_9f.cfg.getProperty("visible")){_9f.hide();this.activeItem.focus();}else{this.activeItem.cfg.setProperty("selected",false);this.activeItem.blur();}}}_37.preventDefault(_9d);}},_onInit:function(_a5,_a6,_a7){if(((this.parent&&!this.lazyLoad)||(!this.parent&&this.cfg.getProperty("position")=="static")||(!this.parent&&!this.lazyLoad&&this.cfg.getProperty("position")=="dynamic"))&&this.getItemGroups().length===0){if(this.srcElement){this._initSubTree();}if(this.itemData){this.addItems(this.itemData);}}else{if(this.lazyLoad){this.cfg.fireQueue();}}},_onBeforeRender:function(_a8,_a9,_aa){var _ab=this.cfg;var oEl=this.element;var _ad=this._aListElements.length;if(_ad>0){var i=0;var _af=true;var oUL;var _b1;do{oUL=this._aListElements[i];if(oUL){if(_af){Dom.addClass(oUL,"first-of-type");_af=false;}if(!Dom.isAncestor(oEl,oUL)){this.appendToBody(oUL);}_b1=this._aGroupTitleElements[i];if(_b1){if(!Dom.isAncestor(oEl,_b1)){oUL.parentNode.insertBefore(_b1,oUL);}Dom.addClass(oUL,"hastitle");}}i++;}while(i<_ad);}},_onRender:function(_b2,_b3,_b4){if(this.cfg.getProperty("position")=="dynamic"){var _b5=this.element.parentNode.tagName.toUpperCase()=="BODY"?this.element.offsetWidth:this._getOffsetWidth();this.cfg.setProperty("width",(_b5+"px"));}},_onBeforeShow:function(_b6,_b7,_b8){if(this.lazyLoad&&this.getItemGroups().length===0){if(this.srcElement){this._initSubTree();}if(this.itemData){if(this.parent&&this.parent.parent&&this.parent.parent.srcElement&&this.parent.parent.srcElement.tagName.toUpperCase()=="SELECT"){var _b9=this.itemData.length;for(var n=0;n<_b9;n++){if(this.itemData[n].tagName){this.addItem((new this.ITEM_TYPE(this.itemData[n])));}}}else{this.addItems(this.itemData);}}if(this.srcElement){this.render();}else{if(this.parent){this.render(this.parent.element);}else{this.render(this.cfg.getProperty("container"));}}}},_onShow:function(_bb,_bc,_bd){this.setInitialFocus();var _be=this.parent;if(_be){var _bf=_be.parent;var _c0=_bf.cfg.getProperty("submenualignment");var _c1=this.cfg.getProperty("submenualignment");if((_c0[0]!=_c1[0])&&(_c0[1]!=_c1[1])){this.cfg.setProperty("submenualignment",[_c0[0],_c0[1]]);}if(!_bf.cfg.getProperty("autosubmenudisplay")&&_bf.cfg.getProperty("position")=="static"){_bf.cfg.setProperty("autosubmenudisplay",true);var _c2=function(_c3){if(_c3.type=="mousedown"||(_c3.type=="keydown"&&_c3.keyCode==27)){var _c4=_37.getTarget(_c3);if(_c4!=_bf.element||!YAHOO.util.Dom.isAncestor(_bf.element,_c4)){_bf.cfg.setProperty("autosubmenudisplay",false);_37.removeListener(document,"mousedown",_c2);_37.removeListener(document,"keydown",_c2);}}};_37.addListener(document,"mousedown",_c2);_37.addListener(document,"keydown",_c2);}}},_onBeforeHide:function(_c5,_c6,_c7){this.clearActiveItem(true);},_onParentMenuConfigChange:function(_c8,_c9,_ca){var _cb=_c9[0][0];var _cc=_c9[0][1];switch(_cb){case "iframe":case "constraintoviewport":case "hidedelay":case "showdelay":case "clicktohide":case "effect":_ca.cfg.setProperty(_cb,_cc);break;}},_onParentMenuRender:function(_cd,_ce,_cf){var _d0=_cf.parent.parent;var _d1={constraintoviewport:_d0.cfg.getProperty("constraintoviewport"),xy:[0,0],clicktohide:_d0.cfg.getProperty("clicktohide"),effect:_d0.cfg.getProperty("effect")};var _d2=_d0.cfg.getProperty("showdelay");if(_d2>0){_d1.showdelay=_d2;}var _d3=_d0.cfg.getProperty("hidedelay");if(_d3>0){_d1.hidedelay=_d3;}if(this.cfg.getProperty("position")==_d0.cfg.getProperty("position")){_d1.iframe=_d0.cfg.getProperty("iframe");}_cf.cfg.applyConfig(_d1);if(!this.lazyLoad){if(Dom.inDocument(this.element)){this.render();}else{this.render(this.parent.element);}}},_onSubmenuBeforeShow:function(_d4,_d5,_d6){var _d7=this.parent;var _d8=_d7.parent.cfg.getProperty("submenualignment");this.cfg.setProperty("context",[_d7.element,_d8[0],_d8[1]]);_d7.submenuIndicator.alt=_d7.EXPANDED_SUBMENU_INDICATOR_ALT_TEXT;},_onSubmenuShow:function(_d9,_da,_db){var _dc=this.parent;_dc.submenuIndicator.alt=_dc.EXPANDED_SUBMENU_INDICATOR_ALT_TEXT;},_onSubmenuHide:function(_dd,_de,_df){var _e0=this.parent;_e0.submenuIndicator.alt=_e0.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT;},_onMenuItemFocus:function(_e1,_e2,_e3){this.activeItem=_e3;},_onMenuItemBlur:function(_e4,_e5){this.activeItem=null;},_onMenuItemConfigChange:function(_e6,_e7,_e8){var _e9=_e7[0][0];switch(_e9){case "submenu":var _ea=_e7[0][1];if(_ea){this._configureSubmenu(_e8);}break;case "text":case "helptext":if(this.element.style.width){var _eb=this._getOffsetWidth()+"px";Dom.setStyle(this.element,"width",_eb);}break;}},enforceConstraints:function(_ec,_ed,obj){var _ef=this.cfg;var pos=_ed[0];var x=pos[0];var y=pos[1];var bod=document.getElementsByTagName("body")[0];var htm=document.getElementsByTagName("html")[0];var _f5=Dom.getStyle(bod,"overflow");var _f6=Dom.getStyle(htm,"overflow");var _f7=this.element.offsetHeight;var _f8=this.element.offsetWidth;var _f9=Dom.getClientWidth();var _fa=Dom.getClientHeight();var _fb=window.scrollX||document.body.scrollLeft;var _fc=window.scrollY||document.body.scrollTop;var _fd=_fc+10;var _fe=_fb+10;var _ff=_fc+_fa-_f7-10;var _100=_fb+_f9-_f8-10;var _101=_ef.getProperty("context");var _102=_101?_101[0]:null;if(x<10){x=_fe;}else{if((x+_f8)>_f9){if(_102&&((x-_102.offsetWidth)>_f8)){x=(x-(_102.offsetWidth+_f8));}else{x=_100;}}}if(y<10){y=_fd;}else{if(y>_ff){if(_102&&(y>_f7)){y=((y+_102.offsetHeight)-_f7);}else{y=_ff;}}}_ef.setProperty("x",x,true);_ef.setProperty("y",y,true);},configVisible:function(_103,_104,_105){if(this.cfg.getProperty("position")=="dynamic"){YAHOO.widget.Menu.superclass.configVisible.call(this,_103,_104,_105);}else{var _106=_104[0];var _107=Dom.getStyle(this.element,"display");if(_106){if(_107!="block"){this.beforeShowEvent.fire();Dom.setStyle(this.element,"display","block");this.showEvent.fire();}}else{if(_107=="block"){this.beforeHideEvent.fire();Dom.setStyle(this.element,"display","none");this.hideEvent.fire();}}}},configPosition:function(_108,_109,_10a){var _10b=_109[0]=="static"?"static":"absolute";var oCfg=this.cfg;Dom.setStyle(this.element,"position",_10b);if(_10b=="static"){oCfg.setProperty("iframe",false);Dom.setStyle(this.element,"display","block");oCfg.setProperty("visible",true);}else{Dom.setStyle(this.element,"visibility","hidden");}if(_10b=="absolute"){var _10d=oCfg.getProperty("zindex");if(!_10d||_10d===0){_10d=this.parent?(this.parent.parent.cfg.getProperty("zindex")+1):1;oCfg.setProperty("zindex",_10d);}}},configIframe:function(_10e,_10f,_110){if(this.cfg.getProperty("position")=="dynamic"){YAHOO.widget.Menu.superclass.configIframe.call(this,_10e,_10f,_110);}},configHideDelay:function(_111,_112,_113){var _114=_112[0];var _115=this.mouseOutEvent;var _116=this.mouseOverEvent;var _117=this.keyDownEvent;if(_114>0){if(!this._hideDelayEventHandlersAssigned){_115.subscribe(this._execHideDelay,true);_116.subscribe(this._cancelHideDelay,this,true);_117.subscribe(this._cancelHideDelay,this,true);this._hideDelayEventHandlersAssigned=true;}}else{_115.unsubscribe(this._execHideDelay,this);_116.unsubscribe(this._cancelHideDelay,this);_117.unsubscribe(this._cancelHideDelay,this);this._hideDelayEventHandlersAssigned=false;}},configContainer:function(_118,_119,_11a){var _11b=_119[0];if(typeof _11b=="string"){this.cfg.setProperty("container",document.getElementById(_11b),true);}},onDomResize:function(e,obj){if(!this._handleResize){this._handleResize=true;return;}var _11e=this.cfg;if(_11e.getProperty("position")=="dynamic"){_11e.setProperty("width",(this._getOffsetWidth()+"px"));}YAHOO.widget.Menu.superclass.onDomResize.call(this,e,obj);},initEvents:function(){YAHOO.widget.Menu.superclass.initEvents.call(this);var _11f=YAHOO.util.CustomEvent;this.mouseOverEvent=new _11f("mouseOverEvent",this);this.mouseOutEvent=new _11f("mouseOutEvent",this);this.mouseDownEvent=new _11f("mouseDownEvent",this);this.mouseUpEvent=new _11f("mouseUpEvent",this);this.clickEvent=new _11f("clickEvent",this);this.keyPressEvent=new _11f("keyPressEvent",this);this.keyDownEvent=new _11f("keyDownEvent",this);this.keyUpEvent=new _11f("keyUpEvent",this);this.itemAddedEvent=new _11f("itemAddedEvent",this);this.itemRemovedEvent=new _11f("itemRemovedEvent",this);},getRoot:function(){var _120=this.parent;if(_120){var _121=_120.parent;return _121?_121.getRoot():this;}else{return this;}},toString:function(){return ("Menu "+this.id);},setItemGroupTitle:function(_122,_123){if(typeof _122=="string"&&_122.length>0){var _124=typeof _123=="number"?_123:0;var _125=this._aGroupTitleElements[_124];if(_125){_125.innerHTML=_122;}else{_125=document.createElement(this.GROUP_TITLE_TAG_NAME);_125.innerHTML=_122;this._aGroupTitleElements[_124]=_125;}var i=this._aGroupTitleElements.length-1;var _127;do{if(this._aGroupTitleElements[i]){Dom.removeClass(this._aGroupTitleElements[i],"first-of-type");_127=i;}}while(i--);if(_127!==null){Dom.addClass(this._aGroupTitleElements[_127],"first-of-type");}}},addItem:function(_128,_129){if(_128){return this._addItemToGroup(_129,_128);}},addItems:function(_12a,_12b){function isArray(_12c){return (typeof _12c=="object"&&_12c.constructor==Array);}if(isArray(_12a)){var _12d=_12a.length;var _12e=[];var _12f;for(var i=0;i<_12d;i++){_12f=_12a[i];if(isArray(_12f)){_12e[_12e.length]=this.addItems(_12f,i);}else{_12e[_12e.length]=this._addItemToGroup(_12b,_12f);}}if(_12e.length){return _12e;}}},insertItem:function(_131,_132,_133){if(_131){return this._addItemToGroup(_133,_131,_132);}},removeItem:function(_134,_135){if(typeof _134!="undefined"){var _136;if(_134 instanceof YAHOO.widget.MenuItem){_136=this._removeItemFromGroupByValue(_135,_134);}else{if(typeof _134=="number"){_136=this._removeItemFromGroupByIndex(_135,_134);}}if(_136){_136.destroy();return _136;}}},getItemGroups:function(){return this._aItemGroups;},getItem:function(_137,_138){if(typeof _137=="number"){var _139=this._getItemGroup(_138);if(_139){return _139[_137];}}},destroy:function(){this.mouseOverEvent.unsubscribeAll();this.mouseOutEvent.unsubscribeAll();this.mouseDownEvent.unsubscribeAll();this.mouseUpEvent.unsubscribeAll();this.clickEvent.unsubscribeAll();this.keyPressEvent.unsubscribeAll();this.keyDownEvent.unsubscribeAll();this.keyUpEvent.unsubscribeAll();var _13a=this._aItemGroups.length;var _13b;var _13c;var _13d;var i;var n;if(_13a>0){i=_13a-1;do{_13c=this._aItemGroups[i];if(_13c){_13b=_13c.length;if(_13b>0){n=_13b-1;do{_13d=this._aItemGroups[i][n];if(_13d){_13d.destroy();}}while(n--);}}}while(i--);}YAHOO.widget.Menu.superclass.destroy.call(this);},setInitialFocus:function(){var _140=this._getFirstEnabledItem();if(_140){_140.focus();}},setInitialSelection:function(){var _141=this._getFirstEnabledItem();if(_141){_141.cfg.setProperty("selected",true);}},clearActiveItem:function(_142){if(this.cfg.getProperty("showdelay")>0){this._cancelShowDelay();}var _143=this.activeItem;if(_143){var _144=_143.cfg;_144.setProperty("selected",false);var _145=_144.getProperty("submenu");if(_145){_145.hide();}if(_142){_143.blur();}}},initDefaultConfig:function(){YAHOO.widget.Menu.superclass.initDefaultConfig.call(this);var _146=this.cfg;_146.addProperty("visible",{value:false,handler:this.configVisible,validator:this.cfg.checkBoolean});_146.addProperty("constraintoviewport",{value:true,handler:this.configConstrainToViewport,validator:this.cfg.checkBoolean,supercedes:["iframe","x","y","xy"]});_146.addProperty("position",{value:"dynamic",handler:this.configPosition,validator:this._checkPosition,supercedes:["visible"]});_146.addProperty("submenualignment",{value:["tl","tr"]});_146.addProperty("autosubmenudisplay",{value:true,validator:_146.checkBoolean});_146.addProperty("showdelay",{value:0,validator:_146.checkNumber});_146.addProperty("hidedelay",{value:0,validator:_146.checkNumber,handler:this.configHideDelay,suppressEvent:true});_146.addProperty("clicktohide",{value:true,validator:_146.checkBoolean});this.cfg.addProperty("container",{value:document.body,handler:this.configContainer});}});})();YAHOO.widget.MenuModule=YAHOO.widget.Menu;(function(){var Dom=YAHOO.util.Dom;var _148=YAHOO.widget.Module;var Menu=YAHOO.widget.Menu;YAHOO.widget.MenuItem=function(_14a,_14b){if(_14a){if(_14b){this.parent=_14b.parent;this.value=_14b.value;}this.init(_14a,_14b);}};YAHOO.widget.MenuItem.prototype={SUBMENU_INDICATOR_IMAGE_PATH:"nt/ic/ut/alt1/menuarorght8_nrm_1.gif",SELECTED_SUBMENU_INDICATOR_IMAGE_PATH:"nt/ic/ut/alt1/menuarorght8_hov_1.gif",DISABLED_SUBMENU_INDICATOR_IMAGE_PATH:"nt/ic/ut/alt1/menuarorght8_dim_1.gif",COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT:"Collapsed. Click to expand.",EXPANDED_SUBMENU_INDICATOR_ALT_TEXT:"Expanded. Click to collapse.",DISABLED_SUBMENU_INDICATOR_ALT_TEXT:"Disabled.",CHECKED_IMAGE_PATH:"nt/ic/ut/bsc/menuchk8_nrm_1.gif",SELECTED_CHECKED_IMAGE_PATH:"nt/ic/ut/bsc/menuchk8_hov_1.gif",DISABLED_CHECKED_IMAGE_PATH:"nt/ic/ut/bsc/menuchk8_dim_1.gif",CHECKED_IMAGE_ALT_TEXT:"Checked.",DISABLED_CHECKED_IMAGE_ALT_TEXT:"Checked. (Item disabled.)",CSS_CLASS_NAME:"yuimenuitem",SUBMENU_TYPE:null,IMG_ROOT:"http://us.i1.yimg.com/us.yimg.com/i/",IMG_ROOT_SSL:"https://a248.e.akamai.net/sec.yimg.com/i/",_oAnchor:null,_oText:null,_oHelpTextEM:null,_oSubmenu:null,_checkImage:null,constructor:YAHOO.widget.MenuItem,imageRoot:null,isSecure:_148.prototype.isSecure,index:null,groupIndex:null,parent:null,element:null,srcElement:null,value:null,submenuIndicator:null,browser:_148.prototype.browser,destroyEvent:null,mouseOverEvent:null,mouseOutEvent:null,mouseDownEvent:null,mouseUpEvent:null,clickEvent:null,keyPressEvent:null,keyDownEvent:null,keyUpEvent:null,focusEvent:null,blurEvent:null,init:function(_14c,_14d){this.imageRoot=(this.isSecure)?this.IMG_ROOT_SSL:this.IMG_ROOT;if(!this.SUBMENU_TYPE){this.SUBMENU_TYPE=Menu;}this.cfg=new YAHOO.util.Config(this);this.initDefaultConfig();var _14e=this.cfg;if(this._checkString(_14c)){this._createRootNodeStructure();_14e.setProperty("text",_14c);}else{if(this._checkDOMNode(_14c)){switch(_14c.tagName.toUpperCase()){case "OPTION":this._createRootNodeStructure();_14e.setProperty("text",_14c.text);this.srcElement=_14c;break;case "OPTGROUP":this._createRootNodeStructure();_14e.setProperty("text",_14c.label);this.srcElement=_14c;this._initSubTree();break;case "LI":var _14f=this._getFirstElement(_14c,"A");var sURL="#";var _151=null;var _152=null;if(_14f){sURL=_14f.getAttribute("href");_151=_14f.getAttribute("target");if(_14f.innerText){_152=_14f.innerText;}else{var _153=_14f.ownerDocument.createRange();_153.selectNodeContents(_14f);_152=_153.toString();}}else{var _154=_14c.firstChild;_152=_154.nodeValue;_14f=document.createElement("a");_14f.setAttribute("href",sURL);_14c.replaceChild(_14f,_154);_14f.appendChild(_154);}this.srcElement=_14c;this.element=_14c;this._oAnchor=_14f;var _155=this._getFirstElement(_14f);var _156=false;var _157=false;if(_155){this._oText=_155.firstChild;switch(_155.tagName.toUpperCase()){case "EM":_156=true;break;case "STRONG":_157=true;break;}}else{this._oText=_14f.firstChild;}_14e.setProperty("text",_152,true);_14e.setProperty("url",sURL,true);_14e.setProperty("target",_151,true);_14e.setProperty("emphasis",_156,true);_14e.setProperty("strongemphasis",_157,true);this._initSubTree();break;}}}if(this.element){Dom.addClass(this.element,this.CSS_CLASS_NAME);var _158=YAHOO.util.CustomEvent;this.destroyEvent=new _158("destroyEvent",this);this.mouseOverEvent=new _158("mouseOverEvent",this);this.mouseOutEvent=new _158("mouseOutEvent",this);this.mouseDownEvent=new _158("mouseDownEvent",this);this.mouseUpEvent=new _158("mouseUpEvent",this);this.clickEvent=new _158("clickEvent",this);this.keyPressEvent=new _158("keyPressEvent",this);this.keyDownEvent=new _158("keyDownEvent",this);this.keyUpEvent=new _158("keyUpEvent",this);this.focusEvent=new _158("focusEvent",this);this.blurEvent=new _158("blurEvent",this);if(_14d){_14e.applyConfig(_14d);}_14e.fireQueue();}},_getFirstElement:function(_159,_15a){var _15b;if(_159.firstChild&&_159.firstChild.nodeType==1){_15b=_159.firstChild;}else{if(_159.firstChild&&_159.firstChild.nextSibling&&_159.firstChild.nextSibling.nodeType==1){_15b=_159.firstChild.nextSibling;}}if(_15a){return (_15b&&_15b.tagName.toUpperCase()==_15a)?_15b:false;}return _15b;},_checkString:function(_15c){return (typeof _15c=="string");},_checkDOMNode:function(_15d){return (_15d&&_15d.tagName);},_createRootNodeStructure:function(){this.element=document.createElement("li");this._oText=document.createTextNode("");this._oAnchor=document.createElement("a");this._oAnchor.appendChild(this._oText);this.cfg.refireEvent("url");this.element.appendChild(this._oAnchor);},_initSubTree:function(){var _15e=this.srcElement;var _15f=this.cfg;if(_15e.childNodes.length>0){if(this.parent.lazyLoad&&this.parent.srcElement&&this.parent.srcElement.tagName.toUpperCase()=="SELECT"){_15f.setProperty("submenu",{id:Dom.generateId(),itemdata:_15e.childNodes});}else{var _160=_15e.firstChild;var _161=[];do{if(_160&&_160.tagName){switch(_160.tagName.toUpperCase()){case "DIV":_15f.setProperty("submenu",_160);break;case "OPTION":_161[_161.length]=_160;break;}}}while((_160=_160.nextSibling));var _162=_161.length;if(_162>0){var _163=new this.SUBMENU_TYPE(Dom.generateId());_15f.setProperty("submenu",_163);for(var n=0;n<_162;n++){_163.addItem((new _163.ITEM_TYPE(_161[n])));}}}}},_preloadImage:function(_165){var _166=this.imageRoot+_165;if(!document.images[_166]){var _167=document.createElement("img");_167.src=_166;_167.name=_166;_167.id=_166;_167.style.display="none";document.body.appendChild(_167);}},configText:function(_168,_169,_16a){var _16b=_169[0];if(this._oText){this._oText.nodeValue=_16b;}},configHelpText:function(_16c,_16d,_16e){var me=this;var _170=_16d[0];var oEl=this.element;var _172=this.cfg;var _173=[oEl,this._oAnchor];var oImg=this.submenuIndicator;var _175=function(){Dom.addClass(_173,"hashelptext");if(_172.getProperty("disabled")){_172.refireEvent("disabled");}if(_172.getProperty("selected")){_172.refireEvent("selected");}};var _176=function(){Dom.removeClass(_173,"hashelptext");oEl.removeChild(me._oHelpTextEM);me._oHelpTextEM=null;};if(this._checkDOMNode(_170)){if(this._oHelpTextEM){this._oHelpTextEM.parentNode.replaceChild(_170,this._oHelpTextEM);}else{this._oHelpTextEM=_170;oEl.insertBefore(this._oHelpTextEM,oImg);}_175();}else{if(this._checkString(_170)){if(_170.length===0){_176();}else{if(!this._oHelpTextEM){this._oHelpTextEM=document.createElement("em");oEl.insertBefore(this._oHelpTextEM,oImg);}this._oHelpTextEM.innerHTML=_170;_175();}}else{if(!_170&&this._oHelpTextEM){_176();}}}},configURL:function(_177,_178,_179){var sURL=_178[0];if(!sURL){sURL="#";}this._oAnchor.setAttribute("href",sURL);},configTarget:function(_17b,_17c,_17d){var _17e=_17c[0];var _17f=this._oAnchor;if(_17e&&_17e.length>0){_17f.setAttribute("target",_17e);}else{_17f.removeAttribute("target");}},configEmphasis:function(_180,_181,_182){var _183=_181[0];var _184=this._oAnchor;var _185=this._oText;var _186=this.cfg;var oEM;if(_183&&_186.getProperty("strongemphasis")){_186.setProperty("strongemphasis",false);}if(_184){if(_183){oEM=document.createElement("em");oEM.appendChild(_185);_184.appendChild(oEM);}else{oEM=this._getFirstElement(_184,"EM");_184.removeChild(oEM);_184.appendChild(_185);}}},configStrongEmphasis:function(_188,_189,_18a){var _18b=_189[0];var _18c=this._oAnchor;var _18d=this._oText;var _18e=this.cfg;var _18f;if(_18b&&_18e.getProperty("emphasis")){_18e.setProperty("emphasis",false);}if(_18c){if(_18b){_18f=document.createElement("strong");_18f.appendChild(_18d);_18c.appendChild(_18f);}else{_18f=this._getFirstElement(_18c,"STRONG");_18c.removeChild(_18f);_18c.appendChild(_18d);}}},configChecked:function(_190,_191,_192){var _193=_191[0];var oEl=this.element;var _195=this.cfg;var oImg;if(_193){this._preloadImage(this.CHECKED_IMAGE_PATH);this._preloadImage(this.SELECTED_CHECKED_IMAGE_PATH);this._preloadImage(this.DISABLED_CHECKED_IMAGE_PATH);oImg=document.createElement("img");oImg.src=(this.imageRoot+this.CHECKED_IMAGE_PATH);oImg.alt=this.CHECKED_IMAGE_ALT_TEXT;var _197=this.cfg.getProperty("submenu");if(_197){oEl.insertBefore(oImg,_197.element);}else{oEl.appendChild(oImg);}Dom.addClass([oEl,oImg],"checked");this._checkImage=oImg;if(_195.getProperty("disabled")){_195.refireEvent("disabled");}if(_195.getProperty("selected")){_195.refireEvent("selected");}}else{oImg=this._checkImage;Dom.removeClass([oEl,oImg],"checked");if(oImg){oEl.removeChild(oImg);}this._checkImage=null;}},configDisabled:function(_198,_199,_19a){var _19b=_199[0];var _19c=this._oAnchor;var _19d=[this.element,_19c];var oEM=this._oHelpTextEM;var _19f=this.cfg;var oImg;var _1a1;var _1a2;if(oEM){_19d[2]=oEM;}if(this.cfg.getProperty("checked")){_1a2=this.CHECKED_IMAGE_ALT_TEXT;_1a1=this.CHECKED_IMAGE_PATH;oImg=this._checkImage;if(_19b){_1a2=this.DISABLED_CHECKED_IMAGE_ALT_TEXT;_1a1=this.DISABLED_CHECKED_IMAGE_PATH;}oImg.src=document.images[(this.imageRoot+_1a1)].src;oImg.alt=_1a2;}oImg=this.submenuIndicator;if(_19b){if(_19f.getProperty("selected")){_19f.setProperty("selected",false);}_19c.removeAttribute("href");Dom.addClass(_19d,"disabled");_1a1=this.DISABLED_SUBMENU_INDICATOR_IMAGE_PATH;_1a2=this.DISABLED_SUBMENU_INDICATOR_ALT_TEXT;}else{_19c.setAttribute("href",_19f.getProperty("url"));Dom.removeClass(_19d,"disabled");_1a1=this.SUBMENU_INDICATOR_IMAGE_PATH;_1a2=this.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT;}if(oImg){oImg.src=this.imageRoot+_1a1;oImg.alt=_1a2;}},configSelected:function(_1a3,_1a4,_1a5){if(!this.cfg.getProperty("disabled")){var _1a6=_1a4[0];var oEM=this._oHelpTextEM;var _1a8=[this.element,this._oAnchor];var oImg=this.submenuIndicator;var _1aa;if(oEM){_1a8[_1a8.length]=oEM;}if(oImg){_1a8[_1a8.length]=oImg;}if(this.cfg.getProperty("checked")){_1aa=this.imageRoot+(_1a6?this.SELECTED_CHECKED_IMAGE_PATH:this.CHECKED_IMAGE_PATH);this._checkImage.src=document.images[_1aa].src;}if(_1a6){Dom.addClass(_1a8,"selected");_1aa=this.SELECTED_SUBMENU_INDICATOR_IMAGE_PATH;}else{Dom.removeClass(_1a8,"selected");_1aa=this.SUBMENU_INDICATOR_IMAGE_PATH;}if(oImg){oImg.src=document.images[(this.imageRoot+_1aa)].src;}}},configSubmenu:function(_1ab,_1ac,_1ad){var oEl=this.element;var _1af=_1ac[0];var oImg=this.submenuIndicator;var _1b1=this.cfg;var _1b2=[this.element,this._oAnchor];var _1b3;var _1b4=this.parent&&this.parent.lazyLoad;if(_1af){if(_1af instanceof Menu){_1b3=_1af;_1b3.parent=this;_1b3.lazyLoad=_1b4;}else{if(typeof _1af=="object"&&_1af.id&&!_1af.nodeType){var _1b5=_1af.id;var _1b6=_1af;delete _1af["id"];_1b6.lazyload=_1b4;_1b6.parent=this;_1b3=new this.SUBMENU_TYPE(_1b5,_1b6);this.cfg.setProperty("submenu",_1b3,true);}else{_1b3=new this.SUBMENU_TYPE(_1af,{lazyload:_1b4,parent:this});this.cfg.setProperty("submenu",_1b3,true);}}if(_1b3){this._oSubmenu=_1b3;if(!oImg){this._preloadImage(this.SUBMENU_INDICATOR_IMAGE_PATH);this._preloadImage(this.SELECTED_SUBMENU_INDICATOR_IMAGE_PATH);this._preloadImage(this.DISABLED_SUBMENU_INDICATOR_IMAGE_PATH);oImg=document.createElement("img");oImg.src=(this.imageRoot+this.SUBMENU_INDICATOR_IMAGE_PATH);oImg.alt=this.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT;oEl.appendChild(oImg);this.submenuIndicator=oImg;Dom.addClass(_1b2,"hassubmenu");if(_1b1.getProperty("disabled")){_1b1.refireEvent("disabled");}if(_1b1.getProperty("selected")){_1b1.refireEvent("selected");}}}}else{Dom.removeClass(_1b2,"hassubmenu");if(oImg){oEl.removeChild(oImg);}if(this._oSubmenu){this._oSubmenu.destroy();}}},initDefaultConfig:function(){var _1b7=this.cfg;var _1b8=_1b7.checkBoolean;_1b7.addProperty("text",{value:"",handler:this.configText,validator:this._checkString,suppressEvent:true});_1b7.addProperty("helptext",{handler:this.configHelpText});_1b7.addProperty("url",{value:"#",handler:this.configURL,suppressEvent:true});_1b7.addProperty("target",{handler:this.configTarget,suppressEvent:true});_1b7.addProperty("emphasis",{value:false,handler:this.configEmphasis,validator:_1b8,suppressEvent:true});_1b7.addProperty("strongemphasis",{value:false,handler:this.configStrongEmphasis,validator:_1b8,suppressEvent:true});_1b7.addProperty("checked",{value:false,handler:this.configChecked,validator:this.cfg.checkBoolean,suppressEvent:true,supercedes:["disabled"]});_1b7.addProperty("disabled",{value:false,handler:this.configDisabled,validator:_1b8,suppressEvent:true});_1b7.addProperty("selected",{value:false,handler:this.configSelected,validator:_1b8,suppressEvent:true});_1b7.addProperty("submenu",{handler:this.configSubmenu});},getNextEnabledSibling:function(){if(this.parent instanceof Menu){var _1b9=this.groupIndex;var _1ba=function(_1bb,_1bc){return _1bb[_1bc]||_1ba(_1bb,(_1bc+1));};var _1bd=this.parent.getItemGroups();var _1be;if(this.index<(_1bd[_1b9].length-1)){_1be=_1ba(_1bd[_1b9],(this.index+1));}else{var _1bf;if(_1b9<(_1bd.length-1)){_1bf=_1b9+1;}else{_1bf=0;}var _1c0=_1ba(_1bd,_1bf);_1be=_1ba(_1c0,0);}return (_1be.cfg.getProperty("disabled")||_1be.element.style.display=="none")?_1be.getNextEnabledSibling():_1be;}},getPreviousEnabledSibling:function(){if(this.parent instanceof Menu){var _1c1=this.groupIndex;var _1c2=function(_1c3,_1c4){return _1c3[_1c4]||_1c2(_1c3,(_1c4-1));};var _1c5=function(_1c6,_1c7){return _1c6[_1c7]?_1c7:_1c5(_1c6,(_1c7+1));};var _1c8=this.parent.getItemGroups();var _1c9;if(this.index>_1c5(_1c8[_1c1],0)){_1c9=_1c2(_1c8[_1c1],(this.index-1));}else{var _1ca;if(_1c1>_1c5(_1c8,0)){_1ca=_1c1-1;}else{_1ca=_1c8.length-1;}var _1cb=_1c2(_1c8,_1ca);_1c9=_1c2(_1cb,(_1cb.length-1));}return (_1c9.cfg.getProperty("disabled")||_1c9.element.style.display=="none")?_1c9.getPreviousEnabledSibling():_1c9;}},focus:function(){var _1cc=this.parent;var _1cd=this._oAnchor;var _1ce=_1cc.activeItem;if(!this.cfg.getProperty("disabled")&&_1cc&&_1cc.cfg.getProperty("visible")&&this.element.style.display!="none"){if(_1ce){_1ce.blur();}try{_1cd.focus();}catch(e){}this.focusEvent.fire();}},blur:function(){var _1cf=this.parent;if(!this.cfg.getProperty("disabled")&&_1cf&&Dom.getStyle(_1cf.element,"visibility")=="visible"){this._oAnchor.blur();this.blurEvent.fire();}},destroy:function(){var oEl=this.element;if(oEl){this.mouseOverEvent.unsubscribeAll();this.mouseOutEvent.unsubscribeAll();this.mouseDownEvent.unsubscribeAll();this.mouseUpEvent.unsubscribeAll();this.clickEvent.unsubscribeAll();this.keyPressEvent.unsubscribeAll();this.keyDownEvent.unsubscribeAll();this.keyUpEvent.unsubscribeAll();this.focusEvent.unsubscribeAll();this.blurEvent.unsubscribeAll();this.cfg.configChangedEvent.unsubscribeAll();var _1d1=oEl.parentNode;if(_1d1){_1d1.removeChild(oEl);this.destroyEvent.fire();}this.destroyEvent.unsubscribeAll();}},toString:function(){return ("MenuItem: "+this.cfg.getProperty("text"));}};})();YAHOO.widget.MenuModuleItem=YAHOO.widget.MenuItem;YAHOO.widget.ContextMenu=function(_1d2,_1d3){YAHOO.widget.ContextMenu.superclass.constructor.call(this,_1d2,_1d3);};YAHOO.extend(YAHOO.widget.ContextMenu,YAHOO.widget.Menu,{_oTrigger:null,contextEventTarget:null,init:function(_1d4,_1d5){if(!this.ITEM_TYPE){this.ITEM_TYPE=YAHOO.widget.ContextMenuItem;}YAHOO.widget.ContextMenu.superclass.init.call(this,_1d4);this.beforeInitEvent.fire(YAHOO.widget.ContextMenu);if(_1d5){this.cfg.applyConfig(_1d5,true);}this.initEvent.fire(YAHOO.widget.ContextMenu);},_removeEventHandlers:function(){var _1d6=YAHOO.util.Event;var _1d7=this._oTrigger;var _1d8=(this.browser=="opera");_1d6.removeListener(_1d7,(_1d8?"mousedown":"contextmenu"),this._onTriggerContextMenu);if(_1d8){_1d6.removeListener(_1d7,"click",this._onTriggerClick);}},_onTriggerClick:function(_1d9,_1da){if(_1d9.ctrlKey){YAHOO.util.Event.stopEvent(_1d9);}},_onTriggerContextMenu:function(_1db,_1dc){YAHOO.widget.MenuManager.hideVisible();var _1dd=YAHOO.util.Event;var _1de=this.cfg;if(_1db.type=="mousedown"&&!_1db.ctrlKey){return;}this.contextEventTarget=_1dd.getTarget(_1db);var nX=_1dd.getPageX(_1db);var nY=_1dd.getPageY(_1db);_1de.applyConfig({xy:[nX,nY],visible:true});_1de.fireQueue();_1dd.stopEvent(_1db);},toString:function(){return ("ContextMenu "+this.id);},initDefaultConfig:function(){YAHOO.widget.ContextMenu.superclass.initDefaultConfig.call(this);this.cfg.addProperty("trigger",{handler:this.configTrigger});},destroy:function(){this._removeEventHandlers();YAHOO.widget.ContextMenu.superclass.destroy.call(this);},configTrigger:function(_1e1,_1e2,_1e3){var _1e4=YAHOO.util.Event;var _1e5=_1e2[0];if(_1e5){if(this._oTrigger){this._removeEventHandlers();}this._oTrigger=_1e5;var _1e6=(this.browser=="opera");_1e4.addListener(_1e5,(_1e6?"mousedown":"contextmenu"),this._onTriggerContextMenu,this,true);if(_1e6){_1e4.addListener(_1e5,"click",this._onTriggerClick,this,true);}}else{this._removeEventHandlers();}}});YAHOO.widget.ContextMenuItem=function(_1e7,_1e8){YAHOO.widget.ContextMenuItem.superclass.constructor.call(this,_1e7,_1e8);};YAHOO.extend(YAHOO.widget.ContextMenuItem,YAHOO.widget.MenuItem,{init:function(_1e9,_1ea){if(!this.SUBMENU_TYPE){this.SUBMENU_TYPE=YAHOO.widget.ContextMenu;}YAHOO.widget.ContextMenuItem.superclass.init.call(this,_1e9);var _1eb=this.cfg;if(_1ea){_1eb.applyConfig(_1ea,true);}_1eb.fireQueue();},toString:function(){return ("MenuBarItem: "+this.cfg.getProperty("text"));}});YAHOO.widget.MenuBar=function(_1ec,_1ed){YAHOO.widget.MenuBar.superclass.constructor.call(this,_1ec,_1ed);};YAHOO.extend(YAHOO.widget.MenuBar,YAHOO.widget.Menu,{init:function(_1ee,_1ef){if(!this.ITEM_TYPE){this.ITEM_TYPE=YAHOO.widget.MenuBarItem;}YAHOO.widget.MenuBar.superclass.init.call(this,_1ee);this.beforeInitEvent.fire(YAHOO.widget.MenuBar);if(_1ef){this.cfg.applyConfig(_1ef,true);}this.initEvent.fire(YAHOO.widget.MenuBar);},CSS_CLASS_NAME:"yuimenubar",_onKeyDown:function(_1f0,_1f1,_1f2){var _1f3=YAHOO.util.Event;var _1f4=_1f1[0];var _1f5=_1f1[1];var _1f6=_1f5.cfg;var _1f7;switch(_1f4.keyCode){case 27:if(this.cfg.getProperty("position")=="dynamic"){this.hide();if(this.parent){this.parent.focus();}}else{if(this.activeItem){_1f7=this.activeItem.cfg.getProperty("submenu");if(_1f7&&_1f7.cfg.getProperty("visible")){_1f7.hide();this.activeItem.focus();}else{this.activeItem.cfg.setProperty("selected",false);this.activeItem.blur();}}}_1f3.preventDefault(_1f4);break;case 37:case 39:if(_1f5==this.activeItem&&!_1f6.getProperty("selected")){_1f6.setProperty("selected",true);}else{var _1f8=(_1f4.keyCode==37)?_1f5.getPreviousEnabledSibling():_1f5.getNextEnabledSibling();if(_1f8){this.clearActiveItem();_1f8.cfg.setProperty("selected",true);if(this.cfg.getProperty("autosubmenudisplay")){_1f7=_1f8.cfg.getProperty("submenu");if(_1f7){_1f7.show();_1f7.activeItem.blur();_1f7.activeItem=null;}}_1f8.focus();}}_1f3.preventDefault(_1f4);break;case 40:if(this.activeItem!=_1f5){this.clearActiveItem();_1f6.setProperty("selected",true);_1f5.focus();}_1f7=_1f6.getProperty("submenu");if(_1f7){if(_1f7.cfg.getProperty("visible")){_1f7.setInitialSelection();_1f7.setInitialFocus();}else{_1f7.show();}}_1f3.preventDefault(_1f4);break;}},_onClick:function(_1f9,_1fa,_1fb){YAHOO.widget.MenuBar.superclass._onClick.call(this,_1f9,_1fa,_1fb);var _1fc=_1fa[1];if(_1fc){var _1fd=YAHOO.util.Event;var Dom=YAHOO.util.Dom;var _1ff=_1fa[0];var _200=_1fd.getTarget(_1ff);var _201=this.activeItem;var _202=this.cfg;if(_201&&_201!=_1fc){this.clearActiveItem();}_1fc.cfg.setProperty("selected",true);_1fc.focus();var _203=_1fc.cfg.getProperty("submenu");if(_203&&_200!=_1fc.submenuIndicator){if(_203.cfg.getProperty("visible")){_203.hide();}else{_203.show();}}}},toString:function(){return ("MenuBar "+this.id);},initDefaultConfig:function(){YAHOO.widget.MenuBar.superclass.initDefaultConfig.call(this);var _204=this.cfg;_204.addProperty("position",{value:"static",handler:this.configPosition,validator:this._checkPosition,supercedes:["visible"]});_204.addProperty("submenualignment",{value:["tl","bl"]});_204.addProperty("autosubmenudisplay",{value:false,validator:_204.checkBoolean});}});YAHOO.widget.MenuBarItem=function(_205,_206){YAHOO.widget.MenuBarItem.superclass.constructor.call(this,_205,_206);};YAHOO.extend(YAHOO.widget.MenuBarItem,YAHOO.widget.MenuItem,{init:function(_207,_208){if(!this.SUBMENU_TYPE){this.SUBMENU_TYPE=YAHOO.widget.Menu;}YAHOO.widget.MenuBarItem.superclass.init.call(this,_207);var _209=this.cfg;if(_208){_209.applyConfig(_208,true);}_209.fireQueue();},CSS_CLASS_NAME:"yuimenubaritem",SUBMENU_INDICATOR_IMAGE_PATH:"nt/ic/ut/alt1/menuarodwn8_nrm_1.gif",SELECTED_SUBMENU_INDICATOR_IMAGE_PATH:"nt/ic/ut/alt1/menuarodwn8_hov_1.gif",DISABLED_SUBMENU_INDICATOR_IMAGE_PATH:"nt/ic/ut/alt1/menuarodwn8_dim_1.gif",toString:function(){return ("MenuBarItem: "+this.cfg.getProperty("text"));}}); \ No newline at end of file +/* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.txt version: 0.12.1 */ +(function(){var Dom=YAHOO.util.Dom,Event=YAHOO.util.Event;YAHOO.widget.MenuManager=function(){var m_bInitializedEventHandlers=false,m_oMenus={},m_oItems={},m_oVisibleMenus={},me=this;function addItem(p_oItem){var sYUIId=Dom.generateId();if(p_oItem&&m_oItems[sYUIId]!=p_oItem){p_oItem.element.setAttribute("yuiid",sYUIId);m_oItems[sYUIId]=p_oItem;p_oItem.destroyEvent.subscribe(onItemDestroy,p_oItem);}} +function removeItem(p_oItem){var sYUIId=p_oItem.element.getAttribute("yuiid");if(sYUIId&&m_oItems[sYUIId]){delete m_oItems[sYUIId];}} +function getMenuRootElement(p_oElement){var oParentNode;if(p_oElement&&p_oElement.tagName){switch(p_oElement.tagName.toUpperCase()){case"DIV":oParentNode=p_oElement.parentNode;if(Dom.hasClass(p_oElement,"bd")&&oParentNode&&oParentNode.tagName&&oParentNode.tagName.toUpperCase()=="DIV"){return oParentNode;} +else{return p_oElement;} +break;case"LI":return p_oElement;default:oParentNode=p_oElement.parentNode;if(oParentNode){return getMenuRootElement(oParentNode);} +break;}}} +function onDOMEvent(p_oEvent){var oTarget=Event.getTarget(p_oEvent),oElement=getMenuRootElement(oTarget),oMenuItem,oMenu;if(oElement){var sTagName=oElement.tagName.toUpperCase();if(sTagName=="LI"){var sYUIId=oElement.getAttribute("yuiid");if(sYUIId){oMenuItem=m_oItems[sYUIId];oMenu=oMenuItem.parent;}} +else if(sTagName=="DIV"){if(oElement.id){oMenu=m_oMenus[oElement.id];}}} +if(oMenu){var oEventTypes={"click":"clickEvent","mousedown":"mouseDownEvent","mouseup":"mouseUpEvent","mouseover":"mouseOverEvent","mouseout":"mouseOutEvent","keydown":"keyDownEvent","keyup":"keyUpEvent","keypress":"keyPressEvent"},sCustomEventType=oEventTypes[p_oEvent.type];if(oMenuItem&&!oMenuItem.cfg.getProperty("disabled")){oMenuItem[sCustomEventType].fire(p_oEvent);} +oMenu[sCustomEventType].fire(p_oEvent,oMenuItem);} +else if(p_oEvent.type=="mousedown"){var oActiveItem;for(var i in m_oMenus){if(m_oMenus.hasOwnProperty(i)){oMenu=m_oMenus[i];if(oMenu.cfg.getProperty("clicktohide")&&oMenu.cfg.getProperty("position")=="dynamic"){oMenu.hide();} +else{oMenu.clearActiveItem(true);}}}}} +function onMenuDestroy(p_sType,p_aArgs,p_oMenu){if(p_oMenu&&m_oMenus[p_oMenu.id]){delete m_oMenus[p_oMenu.id];}} +function onItemDestroy(p_sType,p_aArgs,p_oItem){var sYUIId=p_oItem.element.getAttribute("yuiid");if(sYUIId){delete m_oItems[sYUIId];}} +function onMenuVisibleConfigChange(p_sType,p_aArgs,p_oMenu){var bVisible=p_aArgs[0];if(bVisible){m_oVisibleMenus[p_oMenu.id]=p_oMenu;} +else if(m_oVisibleMenus[p_oMenu.id]){delete m_oVisibleMenus[p_oMenu.id];}} +function onItemAdded(p_sType,p_aArgs){addItem(p_aArgs[0]);} +function onItemRemoved(p_sType,p_aArgs){removeItem(p_aArgs[0]);} +return{addMenu:function(p_oMenu){if(p_oMenu&&p_oMenu.id&&!m_oMenus[p_oMenu.id]){m_oMenus[p_oMenu.id]=p_oMenu;if(!m_bInitializedEventHandlers){var oDoc=document;Event.addListener(oDoc,"mouseover",onDOMEvent,me,true);Event.addListener(oDoc,"mouseout",onDOMEvent,me,true);Event.addListener(oDoc,"mousedown",onDOMEvent,me,true);Event.addListener(oDoc,"mouseup",onDOMEvent,me,true);Event.addListener(oDoc,"click",onDOMEvent,me,true);Event.addListener(oDoc,"keydown",onDOMEvent,me,true);Event.addListener(oDoc,"keyup",onDOMEvent,me,true);Event.addListener(oDoc,"keypress",onDOMEvent,me,true);m_bInitializedEventHandlers=true;} +p_oMenu.destroyEvent.subscribe(onMenuDestroy,p_oMenu,me);p_oMenu.cfg.subscribeToConfigEvent("visible",onMenuVisibleConfigChange,p_oMenu);p_oMenu.itemAddedEvent.subscribe(onItemAdded);p_oMenu.itemRemovedEvent.subscribe(onItemRemoved);}},removeMenu:function(p_oMenu){if(p_oMenu&&m_oMenus[p_oMenu.id]){delete m_oMenus[p_oMenu.id];}},hideVisible:function(){var oMenu;for(var i in m_oVisibleMenus){if(m_oVisibleMenus.hasOwnProperty(i)){oMenu=m_oVisibleMenus[i];if(oMenu.cfg.getProperty("position")=="dynamic"){oMenu.hide();}}}},getMenus:function(){return m_oMenus;},getMenu:function(p_sId){if(m_oMenus[p_sId]){return m_oMenus[p_sId];}},toString:function(){return("MenuManager");}};}();})();(function(){var Dom=YAHOO.util.Dom,Event=YAHOO.util.Event;YAHOO.widget.Menu=function(p_oElement,p_oConfig){if(p_oConfig){this.parent=p_oConfig.parent;this.lazyLoad=p_oConfig.lazyLoad||p_oConfig.lazyload;this.itemData=p_oConfig.itemData||p_oConfig.itemdata;} +YAHOO.widget.Menu.superclass.constructor.call(this,p_oElement,p_oConfig);};YAHOO.extend(YAHOO.widget.Menu,YAHOO.widget.Overlay,{CSS_CLASS_NAME:"yuimenu",ITEM_TYPE:null,GROUP_TITLE_TAG_NAME:"h6",_nHideDelayId:null,_nShowDelayId:null,_hideDelayEventHandlersAssigned:false,_bHandledMouseOverEvent:false,_bHandledMouseOutEvent:false,_aGroupTitleElements:null,_aItemGroups:null,_aListElements:null,lazyLoad:false,itemData:null,activeItem:null,parent:null,srcElement:null,mouseOverEvent:null,mouseOutEvent:null,mouseDownEvent:null,mouseUpEvent:null,clickEvent:null,keyPressEvent:null,keyDownEvent:null,keyUpEvent:null,itemAddedEvent:null,itemRemovedEvent:null,init:function(p_oElement,p_oConfig){this._aItemGroups=[];this._aListElements=[];this._aGroupTitleElements=[];if(!this.ITEM_TYPE){this.ITEM_TYPE=YAHOO.widget.MenuItem;} +var oElement;if(typeof p_oElement=="string"){oElement=document.getElementById(p_oElement);} +else if(p_oElement.tagName){oElement=p_oElement;} +if(oElement&&oElement.tagName){switch(oElement.tagName.toUpperCase()){case"DIV":this.srcElement=oElement;if(!oElement.id){oElement.setAttribute("id",Dom.generateId());} +YAHOO.widget.Menu.superclass.init.call(this,oElement);this.beforeInitEvent.fire(YAHOO.widget.Menu);break;case"SELECT":this.srcElement=oElement;YAHOO.widget.Menu.superclass.init.call(this,Dom.generateId());this.beforeInitEvent.fire(YAHOO.widget.Menu);break;}} +else{YAHOO.widget.Menu.superclass.init.call(this,p_oElement);this.beforeInitEvent.fire(YAHOO.widget.Menu);} +if(this.element){var oEl=this.element;Dom.addClass(oEl,this.CSS_CLASS_NAME);this.initEvent.subscribe(this._onInit,this,true);this.beforeRenderEvent.subscribe(this._onBeforeRender,this,true);this.renderEvent.subscribe(this._onRender,this,true);this.beforeShowEvent.subscribe(this._onBeforeShow,this,true);this.showEvent.subscribe(this._onShow,this,true);this.beforeHideEvent.subscribe(this._onBeforeHide,this,true);this.mouseOverEvent.subscribe(this._onMouseOver,this,true);this.mouseOutEvent.subscribe(this._onMouseOut,this,true);this.clickEvent.subscribe(this._onClick,this,true);this.keyDownEvent.subscribe(this._onKeyDown,this,true);YAHOO.widget.Module.textResizeEvent.subscribe(this._onTextResize,this,true);if(p_oConfig){this.cfg.applyConfig(p_oConfig,true);} +YAHOO.widget.MenuManager.addMenu(this);this.initEvent.fire(YAHOO.widget.Menu);}},_initSubTree:function(){var oNode;if(this.srcElement.tagName=="DIV"){oNode=this.body.firstChild;var nGroup=0,sGroupTitleTagName=this.GROUP_TITLE_TAG_NAME.toUpperCase();do{if(oNode&&oNode.tagName){switch(oNode.tagName.toUpperCase()){case sGroupTitleTagName:this._aGroupTitleElements[nGroup]=oNode;break;case"UL":this._aListElements[nGroup]=oNode;this._aItemGroups[nGroup]=[];nGroup++;break;}}} +while((oNode=oNode.nextSibling));if(this._aListElements[0]){Dom.addClass(this._aListElements[0],"first-of-type");}} +oNode=null;if(this.srcElement.tagName){var sSrcElementTagName=this.srcElement.tagName.toUpperCase();switch(sSrcElementTagName){case"DIV":if(this._aListElements.length>0){var i=this._aListElements.length-1;do{oNode=this._aListElements[i].firstChild;do{if(oNode&&oNode.tagName&&oNode.tagName.toUpperCase()=="LI"){this.addItem(new this.ITEM_TYPE(oNode,{parent:this}),i);}} +while((oNode=oNode.nextSibling));} +while(i--);} +break;case"SELECT":oNode=this.srcElement.firstChild;do{if(oNode&&oNode.tagName){switch(oNode.tagName.toUpperCase()){case"OPTGROUP":case"OPTION":this.addItem(new this.ITEM_TYPE(oNode,{parent:this}));break;}}} +while((oNode=oNode.nextSibling));break;}}},_getFirstEnabledItem:function(){var nGroups=this._aItemGroups.length,oItem,aItemGroup;for(var i=0;i=aGroup.length);if(aGroup[p_nItemIndex]){aGroup.splice(p_nItemIndex,0,oItem);} +else{aGroup[p_nItemIndex]=oItem;} +oGroupItem=aGroup[p_nItemIndex];if(oGroupItem){if(bAppend&&(!oGroupItem.element.parentNode||oGroupItem.element.parentNode.nodeType==11)){this._aListElements[nGroupIndex].appendChild(oGroupItem.element);} +else{function getNextItemSibling(p_aArray,p_nStartIndex){return(p_aArray[p_nStartIndex]||getNextItemSibling(p_aArray,(p_nStartIndex+1)));} +var oNextItemSibling=getNextItemSibling(aGroup,(p_nItemIndex+1));if(oNextItemSibling&&(!oGroupItem.element.parentNode||oGroupItem.element.parentNode.nodeType==11)){this._aListElements[nGroupIndex].insertBefore(oGroupItem.element,oNextItemSibling.element);}} +oGroupItem.parent=this;this._subscribeToItemEvents(oGroupItem);this._configureSubmenu(oGroupItem);this._updateItemProperties(nGroupIndex);this.itemAddedEvent.fire(oGroupItem);return oGroupItem;}} +else{var nItemIndex=aGroup.length;aGroup[nItemIndex]=oItem;oGroupItem=aGroup[nItemIndex];if(oGroupItem){if(!Dom.isAncestor(this._aListElements[nGroupIndex],oGroupItem.element)){this._aListElements[nGroupIndex].appendChild(oGroupItem.element);} +oGroupItem.element.setAttribute("groupindex",nGroupIndex);oGroupItem.element.setAttribute("index",nItemIndex);oGroupItem.parent=this;oGroupItem.index=nItemIndex;oGroupItem.groupIndex=nGroupIndex;this._subscribeToItemEvents(oGroupItem);this._configureSubmenu(oGroupItem);if(nItemIndex===0){Dom.addClass(oGroupItem.element,"first-of-type");} +this.itemAddedEvent.fire(oGroupItem);return oGroupItem;}}}},_removeItemFromGroupByIndex:function(p_nGroupIndex,p_nItemIndex){var nGroupIndex=typeof p_nGroupIndex=="number"?p_nGroupIndex:0,aGroup=this._getItemGroup(nGroupIndex);if(aGroup){var aArray=aGroup.splice(p_nItemIndex,1),oItem=aArray[0];if(oItem){this._updateItemProperties(nGroupIndex);if(aGroup.length===0){var oUL=this._aListElements[nGroupIndex];if(this.body&&oUL){this.body.removeChild(oUL);} +this._aItemGroups.splice(nGroupIndex,1);this._aListElements.splice(nGroupIndex,1);oUL=this._aListElements[0];if(oUL){Dom.addClass(oUL,"first-of-type");}} +this.itemRemovedEvent.fire(oItem);return oItem;}}},_removeItemFromGroupByValue:function(p_nGroupIndex,p_oItem){var aGroup=this._getItemGroup(p_nGroupIndex);if(aGroup){var nItems=aGroup.length,nItemIndex=-1;if(nItems>0){var i=nItems-1;do{if(aGroup[i]==p_oItem){nItemIndex=i;break;}} +while(i--);if(nItemIndex>-1){return this._removeItemFromGroupByIndex(p_nGroupIndex,nItemIndex);}}}},_updateItemProperties:function(p_nGroupIndex){var aGroup=this._getItemGroup(p_nGroupIndex),nItems=aGroup.length;if(nItems>0){var i=nItems-1,oItem,oLI;do{oItem=aGroup[i];if(oItem){oLI=oItem.element;oItem.index=i;oItem.groupIndex=p_nGroupIndex;oLI.setAttribute("groupindex",p_nGroupIndex);oLI.setAttribute("index",i);Dom.removeClass(oLI,"first-of-type");}} +while(i--);if(oLI){Dom.addClass(oLI,"first-of-type");}}},_createItemGroup:function(p_nIndex){if(!this._aItemGroups[p_nIndex]){this._aItemGroups[p_nIndex]=[];var oUL=document.createElement("ul");this._aListElements[p_nIndex]=oUL;return this._aItemGroups[p_nIndex];}},_getItemGroup:function(p_nIndex){var nIndex=((typeof p_nIndex=="number")?p_nIndex:0);return this._aItemGroups[nIndex];},_configureSubmenu:function(p_oItem){var oSubmenu=p_oItem.cfg.getProperty("submenu");if(oSubmenu){this.cfg.configChangedEvent.subscribe(this._onParentMenuConfigChange,oSubmenu,true);this.renderEvent.subscribe(this._onParentMenuRender,oSubmenu,true);oSubmenu.beforeShowEvent.subscribe(this._onSubmenuBeforeShow,oSubmenu,true);oSubmenu.showEvent.subscribe(this._onSubmenuShow,oSubmenu,true);oSubmenu.hideEvent.subscribe(this._onSubmenuHide,oSubmenu,true);}},_subscribeToItemEvents:function(p_oItem){p_oItem.focusEvent.subscribe(this._onMenuItemFocus,p_oItem,this);p_oItem.blurEvent.subscribe(this._onMenuItemBlur,this,true);p_oItem.cfg.configChangedEvent.subscribe(this._onMenuItemConfigChange,p_oItem,this);},_getOffsetWidth:function(){var oClone=this.element.cloneNode(true);Dom.setStyle(oClone,"width","");document.body.appendChild(oClone);var sWidth=oClone.offsetWidth;document.body.removeChild(oClone);return sWidth;},_cancelHideDelay:function(){var oRoot=this.getRoot();if(oRoot._nHideDelayId){window.clearTimeout(oRoot._nHideDelayId);}},_execHideDelay:function(){this._cancelHideDelay();var oRoot=this.getRoot(),me=this;function hideMenu(){if(oRoot.activeItem){oRoot.clearActiveItem();} +if(oRoot==me&&me.cfg.getProperty("position")=="dynamic"){me.hide();}} +oRoot._nHideDelayId=window.setTimeout(hideMenu,oRoot.cfg.getProperty("hidedelay"));},_cancelShowDelay:function(){var oRoot=this.getRoot();if(oRoot._nShowDelayId){window.clearTimeout(oRoot._nShowDelayId);}},_execShowDelay:function(p_oMenu){var oRoot=this.getRoot();function showMenu(){p_oMenu.show();} +oRoot._nShowDelayId=window.setTimeout(showMenu,oRoot.cfg.getProperty("showdelay"));},_onMouseOver:function(p_sType,p_aArgs,p_oMenu){var oEvent=p_aArgs[0],oItem=p_aArgs[1],oTarget=Event.getTarget(oEvent);if(!this._bHandledMouseOverEvent&&(oTarget==this.element||Dom.isAncestor(this.element,oTarget))){this.clearActiveItem();this._bHandledMouseOverEvent=true;this._bHandledMouseOutEvent=false;} +if(oItem&&!oItem.handledMouseOverEvent&&!oItem.cfg.getProperty("disabled")&&(oTarget==oItem.element||Dom.isAncestor(oItem.element,oTarget))){var nShowDelay=this.cfg.getProperty("showdelay"),bShowDelay=(nShowDelay>0);if(bShowDelay){this._cancelShowDelay();} +var oActiveItem=this.activeItem;if(oActiveItem){oActiveItem.cfg.setProperty("selected",false);var oActiveSubmenu=oActiveItem.cfg.getProperty("submenu");if(oActiveSubmenu){oActiveSubmenu.hide();}} +var oItemCfg=oItem.cfg;oItemCfg.setProperty("selected",true);oItem.focus();if(this.cfg.getProperty("autosubmenudisplay")){var oSubmenu=oItemCfg.getProperty("submenu");if(oSubmenu){if(bShowDelay){this._execShowDelay(oSubmenu);} +else{oSubmenu.show();}}} +oItem.handledMouseOverEvent=true;oItem.handledMouseOutEvent=false;}},_onMouseOut:function(p_sType,p_aArgs,p_oMenu){var oEvent=p_aArgs[0],oItem=p_aArgs[1],oRelatedTarget=Event.getRelatedTarget(oEvent),bMovingToSubmenu=false;if(oItem&&!oItem.cfg.getProperty("disabled")){var oItemCfg=oItem.cfg,oSubmenu=oItemCfg.getProperty("submenu");if(oSubmenu&&(oRelatedTarget==oSubmenu.element||Dom.isAncestor(oSubmenu.element,oRelatedTarget))){bMovingToSubmenu=true;} +if(!oItem.handledMouseOutEvent&&((oRelatedTarget!=oItem.element&&!Dom.isAncestor(oItem.element,oRelatedTarget))||bMovingToSubmenu)){if(!oSubmenu||(oSubmenu&&!oSubmenu.cfg.getProperty("visible"))){oItem.cfg.setProperty("selected",false);if(oSubmenu&&oSubmenu.cfg.getProperty("showdelay")&&!oSubmenu.cfg.getProperty("visible")){this._cancelShowDelay();}} +oItem.handledMouseOutEvent=true;oItem.handledMouseOverEvent=false;}} +if(!this._bHandledMouseOutEvent&&((oRelatedTarget!=this.element&&!Dom.isAncestor(this.element,oRelatedTarget))||bMovingToSubmenu)){this._bHandledMouseOutEvent=true;this._bHandledMouseOverEvent=false;}},_onClick:function(p_sType,p_aArgs,p_oMenu){var oEvent=p_aArgs[0],oItem=p_aArgs[1],oTarget=Event.getTarget(oEvent);if(oItem&&!oItem.cfg.getProperty("disabled")){var oItemCfg=oItem.cfg,oSubmenu=oItemCfg.getProperty("submenu");if(oTarget==oItem.submenuIndicator&&oSubmenu){if(oSubmenu.cfg.getProperty("visible")){oSubmenu.hide();} +else{this.clearActiveItem();this.activeItem=oItem;oItem.cfg.setProperty("selected",true);oSubmenu.show();}} +else{var sURL=oItemCfg.getProperty("url"),bCurrentPageURL=(sURL.substr((sURL.length-1),1)=="#"),sTarget=oItemCfg.getProperty("target"),bHasTarget=(sTarget&&sTarget.length>0);if(oTarget.tagName.toUpperCase()=="A"&&bCurrentPageURL&&!bHasTarget){Event.preventDefault(oEvent);} +if(oTarget.tagName.toUpperCase()!="A"&&!bCurrentPageURL&&!bHasTarget){document.location=sURL;} +if(bCurrentPageURL&&!oSubmenu){var oRoot=this.getRoot();if(oRoot.cfg.getProperty("position")=="static"){oRoot.clearActiveItem();} +else{oRoot.hide();}}}}},_onKeyDown:function(p_sType,p_aArgs,p_oMenu){var oEvent=p_aArgs[0],oItem=p_aArgs[1],oSubmenu;if(oItem&&!oItem.cfg.getProperty("disabled")){var oItemCfg=oItem.cfg,oParentItem=this.parent,oRoot,oNextItem;switch(oEvent.keyCode){case 38:case 40:if(oItem==this.activeItem&&!oItemCfg.getProperty("selected")){oItemCfg.setProperty("selected",true);} +else{oNextItem=(oEvent.keyCode==38)?oItem.getPreviousEnabledSibling():oItem.getNextEnabledSibling();if(oNextItem){this.clearActiveItem();oNextItem.cfg.setProperty("selected",true);oNextItem.focus();}} +Event.preventDefault(oEvent);break;case 39:oSubmenu=oItemCfg.getProperty("submenu");if(oSubmenu){if(!oItemCfg.getProperty("selected")){oItemCfg.setProperty("selected",true);} +oSubmenu.show();oSubmenu.setInitialSelection();} +else{oRoot=this.getRoot();if(oRoot instanceof YAHOO.widget.MenuBar){oNextItem=oRoot.activeItem.getNextEnabledSibling();if(oNextItem){oRoot.clearActiveItem();oNextItem.cfg.setProperty("selected",true);oSubmenu=oNextItem.cfg.getProperty("submenu");if(oSubmenu){oSubmenu.show();} +oNextItem.focus();}}} +Event.preventDefault(oEvent);break;case 37:if(oParentItem){var oParentMenu=oParentItem.parent;if(oParentMenu instanceof YAHOO.widget.MenuBar){oNextItem=oParentMenu.activeItem.getPreviousEnabledSibling();if(oNextItem){oParentMenu.clearActiveItem();oNextItem.cfg.setProperty("selected",true);oSubmenu=oNextItem.cfg.getProperty("submenu");if(oSubmenu){oSubmenu.show();} +oNextItem.focus();}} +else{this.hide();oParentItem.focus();}} +Event.preventDefault(oEvent);break;}} +if(oEvent.keyCode==27){if(this.cfg.getProperty("position")=="dynamic"){this.hide();if(this.parent){this.parent.focus();}} +else if(this.activeItem){oSubmenu=this.activeItem.cfg.getProperty("submenu");if(oSubmenu&&oSubmenu.cfg.getProperty("visible")){oSubmenu.hide();this.activeItem.focus();} +else{this.activeItem.cfg.setProperty("selected",false);this.activeItem.blur();}} +Event.preventDefault(oEvent);}},_onTextResize:function(p_sType,p_aArgs,p_oMenu){if(this.browser=="gecko"&&!this._handleResize){this._handleResize=true;return;} +var oConfig=this.cfg;if(oConfig.getProperty("position")=="dynamic"){oConfig.setProperty("width",(this._getOffsetWidth()+"px"));}},_onInit:function(p_sType,p_aArgs,p_oMenu){if(((this.parent&&!this.lazyLoad)||(!this.parent&&this.cfg.getProperty("position")=="static")||(!this.parent&&!this.lazyLoad&&this.cfg.getProperty("position")=="dynamic"))&&this.getItemGroups().length===0){if(this.srcElement){this._initSubTree();} +if(this.itemData){this.addItems(this.itemData);}} +else if(this.lazyLoad){this.cfg.fireQueue();}},_onBeforeRender:function(p_sType,p_aArgs,p_oMenu){var oConfig=this.cfg,oEl=this.element,nListElements=this._aListElements.length;if(nListElements>0){var i=0,bFirstList=true,oUL,oGroupTitle;do{oUL=this._aListElements[i];if(oUL){if(bFirstList){Dom.addClass(oUL,"first-of-type");bFirstList=false;} +if(!Dom.isAncestor(oEl,oUL)){this.appendToBody(oUL);} +oGroupTitle=this._aGroupTitleElements[i];if(oGroupTitle){if(!Dom.isAncestor(oEl,oGroupTitle)){oUL.parentNode.insertBefore(oGroupTitle,oUL);} +Dom.addClass(oUL,"hastitle");}} +i++;} +while(iviewPortWidth){if(oContextElement&&((x-oContextElement.offsetWidth)>offsetWidth)){x=(x-(oContextElement.offsetWidth+offsetWidth));} +else{x=rightConstraint;}} +if(y<10){y=topConstraint;}else if(y>bottomConstraint){if(oContextElement&&(y>offsetHeight)){y=((y+oContextElement.offsetHeight)-offsetHeight);} +else{y=bottomConstraint;}} +oConfig.setProperty("x",x,true);oConfig.setProperty("y",y,true);oConfig.setProperty("xy",[x,y],true);},configVisible:function(p_sType,p_aArgs,p_oMenu){if(this.cfg.getProperty("position")=="dynamic"){YAHOO.widget.Menu.superclass.configVisible.call(this,p_sType,p_aArgs,p_oMenu);} +else{var bVisible=p_aArgs[0],sDisplay=Dom.getStyle(this.element,"display");if(bVisible){if(sDisplay!="block"){this.beforeShowEvent.fire();Dom.setStyle(this.element,"display","block");this.showEvent.fire();}} +else{if(sDisplay=="block"){this.beforeHideEvent.fire();Dom.setStyle(this.element,"display","none");this.hideEvent.fire();}}}},configPosition:function(p_sType,p_aArgs,p_oMenu){var sCSSPosition=p_aArgs[0]=="static"?"static":"absolute",oCfg=this.cfg;Dom.setStyle(this.element,"position",sCSSPosition);if(sCSSPosition=="static"){oCfg.setProperty("iframe",false);Dom.setStyle(this.element,"display","block");oCfg.setProperty("visible",true);} +else{Dom.setStyle(this.element,"visibility","hidden");} +if(sCSSPosition=="absolute"){var nZIndex=oCfg.getProperty("zindex");if(!nZIndex||nZIndex===0){nZIndex=this.parent?(this.parent.parent.cfg.getProperty("zindex")+1):1;oCfg.setProperty("zindex",nZIndex);}}},configIframe:function(p_sType,p_aArgs,p_oMenu){if(this.cfg.getProperty("position")=="dynamic"){YAHOO.widget.Menu.superclass.configIframe.call(this,p_sType,p_aArgs,p_oMenu);}},configHideDelay:function(p_sType,p_aArgs,p_oMenu){var nHideDelay=p_aArgs[0],oMouseOutEvent=this.mouseOutEvent,oMouseOverEvent=this.mouseOverEvent,oKeyDownEvent=this.keyDownEvent;if(nHideDelay>0){if(!this._hideDelayEventHandlersAssigned){oMouseOutEvent.subscribe(this._execHideDelay,true);oMouseOverEvent.subscribe(this._cancelHideDelay,this,true);oKeyDownEvent.subscribe(this._cancelHideDelay,this,true);this._hideDelayEventHandlersAssigned=true;}} +else{oMouseOutEvent.unsubscribe(this._execHideDelay,this);oMouseOverEvent.unsubscribe(this._cancelHideDelay,this);oKeyDownEvent.unsubscribe(this._cancelHideDelay,this);this._hideDelayEventHandlersAssigned=false;}},configContainer:function(p_sType,p_aArgs,p_oMenu){var oElement=p_aArgs[0];if(typeof oElement=='string'){this.cfg.setProperty("container",document.getElementById(oElement),true);}},initEvents:function(){YAHOO.widget.Menu.superclass.initEvents.call(this);var CustomEvent=YAHOO.util.CustomEvent;this.mouseOverEvent=new CustomEvent("mouseOverEvent",this);this.mouseOutEvent=new CustomEvent("mouseOutEvent",this);this.mouseDownEvent=new CustomEvent("mouseDownEvent",this);this.mouseUpEvent=new CustomEvent("mouseUpEvent",this);this.clickEvent=new CustomEvent("clickEvent",this);this.keyPressEvent=new CustomEvent("keyPressEvent",this);this.keyDownEvent=new CustomEvent("keyDownEvent",this);this.keyUpEvent=new CustomEvent("keyUpEvent",this);this.itemAddedEvent=new CustomEvent("itemAddedEvent",this);this.itemRemovedEvent=new CustomEvent("itemRemovedEvent",this);},getRoot:function(){var oItem=this.parent;if(oItem){var oParentMenu=oItem.parent;return oParentMenu?oParentMenu.getRoot():this;} +else{return this;}},toString:function(){return("Menu "+this.id);},setItemGroupTitle:function(p_sGroupTitle,p_nGroupIndex){if(typeof p_sGroupTitle=="string"&&p_sGroupTitle.length>0){var nGroupIndex=typeof p_nGroupIndex=="number"?p_nGroupIndex:0,oTitle=this._aGroupTitleElements[nGroupIndex];if(oTitle){oTitle.innerHTML=p_sGroupTitle;} +else{oTitle=document.createElement(this.GROUP_TITLE_TAG_NAME);oTitle.innerHTML=p_sGroupTitle;this._aGroupTitleElements[nGroupIndex]=oTitle;} +var i=this._aGroupTitleElements.length-1,nFirstIndex;do{if(this._aGroupTitleElements[i]){Dom.removeClass(this._aGroupTitleElements[i],"first-of-type");nFirstIndex=i;}} +while(i--);if(nFirstIndex!==null){Dom.addClass(this._aGroupTitleElements[nFirstIndex],"first-of-type");}}},addItem:function(p_oItem,p_nGroupIndex){if(p_oItem){return this._addItemToGroup(p_nGroupIndex,p_oItem);}},addItems:function(p_aItems,p_nGroupIndex){function isArray(p_oValue){return(typeof p_oValue=="object"&&p_oValue.constructor==Array);} +if(isArray(p_aItems)){var nItems=p_aItems.length,aItems=[],oItem;for(var i=0;i0){i=nItemGroups-1;do{oItemGroup=this._aItemGroups[i];if(oItemGroup){nItems=oItemGroup.length;if(nItems>0){n=nItems-1;do{oItem=this._aItemGroups[i][n];if(oItem){oItem.destroy();}} +while(n--);}}} +while(i--);} +YAHOO.widget.Menu.superclass.destroy.call(this);},setInitialFocus:function(){var oItem=this._getFirstEnabledItem();if(oItem){oItem.focus();}},setInitialSelection:function(){var oItem=this._getFirstEnabledItem();if(oItem){oItem.cfg.setProperty("selected",true);}},clearActiveItem:function(p_bBlur){if(this.cfg.getProperty("showdelay")>0){this._cancelShowDelay();} +var oActiveItem=this.activeItem;if(oActiveItem){var oConfig=oActiveItem.cfg;oConfig.setProperty("selected",false);var oSubmenu=oConfig.getProperty("submenu");if(oSubmenu){oSubmenu.hide();} +if(p_bBlur){oActiveItem.blur();}}},initDefaultConfig:function(){YAHOO.widget.Menu.superclass.initDefaultConfig.call(this);var oConfig=this.cfg;oConfig.addProperty("visible",{value:false,handler:this.configVisible,validator:this.cfg.checkBoolean});oConfig.addProperty("constraintoviewport",{value:true,handler:this.configConstrainToViewport,validator:this.cfg.checkBoolean,supercedes:["iframe","x","y","xy"]});oConfig.addProperty("position",{value:"dynamic",handler:this.configPosition,validator:this._checkPosition,supercedes:["visible"]});oConfig.addProperty("submenualignment",{value:["tl","tr"]});oConfig.addProperty("autosubmenudisplay",{value:true,validator:oConfig.checkBoolean});oConfig.addProperty("showdelay",{value:0,validator:oConfig.checkNumber});oConfig.addProperty("hidedelay",{value:0,validator:oConfig.checkNumber,handler:this.configHideDelay,suppressEvent:true});oConfig.addProperty("clicktohide",{value:true,validator:oConfig.checkBoolean});this.cfg.addProperty("container",{value:document.body,handler:this.configContainer});}});})();YAHOO.widget.MenuModule=YAHOO.widget.Menu;(function(){var Dom=YAHOO.util.Dom,Module=YAHOO.widget.Module,Menu=YAHOO.widget.Menu;YAHOO.widget.MenuItem=function(p_oObject,p_oConfig){if(p_oObject){if(p_oConfig){this.parent=p_oConfig.parent;this.value=p_oConfig.value;} +this.init(p_oObject,p_oConfig);}};YAHOO.widget.MenuItem.prototype={SUBMENU_INDICATOR_IMAGE_PATH:"nt/ic/ut/alt1/menuarorght8_nrm_1.gif",SELECTED_SUBMENU_INDICATOR_IMAGE_PATH:"nt/ic/ut/alt1/menuarorght8_hov_1.gif",DISABLED_SUBMENU_INDICATOR_IMAGE_PATH:"nt/ic/ut/alt1/menuarorght8_dim_1.gif",COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT:"Collapsed. Click to expand.",EXPANDED_SUBMENU_INDICATOR_ALT_TEXT:"Expanded. Click to collapse.",DISABLED_SUBMENU_INDICATOR_ALT_TEXT:"Disabled.",CHECKED_IMAGE_PATH:"nt/ic/ut/bsc/menuchk8_nrm_1.gif",SELECTED_CHECKED_IMAGE_PATH:"nt/ic/ut/bsc/menuchk8_hov_1.gif",DISABLED_CHECKED_IMAGE_PATH:"nt/ic/ut/bsc/menuchk8_dim_1.gif",CHECKED_IMAGE_ALT_TEXT:"Checked.",DISABLED_CHECKED_IMAGE_ALT_TEXT:"Checked. (Item disabled.)",CSS_CLASS_NAME:"yuimenuitem",SUBMENU_TYPE:null,IMG_ROOT:"http://us.i1.yimg.com/us.yimg.com/i/",IMG_ROOT_SSL:"https://a248.e.akamai.net/sec.yimg.com/i/",_oAnchor:null,_oText:null,_oHelpTextEM:null,_oSubmenu:null,_checkImage:null,constructor:YAHOO.widget.MenuItem,imageRoot:null,isSecure:Module.prototype.isSecure,index:null,groupIndex:null,parent:null,element:null,srcElement:null,value:null,submenuIndicator:null,browser:Module.prototype.browser,destroyEvent:null,mouseOverEvent:null,mouseOutEvent:null,mouseDownEvent:null,mouseUpEvent:null,clickEvent:null,keyPressEvent:null,keyDownEvent:null,keyUpEvent:null,focusEvent:null,blurEvent:null,init:function(p_oObject,p_oConfig){this.imageRoot=(this.isSecure)?this.IMG_ROOT_SSL:this.IMG_ROOT;if(!this.SUBMENU_TYPE){this.SUBMENU_TYPE=Menu;} +this.cfg=new YAHOO.util.Config(this);this.initDefaultConfig();var oConfig=this.cfg;if(this._checkString(p_oObject)){this._createRootNodeStructure();oConfig.setProperty("text",p_oObject);} +else if(this._checkDOMNode(p_oObject)){switch(p_oObject.tagName.toUpperCase()){case"OPTION":this._createRootNodeStructure();oConfig.setProperty("text",p_oObject.text);this.srcElement=p_oObject;break;case"OPTGROUP":this._createRootNodeStructure();oConfig.setProperty("text",p_oObject.label);this.srcElement=p_oObject;this._initSubTree();break;case"LI":var oAnchor=this._getFirstElement(p_oObject,"A"),sURL="#",sTarget,sText;if(oAnchor){sURL=oAnchor.getAttribute("href");sTarget=oAnchor.getAttribute("target");if(oAnchor.innerText){sText=oAnchor.innerText;} +else{var oRange=oAnchor.ownerDocument.createRange();oRange.selectNodeContents(oAnchor);sText=oRange.toString();}} +else{var oText=p_oObject.firstChild;sText=oText.nodeValue;oAnchor=document.createElement("a");oAnchor.setAttribute("href",sURL);p_oObject.replaceChild(oAnchor,oText);oAnchor.appendChild(oText);} +this.srcElement=p_oObject;this.element=p_oObject;this._oAnchor=oAnchor;var oEmphasisNode=this._getFirstElement(oAnchor),bEmphasis=false,bStrongEmphasis=false;if(oEmphasisNode){this._oText=oEmphasisNode.firstChild;switch(oEmphasisNode.tagName.toUpperCase()){case"EM":bEmphasis=true;break;case"STRONG":bStrongEmphasis=true;break;}} +else{this._oText=oAnchor.firstChild;} +oConfig.setProperty("text",sText,true);oConfig.setProperty("url",sURL,true);oConfig.setProperty("target",sTarget,true);oConfig.setProperty("emphasis",bEmphasis,true);oConfig.setProperty("strongemphasis",bStrongEmphasis,true);this._initSubTree();break;}} +if(this.element){Dom.addClass(this.element,this.CSS_CLASS_NAME);var CustomEvent=YAHOO.util.CustomEvent;this.destroyEvent=new CustomEvent("destroyEvent",this);this.mouseOverEvent=new CustomEvent("mouseOverEvent",this);this.mouseOutEvent=new CustomEvent("mouseOutEvent",this);this.mouseDownEvent=new CustomEvent("mouseDownEvent",this);this.mouseUpEvent=new CustomEvent("mouseUpEvent",this);this.clickEvent=new CustomEvent("clickEvent",this);this.keyPressEvent=new CustomEvent("keyPressEvent",this);this.keyDownEvent=new CustomEvent("keyDownEvent",this);this.keyUpEvent=new CustomEvent("keyUpEvent",this);this.focusEvent=new CustomEvent("focusEvent",this);this.blurEvent=new CustomEvent("blurEvent",this);if(p_oConfig){oConfig.applyConfig(p_oConfig);} +oConfig.fireQueue();}},_getFirstElement:function(p_oElement,p_sTagName){var oElement;if(p_oElement.firstChild&&p_oElement.firstChild.nodeType==1){oElement=p_oElement.firstChild;} +else if(p_oElement.firstChild&&p_oElement.firstChild.nextSibling&&p_oElement.firstChild.nextSibling.nodeType==1){oElement=p_oElement.firstChild.nextSibling;} +if(p_sTagName){return(oElement&&oElement.tagName.toUpperCase()==p_sTagName)?oElement:false;} +return oElement;},_checkString:function(p_oObject){return(typeof p_oObject=="string");},_checkDOMNode:function(p_oObject){return(p_oObject&&p_oObject.tagName);},_createRootNodeStructure:function(){this.element=document.createElement("li");this._oText=document.createTextNode("");this._oAnchor=document.createElement("a");this._oAnchor.appendChild(this._oText);this.cfg.refireEvent("url");this.element.appendChild(this._oAnchor);},_initSubTree:function(){var oSrcEl=this.srcElement,oConfig=this.cfg;if(oSrcEl.childNodes.length>0){if(this.parent.lazyLoad&&this.parent.srcElement&&this.parent.srcElement.tagName.toUpperCase()=="SELECT"){oConfig.setProperty("submenu",{id:Dom.generateId(),itemdata:oSrcEl.childNodes});} +else{var oNode=oSrcEl.firstChild,aOptions=[];do{if(oNode&&oNode.tagName){switch(oNode.tagName.toUpperCase()){case"DIV":oConfig.setProperty("submenu",oNode);break;case"OPTION":aOptions[aOptions.length]=oNode;break;}}} +while((oNode=oNode.nextSibling));var nOptions=aOptions.length;if(nOptions>0){var oMenu=new this.SUBMENU_TYPE(Dom.generateId());oConfig.setProperty("submenu",oMenu);for(var n=0;n0){oAnchor.setAttribute("target",sTarget);} +else{oAnchor.removeAttribute("target");}},configEmphasis:function(p_sType,p_aArgs,p_oItem){var bEmphasis=p_aArgs[0],oAnchor=this._oAnchor,oText=this._oText,oConfig=this.cfg,oEM;if(bEmphasis&&oConfig.getProperty("strongemphasis")){oConfig.setProperty("strongemphasis",false);} +if(oAnchor){if(bEmphasis){oEM=document.createElement("em");oEM.appendChild(oText);oAnchor.appendChild(oEM);} +else{oEM=this._getFirstElement(oAnchor,"EM");if(oEM){oAnchor.removeChild(oEM);oAnchor.appendChild(oText);}}}},configStrongEmphasis:function(p_sType,p_aArgs,p_oItem){var bStrongEmphasis=p_aArgs[0],oAnchor=this._oAnchor,oText=this._oText,oConfig=this.cfg,oStrong;if(bStrongEmphasis&&oConfig.getProperty("emphasis")){oConfig.setProperty("emphasis",false);} +if(oAnchor){if(bStrongEmphasis){oStrong=document.createElement("strong");oStrong.appendChild(oText);oAnchor.appendChild(oStrong);} +else{oStrong=this._getFirstElement(oAnchor,"STRONG");if(oStrong){oAnchor.removeChild(oStrong);oAnchor.appendChild(oText);}}}},configChecked:function(p_sType,p_aArgs,p_oItem){var bChecked=p_aArgs[0],oEl=this.element,oConfig=this.cfg,oImg;if(bChecked){this._preloadImage(this.CHECKED_IMAGE_PATH);this._preloadImage(this.SELECTED_CHECKED_IMAGE_PATH);this._preloadImage(this.DISABLED_CHECKED_IMAGE_PATH);oImg=document.createElement("img");oImg.src=(this.imageRoot+this.CHECKED_IMAGE_PATH);oImg.alt=this.CHECKED_IMAGE_ALT_TEXT;var oSubmenu=this.cfg.getProperty("submenu");if(oSubmenu){oEl.insertBefore(oImg,oSubmenu.element);} +else{oEl.appendChild(oImg);} +Dom.addClass([oEl,oImg],"checked");this._checkImage=oImg;if(oConfig.getProperty("disabled")){oConfig.refireEvent("disabled");} +if(oConfig.getProperty("selected")){oConfig.refireEvent("selected");}} +else{oImg=this._checkImage;Dom.removeClass([oEl,oImg],"checked");if(oImg){oEl.removeChild(oImg);} +this._checkImage=null;}},configDisabled:function(p_sType,p_aArgs,p_oItem){var bDisabled=p_aArgs[0],oAnchor=this._oAnchor,aNodes=[this.element,oAnchor],oEM=this._oHelpTextEM,oConfig=this.cfg,oImg,sImgSrc,sImgAlt;if(oEM){aNodes[2]=oEM;} +if(this.cfg.getProperty("checked")){sImgAlt=this.CHECKED_IMAGE_ALT_TEXT;sImgSrc=this.CHECKED_IMAGE_PATH;oImg=this._checkImage;if(bDisabled){sImgAlt=this.DISABLED_CHECKED_IMAGE_ALT_TEXT;sImgSrc=this.DISABLED_CHECKED_IMAGE_PATH;} +oImg.src=document.images[(this.imageRoot+sImgSrc)].src;oImg.alt=sImgAlt;} +oImg=this.submenuIndicator;if(bDisabled){if(oConfig.getProperty("selected")){oConfig.setProperty("selected",false);} +oAnchor.removeAttribute("href");Dom.addClass(aNodes,"disabled");sImgSrc=this.DISABLED_SUBMENU_INDICATOR_IMAGE_PATH;sImgAlt=this.DISABLED_SUBMENU_INDICATOR_ALT_TEXT;} +else{oAnchor.setAttribute("href",oConfig.getProperty("url"));Dom.removeClass(aNodes,"disabled");sImgSrc=this.SUBMENU_INDICATOR_IMAGE_PATH;sImgAlt=this.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT;} +if(oImg){oImg.src=this.imageRoot+sImgSrc;oImg.alt=sImgAlt;}},configSelected:function(p_sType,p_aArgs,p_oItem){if(!this.cfg.getProperty("disabled")){var bSelected=p_aArgs[0],oEM=this._oHelpTextEM,aNodes=[this.element,this._oAnchor],oImg=this.submenuIndicator,sImgSrc;if(oEM){aNodes[aNodes.length]=oEM;} +if(oImg){aNodes[aNodes.length]=oImg;} +if(this.cfg.getProperty("checked")){sImgSrc=this.imageRoot+(bSelected?this.SELECTED_CHECKED_IMAGE_PATH:this.CHECKED_IMAGE_PATH);this._checkImage.src=document.images[sImgSrc].src;} +if(bSelected){Dom.addClass(aNodes,"selected");sImgSrc=this.SELECTED_SUBMENU_INDICATOR_IMAGE_PATH;} +else{Dom.removeClass(aNodes,"selected");sImgSrc=this.SUBMENU_INDICATOR_IMAGE_PATH;} +if(oImg){oImg.src=document.images[(this.imageRoot+sImgSrc)].src;}}},configSubmenu:function(p_sType,p_aArgs,p_oItem){var oEl=this.element,oSubmenu=p_aArgs[0],oImg=this.submenuIndicator,oConfig=this.cfg,aNodes=[this.element,this._oAnchor],oMenu,bLazyLoad=this.parent&&this.parent.lazyLoad;if(oSubmenu){if(oSubmenu instanceof Menu){oMenu=oSubmenu;oMenu.parent=this;oMenu.lazyLoad=bLazyLoad;} +else if(typeof oSubmenu=="object"&&oSubmenu.id&&!oSubmenu.nodeType){var sSubmenuId=oSubmenu.id,oSubmenuConfig=oSubmenu;oSubmenuConfig.lazyload=bLazyLoad;oSubmenuConfig.parent=this;oMenu=new this.SUBMENU_TYPE(sSubmenuId,oSubmenuConfig);this.cfg.setProperty("submenu",oMenu,true);} +else{oMenu=new this.SUBMENU_TYPE(oSubmenu,{lazyload:bLazyLoad,parent:this});this.cfg.setProperty("submenu",oMenu,true);} +if(oMenu){this._oSubmenu=oMenu;if(!oImg){this._preloadImage(this.SUBMENU_INDICATOR_IMAGE_PATH);this._preloadImage(this.SELECTED_SUBMENU_INDICATOR_IMAGE_PATH);this._preloadImage(this.DISABLED_SUBMENU_INDICATOR_IMAGE_PATH);oImg=document.createElement("img");oImg.src=(this.imageRoot+this.SUBMENU_INDICATOR_IMAGE_PATH);oImg.alt=this.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT;oEl.appendChild(oImg);this.submenuIndicator=oImg;Dom.addClass(aNodes,"hassubmenu");if(oConfig.getProperty("disabled")){oConfig.refireEvent("disabled");} +if(oConfig.getProperty("selected")){oConfig.refireEvent("selected");}}}} +else{Dom.removeClass(aNodes,"hassubmenu");if(oImg){oEl.removeChild(oImg);} +if(this._oSubmenu){this._oSubmenu.destroy();}}},initDefaultConfig:function(){var oConfig=this.cfg,CheckBoolean=oConfig.checkBoolean;oConfig.addProperty("text",{value:"",handler:this.configText,validator:this._checkString,suppressEvent:true});oConfig.addProperty("helptext",{handler:this.configHelpText});oConfig.addProperty("url",{value:"#",handler:this.configURL,suppressEvent:true});oConfig.addProperty("target",{handler:this.configTarget,suppressEvent:true});oConfig.addProperty("emphasis",{value:false,handler:this.configEmphasis,validator:CheckBoolean,suppressEvent:true});oConfig.addProperty("strongemphasis",{value:false,handler:this.configStrongEmphasis,validator:CheckBoolean,suppressEvent:true});oConfig.addProperty("checked",{value:false,handler:this.configChecked,validator:this.cfg.checkBoolean,suppressEvent:true,supercedes:["disabled"]});oConfig.addProperty("disabled",{value:false,handler:this.configDisabled,validator:CheckBoolean,suppressEvent:true});oConfig.addProperty("selected",{value:false,handler:this.configSelected,validator:CheckBoolean,suppressEvent:true});oConfig.addProperty("submenu",{handler:this.configSubmenu});},getNextEnabledSibling:function(){if(this.parent instanceof Menu){var nGroupIndex=this.groupIndex;function getNextArrayItem(p_aArray,p_nStartIndex){return p_aArray[p_nStartIndex]||getNextArrayItem(p_aArray,(p_nStartIndex+1));} +var aItemGroups=this.parent.getItemGroups(),oNextItem;if(this.index<(aItemGroups[nGroupIndex].length-1)){oNextItem=getNextArrayItem(aItemGroups[nGroupIndex],(this.index+1));} +else{var nNextGroupIndex;if(nGroupIndex<(aItemGroups.length-1)){nNextGroupIndex=nGroupIndex+1;} +else{nNextGroupIndex=0;} +var aNextGroup=getNextArrayItem(aItemGroups,nNextGroupIndex);oNextItem=getNextArrayItem(aNextGroup,0);} +return(oNextItem.cfg.getProperty("disabled")||oNextItem.element.style.display=="none")?oNextItem.getNextEnabledSibling():oNextItem;}},getPreviousEnabledSibling:function(){if(this.parent instanceof Menu){var nGroupIndex=this.groupIndex;function getPreviousArrayItem(p_aArray,p_nStartIndex){return p_aArray[p_nStartIndex]||getPreviousArrayItem(p_aArray,(p_nStartIndex-1));} +function getFirstItemIndex(p_aArray,p_nStartIndex){return p_aArray[p_nStartIndex]?p_nStartIndex:getFirstItemIndex(p_aArray,(p_nStartIndex+1));} +var aItemGroups=this.parent.getItemGroups(),oPreviousItem;if(this.index>getFirstItemIndex(aItemGroups[nGroupIndex],0)){oPreviousItem=getPreviousArrayItem(aItemGroups[nGroupIndex],(this.index-1));} +else{var nPreviousGroupIndex;if(nGroupIndex>getFirstItemIndex(aItemGroups,0)){nPreviousGroupIndex=nGroupIndex-1;} +else{nPreviousGroupIndex=aItemGroups.length-1;} +var aPreviousGroup=getPreviousArrayItem(aItemGroups,nPreviousGroupIndex);oPreviousItem=getPreviousArrayItem(aPreviousGroup,(aPreviousGroup.length-1));} +return(oPreviousItem.cfg.getProperty("disabled")||oPreviousItem.element.style.display=="none")?oPreviousItem.getPreviousEnabledSibling():oPreviousItem;}},focus:function(){var oParent=this.parent,oAnchor=this._oAnchor,oActiveItem=oParent.activeItem;function setFocus(){try{oAnchor.focus();} +catch(e){}} +if(!this.cfg.getProperty("disabled")&&oParent&&oParent.cfg.getProperty("visible")&&this.element.style.display!="none"){if(oActiveItem){oActiveItem.blur();} +window.setTimeout(setFocus,0);this.focusEvent.fire();}},blur:function(){var oParent=this.parent;if(!this.cfg.getProperty("disabled")&&oParent&&Dom.getStyle(oParent.element,"visibility")=="visible"){this._oAnchor.blur();this.blurEvent.fire();}},destroy:function(){var oEl=this.element;if(oEl){var oSubmenu=this.cfg.getProperty("submenu");if(oSubmenu){oSubmenu.destroy();} +this.mouseOverEvent.unsubscribeAll();this.mouseOutEvent.unsubscribeAll();this.mouseDownEvent.unsubscribeAll();this.mouseUpEvent.unsubscribeAll();this.clickEvent.unsubscribeAll();this.keyPressEvent.unsubscribeAll();this.keyDownEvent.unsubscribeAll();this.keyUpEvent.unsubscribeAll();this.focusEvent.unsubscribeAll();this.blurEvent.unsubscribeAll();this.cfg.configChangedEvent.unsubscribeAll();var oParentNode=oEl.parentNode;if(oParentNode){oParentNode.removeChild(oEl);this.destroyEvent.fire();} +this.destroyEvent.unsubscribeAll();}},toString:function(){return("MenuItem: "+this.cfg.getProperty("text"));}};})();YAHOO.widget.MenuModuleItem=YAHOO.widget.MenuItem;YAHOO.widget.ContextMenu=function(p_oElement,p_oConfig){YAHOO.widget.ContextMenu.superclass.constructor.call(this,p_oElement,p_oConfig);};YAHOO.extend(YAHOO.widget.ContextMenu,YAHOO.widget.Menu,{_oTrigger:null,contextEventTarget:null,init:function(p_oElement,p_oConfig){if(!this.ITEM_TYPE){this.ITEM_TYPE=YAHOO.widget.ContextMenuItem;} +YAHOO.widget.ContextMenu.superclass.init.call(this,p_oElement);this.beforeInitEvent.fire(YAHOO.widget.ContextMenu);if(p_oConfig){this.cfg.applyConfig(p_oConfig,true);} +this.initEvent.fire(YAHOO.widget.ContextMenu);},_removeEventHandlers:function(){var Event=YAHOO.util.Event,oTrigger=this._oTrigger,bOpera=(this.browser=="opera");Event.removeListener(oTrigger,(bOpera?"mousedown":"contextmenu"),this._onTriggerContextMenu);if(bOpera){Event.removeListener(oTrigger,"click",this._onTriggerClick);}},_onTriggerClick:function(p_oEvent,p_oMenu){if(p_oEvent.ctrlKey){YAHOO.util.Event.stopEvent(p_oEvent);}},_onTriggerContextMenu:function(p_oEvent,p_oMenu){YAHOO.widget.MenuManager.hideVisible();var Event=YAHOO.util.Event,oConfig=this.cfg;if(p_oEvent.type=="mousedown"&&!p_oEvent.ctrlKey){return;} +this.contextEventTarget=Event.getTarget(p_oEvent);var nX=Event.getPageX(p_oEvent),nY=Event.getPageY(p_oEvent);oConfig.applyConfig({xy:[nX,nY],visible:true});oConfig.fireQueue();Event.stopEvent(p_oEvent);},toString:function(){return("ContextMenu "+this.id);},initDefaultConfig:function(){YAHOO.widget.ContextMenu.superclass.initDefaultConfig.call(this);this.cfg.addProperty("trigger",{handler:this.configTrigger});},destroy:function(){this._removeEventHandlers();YAHOO.widget.ContextMenu.superclass.destroy.call(this);},configTrigger:function(p_sType,p_aArgs,p_oMenu){var Event=YAHOO.util.Event,oTrigger=p_aArgs[0];if(oTrigger){if(this._oTrigger){this._removeEventHandlers();} +this._oTrigger=oTrigger;var bOpera=(this.browser=="opera");Event.addListener(oTrigger,(bOpera?"mousedown":"contextmenu"),this._onTriggerContextMenu,this,true);if(bOpera){Event.addListener(oTrigger,"click",this._onTriggerClick,this,true);}} +else{this._removeEventHandlers();}}});YAHOO.widget.ContextMenuItem=function(p_oObject,p_oConfig){YAHOO.widget.ContextMenuItem.superclass.constructor.call(this,p_oObject,p_oConfig);};YAHOO.extend(YAHOO.widget.ContextMenuItem,YAHOO.widget.MenuItem,{init:function(p_oObject,p_oConfig){if(!this.SUBMENU_TYPE){this.SUBMENU_TYPE=YAHOO.widget.ContextMenu;} +YAHOO.widget.ContextMenuItem.superclass.init.call(this,p_oObject);var oConfig=this.cfg;if(p_oConfig){oConfig.applyConfig(p_oConfig,true);} +oConfig.fireQueue();},toString:function(){return("MenuBarItem: "+this.cfg.getProperty("text"));}});YAHOO.widget.MenuBar=function(p_oElement,p_oConfig){YAHOO.widget.MenuBar.superclass.constructor.call(this,p_oElement,p_oConfig);};YAHOO.extend(YAHOO.widget.MenuBar,YAHOO.widget.Menu,{init:function(p_oElement,p_oConfig){if(!this.ITEM_TYPE){this.ITEM_TYPE=YAHOO.widget.MenuBarItem;} +YAHOO.widget.MenuBar.superclass.init.call(this,p_oElement);this.beforeInitEvent.fire(YAHOO.widget.MenuBar);if(p_oConfig){this.cfg.applyConfig(p_oConfig,true);} +this.initEvent.fire(YAHOO.widget.MenuBar);},CSS_CLASS_NAME:"yuimenubar",_onKeyDown:function(p_sType,p_aArgs,p_oMenuBar){var Event=YAHOO.util.Event,oEvent=p_aArgs[0],oItem=p_aArgs[1],oSubmenu;if(oItem&&!oItem.cfg.getProperty("disabled")){var oItemCfg=oItem.cfg;switch(oEvent.keyCode){case 37:case 39:if(oItem==this.activeItem&&!oItemCfg.getProperty("selected")){oItemCfg.setProperty("selected",true);} +else{var oNextItem=(oEvent.keyCode==37)?oItem.getPreviousEnabledSibling():oItem.getNextEnabledSibling();if(oNextItem){this.clearActiveItem();oNextItem.cfg.setProperty("selected",true);if(this.cfg.getProperty("autosubmenudisplay")){oSubmenu=oNextItem.cfg.getProperty("submenu");if(oSubmenu){oSubmenu.show();oSubmenu.activeItem.blur();oSubmenu.activeItem=null;}} +oNextItem.focus();}} +Event.preventDefault(oEvent);break;case 40:if(this.activeItem!=oItem){this.clearActiveItem();oItemCfg.setProperty("selected",true);oItem.focus();} +oSubmenu=oItemCfg.getProperty("submenu");if(oSubmenu){if(oSubmenu.cfg.getProperty("visible")){oSubmenu.setInitialSelection();oSubmenu.setInitialFocus();} +else{oSubmenu.show();}} +Event.preventDefault(oEvent);break;}} +if(oEvent.keyCode==27&&this.activeItem){oSubmenu=this.activeItem.cfg.getProperty("submenu");if(oSubmenu&&oSubmenu.cfg.getProperty("visible")){oSubmenu.hide();this.activeItem.focus();} +else{this.activeItem.cfg.setProperty("selected",false);this.activeItem.blur();} +Event.preventDefault(oEvent);}},_onClick:function(p_sType,p_aArgs,p_oMenuBar){YAHOO.widget.MenuBar.superclass._onClick.call(this,p_sType,p_aArgs,p_oMenuBar);var oItem=p_aArgs[1];if(oItem&&!oItem.cfg.getProperty("disabled")){var Event=YAHOO.util.Event,Dom=YAHOO.util.Dom,oEvent=p_aArgs[0],oTarget=Event.getTarget(oEvent),oActiveItem=this.activeItem,oConfig=this.cfg;if(oActiveItem&&oActiveItem!=oItem){this.clearActiveItem();} +oItem.cfg.setProperty("selected",true);oItem.focus();var oSubmenu=oItem.cfg.getProperty("submenu");if(oSubmenu&&oTarget!=oItem.submenuIndicator){if(oSubmenu.cfg.getProperty("visible")){oSubmenu.hide();} +else{oSubmenu.show();}}}},toString:function(){return("MenuBar "+this.id);},initDefaultConfig:function(){YAHOO.widget.MenuBar.superclass.initDefaultConfig.call(this);var oConfig=this.cfg;oConfig.addProperty("position",{value:"static",handler:this.configPosition,validator:this._checkPosition,supercedes:["visible"]});oConfig.addProperty("submenualignment",{value:["tl","bl"]});oConfig.addProperty("autosubmenudisplay",{value:false,validator:oConfig.checkBoolean});}});YAHOO.widget.MenuBarItem=function(p_oObject,p_oConfig){YAHOO.widget.MenuBarItem.superclass.constructor.call(this,p_oObject,p_oConfig);};YAHOO.extend(YAHOO.widget.MenuBarItem,YAHOO.widget.MenuItem,{init:function(p_oObject,p_oConfig){if(!this.SUBMENU_TYPE){this.SUBMENU_TYPE=YAHOO.widget.Menu;} +YAHOO.widget.MenuBarItem.superclass.init.call(this,p_oObject);var oConfig=this.cfg;if(p_oConfig){oConfig.applyConfig(p_oConfig,true);} +oConfig.fireQueue();},CSS_CLASS_NAME:"yuimenubaritem",SUBMENU_INDICATOR_IMAGE_PATH:"nt/ic/ut/alt1/menuarodwn8_nrm_1.gif",SELECTED_SUBMENU_INDICATOR_IMAGE_PATH:"nt/ic/ut/alt1/menuarodwn8_hov_1.gif",DISABLED_SUBMENU_INDICATOR_IMAGE_PATH:"nt/ic/ut/alt1/menuarodwn8_dim_1.gif",toString:function(){return("MenuBarItem: "+this.cfg.getProperty("text"));}}); \ No newline at end of file diff --git a/lib/yui/menu/menu.js b/lib/yui/menu/menu.js index 48956e7c9b..fef0b1f340 100755 --- a/lib/yui/menu/menu.js +++ b/lib/yui/menu/menu.js @@ -2,7 +2,7 @@ Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.txt -version: 0.12.0 +version: 0.12.1 */ /** @@ -27,8 +27,8 @@ version: 0.12.0 */ (function() { -var Dom = YAHOO.util.Dom; -var Event = YAHOO.util.Event; +var Dom = YAHOO.util.Dom, + Event = YAHOO.util.Event; /** * Singleton that manages a collection of all menus and menu items. Listens for @@ -39,39 +39,42 @@ var Event = YAHOO.util.Event; * @class MenuManager * @static */ -YAHOO.widget.MenuManager = new function() { +YAHOO.widget.MenuManager = function() { // Private member variables // Flag indicating if the DOM event handlers have been attached - var m_bInitializedEventHandlers = false; + var m_bInitializedEventHandlers = false, - // Collection of menus + // Collection of menus - var m_oMenus = {}; + m_oMenus = {}, - // Collection of menu items + // Collection of menu items - var m_oItems = {}; + m_oItems = {}, - // Collection of visible menus + // Collection of visible menus - var m_oVisibleMenus = {}; + m_oVisibleMenus = {}, - // Logger + // Logger + me = this; + // Private methods /** - * Adds an item to the collection of known menu items. + * @method addItem + * @description Adds an item to the collection of known menu items. * @private * @param {YAHOO.widget.MenuItem} p_oItem Object specifying the MenuItem * instance to be added. */ - var addItem = function(p_oItem) { + function addItem(p_oItem) { var sYUIId = Dom.generateId(); @@ -86,15 +89,16 @@ YAHOO.widget.MenuManager = new function() { } - }; + } /** - * Removes an item from the collection of known menu items. + * @method removeItem + * @description Removes an item from the collection of known menu items. * @private * @param {YAHOO.widget.MenuItem} p_oItem Object specifying the MenuItem * instance to be removed. */ - var removeItem = function(p_oItem) { + function removeItem(p_oItem) { var sYUIId = p_oItem.element.getAttribute("yuiid"); @@ -105,16 +109,18 @@ YAHOO.widget.MenuManager = new function() { } - }; + } /** - * Finds the root DIV node of a menu or the root LI node of a menu item. + * @method getMenuRootElement + * @description Finds the root DIV node of a menu or the root LI node of a + * menu item. * @private * @param {HTMLElement} p_oElement Object specifying * an HTML element. */ - var getMenuRootElement = function(p_oElement) { + function getMenuRootElement(p_oElement) { var oParentNode; @@ -166,12 +172,13 @@ YAHOO.widget.MenuManager = new function() { } - }; + } // Private event handlers /** - * Generic, global event handler for all of a menu's DOM-based + * @method onDOMEvent + * @description Generic, global event handler for all of a menu's DOM-based * events. This listens for events against the document object. If the * target of a given event is a member of a menu or menu item's DOM, the * instance's corresponding Custom Event is fired. @@ -179,18 +186,17 @@ YAHOO.widget.MenuManager = new function() { * @param {Event} p_oEvent Object representing the DOM event object passed * back by the event utility (YAHOO.util.Event). */ - var onDOMEvent = function(p_oEvent) { + function onDOMEvent(p_oEvent) { // Get the target node of the DOM event - var oTarget = Event.getTarget(p_oEvent); + var oTarget = Event.getTarget(p_oEvent), // See if the target of the event was a menu, or a menu item - var oElement = getMenuRootElement(oTarget); - - var oMenuItem; - var oMenu; + oElement = getMenuRootElement(oTarget), + oMenuItem, + oMenu; if(oElement) { @@ -233,9 +239,9 @@ YAHOO.widget.MenuManager = new function() { "keydown": "keyDownEvent", "keyup": "keyUpEvent", "keypress": "keyPressEvent" - }; + }, - var sCustomEventType = oEventTypes[p_oEvent.type]; + sCustomEventType = oEventTypes[p_oEvent.type]; // Fire the Custom Even that corresponds the current DOM event @@ -283,10 +289,11 @@ YAHOO.widget.MenuManager = new function() { } - }; + } /** - * "destroy" event handler for a menu. + * @method onMenuDestroy + * @description "destroy" event handler for a menu. * @private * @param {String} p_sType String representing the name of the event that * was fired. @@ -294,14 +301,20 @@ YAHOO.widget.MenuManager = new function() { * @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that * fired the event. */ - var onMenuDestroy = function(p_sType, p_aArgs, p_oMenu) { + function onMenuDestroy(p_sType, p_aArgs, p_oMenu) { - this.removeMenu(p_oMenu); + if(p_oMenu && m_oMenus[p_oMenu.id]) { - }; + delete m_oMenus[p_oMenu.id]; + + + } + + } /** - * "destroy" event handler for a MenuItem instance. + * @method onItemDestroy + * @description "destroy" event handler for a MenuItem instance. * @private * @param {String} p_sType String representing the name of the event that * was fired. @@ -309,7 +322,7 @@ YAHOO.widget.MenuManager = new function() { * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item * that fired the event. */ - var onItemDestroy = function(p_sType, p_aArgs, p_oItem) { + function onItemDestroy(p_sType, p_aArgs, p_oItem) { var sYUIId = p_oItem.element.getAttribute("yuiid"); @@ -319,10 +332,11 @@ YAHOO.widget.MenuManager = new function() { } - }; + } /** - * Event handler for when the "visible" configuration property + * @method onMenuVisibleConfigChange + * @description Event handler for when the "visible" configuration property * of a Menu instance changes. * @private * @param {String} p_sType String representing the name of the event that @@ -331,7 +345,7 @@ YAHOO.widget.MenuManager = new function() { * @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that * fired the event. */ - var onMenuVisibleConfigChange = function(p_sType, p_aArgs, p_oMenu) { + function onMenuVisibleConfigChange(p_sType, p_aArgs, p_oMenu) { var bVisible = p_aArgs[0]; @@ -348,3465 +362,3667 @@ YAHOO.widget.MenuManager = new function() { } - }; - - /** - * "itemadded" event handler for a Menu instance. - * @private - * @param {String} p_sType String representing the name of the event that - * was fired. - * @param {Array} p_aArgs Array of arguments sent when the event was fired. - */ - var onItemAdded = function(p_sType, p_aArgs) { - - addItem(p_aArgs[0]); - - }; - - - /** - * "itemremoved" event handler for a Menu instance. - * @private - * @param {String} p_sType String representing the name of the event that - * was fired. - * @param {Array} p_aArgs Array of arguments sent when the event was fired. - */ - var onItemRemoved = function(p_sType, p_aArgs) { - - removeItem(p_aArgs[0]); - - }; - - // Privileged methods - - /** - * @method addMenu - * @description Adds a menu to the collection of known menus. - * @param {YAHOO.widget.Menu} p_oMenu Object specifying the Menu instance - * to be added. - */ - this.addMenu = function(p_oMenu) { - - if(p_oMenu && p_oMenu.id && !m_oMenus[p_oMenu.id]) { - - m_oMenus[p_oMenu.id] = p_oMenu; - - - if(!m_bInitializedEventHandlers) { - - var oDoc = document; - - Event.addListener(oDoc, "mouseover", onDOMEvent, this, true); - Event.addListener(oDoc, "mouseout", onDOMEvent, this, true); - Event.addListener(oDoc, "mousedown", onDOMEvent, this, true); - Event.addListener(oDoc, "mouseup", onDOMEvent, this, true); - Event.addListener(oDoc, "click", onDOMEvent, this, true); - Event.addListener(oDoc, "keydown", onDOMEvent, this, true); - Event.addListener(oDoc, "keyup", onDOMEvent, this, true); - Event.addListener(oDoc, "keypress", onDOMEvent, this, true); - - m_bInitializedEventHandlers = true; - - - } - - p_oMenu.destroyEvent.subscribe(onMenuDestroy, p_oMenu, this); - - p_oMenu.cfg.subscribeToConfigEvent( - "visible", - onMenuVisibleConfigChange, - p_oMenu - ); - - p_oMenu.itemAddedEvent.subscribe(onItemAdded); - p_oMenu.itemRemovedEvent.subscribe(onItemRemoved); - - - } - - }; - - /** - * @method removeMenu - * @description Removes a menu from the collection of known menus. - * @param {YAHOO.widget.Menu} p_oMenu Object specifying the Menu instance - * to be removed. - */ - this.removeMenu = function(p_oMenu) { - - if(p_oMenu && m_oMenus[p_oMenu.id]) { - - delete m_oMenus[p_oMenu.id]; - - - } - - }; - - /** - * @method hideVisible - * @description Hides all visible, dynamically positioned menus. - */ - this.hideVisible = function() { - - var oMenu; - - for(var i in m_oVisibleMenus) { - - if(m_oVisibleMenus.hasOwnProperty(i)) { - - oMenu = m_oVisibleMenus[i]; - - if(oMenu.cfg.getProperty("position") == "dynamic") { - - oMenu.hide(); - - } - - } - - } - - }; - - /** - * @method getMenus - * @description Returns an array of all menus registered with the - * menu manger. - * @return {Array} - */ - this.getMenus = function() { - - return m_oMenus; - - }; - - /** - * @method getMenu - * @description Returns a menu with the specified id. - * @param {String} p_sId String specifying the id of the menu to - * be retrieved. - * @return {YAHOO.widget.Menu} - */ - this.getMenu = function(p_sId) { - - if(m_oMenus[p_sId]) { - - return m_oMenus[p_sId]; - - } - - }; - - - /** - * @method toString - * @description Returns a string representing the menu manager. - * @return {String} - */ - this.toString = function() { - - return ("MenuManager"); - - }; - -}; - -})(); - -(function() { - -var Dom = YAHOO.util.Dom; -var Event = YAHOO.util.Event; - -/** -* The Menu class creates a container that holds a vertical list representing -* a set of options or commands. Menu is the base class for all -* menu containers. -* @param {String} p_oElement String specifying the id attribute of the -* <div> element of the menu. -* @param {String} p_oElement String specifying the id attribute of the -* <select> element to be used as the data source -* for the menu. -* @param {HTMLDivElement} p_oElement Object -* specifying the <div> element of the menu. -* @param {HTMLSelectElement} p_oElement -* Object specifying the <select> element to be used as -* the data source for the menu. -* @param {Object} p_oConfig Optional. Object literal specifying the -* configuration for the menu. See configuration class documentation for -* more details. -* @namespace YAHOO.widget -* @class Menu -* @constructor -* @extends YAHOO.widget.Overlay -*/ -YAHOO.widget.Menu = function(p_oElement, p_oConfig) { - - if(p_oConfig) { - - this.parent = p_oConfig.parent; - - this.lazyLoad = p_oConfig.lazyLoad || p_oConfig.lazyload; - - this.itemData = p_oConfig.itemData || p_oConfig.itemdata; - } - YAHOO.widget.Menu.superclass.constructor.call( - this, - p_oElement, - p_oConfig - ); - -}; - -YAHOO.extend(YAHOO.widget.Menu, YAHOO.widget.Overlay, { - -// Constants - -/** -* @property CSS_CLASS_NAME -* @description String representing the CSS class(es) to be applied to the -* menu's <div> element. -* @default "yuimenu" -* @final -* @type String -*/ -CSS_CLASS_NAME: "yuimenu", - -/** -* @property ITEM_TYPE -* @description Object representing the type of menu item to instantiate and -* add when parsing the child nodes (either <li> element, -* <optgroup> element or <option>) -* of the menu's source HTML element. -* @default YAHOO.widget.MenuItem -* @final -* @type YAHOO.widget.MenuItem -*/ -ITEM_TYPE: null, - -/** -* @property GROUP_TITLE_TAG_NAME -* @description String representing the tagname of the HTML element used to -* title the menu's item groups. -* @default H6 -* @final -* @type String -*/ -GROUP_TITLE_TAG_NAME: "h6", - -// Private properties - -/** -* @property _nHideDelayId -* @description Number representing the time-out setting used to cancel the -* hiding of a menu. -* @default null -* @private -* @type Number -*/ -_nHideDelayId: null, - -/** -* @property _nShowDelayId -* @description Number representing the time-out setting used to cancel the -* showing of a menu. -* @default null -* @private -* @type Number -*/ -_nShowDelayId: null, - -/** -* @property _hideDelayEventHandlersAssigned -* @description Boolean indicating if the "mouseover" and "mouseout" event -* handlers used for hiding the menu via a call to "window.setTimeout" have -* already been assigned. -* @default false -* @private -* @type Boolean -*/ -_hideDelayEventHandlersAssigned: false, - -/** -* @property _bHandledMouseOverEvent -* @description Boolean indicating the current state of the menu's -* "mouseover" event. -* @default false -* @private -* @type Boolean -*/ -_bHandledMouseOverEvent: false, - -/** -* @property _bHandledMouseOutEvent -* @description Boolean indicating the current state of the menu's -* "mouseout" event. -* @default false -* @private -* @type Boolean -*/ -_bHandledMouseOutEvent: false, - -/** -* @property _aGroupTitleElements -* @description Array of HTML element used to title groups of menu items. -* @default [] -* @private -* @type Array -*/ -_aGroupTitleElements: null, - -/** -* @property _aItemGroups -* @description Array of menu items. -* @default [] -* @private -* @type Array -*/ -_aItemGroups: null, - -/** -* @property _aListElements -* @description Array of <ul> elements, each of which is -* the parent node for each item's <li> element. -* @default [] -* @private -* @type Array -*/ -_aListElements: null, - -// Public properties - -/** -* @property lazyLoad -* @description Boolean indicating if the menu's "lazy load" feature is -* enabled. If set to "true," initialization and rendering of the menu's -* items will be deferred until the first time it is made visible. This -* property should be set via the constructor using the configuration -* object literal. -* @default false -* @type Boolean -*/ -lazyLoad: false, - -/** -* @property itemData -* @description Array of items to be added to the menu. The array can contain -* strings representing the text for each item to be created, object literals -* representing the menu item configuration properties, or MenuItem instances. -* This property should be set via the constructor using the configuration -* object literal. -* @default null -* @type Array -*/ -itemData: null, - -/** -* @property activeItem -* @description Object reference to the item in the menu that has focus. -* @default null -* @type YAHOO.widget.MenuItem -*/ -activeItem: null, - -/** -* @property parent -* @description Object reference to the menu's parent menu or menu item. -* This property can be set via the constructor using the configuration -* object literal. -* @default null -* @type YAHOO.widget.MenuItem -*/ -parent: null, - -/** -* @property srcElement -* @description Object reference to the HTML element (either -* <select> or <div>) used to -* create the menu. -* @default null -* @type HTMLSelectElement|HTMLDivElement -*/ -srcElement: null, - -// Events - -/** -* @event mouseOverEvent -* @description Fires when the mouse has entered the menu. Passes back -* the DOM Event object as an argument. -*/ -mouseOverEvent: null, - -/** -* @event mouseOutEvent -* @description Fires when the mouse has left the menu. Passes back the DOM -* Event object as an argument. -* @type YAHOO.util.CustomEvent -*/ -mouseOutEvent: null, - -/** -* @event mouseDownEvent -* @description Fires when the user mouses down on the menu. Passes back the -* DOM Event object as an argument. -* @type YAHOO.util.CustomEvent -*/ -mouseDownEvent: null, - -/** -* @event mouseUpEvent -* @description Fires when the user releases a mouse button while the mouse is -* over the menu. Passes back the DOM Event object as an argument. -* @type YAHOO.util.CustomEvent -*/ -mouseUpEvent: null, - -/** -* @event clickEvent -* @description Fires when the user clicks the on the menu. Passes back the -* DOM Event object as an argument. -* @type YAHOO.util.CustomEvent -*/ -clickEvent: null, - -/** -* @event keyPressEvent -* @description Fires when the user presses an alphanumeric key when one of the -* menu's items has focus. Passes back the DOM Event object as an argument. -* @type YAHOO.util.CustomEvent -*/ -keyPressEvent: null, - -/** -* @event keyDownEvent -* @description Fires when the user presses a key when one of the menu's items -* has focus. Passes back the DOM Event object as an argument. -* @type YAHOO.util.CustomEvent -*/ -keyDownEvent: null, - -/** -* @event keyUpEvent -* @description Fires when the user releases a key when one of the menu's items -* has focus. Passes back the DOM Event object as an argument. -* @type YAHOO.util.CustomEvent -*/ -keyUpEvent: null, - -/** -* @event itemAddedEvent -* @description Fires when an item is added to the menu. -* @type YAHOO.util.CustomEvent -*/ -itemAddedEvent: null, - -/** -* @event itemRemovedEvent -* @description Fires when an item is removed to the menu. -* @type YAHOO.util.CustomEvent -*/ -itemRemovedEvent: null, - -/** -* @method init -* @description The Menu class's initialization method. This method is -* automatically called by the constructor, and sets up all DOM references -* for pre-existing markup, and creates required markup if it is not -* already present. -* @param {String} p_oElement String specifying the id attribute of the -* <div> element of the menu. -* @param {String} p_oElement String specifying the id attribute of the -* <select> element to be used as the data source -* for the menu. -* @param {HTMLDivElement} p_oElement Object -* specifying the <div> element of the menu. -* @param {HTMLSelectElement} p_oElement -* Object specifying the <select> element to be used as -* the data source for the menu. -* @param {Object} p_oConfig Optional. Object literal specifying the -* configuration for the menu. See configuration class documentation for -* more details. -*/ -init: function(p_oElement, p_oConfig) { - - this._aItemGroups = []; - this._aListElements = []; - this._aGroupTitleElements = []; - - if(!this.ITEM_TYPE) { - - this.ITEM_TYPE = YAHOO.widget.MenuItem; - - } - - var oElement; - - if(typeof p_oElement == "string") { - - oElement = document.getElementById(p_oElement); - - } - else if(p_oElement.tagName) { - - oElement = p_oElement; - - } - - if(oElement && oElement.tagName) { - - switch(oElement.tagName.toUpperCase()) { - - case "DIV": - - this.srcElement = oElement; - - if(!oElement.id) { - - oElement.setAttribute("id", Dom.generateId()); - - } - - /* - Note: we don't pass the user config in here yet - because we only want it executed once, at the lowest - subclass level. - */ - - YAHOO.widget.Menu.superclass.init.call(this, oElement); - - this.beforeInitEvent.fire(YAHOO.widget.Menu); - - - break; - - case "SELECT": - - this.srcElement = oElement; - - - /* - The source element is not something that we can use - outright, so we need to create a new Overlay - - Note: we don't pass the user config in here yet - because we only want it executed once, at the lowest - subclass level. - */ - - YAHOO.widget.Menu.superclass.init.call(this, Dom.generateId()); - - this.beforeInitEvent.fire(YAHOO.widget.Menu); - - break; - - } - - } - else { - - /* - Note: we don't pass the user config in here yet - because we only want it executed once, at the lowest - subclass level. - */ - - YAHOO.widget.Menu.superclass.init.call(this, p_oElement); - - this.beforeInitEvent.fire(YAHOO.widget.Menu); - - } - - if(this.element) { - - var oEl = this.element; - - Dom.addClass(oEl, this.CSS_CLASS_NAME); - - // Subscribe to Custom Events - - this.initEvent.subscribe(this._onInit, this, true); - this.beforeRenderEvent.subscribe(this._onBeforeRender, this, true); - this.renderEvent.subscribe(this._onRender, this, true); - this.beforeShowEvent.subscribe(this._onBeforeShow, this, true); - this.showEvent.subscribe(this._onShow, this, true); - this.beforeHideEvent.subscribe(this._onBeforeHide, this, true); - this.mouseOverEvent.subscribe(this._onMouseOver, this, true); - this.mouseOutEvent.subscribe(this._onMouseOut, this, true); - this.clickEvent.subscribe(this._onClick, this, true); - this.keyDownEvent.subscribe(this._onKeyDown, this, true); - - if(p_oConfig) { - - this.cfg.applyConfig(p_oConfig, true); - - } - - // Register the Menu instance with the MenuManager - - YAHOO.widget.MenuManager.addMenu(this); - - - this.initEvent.fire(YAHOO.widget.Menu); - - } - -}, - -// Private methods - -/** -* @method _initSubTree -* @description Iterates the childNodes of the source element to find nodes -* used to instantiate menu and menu items. -* @private -*/ -_initSubTree: function() { - - var oNode; - - if(this.srcElement.tagName == "DIV") { - - /* - Populate the collection of item groups and item - group titles - */ - - oNode = this.body.firstChild; - - var nGroup = 0; - var sGroupTitleTagName = this.GROUP_TITLE_TAG_NAME.toUpperCase(); - - do { - - if(oNode && oNode.tagName) { - - switch(oNode.tagName.toUpperCase()) { - - case sGroupTitleTagName: - - this._aGroupTitleElements[nGroup] = oNode; - - break; - - case "UL": - - this._aListElements[nGroup] = oNode; - this._aItemGroups[nGroup] = []; - nGroup++; - - break; - - } - - } - - } - while((oNode = oNode.nextSibling)); - - /* - Apply the "first-of-type" class to the first UL to mimic - the "first-of-type" CSS3 psuedo class. - */ - - if(this._aListElements[0]) { - - Dom.addClass(this._aListElements[0], "first-of-type"); - - } - - } - - oNode = null; - - if(this.srcElement.tagName) { - - switch(this.srcElement.tagName.toUpperCase()) { - - case "DIV": - - if(this._aListElements.length > 0) { - - - var i = this._aListElements.length - 1; - - do { - - oNode = this._aListElements[i].firstChild; - - - do { - - if(oNode && oNode.tagName) { - - switch(oNode.tagName.toUpperCase()) { - - case "LI": - - - this.addItem( - new this.ITEM_TYPE( - oNode, - { parent: this } - ), - i - ); - - break; - - } - - } - - } - while((oNode = oNode.nextSibling)); - - } - while(i--); - - } - - break; - - case "SELECT": - - - oNode = this.srcElement.firstChild; - - do { - - if(oNode && oNode.tagName) { - - switch(oNode.tagName.toUpperCase()) { - - case "OPTGROUP": - case "OPTION": - - - this.addItem( - new this.ITEM_TYPE( - oNode, - { parent: this } - ) - ); - - break; - - } - - } - - } - while((oNode = oNode.nextSibling)); - - break; - - } - - } - -}, - -/** -* @method _getFirstEnabledItem -* @description Returns the first enabled item in the menu. -* @return {YAHOO.widget.MenuItem} -* @private -*/ -_getFirstEnabledItem: function() { - - var nGroups = this._aItemGroups.length; - var oItem; - var aItemGroup; - - for(var i=0; i= aGroup.length); - - if(aGroup[p_nItemIndex]) { - - aGroup.splice(p_nItemIndex, 0, oItem); - - } - else { - - aGroup[p_nItemIndex] = oItem; - - } - - oGroupItem = aGroup[p_nItemIndex]; - - if(oGroupItem) { - - if( - bAppend && - ( - !oGroupItem.element.parentNode || - oGroupItem.element.parentNode.nodeType == 11 - ) - ) { - - this._aListElements[nGroupIndex].appendChild( - oGroupItem.element - ); - - } - else { - - - /** - * Returns the next sibling of an item in an array. - * @private - * @param {p_aArray} Array to search. - * @param {p_nStartIndex} Number indicating the index to - * start searching the array. - * @return {Object} - */ - var getNextItemSibling = - - function(p_aArray, p_nStartIndex) { - - return ( - p_aArray[p_nStartIndex] || - getNextItemSibling( - p_aArray, - (p_nStartIndex+1) - ) - ); - - }; - - - var oNextItemSibling = - getNextItemSibling(aGroup, (p_nItemIndex+1)); - - if( - oNextItemSibling && - ( - !oGroupItem.element.parentNode || - oGroupItem.element.parentNode.nodeType == 11 - ) - ) { - - this._aListElements[nGroupIndex].insertBefore( - oGroupItem.element, - oNextItemSibling.element - ); - - } - - } - - - oGroupItem.parent = this; - - this._subscribeToItemEvents(oGroupItem); - - this._configureSubmenu(oGroupItem); - - this._updateItemProperties(nGroupIndex); - - - this.itemAddedEvent.fire(oGroupItem); - - return oGroupItem; - - } - - } - else { - - var nItemIndex = aGroup.length; - - aGroup[nItemIndex] = oItem; - - oGroupItem = aGroup[nItemIndex]; - - - if(oGroupItem) { - - if( - !Dom.isAncestor( - this._aListElements[nGroupIndex], - oGroupItem.element - ) - ) { - - this._aListElements[nGroupIndex].appendChild( - oGroupItem.element - ); - - } - - oGroupItem.element.setAttribute("groupindex", nGroupIndex); - oGroupItem.element.setAttribute("index", nItemIndex); - - oGroupItem.parent = this; - - oGroupItem.index = nItemIndex; - oGroupItem.groupIndex = nGroupIndex; - - this._subscribeToItemEvents(oGroupItem); - - this._configureSubmenu(oGroupItem); - - if(nItemIndex === 0) { - - Dom.addClass(oGroupItem.element, "first-of-type"); - - } - - - - this.itemAddedEvent.fire(oGroupItem); - - return oGroupItem; - - } - - } - - } - -}, - -/** -* @method _removeItemFromGroupByIndex -* @description Removes a menu item from a group by index. Returns the menu -* item that was removed. -* @private -* @param {Number} p_nGroupIndex Number indicating the group to which the menu -* item belongs. -* @param {Number} p_nItemIndex Number indicating the index of the menu item -* to be removed. -* @return {YAHOO.widget.MenuItem} -*/ -_removeItemFromGroupByIndex: function(p_nGroupIndex, p_nItemIndex) { - - var nGroupIndex = typeof p_nGroupIndex == "number" ? p_nGroupIndex : 0; - var aGroup = this._getItemGroup(nGroupIndex); - - if(aGroup) { - - var aArray = aGroup.splice(p_nItemIndex, 1); - var oItem = aArray[0]; - - if(oItem) { - - // Update the index and className properties of each member - - this._updateItemProperties(nGroupIndex); - - if(aGroup.length === 0) { - - // Remove the UL - - var oUL = this._aListElements[nGroupIndex]; - - if(this.body && oUL) { - - this.body.removeChild(oUL); - - } - - // Remove the group from the array of items - - this._aItemGroups.splice(nGroupIndex, 1); - - - // Remove the UL from the array of ULs - - this._aListElements.splice(nGroupIndex, 1); - - - /* - Assign the "first-of-type" class to the new first UL - in the collection - */ - - oUL = this._aListElements[0]; - - if(oUL) { - - Dom.addClass(oUL, "first-of-type"); - - } - - } - - - this.itemRemovedEvent.fire(oItem); - - // Return a reference to the item that was removed - - return oItem; - - } - - } - -}, - -/** -* @method _removeItemFromGroupByValue -* @description Removes a menu item from a group by reference. Returns the -* menu item that was removed. -* @private -* @param {Number} p_nGroupIndex Number indicating the group to which the -* menu item belongs. -* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem -* instance to be removed. -* @return {YAHOO.widget.MenuItem} -*/ -_removeItemFromGroupByValue: function(p_nGroupIndex, p_oItem) { - - var aGroup = this._getItemGroup(p_nGroupIndex); - - if(aGroup) { - - var nItems = aGroup.length; - var nItemIndex = -1; - - if(nItems > 0) { - - var i = nItems-1; - - do { - - if(aGroup[i] == p_oItem) { - - nItemIndex = i; - break; - - } - - } - while(i--); - - if(nItemIndex > -1) { - - return this._removeItemFromGroupByIndex( - p_nGroupIndex, - nItemIndex - ); - - } - - } - - } - -}, - -/** -* @method _updateItemProperties -* @description Updates the "index," "groupindex," and "className" properties -* of the menu items in the specified group. -* @private -* @param {Number} p_nGroupIndex Number indicating the group of items to update. -*/ -_updateItemProperties: function(p_nGroupIndex) { - - var aGroup = this._getItemGroup(p_nGroupIndex); - var nItems = aGroup.length; - - if(nItems > 0) { - - var i = nItems - 1; - var oItem; - var oLI; - - // Update the index and className properties of each member - - do { - - oItem = aGroup[i]; - - if(oItem) { - - oLI = oItem.element; - - oItem.index = i; - oItem.groupIndex = p_nGroupIndex; - - oLI.setAttribute("groupindex", p_nGroupIndex); - oLI.setAttribute("index", i); - - Dom.removeClass(oLI, "first-of-type"); - - } - - } - while(i--); - - if(oLI) { - - Dom.addClass(oLI, "first-of-type"); - - } - - } - -}, - -/** -* @method _createItemGroup -* @description Creates a new menu item group (array) and its associated -* <ul> element. Returns an aray of menu item groups. -* @private -* @param {Number} p_nIndex Number indicating the group to create. -* @return {Array} -*/ -_createItemGroup: function(p_nIndex) { - - if(!this._aItemGroups[p_nIndex]) { - - this._aItemGroups[p_nIndex] = []; - - var oUL = document.createElement("ul"); - - this._aListElements[p_nIndex] = oUL; - - return this._aItemGroups[p_nIndex]; - - } - -}, - -/** -* @method _getItemGroup -* @description Returns the menu item group at the specified index. -* @private -* @param {Number} p_nIndex Number indicating the index of the menu item group -* to be retrieved. -* @return {Array} -*/ -_getItemGroup: function(p_nIndex) { - - var nIndex = ((typeof p_nIndex == "number") ? p_nIndex : 0); - - return this._aItemGroups[nIndex]; - -}, - -/** -* @method _configureSubmenu -* @description Subscribes the menu item's submenu to its parent menu's events. -* @private -* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem -* instance with the submenu to be configured. -*/ -_configureSubmenu: function(p_oItem) { - - var oSubmenu = p_oItem.cfg.getProperty("submenu"); - - if(oSubmenu) { - - /* - Listen for configuration changes to the parent menu - so they they can be applied to the submenu. - */ - - this.cfg.configChangedEvent.subscribe( - this._onParentMenuConfigChange, - oSubmenu, - true - ); - - this.renderEvent.subscribe( - this._onParentMenuRender, - oSubmenu, - true - ); - - oSubmenu.beforeShowEvent.subscribe( - this._onSubmenuBeforeShow, - oSubmenu, - true - ); - - oSubmenu.showEvent.subscribe( - this._onSubmenuShow, - oSubmenu, - true - ); - - oSubmenu.hideEvent.subscribe( - this._onSubmenuHide, - oSubmenu, - true - ); - - } - -}, - -/** -* @method _subscribeToItemEvents -* @description Subscribes a menu to a menu item's event. -* @private -* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem -* instance whose events should be subscribed to. -*/ -_subscribeToItemEvents: function(p_oItem) { - - p_oItem.focusEvent.subscribe(this._onMenuItemFocus, p_oItem, this); - - p_oItem.blurEvent.subscribe(this._onMenuItemBlur, this, true); - - p_oItem.cfg.configChangedEvent.subscribe( - this._onMenuItemConfigChange, - p_oItem, - this - ); - -}, - -/** -* @method _getOffsetWidth -* @description Returns the offset width of the menu's -* <div> element. -* @private -*/ -_getOffsetWidth: function() { - - var oClone = this.element.cloneNode(true); - - Dom.setStyle(oClone, "width", ""); - - document.body.appendChild(oClone); - - var sWidth = oClone.offsetWidth; - - document.body.removeChild(oClone); - - return sWidth; - -}, - -/** -* @method _cancelHideDelay -* @description Cancels the call to "hideMenu." -* @private -*/ -_cancelHideDelay: function() { - - var oRoot = this.getRoot(); - - if(oRoot._nHideDelayId) { - - window.clearTimeout(oRoot._nHideDelayId); - - } - -}, - -/** -* @method _execHideDelay -* @description Hides the menu after the number of milliseconds specified by -* the "hidedelay" configuration property. -* @private -*/ -_execHideDelay: function() { - - this._cancelHideDelay(); - - var oRoot = this.getRoot(); - var me = this; - - var hideMenu = function() { - - if(oRoot.activeItem) { - - oRoot.clearActiveItem(); - - } - - if(oRoot == me && me.cfg.getProperty("position") == "dynamic") { - - me.hide(); - - } - - }; - - oRoot._nHideDelayId = - window.setTimeout(hideMenu, oRoot.cfg.getProperty("hidedelay")); - -}, - -/** -* @method _cancelShowDelay -* @description Cancels the call to the "showMenu." -* @private -*/ -_cancelShowDelay: function() { - - var oRoot = this.getRoot(); - - if(oRoot._nShowDelayId) { - - window.clearTimeout(oRoot._nShowDelayId); - - } - -}, - -/** -* @method _execShowDelay -* @description Shows the menu after the number of milliseconds specified by -* the "showdelay" configuration property have ellapsed. -* @private -* @param {YAHOO.widget.Menu} p_oMenu Object specifying the menu that should -* be made visible. -*/ -_execShowDelay: function(p_oMenu) { - - this._cancelShowDelay(); - - var oRoot = this.getRoot(); - - var showMenu = function() { - - p_oMenu.show(); - - }; - - oRoot._nShowDelayId = - window.setTimeout(showMenu, oRoot.cfg.getProperty("showdelay")); - -}, - -// Protected methods - -/** -* @method _onMouseOver -* @description "mouseover" event handler for the menu. -* @protected -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that -* fired the event. -*/ -_onMouseOver: function(p_sType, p_aArgs, p_oMenu) { - - var oEvent = p_aArgs[0]; - var oItem = p_aArgs[1]; - var oTarget = Event.getTarget(oEvent); - - if( - !this._bHandledMouseOverEvent && - (oTarget == this.element || Dom.isAncestor(this.element, oTarget)) - ) { - - // MENU MOUSEOVER LOGIC HERE - - this.clearActiveItem(); - - this._bHandledMouseOverEvent = true; - this._bHandledMouseOutEvent = false; - - } - - if( - oItem && !oItem.handledMouseOverEvent && - (oTarget == oItem.element || Dom.isAncestor(oItem.element, oTarget)) - ) { - - var oItemCfg = oItem.cfg; - - // Select and focus the current menu item - - oItemCfg.setProperty("selected", true); - oItem.focus(); - - if(this.cfg.getProperty("autosubmenudisplay")) { - - // Show the submenu this menu item - - var oSubmenu = oItemCfg.getProperty("submenu"); - - if(oSubmenu) { - - if(this.cfg.getProperty("showdelay") > 0) { - - this._execShowDelay(oSubmenu); - - } - else { - - oSubmenu.show(); - - } - - } - - } - - oItem.handledMouseOverEvent = true; - oItem.handledMouseOutEvent = false; - - } - -}, - -/** -* @method _onMouseOut -* @description "mouseout" event handler for the menu. -* @protected -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that -* fired the event. -*/ -_onMouseOut: function(p_sType, p_aArgs, p_oMenu) { - - var oEvent = p_aArgs[0]; - var oItem = p_aArgs[1]; - var oRelatedTarget = Event.getRelatedTarget(oEvent); - var bMovingToSubmenu = false; - - if(oItem) { - - var oItemCfg = oItem.cfg; - var oSubmenu = oItemCfg.getProperty("submenu"); - - if( - oSubmenu && - ( - oRelatedTarget == oSubmenu.element || - Dom.isAncestor(oSubmenu.element, oRelatedTarget) - ) - ) { - - bMovingToSubmenu = true; - - } - - if( - !oItem.handledMouseOutEvent && - ( - ( - oRelatedTarget != oItem.element && - !Dom.isAncestor(oItem.element, oRelatedTarget) - ) || bMovingToSubmenu - ) - ) { - - if(this.cfg.getProperty("showdelay") > 0) { - - this._cancelShowDelay(); - - } - - if(!bMovingToSubmenu) { - - oItemCfg.setProperty("selected", false); - - } - - if(this.cfg.getProperty("autosubmenudisplay")) { - - if(oSubmenu) { - - if( - !( - oRelatedTarget == oSubmenu.element || - YAHOO.util.Dom.isAncestor( - oSubmenu.element, - oRelatedTarget - ) - ) - ) { - - oSubmenu.hide(); - - } - - } - - } - - oItem.handledMouseOutEvent = true; - oItem.handledMouseOverEvent = false; - - } - - } - - if( - !this._bHandledMouseOutEvent && - ( - ( - oRelatedTarget != this.element && - !Dom.isAncestor(this.element, oRelatedTarget) - ) - || bMovingToSubmenu - ) - ) { - - this._bHandledMouseOutEvent = true; - this._bHandledMouseOverEvent = false; - - } - -}, - -/** -* @method _onClick -* @description "click" event handler for the menu. -* @protected -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that -* fired the event. -*/ -_onClick: function(p_sType, p_aArgs, p_oMenu) { - - var oEvent = p_aArgs[0]; - var oItem = p_aArgs[1]; - var oTarget = Event.getTarget(oEvent); - - if(oItem) { - - var oItemCfg = oItem.cfg; - var oSubmenu = oItemCfg.getProperty("submenu"); - - /* - ACCESSIBILITY FEATURE FOR SCREEN READERS: - Expand/collapse the submenu when the user clicks - on the submenu indicator image. - */ - - if(oTarget == oItem.submenuIndicator && oSubmenu) { - - if(oSubmenu.cfg.getProperty("visible")) { - - oSubmenu.hide(); - - } - else { - - this.clearActiveItem(); - - this.activeItem = oItem; - - oItem.cfg.setProperty("selected", true); - - oSubmenu.show(); - - } - - } - else { - - var sURL = oItemCfg.getProperty("url"); - var bCurrentPageURL = (sURL.substr((sURL.length-1),1) == "#"); - var sTarget = oItemCfg.getProperty("target"); - var bHasTarget = (sTarget && sTarget.length > 0); - - /* - Prevent the browser from following links - equal to "#" - */ - - if( - oTarget.tagName.toUpperCase() == "A" && - bCurrentPageURL && !bHasTarget - ) { - - Event.preventDefault(oEvent); - - } - - if( - oTarget.tagName.toUpperCase() != "A" && - !bCurrentPageURL && !bHasTarget - ) { - - /* - Follow the URL of the item regardless of - whether or not the user clicked specifically - on the anchor element. - */ - - document.location = sURL; - - } - - /* - If the item doesn't navigate to a URL and it doesn't have - a submenu, then collapse the menu tree. - */ - - if(bCurrentPageURL && !oSubmenu) { - - var oRoot = this.getRoot(); - - if(oRoot.cfg.getProperty("position") == "static") { - - oRoot.clearActiveItem(); - - } - else { - - oRoot.hide(); - - } - - } - - } - - } - -}, - -/** -* @method _onKeyDown -* @description "keydown" event handler for the menu. -* @protected -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that -* fired the event. -*/ -_onKeyDown: function(p_sType, p_aArgs, p_oMenu) { - - var oEvent = p_aArgs[0]; - var oItem = p_aArgs[1]; - var oSubmenu; - - if(oItem) { - - var oItemCfg = oItem.cfg; - var oParentItem = this.parent; - var oRoot; - var oNextItem; - - switch(oEvent.keyCode) { - - case 38: // Up arrow - case 40: // Down arrow - - if( - oItem == this.activeItem && - !oItemCfg.getProperty("selected") - ) { - - oItemCfg.setProperty("selected", true); - - } - else { - - oNextItem = (oEvent.keyCode == 38) ? - oItem.getPreviousEnabledSibling() : - oItem.getNextEnabledSibling(); - - if(oNextItem) { - - this.clearActiveItem(); - - oNextItem.cfg.setProperty("selected", true); - oNextItem.focus(); - - } - - } - - Event.preventDefault(oEvent); - - break; - - - case 39: // Right arrow - - oSubmenu = oItemCfg.getProperty("submenu"); - - if(oSubmenu) { - - if(!oItemCfg.getProperty("selected")) { - - oItemCfg.setProperty("selected", true); - - } - - oSubmenu.show(); - - oSubmenu.setInitialSelection(); - - } - else { - - oRoot = this.getRoot(); - - if(oRoot instanceof YAHOO.widget.MenuBar) { - - oNextItem = oRoot.activeItem.getNextEnabledSibling(); - - if(oNextItem) { - - oRoot.clearActiveItem(); - - oNextItem.cfg.setProperty("selected", true); - - oSubmenu = oNextItem.cfg.getProperty("submenu"); - - if(oSubmenu) { - - oSubmenu.show(); - - } - - oNextItem.focus(); - - } - - } - - } - - - Event.preventDefault(oEvent); - - break; - - - case 37: // Left arrow - - if(oParentItem) { - - var oParentMenu = oParentItem.parent; - - if(oParentMenu instanceof YAHOO.widget.MenuBar) { - - oNextItem = - oParentMenu.activeItem.getPreviousEnabledSibling(); - - if(oNextItem) { - - oParentMenu.clearActiveItem(); - - oNextItem.cfg.setProperty("selected", true); - - oSubmenu = oNextItem.cfg.getProperty("submenu"); - - if(oSubmenu) { - - oSubmenu.show(); - - } - - oNextItem.focus(); - - } - - } - else { - - this.hide(); - - oParentItem.focus(); - - } - - } - - Event.preventDefault(oEvent); - - break; - - } - - } - - if(oEvent.keyCode == 27) { // Esc key - - if(this.cfg.getProperty("position") == "dynamic") { - - this.hide(); - - if(this.parent) { - - this.parent.focus(); - - } - - } - else if(this.activeItem) { - - oSubmenu = this.activeItem.cfg.getProperty("submenu"); - - if(oSubmenu && oSubmenu.cfg.getProperty("visible")) { - - oSubmenu.hide(); - this.activeItem.focus(); - - } - else { - - this.activeItem.cfg.setProperty("selected", false); - this.activeItem.blur(); - - } - - } - - Event.preventDefault(oEvent); - - } - -}, - -// Private methods - -/** -* @method _onInit -* @description "init" event handler for the menu. -* @private -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that -* fired the event. -*/ -_onInit: function(p_sType, p_aArgs, p_oMenu) { - - if( - ( - (this.parent && !this.lazyLoad) || - (!this.parent && this.cfg.getProperty("position") == "static") || - ( - !this.parent && - !this.lazyLoad && - this.cfg.getProperty("position") == "dynamic" - ) - ) && - this.getItemGroups().length === 0 - ) { - - if(this.srcElement) { - - this._initSubTree(); - - } - - if(this.itemData) { - - this.addItems(this.itemData); - - } - - } - else if(this.lazyLoad) { - - this.cfg.fireQueue(); - - } - -}, - -/** -* @method _onBeforeRender -* @description "beforerender" event handler for the menu. Appends all of the -* <ul>, <li> and their accompanying -* title elements to the body element of the menu. -* @private -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that -* fired the event. -*/ -_onBeforeRender: function(p_sType, p_aArgs, p_oMenu) { - - var oConfig = this.cfg; - var oEl = this.element; - var nListElements = this._aListElements.length; - - if(nListElements > 0) { - - var i = 0; - var bFirstList = true; - var oUL; - var oGroupTitle; - - do { - - oUL = this._aListElements[i]; - - if(oUL) { - - if(bFirstList) { - - Dom.addClass(oUL, "first-of-type"); - bFirstList = false; - - } - - if(!Dom.isAncestor(oEl, oUL)) { - - this.appendToBody(oUL); - - } - - oGroupTitle = this._aGroupTitleElements[i]; - - if(oGroupTitle) { - - if(!Dom.isAncestor(oEl, oGroupTitle)) { - - oUL.parentNode.insertBefore(oGroupTitle, oUL); - - } - - Dom.addClass(oUL, "hastitle"); - - } - - } - - i++; - - } - while(i < nListElements); - - } - -}, - -/** -* @method _onRender -* @description "render" event handler for the menu. -* @private -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that -* fired the event. -*/ -_onRender: function(p_sType, p_aArgs, p_oMenu) { - - if(this.cfg.getProperty("position") == "dynamic") { - - var sWidth = - this.element.parentNode.tagName.toUpperCase() == "BODY" ? - this.element.offsetWidth : this._getOffsetWidth(); - - this.cfg.setProperty("width", (sWidth + "px")); - - } - -}, - -/** -* @method _onBeforeShow -* @description "beforeshow" event handler for the menu. -* @private -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that -* fired the event. -*/ -_onBeforeShow: function(p_sType, p_aArgs, p_oMenu) { - - if(this.lazyLoad && this.getItemGroups().length === 0) { - - if(this.srcElement) { - - this._initSubTree(); - - } - - if(this.itemData) { - - if( - this.parent && this.parent.parent && - this.parent.parent.srcElement && - this.parent.parent.srcElement.tagName.toUpperCase() == "SELECT" - ) { - - var nOptions = this.itemData.length; - - for(var n=0; n 0) { - - oConfig.showdelay = nShowDelay; - - } - - var nHideDelay = oParentMenu.cfg.getProperty("hidedelay"); - - if(nHideDelay > 0) { - - oConfig.hidedelay = nHideDelay; - - } - - /* - Only sync the "iframe" configuration property if the parent - menu's "position" configuration is the same. - */ - - if( - this.cfg.getProperty("position") == - oParentMenu.cfg.getProperty("position") - ) { - - oConfig.iframe = oParentMenu.cfg.getProperty("iframe"); - - } - - - p_oSubmenu.cfg.applyConfig(oConfig); - - if(!this.lazyLoad) { - - if(Dom.inDocument(this.element)) { - - this.render(); - - } - else { - - this.render(this.parent.element); - - } - - } - -}, - -/** -* @method _onSubmenuBeforeShow -* @description "beforeshow" event handler for a submenu. -* @private -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oSubmenu Object representing the submenu that -* subscribed to the event. -*/ -_onSubmenuBeforeShow: function(p_sType, p_aArgs, p_oSubmenu) { - - var oParent = this.parent; - var aAlignment = oParent.parent.cfg.getProperty("submenualignment"); - - this.cfg.setProperty( - "context", - [oParent.element, aAlignment[0], aAlignment[1]] - ); - - oParent.submenuIndicator.alt = oParent.EXPANDED_SUBMENU_INDICATOR_ALT_TEXT; - -}, - -/** -* @method _onSubmenuShow -* @description "show" event handler for a submenu. -* @private -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oSubmenu Object representing the submenu that -* subscribed to the event. -*/ -_onSubmenuShow: function(p_sType, p_aArgs, p_oSubmenu) { - - var oParent = this.parent; - - oParent.submenuIndicator.alt = oParent.EXPANDED_SUBMENU_INDICATOR_ALT_TEXT; - -}, - -/** -* @method _onSubmenuHide -* @description "hide" Custom Event handler for a submenu. -* @private -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oSubmenu Object representing the submenu that -* subscribed to the event. -*/ -_onSubmenuHide: function(p_sType, p_aArgs, p_oSubmenu) { - - var oParent = this.parent; - - oParent.submenuIndicator.alt = oParent.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT; - -}, - -/** -* @method _onMenuItemFocus -* @description "focus" event handler for the menu's items. -* @private -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item -* that fired the event. -*/ -_onMenuItemFocus: function(p_sType, p_aArgs, p_oItem) { - - this.activeItem = p_oItem; - -}, - -/** -* @method _onMenuItemBlur -* @description "blur" event handler for the menu's items. -* @private -* @param {String} p_sType String representing the name of the event -* that was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -*/ -_onMenuItemBlur: function(p_sType, p_aArgs) { - - this.activeItem = null; - -}, - -/** -* @method _onMenuItemConfigChange -* @description "configchange" event handler for the menu's items. -* @private -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item -* that fired the event. -*/ -_onMenuItemConfigChange: function(p_sType, p_aArgs, p_oItem) { - - var sProperty = p_aArgs[0][0]; - - switch(sProperty) { - - case "submenu": - - var oSubmenu = p_aArgs[0][1]; - - if(oSubmenu) { - - this._configureSubmenu(p_oItem); - - } - - break; - - case "text": - case "helptext": - - /* - A change to an item's "text" or "helptext" - configuration properties requires the width of the parent - menu to be recalculated. - */ - - if(this.element.style.width) { - - var sWidth = this._getOffsetWidth() + "px"; - - Dom.setStyle(this.element, "width", sWidth); - - } - - break; - - } - -}, - -// Public event handlers for configuration properties - -/** -* @method enforceConstraints -* @description The default event handler executed when the moveEvent is fired, -* if the "constraintoviewport" configuration property is set to true. -* @param {String} type The name of the event that was fired. -* @param {Array} args Collection of arguments sent when the -* event was fired. -* @param {Array} obj Array containing the current Menu instance -* and the item that fired the event. -*/ -enforceConstraints: function(type, args, obj) { - - var oConfig = this.cfg; - - var pos = args[0]; - - var x = pos[0]; - var y = pos[1]; - - var bod = document.getElementsByTagName('body')[0]; - var htm = document.getElementsByTagName('html')[0]; - - var bodyOverflow = Dom.getStyle(bod, "overflow"); - var htmOverflow = Dom.getStyle(htm, "overflow"); - - var offsetHeight = this.element.offsetHeight; - var offsetWidth = this.element.offsetWidth; - - var viewPortWidth = Dom.getClientWidth(); - var viewPortHeight = Dom.getClientHeight(); - - var scrollX = window.scrollX || document.body.scrollLeft; - var scrollY = window.scrollY || document.body.scrollTop; - - var topConstraint = scrollY + 10; - var leftConstraint = scrollX + 10; - var bottomConstraint = scrollY + viewPortHeight - offsetHeight - 10; - var rightConstraint = scrollX + viewPortWidth - offsetWidth - 10; - - var aContext = oConfig.getProperty("context"); - var oContextElement = aContext ? aContext[0] : null; - - - if (x < 10) { - - x = leftConstraint; - - } else if ((x + offsetWidth) > viewPortWidth) { - - if( - oContextElement && - ((x - oContextElement.offsetWidth) > offsetWidth) - ) { - - x = (x - (oContextElement.offsetWidth + offsetWidth)); - - } - else { - - x = rightConstraint; - - } - - } - - if (y < 10) { - - y = topConstraint; - - } else if (y > bottomConstraint) { - - if(oContextElement && (y > offsetHeight)) { - - y = ((y + oContextElement.offsetHeight) - offsetHeight); - - } - else { - - y = bottomConstraint; - - } - - } - - oConfig.setProperty("x", x, true); - oConfig.setProperty("y", y, true); - -}, - -/** -* @method configVisible -* @description Event handler for when the "visible" configuration property -* the menu changes. -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that -* fired the event. -*/ -configVisible: function(p_sType, p_aArgs, p_oMenu) { - - if(this.cfg.getProperty("position") == "dynamic") { - - YAHOO.widget.Menu.superclass.configVisible.call( - this, - p_sType, - p_aArgs, - p_oMenu - ); - - } - else { - - var bVisible = p_aArgs[0]; - var sDisplay = Dom.getStyle(this.element, "display"); - - if(bVisible) { - - if(sDisplay != "block") { - this.beforeShowEvent.fire(); - Dom.setStyle(this.element, "display", "block"); - this.showEvent.fire(); - } - - } - else { - - if(sDisplay == "block") { - this.beforeHideEvent.fire(); - Dom.setStyle(this.element, "display", "none"); - this.hideEvent.fire(); - } - - } - - } - -}, - -/** -* @method configPosition -* @description Event handler for when the "position" configuration property -* of the menu changes. -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that -* fired the event. -*/ -configPosition: function(p_sType, p_aArgs, p_oMenu) { - - var sCSSPosition = p_aArgs[0] == "static" ? "static" : "absolute"; - var oCfg = this.cfg; - - Dom.setStyle(this.element, "position", sCSSPosition); - - if(sCSSPosition == "static") { - - /* - Remove the iframe for statically positioned menus since it will - intercept mouse events. - */ - - oCfg.setProperty("iframe", false); - - // Statically positioned menus are visible by default - - Dom.setStyle(this.element, "display", "block"); - - oCfg.setProperty("visible", true); - - } - else { - - /* - Even though the "visible" property is queued to - "false" by default, we need to set the "visibility" property to - "hidden" since Overlay's "configVisible" implementation checks the - element's "visibility" style property before deciding whether - or not to show an Overlay instance. - */ - - Dom.setStyle(this.element, "visibility", "hidden"); - - } - - if(sCSSPosition == "absolute") { - - var nZIndex = oCfg.getProperty("zindex"); - - if(!nZIndex || nZIndex === 0) { - - nZIndex = this.parent ? - (this.parent.parent.cfg.getProperty("zindex") + 1) : 1; - - oCfg.setProperty("zindex", nZIndex); - - } - - } - -}, - -/** -* @method configIframe -* @description Event handler for when the "iframe" configuration property of -* the menu changes. -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that -* fired the event. -*/ -configIframe: function(p_sType, p_aArgs, p_oMenu) { - - if(this.cfg.getProperty("position") == "dynamic") { - - YAHOO.widget.Menu.superclass.configIframe.call( - this, - p_sType, - p_aArgs, - p_oMenu - ); - - } - -}, - -/** -* @method configHideDelay -* @description Event handler for when the "hidedelay" configuration property -* of the menu changes. -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that -* fired the event. -*/ -configHideDelay: function(p_sType, p_aArgs, p_oMenu) { - - var nHideDelay = p_aArgs[0]; - var oMouseOutEvent = this.mouseOutEvent; - var oMouseOverEvent = this.mouseOverEvent; - var oKeyDownEvent = this.keyDownEvent; - - if(nHideDelay > 0) { - - /* - Only assign event handlers once. This way the user change - the value for the hidedelay as many times as they want. - */ - - if(!this._hideDelayEventHandlersAssigned) { - - oMouseOutEvent.subscribe(this._execHideDelay, true); - oMouseOverEvent.subscribe(this._cancelHideDelay, this, true); - oKeyDownEvent.subscribe(this._cancelHideDelay, this, true); - - this._hideDelayEventHandlersAssigned = true; - - } - - } - else { - - oMouseOutEvent.unsubscribe(this._execHideDelay, this); - oMouseOverEvent.unsubscribe(this._cancelHideDelay, this); - oKeyDownEvent.unsubscribe(this._cancelHideDelay, this); - - this._hideDelayEventHandlersAssigned = false; - - } - -}, - -/** -* @method configContainer -* @description Event handler for when the "container" configuration property -of the menu changes. -* @param {String} p_sType String representing the name of the event that -* was fired. -* @param {Array} p_aArgs Array of arguments sent when the event was fired. -* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that -* fired the event. -*/ -configContainer: function(p_sType, p_aArgs, p_oMenu) { - - var oElement = p_aArgs[0]; - - if(typeof oElement == 'string') { - - this.cfg.setProperty( - "container", - document.getElementById(oElement), - true - ); - - } - -}, - -// Public methods - -/** -* Event handler called when the resize monitor element's "resize" evet is fired. -*/ -onDomResize: function(e, obj) { - - if(!this._handleResize) { - - this._handleResize = true; - return; - - } - - var oConfig = this.cfg; - - if(oConfig.getProperty("position") == "dynamic") { - - oConfig.setProperty("width", (this._getOffsetWidth() + "px")); - - } - - YAHOO.widget.Menu.superclass.onDomResize.call(this, e, obj); - -}, - -/** -* @method initEvents -* @description Initializes the custom events for the menu. -*/ -initEvents: function() { - - YAHOO.widget.Menu.superclass.initEvents.call(this); - - // Create custom events - - var CustomEvent = YAHOO.util.CustomEvent; - - this.mouseOverEvent = new CustomEvent("mouseOverEvent", this); - this.mouseOutEvent = new CustomEvent("mouseOutEvent", this); - this.mouseDownEvent = new CustomEvent("mouseDownEvent", this); - this.mouseUpEvent = new CustomEvent("mouseUpEvent", this); - this.clickEvent = new CustomEvent("clickEvent", this); - this.keyPressEvent = new CustomEvent("keyPressEvent", this); - this.keyDownEvent = new CustomEvent("keyDownEvent", this); - this.keyUpEvent = new CustomEvent("keyUpEvent", this); - this.itemAddedEvent = new CustomEvent("itemAddedEvent", this); - this.itemRemovedEvent = new CustomEvent("itemRemovedEvent", this); - -}, - -/** -* @method getRoot -* @description Finds the menu's root menu. -*/ -getRoot: function() { - - var oItem = this.parent; - - if(oItem) { - - var oParentMenu = oItem.parent; - - return oParentMenu ? oParentMenu.getRoot() : this; - - } - else { - - return this; - - } - -}, - -/** -* @method toString -* @description Returns a string representing the menu. -* @return {String} -*/ -toString: function() { - - return ("Menu " + this.id); - -}, - -/** -* @method setItemGroupTitle -* @description Sets the title of a group of menu items. -* @param {String} p_sGroupTitle String specifying the title of the group. -* @param {Number} p_nGroupIndex Optional. Number specifying the group to which -* the title belongs. -*/ -setItemGroupTitle: function(p_sGroupTitle, p_nGroupIndex) { - - if(typeof p_sGroupTitle == "string" && p_sGroupTitle.length > 0) { - - var nGroupIndex = typeof p_nGroupIndex == "number" ? p_nGroupIndex : 0; - var oTitle = this._aGroupTitleElements[nGroupIndex]; - - if(oTitle) { - - oTitle.innerHTML = p_sGroupTitle; - - } - else { - - oTitle = document.createElement(this.GROUP_TITLE_TAG_NAME); - - oTitle.innerHTML = p_sGroupTitle; - - this._aGroupTitleElements[nGroupIndex] = oTitle; - - } - - var i = this._aGroupTitleElements.length - 1; - var nFirstIndex; - - do { - - if(this._aGroupTitleElements[i]) { - - Dom.removeClass(this._aGroupTitleElements[i], "first-of-type"); - - nFirstIndex = i; - - } - - } - while(i--); - - if(nFirstIndex !== null) { - - Dom.addClass( - this._aGroupTitleElements[nFirstIndex], - "first-of-type" - ); - - } - - } - -}, - -/** -* @method addItem -* @description Appends an item to the menu. -* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem -* instance to be added to the menu. -* @param {String} p_oItem String specifying the text of the item to be added -* to the menu. -* @param {Object} p_oItem Object literal containing a set of menu item -* configuration properties. -* @param {Number} p_nGroupIndex Optional. Number indicating the group to -* which the item belongs. -* @return {YAHOO.widget.MenuItem} -*/ -addItem: function(p_oItem, p_nGroupIndex) { - - if(p_oItem) { - - return this._addItemToGroup(p_nGroupIndex, p_oItem); - - } - -}, - -/** -* @method addItems -* @description Adds an array of items to the menu. -* @param {Array} p_aItems Array of items to be added to the menu. The array -* can contain strings specifying the text for each item to be created, object -* literals specifying each of the menu item configuration properties, -* or MenuItem instances. -* @param {Number} p_nGroupIndex Optional. Number specifying the group to -* which the items belongs. -* @return {Array} -*/ -addItems: function(p_aItems, p_nGroupIndex) { - - function isArray(p_oValue) { - - return (typeof p_oValue == "object" && p_oValue.constructor == Array); - - } - - if(isArray(p_aItems)) { - - var nItems = p_aItems.length; - var aItems = []; - var oItem; - - for(var i=0; i<div> element -* (and accompanying child nodes) from the document. -*/ -destroy: function() { - - // Remove Custom Event listeners - - this.mouseOverEvent.unsubscribeAll(); - this.mouseOutEvent.unsubscribeAll(); - this.mouseDownEvent.unsubscribeAll(); - this.mouseUpEvent.unsubscribeAll(); - this.clickEvent.unsubscribeAll(); - this.keyPressEvent.unsubscribeAll(); - this.keyDownEvent.unsubscribeAll(); - this.keyUpEvent.unsubscribeAll(); - - var nItemGroups = this._aItemGroups.length; - var nItems; - var oItemGroup; - var oItem; - var i; - var n; - - // Remove all items - - if(nItemGroups > 0) { - - i = nItemGroups - 1; - - do { - - oItemGroup = this._aItemGroups[i]; - - if(oItemGroup) { - - nItems = oItemGroup.length; - - if(nItems > 0) { + /** + * @method onItemAdded + * @description "itemadded" event handler for a Menu instance. + * @private + * @param {String} p_sType String representing the name of the event that + * was fired. + * @param {Array} p_aArgs Array of arguments sent when the event was fired. + */ + function onItemAdded(p_sType, p_aArgs) { - n = nItems - 1; + addItem(p_aArgs[0]); - do { + } - oItem = this._aItemGroups[i][n]; - if(oItem) { + /** + * @method onItemRemoved + * @description "itemremoved" event handler for a Menu instance. + * @private + * @param {String} p_sType String representing the name of the event that + * was fired. + * @param {Array} p_aArgs Array of arguments sent when the event was fired. + */ + function onItemRemoved(p_sType, p_aArgs) { - oItem.destroy(); - } + removeItem(p_aArgs[0]); - } - while(n--); + } - } + return { - } + // Privileged methods - } - while(i--); + /** + * @method addMenu + * @description Adds a menu to the collection of known menus. + * @param {YAHOO.widget.Menu} p_oMenu Object specifying the Menu + * instance to be added. + */ + addMenu: function(p_oMenu) { - } + if(p_oMenu && p_oMenu.id && !m_oMenus[p_oMenu.id]) { - // Continue with the superclass implementation of this method + m_oMenus[p_oMenu.id] = p_oMenu; - YAHOO.widget.Menu.superclass.destroy.call(this); + if(!m_bInitializedEventHandlers) { -}, + var oDoc = document; -/** -* @method setInitialFocus -* @description Sets focus to the menu's first enabled item. -*/ -setInitialFocus: function() { + Event.addListener(oDoc, "mouseover", onDOMEvent, me, true); + Event.addListener(oDoc, "mouseout", onDOMEvent, me, true); + Event.addListener(oDoc, "mousedown", onDOMEvent, me, true); + Event.addListener(oDoc, "mouseup", onDOMEvent, me, true); + Event.addListener(oDoc, "click", onDOMEvent, me, true); + Event.addListener(oDoc, "keydown", onDOMEvent, me, true); + Event.addListener(oDoc, "keyup", onDOMEvent, me, true); + Event.addListener(oDoc, "keypress", onDOMEvent, me, true); - var oItem = this._getFirstEnabledItem(); + m_bInitializedEventHandlers = true; - if(oItem) { - oItem.focus(); - } + } -}, + p_oMenu.destroyEvent.subscribe(onMenuDestroy, p_oMenu, me); -/** -* @method setInitialSelection -* @description Sets the "selected" configuration property of the menu's first -* enabled item to "true." -*/ -setInitialSelection: function() { + p_oMenu.cfg.subscribeToConfigEvent( + "visible", + onMenuVisibleConfigChange, + p_oMenu + ); - var oItem = this._getFirstEnabledItem(); + p_oMenu.itemAddedEvent.subscribe(onItemAdded); + p_oMenu.itemRemovedEvent.subscribe(onItemRemoved); - if(oItem) { - oItem.cfg.setProperty("selected", true); - } + } -}, + }, -/** -* @method clearActiveItem -* @description Sets the "selected" configuration property of the menu's active -* item to "false" and hides the item's submenu. -* @param {Boolean} p_bBlur Boolean indicating if the menu's active item -* should be blurred. -*/ -clearActiveItem: function(p_bBlur) { - if(this.cfg.getProperty("showdelay") > 0) { + /** + * @method removeMenu + * @description Removes a menu from the collection of known menus. + * @param {YAHOO.widget.Menu} p_oMenu Object specifying the Menu + * instance to be removed. + */ + removeMenu: function(p_oMenu) { - this._cancelShowDelay(); + if(p_oMenu && m_oMenus[p_oMenu.id]) { - } + delete m_oMenus[p_oMenu.id]; - var oActiveItem = this.activeItem; - if(oActiveItem) { + } - var oConfig = oActiveItem.cfg; + }, - oConfig.setProperty("selected", false); - var oSubmenu = oConfig.getProperty("submenu"); + /** + * @method hideVisible + * @description Hides all visible, dynamically positioned menus. + */ + hideVisible: function() { - if(oSubmenu) { + var oMenu; - oSubmenu.hide(); + for(var i in m_oVisibleMenus) { - } + if(m_oVisibleMenus.hasOwnProperty(i)) { - if(p_bBlur) { + oMenu = m_oVisibleMenus[i]; - oActiveItem.blur(); + if(oMenu.cfg.getProperty("position") == "dynamic") { - } + oMenu.hide(); - } + } -}, + } -/** -* @description Initializes the class's configurable properties which can be -* changed using the menu's Config object ("cfg"). -* @method initDefaultConfig -*/ -initDefaultConfig: function() { + } - YAHOO.widget.Menu.superclass.initDefaultConfig.call(this); + }, - var oConfig = this.cfg; + /** + * @method getMenus + * @description Returns an array of all menus registered with the + * menu manger. + * @return {Array} + */ + getMenus: function() { - // Add configuration properties + return m_oMenus; - /* - Change the default value for the "visible" configuration - property to "false" by re-adding the property. - */ + }, - /** - * @config visible - * @description Boolean indicating whether or not the menu is visible. If - * the menu's "position" configuration property is set to "dynamic" (the - * default), this property toggles the menu's <div> - * element's "visibility" style property between "visible" (true) or - * "hidden" (false). If the menu's "position" configuration property is - * set to "static" this property toggles the menu's - * <div> element's "display" style property - * between "block" (true) or "none" (false). - * @default false - * @type Boolean - */ - oConfig.addProperty( - "visible", - { - value:false, - handler:this.configVisible, - validator:this.cfg.checkBoolean - } - ); + /** + * @method getMenu + * @description Returns a menu with the specified id. + * @param {String} p_sId String specifying the id of the menu to + * be retrieved. + * @return {YAHOO.widget.Menu} + */ + getMenu: function(p_sId) { - /* - Change the default value for the "constraintoviewport" configuration - property to "true" by re-adding the property. - */ + if(m_oMenus[p_sId]) { - /** - * @config constraintoviewport - * @description Boolean indicating if the menu will try to remain inside - * the boundaries of the size of viewport. - * @default true - * @type Boolean - */ - oConfig.addProperty( - "constraintoviewport", - { - value:true, - handler:this.configConstrainToViewport, - validator:this.cfg.checkBoolean, - supercedes:["iframe","x","y","xy"] - } - ); + return m_oMenus[p_sId]; - /** - * @config position - * @description String indicating how a menu should be positioned on the - * screen. Possible values are "static" and "dynamic." Static menus are - * visible by default and reside in the normal flow of the document - * (CSS position: static). Dynamic menus are hidden by default, reside - * out of the normal flow of the document (CSS position: absolute), and - * can overlay other elements on the screen. - * @default dynamic - * @type String - */ - oConfig.addProperty( - "position", - { - value: "dynamic", - handler: this.configPosition, - validator: this._checkPosition, - supercedes: ["visible"] - } - ); + } - /** - * @config submenualignment - * @description Array defining how submenus should be aligned to their - * parent menu item. The format is: [itemCorner, submenuCorner]. By default - * a submenu's top left corner is aligned to its parent menu item's top - * right corner. - * @default ["tl","tr"] - * @type Array - */ - oConfig.addProperty("submenualignment", { value: ["tl","tr"] } ); + }, - /** - * @config autosubmenudisplay - * @description Boolean indicating if submenus are automatically made - * visible when the user mouses over the menu's items. - * @default true - * @type Boolean - */ - oConfig.addProperty( - "autosubmenudisplay", - { - value: true, - validator: oConfig.checkBoolean - } - ); - /** - * @config showdelay - * @description Number indicating the time (in milliseconds) that should - * expire before a submenu is made visible when the user mouses over - * the menu's items. - * @default 0 - * @type Number - */ - oConfig.addProperty( - "showdelay", - { - value: 0, - validator: oConfig.checkNumber - } - ); + /** + * @method toString + * @description Returns a string representing the menu manager. + * @return {String} + */ + toString: function() { - /** - * @config hidedelay - * @description Number indicating the time (in milliseconds) that should - * expire before the menu is hidden. - * @default 0 - * @type Number - */ - oConfig.addProperty( - "hidedelay", - { - value: 0, - validator: oConfig.checkNumber, - handler: this.configHideDelay, - suppressEvent: true - } - ); + return ("MenuManager"); - /** - * @config clicktohide - * @description Boolean indicating if the menu will automatically be - * hidden if the user clicks outside of it. - * @default true - * @type Boolean - */ - oConfig.addProperty( - "clicktohide", - { - value: true, - validator: oConfig.checkBoolean } - ); - - /** - * @config container - * @description HTML element reference or string specifying the id - * attribute of the HTML element that the menu's markup should be rendered into. - * @type HTMLElement|String - * @default document.body - */ - this.cfg.addProperty( - "container", - { value:document.body, handler:this.configContainer } - ); -} - -}); // END YAHOO.extend + }; +}(); + +})(); + + +(function() { + +var Dom = YAHOO.util.Dom, + Event = YAHOO.util.Event; + + +/** +* The Menu class creates a container that holds a vertical list representing +* a set of options or commands. Menu is the base class for all +* menu containers. +* @param {String} p_oElement String specifying the id attribute of the +* <div> element of the menu. +* @param {String} p_oElement String specifying the id attribute of the +* <select> element to be used as the data source +* for the menu. +* @param {HTMLDivElement} p_oElement Object +* specifying the <div> element of the menu. +* @param {HTMLSelectElement} p_oElement +* Object specifying the <select> element to be used as +* the data source for the menu. +* @param {Object} p_oConfig Optional. Object literal specifying the +* configuration for the menu. See configuration class documentation for +* more details. +* @namespace YAHOO.widget +* @class Menu +* @constructor +* @extends YAHOO.widget.Overlay +*/ +YAHOO.widget.Menu = function(p_oElement, p_oConfig) { + + if(p_oConfig) { + + this.parent = p_oConfig.parent; + + this.lazyLoad = p_oConfig.lazyLoad || p_oConfig.lazyload; + + this.itemData = p_oConfig.itemData || p_oConfig.itemdata; + + } + + + YAHOO.widget.Menu.superclass.constructor.call( + this, + p_oElement, + p_oConfig + ); + +}; + +YAHOO.extend(YAHOO.widget.Menu, YAHOO.widget.Overlay, { + + + +// Constants + + +/** +* @property CSS_CLASS_NAME +* @description String representing the CSS class(es) to be applied to the +* menu's <div> element. +* @default "yuimenu" +* @final +* @type String +*/ +CSS_CLASS_NAME: "yuimenu", + + +/** +* @property ITEM_TYPE +* @description Object representing the type of menu item to instantiate and +* add when parsing the child nodes (either <li> element, +* <optgroup> element or <option>) +* of the menu's source HTML element. +* @default YAHOO.widget.MenuItem +* @final +* @type YAHOO.widget.MenuItem +*/ +ITEM_TYPE: null, + + +/** +* @property GROUP_TITLE_TAG_NAME +* @description String representing the tagname of the HTML element used to +* title the menu's item groups. +* @default H6 +* @final +* @type String +*/ +GROUP_TITLE_TAG_NAME: "h6", + + + +// Private properties + + +/** +* @property _nHideDelayId +* @description Number representing the time-out setting used to cancel the +* hiding of a menu. +* @default null +* @private +* @type Number +*/ +_nHideDelayId: null, + + +/** +* @property _nShowDelayId +* @description Number representing the time-out setting used to cancel the +* showing of a menu. +* @default null +* @private +* @type Number +*/ +_nShowDelayId: null, + + +/** +* @property _hideDelayEventHandlersAssigned +* @description Boolean indicating if the "mouseover" and "mouseout" event +* handlers used for hiding the menu via a call to "window.setTimeout" have +* already been assigned. +* @default false +* @private +* @type Boolean +*/ +_hideDelayEventHandlersAssigned: false, + + +/** +* @property _bHandledMouseOverEvent +* @description Boolean indicating the current state of the menu's +* "mouseover" event. +* @default false +* @private +* @type Boolean +*/ +_bHandledMouseOverEvent: false, + + +/** +* @property _bHandledMouseOutEvent +* @description Boolean indicating the current state of the menu's +* "mouseout" event. +* @default false +* @private +* @type Boolean +*/ +_bHandledMouseOutEvent: false, + + +/** +* @property _aGroupTitleElements +* @description Array of HTML element used to title groups of menu items. +* @default [] +* @private +* @type Array +*/ +_aGroupTitleElements: null, + + +/** +* @property _aItemGroups +* @description Array of menu items. +* @default [] +* @private +* @type Array +*/ +_aItemGroups: null, + + +/** +* @property _aListElements +* @description Array of <ul> elements, each of which is +* the parent node for each item's <li> element. +* @default [] +* @private +* @type Array +*/ +_aListElements: null, + + + +// Public properties + + +/** +* @property lazyLoad +* @description Boolean indicating if the menu's "lazy load" feature is +* enabled. If set to "true," initialization and rendering of the menu's +* items will be deferred until the first time it is made visible. This +* property should be set via the constructor using the configuration +* object literal. +* @default false +* @type Boolean +*/ +lazyLoad: false, + + +/** +* @property itemData +* @description Array of items to be added to the menu. The array can contain +* strings representing the text for each item to be created, object literals +* representing the menu item configuration properties, or MenuItem instances. +* This property should be set via the constructor using the configuration +* object literal. +* @default null +* @type Array +*/ +itemData: null, + + +/** +* @property activeItem +* @description Object reference to the item in the menu that has focus. +* @default null +* @type YAHOO.widget.MenuItem +*/ +activeItem: null, + + +/** +* @property parent +* @description Object reference to the menu's parent menu or menu item. +* This property can be set via the constructor using the configuration +* object literal. +* @default null +* @type YAHOO.widget.MenuItem +*/ +parent: null, + + +/** +* @property srcElement +* @description Object reference to the HTML element (either +* <select> or <div>) used to +* create the menu. +* @default null +* @type HTMLSelectElement|HTMLDivElement +*/ +srcElement: null, + + + +// Events + + +/** +* @event mouseOverEvent +* @description Fires when the mouse has entered the menu. Passes back +* the DOM Event object as an argument. +*/ +mouseOverEvent: null, + + +/** +* @event mouseOutEvent +* @description Fires when the mouse has left the menu. Passes back the DOM +* Event object as an argument. +* @type YAHOO.util.CustomEvent +*/ +mouseOutEvent: null, + + +/** +* @event mouseDownEvent +* @description Fires when the user mouses down on the menu. Passes back the +* DOM Event object as an argument. +* @type YAHOO.util.CustomEvent +*/ +mouseDownEvent: null, + + +/** +* @event mouseUpEvent +* @description Fires when the user releases a mouse button while the mouse is +* over the menu. Passes back the DOM Event object as an argument. +* @type YAHOO.util.CustomEvent +*/ +mouseUpEvent: null, + + +/** +* @event clickEvent +* @description Fires when the user clicks the on the menu. Passes back the +* DOM Event object as an argument. +* @type YAHOO.util.CustomEvent +*/ +clickEvent: null, + + +/** +* @event keyPressEvent +* @description Fires when the user presses an alphanumeric key when one of the +* menu's items has focus. Passes back the DOM Event object as an argument. +* @type YAHOO.util.CustomEvent +*/ +keyPressEvent: null, + + +/** +* @event keyDownEvent +* @description Fires when the user presses a key when one of the menu's items +* has focus. Passes back the DOM Event object as an argument. +* @type YAHOO.util.CustomEvent +*/ +keyDownEvent: null, + + +/** +* @event keyUpEvent +* @description Fires when the user releases a key when one of the menu's items +* has focus. Passes back the DOM Event object as an argument. +* @type YAHOO.util.CustomEvent +*/ +keyUpEvent: null, + + +/** +* @event itemAddedEvent +* @description Fires when an item is added to the menu. +* @type YAHOO.util.CustomEvent +*/ +itemAddedEvent: null, + + +/** +* @event itemRemovedEvent +* @description Fires when an item is removed to the menu. +* @type YAHOO.util.CustomEvent +*/ +itemRemovedEvent: null, + + +/** +* @method init +* @description The Menu class's initialization method. This method is +* automatically called by the constructor, and sets up all DOM references +* for pre-existing markup, and creates required markup if it is not +* already present. +* @param {String} p_oElement String specifying the id attribute of the +* <div> element of the menu. +* @param {String} p_oElement String specifying the id attribute of the +* <select> element to be used as the data source +* for the menu. +* @param {HTMLDivElement} p_oElement Object +* specifying the <div> element of the menu. +* @param {HTMLSelectElement} p_oElement +* Object specifying the <select> element to be used as +* the data source for the menu. +* @param {Object} p_oConfig Optional. Object literal specifying the +* configuration for the menu. See configuration class documentation for +* more details. +*/ +init: function(p_oElement, p_oConfig) { + + this._aItemGroups = []; + this._aListElements = []; + this._aGroupTitleElements = []; + + + if(!this.ITEM_TYPE) { + + this.ITEM_TYPE = YAHOO.widget.MenuItem; + + } + + + var oElement; + + if(typeof p_oElement == "string") { + + oElement = document.getElementById(p_oElement); + + } + else if(p_oElement.tagName) { + + oElement = p_oElement; + + } + + + if(oElement && oElement.tagName) { + + switch(oElement.tagName.toUpperCase()) { + + case "DIV": + + this.srcElement = oElement; + + if(!oElement.id) { + + oElement.setAttribute("id", Dom.generateId()); + + } + + + /* + Note: we don't pass the user config in here yet + because we only want it executed once, at the lowest + subclass level. + */ + + YAHOO.widget.Menu.superclass.init.call(this, oElement); + + this.beforeInitEvent.fire(YAHOO.widget.Menu); + + + + break; + + case "SELECT": + + this.srcElement = oElement; + + + /* + The source element is not something that we can use + outright, so we need to create a new Overlay + + Note: we don't pass the user config in here yet + because we only want it executed once, at the lowest + subclass level. + */ + + YAHOO.widget.Menu.superclass.init.call(this, Dom.generateId()); + + this.beforeInitEvent.fire(YAHOO.widget.Menu); + + + + break; + + } + + } + else { + + /* + Note: we don't pass the user config in here yet + because we only want it executed once, at the lowest + subclass level. + */ + + YAHOO.widget.Menu.superclass.init.call(this, p_oElement); + + this.beforeInitEvent.fire(YAHOO.widget.Menu); + + + + } + + + if(this.element) { + + var oEl = this.element; + + Dom.addClass(oEl, this.CSS_CLASS_NAME); + + + // Subscribe to Custom Events + + this.initEvent.subscribe(this._onInit, this, true); + this.beforeRenderEvent.subscribe(this._onBeforeRender, this, true); + this.renderEvent.subscribe(this._onRender, this, true); + this.beforeShowEvent.subscribe(this._onBeforeShow, this, true); + this.showEvent.subscribe(this._onShow, this, true); + this.beforeHideEvent.subscribe(this._onBeforeHide, this, true); + this.mouseOverEvent.subscribe(this._onMouseOver, this, true); + this.mouseOutEvent.subscribe(this._onMouseOut, this, true); + this.clickEvent.subscribe(this._onClick, this, true); + this.keyDownEvent.subscribe(this._onKeyDown, this, true); + + YAHOO.widget.Module.textResizeEvent.subscribe( + this._onTextResize, + this, + true + ); + + + if(p_oConfig) { + + this.cfg.applyConfig(p_oConfig, true); + + } + + + // Register the Menu instance with the MenuManager + + YAHOO.widget.MenuManager.addMenu(this); + + + this.initEvent.fire(YAHOO.widget.Menu); + + } + +}, + + + +// Private methods + + +/** +* @method _initSubTree +* @description Iterates the childNodes of the source element to find nodes +* used to instantiate menu and menu items. +* @private +*/ +_initSubTree: function() { + + var oNode; + + if(this.srcElement.tagName == "DIV") { + + /* + Populate the collection of item groups and item + group titles + */ + + oNode = this.body.firstChild; + + var nGroup = 0, + sGroupTitleTagName = this.GROUP_TITLE_TAG_NAME.toUpperCase(); + + do { + + if(oNode && oNode.tagName) { + + switch(oNode.tagName.toUpperCase()) { + + case sGroupTitleTagName: + + this._aGroupTitleElements[nGroup] = oNode; + + break; + + case "UL": + + this._aListElements[nGroup] = oNode; + this._aItemGroups[nGroup] = []; + nGroup++; + + break; + + } + + } + + } + while((oNode = oNode.nextSibling)); + + + /* + Apply the "first-of-type" class to the first UL to mimic + the "first-of-type" CSS3 psuedo class. + */ + + if(this._aListElements[0]) { + + Dom.addClass(this._aListElements[0], "first-of-type"); + + } + + } + + + oNode = null; + + + if(this.srcElement.tagName) { + + var sSrcElementTagName = this.srcElement.tagName.toUpperCase(); + + + switch(sSrcElementTagName) { + + case "DIV": + + if(this._aListElements.length > 0) { + + + var i = this._aListElements.length - 1; + + do { + + oNode = this._aListElements[i].firstChild; + + + do { + + if( + oNode && + oNode.tagName && + oNode.tagName.toUpperCase() == "LI" + ) { + + + this.addItem( + new this.ITEM_TYPE( + oNode, + { parent: this } + ), + i + ); + + } + + } + while((oNode = oNode.nextSibling)); + + } + while(i--); + + } + + break; + + case "SELECT": + + + oNode = this.srcElement.firstChild; + + do { + + if(oNode && oNode.tagName) { + + switch(oNode.tagName.toUpperCase()) { + + case "OPTGROUP": + case "OPTION": + + + this.addItem( + new this.ITEM_TYPE( + oNode, + { parent: this } + ) + ); + + break; + + } + + } + + } + while((oNode = oNode.nextSibling)); + + break; + + } + + } + +}, + + +/** +* @method _getFirstEnabledItem +* @description Returns the first enabled item in the menu. +* @return {YAHOO.widget.MenuItem} +* @private +*/ +_getFirstEnabledItem: function() { + + var nGroups = this._aItemGroups.length, + oItem, + aItemGroup; + + for(var i=0; i= aGroup.length); + + + if(aGroup[p_nItemIndex]) { + + aGroup.splice(p_nItemIndex, 0, oItem); + + } + else { + + aGroup[p_nItemIndex] = oItem; + + } + + + oGroupItem = aGroup[p_nItemIndex]; + + if(oGroupItem) { + + if( + bAppend && + ( + !oGroupItem.element.parentNode || + oGroupItem.element.parentNode.nodeType == 11 + ) + ) { + + this._aListElements[nGroupIndex].appendChild( + oGroupItem.element + ); + + } + else { + + + /** + * Returns the next sibling of an item in an array. + * @private + * @param {p_aArray} Array to search. + * @param {p_nStartIndex} Number indicating the index to + * start searching the array. + * @return {Object} + */ + function getNextItemSibling(p_aArray, p_nStartIndex) { + + return ( + p_aArray[p_nStartIndex] || + getNextItemSibling( + p_aArray, + (p_nStartIndex+1) + ) + ); + + } + + + var oNextItemSibling = + getNextItemSibling(aGroup, (p_nItemIndex+1)); + + if( + oNextItemSibling && + ( + !oGroupItem.element.parentNode || + oGroupItem.element.parentNode.nodeType == 11 + ) + ) { + + this._aListElements[nGroupIndex].insertBefore( + oGroupItem.element, + oNextItemSibling.element + ); + + } + + } + + + oGroupItem.parent = this; + + this._subscribeToItemEvents(oGroupItem); + + this._configureSubmenu(oGroupItem); + + this._updateItemProperties(nGroupIndex); + + + this.itemAddedEvent.fire(oGroupItem); + + return oGroupItem; + + } + + } + else { + + var nItemIndex = aGroup.length; + + aGroup[nItemIndex] = oItem; + + oGroupItem = aGroup[nItemIndex]; + + + if(oGroupItem) { + + if( + !Dom.isAncestor( + this._aListElements[nGroupIndex], + oGroupItem.element + ) + ) { + + this._aListElements[nGroupIndex].appendChild( + oGroupItem.element + ); + + } + + oGroupItem.element.setAttribute("groupindex", nGroupIndex); + oGroupItem.element.setAttribute("index", nItemIndex); + + oGroupItem.parent = this; + + oGroupItem.index = nItemIndex; + oGroupItem.groupIndex = nGroupIndex; + + this._subscribeToItemEvents(oGroupItem); + + this._configureSubmenu(oGroupItem); + + if(nItemIndex === 0) { + + Dom.addClass(oGroupItem.element, "first-of-type"); + + } + + + + this.itemAddedEvent.fire(oGroupItem); + + return oGroupItem; + + } + + } + + } + +}, + + +/** +* @method _removeItemFromGroupByIndex +* @description Removes a menu item from a group by index. Returns the menu +* item that was removed. +* @private +* @param {Number} p_nGroupIndex Number indicating the group to which the menu +* item belongs. +* @param {Number} p_nItemIndex Number indicating the index of the menu item +* to be removed. +* @return {YAHOO.widget.MenuItem} +*/ +_removeItemFromGroupByIndex: function(p_nGroupIndex, p_nItemIndex) { + + var nGroupIndex = typeof p_nGroupIndex == "number" ? p_nGroupIndex : 0, + aGroup = this._getItemGroup(nGroupIndex); + + if(aGroup) { + + var aArray = aGroup.splice(p_nItemIndex, 1), + oItem = aArray[0]; + + if(oItem) { + + // Update the index and className properties of each member + + this._updateItemProperties(nGroupIndex); + + if(aGroup.length === 0) { + + // Remove the UL + + var oUL = this._aListElements[nGroupIndex]; + + if(this.body && oUL) { + + this.body.removeChild(oUL); + + } + + // Remove the group from the array of items + + this._aItemGroups.splice(nGroupIndex, 1); + + + // Remove the UL from the array of ULs + + this._aListElements.splice(nGroupIndex, 1); + + + /* + Assign the "first-of-type" class to the new first UL + in the collection + */ + + oUL = this._aListElements[0]; + + if(oUL) { + + Dom.addClass(oUL, "first-of-type"); + + } + + } + + + this.itemRemovedEvent.fire(oItem); + + + // Return a reference to the item that was removed + + return oItem; + + } + + } + +}, + + +/** +* @method _removeItemFromGroupByValue +* @description Removes a menu item from a group by reference. Returns the +* menu item that was removed. +* @private +* @param {Number} p_nGroupIndex Number indicating the group to which the +* menu item belongs. +* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem +* instance to be removed. +* @return {YAHOO.widget.MenuItem} +*/ +_removeItemFromGroupByValue: function(p_nGroupIndex, p_oItem) { + + var aGroup = this._getItemGroup(p_nGroupIndex); + + if(aGroup) { + + var nItems = aGroup.length, + nItemIndex = -1; + + if(nItems > 0) { + + var i = nItems-1; + + do { + + if(aGroup[i] == p_oItem) { + + nItemIndex = i; + break; + + } + + } + while(i--); + + if(nItemIndex > -1) { + + return this._removeItemFromGroupByIndex( + p_nGroupIndex, + nItemIndex + ); + + } + + } + + } + +}, + + +/** +* @method _updateItemProperties +* @description Updates the "index," "groupindex," and "className" properties +* of the menu items in the specified group. +* @private +* @param {Number} p_nGroupIndex Number indicating the group of items to update. +*/ +_updateItemProperties: function(p_nGroupIndex) { + + var aGroup = this._getItemGroup(p_nGroupIndex), + nItems = aGroup.length; + + if(nItems > 0) { + + var i = nItems - 1, + oItem, + oLI; + + // Update the index and className properties of each member + + do { + + oItem = aGroup[i]; + + if(oItem) { + + oLI = oItem.element; + + oItem.index = i; + oItem.groupIndex = p_nGroupIndex; + + oLI.setAttribute("groupindex", p_nGroupIndex); + oLI.setAttribute("index", i); + + Dom.removeClass(oLI, "first-of-type"); + + } + + } + while(i--); + + + if(oLI) { + + Dom.addClass(oLI, "first-of-type"); + + } + + } + +}, + + +/** +* @method _createItemGroup +* @description Creates a new menu item group (array) and its associated +* <ul> element. Returns an aray of menu item groups. +* @private +* @param {Number} p_nIndex Number indicating the group to create. +* @return {Array} +*/ +_createItemGroup: function(p_nIndex) { + + if(!this._aItemGroups[p_nIndex]) { + + this._aItemGroups[p_nIndex] = []; + + var oUL = document.createElement("ul"); + + this._aListElements[p_nIndex] = oUL; + + return this._aItemGroups[p_nIndex]; + + } + +}, + + +/** +* @method _getItemGroup +* @description Returns the menu item group at the specified index. +* @private +* @param {Number} p_nIndex Number indicating the index of the menu item group +* to be retrieved. +* @return {Array} +*/ +_getItemGroup: function(p_nIndex) { + + var nIndex = ((typeof p_nIndex == "number") ? p_nIndex : 0); + + return this._aItemGroups[nIndex]; + +}, + + +/** +* @method _configureSubmenu +* @description Subscribes the menu item's submenu to its parent menu's events. +* @private +* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem +* instance with the submenu to be configured. +*/ +_configureSubmenu: function(p_oItem) { + + var oSubmenu = p_oItem.cfg.getProperty("submenu"); + + if(oSubmenu) { + + /* + Listen for configuration changes to the parent menu + so they they can be applied to the submenu. + */ + + this.cfg.configChangedEvent.subscribe( + this._onParentMenuConfigChange, + oSubmenu, + true + ); + + this.renderEvent.subscribe( + this._onParentMenuRender, + oSubmenu, + true + ); + + oSubmenu.beforeShowEvent.subscribe( + this._onSubmenuBeforeShow, + oSubmenu, + true + ); + + oSubmenu.showEvent.subscribe( + this._onSubmenuShow, + oSubmenu, + true + ); + + oSubmenu.hideEvent.subscribe( + this._onSubmenuHide, + oSubmenu, + true + ); + + } + +}, + + +/** +* @method _subscribeToItemEvents +* @description Subscribes a menu to a menu item's event. +* @private +* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem +* instance whose events should be subscribed to. +*/ +_subscribeToItemEvents: function(p_oItem) { + + p_oItem.focusEvent.subscribe(this._onMenuItemFocus, p_oItem, this); + + p_oItem.blurEvent.subscribe(this._onMenuItemBlur, this, true); + + p_oItem.cfg.configChangedEvent.subscribe( + this._onMenuItemConfigChange, + p_oItem, + this + ); + +}, + + +/** +* @method _getOffsetWidth +* @description Returns the offset width of the menu's +* <div> element. +* @private +*/ +_getOffsetWidth: function() { + + var oClone = this.element.cloneNode(true); + + Dom.setStyle(oClone, "width", ""); + + document.body.appendChild(oClone); + + var sWidth = oClone.offsetWidth; + + document.body.removeChild(oClone); + + return sWidth; + +}, + + +/** +* @method _cancelHideDelay +* @description Cancels the call to "hideMenu." +* @private +*/ +_cancelHideDelay: function() { + + var oRoot = this.getRoot(); + + if(oRoot._nHideDelayId) { + + window.clearTimeout(oRoot._nHideDelayId); + + } + +}, + + +/** +* @method _execHideDelay +* @description Hides the menu after the number of milliseconds specified by +* the "hidedelay" configuration property. +* @private +*/ +_execHideDelay: function() { + + this._cancelHideDelay(); + + var oRoot = this.getRoot(), + me = this; + + function hideMenu() { + + if(oRoot.activeItem) { + + oRoot.clearActiveItem(); + + } + + if(oRoot == me && me.cfg.getProperty("position") == "dynamic") { + + me.hide(); + + } + + } + + + oRoot._nHideDelayId = + window.setTimeout(hideMenu, oRoot.cfg.getProperty("hidedelay")); + +}, + + +/** +* @method _cancelShowDelay +* @description Cancels the call to the "showMenu." +* @private +*/ +_cancelShowDelay: function() { + + var oRoot = this.getRoot(); + + if(oRoot._nShowDelayId) { + + window.clearTimeout(oRoot._nShowDelayId); + + } + +}, + + +/** +* @method _execShowDelay +* @description Shows the menu after the number of milliseconds specified by +* the "showdelay" configuration property have ellapsed. +* @private +* @param {YAHOO.widget.Menu} p_oMenu Object specifying the menu that should +* be made visible. +*/ +_execShowDelay: function(p_oMenu) { + + var oRoot = this.getRoot(); + + function showMenu() { + + p_oMenu.show(); + + } + + + oRoot._nShowDelayId = + window.setTimeout(showMenu, oRoot.cfg.getProperty("showdelay")); + +}, + + + +// Protected methods + + +/** +* @method _onMouseOver +* @description "mouseover" event handler for the menu. +* @protected +* @param {String} p_sType String representing the name of the event that +* was fired. +* @param {Array} p_aArgs Array of arguments sent when the event was fired. +* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that +* fired the event. +*/ +_onMouseOver: function(p_sType, p_aArgs, p_oMenu) { + + var oEvent = p_aArgs[0], + oItem = p_aArgs[1], + oTarget = Event.getTarget(oEvent); + + + if( + !this._bHandledMouseOverEvent && + (oTarget == this.element || Dom.isAncestor(this.element, oTarget)) + ) { + + this.clearActiveItem(); + + this._bHandledMouseOverEvent = true; + this._bHandledMouseOutEvent = false; + + } + + + if( + oItem && !oItem.handledMouseOverEvent && + !oItem.cfg.getProperty("disabled") && + (oTarget == oItem.element || Dom.isAncestor(oItem.element, oTarget)) + ) { + + var nShowDelay = this.cfg.getProperty("showdelay"), + bShowDelay = (nShowDelay > 0); + + + if(bShowDelay) { + + this._cancelShowDelay(); + + } + + + var oActiveItem = this.activeItem; + + if(oActiveItem) { + + oActiveItem.cfg.setProperty("selected", false); + + var oActiveSubmenu = oActiveItem.cfg.getProperty("submenu"); + + if(oActiveSubmenu) { + + oActiveSubmenu.hide(); + + } + + } + + + var oItemCfg = oItem.cfg; + + // Select and focus the current menu item + + oItemCfg.setProperty("selected", true); + oItem.focus(); + + + if(this.cfg.getProperty("autosubmenudisplay")) { + + // Show the submenu this menu item + + var oSubmenu = oItemCfg.getProperty("submenu"); + + if(oSubmenu) { + + if(bShowDelay) { + + this._execShowDelay(oSubmenu); + + } + else { + + oSubmenu.show(); + + } + + } + + } + + oItem.handledMouseOverEvent = true; + oItem.handledMouseOutEvent = false; + + } + +}, + + +/** +* @method _onMouseOut +* @description "mouseout" event handler for the menu. +* @protected +* @param {String} p_sType String representing the name of the event that +* was fired. +* @param {Array} p_aArgs Array of arguments sent when the event was fired. +* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that +* fired the event. +*/ +_onMouseOut: function(p_sType, p_aArgs, p_oMenu) { + + var oEvent = p_aArgs[0], + oItem = p_aArgs[1], + oRelatedTarget = Event.getRelatedTarget(oEvent), + bMovingToSubmenu = false; + + + if(oItem && !oItem.cfg.getProperty("disabled")) { + + var oItemCfg = oItem.cfg, + oSubmenu = oItemCfg.getProperty("submenu"); + + + if( + oSubmenu && + ( + oRelatedTarget == oSubmenu.element || + Dom.isAncestor(oSubmenu.element, oRelatedTarget) + ) + ) { + + bMovingToSubmenu = true; + + } + + + if( + !oItem.handledMouseOutEvent && + ( + ( + oRelatedTarget != oItem.element && + !Dom.isAncestor(oItem.element, oRelatedTarget) + ) || bMovingToSubmenu + ) + ) { + + if( + !oSubmenu || + (oSubmenu && !oSubmenu.cfg.getProperty("visible")) + ) { + + oItem.cfg.setProperty("selected", false); + + if( + oSubmenu && + oSubmenu.cfg.getProperty("showdelay") && + !oSubmenu.cfg.getProperty("visible") + ) { + + this._cancelShowDelay(); + + } + + } + + + oItem.handledMouseOutEvent = true; + oItem.handledMouseOverEvent = false; + + } + + } + + + if( + !this._bHandledMouseOutEvent && + ( + ( + oRelatedTarget != this.element && + !Dom.isAncestor(this.element, oRelatedTarget) + ) + || bMovingToSubmenu + ) + ) { + + this._bHandledMouseOutEvent = true; + this._bHandledMouseOverEvent = false; + + } + +}, + + +/** +* @method _onClick +* @description "click" event handler for the menu. +* @protected +* @param {String} p_sType String representing the name of the event that +* was fired. +* @param {Array} p_aArgs Array of arguments sent when the event was fired. +* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that +* fired the event. +*/ +_onClick: function(p_sType, p_aArgs, p_oMenu) { + + var oEvent = p_aArgs[0], + oItem = p_aArgs[1], + oTarget = Event.getTarget(oEvent); + + if(oItem && !oItem.cfg.getProperty("disabled")) { + + var oItemCfg = oItem.cfg, + oSubmenu = oItemCfg.getProperty("submenu"); + + + /* + ACCESSIBILITY FEATURE FOR SCREEN READERS: + Expand/collapse the submenu when the user clicks + on the submenu indicator image. + */ + + if(oTarget == oItem.submenuIndicator && oSubmenu) { + + if(oSubmenu.cfg.getProperty("visible")) { + + oSubmenu.hide(); + + } + else { + + this.clearActiveItem(); + + this.activeItem = oItem; + + oItem.cfg.setProperty("selected", true); + + oSubmenu.show(); + + } + + } + else { + + var sURL = oItemCfg.getProperty("url"), + bCurrentPageURL = (sURL.substr((sURL.length-1),1) == "#"), + sTarget = oItemCfg.getProperty("target"), + bHasTarget = (sTarget && sTarget.length > 0); + + /* + Prevent the browser from following links + equal to "#" + */ + + if( + oTarget.tagName.toUpperCase() == "A" && + bCurrentPageURL && !bHasTarget + ) { + + Event.preventDefault(oEvent); + + } + + if( + oTarget.tagName.toUpperCase() != "A" && + !bCurrentPageURL && !bHasTarget + ) { + + /* + Follow the URL of the item regardless of + whether or not the user clicked specifically + on the anchor element. + */ + + document.location = sURL; + + } + + + /* + If the item doesn't navigate to a URL and it doesn't have + a submenu, then collapse the menu tree. + */ + + if(bCurrentPageURL && !oSubmenu) { + + var oRoot = this.getRoot(); + + if(oRoot.cfg.getProperty("position") == "static") { + + oRoot.clearActiveItem(); + + } + else { + + oRoot.hide(); + + } + + } + + } + + } + +}, + + +/** +* @method _onKeyDown +* @description "keydown" event handler for the menu. +* @protected +* @param {String} p_sType String representing the name of the event that +* was fired. +* @param {Array} p_aArgs Array of arguments sent when the event was fired. +* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that +* fired the event. +*/ +_onKeyDown: function(p_sType, p_aArgs, p_oMenu) { + + var oEvent = p_aArgs[0], + oItem = p_aArgs[1], + oSubmenu; + + if(oItem && !oItem.cfg.getProperty("disabled")) { + + var oItemCfg = oItem.cfg, + oParentItem = this.parent, + oRoot, + oNextItem; + + + switch(oEvent.keyCode) { + + case 38: // Up arrow + case 40: // Down arrow + + if( + oItem == this.activeItem && + !oItemCfg.getProperty("selected") + ) { + + oItemCfg.setProperty("selected", true); + + } + else { + + oNextItem = (oEvent.keyCode == 38) ? + oItem.getPreviousEnabledSibling() : + oItem.getNextEnabledSibling(); + + if(oNextItem) { + + this.clearActiveItem(); + + oNextItem.cfg.setProperty("selected", true); + oNextItem.focus(); + + } + + } + + Event.preventDefault(oEvent); + + break; + + + case 39: // Right arrow + + oSubmenu = oItemCfg.getProperty("submenu"); + + if(oSubmenu) { + + if(!oItemCfg.getProperty("selected")) { + + oItemCfg.setProperty("selected", true); + + } + + oSubmenu.show(); + + oSubmenu.setInitialSelection(); + + } + else { + + oRoot = this.getRoot(); + + if(oRoot instanceof YAHOO.widget.MenuBar) { + + oNextItem = oRoot.activeItem.getNextEnabledSibling(); + + if(oNextItem) { + + oRoot.clearActiveItem(); + + oNextItem.cfg.setProperty("selected", true); + + oSubmenu = oNextItem.cfg.getProperty("submenu"); + + if(oSubmenu) { + + oSubmenu.show(); + + } + + oNextItem.focus(); + + } + + } + + } + + + Event.preventDefault(oEvent); + + break; + + + case 37: // Left arrow + + if(oParentItem) { + + var oParentMenu = oParentItem.parent; + + if(oParentMenu instanceof YAHOO.widget.MenuBar) { + + oNextItem = + oParentMenu.activeItem.getPreviousEnabledSibling(); + + if(oNextItem) { + + oParentMenu.clearActiveItem(); + + oNextItem.cfg.setProperty("selected", true); + + oSubmenu = oNextItem.cfg.getProperty("submenu"); + + if(oSubmenu) { + + oSubmenu.show(); + + } + + oNextItem.focus(); + + } + + } + else { + + this.hide(); + + oParentItem.focus(); + + } + + } + + Event.preventDefault(oEvent); + + break; + + } + + + } + + + if(oEvent.keyCode == 27) { // Esc key + + if(this.cfg.getProperty("position") == "dynamic") { + + this.hide(); + + if(this.parent) { + + this.parent.focus(); + + } + + } + else if(this.activeItem) { + + oSubmenu = this.activeItem.cfg.getProperty("submenu"); + + if(oSubmenu && oSubmenu.cfg.getProperty("visible")) { + + oSubmenu.hide(); + this.activeItem.focus(); + + } + else { + + this.activeItem.cfg.setProperty("selected", false); + this.activeItem.blur(); + + } + + } + + + Event.preventDefault(oEvent); + + } + +}, + + +/** +* @method _onTextResize +* @description "textresize" event handler for the menu. +* @protected +* @param {String} p_sType String representing the name of the event that +* was fired. +* @param {Array} p_aArgs Array of arguments sent when the event was fired. +* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that +* fired the event. +*/ +_onTextResize: function(p_sType, p_aArgs, p_oMenu) { + + if(this.browser == "gecko" && !this._handleResize) { + + this._handleResize = true; + return; + + } + + + var oConfig = this.cfg; + + if(oConfig.getProperty("position") == "dynamic") { + + oConfig.setProperty("width", (this._getOffsetWidth() + "px")); + + } + +}, + + + +// Private methods + + +/** +* @method _onInit +* @description "init" event handler for the menu. +* @private +* @param {String} p_sType String representing the name of the event that +* was fired. +* @param {Array} p_aArgs Array of arguments sent when the event was fired. +* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that +* fired the event. +*/ +_onInit: function(p_sType, p_aArgs, p_oMenu) { + + if( + ( + (this.parent && !this.lazyLoad) || + (!this.parent && this.cfg.getProperty("position") == "static") || + ( + !this.parent && + !this.lazyLoad && + this.cfg.getProperty("position") == "dynamic" + ) + ) && + this.getItemGroups().length === 0 + ) { + + if(this.srcElement) { + + this._initSubTree(); + + } + + + if(this.itemData) { + + this.addItems(this.itemData); + + } + + } + else if(this.lazyLoad) { + + this.cfg.fireQueue(); + + } + +}, + + +/** +* @method _onBeforeRender +* @description "beforerender" event handler for the menu. Appends all of the +* <ul>, <li> and their accompanying +* title elements to the body element of the menu. +* @private +* @param {String} p_sType String representing the name of the event that +* was fired. +* @param {Array} p_aArgs Array of arguments sent when the event was fired. +* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that +* fired the event. +*/ +_onBeforeRender: function(p_sType, p_aArgs, p_oMenu) { + + var oConfig = this.cfg, + oEl = this.element, + nListElements = this._aListElements.length; + + + if(nListElements > 0) { + + var i = 0, + bFirstList = true, + oUL, + oGroupTitle; + + + do { + + oUL = this._aListElements[i]; + + if(oUL) { + + if(bFirstList) { + + Dom.addClass(oUL, "first-of-type"); + bFirstList = false; + + } + + + if(!Dom.isAncestor(oEl, oUL)) { + + this.appendToBody(oUL); + + } + + + oGroupTitle = this._aGroupTitleElements[i]; + + if(oGroupTitle) { + + if(!Dom.isAncestor(oEl, oGroupTitle)) { + + oUL.parentNode.insertBefore(oGroupTitle, oUL); + + } + + + Dom.addClass(oUL, "hastitle"); + + } + + } + + i++; + + } + while(i < nListElements); + + } + +}, + + +/** +* @method _onRender +* @description "render" event handler for the menu. +* @private +* @param {String} p_sType String representing the name of the event that +* was fired. +* @param {Array} p_aArgs Array of arguments sent when the event was fired. +* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that +* fired the event. +*/ +_onRender: function(p_sType, p_aArgs, p_oMenu) { + + if(this.cfg.getProperty("position") == "dynamic") { + + var sWidth = + this.element.parentNode.tagName.toUpperCase() == "BODY" ? + this.element.offsetWidth : this._getOffsetWidth(); + + this.cfg.setProperty("width", (sWidth + "px")); + + } + +}, + + +/** +* @method _onBeforeShow +* @description "beforeshow" event handler for the menu. +* @private +* @param {String} p_sType String representing the name of the event that +* was fired. +* @param {Array} p_aArgs Array of arguments sent when the event was fired. +* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that +* fired the event. +*/ +_onBeforeShow: function(p_sType, p_aArgs, p_oMenu) { + + if(this.lazyLoad && this.getItemGroups().length === 0) { + + if(this.srcElement) { + + this._initSubTree(); + + } + + + if(this.itemData) { + + if( + this.parent && this.parent.parent && + this.parent.parent.srcElement && + this.parent.parent.srcElement.tagName.toUpperCase() == "SELECT" + ) { + + var nOptions = this.itemData.length; + + for(var n=0; n viewPortWidth) { + + if( + oContextElement && + ((x - oContextElement.offsetWidth) > offsetWidth) + ) { + + x = (x - (oContextElement.offsetWidth + offsetWidth)); + + } + else { + + x = rightConstraint; + + } + + } + + if (y < 10) { + + y = topConstraint; + + } else if (y > bottomConstraint) { + + if(oContextElement && (y > offsetHeight)) { + + y = ((y + oContextElement.offsetHeight) - offsetHeight); + + } + else { + + y = bottomConstraint; + + } + + } + + oConfig.setProperty("x", x, true); + oConfig.setProperty("y", y, true); + oConfig.setProperty("xy", [x,y], true); + +}, + + +/** +* @method configVisible +* @description Event handler for when the "visible" configuration property +* the menu changes. +* @param {String} p_sType String representing the name of the event that +* was fired. +* @param {Array} p_aArgs Array of arguments sent when the event was fired. +* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that +* fired the event. +*/ +configVisible: function(p_sType, p_aArgs, p_oMenu) { + + if(this.cfg.getProperty("position") == "dynamic") { + + YAHOO.widget.Menu.superclass.configVisible.call( + this, + p_sType, + p_aArgs, + p_oMenu + ); + + } + else { + + var bVisible = p_aArgs[0], + sDisplay = Dom.getStyle(this.element, "display"); + + if(bVisible) { + + if(sDisplay != "block") { + this.beforeShowEvent.fire(); + Dom.setStyle(this.element, "display", "block"); + this.showEvent.fire(); + } + + } + else { + + if(sDisplay == "block") { + this.beforeHideEvent.fire(); + Dom.setStyle(this.element, "display", "none"); + this.hideEvent.fire(); + } + + } + + } + +}, + + +/** +* @method configPosition +* @description Event handler for when the "position" configuration property +* of the menu changes. +* @param {String} p_sType String representing the name of the event that +* was fired. +* @param {Array} p_aArgs Array of arguments sent when the event was fired. +* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that +* fired the event. +*/ +configPosition: function(p_sType, p_aArgs, p_oMenu) { + + var sCSSPosition = p_aArgs[0] == "static" ? "static" : "absolute", + oCfg = this.cfg; + + Dom.setStyle(this.element, "position", sCSSPosition); + + + if(sCSSPosition == "static") { + + /* + Remove the iframe for statically positioned menus since it will + intercept mouse events. + */ + + oCfg.setProperty("iframe", false); + + + // Statically positioned menus are visible by default + + Dom.setStyle(this.element, "display", "block"); + + oCfg.setProperty("visible", true); + + } + else { + + /* + Even though the "visible" property is queued to + "false" by default, we need to set the "visibility" property to + "hidden" since Overlay's "configVisible" implementation checks the + element's "visibility" style property before deciding whether + or not to show an Overlay instance. + */ + + Dom.setStyle(this.element, "visibility", "hidden"); + + } + + + if(sCSSPosition == "absolute") { + + var nZIndex = oCfg.getProperty("zindex"); + + if(!nZIndex || nZIndex === 0) { + + nZIndex = this.parent ? + (this.parent.parent.cfg.getProperty("zindex") + 1) : 1; + + oCfg.setProperty("zindex", nZIndex); + + } + + } + +}, + + +/** +* @method configIframe +* @description Event handler for when the "iframe" configuration property of +* the menu changes. +* @param {String} p_sType String representing the name of the event that +* was fired. +* @param {Array} p_aArgs Array of arguments sent when the event was fired. +* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that +* fired the event. +*/ +configIframe: function(p_sType, p_aArgs, p_oMenu) { + + if(this.cfg.getProperty("position") == "dynamic") { + + YAHOO.widget.Menu.superclass.configIframe.call( + this, + p_sType, + p_aArgs, + p_oMenu + ); + + } + +}, + + +/** +* @method configHideDelay +* @description Event handler for when the "hidedelay" configuration property +* of the menu changes. +* @param {String} p_sType String representing the name of the event that +* was fired. +* @param {Array} p_aArgs Array of arguments sent when the event was fired. +* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that +* fired the event. +*/ +configHideDelay: function(p_sType, p_aArgs, p_oMenu) { + + var nHideDelay = p_aArgs[0], + oMouseOutEvent = this.mouseOutEvent, + oMouseOverEvent = this.mouseOverEvent, + oKeyDownEvent = this.keyDownEvent; + + if(nHideDelay > 0) { + + /* + Only assign event handlers once. This way the user change + the value for the hidedelay as many times as they want. + */ + + if(!this._hideDelayEventHandlersAssigned) { + + oMouseOutEvent.subscribe(this._execHideDelay, true); + oMouseOverEvent.subscribe(this._cancelHideDelay, this, true); + oKeyDownEvent.subscribe(this._cancelHideDelay, this, true); + + this._hideDelayEventHandlersAssigned = true; + + } + + } + else { + + oMouseOutEvent.unsubscribe(this._execHideDelay, this); + oMouseOverEvent.unsubscribe(this._cancelHideDelay, this); + oKeyDownEvent.unsubscribe(this._cancelHideDelay, this); + + this._hideDelayEventHandlersAssigned = false; + + } + +}, + + +/** +* @method configContainer +* @description Event handler for when the "container" configuration property +of the menu changes. +* @param {String} p_sType String representing the name of the event that +* was fired. +* @param {Array} p_aArgs Array of arguments sent when the event was fired. +* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that +* fired the event. +*/ +configContainer: function(p_sType, p_aArgs, p_oMenu) { + + var oElement = p_aArgs[0]; + + if(typeof oElement == 'string') { + + this.cfg.setProperty( + "container", + document.getElementById(oElement), + true + ); + + } + +}, + + + +// Public methods + + +/** +* @method initEvents +* @description Initializes the custom events for the menu. +*/ +initEvents: function() { + + YAHOO.widget.Menu.superclass.initEvents.call(this); + + // Create custom events + + var CustomEvent = YAHOO.util.CustomEvent; + + this.mouseOverEvent = new CustomEvent("mouseOverEvent", this); + this.mouseOutEvent = new CustomEvent("mouseOutEvent", this); + this.mouseDownEvent = new CustomEvent("mouseDownEvent", this); + this.mouseUpEvent = new CustomEvent("mouseUpEvent", this); + this.clickEvent = new CustomEvent("clickEvent", this); + this.keyPressEvent = new CustomEvent("keyPressEvent", this); + this.keyDownEvent = new CustomEvent("keyDownEvent", this); + this.keyUpEvent = new CustomEvent("keyUpEvent", this); + this.itemAddedEvent = new CustomEvent("itemAddedEvent", this); + this.itemRemovedEvent = new CustomEvent("itemRemovedEvent", this); + +}, + + +/** +* @method getRoot +* @description Finds the menu's root menu. +*/ +getRoot: function() { + + var oItem = this.parent; + + if(oItem) { + + var oParentMenu = oItem.parent; + + return oParentMenu ? oParentMenu.getRoot() : this; + + } + else { + + return this; + + } + +}, + + +/** +* @method toString +* @description Returns a string representing the menu. +* @return {String} +*/ +toString: function() { + + return ("Menu " + this.id); + +}, + + +/** +* @method setItemGroupTitle +* @description Sets the title of a group of menu items. +* @param {String} p_sGroupTitle String specifying the title of the group. +* @param {Number} p_nGroupIndex Optional. Number specifying the group to which +* the title belongs. +*/ +setItemGroupTitle: function(p_sGroupTitle, p_nGroupIndex) { + + if(typeof p_sGroupTitle == "string" && p_sGroupTitle.length > 0) { + + var nGroupIndex = typeof p_nGroupIndex == "number" ? p_nGroupIndex : 0, + oTitle = this._aGroupTitleElements[nGroupIndex]; + + + if(oTitle) { + + oTitle.innerHTML = p_sGroupTitle; + + } + else { + + oTitle = document.createElement(this.GROUP_TITLE_TAG_NAME); + + oTitle.innerHTML = p_sGroupTitle; + + this._aGroupTitleElements[nGroupIndex] = oTitle; + + } + + + var i = this._aGroupTitleElements.length - 1, + nFirstIndex; + + do { + + if(this._aGroupTitleElements[i]) { + + Dom.removeClass(this._aGroupTitleElements[i], "first-of-type"); + + nFirstIndex = i; + + } + + } + while(i--); + + + if(nFirstIndex !== null) { + + Dom.addClass( + this._aGroupTitleElements[nFirstIndex], + "first-of-type" + ); + + } + + } + +}, + + + +/** +* @method addItem +* @description Appends an item to the menu. +* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem +* instance to be added to the menu. +* @param {String} p_oItem String specifying the text of the item to be added +* to the menu. +* @param {Object} p_oItem Object literal containing a set of menu item +* configuration properties. +* @param {Number} p_nGroupIndex Optional. Number indicating the group to +* which the item belongs. +* @return {YAHOO.widget.MenuItem} +*/ +addItem: function(p_oItem, p_nGroupIndex) { + + if(p_oItem) { + + return this._addItemToGroup(p_nGroupIndex, p_oItem); + + } + +}, + + +/** +* @method addItems +* @description Adds an array of items to the menu. +* @param {Array} p_aItems Array of items to be added to the menu. The array +* can contain strings specifying the text for each item to be created, object +* literals specifying each of the menu item configuration properties, +* or MenuItem instances. +* @param {Number} p_nGroupIndex Optional. Number specifying the group to +* which the items belongs. +* @return {Array} +*/ +addItems: function(p_aItems, p_nGroupIndex) { + + function isArray(p_oValue) { + + return (typeof p_oValue == "object" && p_oValue.constructor == Array); + + } + + + if(isArray(p_aItems)) { + + var nItems = p_aItems.length, + aItems = [], + oItem; + + + for(var i=0; i<div> element +* (and accompanying child nodes) from the document. +*/ +destroy: function() { + + // Remove Custom Event listeners + + this.mouseOverEvent.unsubscribeAll(); + this.mouseOutEvent.unsubscribeAll(); + this.mouseDownEvent.unsubscribeAll(); + this.mouseUpEvent.unsubscribeAll(); + this.clickEvent.unsubscribeAll(); + this.keyPressEvent.unsubscribeAll(); + this.keyDownEvent.unsubscribeAll(); + this.keyUpEvent.unsubscribeAll(); + this.itemAddedEvent.unsubscribeAll(); + this.itemRemovedEvent.unsubscribeAll(); + + var nItemGroups = this._aItemGroups.length, + nItems, + oItemGroup, + oItem, + i, + n; + + + // Remove all items + + if(nItemGroups > 0) { + + i = nItemGroups - 1; + + do { + + oItemGroup = this._aItemGroups[i]; + + if(oItemGroup) { + + nItems = oItemGroup.length; + + if(nItems > 0) { + + n = nItems - 1; + + do { + + oItem = this._aItemGroups[i][n]; + + if(oItem) { + + oItem.destroy(); + } + + } + while(n--); + + } + + } + + } + while(i--); + + } + + + // Continue with the superclass implementation of this method + + YAHOO.widget.Menu.superclass.destroy.call(this); + + +}, + + +/** +* @method setInitialFocus +* @description Sets focus to the menu's first enabled item. +*/ +setInitialFocus: function() { + + var oItem = this._getFirstEnabledItem(); + + if(oItem) { + + oItem.focus(); + } + +}, + + +/** +* @method setInitialSelection +* @description Sets the "selected" configuration property of the menu's first +* enabled item to "true." +*/ +setInitialSelection: function() { + + var oItem = this._getFirstEnabledItem(); + + if(oItem) { + + oItem.cfg.setProperty("selected", true); + } + +}, + + +/** +* @method clearActiveItem +* @description Sets the "selected" configuration property of the menu's active +* item to "false" and hides the item's submenu. +* @param {Boolean} p_bBlur Boolean indicating if the menu's active item +* should be blurred. +*/ +clearActiveItem: function(p_bBlur) { + + if(this.cfg.getProperty("showdelay") > 0) { + + this._cancelShowDelay(); + + } + + + var oActiveItem = this.activeItem; + + if(oActiveItem) { + + var oConfig = oActiveItem.cfg; + + oConfig.setProperty("selected", false); + + var oSubmenu = oConfig.getProperty("submenu"); + + if(oSubmenu) { + + oSubmenu.hide(); + + } + + if(p_bBlur) { + + oActiveItem.blur(); + + } + + } + +}, + + +/** +* @description Initializes the class's configurable properties which can be +* changed using the menu's Config object ("cfg"). +* @method initDefaultConfig +*/ +initDefaultConfig: function() { + + YAHOO.widget.Menu.superclass.initDefaultConfig.call(this); + + var oConfig = this.cfg; + + // Add configuration properties + + /* + Change the default value for the "visible" configuration + property to "false" by re-adding the property. + */ + + /** + * @config visible + * @description Boolean indicating whether or not the menu is visible. If + * the menu's "position" configuration property is set to "dynamic" (the + * default), this property toggles the menu's <div> + * element's "visibility" style property between "visible" (true) or + * "hidden" (false). If the menu's "position" configuration property is + * set to "static" this property toggles the menu's + * <div> element's "display" style property + * between "block" (true) or "none" (false). + * @default false + * @type Boolean + */ + oConfig.addProperty( + "visible", + { + value:false, + handler:this.configVisible, + validator:this.cfg.checkBoolean + } + ); + + + /* + Change the default value for the "constraintoviewport" configuration + property to "true" by re-adding the property. + */ + + /** + * @config constraintoviewport + * @description Boolean indicating if the menu will try to remain inside + * the boundaries of the size of viewport. + * @default true + * @type Boolean + */ + oConfig.addProperty( + "constraintoviewport", + { + value:true, + handler:this.configConstrainToViewport, + validator:this.cfg.checkBoolean, + supercedes:["iframe","x","y","xy"] + } + ); + + + /** + * @config position + * @description String indicating how a menu should be positioned on the + * screen. Possible values are "static" and "dynamic." Static menus are + * visible by default and reside in the normal flow of the document + * (CSS position: static). Dynamic menus are hidden by default, reside + * out of the normal flow of the document (CSS position: absolute), and + * can overlay other elements on the screen. + * @default dynamic + * @type String + */ + oConfig.addProperty( + "position", + { + value: "dynamic", + handler: this.configPosition, + validator: this._checkPosition, + supercedes: ["visible"] + } + ); + + + /** + * @config submenualignment + * @description Array defining how submenus should be aligned to their + * parent menu item. The format is: [itemCorner, submenuCorner]. By default + * a submenu's top left corner is aligned to its parent menu item's top + * right corner. + * @default ["tl","tr"] + * @type Array + */ + oConfig.addProperty("submenualignment", { value: ["tl","tr"] } ); + + + /** + * @config autosubmenudisplay + * @description Boolean indicating if submenus are automatically made + * visible when the user mouses over the menu's items. + * @default true + * @type Boolean + */ + oConfig.addProperty( + "autosubmenudisplay", + { + value: true, + validator: oConfig.checkBoolean + } + ); + + + /** + * @config showdelay + * @description Number indicating the time (in milliseconds) that should + * expire before a submenu is made visible when the user mouses over + * the menu's items. + * @default 0 + * @type Number + */ + oConfig.addProperty( + "showdelay", + { + value: 0, + validator: oConfig.checkNumber + } + ); + + + /** + * @config hidedelay + * @description Number indicating the time (in milliseconds) that should + * expire before the menu is hidden. + * @default 0 + * @type Number + */ + oConfig.addProperty( + "hidedelay", + { + value: 0, + validator: oConfig.checkNumber, + handler: this.configHideDelay, + suppressEvent: true + } + ); + + + /** + * @config clicktohide + * @description Boolean indicating if the menu will automatically be + * hidden if the user clicks outside of it. + * @default true + * @type Boolean + */ + oConfig.addProperty( + "clicktohide", + { + value: true, + validator: oConfig.checkBoolean + } + ); + + + /** + * @config container + * @description HTML element reference or string specifying the id + * attribute of the HTML element that the menu's markup should be rendered into. + * @type HTMLElement|String + * @default document.body + */ + this.cfg.addProperty( + "container", + { value:document.body, handler:this.configContainer } + ); + +} + +}); // END YAHOO.extend + })(); /** @@ -3838,9 +4054,9 @@ YAHOO.widget.MenuModule = YAHOO.widget.Menu; (function() { -var Dom = YAHOO.util.Dom; -var Module = YAHOO.widget.Module; -var Menu = YAHOO.widget.Menu; +var Dom = YAHOO.util.Dom, + Module = YAHOO.widget.Module, + Menu = YAHOO.widget.Menu; /** * Creates an item for a menu. @@ -4361,10 +4577,10 @@ YAHOO.widget.MenuItem.prototype = { // Get the anchor node (if it exists) - var oAnchor = this._getFirstElement(p_oObject, "A"); - var sURL = "#"; - var sTarget = null; - var sText = null; + var oAnchor = this._getFirstElement(p_oObject, "A"), + sURL = "#", + sTarget, + sText; // Capture the "text" and/or the "URL" @@ -4412,9 +4628,9 @@ YAHOO.widget.MenuItem.prototype = { // Check if emphasis has been applied to the MenuItem - var oEmphasisNode = this._getFirstElement(oAnchor); - var bEmphasis = false; - var bStrongEmphasis = false; + var oEmphasisNode = this._getFirstElement(oAnchor), + bEmphasis = false, + bStrongEmphasis = false; if(oEmphasisNode) { @@ -4601,8 +4817,8 @@ YAHOO.widget.MenuItem.prototype = { */ _initSubTree: function() { - var oSrcEl = this.srcElement; - var oConfig = this.cfg; + var oSrcEl = this.srcElement, + oConfig = this.cfg; if(oSrcEl.childNodes.length > 0) { @@ -4620,8 +4836,8 @@ YAHOO.widget.MenuItem.prototype = { } else { - var oNode = oSrcEl.firstChild; - var aOptions = []; + var oNode = oSrcEl.firstChild, + aOptions = []; do { @@ -4732,19 +4948,19 @@ YAHOO.widget.MenuItem.prototype = { */ configHelpText: function(p_sType, p_aArgs, p_oItem) { - var me = this; - var oHelpText = p_aArgs[0]; - var oEl = this.element; - var oConfig = this.cfg; - var aNodes = [oEl, this._oAnchor]; - var oImg = this.submenuIndicator; + var me = this, + oHelpText = p_aArgs[0], + oEl = this.element, + oConfig = this.cfg, + aNodes = [oEl, this._oAnchor], + oImg = this.submenuIndicator; /** * Adds the "hashelptext" class to the necessary nodes and refires the * "selected" and "disabled" configuration events. * @private */ - var initHelpText = function() { + function initHelpText() { Dom.addClass(aNodes, "hashelptext"); @@ -4760,20 +4976,20 @@ YAHOO.widget.MenuItem.prototype = { } - }; + } /** * Removes the "hashelptext" class and corresponding DOM element (EM). * @private */ - var removeHelpText = function() { + function removeHelpText() { Dom.removeClass(aNodes, "hashelptext"); oEl.removeChild(me._oHelpTextEM); me._oHelpTextEM = null; - }; + } if(this._checkDOMNode(oHelpText)) { @@ -4864,8 +5080,8 @@ YAHOO.widget.MenuItem.prototype = { */ configTarget: function(p_sType, p_aArgs, p_oItem) { - var sTarget = p_aArgs[0]; - var oAnchor = this._oAnchor; + var sTarget = p_aArgs[0], + oAnchor = this._oAnchor; if(sTarget && sTarget.length > 0) { @@ -4892,11 +5108,11 @@ YAHOO.widget.MenuItem.prototype = { */ configEmphasis: function(p_sType, p_aArgs, p_oItem) { - var bEmphasis = p_aArgs[0]; - var oAnchor = this._oAnchor; - var oText = this._oText; - var oConfig = this.cfg; - var oEM; + var bEmphasis = p_aArgs[0], + oAnchor = this._oAnchor, + oText = this._oText, + oConfig = this.cfg, + oEM; if(bEmphasis && oConfig.getProperty("strongemphasis")) { @@ -4918,8 +5134,12 @@ YAHOO.widget.MenuItem.prototype = { oEM = this._getFirstElement(oAnchor, "EM"); - oAnchor.removeChild(oEM); - oAnchor.appendChild(oText); + if(oEM) { + + oAnchor.removeChild(oEM); + oAnchor.appendChild(oText); + + } } @@ -4939,11 +5159,11 @@ YAHOO.widget.MenuItem.prototype = { */ configStrongEmphasis: function(p_sType, p_aArgs, p_oItem) { - var bStrongEmphasis = p_aArgs[0]; - var oAnchor = this._oAnchor; - var oText = this._oText; - var oConfig = this.cfg; - var oStrong; + var bStrongEmphasis = p_aArgs[0], + oAnchor = this._oAnchor, + oText = this._oText, + oConfig = this.cfg, + oStrong; if(bStrongEmphasis && oConfig.getProperty("emphasis")) { @@ -4965,8 +5185,12 @@ YAHOO.widget.MenuItem.prototype = { oStrong = this._getFirstElement(oAnchor, "STRONG"); - oAnchor.removeChild(oStrong); - oAnchor.appendChild(oText); + if(oStrong) { + + oAnchor.removeChild(oStrong); + oAnchor.appendChild(oText); + + } } @@ -4986,10 +5210,10 @@ YAHOO.widget.MenuItem.prototype = { */ configChecked: function(p_sType, p_aArgs, p_oItem) { - var bChecked = p_aArgs[0]; - var oEl = this.element; - var oConfig = this.cfg; - var oImg; + var bChecked = p_aArgs[0], + oEl = this.element, + oConfig = this.cfg, + oImg; if(bChecked) { @@ -5062,14 +5286,14 @@ YAHOO.widget.MenuItem.prototype = { */ configDisabled: function(p_sType, p_aArgs, p_oItem) { - var bDisabled = p_aArgs[0]; - var oAnchor = this._oAnchor; - var aNodes = [this.element, oAnchor]; - var oEM = this._oHelpTextEM; - var oConfig = this.cfg; - var oImg; - var sImgSrc; - var sImgAlt; + var bDisabled = p_aArgs[0], + oAnchor = this._oAnchor, + aNodes = [this.element, oAnchor], + oEM = this._oHelpTextEM, + oConfig = this.cfg, + oImg, + sImgSrc, + sImgAlt; if(oEM) { @@ -5147,11 +5371,11 @@ YAHOO.widget.MenuItem.prototype = { if(!this.cfg.getProperty("disabled")) { - var bSelected = p_aArgs[0]; - var oEM = this._oHelpTextEM; - var aNodes = [this.element, this._oAnchor]; - var oImg = this.submenuIndicator; - var sImgSrc; + var bSelected = p_aArgs[0], + oEM = this._oHelpTextEM, + aNodes = [this.element, this._oAnchor], + oImg = this.submenuIndicator, + sImgSrc; if(oEM) { @@ -5210,13 +5434,13 @@ YAHOO.widget.MenuItem.prototype = { */ configSubmenu: function(p_sType, p_aArgs, p_oItem) { - var oEl = this.element; - var oSubmenu = p_aArgs[0]; - var oImg = this.submenuIndicator; - var oConfig = this.cfg; - var aNodes = [this.element, this._oAnchor]; - var oMenu; - var bLazyLoad = this.parent && this.parent.lazyLoad; + var oEl = this.element, + oSubmenu = p_aArgs[0], + oImg = this.submenuIndicator, + oConfig = this.cfg, + aNodes = [this.element, this._oAnchor], + oMenu, + bLazyLoad = this.parent && this.parent.lazyLoad; if(oSubmenu) { @@ -5233,10 +5457,8 @@ YAHOO.widget.MenuItem.prototype = { !oSubmenu.nodeType ) { - var sSubmenuId = oSubmenu.id; - var oSubmenuConfig = oSubmenu; - - delete oSubmenu["id"]; + var sSubmenuId = oSubmenu.id, + oSubmenuConfig = oSubmenu; oSubmenuConfig.lazyload = bLazyLoad; oSubmenuConfig.parent = this; @@ -5334,8 +5556,8 @@ YAHOO.widget.MenuItem.prototype = { */ initDefaultConfig : function() { - var oConfig = this.cfg; - var CheckBoolean = oConfig.checkBoolean; + var oConfig = this.cfg, + CheckBoolean = oConfig.checkBoolean; // Define the config properties @@ -5527,16 +5749,16 @@ YAHOO.widget.MenuItem.prototype = { * start searching the array. * @return {Object} */ - var getNextArrayItem = function(p_aArray, p_nStartIndex) { + function getNextArrayItem(p_aArray, p_nStartIndex) { return p_aArray[p_nStartIndex] || getNextArrayItem(p_aArray, (p_nStartIndex+1)); - }; + } - var aItemGroups = this.parent.getItemGroups(); - var oNextItem; + var aItemGroups = this.parent.getItemGroups(), + oNextItem; if(this.index < (aItemGroups[nGroupIndex].length - 1)) { @@ -5599,12 +5821,12 @@ YAHOO.widget.MenuItem.prototype = { * start searching the array. * @return {Object} */ - var getPreviousArrayItem = function(p_aArray, p_nStartIndex) { + function getPreviousArrayItem(p_aArray, p_nStartIndex) { return p_aArray[p_nStartIndex] || getPreviousArrayItem(p_aArray, (p_nStartIndex-1)); - }; + } /** * Get the index of the first item in an array @@ -5614,16 +5836,16 @@ YAHOO.widget.MenuItem.prototype = { * start searching the array. * @return {Object} */ - var getFirstItemIndex = function(p_aArray, p_nStartIndex) { + function getFirstItemIndex(p_aArray, p_nStartIndex) { return p_aArray[p_nStartIndex] ? p_nStartIndex : getFirstItemIndex(p_aArray, (p_nStartIndex+1)); - }; + } - var aItemGroups = this.parent.getItemGroups(); - var oPreviousItem; + var aItemGroups = this.parent.getItemGroups(), + oPreviousItem; if( this.index > getFirstItemIndex(aItemGroups[nGroupIndex], 0) @@ -5679,9 +5901,22 @@ YAHOO.widget.MenuItem.prototype = { */ focus: function() { - var oParent = this.parent; - var oAnchor = this._oAnchor; - var oActiveItem = oParent.activeItem; + var oParent = this.parent, + oAnchor = this._oAnchor, + oActiveItem = oParent.activeItem; + + function setFocus() { + + try { + + oAnchor.focus(); + + } + catch(e) { + + } + + } if( !this.cfg.getProperty("disabled") && @@ -5696,14 +5931,13 @@ YAHOO.widget.MenuItem.prototype = { } - try { - - oAnchor.focus(); - - } - catch(e) { + /* + Setting focus via a timer fixes a race condition in Firefox, IE + and Opera where the browser viewport jumps as it trys to + position and focus the menu. + */ - } + window.setTimeout(setFocus, 0); this.focusEvent.fire(); @@ -5745,6 +5979,16 @@ YAHOO.widget.MenuItem.prototype = { if(oEl) { + // If the item has a submenu, destroy it first + + var oSubmenu = this.cfg.getProperty("submenu"); + + if(oSubmenu) { + + oSubmenu.destroy(); + + } + // Remove CustomEvent listeners this.mouseOverEvent.unsubscribeAll(); @@ -5935,9 +6179,9 @@ init: function(p_oElement, p_oConfig) { */ _removeEventHandlers: function() { - var Event = YAHOO.util.Event; - var oTrigger = this._oTrigger; - var bOpera = (this.browser == "opera"); + var Event = YAHOO.util.Event, + oTrigger = this._oTrigger, + bOpera = (this.browser == "opera"); // Remove the event handlers from the trigger(s) @@ -5993,8 +6237,8 @@ _onTriggerContextMenu: function(p_oEvent, p_oMenu) { YAHOO.widget.MenuManager.hideVisible(); - var Event = YAHOO.util.Event; - var oConfig = this.cfg; + var Event = YAHOO.util.Event, + oConfig = this.cfg; if(p_oEvent.type == "mousedown" && !p_oEvent.ctrlKey) { @@ -6006,8 +6250,8 @@ _onTriggerContextMenu: function(p_oEvent, p_oMenu) { // Position and display the context menu - var nX = Event.getPageX(p_oEvent); - var nY = Event.getPageY(p_oEvent); + var nX = Event.getPageX(p_oEvent), + nY = Event.getPageY(p_oEvent); oConfig.applyConfig( { xy:[nX, nY], visible:true } ); oConfig.fireQueue(); @@ -6090,8 +6334,8 @@ destroy: function() { */ configTrigger: function(p_sType, p_aArgs, p_oMenu) { - var Event = YAHOO.util.Event; - var oTrigger = p_aArgs[0]; + var Event = YAHOO.util.Event, + oTrigger = p_aArgs[0]; if(oTrigger) { @@ -6355,130 +6599,120 @@ CSS_CLASS_NAME: "yuimenubar", */ _onKeyDown: function(p_sType, p_aArgs, p_oMenuBar) { - var Event = YAHOO.util.Event; - var oEvent = p_aArgs[0]; - var oItem = p_aArgs[1]; - var oItemCfg = oItem.cfg; - var oSubmenu; + var Event = YAHOO.util.Event, + oEvent = p_aArgs[0], + oItem = p_aArgs[1], + oSubmenu; - switch(oEvent.keyCode) { + if(oItem && !oItem.cfg.getProperty("disabled")) { - case 27: // Esc key + var oItemCfg = oItem.cfg; - if(this.cfg.getProperty("position") == "dynamic") { + switch(oEvent.keyCode) { - this.hide(); + case 37: // Left arrow + case 39: // Right arrow - if(this.parent) { + if( + oItem == this.activeItem && + !oItemCfg.getProperty("selected") + ) { - this.parent.focus(); + oItemCfg.setProperty("selected", true); } + else { - } - else if(this.activeItem) { + var oNextItem = (oEvent.keyCode == 37) ? + oItem.getPreviousEnabledSibling() : + oItem.getNextEnabledSibling(); - oSubmenu = this.activeItem.cfg.getProperty("submenu"); + if(oNextItem) { - if(oSubmenu && oSubmenu.cfg.getProperty("visible")) { + this.clearActiveItem(); - oSubmenu.hide(); - this.activeItem.focus(); + oNextItem.cfg.setProperty("selected", true); - } - else { - this.activeItem.cfg.setProperty("selected", false); - this.activeItem.blur(); + if(this.cfg.getProperty("autosubmenudisplay")) { - } + oSubmenu = oNextItem.cfg.getProperty("submenu"); - } + if(oSubmenu) { + oSubmenu.show(); + oSubmenu.activeItem.blur(); + oSubmenu.activeItem = null; - Event.preventDefault(oEvent); + } - break; + } - case 37: // Left arrow - case 39: // Right arrow + oNextItem.focus(); - if( - oItem == this.activeItem && - !oItemCfg.getProperty("selected") - ) { + } - oItemCfg.setProperty("selected", true); + } - } - else { + Event.preventDefault(oEvent); + + break; - var oNextItem = (oEvent.keyCode == 37) ? - oItem.getPreviousEnabledSibling() : - oItem.getNextEnabledSibling(); + case 40: // Down arrow - if(oNextItem) { + if(this.activeItem != oItem) { this.clearActiveItem(); - oNextItem.cfg.setProperty("selected", true); + oItemCfg.setProperty("selected", true); + oItem.focus(); - if(this.cfg.getProperty("autosubmenudisplay")) { + } - oSubmenu = oNextItem.cfg.getProperty("submenu"); + oSubmenu = oItemCfg.getProperty("submenu"); - if(oSubmenu) { + if(oSubmenu) { - oSubmenu.show(); - oSubmenu.activeItem.blur(); - oSubmenu.activeItem = null; + if(oSubmenu.cfg.getProperty("visible")) { - } + oSubmenu.setInitialSelection(); + oSubmenu.setInitialFocus(); } + else { - oNextItem.focus(); - - } - - } - - Event.preventDefault(oEvent); - - break; - - case 40: // Down arrow + oSubmenu.show(); - if(this.activeItem != oItem) { + } - this.clearActiveItem(); + } - oItemCfg.setProperty("selected", true); - oItem.focus(); + Event.preventDefault(oEvent); - } + break; - oSubmenu = oItemCfg.getProperty("submenu"); + } - if(oSubmenu) { + } - if(oSubmenu.cfg.getProperty("visible")) { + if(oEvent.keyCode == 27 && this.activeItem) { // Esc key - oSubmenu.setInitialSelection(); - oSubmenu.setInitialFocus(); + oSubmenu = this.activeItem.cfg.getProperty("submenu"); - } - else { + if(oSubmenu && oSubmenu.cfg.getProperty("visible")) { - oSubmenu.show(); + oSubmenu.hide(); + this.activeItem.focus(); - } + } + else { - } + this.activeItem.cfg.setProperty("selected", false); + this.activeItem.blur(); - Event.preventDefault(oEvent); + } - break; + Event.preventDefault(oEvent); } @@ -6505,16 +6739,16 @@ _onClick: function(p_sType, p_aArgs, p_oMenuBar) { var oItem = p_aArgs[1]; - if(oItem) { + if(oItem && !oItem.cfg.getProperty("disabled")) { - var Event = YAHOO.util.Event; - var Dom = YAHOO.util.Dom; + var Event = YAHOO.util.Event, + Dom = YAHOO.util.Dom, - var oEvent = p_aArgs[0]; - var oTarget = Event.getTarget(oEvent); + oEvent = p_aArgs[0], + oTarget = Event.getTarget(oEvent), - var oActiveItem = this.activeItem; - var oConfig = this.cfg; + oActiveItem = this.activeItem, + oConfig = this.cfg; // Hide any other submenus that might be visible diff --git a/lib/yui/reset-fonts-grids/README b/lib/yui/reset-fonts-grids/README index d8e7eeb879..c35c53c41c 100755 --- a/lib/yui/reset-fonts-grids/README +++ b/lib/yui/reset-fonts-grids/README @@ -1,5 +1,9 @@ YUI Library - Reset+Fonts+Grids (RFG) - Release Notes +Version 0.12.1 + + * No changes. + Version 0.12.0 * Initial release. diff --git a/lib/yui/reset-fonts-grids/reset-fonts-grids.css b/lib/yui/reset-fonts-grids/reset-fonts-grids.css index 507ed66483..f70ed865b0 100755 --- a/lib/yui/reset-fonts-grids/reset-fonts-grids.css +++ b/lib/yui/reset-fonts-grids/reset-fonts-grids.css @@ -1,174 +1,4 @@ -/* -Copyright (c) 2006, Yahoo! Inc. All rights reserved. -Code licensed under the BSD License: -http://developer.yahoo.net/yui/license.txt -version: 0.12.0 -*/ - -/*=============*/ -/* reset.css */ -/*=============*/ - -body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td{margin:0;padding:0;} -table{border-collapse:collapse;border-spacing:0;} -fieldset,img{border:0;} -address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;} -ol,ul {list-style:none;} -caption,th {text-align:left;} -h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;} -q:before,q:after{content:'';} -abbr,acronym {border:0;} - -/*=============*/ -/* fonts.css */ -/*=============*/ - -/** - * 84.5% for !IE, keywords for IE to preserve user font-size adjustment - * Percents could work for IE, but for backCompat purposes, we are using keywords. - * x-small is for IE6/7 quirks mode. - * - */ -body {font:13px arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;} -table {font-size:inherit;font:100%;} -/** - * 99% for safari; 100% is too large - */ -select, input, textarea {font:99% arial,helvetica,clean,sans-serif;} -/** - * Bump up !IE to get to 13px equivalent - */ -pre, code {font:115% monospace;*font-size:100%;} -/** - * Default line-height based on font-size rather than "computed-value" - * see: http://www.w3.org/TR/CSS21/visudet.html#line-height - */ -body * {line-height:1.22em;} - -/*=============*/ -/* grids.css */ -/*=============*/ - -/* for all templates and grids */ -body{text-align:center;} -#ft{clear:both;} -/**/ -/* 750 centered, and backward compatibility */ -#doc,#doc2,#doc3,.yui-t1,.yui-t2,.yui-t3,.yui-t4,.yui-t5,.yui-t6,.yui-t7 { - margin:auto;text-align:left; - width:57.69em;*width:56.3em;min-width:750px;} -/* 950 centered */ -#doc2 { - width:73.074em;*width:71.313em;min-width:950px;} -/* 100% with 10px viewport side matting */ -#doc3 { - margin:auto 10px; /* not for structure, but so content doesn't bleed to edge */ - width:auto;} - -/* below required for all fluid grids; adjust widths and margins above accordingly */ - - /* to preserve source-order independence for Gecko */ - .yui-b{position:relative;} - .yui-b{_position:static;} /* for IE < 7 */ - #yui-main .yui-b{position:static;} - -#yui-main {width:100%;} -.yui-t1 #yui-main, -.yui-t2 #yui-main, -.yui-t3 #yui-main{float:right;margin-left:-25em;/* IE: preserve layout at narrow widths */} - -.yui-t4 #yui-main, -.yui-t5 #yui-main, -.yui-t6 #yui-main{float:left;margin-right:-25em;/* IE: preserve layout at narrow widths */} - -.yui-t1 .yui-b { - float:left; - width:12.3207em;*width:12.0106em;} -.yui-t1 #yui-main .yui-b{ - margin-left:13.3207em;*margin-left:13.0106em; -} - -.yui-t2 .yui-b { - float:left; - width:13.8456em;*width:13.512em;} -.yui-t2 #yui-main .yui-b { - margin-left:14.8456em;*margin-left:14.512em; -} - -.yui-t3 .yui-b { - float:left; - width:23.0759em;*width:22.52em;} -.yui-t3 #yui-main .yui-b { - margin-left:24.0759em;*margin-left:23.52em; -} - -.yui-t4 .yui-b { - float:right; - width:13.8456em;*width:13.512em;} -.yui-t4 #yui-main .yui-b { - margin-right:14.8456em;*margin-right:14.512em; -} - -.yui-t5 .yui-b { - float:right; - width:18.4608em;*width:18.016em;} -.yui-t5 #yui-main .yui-b { - margin-right:19.4608em;*margin-right:19.016em; -} - -.yui-t6 .yui-b { - float:right; - width:23.0759em;*width:22.52em;} -.yui-t6 #yui-main .yui-b { - margin-right:24.0759em;*margin-right:23.52em; -} - -.yui-t7 #yui-main .yui-b { - display:block;margin:0 0 1em 0; -} -#yui-main .yui-b {float:none;width:auto;} -/* GRIDS (not TEMPLATES) */ -.yui-g .yui-u, -.yui-g .yui-g, -.yui-gc .yui-u, -.yui-gc .yui-g .yui-u, -.yui-ge .yui-u, -.yui-gf .yui-u{float:right;display:inline;} -.yui-g div.first, -.yui-gc div.first, -.yui-gc div.first div.first, -.yui-gd div.first, -.yui-ge div.first, -.yui-gf div.first{float:left;} -.yui-g .yui-u, -.yui-g .yui-g{width:49.1%;} -.yui-g .yui-g .yui-u, -.yui-gc .yui-g .yui-u {width:48.1%;} -.yui-gb .yui-u, -.yui-gc .yui-u, -.yui-gd .yui-u{float:left;margin-left:2%;*margin-left:1.895%;width:32%;} -.yui-gb div.first, -.yui-gc div.first, -.yui-gd div.first{margin-left:0;} -.yui-gc div.first, -.yui-gd .yui-u{width:66%;} -.yui-gd div.first{width:32%;} -.yui-ge .yui-u{width:24%;} -.yui-ge div.first, -.yui-gf .yui-u{width:74.2%;} -.yui-gf div.first{width:24%;} -.yui-ge div.first{width:74.2%;} -#bd:after, -.yui-g:after, -.yui-gb:after, -.yui-gc:after, -.yui-gd:after, -.yui-ge:after, -.yui-gf:after{content:".";display:block;height:0;clear:both;visibility:hidden;} -#bd, -.yui-g, -.yui-gb, -.yui-gc, -.yui-gd, -.yui-ge, -.yui-gf{zoom:1;} \ No newline at end of file +/*Copyright (c) 2006,Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt version 0.12.1*/ +/*reset.css*/body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}ol,ul {list-style:none;}caption,th {text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym {border:0;} +/*fonts.css*/body{font:13px arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}table {font-size:inherit;font:100%;}select, input, textarea {font:99% arial,helvetica,clean,sans-serif;}pre, code {font:115% monospace;*font-size:100%;}body * {line-height:1.22em;} +/*grids.css*/body{text-align:center;}#ft{clear:both;}#doc,#doc2,#doc3,.yui-t1,.yui-t2,.yui-t3,.yui-t4,.yui-t5,.yui-t6,.yui-t7{margin:auto;text-align:left;width:57.69em;*width:56.3em;min-width:750px;}#doc2{width:73.074em;*width:71.313em;min-width:950px;}#doc3{margin:auto 10px;width:auto;}.yui-b{position:relative;}.yui-b{_position:static;}#yui-main .yui-b{position:static;}#yui-main{width:100%;}.yui-t1 #yui-main,.yui-t2 #yui-main,.yui-t3 #yui-main{float:right;margin-left:-25em;}.yui-t4 #yui-main,.yui-t5 #yui-main,.yui-t6 #yui-main{float:left;margin-right:-25em;}.yui-t1 .yui-b{float:left;width:12.3207em;*width:12.0106em;}.yui-t1 #yui-main .yui-b{margin-left:13.3207em;*margin-left:13.0106em;}.yui-t2 .yui-b{float:left;width:13.8456em;*width:13.512em;}.yui-t2 #yui-main .yui-b{margin-left:14.8456em;*margin-left:14.512em;}.yui-t3 .yui-b{float:left;width:23.0759em;*width:22.52em;}.yui-t3 #yui-main .yui-b{margin-left:24.0759em;*margin-left:23.52em;}.yui-t4 .yui-b{float:right;width:13.8456em;*width:13.512em;}.yui-t4 #yui-main .yui-b{margin-right:14.8456em;*margin-right:14.512em;}.yui-t5 .yui-b{float:right;width:18.4608em;*width:18.016em;}.yui-t5 #yui-main .yui-b{margin-right:19.4608em;*margin-right:19.016em;}.yui-t6 .yui-b{float:right;width:23.0759em;*width:22.52em;}.yui-t6 #yui-main .yui-b{margin-right:24.0759em;*margin-right:23.52em;}.yui-t7 #yui-main .yui-b{display:block;margin:0 0 1em 0;}#yui-main .yui-b{float:none;width:auto;}.yui-g .yui-u,.yui-g .yui-g,.yui-gc .yui-u,.yui-gc .yui-g .yui-u,.yui-ge .yui-u,.yui-gf .yui-u{float:right;display:inline;}.yui-g div.first,.yui-gc div.first,.yui-gc div.first div.first,.yui-gd div.first,.yui-ge div.first,.yui-gf div.first{float:left;}.yui-g .yui-u,.yui-g .yui-g{width:49.1%;}.yui-g .yui-g .yui-u,.yui-gc .yui-g .yui-u{width:48.1%;}.yui-gb .yui-u,.yui-gc .yui-u,.yui-gd .yui-u{float:left;margin-left:2%;*margin-left:1.895%;width:32%;}.yui-gb div.first,.yui-gc div.first,.yui-gd div.first{margin-left:0;}.yui-gc div.first,.yui-gd .yui-u{width:66%;}.yui-gd div.first{width:32%;}.yui-ge .yui-u{width:24%;}.yui-ge div.first,.yui-gf .yui-u{width:74.2%;}.yui-gf div.first{width:24%;}.yui-ge div.first{width:74.2%;}#bd:after,.yui-g:after,.yui-gb:after,.yui-gc:after,.yui-gd:after,.yui-ge:after,.yui-gf:after{content:".";display:block;height:0;clear:both;visibility:hidden;}#bd,.yui-g,.yui-gb,.yui-gc,.yui-gd,.yui-ge,.yui-gf{zoom:1;} \ No newline at end of file diff --git a/lib/yui/reset/README b/lib/yui/reset/README index 990e8ccffa..ab248cc60b 100755 --- a/lib/yui/reset/README +++ b/lib/yui/reset/README @@ -1,5 +1,9 @@ YUI Library - Reset - Release Notes +Version 0.12.1 + + * No changes. + Version 0.12.0 * Added: h1,h2,h3,h4,h5,h6{font-weight:normal;} diff --git a/lib/yui/reset/reset-min.css b/lib/yui/reset/reset-min.css index d7e1533355..7428454d63 100755 --- a/lib/yui/reset/reset-min.css +++ b/lib/yui/reset/reset-min.css @@ -1 +1 @@ -/* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt version: 0.12.0 */ body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}ol,ul {list-style:none;}caption,th {text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym {border:0;} \ No newline at end of file +/* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt version: 0.12.1 */ body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}ol,ul {list-style:none;}caption,th {text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym {border:0;} \ No newline at end of file diff --git a/lib/yui/reset/reset.css b/lib/yui/reset/reset.css index c488811147..a2e0de7ff0 100755 --- a/lib/yui/reset/reset.css +++ b/lib/yui/reset/reset.css @@ -2,7 +2,7 @@ Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt -version: 0.12.0 +version: 0.12.1 */ body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td{margin:0;padding:0;} table{border-collapse:collapse;border-spacing:0;} diff --git a/lib/yui/slider/README b/lib/yui/slider/README index dc317b4690..80b615b162 100755 --- a/lib/yui/slider/README +++ b/lib/yui/slider/README @@ -1,5 +1,10 @@ Slider - Release Notes +0.12.1 + + * Removed unneccessary getXY calls that were contribuing to slower performance + in FireFox when the slider was deeply nested in the DOM. + 0.12.0 * Added "slideStart", "slideEnd", and "change" custom events. The abstract diff --git a/lib/yui/slider/slider-debug.js b/lib/yui/slider/slider-debug.js index af921eed59..b1f2f31158 100755 --- a/lib/yui/slider/slider-debug.js +++ b/lib/yui/slider/slider-debug.js @@ -1,16 +1,15 @@ -/* +/* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt -version: 0.12.0 -*/ - +version: 0.12.1 +*/ /** - * The Slider component is a UI control that enables the user to adjust - * values in a finite range along one or two axes. Typically, the Slider - * control is used in a web application as a rich, visual replacement - * for an input box that takes a number as input. The Slider control can - * also easily accommodate a second dimension, providing x,y output for + * The Slider component is a UI control that enables the user to adjust + * values in a finite range along one or two axes. Typically, the Slider + * control is used in a web application as a rich, visual replacement + * for an input box that takes a number as input. The Slider control can + * also easily accommodate a second dimension, providing x,y output for * a selection point chosen from a rectangular region. * * @module slider @@ -22,20 +21,104 @@ version: 0.12.0 /** * A DragDrop implementation that can be used as a background for a - * slider. It takes a reference to the thumb instance - * so it can delegate some of the events to it. The goal is to make the - * thumb jump to the location on the background when the background is - * clicked. + * slider. It takes a reference to the thumb instance + * so it can delegate some of the events to it. The goal is to make the + * thumb jump to the location on the background when the background is + * clicked. * * @class Slider * @extends YAHOO.util.DragDrop + * @uses YAHOO.util.EventProvider * @constructor - * @param {String} id The id of the element linked to this instance - * @param {String} sGroup The group of related DragDrop items - * @param {String} sType The type of slider (horiz, vert, region) + * @param {String} id The id of the element linked to this instance + * @param {String} sGroup The group of related DragDrop items + * @param {SliderThumb} oThumb The thumb for this slider + * @param {String} sType The type of slider (horiz, vert, region) */ YAHOO.widget.Slider = function(sElementId, sGroup, oThumb, sType) { if (sElementId) { + this.init(sElementId, sGroup, true); + this.initSlider(sType); + this.initThumb(oThumb); + } +}; + +/** + * Factory method for creating a horizontal slider + * @method YAHOO.widget.Slider.getHorizSlider + * @static + * @param {String} sBGElId the id of the slider's background element + * @param {String} sHandleElId the id of the thumb element + * @param {int} iLeft the number of pixels the element can move left + * @param {int} iRight the number of pixels the element can move right + * @param {int} iTickSize optional parameter for specifying that the element + * should move a certain number pixels at a time. + * @return {Slider} a horizontal slider control + */ +YAHOO.widget.Slider.getHorizSlider = + function (sBGElId, sHandleElId, iLeft, iRight, iTickSize) { + return new YAHOO.widget.Slider(sBGElId, sBGElId, + new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, + iLeft, iRight, 0, 0, iTickSize), "horiz"); +}; + +/** + * Factory method for creating a vertical slider + * @method YAHOO.widget.Slider.getVertSlider + * @static + * @param {String} sBGElId the id of the slider's background element + * @param {String} sHandleElId the id of the thumb element + * @param {int} iUp the number of pixels the element can move up + * @param {int} iDown the number of pixels the element can move down + * @param {int} iTickSize optional parameter for specifying that the element + * should move a certain number pixels at a time. + * @return {Slider} a vertical slider control + */ +YAHOO.widget.Slider.getVertSlider = + function (sBGElId, sHandleElId, iUp, iDown, iTickSize) { + return new YAHOO.widget.Slider(sBGElId, sBGElId, + new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, 0, 0, + iUp, iDown, iTickSize), "vert"); +}; + +/** + * Factory method for creating a slider region like the one in the color + * picker example + * @method YAHOO.widget.Slider.getSliderRegion + * @static + * @param {String} sBGElId the id of the slider's background element + * @param {String} sHandleElId the id of the thumb element + * @param {int} iLeft the number of pixels the element can move left + * @param {int} iRight the number of pixels the element can move right + * @param {int} iUp the number of pixels the element can move up + * @param {int} iDown the number of pixels the element can move down + * @param {int} iTickSize optional parameter for specifying that the element + * should move a certain number pixels at a time. + * @return {Slider} a slider region control + */ +YAHOO.widget.Slider.getSliderRegion = + function (sBGElId, sHandleElId, iLeft, iRight, iUp, iDown, iTickSize) { + return new YAHOO.widget.Slider(sBGElId, sBGElId, + new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, iLeft, iRight, + iUp, iDown, iTickSize), "region"); +}; + +/** + * By default, animation is available if the animation library is detected. + * @property YAHOO.widget.Slider.ANIM_AVAIL + * @static + * @type boolean + */ +YAHOO.widget.Slider.ANIM_AVAIL = true; + +YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { + + /** + * Initializes the slider. Executed in the constructor + * @method initSlider + * @param {string} sType the type of slider (horiz, vert, region) + */ + initSlider: function(sType) { /** * The type of the slider (horiz, vert, region) @@ -44,30 +127,24 @@ YAHOO.widget.Slider = function(sElementId, sGroup, oThumb, sType) { */ this.type = sType; - this.init(sElementId, sGroup, true); - //this.removeInvalidHandleType("A"); this.logger = new YAHOO.widget.LogWriter(this.toString()); - var self = this; - /** - * Event the fires when the value of the control changes. If + * Event the fires when the value of the control changes. If * the control is animated the event will fire every point * along the way. * @event change - * @param {int} new - * @param {int} firstOffset the number of pixels the thumb has moved - * from its start position. Normal horizontal and vertical sliders will only - * have the firstOffset. Regions will have both, the first is the horizontal - * offset, the second the vertical. - * @param {int} secondOffset the y offset for region sliders + * @param {int} newOffset|x the new offset for normal sliders, or the new + * x offset for region sliders + * @param {int} y the number of pixels the thumb has moved on the y axis + * (region sliders only) */ this.createEvent("change", this); /** - * Event that fires at the end of a slider thumb move. + * Event that fires at the beginning of a slider thumb move. * @event slideStart */ this.createEvent("slideStart", this); @@ -78,26 +155,13 @@ YAHOO.widget.Slider = function(sElementId, sGroup, oThumb, sType) { */ this.createEvent("slideEnd", this); - /** - * A YAHOO.widget.SliderThumb instance that we will use to - * reposition the thumb when the background is clicked - * @property thumb - * @type YAHOO.widget.SliderThumb - */ - this.thumb = oThumb; - - // add handler for the handle onchange event - oThumb.onChange = function() { - self.handleThumbChange(); - }; - /** * Overrides the isTarget property in YAHOO.util.DragDrop * @property isTarget * @private */ this.isTarget = false; - + /** * Flag that determines if the thumb will animate when moved * @property animate @@ -137,7 +201,7 @@ YAHOO.widget.Slider = function(sElementId, sGroup, oThumb, sType) { /** * moveComplete is set to true when the slider has moved to its final - * destination. For animated slider, this value can be checked in + * destination. For animated slider, this value can be checked in * the onChange handler to make it possible to execute logic only * when the move is complete rather than at all points along the way. * @@ -154,102 +218,64 @@ YAHOO.widget.Slider = function(sElementId, sGroup, oThumb, sType) { * @default 0.2 */ this.animationDuration = 0.2; + }, - if (oThumb._isHoriz && oThumb.xTicks && oThumb.xTicks.length) { - this.tickPause = Math.round(360 / oThumb.xTicks.length); - } else if (oThumb.yTicks && oThumb.yTicks.length) { - this.tickPause = Math.round(360 / oThumb.yTicks.length); - } + /** + * Initializes the slider's thumb. Executed in the constructor. + * @method initThumb + * @param {YAHOO.widget.SliderThumb} t the slider thumb + */ + initThumb: function(t) { - this.logger.log("tickPause: " + this.tickPause); + var self = this; - // delegate thumb methods - oThumb.onMouseDown = function () { return self.focus(); }; - //oThumb.b4MouseDown = function () { return self.b4MouseDown(); }; - // oThumb.lock = function() { self.lock(); }; - // oThumb.unlock = function() { self.unlock(); }; - oThumb.onMouseUp = function() { self.thumbMouseUp(); }; - oThumb.onDrag = function() { self.fireEvents(); }; - oThumb.onAvailable = function() { return self.setStartSliderState(); }; - } -}; + /** + * A YAHOO.widget.SliderThumb instance that we will use to + * reposition the thumb when the background is clicked + * @property thumb + * @type YAHOO.widget.SliderThumb + */ + this.thumb = t; + t.cacheBetweenDrags = true; -/** - * Factory method for creating a horizontal slider - * @method YAHOO.widget.Slider.getHorizSlider - * @static - * @param {String} sBGElId the id of the slider's background element - * @param {String} sHandleElId the id of the thumb element - * @param {int} iLeft the number of pixels the element can move left - * @param {int} iRight the number of pixels the element can move right - * @param {int} iTickSize optional parameter for specifying that the element - * should move a certain number pixels at a time. - * @return {Slider} a horizontal slider control - */ -YAHOO.widget.Slider.getHorizSlider = - function (sBGElId, sHandleElId, iLeft, iRight, iTickSize) { - return new YAHOO.widget.Slider(sBGElId, sBGElId, - new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, - iLeft, iRight, 0, 0, iTickSize), "horiz"); -}; + // add handler for the handle onchange event + t.onChange = function() { + self.handleThumbChange(); + }; -/** - * Factory method for creating a vertical slider - * @method YAHOO.widget.Slider.getVertSlider - * @static - * @param {String} sBGElId the id of the slider's background element - * @param {String} sHandleElId the id of the thumb element - * @param {int} iUp the number of pixels the element can move up - * @param {int} iDown the number of pixels the element can move down - * @param {int} iTickSize optional parameter for specifying that the element - * should move a certain number pixels at a time. - * @return {Slider} a vertical slider control - */ -YAHOO.widget.Slider.getVertSlider = - function (sBGElId, sHandleElId, iUp, iDown, iTickSize) { - return new YAHOO.widget.Slider(sBGElId, sBGElId, - new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, 0, 0, - iUp, iDown, iTickSize), "vert"); -}; + if (t._isHoriz && t.xTicks && t.xTicks.length) { + this.tickPause = Math.round(360 / t.xTicks.length); + } else if (t.yTicks && t.yTicks.length) { + this.tickPause = Math.round(360 / t.yTicks.length); + } -/** - * Factory method for creating a slider region like the one in the color - * picker example - * @method YAHOO.widget.Slider.getSliderRegion - * @static - * @param {String} sBGElId the id of the slider's background element - * @param {String} sHandleElId the id of the thumb element - * @param {int} iLeft the number of pixels the element can move left - * @param {int} iRight the number of pixels the element can move right - * @param {int} iUp the number of pixels the element can move up - * @param {int} iDown the number of pixels the element can move down - * @param {int} iTickSize optional parameter for specifying that the element - * should move a certain number pixels at a time. - * @return {Slider} a slider region control - */ -YAHOO.widget.Slider.getSliderRegion = - function (sBGElId, sHandleElId, iLeft, iRight, iUp, iDown, iTickSize) { - return new YAHOO.widget.Slider(sBGElId, sBGElId, - new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, iLeft, iRight, - iUp, iDown, iTickSize), "region"); -}; + this.logger.log("tickPause: " + this.tickPause); -/** - * By default, animation is available if the animation library is detected. - * @property YAHOO.widget.Slider.ANIM_AVAIL - * @static - * @type boolean - */ -YAHOO.widget.Slider.ANIM_AVAIL = true; + // delegate thumb methods + t.onMouseDown = function () { return self.focus(); }; + t.onMouseUp = function() { self.thumbMouseUp(); }; + t.onDrag = function() { self.fireEvents(true); }; + t.onAvailable = function() { return self.setStartSliderState(); }; -YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { + }, + /** + * Executed when the slider element is available + * @method onAvailable + */ onAvailable: function() { var Event = YAHOO.util.Event; Event.on(this.id, "keydown", this.handleKeyDown, this, true); Event.on(this.id, "keypress", this.handleKeyPress, this, true); }, - + + /** + * Executed when a keypress event happens with the control focused. + * Prevents the default behavior for navigation keys. The actual + * logic for moving the slider thumb in response to a key event + * happens in handleKeyDown. + * @param {Event} e the keypress event + */ handleKeyPress: function(e) { if (this.enableKeys) { var Event = YAHOO.util.Event; @@ -266,8 +292,14 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { default: } } - }, + }, + /** + * Executed when a keydown event happens with the control focused. + * Updates the slider value and display when the keypress is an + * arrow key, home, or end as long as enableKeys is set to true. + * @param {Event} e the keydown event + */ handleKeyDown: function(e) { if (this.enableKeys) { var Event = YAHOO.util.Event; @@ -292,13 +324,13 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { case 0x28: v += this.keyIncrement; break; // home - case 0x24: h = t.leftConstraint; - v = t.topConstraint; + case 0x24: h = t.leftConstraint; + v = t.topConstraint; break; // end - case 0x23: h = t.rightConstraint; - v = t.bottomConstraint; + case 0x23: h = t.rightConstraint; + v = t.bottomConstraint; break; default: changeValue = false; @@ -319,7 +351,7 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { /** * Initialization that sets up the value offsets once the elements are ready - * @method setSliderStartState + * @method setStartSliderState */ setStartSliderState: function() { @@ -366,14 +398,14 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { if (el) { /** - * The center of the slider element is stored so we can position + * The center of the slider element is stored so we can position * place it in the correct position when the background is clicked * @property thumbCenterPoint * @type {"x": int, "y": int} */ - this.thumbCenterPoint = { - x: parseInt(el.offsetWidth/2, 10), - y: parseInt(el.offsetHeight/2, 10) + this.thumbCenterPoint = { + x: parseInt(el.offsetWidth/2, 10), + y: parseInt(el.offsetHeight/2, 10) }; } @@ -439,7 +471,7 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { } catch(e) { // Prevent permission denied unhandled exception in FF that can // happen when setting focus while another element is handling - // the blur. @TODO this is still writing to the error log + // the blur. @TODO this is still writing to the error log // (unhandled error) in FF1.5 with strict error checking on. } } @@ -464,8 +496,8 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { * @param {int} secondOffset the y offset for region sliders * @deprecated use instance.subscribe("change") instead */ - onChange: function (firstOffset, secondOffset) { - /* override me */ + onChange: function (firstOffset, secondOffset) { + /* override me */ this.logger.log("onChange: " + firstOffset + ", " + secondOffset); }, @@ -474,8 +506,8 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { * @method onSlideStart * @deprecated use instance.subscribe("slideStart") instead */ - onSlideStart: function () { - /* override me */ + onSlideStart: function () { + /* override me */ this.logger.log("onSlideStart"); }, @@ -484,8 +516,8 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { * @method onSliderEnd * @deprecated use instance.subscribe("slideEnd") instead */ - onSlideEnd: function () { - /* override me */ + onSlideEnd: function () { + /* override me */ this.logger.log("onSlideEnd"); }, @@ -494,7 +526,7 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { * @method getValue * @return {int} the current value */ - getValue: function () { + getValue: function () { return this.thumb.getValue(); }, @@ -503,7 +535,7 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { * @method getXValue * @return {int} the current horizontal offset */ - getXValue: function () { + getXValue: function () { return this.thumb.getXValue(); }, @@ -512,7 +544,7 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { * @method getYValue * @return {int} the current vertical offset */ - getYValue: function () { + getYValue: function () { return this.thumb.getYValue(); }, @@ -521,7 +553,7 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { * @method handleThumbChange * @private */ - handleThumbChange: function () { + handleThumbChange: function () { var t = this.thumb; if (t._isRegion) { t.onChange(t.getXValue(), t.getYValue()); @@ -537,7 +569,7 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { * Provides a way to set the value of the slider in code. * @method setValue * @param {int} newOffset the number of pixels the thumb should be - * positioned away from the initial start point + * positioned away from the initial start point * @param {boolean} skipAnim set to true to disable the animation * for this move action (but not others). * @param {boolean} force ignore the locked setting and set value anyway @@ -564,7 +596,7 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { var t = this.thumb; var newX, newY; - this.verifyOffset(); + this.verifyOffset(true); if (t._isRegion) { return false; } else if (t._isHoriz) { @@ -628,13 +660,16 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { /** * Checks the background position element position. If it has moved from the * baseline position, the constraints for the thumb are reset + * @param checkPos {boolean} check the position instead of using cached value * @method verifyOffset * @return {boolean} True if the offset is the same as the baseline. */ - verifyOffset: function() { + verifyOffset: function(checkPos) { var newPos = YAHOO.util.Dom.getXY(this.getEl()); - this.logger.log("newPos: " + newPos); + //var newPos = [this.initPageX, this.initPageY]; + + this.logger.log("newPos: " + newPos, "warn"); if (newPos[0] != this.baselinePos[0] || newPos[1] != this.baselinePos[1]) { this.logger.log("background moved, resetting constraints"); @@ -647,8 +682,8 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { }, /** - * Move the associated slider moved to a timeout to try to get around the - * mousedown stealing moz does when I move the slider element between the + * Move the associated slider moved to a timeout to try to get around the + * mousedown stealing moz does when I move the slider element between the * cursor and the background during the mouseup event * @method moveThumb * @param {int} x the X coordinate of the click @@ -685,6 +720,9 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { // this.thumb._animating = true; this.lock(); + // cache the current thumb pos + this.curCoord = YAHOO.util.Dom.getXY(this.thumb.getEl()); + setTimeout( function() { self.moveOneTick(p); }, this.tickPause ); } else if (this.animate && YAHOO.widget.Slider.ANIM_AVAIL && !skipAnim) { @@ -693,9 +731,9 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { // this.thumb._animating = true; this.lock(); - var oAnim = new YAHOO.util.Motion( - t.id, { points: { to: p } }, - this.animationDuration, + var oAnim = new YAHOO.util.Motion( + t.id, { points: { to: p } }, + this.animationDuration, YAHOO.util.Easing.easeOut ); oAnim.onComplete.subscribe( function() { self.endMove(); } ); @@ -716,9 +754,15 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { */ moveOneTick: function(finalCoord) { - var t = this.thumb; - var curCoord = YAHOO.util.Dom.getXY(t.getEl()); - var tmp; + var t = this.thumb, tmp; + + + // redundant call to getXY since we set the position most of time prior + // to getting here. Moved to this.curCoord + //var curCoord = YAHOO.util.Dom.getXY(t.getEl()); + + // alignElWithMouse caches position in lastPageX, lastPageY .. doesn't work + //var curCoord = [this.lastPageX, this.lastPageY]; // var thresh = Math.min(t.tickSize + (Math.floor(t.tickSize/2)), 10); // var thresh = 10; @@ -727,23 +771,26 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { var nextCoord = null; if (t._isRegion) { - nextCoord = this._getNextX(curCoord, finalCoord); - var tmpX = (nextCoord) ? nextCoord[0] : curCoord[0]; - nextCoord = this._getNextY([tmpX, curCoord[1]], finalCoord); + nextCoord = this._getNextX(this.curCoord, finalCoord); + var tmpX = (nextCoord) ? nextCoord[0] : this.curCoord[0]; + nextCoord = this._getNextY([tmpX, this.curCoord[1]], finalCoord); } else if (t._isHoriz) { - nextCoord = this._getNextX(curCoord, finalCoord); + nextCoord = this._getNextX(this.curCoord, finalCoord); } else { - nextCoord = this._getNextY(curCoord, finalCoord); + nextCoord = this._getNextY(this.curCoord, finalCoord); } - this.logger.log("moveOneTick: " + + this.logger.log("moveOneTick: " + " finalCoord: " + finalCoord + - " curCoord: " + curCoord + + " this.curCoord: " + this.curCoord + " nextCoord: " + nextCoord); if (nextCoord) { + // cache the position + this.curCoord = nextCoord; + // move to the next coord // YAHOO.util.Dom.setXY(t.getEl(), nextCoord); @@ -752,11 +799,11 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { // YAHOO.util.Dom.setStyle(el, "top", (nextCoord[1] + this.thumb.deltaSetXY[1]) + "px"); this.thumb.alignElWithMouse(t.getEl(), nextCoord[0], nextCoord[1]); - + // check if we are in the final position, if not make a recursive call if (!(nextCoord[0] == finalCoord[0] && nextCoord[1] == finalCoord[1])) { var self = this; - setTimeout(function() { self.moveOneTick(finalCoord); }, + setTimeout(function() { self.moveOneTick(finalCoord); }, this.tickPause); } else { this.endMove(); @@ -848,7 +895,7 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { this.focus(); this.moveThumb(x, y); } - + }, /** @@ -881,14 +928,21 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { * the middle of an animation as the event will fire when the animation is * complete * @method fireEvents + * @param {boolean} thumbEvent set to true if this event is fired from an event + * that occurred on the thumb. If it is, the state of the + * thumb dd object should be correct. Otherwise, the event + * originated on the background, so the thumb state needs to + * be refreshed before proceeding. * @private */ - fireEvents: function () { + fireEvents: function (thumbEvent) { var t = this.thumb; // this.logger.log("FireEvents: " + t._isRegion); - t.cachePosition(); + if (!thumbEvent) { + t.cachePosition(); + } if (! this.isLocked()) { if (t._isRegion) { @@ -929,7 +983,7 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { * @method toString * @return {string} string representation of the instance */ - toString: function () { + toString: function () { return ("Slider (" + this.type +") " + this.id); } @@ -948,16 +1002,17 @@ YAHOO.augment(YAHOO.widget.Slider, YAHOO.util.EventProvider); * @param {int} iRight the number of pixels the element can move right * @param {int} iUp the number of pixels the element can move up * @param {int} iDown the number of pixels the element can move down - * @param {int} iTickSize optional parameter for specifying that the element + * @param {int} iTickSize optional parameter for specifying that the element * should move a certain number pixels at a time. */ YAHOO.widget.SliderThumb = function(id, sGroup, iLeft, iRight, iUp, iDown, iTickSize) { if (id) { - this.init(id, sGroup); + //this.init(id, sGroup); + YAHOO.widget.SliderThumb.superclass.constructor.call(this, id, sGroup); /** - * The id of the thumbs parent HTML element (the slider background + * The id of the thumbs parent HTML element (the slider background * element). * @property parentElId * @type string @@ -1004,12 +1059,12 @@ YAHOO.widget.SliderThumb = function(id, sGroup, iLeft, iRight, iUp, iDown, iTick */ this.scroll = false; -}; +}; YAHOO.extend(YAHOO.widget.SliderThumb, YAHOO.util.DD, { /** - * The (X and Y) difference between the thumb location and its parent + * The (X and Y) difference between the thumb location and its parent * (the slider background) when the control is instantiated. * @property startOffset * @type [int, int] @@ -1040,19 +1095,55 @@ YAHOO.extend(YAHOO.widget.SliderThumb, YAHOO.util.DD, { */ _graduated: false, + /** * Returns the difference between the location of the thumb and its parent. * @method getOffsetFromParent * @param {[int, int]} parentPos Optionally accepts the position of the parent * @type [int, int] */ - getOffsetFromParent: function(parentPos) { + getOffsetFromParent0: function(parentPos) { var myPos = YAHOO.util.Dom.getXY(this.getEl()); var ppos = parentPos || YAHOO.util.Dom.getXY(this.parentElId); return [ (myPos[0] - ppos[0]), (myPos[1] - ppos[1]) ]; }, + getOffsetFromParent: function(parentPos) { + + var el = this.getEl(); + + if (!this.deltaOffset) { + + var myPos = YAHOO.util.Dom.getXY(el); + var ppos = parentPos || YAHOO.util.Dom.getXY(this.parentElId); + + var newOffset = [ (myPos[0] - ppos[0]), (myPos[1] - ppos[1]) ]; + + var l = parseInt( YAHOO.util.Dom.getStyle(el, "left"), 10 ); + var t = parseInt( YAHOO.util.Dom.getStyle(el, "top" ), 10 ); + + var deltaX = l - newOffset[0]; + var deltaY = t - newOffset[1]; + + if (isNaN(deltaX) || isNaN(deltaY)) { + this.logger.log("element does not have a position style def yet"); + } else { + this.deltaOffset = [deltaX, deltaY]; + } + + } else { + var newLeft = parseInt( YAHOO.util.Dom.getStyle(el, "left"), 10 ); + var newTop = parseInt( YAHOO.util.Dom.getStyle(el, "top" ), 10 ); + + newOffset = [newLeft + this.deltaOffset[0], newTop + this.deltaOffset[1]]; + } + + return newOffset; + + //return [ (myPos[0] - ppos[0]), (myPos[1] - ppos[1]) ]; + }, + /** * Set up the slider, must be called in the constructor of all subclasses * @method initSlider @@ -1064,6 +1155,13 @@ YAHOO.extend(YAHOO.widget.SliderThumb, YAHOO.util.DD, { */ initSlider: function (iLeft, iRight, iUp, iDown, iTickSize) { + + //document these. new for 0.12.1 + this.initLeft = iLeft; + this.initRight = iRight; + this.initUp = iUp; + this.initDown = iDown; + this.setXConstraint(iLeft, iRight, iTickSize); this.setYConstraint(iUp, iDown, iTickSize); @@ -1071,9 +1169,9 @@ YAHOO.extend(YAHOO.widget.SliderThumb, YAHOO.util.DD, { this._graduated = true; } - this._isHoriz = (iLeft || iRight); + this._isHoriz = (iLeft || iRight); this._isVert = (iUp || iDown); - this._isRegion = (this._isHoriz && this._isVert); + this._isRegion = (this._isHoriz && this._isVert); }, @@ -1083,9 +1181,11 @@ YAHOO.extend(YAHOO.widget.SliderThumb, YAHOO.util.DD, { */ clearTicks: function () { YAHOO.widget.SliderThumb.superclass.clearTicks.call(this); + this.tickSize = 0; this._graduated = false; }, + /** * Gets the current offset from the element's start position in * pixels. @@ -1096,7 +1196,7 @@ YAHOO.extend(YAHOO.widget.SliderThumb, YAHOO.util.DD, { getValue: function () { if (!this.available) { return 0; } var val = (this._isHoriz) ? this.getXValue() : this.getYValue(); - this.logger.log("getVal: " + val); + //this.logger.log("getVal: " + val); return val; }, @@ -1131,7 +1231,7 @@ YAHOO.extend(YAHOO.widget.SliderThumb, YAHOO.util.DD, { * @method toString * @return {string} string representation of the instance */ - toString: function () { + toString: function () { return "SliderThumb " + this.id; }, @@ -1141,7 +1241,7 @@ YAHOO.extend(YAHOO.widget.SliderThumb, YAHOO.util.DD, { * @method onChange * @private */ - onChange: function (x, y) { + onChange: function (x, y) { } }); diff --git a/lib/yui/slider/slider-min.js b/lib/yui/slider/slider-min.js index a872cf5683..f94098fdee 100755 --- a/lib/yui/slider/slider-min.js +++ b/lib/yui/slider/slider-min.js @@ -1 +1,29 @@ -/* Copyright (c) 2006, Yahoo! Inc. All rights reserved.Code licensed under the BSD License:http://developer.yahoo.net/yui/license.txt version: 0.12.0 */ YAHOO.widget.Slider=function(_1,_2,_3,_4){if(_1){this.type=_4;this.init(_1,_2,true);var _5=this;this.createEvent("change",this);this.createEvent("slideStart",this);this.createEvent("slideEnd",this);this.thumb=_3;_3.onChange=function(){_5.handleThumbChange();};this.isTarget=false;this.animate=YAHOO.widget.Slider.ANIM_AVAIL;this.backgroundEnabled=true;this.tickPause=40;this.enableKeys=true;this.keyIncrement=20;this.moveComplete=true;this.animationDuration=0.2;if(_3._isHoriz&&_3.xTicks&&_3.xTicks.length){this.tickPause=Math.round(360/_3.xTicks.length);}else{if(_3.yTicks&&_3.yTicks.length){this.tickPause=Math.round(360/_3.yTicks.length);}}_3.onMouseDown=function(){return _5.focus();};_3.onMouseUp=function(){_5.thumbMouseUp();};_3.onDrag=function(){_5.fireEvents();};_3.onAvailable=function(){return _5.setStartSliderState();};}};YAHOO.widget.Slider.getHorizSlider=function(_6,_7,_8,_9,_10){return new YAHOO.widget.Slider(_6,_6,new YAHOO.widget.SliderThumb(_7,_6,_8,_9,0,0,_10),"horiz");};YAHOO.widget.Slider.getVertSlider=function(_11,_12,iUp,_14,_15){return new YAHOO.widget.Slider(_11,_11,new YAHOO.widget.SliderThumb(_12,_11,0,0,iUp,_14,_15),"vert");};YAHOO.widget.Slider.getSliderRegion=function(_16,_17,_18,_19,iUp,_20,_21){return new YAHOO.widget.Slider(_16,_16,new YAHOO.widget.SliderThumb(_17,_16,_18,_19,iUp,_20,_21),"region");};YAHOO.widget.Slider.ANIM_AVAIL=true;YAHOO.extend(YAHOO.widget.Slider,YAHOO.util.DragDrop,{onAvailable:function(){var _22=YAHOO.util.Event;_22.on(this.id,"keydown",this.handleKeyDown,this,true);_22.on(this.id,"keypress",this.handleKeyPress,this,true);},handleKeyPress:function(e){if(this.enableKeys){var _24=YAHOO.util.Event;var kc=_24.getCharCode(e);switch(kc){case 37:case 38:case 39:case 40:case 36:case 35:_24.preventDefault(e);break;default:}}},handleKeyDown:function(e){if(this.enableKeys){var _26=YAHOO.util.Event;var kc=_26.getCharCode(e),t=this.thumb;var h=this.getXValue(),v=this.getYValue();var _28=false;var _29=true;switch(kc){case 37:h-=this.keyIncrement;break;case 38:v-=this.keyIncrement;break;case 39:h+=this.keyIncrement;break;case 40:v+=this.keyIncrement;break;case 36:h=t.leftConstraint;v=t.topConstraint;break;case 35:h=t.rightConstraint;v=t.bottomConstraint;break;default:_29=false;}if(_29){if(t._isRegion){this.setRegionValue(h,v,true);}else{var _30=(t._isHoriz)?h:v;this.setValue(_30,true);}_26.stopEvent(e);}}},setStartSliderState:function(){this.setThumbCenterPoint();this.baselinePos=YAHOO.util.Dom.getXY(this.getEl());this.thumb.startOffset=this.thumb.getOffsetFromParent(this.baselinePos);if(this.thumb._isRegion){if(this.deferredSetRegionValue){this.setRegionValue.apply(this,this.deferredSetRegionValue,true);this.deferredSetRegionValue=null;}else{this.setRegionValue(0,0,true);}}else{if(this.deferredSetValue){this.setValue.apply(this,this.deferredSetValue,true);this.deferredSetValue=null;}else{this.setValue(0,true,true);}}},setThumbCenterPoint:function(){var el=this.thumb.getEl();if(el){this.thumbCenterPoint={x:parseInt(el.offsetWidth/2,10),y:parseInt(el.offsetHeight/2,10)};}},lock:function(){this.thumb.lock();this.locked=true;},unlock:function(){this.thumb.unlock();this.locked=false;},thumbMouseUp:function(){if(!this.isLocked()&&!this.moveComplete){this.endMove();}},getThumb:function(){return this.thumb;},focus:function(){var el=this.getEl();if(el.focus){try{el.focus();}catch(e){}}this.verifyOffset();if(this.isLocked()){return false;}else{this.onSlideStart();return true;}},onChange:function(_32,_33){},onSlideStart:function(){},onSlideEnd:function(){},getValue:function(){return this.thumb.getValue();},getXValue:function(){return this.thumb.getXValue();},getYValue:function(){return this.thumb.getYValue();},handleThumbChange:function(){var t=this.thumb;if(t._isRegion){t.onChange(t.getXValue(),t.getYValue());this.fireEvent("change",{x:t.getXValue(),y:t.getYValue()});}else{t.onChange(t.getValue());this.fireEvent("change",t.getValue());}},setValue:function(_35,_36,_37){if(!this.thumb.available){this.deferredSetValue=arguments;return false;}if(this.isLocked()&&!_37){return false;}if(isNaN(_35)){return false;}var t=this.thumb;var _38,newY;this.verifyOffset();if(t._isRegion){return false;}else{if(t._isHoriz){this.onSlideStart();_38=t.initPageX+_35+this.thumbCenterPoint.x;this.moveThumb(_38,t.initPageY,_36);}else{this.onSlideStart();newY=t.initPageY+_35+this.thumbCenterPoint.y;this.moveThumb(t.initPageX,newY,_36);}}return true;},setRegionValue:function(_39,_40,_41){if(!this.thumb.available){this.deferredSetRegionValue=arguments;return false;}if(this.isLocked()&&!force){return false;}if(isNaN(_39)){return false;}var t=this.thumb;if(t._isRegion){this.onSlideStart();var _42=t.initPageX+_39+this.thumbCenterPoint.x;var _43=t.initPageY+_40+this.thumbCenterPoint.y;this.moveThumb(_42,_43,_41);return true;}return false;},verifyOffset:function(){var _44=YAHOO.util.Dom.getXY(this.getEl());if(_44[0]!=this.baselinePos[0]||_44[1]!=this.baselinePos[1]){this.thumb.resetConstraints();this.baselinePos=_44;return false;}return true;},moveThumb:function(x,y,_47){var t=this.thumb;var _48=this;if(!t.available){return;}t.setDelta(this.thumbCenterPoint.x,this.thumbCenterPoint.y);var _p=t.getTargetCoord(x,y);var p=[_p.x,_p.y];this.fireEvent("slideStart");if(this.animate&&YAHOO.widget.Slider.ANIM_AVAIL&&t._graduated&&!_47){this.lock();setTimeout(function(){_48.moveOneTick(p);},this.tickPause);}else{if(this.animate&&YAHOO.widget.Slider.ANIM_AVAIL&&!_47){this.lock();var _51=new YAHOO.util.Motion(t.id,{points:{to:p}},this.animationDuration,YAHOO.util.Easing.easeOut);_51.onComplete.subscribe(function(){_48.endMove();});_51.animate();}else{t.setDragElPos(x,y);this.endMove();}}},moveOneTick:function(_52){var t=this.thumb;var _53=YAHOO.util.Dom.getXY(t.getEl());var tmp;var _55=null;if(t._isRegion){_55=this._getNextX(_53,_52);var _56=(_55)?_55[0]:_53[0];_55=this._getNextY([_56,_53[1]],_52);}else{if(t._isHoriz){_55=this._getNextX(_53,_52);}else{_55=this._getNextY(_53,_52);}}if(_55){this.thumb.alignElWithMouse(t.getEl(),_55[0],_55[1]);if(!(_55[0]==_52[0]&&_55[1]==_52[1])){var _57=this;setTimeout(function(){_57.moveOneTick(_52);},this.tickPause);}else{this.endMove();}}else{this.endMove();}},_getNextX:function(_58,_59){var t=this.thumb;var _60;var tmp=[];var _61=null;if(_58[0]>_59[0]){_60=t.tickSize-this.thumbCenterPoint.x;tmp=t.getTargetCoord(_58[0]-_60,_58[1]);_61=[tmp.x,tmp.y];}else{if(_58[0]<_59[0]){_60=t.tickSize+this.thumbCenterPoint.x;tmp=t.getTargetCoord(_58[0]+_60,_58[1]);_61=[tmp.x,tmp.y];}else{}}return _61;},_getNextY:function(_62,_63){var t=this.thumb;var _64;var tmp=[];var _65=null;if(_62[1]>_63[1]){_64=t.tickSize-this.thumbCenterPoint.y;tmp=t.getTargetCoord(_62[0],_62[1]-_64);_65=[tmp.x,tmp.y];}else{if(_62[1]<_63[1]){_64=t.tickSize+this.thumbCenterPoint.y;tmp=t.getTargetCoord(_62[0],_62[1]+_64);_65=[tmp.x,tmp.y];}else{}}return _65;},b4MouseDown:function(e){this.thumb.autoOffset();this.thumb.resetConstraints();},onMouseDown:function(e){if(!this.isLocked()&&this.backgroundEnabled){var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);this.focus();this.moveThumb(x,y);}},onDrag:function(e){if(!this.isLocked()){var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);this.moveThumb(x,y,true);}},endMove:function(){this.unlock();this.moveComplete=true;this.fireEvents();},fireEvents:function(){var t=this.thumb;t.cachePosition();if(!this.isLocked()){if(t._isRegion){var _66=t.getXValue();var _67=t.getYValue();if(_66!=this.previousX||_67!=this.previousY){this.onChange(_66,_67);this.fireEvent("change",{x:_66,y:_67});}this.previousX=_66;this.previousY=_67;}else{var _68=t.getValue();if(_68!=this.previousVal){this.onChange(_68);this.fireEvent("change",_68);}this.previousVal=_68;}if(this.moveComplete){this.onSlideEnd();this.fireEvent("slideEnd");this.moveComplete=false;}}},toString:function(){return ("Slider ("+this.type+") "+this.id);}});YAHOO.augment(YAHOO.widget.Slider,YAHOO.util.EventProvider);YAHOO.widget.SliderThumb=function(id,_70,_71,_72,iUp,_73,_74){if(id){this.init(id,_70);this.parentElId=_70;}this.isTarget=false;this.tickSize=_74;this.maintainOffset=true;this.initSlider(_71,_72,iUp,_73,_74);this.scroll=false;};YAHOO.extend(YAHOO.widget.SliderThumb,YAHOO.util.DD,{startOffset:null,_isHoriz:false,_prevVal:0,_graduated:false,getOffsetFromParent:function(_75){var _76=YAHOO.util.Dom.getXY(this.getEl());var _77=_75||YAHOO.util.Dom.getXY(this.parentElId);return [(_76[0]-_77[0]),(_76[1]-_77[1])];},initSlider:function(_78,_79,iUp,_80,_81){this.setXConstraint(_78,_79,_81);this.setYConstraint(iUp,_80,_81);if(_81&&_81>1){this._graduated=true;}this._isHoriz=(_78||_79);this._isVert=(iUp||_80);this._isRegion=(this._isHoriz&&this._isVert);},clearTicks:function(){YAHOO.widget.SliderThumb.superclass.clearTicks.call(this);this._graduated=false;},getValue:function(){if(!this.available){return 0;}var val=(this._isHoriz)?this.getXValue():this.getYValue();return val;},getXValue:function(){if(!this.available){return 0;}var _83=this.getOffsetFromParent();return (_83[0]-this.startOffset[0]);},getYValue:function(){if(!this.available){return 0;}var _84=this.getOffsetFromParent();return (_84[1]-this.startOffset[1]);},toString:function(){return "SliderThumb "+this.id;},onChange:function(x,y){}});if("undefined"==typeof YAHOO.util.Anim){YAHOO.widget.Slider.ANIM_AVAIL=false;} \ No newline at end of file +/* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt version: 0.12.1 */ +YAHOO.widget.Slider=function(sElementId,sGroup,oThumb,sType){if(sElementId){this.init(sElementId,sGroup,true);this.initSlider(sType);this.initThumb(oThumb);}};YAHOO.widget.Slider.getHorizSlider=function(sBGElId,sHandleElId,iLeft,iRight,iTickSize){return new YAHOO.widget.Slider(sBGElId,sBGElId,new YAHOO.widget.SliderThumb(sHandleElId,sBGElId,iLeft,iRight,0,0,iTickSize),"horiz");};YAHOO.widget.Slider.getVertSlider=function(sBGElId,sHandleElId,iUp,iDown,iTickSize){return new YAHOO.widget.Slider(sBGElId,sBGElId,new YAHOO.widget.SliderThumb(sHandleElId,sBGElId,0,0,iUp,iDown,iTickSize),"vert");};YAHOO.widget.Slider.getSliderRegion=function(sBGElId,sHandleElId,iLeft,iRight,iUp,iDown,iTickSize){return new YAHOO.widget.Slider(sBGElId,sBGElId,new YAHOO.widget.SliderThumb(sHandleElId,sBGElId,iLeft,iRight,iUp,iDown,iTickSize),"region");};YAHOO.widget.Slider.ANIM_AVAIL=true;YAHOO.extend(YAHOO.widget.Slider,YAHOO.util.DragDrop,{initSlider:function(sType){this.type=sType;this.createEvent("change",this);this.createEvent("slideStart",this);this.createEvent("slideEnd",this);this.isTarget=false;this.animate=YAHOO.widget.Slider.ANIM_AVAIL;this.backgroundEnabled=true;this.tickPause=40;this.enableKeys=true;this.keyIncrement=20;this.moveComplete=true;this.animationDuration=0.2;},initThumb:function(t){var self=this;this.thumb=t;t.cacheBetweenDrags=true;t.onChange=function(){self.handleThumbChange();};if(t._isHoriz&&t.xTicks&&t.xTicks.length){this.tickPause=Math.round(360/t.xTicks.length);}else if(t.yTicks&&t.yTicks.length){this.tickPause=Math.round(360/t.yTicks.length);} +t.onMouseDown=function(){return self.focus();};t.onMouseUp=function(){self.thumbMouseUp();};t.onDrag=function(){self.fireEvents(true);};t.onAvailable=function(){return self.setStartSliderState();};},onAvailable:function(){var Event=YAHOO.util.Event;Event.on(this.id,"keydown",this.handleKeyDown,this,true);Event.on(this.id,"keypress",this.handleKeyPress,this,true);},handleKeyPress:function(e){if(this.enableKeys){var Event=YAHOO.util.Event;var kc=Event.getCharCode(e);switch(kc){case 0x25:case 0x26:case 0x27:case 0x28:case 0x24:case 0x23:Event.preventDefault(e);break;default:}}},handleKeyDown:function(e){if(this.enableKeys){var Event=YAHOO.util.Event;var kc=Event.getCharCode(e),t=this.thumb;var h=this.getXValue(),v=this.getYValue();var horiz=false;var changeValue=true;switch(kc){case 0x25:h-=this.keyIncrement;break;case 0x26:v-=this.keyIncrement;break;case 0x27:h+=this.keyIncrement;break;case 0x28:v+=this.keyIncrement;break;case 0x24:h=t.leftConstraint;v=t.topConstraint;break;case 0x23:h=t.rightConstraint;v=t.bottomConstraint;break;default:changeValue=false;} +if(changeValue){if(t._isRegion){this.setRegionValue(h,v,true);}else{var newVal=(t._isHoriz)?h:v;this.setValue(newVal,true);} +Event.stopEvent(e);}}},setStartSliderState:function(){this.setThumbCenterPoint();this.baselinePos=YAHOO.util.Dom.getXY(this.getEl());this.thumb.startOffset=this.thumb.getOffsetFromParent(this.baselinePos);if(this.thumb._isRegion){if(this.deferredSetRegionValue){this.setRegionValue.apply(this,this.deferredSetRegionValue,true);this.deferredSetRegionValue=null;}else{this.setRegionValue(0,0,true);}}else{if(this.deferredSetValue){this.setValue.apply(this,this.deferredSetValue,true);this.deferredSetValue=null;}else{this.setValue(0,true,true);}}},setThumbCenterPoint:function(){var el=this.thumb.getEl();if(el){this.thumbCenterPoint={x:parseInt(el.offsetWidth/2,10),y:parseInt(el.offsetHeight/2,10)};}},lock:function(){this.thumb.lock();this.locked=true;},unlock:function(){this.thumb.unlock();this.locked=false;},thumbMouseUp:function(){if(!this.isLocked()&&!this.moveComplete){this.endMove();}},getThumb:function(){return this.thumb;},focus:function(){var el=this.getEl();if(el.focus){try{el.focus();}catch(e){}} +this.verifyOffset();if(this.isLocked()){return false;}else{this.onSlideStart();return true;}},onChange:function(firstOffset,secondOffset){},onSlideStart:function(){},onSlideEnd:function(){},getValue:function(){return this.thumb.getValue();},getXValue:function(){return this.thumb.getXValue();},getYValue:function(){return this.thumb.getYValue();},handleThumbChange:function(){var t=this.thumb;if(t._isRegion){t.onChange(t.getXValue(),t.getYValue());this.fireEvent("change",{x:t.getXValue(),y:t.getYValue()});}else{t.onChange(t.getValue());this.fireEvent("change",t.getValue());}},setValue:function(newOffset,skipAnim,force){if(!this.thumb.available){this.deferredSetValue=arguments;return false;} +if(this.isLocked()&&!force){return false;} +if(isNaN(newOffset)){return false;} +var t=this.thumb;var newX,newY;this.verifyOffset(true);if(t._isRegion){return false;}else if(t._isHoriz){this.onSlideStart();newX=t.initPageX+newOffset+this.thumbCenterPoint.x;this.moveThumb(newX,t.initPageY,skipAnim);}else{this.onSlideStart();newY=t.initPageY+newOffset+this.thumbCenterPoint.y;this.moveThumb(t.initPageX,newY,skipAnim);} +return true;},setRegionValue:function(newOffset,newOffset2,skipAnim){if(!this.thumb.available){this.deferredSetRegionValue=arguments;return false;} +if(this.isLocked()&&!force){return false;} +if(isNaN(newOffset)){return false;} +var t=this.thumb;if(t._isRegion){this.onSlideStart();var newX=t.initPageX+newOffset+this.thumbCenterPoint.x;var newY=t.initPageY+newOffset2+this.thumbCenterPoint.y;this.moveThumb(newX,newY,skipAnim);return true;} +return false;},verifyOffset:function(checkPos){var newPos=YAHOO.util.Dom.getXY(this.getEl());if(newPos[0]!=this.baselinePos[0]||newPos[1]!=this.baselinePos[1]){this.thumb.resetConstraints();this.baselinePos=newPos;return false;} +return true;},moveThumb:function(x,y,skipAnim){var t=this.thumb;var self=this;if(!t.available){return;} +t.setDelta(this.thumbCenterPoint.x,this.thumbCenterPoint.y);var _p=t.getTargetCoord(x,y);var p=[_p.x,_p.y];this.fireEvent("slideStart");if(this.animate&&YAHOO.widget.Slider.ANIM_AVAIL&&t._graduated&&!skipAnim){this.lock();this.curCoord=YAHOO.util.Dom.getXY(this.thumb.getEl());setTimeout(function(){self.moveOneTick(p);},this.tickPause);}else if(this.animate&&YAHOO.widget.Slider.ANIM_AVAIL&&!skipAnim){this.lock();var oAnim=new YAHOO.util.Motion(t.id,{points:{to:p}},this.animationDuration,YAHOO.util.Easing.easeOut);oAnim.onComplete.subscribe(function(){self.endMove();});oAnim.animate();}else{t.setDragElPos(x,y);this.endMove();}},moveOneTick:function(finalCoord){var t=this.thumb,tmp;var nextCoord=null;if(t._isRegion){nextCoord=this._getNextX(this.curCoord,finalCoord);var tmpX=(nextCoord)?nextCoord[0]:this.curCoord[0];nextCoord=this._getNextY([tmpX,this.curCoord[1]],finalCoord);}else if(t._isHoriz){nextCoord=this._getNextX(this.curCoord,finalCoord);}else{nextCoord=this._getNextY(this.curCoord,finalCoord);} +if(nextCoord){this.curCoord=nextCoord;this.thumb.alignElWithMouse(t.getEl(),nextCoord[0],nextCoord[1]);if(!(nextCoord[0]==finalCoord[0]&&nextCoord[1]==finalCoord[1])){var self=this;setTimeout(function(){self.moveOneTick(finalCoord);},this.tickPause);}else{this.endMove();}}else{this.endMove();}},_getNextX:function(curCoord,finalCoord){var t=this.thumb;var thresh;var tmp=[];var nextCoord=null;if(curCoord[0]>finalCoord[0]){thresh=t.tickSize-this.thumbCenterPoint.x;tmp=t.getTargetCoord(curCoord[0]-thresh,curCoord[1]);nextCoord=[tmp.x,tmp.y];}else if(curCoord[0]finalCoord[1]){thresh=t.tickSize-this.thumbCenterPoint.y;tmp=t.getTargetCoord(curCoord[0],curCoord[1]-thresh);nextCoord=[tmp.x,tmp.y];}else if(curCoord[1]1){this._graduated=true;} +this._isHoriz=(iLeft||iRight);this._isVert=(iUp||iDown);this._isRegion=(this._isHoriz&&this._isVert);},clearTicks:function(){YAHOO.widget.SliderThumb.superclass.clearTicks.call(this);this.tickSize=0;this._graduated=false;},getValue:function(){if(!this.available){return 0;} +var val=(this._isHoriz)?this.getXValue():this.getYValue();return val;},getXValue:function(){if(!this.available){return 0;} +var newOffset=this.getOffsetFromParent();return(newOffset[0]-this.startOffset[0]);},getYValue:function(){if(!this.available){return 0;} +var newOffset=this.getOffsetFromParent();return(newOffset[1]-this.startOffset[1]);},toString:function(){return"SliderThumb "+this.id;},onChange:function(x,y){}});if("undefined"==typeof YAHOO.util.Anim){YAHOO.widget.Slider.ANIM_AVAIL=false;} \ No newline at end of file diff --git a/lib/yui/slider/slider.js b/lib/yui/slider/slider.js index 8d3cd62039..4d750ac795 100755 --- a/lib/yui/slider/slider.js +++ b/lib/yui/slider/slider.js @@ -2,9 +2,8 @@ Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt -version: 0.12.0 +version: 0.12.1 */ - /** * The Slider component is a UI control that enables the user to adjust * values in a finite range along one or two axes. Typically, the Slider @@ -29,13 +28,97 @@ version: 0.12.0 * * @class Slider * @extends YAHOO.util.DragDrop + * @uses YAHOO.util.EventProvider * @constructor - * @param {String} id The id of the element linked to this instance - * @param {String} sGroup The group of related DragDrop items - * @param {String} sType The type of slider (horiz, vert, region) + * @param {String} id The id of the element linked to this instance + * @param {String} sGroup The group of related DragDrop items + * @param {SliderThumb} oThumb The thumb for this slider + * @param {String} sType The type of slider (horiz, vert, region) */ YAHOO.widget.Slider = function(sElementId, sGroup, oThumb, sType) { if (sElementId) { + this.init(sElementId, sGroup, true); + this.initSlider(sType); + this.initThumb(oThumb); + } +}; + +/** + * Factory method for creating a horizontal slider + * @method YAHOO.widget.Slider.getHorizSlider + * @static + * @param {String} sBGElId the id of the slider's background element + * @param {String} sHandleElId the id of the thumb element + * @param {int} iLeft the number of pixels the element can move left + * @param {int} iRight the number of pixels the element can move right + * @param {int} iTickSize optional parameter for specifying that the element + * should move a certain number pixels at a time. + * @return {Slider} a horizontal slider control + */ +YAHOO.widget.Slider.getHorizSlider = + function (sBGElId, sHandleElId, iLeft, iRight, iTickSize) { + return new YAHOO.widget.Slider(sBGElId, sBGElId, + new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, + iLeft, iRight, 0, 0, iTickSize), "horiz"); +}; + +/** + * Factory method for creating a vertical slider + * @method YAHOO.widget.Slider.getVertSlider + * @static + * @param {String} sBGElId the id of the slider's background element + * @param {String} sHandleElId the id of the thumb element + * @param {int} iUp the number of pixels the element can move up + * @param {int} iDown the number of pixels the element can move down + * @param {int} iTickSize optional parameter for specifying that the element + * should move a certain number pixels at a time. + * @return {Slider} a vertical slider control + */ +YAHOO.widget.Slider.getVertSlider = + function (sBGElId, sHandleElId, iUp, iDown, iTickSize) { + return new YAHOO.widget.Slider(sBGElId, sBGElId, + new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, 0, 0, + iUp, iDown, iTickSize), "vert"); +}; + +/** + * Factory method for creating a slider region like the one in the color + * picker example + * @method YAHOO.widget.Slider.getSliderRegion + * @static + * @param {String} sBGElId the id of the slider's background element + * @param {String} sHandleElId the id of the thumb element + * @param {int} iLeft the number of pixels the element can move left + * @param {int} iRight the number of pixels the element can move right + * @param {int} iUp the number of pixels the element can move up + * @param {int} iDown the number of pixels the element can move down + * @param {int} iTickSize optional parameter for specifying that the element + * should move a certain number pixels at a time. + * @return {Slider} a slider region control + */ +YAHOO.widget.Slider.getSliderRegion = + function (sBGElId, sHandleElId, iLeft, iRight, iUp, iDown, iTickSize) { + return new YAHOO.widget.Slider(sBGElId, sBGElId, + new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, iLeft, iRight, + iUp, iDown, iTickSize), "region"); +}; + +/** + * By default, animation is available if the animation library is detected. + * @property YAHOO.widget.Slider.ANIM_AVAIL + * @static + * @type boolean + */ +YAHOO.widget.Slider.ANIM_AVAIL = true; + +YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { + + /** + * Initializes the slider. Executed in the constructor + * @method initSlider + * @param {string} sType the type of slider (horiz, vert, region) + */ + initSlider: function(sType) { /** * The type of the slider (horiz, vert, region) @@ -44,29 +127,23 @@ YAHOO.widget.Slider = function(sElementId, sGroup, oThumb, sType) { */ this.type = sType; - this.init(sElementId, sGroup, true); - //this.removeInvalidHandleType("A"); - var self = this; - /** * Event the fires when the value of the control changes. If * the control is animated the event will fire every point * along the way. * @event change - * @param {int} new - * @param {int} firstOffset the number of pixels the thumb has moved - * from its start position. Normal horizontal and vertical sliders will only - * have the firstOffset. Regions will have both, the first is the horizontal - * offset, the second the vertical. - * @param {int} secondOffset the y offset for region sliders + * @param {int} newOffset|x the new offset for normal sliders, or the new + * x offset for region sliders + * @param {int} y the number of pixels the thumb has moved on the y axis + * (region sliders only) */ this.createEvent("change", this); /** - * Event that fires at the end of a slider thumb move. + * Event that fires at the beginning of a slider thumb move. * @event slideStart */ this.createEvent("slideStart", this); @@ -77,19 +154,6 @@ YAHOO.widget.Slider = function(sElementId, sGroup, oThumb, sType) { */ this.createEvent("slideEnd", this); - /** - * A YAHOO.widget.SliderThumb instance that we will use to - * reposition the thumb when the background is clicked - * @property thumb - * @type YAHOO.widget.SliderThumb - */ - this.thumb = oThumb; - - // add handler for the handle onchange event - oThumb.onChange = function() { - self.handleThumbChange(); - }; - /** * Overrides the isTarget property in YAHOO.util.DragDrop * @property isTarget @@ -153,101 +217,63 @@ YAHOO.widget.Slider = function(sElementId, sGroup, oThumb, sType) { * @default 0.2 */ this.animationDuration = 0.2; + }, - if (oThumb._isHoriz && oThumb.xTicks && oThumb.xTicks.length) { - this.tickPause = Math.round(360 / oThumb.xTicks.length); - } else if (oThumb.yTicks && oThumb.yTicks.length) { - this.tickPause = Math.round(360 / oThumb.yTicks.length); - } + /** + * Initializes the slider's thumb. Executed in the constructor. + * @method initThumb + * @param {YAHOO.widget.SliderThumb} t the slider thumb + */ + initThumb: function(t) { + var self = this; - // delegate thumb methods - oThumb.onMouseDown = function () { return self.focus(); }; - //oThumb.b4MouseDown = function () { return self.b4MouseDown(); }; - // oThumb.lock = function() { self.lock(); }; - // oThumb.unlock = function() { self.unlock(); }; - oThumb.onMouseUp = function() { self.thumbMouseUp(); }; - oThumb.onDrag = function() { self.fireEvents(); }; - oThumb.onAvailable = function() { return self.setStartSliderState(); }; - } -}; + /** + * A YAHOO.widget.SliderThumb instance that we will use to + * reposition the thumb when the background is clicked + * @property thumb + * @type YAHOO.widget.SliderThumb + */ + this.thumb = t; + t.cacheBetweenDrags = true; -/** - * Factory method for creating a horizontal slider - * @method YAHOO.widget.Slider.getHorizSlider - * @static - * @param {String} sBGElId the id of the slider's background element - * @param {String} sHandleElId the id of the thumb element - * @param {int} iLeft the number of pixels the element can move left - * @param {int} iRight the number of pixels the element can move right - * @param {int} iTickSize optional parameter for specifying that the element - * should move a certain number pixels at a time. - * @return {Slider} a horizontal slider control - */ -YAHOO.widget.Slider.getHorizSlider = - function (sBGElId, sHandleElId, iLeft, iRight, iTickSize) { - return new YAHOO.widget.Slider(sBGElId, sBGElId, - new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, - iLeft, iRight, 0, 0, iTickSize), "horiz"); -}; + // add handler for the handle onchange event + t.onChange = function() { + self.handleThumbChange(); + }; -/** - * Factory method for creating a vertical slider - * @method YAHOO.widget.Slider.getVertSlider - * @static - * @param {String} sBGElId the id of the slider's background element - * @param {String} sHandleElId the id of the thumb element - * @param {int} iUp the number of pixels the element can move up - * @param {int} iDown the number of pixels the element can move down - * @param {int} iTickSize optional parameter for specifying that the element - * should move a certain number pixels at a time. - * @return {Slider} a vertical slider control - */ -YAHOO.widget.Slider.getVertSlider = - function (sBGElId, sHandleElId, iUp, iDown, iTickSize) { - return new YAHOO.widget.Slider(sBGElId, sBGElId, - new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, 0, 0, - iUp, iDown, iTickSize), "vert"); -}; + if (t._isHoriz && t.xTicks && t.xTicks.length) { + this.tickPause = Math.round(360 / t.xTicks.length); + } else if (t.yTicks && t.yTicks.length) { + this.tickPause = Math.round(360 / t.yTicks.length); + } -/** - * Factory method for creating a slider region like the one in the color - * picker example - * @method YAHOO.widget.Slider.getSliderRegion - * @static - * @param {String} sBGElId the id of the slider's background element - * @param {String} sHandleElId the id of the thumb element - * @param {int} iLeft the number of pixels the element can move left - * @param {int} iRight the number of pixels the element can move right - * @param {int} iUp the number of pixels the element can move up - * @param {int} iDown the number of pixels the element can move down - * @param {int} iTickSize optional parameter for specifying that the element - * should move a certain number pixels at a time. - * @return {Slider} a slider region control - */ -YAHOO.widget.Slider.getSliderRegion = - function (sBGElId, sHandleElId, iLeft, iRight, iUp, iDown, iTickSize) { - return new YAHOO.widget.Slider(sBGElId, sBGElId, - new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, iLeft, iRight, - iUp, iDown, iTickSize), "region"); -}; -/** - * By default, animation is available if the animation library is detected. - * @property YAHOO.widget.Slider.ANIM_AVAIL - * @static - * @type boolean - */ -YAHOO.widget.Slider.ANIM_AVAIL = true; + // delegate thumb methods + t.onMouseDown = function () { return self.focus(); }; + t.onMouseUp = function() { self.thumbMouseUp(); }; + t.onDrag = function() { self.fireEvents(true); }; + t.onAvailable = function() { return self.setStartSliderState(); }; -YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { + }, + /** + * Executed when the slider element is available + * @method onAvailable + */ onAvailable: function() { var Event = YAHOO.util.Event; Event.on(this.id, "keydown", this.handleKeyDown, this, true); Event.on(this.id, "keypress", this.handleKeyPress, this, true); }, + /** + * Executed when a keypress event happens with the control focused. + * Prevents the default behavior for navigation keys. The actual + * logic for moving the slider thumb in response to a key event + * happens in handleKeyDown. + * @param {Event} e the keypress event + */ handleKeyPress: function(e) { if (this.enableKeys) { var Event = YAHOO.util.Event; @@ -264,8 +290,14 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { default: } } - }, + }, + /** + * Executed when a keydown event happens with the control focused. + * Updates the slider value and display when the keypress is an + * arrow key, home, or end as long as enableKeys is set to true. + * @param {Event} e the keydown event + */ handleKeyDown: function(e) { if (this.enableKeys) { var Event = YAHOO.util.Event; @@ -317,7 +349,7 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { /** * Initialization that sets up the value offsets once the elements are ready - * @method setSliderStartState + * @method setStartSliderState */ setStartSliderState: function() { @@ -550,7 +582,7 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { var t = this.thumb; var newX, newY; - this.verifyOffset(); + this.verifyOffset(true); if (t._isRegion) { return false; } else if (t._isHoriz) { @@ -611,12 +643,15 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { /** * Checks the background position element position. If it has moved from the * baseline position, the constraints for the thumb are reset + * @param checkPos {boolean} check the position instead of using cached value * @method verifyOffset * @return {boolean} True if the offset is the same as the baseline. */ - verifyOffset: function() { + verifyOffset: function(checkPos) { var newPos = YAHOO.util.Dom.getXY(this.getEl()); + //var newPos = [this.initPageX, this.initPageY]; + if (newPos[0] != this.baselinePos[0] || newPos[1] != this.baselinePos[1]) { this.thumb.resetConstraints(); @@ -660,7 +695,10 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { if (this.animate && YAHOO.widget.Slider.ANIM_AVAIL && t._graduated && !skipAnim) { // this.thumb._animating = true; this.lock(); - + + // cache the current thumb pos + this.curCoord = YAHOO.util.Dom.getXY(this.thumb.getEl()); + setTimeout( function() { self.moveOneTick(p); }, this.tickPause ); } else if (this.animate && YAHOO.widget.Slider.ANIM_AVAIL && !skipAnim) { @@ -691,9 +729,14 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { */ moveOneTick: function(finalCoord) { - var t = this.thumb; - var curCoord = YAHOO.util.Dom.getXY(t.getEl()); - var tmp; + var t = this.thumb, tmp; + + // redundant call to getXY since we set the position most of time prior + // to getting here. Moved to this.curCoord + //var curCoord = YAHOO.util.Dom.getXY(t.getEl()); + + // alignElWithMouse caches position in lastPageX, lastPageY .. doesn't work + //var curCoord = [this.lastPageX, this.lastPageY]; // var thresh = Math.min(t.tickSize + (Math.floor(t.tickSize/2)), 10); // var thresh = 10; @@ -702,19 +745,22 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { var nextCoord = null; if (t._isRegion) { - nextCoord = this._getNextX(curCoord, finalCoord); - var tmpX = (nextCoord) ? nextCoord[0] : curCoord[0]; - nextCoord = this._getNextY([tmpX, curCoord[1]], finalCoord); + nextCoord = this._getNextX(this.curCoord, finalCoord); + var tmpX = (nextCoord) ? nextCoord[0] : this.curCoord[0]; + nextCoord = this._getNextY([tmpX, this.curCoord[1]], finalCoord); } else if (t._isHoriz) { - nextCoord = this._getNextX(curCoord, finalCoord); + nextCoord = this._getNextX(this.curCoord, finalCoord); } else { - nextCoord = this._getNextY(curCoord, finalCoord); + nextCoord = this._getNextY(this.curCoord, finalCoord); } if (nextCoord) { + // cache the position + this.curCoord = nextCoord; + // move to the next coord // YAHOO.util.Dom.setXY(t.getEl(), nextCoord); @@ -849,13 +895,20 @@ YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, { * the middle of an animation as the event will fire when the animation is * complete * @method fireEvents + * @param {boolean} thumbEvent set to true if this event is fired from an event + * that occurred on the thumb. If it is, the state of the + * thumb dd object should be correct. Otherwise, the event + * originated on the background, so the thumb state needs to + * be refreshed before proceeding. * @private */ - fireEvents: function () { + fireEvents: function (thumbEvent) { var t = this.thumb; - t.cachePosition(); + if (!thumbEvent) { + t.cachePosition(); + } if (! this.isLocked()) { if (t._isRegion) { @@ -918,7 +971,8 @@ YAHOO.augment(YAHOO.widget.Slider, YAHOO.util.EventProvider); YAHOO.widget.SliderThumb = function(id, sGroup, iLeft, iRight, iUp, iDown, iTickSize) { if (id) { - this.init(id, sGroup); + //this.init(id, sGroup); + YAHOO.widget.SliderThumb.superclass.constructor.call(this, id, sGroup); /** * The id of the thumbs parent HTML element (the slider background @@ -1008,13 +1062,47 @@ YAHOO.extend(YAHOO.widget.SliderThumb, YAHOO.util.DD, { * @param {[int, int]} parentPos Optionally accepts the position of the parent * @type [int, int] */ - getOffsetFromParent: function(parentPos) { + getOffsetFromParent0: function(parentPos) { var myPos = YAHOO.util.Dom.getXY(this.getEl()); var ppos = parentPos || YAHOO.util.Dom.getXY(this.parentElId); return [ (myPos[0] - ppos[0]), (myPos[1] - ppos[1]) ]; }, + getOffsetFromParent: function(parentPos) { + + var el = this.getEl(); + + if (!this.deltaOffset) { + + var myPos = YAHOO.util.Dom.getXY(el); + var ppos = parentPos || YAHOO.util.Dom.getXY(this.parentElId); + + var newOffset = [ (myPos[0] - ppos[0]), (myPos[1] - ppos[1]) ]; + + var l = parseInt( YAHOO.util.Dom.getStyle(el, "left"), 10 ); + var t = parseInt( YAHOO.util.Dom.getStyle(el, "top" ), 10 ); + + var deltaX = l - newOffset[0]; + var deltaY = t - newOffset[1]; + + if (isNaN(deltaX) || isNaN(deltaY)) { + } else { + this.deltaOffset = [deltaX, deltaY]; + } + + } else { + var newLeft = parseInt( YAHOO.util.Dom.getStyle(el, "left"), 10 ); + var newTop = parseInt( YAHOO.util.Dom.getStyle(el, "top" ), 10 ); + + newOffset = [newLeft + this.deltaOffset[0], newTop + this.deltaOffset[1]]; + } + + return newOffset; + + //return [ (myPos[0] - ppos[0]), (myPos[1] - ppos[1]) ]; + }, + /** * Set up the slider, must be called in the constructor of all subclasses * @method initSlider @@ -1026,6 +1114,12 @@ YAHOO.extend(YAHOO.widget.SliderThumb, YAHOO.util.DD, { */ initSlider: function (iLeft, iRight, iUp, iDown, iTickSize) { + //document these. new for 0.12.1 + this.initLeft = iLeft; + this.initRight = iRight; + this.initUp = iUp; + this.initDown = iDown; + this.setXConstraint(iLeft, iRight, iTickSize); this.setYConstraint(iUp, iDown, iTickSize); @@ -1045,6 +1139,7 @@ YAHOO.extend(YAHOO.widget.SliderThumb, YAHOO.util.DD, { */ clearTicks: function () { YAHOO.widget.SliderThumb.superclass.clearTicks.call(this); + this.tickSize = 0; this._graduated = false; }, diff --git a/lib/yui/tabview/README b/lib/yui/tabview/README index b24caa0d87..f6a41ab1d8 100755 --- a/lib/yui/tabview/README +++ b/lib/yui/tabview/README @@ -1,6 +1,11 @@ -Tabview Release Notes +*** version 0.12.1 *** + +* tabs.css renamed to tabview.css +* calls to "set" now queued so they can be made before "contentReady" + *** version 0.12.0 *** -* Initial release +* TabView widget introduced +* Note: border_tabs.css included as basic skin to enable "tabs" look diff --git a/lib/yui/tabview/assets/border_tabs.css b/lib/yui/tabview/assets/border_tabs.css index 7a1bd32a2d..e0bc50f0e6 100755 --- a/lib/yui/tabview/assets/border_tabs.css +++ b/lib/yui/tabview/assets/border_tabs.css @@ -6,39 +6,43 @@ background-color:#f6f7ee; /* active tab, tab hover, and content bgcolor */ } -.yui-navset-top .yui-nav .selected a { - border-bottom:0; /* no bottom border for active tab */ +.yui-navset .yui-nav li em { padding:.5em; } /* tab padding */ + +/* defaults to orientation "top" */ +.yui-navset .yui-nav .selected a { + border-bottom-width:0; /* no bottom border for active tab */ padding-bottom:1px; /* to match height of other tabs */ } -.yui-navset-top .yui-content { +.yui-navset .yui-content { margin-top:-1px; /* for active tab overlap */ } +/* overrides for other orientations */ + .yui-navset-bottom .yui-nav .selected a { - border-top:0; /* no bottom border for active tab */ - padding-top:1px; /* to match height of other tabs */ + border-width:0 1px 1px; /* no top border for active tab */ + padding:1px 0 0; /* to match height of other tabs */ } .yui-navset-bottom .yui-content { - margin-bottom:-1px; /* for active tab overlap */ + margin:0 0 -1px; /* for active tab overlap */ } .yui-navset-left .yui-nav li.selected a { - border-right:0; /* no bottom border for active tab */ - padding-right:1px; /* to match height of other tabs */ + border-width:1px 0 1px 1px; /* no right border for active tab */ + padding:0 1px 0 0; /* to match width of other tabs */ } .yui-navset-left .yui-content { - margin-left:-1px; /* for active tab overlap */ + margin:0 0 0 -1px; /* for active tab overlap */ } .yui-navset-right .yui-nav li.selected a { - border-left:0; /* no bottom border for active tab */ - padding-left:1px; /* to match height of other tabs */ + border-width:1px 1px 1px 0; /* no left border for active tab */ + padding:0 0 0 1px; /* to match width of other tabs */ } .yui-navset-right .yui-content { - margin-right:-1px; /* for active tab overlap */ - *margin-right:0; /* except IE */ + margin:0 -1px 0 0; /* for active tab overlap */ } \ No newline at end of file diff --git a/lib/yui/tabview/tabview-debug.js b/lib/yui/tabview/tabview-debug.js index 498fb0d90a..b78dd57109 100755 --- a/lib/yui/tabview/tabview-debug.js +++ b/lib/yui/tabview/tabview-debug.js @@ -2,8 +2,9 @@ Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt -version: 0.12.0 +version: 0.12.1 */ + (function() { YAHOO.util.Lang = { @@ -788,7 +789,7 @@ YAHOO.util.Element.prototype = { set: function(key, value, silent) { var el = this.get('element'); if (!el) { - this._queue[key] = ['set', arguments]; + this._queue[this._queue.length] = ['set', arguments]; return false; } @@ -934,7 +935,8 @@ var _registerHTMLAttr = function(self, key, map) { YAHOO.augment(YAHOO.util.Element, AttributeProvider); -})();(function() { +})(); +(function() { var Dom = YAHOO.util.Dom, Event = YAHOO.util.Event, Lang = YAHOO.util.Lang; diff --git a/lib/yui/tabview/tabview-min.js b/lib/yui/tabview/tabview-min.js index e893de7588..18ed9be3ce 100755 --- a/lib/yui/tabview/tabview-min.js +++ b/lib/yui/tabview/tabview-min.js @@ -1 +1,54 @@ -/* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt version: 0.12.0 */ (function(){YAHOO.util.Lang={isArray:function(val){if(val.constructor&&val.constructor.toString().indexOf('Array')>-1){return true;}else{return YAHOO.util.Lang.isObject(val)&&val.constructor==Array;}},isBoolean:function(val){return typeof val=='boolean';},isFunction:function(val){return typeof val=='function';},isNull:function(val){return val===null;},isNumber:function(val){return!isNaN(val);},isObject:function(val){return typeof val=='object'||YAHOO.util.Lang.isFunction(val);},isString:function(val){return typeof val=='string';},isUndefined:function(val){return typeof val=='undefined';}};})();YAHOO.util.Attribute=function(hash,owner){if(owner){this.owner=owner;this.configure(hash,true);}};YAHOO.util.Attribute.prototype={name:undefined,value:null,owner:null,readOnly:false,writeOnce:false,_initialConfig:null,_written:false,method:null,validator:null,getValue:function(){return this.value;},setValue:function(value,silent){var beforeRetVal;var owner=this.owner;var name=this.name;var event={type:name,prevValue:this.getValue(),newValue:value};if(this.readOnly||(this.writeOnce&&this._written)){return false;}if(this.validator&&!this.validator.call(owner,value)){return false;}if(!silent){beforeRetVal=owner.fireBeforeChangeEvent(event);if(beforeRetVal===false){YAHOO.log('setValue '+name+'cancelled by beforeChange event','info','Attribute');return false;}}if(this.method){this.method.call(owner,value);}this.value=value;this._written=true;event.type=name;if(!silent){this.owner.fireChangeEvent(event);}return true;},configure:function(map,init){map=map||{};this._written=false;this._initialConfig=this._initialConfig||{};for(var key in map){if(key&&map.hasOwnProperty(key)){this[key]=map[key];if(init){this._initialConfig[key]=map[key];}}}},resetValue:function(){return this.setValue(this._initialConfig.value);},resetConfig:function(){this.configure(this._initialConfig);},refresh:function(silent){this.setValue(this.value,silent);}};(function(){var Lang=YAHOO.util.Lang;YAHOO.util.AttributeProvider=function(){};YAHOO.util.AttributeProvider.prototype={_configs:null,get:function(key){var configs=this._configs||{};var config=configs[key];if(!config){YAHOO.log(key+' not found','error','AttributeProvider');return undefined;}return config.value;},set:function(key,value,silent){var configs=this._configs||{};var config=configs[key];if(!config){YAHOO.log('set failed: '+key+' not found','error','AttributeProvider');return false;}return config.setValue(value,silent);},getAttributeKeys:function(){var configs=this._configs;var keys=[];var config;for(var key in configs){config=configs[key];if(configs.hasOwnProperty(key)&&!Lang.isUndefined(config)){keys[keys.length]=key;}}return keys;},setAttributes:function(map,silent){for(var key in map){if(map.hasOwnProperty(key)){this.set(key,map[key],silent);}}},resetValue:function(key,silent){var configs=this._configs||{};if(configs[key]){this.set(key,configs[key]._initialConfig.value,silent);return true;}return false;},refresh:function(key,silent){var configs=this._configs;key=((Lang.isString(key))?[key]:key)||this.getAttributeKeys();for(var i=0,len=key.length;i1){if(index+1==tabCount){this.set('activeIndex',index-1);}else{this.set('activeIndex',index+1);}}}this._tabParent.removeChild(tab.get('element'));this._contentParent.removeChild(tab.get('contentEl'));this._configs.tabs.value.splice(index,1);};proto.toString=function(){var name=this.get('id')||this.get('tagName');return"TabView "+name;};proto.contentTransition=function(newTab,oldTab){newTab.set('contentVisible',true);oldTab.set('contentVisible',false);};proto.initAttributes=function(attr){YAHOO.widget.TabView.superclass.initAttributes.call(this,attr);if(!attr.orientation){attr.orientation='top';}var el=this.get('element');this.register('tabs',{value:[],readOnly:true});this._tabParent=this.getElementsByClassName(this.TAB_PARENT_CLASSNAME,'ul')[0]||_createTabParent.call(this);this._contentParent=this.getElementsByClassName(this.CONTENT_PARENT_CLASSNAME,'div')[0]||_createContentParent.call(this);this.register('orientation',{value:attr.orientation,method:function(value){var current=this.get('orientation');this.addClass('yui-navset-'+value);if(current!=value){this.removeClass('yui-navset-'+current);}switch(value){case'bottom':this.appendChild(this._tabParent);break;}}});this.register('activeIndex',{value:attr.activeIndex,method:function(value){this.set('activeTab',this.getTab(value));},validator:function(value){return!this.getTab(value).get('disabled');}});this.register('activeTab',{value:attr.activeTab,method:function(tab){var activeTab=this.get('activeTab');if(tab){tab.set('active',true);}if(activeTab&&activeTab!=tab){activeTab.set('active',false);}if(activeTab&&tab!=activeTab){this.contentTransition(tab,activeTab);}else if(tab){tab.set('contentVisible',true);}},validator:function(value){return!value.get('disabled');}});if(this._tabParent){_initTabs.call(this);}for(var type in this.DOM_EVENTS){if(this.DOM_EVENTS.hasOwnProperty(type)){this.addListener.call(this,type,this.DOMEventHandler);}}};var _initTabs=function(){var tab,attr,contentEl;var el=this.get('element');var tabs=_getChildNodes(this._tabParent);var contentElements=_getChildNodes(this._contentParent);for(var i=0,len=tabs.length;i-1){return true;}else{return YAHOO.util.Lang.isObject(val)&&val.constructor==Array;}},isBoolean:function(val){return typeof val=='boolean';},isFunction:function(val){return typeof val=='function';},isNull:function(val){return val===null;},isNumber:function(val){return!isNaN(val);},isObject:function(val){return typeof val=='object'||YAHOO.util.Lang.isFunction(val);},isString:function(val){return typeof val=='string';},isUndefined:function(val){return typeof val=='undefined';}};})();YAHOO.util.Attribute=function(hash,owner){if(owner){this.owner=owner;this.configure(hash,true);}};YAHOO.util.Attribute.prototype={name:undefined,value:null,owner:null,readOnly:false,writeOnce:false,_initialConfig:null,_written:false,method:null,validator:null,getValue:function(){return this.value;},setValue:function(value,silent){var beforeRetVal;var owner=this.owner;var name=this.name;var event={type:name,prevValue:this.getValue(),newValue:value};if(this.readOnly||(this.writeOnce&&this._written)){return false;} +if(this.validator&&!this.validator.call(owner,value)){return false;} +if(!silent){beforeRetVal=owner.fireBeforeChangeEvent(event);if(beforeRetVal===false){return false;}} +if(this.method){this.method.call(owner,value);} +this.value=value;this._written=true;event.type=name;if(!silent){this.owner.fireChangeEvent(event);} +return true;},configure:function(map,init){map=map||{};this._written=false;this._initialConfig=this._initialConfig||{};for(var key in map){if(key&&map.hasOwnProperty(key)){this[key]=map[key];if(init){this._initialConfig[key]=map[key];}}}},resetValue:function(){return this.setValue(this._initialConfig.value);},resetConfig:function(){this.configure(this._initialConfig);},refresh:function(silent){this.setValue(this.value,silent);}};(function(){var Lang=YAHOO.util.Lang;YAHOO.util.AttributeProvider=function(){};YAHOO.util.AttributeProvider.prototype={_configs:null,get:function(key){var configs=this._configs||{};var config=configs[key];if(!config){return undefined;} +return config.value;},set:function(key,value,silent){var configs=this._configs||{};var config=configs[key];if(!config){return false;} +return config.setValue(value,silent);},getAttributeKeys:function(){var configs=this._configs;var keys=[];var config;for(var key in configs){config=configs[key];if(configs.hasOwnProperty(key)&&!Lang.isUndefined(config)){keys[keys.length]=key;}} +return keys;},setAttributes:function(map,silent){for(var key in map){if(map.hasOwnProperty(key)){this.set(key,map[key],silent);}}},resetValue:function(key,silent){var configs=this._configs||{};if(configs[key]){this.set(key,configs[key]._initialConfig.value,silent);return true;} +return false;},refresh:function(key,silent){var configs=this._configs;key=((Lang.isString(key))?[key]:key)||this.getAttributeKeys();for(var i=0,len=key.length;i1){if(index+1==tabCount){this.set('activeIndex',index-1);}else{this.set('activeIndex',index+1);}}} +this._tabParent.removeChild(tab.get('element'));this._contentParent.removeChild(tab.get('contentEl'));this._configs.tabs.value.splice(index,1);};proto.toString=function(){var name=this.get('id')||this.get('tagName');return"TabView "+name;};proto.contentTransition=function(newTab,oldTab){newTab.set('contentVisible',true);oldTab.set('contentVisible',false);};proto.initAttributes=function(attr){YAHOO.widget.TabView.superclass.initAttributes.call(this,attr);if(!attr.orientation){attr.orientation='top';} +var el=this.get('element');this.register('tabs',{value:[],readOnly:true});this._tabParent=this.getElementsByClassName(this.TAB_PARENT_CLASSNAME,'ul')[0]||_createTabParent.call(this);this._contentParent=this.getElementsByClassName(this.CONTENT_PARENT_CLASSNAME,'div')[0]||_createContentParent.call(this);this.register('orientation',{value:attr.orientation,method:function(value){var current=this.get('orientation');this.addClass('yui-navset-'+value);if(current!=value){this.removeClass('yui-navset-'+current);} +switch(value){case'bottom':this.appendChild(this._tabParent);break;}}});this.register('activeIndex',{value:attr.activeIndex,method:function(value){this.set('activeTab',this.getTab(value));},validator:function(value){return!this.getTab(value).get('disabled');}});this.register('activeTab',{value:attr.activeTab,method:function(tab){var activeTab=this.get('activeTab');if(tab){tab.set('active',true);} +if(activeTab&&activeTab!=tab){activeTab.set('active',false);} +if(activeTab&&tab!=activeTab){this.contentTransition(tab,activeTab);}else if(tab){tab.set('contentVisible',true);}},validator:function(value){return!value.get('disabled');}});if(this._tabParent){_initTabs.call(this);} +for(var type in this.DOM_EVENTS){if(this.DOM_EVENTS.hasOwnProperty(type)){this.addListener.call(this,type,this.DOMEventHandler);}}};var _initTabs=function(){var tab,attr,contentEl;var el=this.get('element');var tabs=_getChildNodes(this._tabParent);var contentElements=_getChildNodes(this._contentParent);for(var i=0,len=tabs.length;i '; } @@ -668,12 +695,12 @@ YAHOO.widget.TreeView.preload = function(prefix) { document.body.appendChild(f); - YAHOO.widget.TreeView.removeHandler(window, + YAHOO.widget.TreeView.removeHandler(window, "load", YAHOO.widget.TreeView.preload); }; -YAHOO.widget.TreeView.addHandler(window, +YAHOO.widget.TreeView.addHandler(window, "load", YAHOO.widget.TreeView.preload); /** @@ -681,6 +708,7 @@ YAHOO.widget.TreeView.addHandler(window, * response to mouse events is handled in Node subclasses. * @namespace YAHOO.widget * @class Node + * @uses YAHOO.util.EventProvider * @param oData {object} a string or object containing the data that will * be used to render this node * @param oParent {Node} this node's parent node @@ -703,7 +731,7 @@ YAHOO.widget.Node.prototype = { /** * This node's child node collection. * @property children - * @type Node[] + * @type Node[] */ children: null, @@ -767,7 +795,7 @@ YAHOO.widget.Node.prototype = { /** * Should we render children for a collapsed node? It is possible that the - * implementer will want to render the hidden data... @todo verify that we + * implementer will want to render the hidden data... @todo verify that we * need this, and implement it if we do. * @property renderHidden * @type boolean @@ -847,6 +875,15 @@ YAHOO.widget.Node.prototype = { */ iconMode: 0, + /** + * Specifies whether or not the content area of the node should be allowed + * to wrap. + * @property nowrap + * @type boolean + * @default true + */ + nowrap: false, + /** * The node type * @property _type @@ -882,7 +919,7 @@ YAHOO.widget.Node.prototype = { * The parentChange event is fired when a parent element is applied * to the node. This is useful if you need to apply tree-level * properties to a tree that need to happen if a node is moved from - * one tre to another. + * one tree to another. * * @event parentChange * @type CustomEvent @@ -993,7 +1030,7 @@ YAHOO.widget.Node.prototype = { return this; }, - + /** * Inserts this node after the supplied node * @method insertAfter @@ -1033,7 +1070,7 @@ YAHOO.widget.Node.prototype = { * Returns true if the Node is a child of supplied Node * @method isChildOf * @param parentNode {Node} the Node to check - * @return {boolean} The node index if this Node is a child of + * @return {boolean} The node index if this Node is a child of * supplied Node, else -1. * @private */ @@ -1119,7 +1156,7 @@ YAHOO.widget.Node.prototype = { /* getSpacerId: function() { return "ygtvspacer" + this.index; - }, + }, */ /** @@ -1182,7 +1219,7 @@ YAHOO.widget.Node.prototype = { * @return {string} the javascript url for toggling this node */ getToggleLink: function() { - return "YAHOO.widget.TreeView.getNode(\'" + this.tree.id + "\'," + + return "YAHOO.widget.TreeView.getNode(\'" + this.tree.id + "\'," + this.index + ").toggle()"; }, @@ -1213,17 +1250,18 @@ YAHOO.widget.Node.prototype = { if (!this.getEl()) { this.expanded = false; - return; - } - - // hide the child div - this.hideChildren(); - this.expanded = false; + } else { + // hide the child div + this.hideChildren(); + this.expanded = false; - this.updateIcon(); + this.updateIcon(); + } // this.getSpacer().title = this.getStateText(); + ret = this.tree.fireEvent("collapseComplete", this); + }, /** @@ -1242,7 +1280,7 @@ YAHOO.widget.Node.prototype = { this.logger.log("Expand was stopped by the abstract onExpand"); return; } - + ret = this.tree.fireEvent("expand", this); if (false === ret) { @@ -1280,13 +1318,15 @@ YAHOO.widget.Node.prototype = { if (! this.multiExpand) { var sibs = this.getSiblings(); for (var i=0; i 0 || + hasChildren: function(checkForLazyLoad) { + return ( this.children.length > 0 || (checkForLazyLoad && this.isDynamic() && !this.dynamicLoadComplete) ); }, @@ -1519,22 +1559,22 @@ YAHOO.widget.Node.prototype = { if (this.dataLoader) { this.logger.log("Using dynamic loader defined for this node"); - setTimeout( + setTimeout( function() { - node.dataLoader(node, - function() { - node.loadComplete(); + node.dataLoader(node, + function() { + node.loadComplete(); }); }, 10); - + } else if (this.tree.root.dataLoader) { this.logger.log("Using the tree-level dynamic loader"); - setTimeout( + setTimeout( function() { - node.tree.root.dataLoader(node, - function() { - node.loadComplete(); + node.tree.root.dataLoader(node, + function() { + node.loadComplete(); }); }, 10); @@ -1563,7 +1603,7 @@ YAHOO.widget.Node.prototype = { // this.children[i].childrenRendered = false; sb[sb.length] = this.children[i].getHtml(); } - + this.childrenRendered = true; return sb.join(""); @@ -1596,7 +1636,7 @@ YAHOO.widget.Node.prototype = { } var p = this.parent; - + while (p.depth > depth) { p = p.parent; } @@ -1614,7 +1654,7 @@ YAHOO.widget.Node.prototype = { * @return {string} the css class for the spacer */ getDepthStyle: function(depth) { - return (this.getAncestor(depth).nextSibling) ? + return (this.getAncestor(depth).nextSibling) ? "ygtvdepthcell" : "ygtvblankdepthcell"; }, @@ -1624,9 +1664,9 @@ YAHOO.widget.Node.prototype = { * @method getNodeHtml * @return {string} The HTML that will render this node. */ - getNodeHtml: function() { + getNodeHtml: function() { this.logger.log("Generating html"); - return ""; + return ""; }, /** @@ -1660,7 +1700,7 @@ YAHOO.widget.Node.prototype = { YAHOO.augment(YAHOO.widget.Node, YAHOO.util.EventProvider); /** - * A custom YAHOO.widget.Node that handles the unique nature of + * A custom YAHOO.widget.Node that handles the unique nature of * the virtual, presentationless root node. * @namespace YAHOO.widget * @class RootNode @@ -1673,7 +1713,7 @@ YAHOO.widget.RootNode = function(oTree) { // special case where the node has no presentation. So we have // to alter the standard properties a bit. this.init(null, null, true); - + /* * For the root node, we get the tree reference from as a param * to the constructor instead of from the parent element. @@ -1682,17 +1722,17 @@ YAHOO.widget.RootNode = function(oTree) { }; YAHOO.extend(YAHOO.widget.RootNode, YAHOO.widget.Node, { - + // overrides YAHOO.widget.Node - getNodeHtml: function() { - return ""; + getNodeHtml: function() { + return ""; }, - toString: function() { + toString: function() { return "RootNode"; }, - loadComplete: function() { + loadComplete: function() { this.tree.draw(); } @@ -1715,7 +1755,7 @@ YAHOO.extend(YAHOO.widget.RootNode, YAHOO.widget.Node, { */ YAHOO.widget.TextNode = function(oData, oParent, expanded) { - if (oData) { + if (oData) { this.init(oData, oParent, expanded); this.setUpLabel(oData); } @@ -1724,7 +1764,7 @@ YAHOO.widget.TextNode = function(oData, oParent, expanded) { }; YAHOO.extend(YAHOO.widget.TextNode, YAHOO.widget.Node, { - + /** * The CSS class for the label href. Defaults to ygtvlabel, but can be * overridden to provide a custom presentation for a specific node. @@ -1750,11 +1790,11 @@ YAHOO.extend(YAHOO.widget.TextNode, YAHOO.widget.Node, { label: null, textNodeParentChange: function() { - + /** * Custom event that is fired when the text node label is clicked. The * custom event is defined on the tree instance, so there is a single - * event that handles all nodes in the tree. The node clicked is + * event that handles all nodes in the tree. The node clicked is * provided as an argument * * @event labelClick @@ -1764,7 +1804,7 @@ YAHOO.extend(YAHOO.widget.TextNode, YAHOO.widget.Node, { if (this.tree && !this.tree.hasEvent("labelClick")) { this.tree.createEvent("labelClick", this.tree); } - + }, /** @@ -1772,8 +1812,8 @@ YAHOO.extend(YAHOO.widget.TextNode, YAHOO.widget.Node, { * @method setUpLabel * @param oData string containing the label, or an object with a label property */ - setUpLabel: function(oData) { - + setUpLabel: function(oData) { + // set up the custom event on the tree this.textNodeParentChange(); this.subscribe("parentChange", this.textNodeParentChange); @@ -1782,7 +1822,7 @@ YAHOO.extend(YAHOO.widget.TextNode, YAHOO.widget.Node, { oData = { label: oData }; } this.label = oData.label; - + // update the link if (oData.href) { this.href = oData.href; @@ -1806,21 +1846,22 @@ YAHOO.extend(YAHOO.widget.TextNode, YAHOO.widget.Node, { * @method getLabelEl * @return {object} the element */ - getLabelEl: function() { + getLabelEl: function() { return document.getElementById(this.labelElId); }, // overrides YAHOO.widget.Node - getNodeHtml: function() { + getNodeHtml: function() { this.logger.log("Generating html"); var sb = []; sb[sb.length] = ''; sb[sb.length] = ''; - + for (var i=0;i '; + //sb[sb.length] = ''; + //sb[sb.length] = ''; + sb[sb.length] = ''; } var getNode = 'YAHOO.widget.TreeView.getNode(\'' + @@ -1838,6 +1879,8 @@ YAHOO.extend(YAHOO.widget.TextNode, YAHOO.widget.Node, { } sb[sb.length] = ' onclick="javascript:' + this.getToggleLink() + '">'; + sb[sb.length] = '
    '; + /* sb[sb.length] = ' '; + //sb[sb.length] = '
    '; + sb[sb.length] = ''; } if (this.hasIcon) { @@ -2031,12 +2078,14 @@ YAHOO.extend(YAHOO.widget.HTMLNode, YAHOO.widget.Node, { sb[sb.length] = 'YAHOO.widget.TreeView.getNode(\''; sb[sb.length] = this.tree.id + '\',' + this.index + ').getStyle()"'; } - sb[sb.length] = '> '; + //sb[sb.length] = '> '; + sb[sb.length] = '>
    '; } sb[sb.length] = ' ";}var f=document.createElement("div");var s=f.style;s.position="absolute";s.top="-1000px";s.left="-1000px";f.innerHTML=sb.join("");document.body.appendChild(f);YAHOO.widget.TreeView.removeHandler(window,"load",YAHOO.widget.TreeView.preload);};YAHOO.widget.TreeView.addHandler(window,"load",YAHOO.widget.TreeView.preload);YAHOO.widget.Node=function(_44,_45,_46){if(_44){this.init(_44,_45,_46);}};YAHOO.widget.Node.prototype={index:0,children:null,tree:null,data:null,parent:null,depth:-1,href:null,target:"_self",expanded:false,multiExpand:true,renderHidden:false,childrenRendered:false,dynamicLoadComplete:false,previousSibling:null,nextSibling:null,_dynLoad:false,dataLoader:null,isLoading:false,hasIcon:true,iconMode:0,_type:"Node",init:function(_47,_48,_49){this.data=_47;this.children=[];this.index=YAHOO.widget.TreeView.nodeCount;++YAHOO.widget.TreeView.nodeCount;this.expanded=_49;this.createEvent("parentChange",this);if(_48){_48.appendChild(this);}},applyParent:function(_50){if(!_50){return false;}this.tree=_50.tree;this.parent=_50;this.depth=_50.depth+1;if(!this.href){this.href="javascript:"+this.getToggleLink();}if(!this.multiExpand){this.multiExpand=_50.multiExpand;}this.tree.regNode(this);_50.childrenRendered=false;for(var i=0,len=this.children.length;i0||(_67&&this.isDynamic()&&!this.dynamicLoadComplete));},toggle:function(){if(!this.tree.locked&&(this.hasChildren(true)||this.isDynamic())){if(this.expanded){this.collapse();}else{this.expand();}}},getHtml:function(){this.childrenRendered=false;var sb=[];sb[sb.length]="
    ";sb[sb.length]=this.getNodeHtml();sb[sb.length]=this.getChildrenHtml();sb[sb.length]="
    ";return sb.join("");},getChildrenHtml:function(){var sb=[];sb[sb.length]="
    ";if((this.hasChildren(true)&&this.expanded)||(this.renderHidden&&!this.isDynamic())){sb[sb.length]=this.renderChildren();}sb[sb.length]="
    ";return sb.join("");},renderChildren:function(){var _68=this;if(this.isDynamic()&&!this.dynamicLoadComplete){this.isLoading=true;this.tree.locked=true;if(this.dataLoader){setTimeout(function(){_68.dataLoader(_68,function(){_68.loadComplete();});},10);}else{if(this.tree.root.dataLoader){setTimeout(function(){_68.tree.root.dataLoader(_68,function(){_68.loadComplete();});},10);}else{return "Error: data loader not found or not specified.";}}return "";}else{return this.completeRender();}},completeRender:function(){var sb=[];for(var i=0;i=this.depth||_69<0){return null;}var p=this.parent;while(p.depth>_69){p=p.parent;}return p;},getDepthStyle:function(_70){return (this.getAncestor(_70).nextSibling)?"ygtvdepthcell":"ygtvblankdepthcell";},getNodeHtml:function(){return "";},refresh:function(){this.getChildrenEl().innerHTML=this.completeRender();if(this.hasIcon){var el=this.getToggleEl();if(el){el.className=this.getStyle();}}},toString:function(){return "Node ("+this.index+")";}};YAHOO.augment(YAHOO.widget.Node,YAHOO.util.EventProvider);YAHOO.widget.RootNode=function(_71){this.init(null,null,true);this.tree=_71;};YAHOO.extend(YAHOO.widget.RootNode,YAHOO.widget.Node,{getNodeHtml:function(){return "";},toString:function(){return "RootNode";},loadComplete:function(){this.tree.draw();}});YAHOO.widget.TextNode=function(_72,_73,_74){if(_72){this.init(_72,_73,_74);this.setUpLabel(_72);}};YAHOO.extend(YAHOO.widget.TextNode,YAHOO.widget.Node,{labelStyle:"ygtvlabel",labelElId:null,label:null,textNodeParentChange:function(){if(this.tree&&!this.tree.hasEvent("labelClick")){this.tree.createEvent("labelClick",this.tree);}},setUpLabel:function(_75){this.textNodeParentChange();this.subscribe("parentChange",this.textNodeParentChange);if(typeof _75=="string"){_75={label:_75};}this.label=_75.label;if(_75.href){this.href=_75.href;}if(_75.target){this.target=_75.target;}if(_75.style){this.labelStyle=_75.style;}this.labelElId="ygtvlabelel"+this.index;},getLabelEl:function(){return document.getElementById(this.labelElId);},getNodeHtml:function(){var sb=[];sb[sb.length]="
     
     
    ";sb[sb.length]="";for(var i=0;i ";}var _76="YAHOO.widget.TreeView.getNode('"+this.tree.id+"',"+this.index+")";sb[sb.length]="";sb[sb.length]=" ";sb[sb.length]="";sb[sb.length]="";sb[sb.length]="";sb[sb.length]="
    ";sb[sb.length]="";sb[sb.length]=this.label;sb[sb.length]="";sb[sb.length]="
    ";return sb.join("");},onLabelClick:function(me){return me.tree.fireEvent("labelClick",me);},toString:function(){return "TextNode ("+this.index+") "+this.label;}});YAHOO.widget.MenuNode=function(_78,_79,_80){if(_78){this.init(_78,_79,_80);this.setUpLabel(_78);}this.multiExpand=false;};YAHOO.extend(YAHOO.widget.MenuNode,YAHOO.widget.TextNode,{toString:function(){return "MenuNode ("+this.index+") "+this.label;}});YAHOO.widget.HTMLNode=function(_81,_82,_83,_84){if(_81){this.init(_81,_82,_83);this.initContent(_81,_84);}};YAHOO.extend(YAHOO.widget.HTMLNode,YAHOO.widget.Node,{contentStyle:"ygtvhtml",contentElId:null,content:null,initContent:function(_85,_86){if(typeof _85=="string"){_85={html:_85};}this.html=_85.html;this.contentElId="ygtvcontentel"+this.index;this.hasIcon=_86;},getContentEl:function(){return document.getElementById(this.contentElId);},getNodeHtml:function(){var sb=[];sb[sb.length]="";sb[sb.length]="";for(var i=0;i ";}if(this.hasIcon){sb[sb.length]=" ";}sb[sb.length]="";sb[sb.length]=this.html;sb[sb.length]="";sb[sb.length]="";sb[sb.length]="
    ";return sb.join("");},toString:function(){return "HTMLNode ("+this.index+")";}});YAHOO.widget.TVAnim=function(){return {FADE_IN:"TVFadeIn",FADE_OUT:"TVFadeOut",getAnim:function(_87,el,_88){if(YAHOO.widget[_87]){return new YAHOO.widget[_87](el,_88);}else{return null;}},isValid:function(_89){return (YAHOO.widget[_89]);}};}();YAHOO.widget.TVFadeIn=function(el,_90){this.el=el;this.callback=_90;};YAHOO.widget.TVFadeIn.prototype={animate:function(){var _91=this;var s=this.el.style;s.opacity=0.1;s.filter="alpha(opacity=10)";s.display="";var dur=0.4;var a=new YAHOO.util.Anim(this.el,{opacity:{from:0.1,to:1,unit:""}},dur);a.onComplete.subscribe(function(){_91.onComplete();});a.animate();},onComplete:function(){this.callback();},toString:function(){return "TVFadeIn";}};YAHOO.widget.TVFadeOut=function(el,_93){this.el=el;this.callback=_93;};YAHOO.widget.TVFadeOut.prototype={animate:function(){var _94=this;var dur=0.4;var a=new YAHOO.util.Anim(this.el,{opacity:{from:1,to:0.1,unit:""}},dur);a.onComplete.subscribe(function(){_94.onComplete();});a.animate();},onComplete:function(){var s=this.el.style;s.display="none";s.filter="alpha(opacity=100)";this.callback();},toString:function(){return "TVFadeOut";}}; \ No newline at end of file +/* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt version: 0.12.1 */ +YAHOO.widget.TreeView=function(id){if(id){this.init(id);}};YAHOO.widget.TreeView.prototype={id:null,_el:null,_nodes:null,locked:false,_expandAnim:null,_collapseAnim:null,_animCount:0,maxAnim:2,setExpandAnim:function(type){if(YAHOO.widget.TVAnim.isValid(type)){this._expandAnim=type;}},setCollapseAnim:function(type){if(YAHOO.widget.TVAnim.isValid(type)){this._collapseAnim=type;}},animateExpand:function(el,node){if(this._expandAnim&&this._animCount ';} +var f=document.createElement("div");var s=f.style;s.position="absolute";s.top="-1000px";s.left="-1000px";f.innerHTML=sb.join("");document.body.appendChild(f);YAHOO.widget.TreeView.removeHandler(window,"load",YAHOO.widget.TreeView.preload);};YAHOO.widget.TreeView.addHandler(window,"load",YAHOO.widget.TreeView.preload);YAHOO.widget.Node=function(oData,oParent,expanded){if(oData){this.init(oData,oParent,expanded);}};YAHOO.widget.Node.prototype={index:0,children:null,tree:null,data:null,parent:null,depth:-1,href:null,target:"_self",expanded:false,multiExpand:true,renderHidden:false,childrenRendered:false,dynamicLoadComplete:false,previousSibling:null,nextSibling:null,_dynLoad:false,dataLoader:null,isLoading:false,hasIcon:true,iconMode:0,nowrap:false,_type:"Node",init:function(oData,oParent,expanded){this.data=oData;this.children=[];this.index=YAHOO.widget.TreeView.nodeCount;++YAHOO.widget.TreeView.nodeCount;this.expanded=expanded;this.createEvent("parentChange",this);if(oParent){oParent.appendChild(this);}},applyParent:function(parentNode){if(!parentNode){return false;} +this.tree=parentNode.tree;this.parent=parentNode;this.depth=parentNode.depth+1;if(!this.href){this.href="javascript:"+this.getToggleLink();} +if(!this.multiExpand){this.multiExpand=parentNode.multiExpand;} +this.tree.regNode(this);parentNode.childrenRendered=false;for(var i=0,len=this.children.length;i0||(checkForLazyLoad&&this.isDynamic()&&!this.dynamicLoadComplete));},toggle:function(){if(!this.tree.locked&&(this.hasChildren(true)||this.isDynamic())){if(this.expanded){this.collapse();}else{this.expand();}}},getHtml:function(){this.childrenRendered=false;var sb=[];sb[sb.length]='
    ';sb[sb.length]=this.getNodeHtml();sb[sb.length]=this.getChildrenHtml();sb[sb.length]='
    ';return sb.join("");},getChildrenHtml:function(){var sb=[];sb[sb.length]='
    =this.depth||depth<0){return null;} +var p=this.parent;while(p.depth>depth){p=p.parent;} +return p;},getDepthStyle:function(depth){return(this.getAncestor(depth).nextSibling)?"ygtvdepthcell":"ygtvblankdepthcell";},getNodeHtml:function(){return"";},refresh:function(){this.getChildrenEl().innerHTML=this.completeRender();if(this.hasIcon){var el=this.getToggleEl();if(el){el.className=this.getStyle();}}},toString:function(){return"Node ("+this.index+")";}};YAHOO.augment(YAHOO.widget.Node,YAHOO.util.EventProvider);YAHOO.widget.RootNode=function(oTree){this.init(null,null,true);this.tree=oTree;};YAHOO.extend(YAHOO.widget.RootNode,YAHOO.widget.Node,{getNodeHtml:function(){return"";},toString:function(){return"RootNode";},loadComplete:function(){this.tree.draw();}});YAHOO.widget.TextNode=function(oData,oParent,expanded){if(oData){this.init(oData,oParent,expanded);this.setUpLabel(oData);}};YAHOO.extend(YAHOO.widget.TextNode,YAHOO.widget.Node,{labelStyle:"ygtvlabel",labelElId:null,label:null,textNodeParentChange:function(){if(this.tree&&!this.tree.hasEvent("labelClick")){this.tree.createEvent("labelClick",this.tree);}},setUpLabel:function(oData){this.textNodeParentChange();this.subscribe("parentChange",this.textNodeParentChange);if(typeof oData=="string"){oData={label:oData};} +this.label=oData.label;if(oData.href){this.href=oData.href;} +if(oData.target){this.target=oData.target;} +if(oData.style){this.labelStyle=oData.style;} +this.labelElId="ygtvlabelel"+this.index;},getLabelEl:function(){return document.getElementById(this.labelElId);},getNodeHtml:function(){var sb=[];sb[sb.length]='';sb[sb.length]='';for(var i=0;i
    ';} +var getNode='YAHOO.widget.TreeView.getNode(\''+ +this.tree.id+'\','+this.index+')';sb[sb.length]='';sb[sb.length]='
    ';sb[sb.length]='
    ';sb[sb.length]='';sb[sb.length]='
    ';sb[sb.length]='';sb[sb.length]='
    ';sb[sb.length]='
    ';return sb.join("");},onLabelClick:function(me){return me.tree.fireEvent("labelClick",me);},toString:function(){return"TextNode ("+this.index+") "+this.label;}});YAHOO.widget.MenuNode=function(oData,oParent,expanded){if(oData){this.init(oData,oParent,expanded);this.setUpLabel(oData);} +this.multiExpand=false;};YAHOO.extend(YAHOO.widget.MenuNode,YAHOO.widget.TextNode,{toString:function(){return"MenuNode ("+this.index+") "+this.label;}});YAHOO.widget.HTMLNode=function(oData,oParent,expanded,hasIcon){if(oData){this.init(oData,oParent,expanded);this.initContent(oData,hasIcon);}};YAHOO.extend(YAHOO.widget.HTMLNode,YAHOO.widget.Node,{contentStyle:"ygtvhtml",contentElId:null,content:null,initContent:function(oData,hasIcon){if(typeof oData=="string"){oData={html:oData};} +this.html=oData.html;this.contentElId="ygtvcontentel"+this.index;this.hasIcon=hasIcon;},getContentEl:function(){return document.getElementById(this.contentElId);},getNodeHtml:function(){var sb=[];sb[sb.length]='';sb[sb.length]='';for(var i=0;i
    ';} +if(this.hasIcon){sb[sb.length]='';sb[sb.length]='
    ';sb[sb.length]='
    ';return sb.join("");},toString:function(){return"HTMLNode ("+this.index+")";}});YAHOO.widget.TVAnim=function(){return{FADE_IN:"TVFadeIn",FADE_OUT:"TVFadeOut",getAnim:function(type,el,callback){if(YAHOO.widget[type]){return new YAHOO.widget[type](el,callback);}else{return null;}},isValid:function(type){return(YAHOO.widget[type]);}};}();YAHOO.widget.TVFadeIn=function(el,callback){this.el=el;this.callback=callback;};YAHOO.widget.TVFadeIn.prototype={animate:function(){var tvanim=this;var s=this.el.style;s.opacity=0.1;s.filter="alpha(opacity=10)";s.display="";var dur=0.4;var a=new YAHOO.util.Anim(this.el,{opacity:{from:0.1,to:1,unit:""}},dur);a.onComplete.subscribe(function(){tvanim.onComplete();});a.animate();},onComplete:function(){this.callback();},toString:function(){return"TVFadeIn";}};YAHOO.widget.TVFadeOut=function(el,callback){this.el=el;this.callback=callback;};YAHOO.widget.TVFadeOut.prototype={animate:function(){var tvanim=this;var dur=0.4;var a=new YAHOO.util.Anim(this.el,{opacity:{from:1,to:0.1,unit:""}},dur);a.onComplete.subscribe(function(){tvanim.onComplete();});a.animate();},onComplete:function(){var s=this.el.style;s.display="none";s.filter="alpha(opacity=100)";this.callback();},toString:function(){return"TVFadeOut";}}; \ No newline at end of file diff --git a/lib/yui/treeview/treeview.js b/lib/yui/treeview/treeview.js index ea6b6ef506..36c485d3fc 100755 --- a/lib/yui/treeview/treeview.js +++ b/lib/yui/treeview/treeview.js @@ -2,9 +2,8 @@ Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt -version: 0.12.0 +version: 0.12.1 */ - /** * The treeview widget is a generic tree building tool. * @module treeview @@ -18,6 +17,7 @@ version: 0.12.0 * Contains the tree view state data and the root node. * * @class TreeView + * @uses YAHOO.util.EventProvider * @constructor * @param {string|HTMLElement} id The id of the element, or the element * itself that the tree will be inserted into. @@ -234,23 +234,41 @@ YAHOO.widget.TreeView.prototype = { this.createEvent("animComplete", this); /** - * Fires when a node is going to be expanded. Return false to stop - * the expand. + * Fires when a node is going to be collapsed. Return false to stop + * the collapse. * @event collapse * @type CustomEvent - * @param {YAHOO.widget.Node} node the node that is expanding/collapsing + * @param {YAHOO.widget.Node} node the node that is collapsing */ this.createEvent("collapse", this); /** - * Fires when a node is going to be collapsed. Return false to stop + * Fires after a node is successfully collapsed. This event will not fire + * if the "collapse" event was cancelled. + * @event collapseComplete + * @type CustomEvent + * @param {YAHOO.widget.Node} node the node that was collapsed + */ + this.createEvent("collapseComplete", this); + + /** + * Fires when a node is going to be expanded. Return false to stop * the collapse. * @event expand * @type CustomEvent - * @param {YAHOO.widget.Node} node the node that is expanding/collapsing + * @param {YAHOO.widget.Node} node the node that is expanding */ this.createEvent("expand", this); + /** + * Fires after a node is successfully expanded. This event will not fire + * if the "expand" event was cancelled. + * @event expandComplete + * @type CustomEvent + * @param {YAHOO.widget.Node} node the node that was expanded + */ + this.createEvent("expandComplete", this); + this._nodes = []; // store a global reference @@ -260,8 +278,16 @@ YAHOO.widget.TreeView.prototype = { this.root = new YAHOO.widget.RootNode(this); + + //YAHOO.util.Event.onContentReady(this.id, this.handleAvailable, this, true); + YAHOO.util.Event.on(this.id, "click", this.handleClick, this, true); }, + //handleAvailable: function() { + //var Event = YAHOO.util.Event; + //Event.on(this.id, + //}, + /** * Renders the tree boilerplate and visible nodes * @method draw @@ -670,6 +696,7 @@ YAHOO.widget.TreeView.addHandler(window, * response to mouse events is handled in Node subclasses. * @namespace YAHOO.widget * @class Node + * @uses YAHOO.util.EventProvider * @param oData {object} a string or object containing the data that will * be used to render this node * @param oParent {Node} this node's parent node @@ -836,6 +863,15 @@ YAHOO.widget.Node.prototype = { */ iconMode: 0, + /** + * Specifies whether or not the content area of the node should be allowed + * to wrap. + * @property nowrap + * @type boolean + * @default true + */ + nowrap: false, + /** * The node type * @property _type @@ -870,7 +906,7 @@ YAHOO.widget.Node.prototype = { * The parentChange event is fired when a parent element is applied * to the node. This is useful if you need to apply tree-level * properties to a tree that need to happen if a node is moved from - * one tre to another. + * one tree to another. * * @event parentChange * @type CustomEvent @@ -1192,17 +1228,18 @@ YAHOO.widget.Node.prototype = { if (!this.getEl()) { this.expanded = false; - return; - } - - // hide the child div - this.hideChildren(); - this.expanded = false; + } else { + // hide the child div + this.hideChildren(); + this.expanded = false; - this.updateIcon(); + this.updateIcon(); + } // this.getSpacer().title = this.getStateText(); + ret = this.tree.fireEvent("collapseComplete", this); + }, /** @@ -1262,6 +1299,8 @@ YAHOO.widget.Node.prototype = { } this.showChildren(); + + ret = this.tree.fireEvent("expandComplete", this); }, updateIcon: function() { @@ -1780,8 +1819,9 @@ YAHOO.extend(YAHOO.widget.TextNode, YAHOO.widget.Node, { sb[sb.length] = ''; for (var i=0;i '; + //sb[sb.length] = '
     
    '; + //sb[sb.length] = '
    '; + sb[sb.length] = '
    '; } var getNode = 'YAHOO.widget.TreeView.getNode(\'' + @@ -1799,6 +1839,8 @@ YAHOO.extend(YAHOO.widget.TextNode, YAHOO.widget.Node, { } sb[sb.length] = ' onclick="javascript:' + this.getToggleLink() + '">'; + sb[sb.length] = '
    '; + /* sb[sb.length] = ' '; + //sb[sb.length] = ' '; + sb[sb.length] = '
    '; } if (this.hasIcon) { @@ -1987,12 +2033,14 @@ YAHOO.extend(YAHOO.widget.HTMLNode, YAHOO.widget.Node, { sb[sb.length] = 'YAHOO.widget.TreeView.getNode(\''; sb[sb.length] = this.tree.id + '\',' + this.index + ').getStyle()"'; } - sb[sb.length] = '> '; + //sb[sb.length] = '> '; + sb[sb.length] = '>
    '; } sb[sb.length] = '-1),isSafari=(ua.indexOf('safari')>-1),isGecko=(!isOpera&&!isSafari&&ua.indexOf('gecko')>-1),isIE=(!isOpera&&ua.indexOf('msie')>-1);var patterns={HYPHEN:/(-[a-z])/i};var toCamel=function(property){if(!patterns.HYPHEN.test(property)){return property;}if(propertyCache[property]){return propertyCache[property];}while(patterns.HYPHEN.exec(property)){property=property.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());}propertyCache[property]=property;return property;};if(document.defaultView&&document.defaultView.getComputedStyle){getStyle=function(el,property){var value=null;var computed=document.defaultView.getComputedStyle(el,'');if(computed){value=computed[toCamel(property)];}return el.style[property]||value;};}else if(document.documentElement.currentStyle&&isIE){getStyle=function(el,property){switch(toCamel(property)){case'opacity':var val=100;try{val=el.filters['DXImageTransform.Microsoft.Alpha'].opacity;}catch(e){try{val=el.filters('alpha').opacity;}catch(e){}}return val/100;break;default:var value=el.currentStyle?el.currentStyle[property]:null;return(el.style[property]||value);}};}else{getStyle=function(el,property){return el.style[property];};}if(isIE){setStyle=function(el,property,val){switch(property){case'opacity':if(typeof el.style.filter=='string'){el.style.filter='alpha(opacity='+val*100+')';if(!el.currentStyle||!el.currentStyle.hasLayout){el.style.zoom=1;}}break;default:el.style[property]=val;}};}else{setStyle=function(el,property,val){el.style[property]=val;};}YAHOO.util.Dom={get:function(el){if(!el){return null;}if(typeof el!='string'&&!(el instanceof Array)){return el;}if(typeof el=='string'){return document.getElementById(el);}else{var collection=[];for(var i=0,len=el.length;i=this.left&®ion.right<=this.right&®ion.top>=this.top&®ion.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(region){var t=Math.max(this.top,region.top);var r=Math.min(this.right,region.right);var b=Math.min(this.bottom,region.bottom);var l=Math.max(this.left,region.left);if(b>=t&&r>=l){return new YAHOO.util.Region(t,r,b,l);}else{return null;}};YAHOO.util.Region.prototype.union=function(region){var t=Math.min(this.top,region.top);var r=Math.max(this.right,region.right);var b=Math.max(this.bottom,region.bottom);var l=Math.min(this.left,region.left);return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}");};YAHOO.util.Region.getRegion=function(el){var p=YAHOO.util.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Point=function(x,y){if(x instanceof Array){y=x[1];x=x[0];}this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y;};YAHOO.util.Point.prototype=new YAHOO.util.Region();YAHOO.util.CustomEvent=function(_1,_2,_3,_4){this.type=_1;this.scope=_2||window;this.silent=_3;this.signature=_4||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}var _5="_YUICEOnSubscribe";if(_1!==_5){this.subscribeEvent=new YAHOO.util.CustomEvent(_5,this,true);}};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(fn,_7,_8){if(this.subscribeEvent){this.subscribeEvent.fire(fn,_7,_8);}this.subscribers.push(new YAHOO.util.Subscriber(fn,_7,_8));},unsubscribe:function(fn,_9){var _10=false;for(var i=0,len=this.subscribers.length;i0){_17=_14[0];}ret=s.fn.call(_16,_17,s.obj);}else{ret=s.fn.call(_16,this.type,_14,s.obj);}if(false===ret){if(!this.silent){}return false;}}}return true;},unsubscribeAll:function(){for(var i=0,len=this.subscribers.length;i=0){_60=_23[_61];}if(!el||!_60){return false;}if(this.useLegacyEvent(el,_59)){var _62=this.getLegacyIndex(el,_59);var _63=_26[_62];if(_63){for(i=0,len=_63.length;i0);}var _76=[];for(var i=0,len=_28.length;i0){for(var i=0,len=_23.length;i0){j=_23.length;while(j){index=j-1;l=_23[index];if(l){EU.removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],index);}j=j-1;}l=null;EU.clearCache();}for(i=0,len=_25.length;i0)?val:0;}YAHOO.util.Dom.setStyle(this.getEl(),attr,val+unit);},getAttribute:function(attr){var el=this.getEl();var val=YAHOO.util.Dom.getStyle(el,attr);if(val!=='auto'&&!this.patterns.offsetUnit.test(val)){return parseFloat(val);}var a=this.patterns.offsetAttribute.exec(attr)||[];var pos=!!(a[3]);var box=!!(a[2]);if(box||(YAHOO.util.Dom.getStyle(el,'position')=='absolute'&&pos)){val=el['offset'+a[0].charAt(0).toUpperCase()+a[0].substr(1)];}else{val=0;}return val;},getDefaultUnit:function(attr){if(this.patterns.defaultUnit.test(attr)){return'px';}return'';},setRuntimeAttribute:function(attr){var start;var end;var attributes=this.attributes;this.runtimeAttributes[attr]={};var isset=function(prop){return(typeof prop!=='undefined');};if(!isset(attributes[attr]['to'])&&!isset(attributes[attr]['by'])){return false;}start=(isset(attributes[attr]['from']))?attributes[attr]['from']:this.getAttribute(attr);if(isset(attributes[attr]['to'])){end=attributes[attr]['to'];}else if(isset(attributes[attr]['by'])){if(start.constructor==Array){end=[];for(var i=0,len=start.length;i0&&isFinite(tweak)){if(tween.currentFrame+tweak>=frames){tweak=frames-(frame+1);}tween.currentFrame+=tweak;}};};YAHOO.util.Bezier=new function(){this.getPosition=function(points,t){var n=points.length;var tmp=[];for(var i=0;i0&&!(control[0]instanceof Array)){control=[control];}else{var tmp=[];for(i=0,len=control.length;i0){this.runtimeAttributes[attr]=this.runtimeAttributes[attr].concat(control);}this.runtimeAttributes[attr][this.runtimeAttributes[attr].length]=end;}else{superclass.setRuntimeAttribute.call(this,attr);}};var translateValues=function(val,start){var pageXY=Y.Dom.getXY(this.getEl());val=[val[0]-pageXY[0]+start[0],val[1]-pageXY[1]+start[1]];return val;};var isset=function(prop){return(typeof prop!=='undefined');};})();(function(){YAHOO.util.Scroll=function(el,attributes,duration,method){if(el){YAHOO.util.Scroll.superclass.constructor.call(this,el,attributes,duration,method);}};YAHOO.extend(YAHOO.util.Scroll,YAHOO.util.ColorAnim);var Y=YAHOO.util;var superclass=Y.Scroll.superclass;var proto=Y.Scroll.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("Scroll "+id);};proto.doMethod=function(attr,start,end){var val=null;if(attr=='scroll'){val=[this.method(this.currentFrame,start[0],end[0]-start[0],this.totalFrames),this.method(this.currentFrame,start[1],end[1]-start[1],this.totalFrames)];}else{val=superclass.doMethod.call(this,attr,start,end);}return val;};proto.getAttribute=function(attr){var val=null;var el=this.getEl();if(attr=='scroll'){val=[el.scrollLeft,el.scrollTop];}else{val=superclass.getAttribute.call(this,attr);}return val;};proto.setAttribute=function(attr,val,unit){var el=this.getEl();if(attr=='scroll'){el.scrollLeft=val[0];el.scrollTop=val[1];}else{superclass.setAttribute.call(this,attr,val,unit);}};})();(function(){var _1=YAHOO.util.Event;var _2=YAHOO.util.Dom;YAHOO.util.DragDrop=function(id,_4,_5){if(id){this.init(id,_4,_5);}};YAHOO.util.DragDrop.prototype={id:null,config:null,dragElId:null,handleElId:null,invalidHandleTypes:null,invalidHandleIds:null,invalidHandleClasses:null,startPageX:0,startPageY:0,groups:null,locked:false,lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isTarget:true,padding:null,_domRef:null,__ygDragDrop:true,constrainX:false,constrainY:false,minX:0,maxX:0,minY:0,maxY:0,maintainOffset:false,xTicks:null,yTicks:null,primaryButtonOnly:true,available:false,hasOuterHandles:false,b4StartDrag:function(x,y){},startDrag:function(x,y){},b4Drag:function(e){},onDrag:function(e){},onDragEnter:function(e,id){},b4DragOver:function(e){},onDragOver:function(e,id){},b4DragOut:function(e){},onDragOut:function(e,id){},b4DragDrop:function(e){},onDragDrop:function(e,id){},onInvalidDrop:function(e){},b4EndDrag:function(e){},endDrag:function(e){},b4MouseDown:function(e){},onMouseDown:function(e){},onMouseUp:function(e){},onAvailable:function(){},getEl:function(){if(!this._domRef){this._domRef=_2.get(this.id);}return this._domRef;},getDragEl:function(){return _2.get(this.dragElId);},init:function(id,_9,_10){this.initTarget(id,_9,_10);_1.on(this.id,"mousedown",this.handleMouseDown,this,true);},initTarget:function(id,_11,_12){this.config=_12||{};this.DDM=YAHOO.util.DDM;this.groups={};if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}this.id=id;this.addToGroup((_11)?_11:"default");this.handleElId=id;_1.onAvailable(id,this.handleOnAvailable,this,true);this.setDragElId(id);this.invalidHandleTypes={A:"A"};this.invalidHandleIds={};this.invalidHandleClasses=[];this.applyConfig();},applyConfig:function(){this.padding=this.config.padding||[0,0,0,0];this.isTarget=(this.config.isTarget!==false);this.maintainOffset=(this.config.maintainOffset);this.primaryButtonOnly=(this.config.primaryButtonOnly!==false);},handleOnAvailable:function(){this.available=true;this.resetConstraints();this.onAvailable();},setPadding:function(_13,_14,_15,_16){if(!_14&&0!==_14){this.padding=[_13,_13,_13,_13];}else{if(!_15&&0!==_15){this.padding=[_13,_14,_13,_14];}else{this.padding=[_13,_14,_15,_16];}}},setInitPosition:function(_17,_18){var el=this.getEl();if(!this.DDM.verifyEl(el)){return;}var dx=_17||0;var dy=_18||0;var p=_2.getXY(el);this.initPageX=p[0]-dx;this.initPageY=p[1]-dy;this.lastPageX=p[0];this.lastPageY=p[1];this.setStartPosition(p);},setStartPosition:function(pos){var p=pos||_2.getXY(this.getEl());this.deltaSetXY=null;this.startPageX=p[0];this.startPageY=p[1];},addToGroup:function(_24){this.groups[_24]=true;this.DDM.regDragDrop(this,_24);},removeFromGroup:function(_25){if(this.groups[_25]){delete this.groups[_25];}this.DDM.removeDDFromGroup(this,_25);},setDragElId:function(id){this.dragElId=id;},setHandleElId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}this.handleElId=id;this.DDM.regHandle(this.id,id);},setOuterHandleElId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}_1.on(id,"mousedown",this.handleMouseDown,this,true);this.setHandleElId(id);this.hasOuterHandles=true;},unreg:function(){_1.removeListener(this.id,"mousedown",this.handleMouseDown);this._domRef=null;this.DDM._remove(this);},isLocked:function(){return (this.DDM.isLocked()||this.locked);},handleMouseDown:function(e,oDD){var _27=e.which||e.button;if(this.primaryButtonOnly&&_27>1){return;}if(this.isLocked()){return;}this.DDM.refreshCache(this.groups);var pt=new YAHOO.util.Point(_1.getPageX(e),_1.getPageY(e));if(!this.hasOuterHandles&&!this.DDM.isOverTarget(pt,this)){}else{if(this.clickValidator(e)){this.setStartPosition();this.b4MouseDown(e);this.onMouseDown(e);this.DDM.handleMouseDown(e,this);this.DDM.stopEvent(e);}else{}}},clickValidator:function(e){var _29=_1.getTarget(e);return (this.isValidHandleChild(_29)&&(this.id==this.handleElId||this.DDM.handleWasClicked(_29,this.id)));},addInvalidHandleType:function(_30){var _31=_30.toUpperCase();this.invalidHandleTypes[_31]=_31;},addInvalidHandleId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}this.invalidHandleIds[id]=id;},addInvalidHandleClass:function(_32){this.invalidHandleClasses.push(_32);},removeInvalidHandleType:function(_33){var _34=_33.toUpperCase();delete this.invalidHandleTypes[_34];},removeInvalidHandleId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}delete this.invalidHandleIds[id];},removeInvalidHandleClass:function(_35){for(var i=0,len=this.invalidHandleClasses.length;i=this.minX;i=i-_41){if(!_42[i]){this.xTicks[this.xTicks.length]=i;_42[i]=true;}}for(i=this.initPageX;i<=this.maxX;i=i+_41){if(!_42[i]){this.xTicks[this.xTicks.length]=i;_42[i]=true;}}this.xTicks.sort(this.DDM.numericSort);},setYTicks:function(_43,_44){this.yTicks=[];this.yTickSize=_44;var _45={};for(var i=this.initPageY;i>=this.minY;i=i-_44){if(!_45[i]){this.yTicks[this.yTicks.length]=i;_45[i]=true;}}for(i=this.initPageY;i<=this.maxY;i=i+_44){if(!_45[i]){this.yTicks[this.yTicks.length]=i;_45[i]=true;}}this.yTicks.sort(this.DDM.numericSort);},setXConstraint:function(_46,_47,_48){this.leftConstraint=_46;this.rightConstraint=_47;this.minX=this.initPageX-_46;this.maxX=this.initPageX+_47;if(_48){this.setXTicks(this.initPageX,_48);}this.constrainX=true;},clearConstraints:function(){this.constrainX=false;this.constrainY=false;this.clearTicks();},clearTicks:function(){this.xTicks=null;this.yTicks=null;this.xTickSize=0;this.yTickSize=0;},setYConstraint:function(iUp,_50,_51){this.topConstraint=iUp;this.bottomConstraint=_50;this.minY=this.initPageY-iUp;this.maxY=this.initPageY+_50;if(_51){this.setYTicks(this.initPageY,_51);}this.constrainY=true;},resetConstraints:function(){if(this.initPageX||this.initPageX===0){var dx=(this.maintainOffset)?this.lastPageX-this.initPageX:0;var dy=(this.maintainOffset)?this.lastPageY-this.initPageY:0;this.setInitPosition(dx,dy);}else{this.setInitPosition();}if(this.constrainX){this.setXConstraint(this.leftConstraint,this.rightConstraint,this.xTickSize);}if(this.constrainY){this.setYConstraint(this.topConstraint,this.bottomConstraint,this.yTickSize);}},getTick:function(val,_53){if(!_53){return val;}else{if(_53[0]>=val){return _53[0];}else{for(var i=0,len=_53.length;i=val){var _55=val-_53[i];var _56=_53[_54]-val;return (_56>_55)?_53[i]:_53[_54];}}return _53[_53.length-1];}}},toString:function(){return ("DragDrop "+this.id);}};})();if(!YAHOO.util.DragDropMgr){YAHOO.util.DragDropMgr=function(){var _57=YAHOO.util.Event;return {ids:{},handleIds:{},dragCurrent:null,dragOvers:{},deltaX:0,deltaY:0,preventDefault:true,stopPropagation:true,initalized:false,locked:false,init:function(){this.initialized=true;},POINT:0,INTERSECT:1,mode:0,_execOnAll:function(_58,_59){for(var i in this.ids){for(var j in this.ids[i]){var oDD=this.ids[i][j];if(!this.isTypeOfDD(oDD)){continue;}oDD[_58].apply(oDD,_59);}}},_onLoad:function(){this.init();_57.on(document,"mouseup",this.handleMouseUp,this,true);_57.on(document,"mousemove",this.handleMouseMove,this,true);_57.on(window,"unload",this._onUnload,this,true);_57.on(window,"resize",this._onResize,this,true);},_onResize:function(e){this._execOnAll("resetConstraints",[]);},lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isLocked:function(){return this.locked;},locationCache:{},useCache:true,clickPixelThresh:3,clickTimeThresh:1000,dragThreshMet:false,clickTimeout:null,startX:0,startY:0,regDragDrop:function(oDD,_61){if(!this.initialized){this.init();}if(!this.ids[_61]){this.ids[_61]={};}this.ids[_61][oDD.id]=oDD;},removeDDFromGroup:function(oDD,_62){if(!this.ids[_62]){this.ids[_62]={};}var obj=this.ids[_62];if(obj&&obj[oDD.id]){delete obj[oDD.id];}},_remove:function(oDD){for(var g in oDD.groups){if(g&&this.ids[g][oDD.id]){delete this.ids[g][oDD.id];}}delete this.handleIds[oDD.id];},regHandle:function(_65,_66){if(!this.handleIds[_65]){this.handleIds[_65]={};}this.handleIds[_65][_66]=_66;},isDragDrop:function(id){return (this.getDDById(id))?true:false;},getRelated:function(_67,_68){var _69=[];for(var i in _67.groups){for(j in this.ids[i]){var dd=this.ids[i][j];if(!this.isTypeOfDD(dd)){continue;}if(!_68||dd.isTarget){_69[_69.length]=dd;}}}return _69;},isLegalTarget:function(oDD,_71){var _72=this.getRelated(oDD,true);for(var i=0,len=_72.length;ithis.clickPixelThresh||_77>this.clickPixelThresh){this.startDrag(this.startX,this.startY);}}if(this.dragThreshMet){this.dragCurrent.b4Drag(e);this.dragCurrent.onDrag(e);this.fireEvents(e,false);}this.stopEvent(e);return true;},fireEvents:function(e,_78){var dc=this.dragCurrent;if(!dc||dc.isLocked()){return;}var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);var pt=new YAHOO.util.Point(x,y);var _80=[];var _81=[];var _82=[];var _83=[];var _84=[];for(var i in this.dragOvers){var ddo=this.dragOvers[i];if(!this.isTypeOfDD(ddo)){continue;}if(!this.isOverTarget(pt,ddo,this.mode)){_81.push(ddo);}_80[i]=true;delete this.dragOvers[i];}for(var _86 in dc.groups){if("string"!=typeof _86){continue;}for(i in this.ids[_86]){var oDD=this.ids[_86][i];if(!this.isTypeOfDD(oDD)){continue;}if(oDD.isTarget&&!oDD.isLocked()&&oDD!=dc){if(this.isOverTarget(pt,oDD,this.mode)){if(_78){_83.push(oDD);}else{if(!_80[oDD.id]){_84.push(oDD);}else{_82.push(oDD);}this.dragOvers[oDD.id]=oDD;}}}}}if(this.mode){if(_81.length){dc.b4DragOut(e,_81);dc.onDragOut(e,_81);}if(_84.length){dc.onDragEnter(e,_84);}if(_82.length){dc.b4DragOver(e,_82);dc.onDragOver(e,_82);}if(_83.length){dc.b4DragDrop(e,_83);dc.onDragDrop(e,_83);}}else{var len=0;for(i=0,len=_81.length;i2000){}else{setTimeout(DDM._addListeners,10);if(document&&document.body){DDM._timeoutCount+=1;}}}},handleWasClicked:function(node,id){if(this.isHandle(id,node.id)){return true;}else{var p=node.parentNode;while(p){if(this.isHandle(id,p.id)){return true;}else{p=p.parentNode;}}}return false;}};}();YAHOO.util.DDM=YAHOO.util.DragDropMgr;YAHOO.util.DDM._addListeners();}YAHOO.util.DD=function(id,_111,_112){if(id){this.init(id,_111,_112);}};YAHOO.extend(YAHOO.util.DD,YAHOO.util.DragDrop,{scroll:true,autoOffset:function(_113,_114){var x=_113-this.startPageX;var y=_114-this.startPageY;this.setDelta(x,y);},setDelta:function(_115,_116){this.deltaX=_115;this.deltaY=_116;},setDragElPos:function(_117,_118){var el=this.getDragEl();this.alignElWithMouse(el,_117,_118);},alignElWithMouse:function(el,_119,_120){var _121=this.getTargetCoord(_119,_120);if(!this.deltaSetXY){var _122=[_121.x,_121.y];YAHOO.util.Dom.setXY(el,_122);var _123=parseInt(YAHOO.util.Dom.getStyle(el,"left"),10);var _124=parseInt(YAHOO.util.Dom.getStyle(el,"top"),10);this.deltaSetXY=[_123-_121.x,_124-_121.y];}else{YAHOO.util.Dom.setStyle(el,"left",(_121.x+this.deltaSetXY[0])+"px");YAHOO.util.Dom.setStyle(el,"top",(_121.y+this.deltaSetXY[1])+"px");}this.cachePosition(_121.x,_121.y);this.autoScroll(_121.x,_121.y,el.offsetHeight,el.offsetWidth);},cachePosition:function(_125,_126){if(_125){this.lastPageX=_125;this.lastPageY=_126;}else{var _127=YAHOO.util.Dom.getXY(this.getEl());this.lastPageX=_127[0];this.lastPageY=_127[1];}},autoScroll:function(x,y,h,w){if(this.scroll){var _130=this.DDM.getClientHeight();var _131=this.DDM.getClientWidth();var st=this.DDM.getScrollTop();var sl=this.DDM.getScrollLeft();var bot=h+y;var _135=w+x;var _136=(_130+st-y-this.deltaY);var _137=(_131+sl-x-this.deltaX);var _138=40;var _139=(document.all)?80:30;if(bot>_130&&_136<_138){window.scrollTo(sl,st+_139);}if(y0&&y-st<_138){window.scrollTo(sl,st-_139);}if(_135>_131&&_137<_138){window.scrollTo(sl+_139,st);}if(x0&&x-sl<_138){window.scrollTo(sl-_139,st);}}},getTargetCoord:function(_140,_141){var x=_140-this.deltaX;var y=_141-this.deltaY;if(this.constrainX){if(xthis.maxX){x=this.maxX;}}if(this.constrainY){if(ythis.maxY){y=this.maxY;}}x=this.getTick(x,this.xTicks);y=this.getTick(y,this.yTicks);return {x:x,y:y};},applyConfig:function(){YAHOO.util.DD.superclass.applyConfig.call(this);this.scroll=(this.config.scroll!==false);},b4MouseDown:function(e){this.autoOffset(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e));},b4Drag:function(e){this.setDragElPos(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e));},toString:function(){return ("DD "+this.id);}});YAHOO.util.DDProxy=function(id,_142,_143){if(id){this.init(id,_142,_143);this.initFrame();}};YAHOO.util.DDProxy.dragElId="ygddfdiv";YAHOO.extend(YAHOO.util.DDProxy,YAHOO.util.DD,{resizeFrame:true,centerFrame:false,createFrame:function(){var self=this;var body=document.body;if(!body||!body.firstChild){setTimeout(function(){self.createFrame();},50);return;}var div=this.getDragEl();if(!div){div=document.createElement("div");div.id=this.dragElId;var s=div.style;s.position="absolute";s.visibility="hidden";s.cursor="move";s.border="2px solid #aaa";s.zIndex=999;body.insertBefore(div,body.firstChild);}},initFrame:function(){this.createFrame();},applyConfig:function(){YAHOO.util.DDProxy.superclass.applyConfig.call(this);this.resizeFrame=(this.config.resizeFrame!==false);this.centerFrame=(this.config.centerFrame);this.setDragElId(this.config.dragElId||YAHOO.util.DDProxy.dragElId);},showFrame:function(_147,_148){var el=this.getEl();var _149=this.getDragEl();var s=_149.style;this._resizeProxy();if(this.centerFrame){this.setDelta(Math.round(parseInt(s.width,10)/2),Math.round(parseInt(s.height,10)/2));}this.setDragElPos(_147,_148);YAHOO.util.Dom.setStyle(_149,"visibility","visible");},_resizeProxy:function(){if(this.resizeFrame){var DOM=YAHOO.util.Dom;var el=this.getEl();var _151=this.getDragEl();var bt=parseInt(DOM.getStyle(_151,"borderTopWidth"),10);var br=parseInt(DOM.getStyle(_151,"borderRightWidth"),10);var bb=parseInt(DOM.getStyle(_151,"borderBottomWidth"),10);var bl=parseInt(DOM.getStyle(_151,"borderLeftWidth"),10);if(isNaN(bt)){bt=0;}if(isNaN(br)){br=0;}if(isNaN(bb)){bb=0;}if(isNaN(bl)){bl=0;}var _156=Math.max(0,el.offsetWidth-br-bl);var _157=Math.max(0,el.offsetHeight-bt-bb);DOM.setStyle(_151,"width",_156+"px");DOM.setStyle(_151,"height",_157+"px");}},b4MouseDown:function(e){var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);this.autoOffset(x,y);this.setDragElPos(x,y);},b4StartDrag:function(x,y){this.showFrame(x,y);},b4EndDrag:function(e){YAHOO.util.Dom.setStyle(this.getDragEl(),"visibility","hidden");},endDrag:function(e){var DOM=YAHOO.util.Dom;var lel=this.getEl();var del=this.getDragEl();DOM.setStyle(del,"visibility","");DOM.setStyle(lel,"visibility","hidden");YAHOO.util.DDM.moveToEl(lel,del);DOM.setStyle(del,"visibility","hidden");DOM.setStyle(lel,"visibility","");},toString:function(){return ("DDProxy "+this.id);}});YAHOO.util.DDTarget=function(id,_160,_161){if(id){this.initTarget(id,_160,_161);}};YAHOO.extend(YAHOO.util.DDTarget,YAHOO.util.DragDrop,{toString:function(){return ("DDTarget "+this.id);}}); +/* Copyright (c) 2006, Yahoo! Inc. All rights reserved.Code licensed under the BSD License:http://developer.yahoo.net/yui/license.txtversion: 0.12.1 */ +if(typeof YAHOO=="undefined"){var YAHOO={};} +YAHOO.namespace=function(){var a=arguments,o=null,i,j,d;for(i=0;i-1),isSafari=(ua.indexOf('safari')>-1),isGecko=(!isOpera&&!isSafari&&ua.indexOf('gecko')>-1),isIE=(!isOpera&&ua.indexOf('msie')>-1);var patterns={HYPHEN:/(-[a-z])/i};var toCamel=function(property){if(!patterns.HYPHEN.test(property)){return property;} +if(propertyCache[property]){return propertyCache[property];} +while(patterns.HYPHEN.exec(property)){property=property.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());} +propertyCache[property]=property;return property;};if(document.defaultView&&document.defaultView.getComputedStyle){getStyle=function(el,property){var value=null;var computed=document.defaultView.getComputedStyle(el,'');if(computed){value=computed[toCamel(property)];} +return el.style[property]||value;};}else if(document.documentElement.currentStyle&&isIE){getStyle=function(el,property){switch(toCamel(property)){case'opacity':var val=100;try{val=el.filters['DXImageTransform.Microsoft.Alpha'].opacity;}catch(e){try{val=el.filters('alpha').opacity;}catch(e){}} +return val/100;break;default:var value=el.currentStyle?el.currentStyle[property]:null;return(el.style[property]||value);}};}else{getStyle=function(el,property){return el.style[property];};} +if(isIE){setStyle=function(el,property,val){switch(property){case'opacity':if(typeof el.style.filter=='string'){el.style.filter='alpha(opacity='+val*100+')';if(!el.currentStyle||!el.currentStyle.hasLayout){el.style.zoom=1;}} +break;default:el.style[property]=val;}};}else{setStyle=function(el,property,val){el.style[property]=val;};} +YAHOO.util.Dom={get:function(el){if(!el){return null;} +if(typeof el!='string'&&!(el instanceof Array)){return el;} +if(typeof el=='string'){return document.getElementById(el);} +else{var collection=[];for(var i=0,len=el.length;i=this.left&®ion.right<=this.right&®ion.top>=this.top&®ion.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(region){var t=Math.max(this.top,region.top);var r=Math.min(this.right,region.right);var b=Math.min(this.bottom,region.bottom);var l=Math.max(this.left,region.left);if(b>=t&&r>=l){return new YAHOO.util.Region(t,r,b,l);}else{return null;}};YAHOO.util.Region.prototype.union=function(region){var t=Math.min(this.top,region.top);var r=Math.max(this.right,region.right);var b=Math.max(this.bottom,region.bottom);var l=Math.min(this.left,region.left);return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}");};YAHOO.util.Region.getRegion=function(el){var p=YAHOO.util.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Point=function(x,y){if(x instanceof Array){y=x[1];x=x[0];} +this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y;};YAHOO.util.Point.prototype=new YAHOO.util.Region(); + +YAHOO.util.CustomEvent=function(type,oScope,silent,signature){this.type=type;this.scope=oScope||window;this.silent=silent;this.signature=signature||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){} +var onsubscribeType="_YUICEOnSubscribe";if(type!==onsubscribeType){this.subscribeEvent=new YAHOO.util.CustomEvent(onsubscribeType,this,true);}};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(fn,obj,override){if(this.subscribeEvent){this.subscribeEvent.fire(fn,obj,override);} +this.subscribers.push(new YAHOO.util.Subscriber(fn,obj,override));},unsubscribe:function(fn,obj){var found=false;for(var i=0,len=this.subscribers.length;i0){param=args[0];} +ret=s.fn.call(scope,param,s.obj);}else{ret=s.fn.call(scope,this.type,args,s.obj);} +if(false===ret){if(!this.silent){} +return false;}}} +return true;},unsubscribeAll:function(){for(var i=0,len=this.subscribers.length;i=0){cacheItem=listeners[index];} +if(!el||!cacheItem){return false;} +if(this.useLegacyEvent(el,sType)){var legacyIndex=this.getLegacyIndex(el,sType);var llist=legacyHandlers[legacyIndex];if(llist){for(i=0,len=llist.length;i0);} +var notAvail=[];for(var i=0,len=onAvailStack.length;i0){for(var i=0,len=listeners.length;i0){j=listeners.length;while(j){index=j-1;l=listeners[index];if(l){EU.removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],index);} +j=j-1;} +l=null;EU.clearCache();} +for(i=0,len=legacyEvents.length;i0)?val:0;} +YAHOO.util.Dom.setStyle(this.getEl(),attr,val+unit);},getAttribute:function(attr){var el=this.getEl();var val=YAHOO.util.Dom.getStyle(el,attr);if(val!=='auto'&&!this.patterns.offsetUnit.test(val)){return parseFloat(val);} +var a=this.patterns.offsetAttribute.exec(attr)||[];var pos=!!(a[3]);var box=!!(a[2]);if(box||(YAHOO.util.Dom.getStyle(el,'position')=='absolute'&&pos)){val=el['offset'+a[0].charAt(0).toUpperCase()+a[0].substr(1)];}else{val=0;} +return val;},getDefaultUnit:function(attr){if(this.patterns.defaultUnit.test(attr)){return'px';} +return'';},setRuntimeAttribute:function(attr){var start;var end;var attributes=this.attributes;this.runtimeAttributes[attr]={};var isset=function(prop){return(typeof prop!=='undefined');};if(!isset(attributes[attr]['to'])&&!isset(attributes[attr]['by'])){return false;} +start=(isset(attributes[attr]['from']))?attributes[attr]['from']:this.getAttribute(attr);if(isset(attributes[attr]['to'])){end=attributes[attr]['to'];}else if(isset(attributes[attr]['by'])){if(start.constructor==Array){end=[];for(var i=0,len=start.length;i0&&isFinite(tweak)){if(tween.currentFrame+tweak>=frames){tweak=frames-(frame+1);} +tween.currentFrame+=tweak;}};};YAHOO.util.Bezier=new function() +{this.getPosition=function(points,t) +{var n=points.length;var tmp=[];for(var i=0;i0&&!(control[0]instanceof Array)){control=[control];}else{var tmp=[];for(i=0,len=control.length;i0){this.runtimeAttributes[attr]=this.runtimeAttributes[attr].concat(control);} +this.runtimeAttributes[attr][this.runtimeAttributes[attr].length]=end;} +else{superclass.setRuntimeAttribute.call(this,attr);}};var translateValues=function(val,start){var pageXY=Y.Dom.getXY(this.getEl());val=[val[0]-pageXY[0]+start[0],val[1]-pageXY[1]+start[1]];return val;};var isset=function(prop){return(typeof prop!=='undefined');};})();(function(){YAHOO.util.Scroll=function(el,attributes,duration,method){if(el){YAHOO.util.Scroll.superclass.constructor.call(this,el,attributes,duration,method);}};YAHOO.extend(YAHOO.util.Scroll,YAHOO.util.ColorAnim);var Y=YAHOO.util;var superclass=Y.Scroll.superclass;var proto=Y.Scroll.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("Scroll "+id);};proto.doMethod=function(attr,start,end){var val=null;if(attr=='scroll'){val=[this.method(this.currentFrame,start[0],end[0]-start[0],this.totalFrames),this.method(this.currentFrame,start[1],end[1]-start[1],this.totalFrames)];}else{val=superclass.doMethod.call(this,attr,start,end);} +return val;};proto.getAttribute=function(attr){var val=null;var el=this.getEl();if(attr=='scroll'){val=[el.scrollLeft,el.scrollTop];}else{val=superclass.getAttribute.call(this,attr);} +return val;};proto.setAttribute=function(attr,val,unit){var el=this.getEl();if(attr=='scroll'){el.scrollLeft=val[0];el.scrollTop=val[1];}else{superclass.setAttribute.call(this,attr,val,unit);}};})(); + +(function(){var Event=YAHOO.util.Event;var Dom=YAHOO.util.Dom;YAHOO.util.DragDrop=function(id,sGroup,config){if(id){this.init(id,sGroup,config);}};YAHOO.util.DragDrop.prototype={id:null,config:null,dragElId:null,handleElId:null,invalidHandleTypes:null,invalidHandleIds:null,invalidHandleClasses:null,startPageX:0,startPageY:0,groups:null,locked:false,lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isTarget:true,padding:null,_domRef:null,__ygDragDrop:true,constrainX:false,constrainY:false,minX:0,maxX:0,minY:0,maxY:0,maintainOffset:false,xTicks:null,yTicks:null,primaryButtonOnly:true,available:false,hasOuterHandles:false,b4StartDrag:function(x,y){},startDrag:function(x,y){},b4Drag:function(e){},onDrag:function(e){},onDragEnter:function(e,id){},b4DragOver:function(e){},onDragOver:function(e,id){},b4DragOut:function(e){},onDragOut:function(e,id){},b4DragDrop:function(e){},onDragDrop:function(e,id){},onInvalidDrop:function(e){},b4EndDrag:function(e){},endDrag:function(e){},b4MouseDown:function(e){},onMouseDown:function(e){},onMouseUp:function(e){},onAvailable:function(){},getEl:function(){if(!this._domRef){this._domRef=Dom.get(this.id);} +return this._domRef;},getDragEl:function(){return Dom.get(this.dragElId);},init:function(id,sGroup,config){this.initTarget(id,sGroup,config);Event.on(this.id,"mousedown",this.handleMouseDown,this,true);},initTarget:function(id,sGroup,config){this.config=config||{};this.DDM=YAHOO.util.DDM;this.groups={};if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=Dom.generateId(id);} +this.id=id;this.addToGroup((sGroup)?sGroup:"default");this.handleElId=id;Event.onAvailable(id,this.handleOnAvailable,this,true);this.setDragElId(id);this.invalidHandleTypes={A:"A"};this.invalidHandleIds={};this.invalidHandleClasses=[];this.applyConfig();},applyConfig:function(){this.padding=this.config.padding||[0,0,0,0];this.isTarget=(this.config.isTarget!==false);this.maintainOffset=(this.config.maintainOffset);this.primaryButtonOnly=(this.config.primaryButtonOnly!==false);},handleOnAvailable:function(){this.available=true;this.resetConstraints();this.onAvailable();},setPadding:function(iTop,iRight,iBot,iLeft){if(!iRight&&0!==iRight){this.padding=[iTop,iTop,iTop,iTop];}else if(!iBot&&0!==iBot){this.padding=[iTop,iRight,iTop,iRight];}else{this.padding=[iTop,iRight,iBot,iLeft];}},setInitPosition:function(diffX,diffY){var el=this.getEl();if(!this.DDM.verifyEl(el)){return;} +var dx=diffX||0;var dy=diffY||0;var p=Dom.getXY(el);this.initPageX=p[0]-dx;this.initPageY=p[1]-dy;this.lastPageX=p[0];this.lastPageY=p[1];this.setStartPosition(p);},setStartPosition:function(pos){var p=pos||Dom.getXY(this.getEl());this.deltaSetXY=null;this.startPageX=p[0];this.startPageY=p[1];},addToGroup:function(sGroup){this.groups[sGroup]=true;this.DDM.regDragDrop(this,sGroup);},removeFromGroup:function(sGroup){if(this.groups[sGroup]){delete this.groups[sGroup];} +this.DDM.removeDDFromGroup(this,sGroup);},setDragElId:function(id){this.dragElId=id;},setHandleElId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=Dom.generateId(id);} +this.handleElId=id;this.DDM.regHandle(this.id,id);},setOuterHandleElId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=Dom.generateId(id);} +Event.on(id,"mousedown",this.handleMouseDown,this,true);this.setHandleElId(id);this.hasOuterHandles=true;},unreg:function(){Event.removeListener(this.id,"mousedown",this.handleMouseDown);this._domRef=null;this.DDM._remove(this);},isLocked:function(){return(this.DDM.isLocked()||this.locked);},handleMouseDown:function(e,oDD){var button=e.which||e.button;if(this.primaryButtonOnly&&button>1){return;} +if(this.isLocked()){return;} +this.DDM.refreshCache(this.groups);var pt=new YAHOO.util.Point(Event.getPageX(e),Event.getPageY(e));if(!this.hasOuterHandles&&!this.DDM.isOverTarget(pt,this)){}else{if(this.clickValidator(e)){this.setStartPosition();this.b4MouseDown(e);this.onMouseDown(e);this.DDM.handleMouseDown(e,this);this.DDM.stopEvent(e);}else{}}},clickValidator:function(e){var target=Event.getTarget(e);return(this.isValidHandleChild(target)&&(this.id==this.handleElId||this.DDM.handleWasClicked(target,this.id)));},addInvalidHandleType:function(tagName){var type=tagName.toUpperCase();this.invalidHandleTypes[type]=type;},addInvalidHandleId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=Dom.generateId(id);} +this.invalidHandleIds[id]=id;},addInvalidHandleClass:function(cssClass){this.invalidHandleClasses.push(cssClass);},removeInvalidHandleType:function(tagName){var type=tagName.toUpperCase();delete this.invalidHandleTypes[type];},removeInvalidHandleId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=Dom.generateId(id);} +delete this.invalidHandleIds[id];},removeInvalidHandleClass:function(cssClass){for(var i=0,len=this.invalidHandleClasses.length;i=this.minX;i=i-iTickSize){if(!tickMap[i]){this.xTicks[this.xTicks.length]=i;tickMap[i]=true;}} +for(i=this.initPageX;i<=this.maxX;i=i+iTickSize){if(!tickMap[i]){this.xTicks[this.xTicks.length]=i;tickMap[i]=true;}} +this.xTicks.sort(this.DDM.numericSort);},setYTicks:function(iStartY,iTickSize){this.yTicks=[];this.yTickSize=iTickSize;var tickMap={};for(var i=this.initPageY;i>=this.minY;i=i-iTickSize){if(!tickMap[i]){this.yTicks[this.yTicks.length]=i;tickMap[i]=true;}} +for(i=this.initPageY;i<=this.maxY;i=i+iTickSize){if(!tickMap[i]){this.yTicks[this.yTicks.length]=i;tickMap[i]=true;}} +this.yTicks.sort(this.DDM.numericSort);},setXConstraint:function(iLeft,iRight,iTickSize){this.leftConstraint=iLeft;this.rightConstraint=iRight;this.minX=this.initPageX-iLeft;this.maxX=this.initPageX+iRight;if(iTickSize){this.setXTicks(this.initPageX,iTickSize);} +this.constrainX=true;},clearConstraints:function(){this.constrainX=false;this.constrainY=false;this.clearTicks();},clearTicks:function(){this.xTicks=null;this.yTicks=null;this.xTickSize=0;this.yTickSize=0;},setYConstraint:function(iUp,iDown,iTickSize){this.topConstraint=iUp;this.bottomConstraint=iDown;this.minY=this.initPageY-iUp;this.maxY=this.initPageY+iDown;if(iTickSize){this.setYTicks(this.initPageY,iTickSize);} +this.constrainY=true;},resetConstraints:function(){if(this.initPageX||this.initPageX===0){var dx=(this.maintainOffset)?this.lastPageX-this.initPageX:0;var dy=(this.maintainOffset)?this.lastPageY-this.initPageY:0;this.setInitPosition(dx,dy);}else{this.setInitPosition();} +if(this.constrainX){this.setXConstraint(this.leftConstraint,this.rightConstraint,this.xTickSize);} +if(this.constrainY){this.setYConstraint(this.topConstraint,this.bottomConstraint,this.yTickSize);}},getTick:function(val,tickArray){if(!tickArray){return val;}else if(tickArray[0]>=val){return tickArray[0];}else{for(var i=0,len=tickArray.length;i=val){var diff1=val-tickArray[i];var diff2=tickArray[next]-val;return(diff2>diff1)?tickArray[i]:tickArray[next];}} +return tickArray[tickArray.length-1];}},toString:function(){return("DragDrop "+this.id);}};})();if(!YAHOO.util.DragDropMgr){YAHOO.util.DragDropMgr=function(){var Event=YAHOO.util.Event;return{ids:{},handleIds:{},dragCurrent:null,dragOvers:{},deltaX:0,deltaY:0,preventDefault:true,stopPropagation:true,initalized:false,locked:false,init:function(){this.initialized=true;},POINT:0,INTERSECT:1,STRICT_INTERSECT:2,mode:0,_execOnAll:function(sMethod,args){for(var i in this.ids){for(var j in this.ids[i]){var oDD=this.ids[i][j];if(!this.isTypeOfDD(oDD)){continue;} +oDD[sMethod].apply(oDD,args);}}},_onLoad:function(){this.init();Event.on(document,"mouseup",this.handleMouseUp,this,true);Event.on(document,"mousemove",this.handleMouseMove,this,true);Event.on(window,"unload",this._onUnload,this,true);Event.on(window,"resize",this._onResize,this,true);},_onResize:function(e){this._execOnAll("resetConstraints",[]);},lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isLocked:function(){return this.locked;},locationCache:{},useCache:true,clickPixelThresh:3,clickTimeThresh:1000,dragThreshMet:false,clickTimeout:null,startX:0,startY:0,regDragDrop:function(oDD,sGroup){if(!this.initialized){this.init();} +if(!this.ids[sGroup]){this.ids[sGroup]={};} +this.ids[sGroup][oDD.id]=oDD;},removeDDFromGroup:function(oDD,sGroup){if(!this.ids[sGroup]){this.ids[sGroup]={};} +var obj=this.ids[sGroup];if(obj&&obj[oDD.id]){delete obj[oDD.id];}},_remove:function(oDD){for(var g in oDD.groups){if(g&&this.ids[g][oDD.id]){delete this.ids[g][oDD.id];}} +delete this.handleIds[oDD.id];},regHandle:function(sDDId,sHandleId){if(!this.handleIds[sDDId]){this.handleIds[sDDId]={};} +this.handleIds[sDDId][sHandleId]=sHandleId;},isDragDrop:function(id){return(this.getDDById(id))?true:false;},getRelated:function(p_oDD,bTargetsOnly){var oDDs=[];for(var i in p_oDD.groups){for(j in this.ids[i]){var dd=this.ids[i][j];if(!this.isTypeOfDD(dd)){continue;} +if(!bTargetsOnly||dd.isTarget){oDDs[oDDs.length]=dd;}}} +return oDDs;},isLegalTarget:function(oDD,oTargetDD){var targets=this.getRelated(oDD,true);for(var i=0,len=targets.length;ithis.clickPixelThresh||diffY>this.clickPixelThresh){this.startDrag(this.startX,this.startY);}} +if(this.dragThreshMet){this.dragCurrent.b4Drag(e);this.dragCurrent.onDrag(e);this.fireEvents(e,false);} +this.stopEvent(e);return true;},fireEvents:function(e,isDrop){var dc=this.dragCurrent;if(!dc||dc.isLocked()){return;} +var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);var pt=new YAHOO.util.Point(x,y);var oldOvers=[];var outEvts=[];var overEvts=[];var dropEvts=[];var enterEvts=[];for(var i in this.dragOvers){var ddo=this.dragOvers[i];if(!this.isTypeOfDD(ddo)){continue;} +if(!this.isOverTarget(pt,ddo,this.mode)){outEvts.push(ddo);} +oldOvers[i]=true;delete this.dragOvers[i];} +for(var sGroup in dc.groups){if("string"!=typeof sGroup){continue;} +for(i in this.ids[sGroup]){var oDD=this.ids[sGroup][i];if(!this.isTypeOfDD(oDD)){continue;} +if(oDD.isTarget&&!oDD.isLocked()&&oDD!=dc){if(this.isOverTarget(pt,oDD,this.mode)){if(isDrop){dropEvts.push(oDD);}else{if(!oldOvers[oDD.id]){enterEvts.push(oDD);}else{overEvts.push(oDD);} +this.dragOvers[oDD.id]=oDD;}}}}} +if(this.mode){if(outEvts.length){dc.b4DragOut(e,outEvts);dc.onDragOut(e,outEvts);} +if(enterEvts.length){dc.onDragEnter(e,enterEvts);} +if(overEvts.length){dc.b4DragOver(e,overEvts);dc.onDragOver(e,overEvts);} +if(dropEvts.length){dc.b4DragDrop(e,dropEvts);dc.onDragDrop(e,dropEvts);}}else{var len=0;for(i=0,len=outEvts.length;i2000){}else{setTimeout(DDM._addListeners,10);if(document&&document.body){DDM._timeoutCount+=1;}}}},handleWasClicked:function(node,id){if(this.isHandle(id,node.id)){return true;}else{var p=node.parentNode;while(p){if(this.isHandle(id,p.id)){return true;}else{p=p.parentNode;}}} +return false;}};}();YAHOO.util.DDM=YAHOO.util.DragDropMgr;YAHOO.util.DDM._addListeners();} +YAHOO.util.DD=function(id,sGroup,config){if(id){this.init(id,sGroup,config);}};YAHOO.extend(YAHOO.util.DD,YAHOO.util.DragDrop,{scroll:true,autoOffset:function(iPageX,iPageY){var x=iPageX-this.startPageX;var y=iPageY-this.startPageY;this.setDelta(x,y);},setDelta:function(iDeltaX,iDeltaY){this.deltaX=iDeltaX;this.deltaY=iDeltaY;},setDragElPos:function(iPageX,iPageY){var el=this.getDragEl();this.alignElWithMouse(el,iPageX,iPageY);},alignElWithMouse:function(el,iPageX,iPageY){var oCoord=this.getTargetCoord(iPageX,iPageY);if(!this.deltaSetXY){var aCoord=[oCoord.x,oCoord.y];YAHOO.util.Dom.setXY(el,aCoord);var newLeft=parseInt(YAHOO.util.Dom.getStyle(el,"left"),10);var newTop=parseInt(YAHOO.util.Dom.getStyle(el,"top"),10);this.deltaSetXY=[newLeft-oCoord.x,newTop-oCoord.y];}else{YAHOO.util.Dom.setStyle(el,"left",(oCoord.x+this.deltaSetXY[0])+"px");YAHOO.util.Dom.setStyle(el,"top",(oCoord.y+this.deltaSetXY[1])+"px");} +this.cachePosition(oCoord.x,oCoord.y);this.autoScroll(oCoord.x,oCoord.y,el.offsetHeight,el.offsetWidth);},cachePosition:function(iPageX,iPageY){if(iPageX){this.lastPageX=iPageX;this.lastPageY=iPageY;}else{var aCoord=YAHOO.util.Dom.getXY(this.getEl());this.lastPageX=aCoord[0];this.lastPageY=aCoord[1];}},autoScroll:function(x,y,h,w){if(this.scroll){var clientH=this.DDM.getClientHeight();var clientW=this.DDM.getClientWidth();var st=this.DDM.getScrollTop();var sl=this.DDM.getScrollLeft();var bot=h+y;var right=w+x;var toBot=(clientH+st-y-this.deltaY);var toRight=(clientW+sl-x-this.deltaX);var thresh=40;var scrAmt=(document.all)?80:30;if(bot>clientH&&toBot0&&y-stclientW&&toRight0&&x-slthis.maxX){x=this.maxX;}} +if(this.constrainY){if(ythis.maxY){y=this.maxY;}} +x=this.getTick(x,this.xTicks);y=this.getTick(y,this.yTicks);return{x:x,y:y};},applyConfig:function(){YAHOO.util.DD.superclass.applyConfig.call(this);this.scroll=(this.config.scroll!==false);},b4MouseDown:function(e){this.autoOffset(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e));},b4Drag:function(e){this.setDragElPos(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e));},toString:function(){return("DD "+this.id);}});YAHOO.util.DDProxy=function(id,sGroup,config){if(id){this.init(id,sGroup,config);this.initFrame();}};YAHOO.util.DDProxy.dragElId="ygddfdiv";YAHOO.extend(YAHOO.util.DDProxy,YAHOO.util.DD,{resizeFrame:true,centerFrame:false,createFrame:function(){var self=this;var body=document.body;if(!body||!body.firstChild){setTimeout(function(){self.createFrame();},50);return;} +var div=this.getDragEl();if(!div){div=document.createElement("div");div.id=this.dragElId;var s=div.style;s.position="absolute";s.visibility="hidden";s.cursor="move";s.border="2px solid #aaa";s.zIndex=999;body.insertBefore(div,body.firstChild);}},initFrame:function(){this.createFrame();},applyConfig:function(){YAHOO.util.DDProxy.superclass.applyConfig.call(this);this.resizeFrame=(this.config.resizeFrame!==false);this.centerFrame=(this.config.centerFrame);this.setDragElId(this.config.dragElId||YAHOO.util.DDProxy.dragElId);},showFrame:function(iPageX,iPageY){var el=this.getEl();var dragEl=this.getDragEl();var s=dragEl.style;this._resizeProxy();if(this.centerFrame){this.setDelta(Math.round(parseInt(s.width,10)/2),Math.round(parseInt(s.height,10)/2));} +this.setDragElPos(iPageX,iPageY);YAHOO.util.Dom.setStyle(dragEl,"visibility","visible");},_resizeProxy:function(){if(this.resizeFrame){var DOM=YAHOO.util.Dom;var el=this.getEl();var dragEl=this.getDragEl();var bt=parseInt(DOM.getStyle(dragEl,"borderTopWidth"),10);var br=parseInt(DOM.getStyle(dragEl,"borderRightWidth"),10);var bb=parseInt(DOM.getStyle(dragEl,"borderBottomWidth"),10);var bl=parseInt(DOM.getStyle(dragEl,"borderLeftWidth"),10);if(isNaN(bt)){bt=0;} +if(isNaN(br)){br=0;} +if(isNaN(bb)){bb=0;} +if(isNaN(bl)){bl=0;} +var newWidth=Math.max(0,el.offsetWidth-br-bl);var newHeight=Math.max(0,el.offsetHeight-bt-bb);DOM.setStyle(dragEl,"width",newWidth+"px");DOM.setStyle(dragEl,"height",newHeight+"px");}},b4MouseDown:function(e){var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);this.autoOffset(x,y);this.setDragElPos(x,y);},b4StartDrag:function(x,y){this.showFrame(x,y);},b4EndDrag:function(e){YAHOO.util.Dom.setStyle(this.getDragEl(),"visibility","hidden");},endDrag:function(e){var DOM=YAHOO.util.Dom;var lel=this.getEl();var del=this.getDragEl();DOM.setStyle(del,"visibility","");DOM.setStyle(lel,"visibility","hidden");YAHOO.util.DDM.moveToEl(lel,del);DOM.setStyle(del,"visibility","hidden");DOM.setStyle(lel,"visibility","");},toString:function(){return("DDProxy "+this.id);}});YAHOO.util.DDTarget=function(id,sGroup,config){if(id){this.initTarget(id,sGroup,config);}};YAHOO.extend(YAHOO.util.DDTarget,YAHOO.util.DragDrop,{toString:function(){return("DDTarget "+this.id);}}); + YAHOO.util.Connect={_msxml_progid:['MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP'],_http_header:{},_has_http_headers:false,_use_default_post_header:true,_default_post_header:'application/x-www-form-urlencoded',_isFormSubmit:false,_isFileUpload:false,_formNode:null,_sFormData:null,_poll:{},_timeOut:{},_polling_interval:50,_transaction_id:0,setProgId:function(id) {this._msxml_progid.unshift(id);},setDefaultPostHeader:function(b) {this._use_default_post_header=b;},setPollingInterval:function(i) @@ -73,7 +329,7 @@ this._isFormSubmit=true;this._sFormData=this._sFormData.substr(0,this._sFormData else if(typeof secureURI=='string'){io.src=secureUri;}} else{var io=document.createElement('iframe');io.id=frameId;io.name=frameId;} io.style.position='absolute';io.style.top='-1000px';io.style.left='-1000px';document.body.appendChild(io);},appendPostData:function(postData) -{var formElements=new Array();var postMessage=postData.split('&');for(var i=0;i-1),isSafari=(ua.indexOf('safari')>-1),isGecko=(!isOpera&&!isSafari&&ua.indexOf('gecko')>-1),isIE=(!isOpera&&ua.indexOf('msie')>-1);var patterns={HYPHEN:/(-[a-z])/i};var toCamel=function(property){if(!patterns.HYPHEN.test(property)){return property;}if(propertyCache[property]){return propertyCache[property];}while(patterns.HYPHEN.exec(property)){property=property.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());}propertyCache[property]=property;return property;};if(document.defaultView&&document.defaultView.getComputedStyle){getStyle=function(el,property){var value=null;var computed=document.defaultView.getComputedStyle(el,'');if(computed){value=computed[toCamel(property)];}return el.style[property]||value;};}else if(document.documentElement.currentStyle&&isIE){getStyle=function(el,property){switch(toCamel(property)){case'opacity':var val=100;try{val=el.filters['DXImageTransform.Microsoft.Alpha'].opacity;}catch(e){try{val=el.filters('alpha').opacity;}catch(e){}}return val/100;break;default:var value=el.currentStyle?el.currentStyle[property]:null;return(el.style[property]||value);}};}else{getStyle=function(el,property){return el.style[property];};}if(isIE){setStyle=function(el,property,val){switch(property){case'opacity':if(typeof el.style.filter=='string'){el.style.filter='alpha(opacity='+val*100+')';if(!el.currentStyle||!el.currentStyle.hasLayout){el.style.zoom=1;}}break;default:el.style[property]=val;}};}else{setStyle=function(el,property,val){el.style[property]=val;};}YAHOO.util.Dom={get:function(el){if(!el){return null;}if(typeof el!='string'&&!(el instanceof Array)){return el;}if(typeof el=='string'){return document.getElementById(el);}else{var collection=[];for(var i=0,len=el.length;i=this.left&®ion.right<=this.right&®ion.top>=this.top&®ion.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(region){var t=Math.max(this.top,region.top);var r=Math.min(this.right,region.right);var b=Math.min(this.bottom,region.bottom);var l=Math.max(this.left,region.left);if(b>=t&&r>=l){return new YAHOO.util.Region(t,r,b,l);}else{return null;}};YAHOO.util.Region.prototype.union=function(region){var t=Math.min(this.top,region.top);var r=Math.max(this.right,region.right);var b=Math.max(this.bottom,region.bottom);var l=Math.min(this.left,region.left);return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}");};YAHOO.util.Region.getRegion=function(el){var p=YAHOO.util.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Point=function(x,y){if(x instanceof Array){y=x[1];x=x[0];}this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y;};YAHOO.util.Point.prototype=new YAHOO.util.Region();YAHOO.util.CustomEvent=function(_1,_2,_3,_4){this.type=_1;this.scope=_2||window;this.silent=_3;this.signature=_4||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}var _5="_YUICEOnSubscribe";if(_1!==_5){this.subscribeEvent=new YAHOO.util.CustomEvent(_5,this,true);}};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(fn,_7,_8){if(this.subscribeEvent){this.subscribeEvent.fire(fn,_7,_8);}this.subscribers.push(new YAHOO.util.Subscriber(fn,_7,_8));},unsubscribe:function(fn,_9){var _10=false;for(var i=0,len=this.subscribers.length;i0){_17=_14[0];}ret=s.fn.call(_16,_17,s.obj);}else{ret=s.fn.call(_16,this.type,_14,s.obj);}if(false===ret){if(!this.silent){}return false;}}}return true;},unsubscribeAll:function(){for(var i=0,len=this.subscribers.length;i=0){_60=_23[_61];}if(!el||!_60){return false;}if(this.useLegacyEvent(el,_59)){var _62=this.getLegacyIndex(el,_59);var _63=_26[_62];if(_63){for(i=0,len=_63.length;i0);}var _76=[];for(var i=0,len=_28.length;i0){for(var i=0,len=_23.length;i0){j=_23.length;while(j){index=j-1;l=_23[index];if(l){EU.removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],index);}j=j-1;}l=null;EU.clearCache();}for(i=0,len=_25.length;i-1),isSafari=(ua.indexOf('safari')>-1),isGecko=(!isOpera&&!isSafari&&ua.indexOf('gecko')>-1),isIE=(!isOpera&&ua.indexOf('msie')>-1);var patterns={HYPHEN:/(-[a-z])/i};var toCamel=function(property){if(!patterns.HYPHEN.test(property)){return property;} +if(propertyCache[property]){return propertyCache[property];} +while(patterns.HYPHEN.exec(property)){property=property.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());} +propertyCache[property]=property;return property;};if(document.defaultView&&document.defaultView.getComputedStyle){getStyle=function(el,property){var value=null;var computed=document.defaultView.getComputedStyle(el,'');if(computed){value=computed[toCamel(property)];} +return el.style[property]||value;};}else if(document.documentElement.currentStyle&&isIE){getStyle=function(el,property){switch(toCamel(property)){case'opacity':var val=100;try{val=el.filters['DXImageTransform.Microsoft.Alpha'].opacity;}catch(e){try{val=el.filters('alpha').opacity;}catch(e){}} +return val/100;break;default:var value=el.currentStyle?el.currentStyle[property]:null;return(el.style[property]||value);}};}else{getStyle=function(el,property){return el.style[property];};} +if(isIE){setStyle=function(el,property,val){switch(property){case'opacity':if(typeof el.style.filter=='string'){el.style.filter='alpha(opacity='+val*100+')';if(!el.currentStyle||!el.currentStyle.hasLayout){el.style.zoom=1;}} +break;default:el.style[property]=val;}};}else{setStyle=function(el,property,val){el.style[property]=val;};} +YAHOO.util.Dom={get:function(el){if(!el){return null;} +if(typeof el!='string'&&!(el instanceof Array)){return el;} +if(typeof el=='string'){return document.getElementById(el);} +else{var collection=[];for(var i=0,len=el.length;i=this.left&®ion.right<=this.right&®ion.top>=this.top&®ion.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(region){var t=Math.max(this.top,region.top);var r=Math.min(this.right,region.right);var b=Math.min(this.bottom,region.bottom);var l=Math.max(this.left,region.left);if(b>=t&&r>=l){return new YAHOO.util.Region(t,r,b,l);}else{return null;}};YAHOO.util.Region.prototype.union=function(region){var t=Math.min(this.top,region.top);var r=Math.max(this.right,region.right);var b=Math.max(this.bottom,region.bottom);var l=Math.min(this.left,region.left);return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}");};YAHOO.util.Region.getRegion=function(el){var p=YAHOO.util.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Point=function(x,y){if(x instanceof Array){y=x[1];x=x[0];} +this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y;};YAHOO.util.Point.prototype=new YAHOO.util.Region(); +YAHOO.util.CustomEvent=function(type,oScope,silent,signature){this.type=type;this.scope=oScope||window;this.silent=silent;this.signature=signature||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){} +var onsubscribeType="_YUICEOnSubscribe";if(type!==onsubscribeType){this.subscribeEvent=new YAHOO.util.CustomEvent(onsubscribeType,this,true);}};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(fn,obj,override){if(this.subscribeEvent){this.subscribeEvent.fire(fn,obj,override);} +this.subscribers.push(new YAHOO.util.Subscriber(fn,obj,override));},unsubscribe:function(fn,obj){var found=false;for(var i=0,len=this.subscribers.length;i0){param=args[0];} +ret=s.fn.call(scope,param,s.obj);}else{ret=s.fn.call(scope,this.type,args,s.obj);} +if(false===ret){if(!this.silent){} +return false;}}} +return true;},unsubscribeAll:function(){for(var i=0,len=this.subscribers.length;i=0){cacheItem=listeners[index];} +if(!el||!cacheItem){return false;} +if(this.useLegacyEvent(el,sType)){var legacyIndex=this.getLegacyIndex(el,sType);var llist=legacyHandlers[legacyIndex];if(llist){for(i=0,len=llist.length;i0);} +var notAvail=[];for(var i=0,len=onAvailStack.length;i0){for(var i=0,len=listeners.length;i0){j=listeners.length;while(j){index=j-1;l=listeners[index];if(l){EU.removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],index);} +j=j-1;} +l=null;EU.clearCache();} +for(i=0,len=legacyEvents.length;i