/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
version: 2.3.0
*/
(function () {
/**
* 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.
* @namespace YAHOO.util
* @class Config
* @constructor
* @param {Object} owner The owner Object to which this Config Object belongs
*/
if (owner) {
}
if (!owner) {
}
};
/**
* Constant representing the CustomEvent type for the config changed event.
* @property YAHOO.util.Config.CONFIG_CHANGED_EVENT
* @private
* @static
* @final
*/
/**
* Constant representing the boolean type string
* @property YAHOO.util.Config.BOOLEAN_TYPE
* @private
* @static
* @final
*/
/**
* Object reference to the owner of this Config Object
* @property owner
* @type Object
*/
owner: null,
/**
* Boolean flag that specifies whether a queue is currently
* being executed
* @property queueInProgress
* @type Boolean
*/
queueInProgress: false,
/**
* Maintains the local collection of configuration property objects and
* their specified values
* @property config
* @private
* @type Object
*/
config: null,
/**
* Maintains the local collection of configuration property objects as
* they were initially applied.
* This object is used when resetting a property.
* @property initialConfig
* @private
* @type Object
*/
initialConfig: null,
/**
* Maintains the local, normalized CustomEvent queue
* @property eventQueue
* @private
* @type Object
*/
eventQueue: null,
/**
* Custom Event, notifying subscribers when Config properties are set
* (setProperty is called without the silent flag
* @event configChangedEvent
*/
configChangedEvent: null,
/**
* Initializes the configuration Object and all of its local members.
* @method init
* @param {Object} owner The owner Object to which this Config
* Object belongs
*/
this.configChangedEvent =
this.queueInProgress = false;
this.config = {};
this.initialConfig = {};
this.eventQueue = [];
},
/**
* Validates that the value passed in is a Boolean.
* @method checkBoolean
* @param {Object} val The value to validate
* @return {Boolean} true, if the value is valid
*/
checkBoolean: function (val) {
},
/**
* Validates that the value passed in is a number.
* @method checkNumber
* @param {Object} val The value to validate
* @return {Boolean} true, if the value is valid
*/
checkNumber: function (val) {
},
/**
* Fires a configuration property event using the specified value.
* @method fireEvent
* @private
* @param {String} key The configuration property's name
* @param {value} Object The value of the correct type for the property
*/
}
},
/**
* Adds a property to the Config Object's private config hash.
* @method addProperty
* @param {String} key The configuration property's name
* @param {Object} propertyObject The Object containing all of this
* property's arguments
*/
if (propertyObject.handler) {
this.owner);
}
if (! propertyObject.suppressEvent) {
}
},
/**
* Returns a key-value configuration map of the values currently set in
* the Config Object.
* @method getConfig
* @return {Object} The current config, represented in a key-value map
*/
getConfig: function () {
var cfg = {},
prop,
}
}
return cfg;
},
/**
* Returns the value of specified property.
* @method getProperty
* @param {String} key The name of the property
* @return {Object} The value of the specified property
*/
getProperty: function (key) {
} else {
return undefined;
}
},
/**
* Resets the specified property's value to its initial value.
* @method resetProperty
* @param {String} key The name of the property
* @return {Boolean} True is the property was reset, false if not
*/
resetProperty: function (key) {
if (this.initialConfig[key] &&
return true;
}
} else {
return false;
}
},
/**
* Sets the value of a property. If the silent property is passed as
* true, the property's event will not be fired.
* @method setProperty
* @param {String} key The name of the property
* @param {String} value The value to set the property to
* @param {Boolean} silent Whether the value should be set silently,
* without firing the property event.
* @return {Boolean} True, if the set was successful, false if it failed.
*/
var property;
if (this.queueInProgress && ! silent) {
// Currently running through a queue...
return true;
} else {
return false;
} else {
if (! silent) {
}
return true;
}
} else {
return false;
}
}
},
/**
* Sets the value of a property and queues its event to execute. If the
* event is already scheduled to execute, it is
* moved from its current position to the end of the queue.
* @method queueProperty
* @param {String} key The name of the property
* @param {String} value The value to set the property to
* @return {Boolean} true, if the set was successful, false if
* it failed.
*/
foundDuplicate = false,
iLen,
sLen,
qLen,
i,
s,
q;
return false;
} else {
} else {
}
foundDuplicate = false;
for (i = 0; i < iLen; i++) {
queueItem = this.eventQueue[i];
if (queueItem) {
if (queueItemKey == key) {
/*
found a dupe... push to end of queue, null
current item, and break
*/
this.eventQueue[i] = null;
this.eventQueue.push(
value : queueItemValue)]);
foundDuplicate = true;
break;
}
}
}
// this is a refire, or a new property in the queue
}
}
if (property.supercedes) {
for (s = 0; s < sLen; s++) {
for (q = 0; q < qLen; q++) {
queueItemCheck = this.eventQueue[q];
if (queueItemCheck) {
if (queueItemCheckKey ==
supercedesCheck.toLowerCase() ) {
this.eventQueue[q] = null;
break;
}
}
}
}
}
return true;
} else {
return false;
}
},
/**
* Fires the event for a property using the property's current value.
* @method refireEvent
* @param {String} key The name of the property
*/
refireEvent: function (key) {
if (this.queueInProgress) {
this.queueProperty(key);
} else {
}
}
},
/**
* Applies a key-value Object literal to the configuration, replacing
* any existing values, and queueing the property events.
* Although the values will be set, fireQueue() must be called for their
* associated events to execute.
* @method applyConfig
* @param {Object} userConfig The configuration Object literal
* @param {Boolean} init When set to true, the initialConfig will
* be set to the userConfig passed in, so that calling a reset will
* reset the properties to the passed values.
*/
var sKey,
if (init) {
oConfig = {};
for (sKey in userConfig) {
}
}
this.initialConfig = oConfig;
}
for (sKey in userConfig) {
}
}
},
/**
* Refires the events for all configuration properties using their
* current values.
* @method refresh
*/
refresh: function () {
var prop;
this.refireEvent(prop);
}
},
/**
* Fires the normalized list of queued property change events
* @method fireQueue
*/
fireQueue: function () {
var i,
key,
this.queueInProgress = true;
queueItem = this.eventQueue[i];
if (queueItem) {
}
}
this.queueInProgress = false;
this.eventQueue = [];
},
/**
* Subscribes an external handler to the change event for any
* given property.
* @method subscribeToConfigEvent
* @param {String} key The property name
* @param {Function} handler The handler function to use subscribe to
* the property's event
* @param {Object} obj The Object to use for scoping the event handler
* (see CustomEvent documentation)
* @param {Boolean} override Optional. If true, will override "this"
* within the handler to map to the scope Object passed into the method.
* @return {Boolean} True, if the subscription was successful,
* otherwise false.
*/
}
return true;
} else {
return false;
}
},
/**
* Unsubscribes an external handler from the change event for any
* given property.
* @method unsubscribeFromConfigEvent
* @param {String} key The property name
* @param {Function} handler The handler function to use subscribe to
* the property's event
* @param {Object} obj The Object to use for scoping the event
* handler (see CustomEvent documentation)
* @return {Boolean} True, if the unsubscription was successful,
* otherwise false.
*/
} else {
return false;
}
},
/**
* Returns a string representation of the Config object
* @method toString
* @return {String} The Config object in string format.
*/
toString: function () {
var output = "Config";
if (this.owner) {
}
return output;
},
/**
* Returns a string representation of the Config object's current
* CustomEvent queue
* @method outputEventQueue
* @return {String} The string list of CustomEvents currently queued
* for execution
*/
outputEventQueue: function () {
var output = "",
q,
for (q = 0; q < nQueue; q++) {
queueItem = this.eventQueue[q];
if (queueItem) {
}
}
return output;
},
/**
* Sets all properties to null, unsubscribes all listeners from each
* property's change event and all listeners from the configChangedEvent.
* @method destroy
*/
destroy: function () {
}
}
this.configChangedEvent.unsubscribeAll();
this.configChangedEvent = null;
this.owner = null;
this.config = null;
this.initialConfig = null;
this.eventQueue = null;
}
};
/**
* subscribed to the specified CustomEvent
* @method YAHOO.util.Config.alreadySubscribed
* @static
* @param {YAHOO.util.CustomEvent} evt The CustomEvent for which to check
* the subscriptions
* @param {Function} fn The function to look for in the subscribers list
* @param {Object} obj The execution scope Object for the subscription
* to the CustomEvent passed in
*/
i;
if (nSubscribers > 0) {
i = nSubscribers - 1;
do {
return true;
}
}
while (i--);
}
return false;
};
}());
(function () {
/**
* 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
* @title Container
* @requires yahoo, dom, event
* @optional dragdrop, animation, button
*/
/**
* 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.
* @namespace YAHOO.widget
* @class Module
* @constructor
* @param {String} el The element ID representing the Module <em>OR</em>
* @param {HTMLElement} el The element representing the Module
* @param {Object} userConfig The configuration Object literal containing
* the configuration that should be set for this module. See configuration
* documentation for more details.
*/
if (el) {
} else {
" for Module instantiation", "error");
}
};
/**
* Constant representing the name of the Module's events
* @property EVENT_TYPES
* @private
* @final
* @type Object
*/
EVENT_TYPES = {
"BEFORE_INIT": "beforeInit",
"INIT": "init",
"APPEND": "append",
"BEFORE_RENDER": "beforeRender",
"RENDER": "render",
"CHANGE_HEADER": "changeHeader",
"CHANGE_BODY": "changeBody",
"CHANGE_FOOTER": "changeFooter",
"CHANGE_CONTENT": "changeContent",
"DESTORY": "destroy",
"BEFORE_SHOW": "beforeShow",
"SHOW": "show",
"BEFORE_HIDE": "beforeHide",
"HIDE": "hide"
},
/**
* Constant representing the Module's configuration properties
* @property DEFAULT_CONFIG
* @private
* @final
* @type Object
*/
DEFAULT_CONFIG = {
"VISIBLE": {
key: "visible",
value: true,
},
"EFFECT": {
key: "effect",
suppressEvent: true,
supercedes: ["visible"]
},
"MONITOR_RESIZE": {
key: "monitorresize",
value: true
}
};
/**
* Constant representing the prefix path to use for non-secure images
* @property YAHOO.widget.Module.IMG_ROOT
* @static
* @final
* @type String
*/
/**
* Constant representing the prefix path to use for securely served images
* @property YAHOO.widget.Module.IMG_ROOT_SSL
* @static
* @final
* @type String
*/
Module.IMG_ROOT_SSL = null;
/**
* Constant for the default CSS class name that represents a Module
* @property YAHOO.widget.Module.CSS_MODULE
* @static
* @final
* @type String
*/
/**
* Constant representing the module header
* @property YAHOO.widget.Module.CSS_HEADER
* @static
* @final
* @type String
*/
/**
* Constant representing the module body
* @property YAHOO.widget.Module.CSS_BODY
* @static
* @final
* @type String
*/
/**
* Constant representing the module footer
* @property YAHOO.widget.Module.CSS_FOOTER
* @static
* @final
* @type String
*/
/**
* Constant representing the url for the "src" attribute of the iframe
* used to monitor changes to the browser's base font size
* @property YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL
* @static
* @final
* @type String
*/
/**
* 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
*/
function createModuleTemplate() {
if (!m_oModuleTemplate) {
}
return m_oModuleTemplate;
}
function createHeader() {
if (!m_oHeaderTemplate) {
}
return (m_oHeaderTemplate.cloneNode(false));
}
function createBody() {
if (!m_oBodyTemplate) {
}
return (m_oBodyTemplate.cloneNode(false));
}
function createFooter() {
if (!m_oFooterTemplate) {
}
return (m_oFooterTemplate.cloneNode(false));
}
/**
* The class's constructor function
* @property contructor
* @type Function
*/
/**
* The main module element that contains the header, body, and footer
* @property element
* @type HTMLElement
*/
element: null,
/**
* The header element, denoted with CSS class "hd"
* @property header
* @type HTMLElement
*/
header: null,
/**
* The body element, denoted with CSS class "bd"
* @property body
* @type HTMLElement
*/
body: null,
/**
* The footer element, denoted with CSS class "ft"
* @property footer
* @type HTMLElement
*/
footer: null,
/**
* The id of the element
* @property id
* @type String
*/
id: null,
/**
* A string representing the root path for all images created by
* a Module instance.
* @deprecated It is recommend that any images for a Module be applied
* via CSS using the "background-image" property.
* @property imageRoot
* @type String
*/
/**
* Initializes the custom events for Module which are fired
* automatically at appropriate times by the Module class.
* @method initEvents
*/
initEvents: function () {
/**
* CustomEvent fired prior to class initalization.
* @event beforeInitEvent
* @param {class} classRef class reference of the initializing
* class, such as this.beforeInitEvent.fire(Module)
*/
/**
* CustomEvent fired after class initalization.
* @event initEvent
* @param {class} classRef class reference of the initializing
* class, such as this.beforeInitEvent.fire(Module)
*/
/**
* CustomEvent fired when the Module is appended to the DOM
* @event appendEvent
*/
/**
* CustomEvent fired before the Module is rendered
* @event beforeRenderEvent
*/
this.beforeRenderEvent =
/**
* CustomEvent fired after the Module is rendered
* @event renderEvent
*/
/**
* CustomEvent fired when the header content of the Module
* is modified
* @event changeHeaderEvent
* @param {String/HTMLElement} content String/element representing
* the new header content
*/
this.changeHeaderEvent =
/**
* CustomEvent fired when the body content of the Module is modified
* @event changeBodyEvent
* @param {String/HTMLElement} content String/element representing
* the new body content
*/
/**
* CustomEvent fired when the footer content of the Module
* is modified
* @event changeFooterEvent
* @param {String/HTMLElement} content String/element representing
* the new footer content
*/
this.changeFooterEvent =
/**
* CustomEvent fired when the content of the Module is modified
* @event changeContentEvent
*/
this.changeContentEvent =
/**
* CustomEvent fired when the Module is destroyed
* @event destroyEvent
*/
/**
* CustomEvent fired before the Module is shown
* @event beforeShowEvent
*/
/**
* CustomEvent fired after the Module is shown
* @event showEvent
*/
/**
* CustomEvent fired before the Module is hidden
* @event beforeHideEvent
*/
/**
* CustomEvent fired after the Module is hidden
* @event hideEvent
*/
},
/**
* String representing the current user-agent platform
* @property platform
* @type String
*/
platform: function () {
return "windows";
return "mac";
} else {
return false;
}
}(),
/**
* String representing the user-agent of the browser
* @deprecated Use YAHOO.env.ua
* @property browser
* @type String
*/
browser: function () {
/*
Check Opera first in case of spoof and check Safari before
Gecko since Safari's user agent string includes "like Gecko"
*/
return 'opera';
return 'ie7';
return 'ie';
return 'safari';
return 'gecko';
} else {
return false;
}
}(),
/**
* Boolean representing whether or not the current browsing context is
* secure (https)
* @property isSecure
* @type Boolean
*/
isSecure: function () {
return true;
} else {
return false;
}
}(),
/**
* Initializes the custom events for Module which are fired
* automatically at appropriate times by the Module class.
*/
initDefaultConfig: function () {
// Add properties //
/**
* Specifies whether the Module is visible on the page.
* @config visible
* @type Boolean
* @default true
*/
handler: this.configVisible,
});
/**
* Object or array of objects representing the ContainerEffect
* classes that are active for animating the container.
* @config effect
* @type Object
* @default null
*/
});
/**
* Specifies whether to create a special proxy iframe to monitor
* for user font resizing in the document
* @config monitorresize
* @type Boolean
* @default true
*/
handler: this.configMonitorResize,
});
},
/**
* The Module class's initialization method, which is executed for
* Module and all of its subclasses. 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.
* @method init
* @param {String} el The element ID representing the Module <em>OR</em>
* @param {HTMLElement} el The element representing the Module
* @param {Object} userConfig The configuration Object literal
* containing the configuration that should be set for this module.
* See configuration documentation for more details.
*/
this.initEvents();
/**
* The Module's Config object used for monitoring
* configuration properties.
* @property cfg
* @type YAHOO.util.Config
*/
if (this.isSecure) {
}
if (typeof el == "string") {
if (! el) {
}
}
}
if (child) {
do {
case Module.CSS_HEADER:
break;
break;
case Module.CSS_FOOTER:
break;
}
}
this.initDefaultConfig();
if (userConfig) {
}
/*
Subscribe to the fireQueue() method of Config so that any
queued configuration changes are excecuted upon render of
the Module
*/
}
},
/**
* Initialized an empty IFRAME that is placed out of the visible area
* that can be used to detect text resize.
* @method initResizeMonitor
*/
initResizeMonitor: function () {
var oDoc,
function fireTextResize() {
}
if (!oIFrame) {
}
/*
Need to set "src" attribute of the iframe to
prevent the browser from reporting duplicate
cookies. (See SourceForge bug #1721755)
*/
sHTML = "<html><head><script " +
"type=\"text/javascript\">" +
"window.onresize=function(){window.parent." +
"YAHOO.widget.Module.textResizeEvent." +
"fire();};window.parent.YAHOO.widget.Module." +
"textResizeEvent.fire();</script></head>" +
"<body></body></html>";
}
/*
Need to set "position" property before inserting the
iframe into the document or Safari's status bar will
forever indicate the iframe is loading
(See SourceForge bug #1723064)
*/
}
}
this, true);
if (!Module.textResizeInitialized) {
fireTextResize)) {
/*
This will fail in IE if document.domain has
changed, so we must change the listener to
use the oIFrame element instead
*/
}
Module.textResizeInitialized = true;
}
this.resizeMonitor = oIFrame;
}
}
},
/**
* Event handler fired when the resize monitor element is resized.
* @method onDomResize
* @param {DOMEvent} e The DOM resize event
* @param {Object} obj The scope object passed to the handler
*/
onDomResize: function (e, obj) {
},
/**
* Sets the Module's header content to the HTML specified, or appends
* the passed element to the header. If no header is present, one will
* be automatically created.
* @method setHeader
* @param {String} headerContent The HTML used to set the header
* <em>OR</em>
* @param {HTMLElement} headerContent The HTMLElement to append to
* the header
*/
setHeader: function (headerContent) {
if (typeof headerContent == "string") {
} else {
}
this.changeContentEvent.fire();
},
/**
* Appends the passed element to the header. If no header is present,
* one will be automatically created.
* @method appendToHeader
* @param {HTMLElement} element The element to append to the header
*/
appendToHeader: function (element) {
this.changeContentEvent.fire();
},
/**
* Sets the Module's body content to the HTML specified, or appends the
* passed element to the body. If no body is present, one will be
* automatically created.
* @method setBody
* @param {String} bodyContent The HTML used to set the body <em>OR</em>
* @param {HTMLElement} bodyContent The HTMLElement to append to the body
*/
setBody: function (bodyContent) {
if (typeof bodyContent == "string") {
} else {
}
this.changeContentEvent.fire();
},
/**
* Appends the passed element to the body. If no body is present, one
* will be automatically created.
* @method appendToBody
* @param {HTMLElement} element The element to append to the body
*/
appendToBody: function (element) {
this.changeContentEvent.fire();
},
/**
* Sets the Module's footer content to the HTML specified, or appends
* the passed element to the footer. If no footer is present, one will
* be automatically created.
* @method setFooter
* @param {String} footerContent The HTML used to set the footer
* <em>OR</em>
* @param {HTMLElement} footerContent The HTMLElement to append to
* the footer
*/
setFooter: function (footerContent) {
if (typeof footerContent == "string") {
} else {
}
this.changeContentEvent.fire();
},
/**
* Appends the passed element to the footer. If no footer is present,
* one will be automatically created.
* @method appendToFooter
* @param {HTMLElement} element The element to append to the footer
*/
appendToFooter: function (element) {
this.changeContentEvent.fire();
},
/**
* Renders the Module by inserting the elements that are not already
* in the main Module into their correct places. Optionally appends
* the Module to the specified node prior to the render's execution.
* NOTE: For Modules without existing markup, the appendToNode argument
* is REQUIRED. If this argument is ommitted and the current element is
* not present in the document, the function will return false,
* indicating that the render was a failure.
* @method render
* @param {String} appendToNode The element id to which the Module
* should be appended to prior to rendering <em>OR</em>
* @param {HTMLElement} appendToNode The element to which the Module
* should be appended to prior to rendering
* @param {HTMLElement} moduleElement OPTIONAL. The element that
* represents the actual Standard Module container.
* @return {Boolean} Success or failure of the render
*/
var me = this,
if (typeof element == "string") {
}
if (element) {
}
}
this.beforeRenderEvent.fire();
if (! moduleElement) {
moduleElement = this.element;
}
if (appendToNode) {
} else {
/*
No node was passed in. If the element is not already in
the Dom, this fails
*/
" Module isn't already in the DOM.", "error");
return false;
}
}
// Need to get everything into the DOM if it isn't already
/*
There is a header, but it's not in the DOM yet...
need to add it
*/
if (firstChild) { // Insert before first child if exists
} else { // Append to empty body because there are no children
}
}
/*
There is a body, but it's not in the DOM yet...
need to add it
*/
// Insert before footer if exists in DOM
this.moduleElement, this.footer)) {
} else { // Append to element because there is no footer
}
}
/*
There is a footer, but it's not in the DOM yet...
need to add it
*/
}
this.renderEvent.fire();
return true;
},
/**
* Removes the Module element from the DOM and sets all child elements
* to null.
* @method destroy
*/
destroy: function () {
var parent,
e;
if (this.element) {
}
if (parent) {
}
this.element = null;
this.header = null;
this.body = null;
this.footer = null;
this.cfg = null;
this.destroyEvent.fire();
for (e in this) {
if (e instanceof CustomEvent) {
e.unsubscribeAll();
}
}
},
/**
* Shows the Module element by setting the visible configuration
* property to true. Also fires two events: beforeShowEvent prior to
* the visibility change, and showEvent after.
* @method show
*/
show: function () {
},
/**
* Hides the Module element by setting the visible configuration
* property to false. Also fires two events: beforeHideEvent prior to
* the visibility change, and hideEvent after.
* @method hide
*/
hide: function () {
},
// BUILT-IN EVENT HANDLERS FOR MODULE //
/**
* Default event handler for changing the visibility property of a
* Module. By default, this is achieved by switching the "display" style
* between "block" and "none".
* This method is responsible for firing showEvent and hideEvent.
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
* @method configVisible
*/
if (visible) {
this.beforeShowEvent.fire();
} else {
this.beforeHideEvent.fire();
}
},
/**
* Default event handler for the "monitorresize" configuration property
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
* @method configMonitorResize
*/
if (monitor) {
this.initResizeMonitor();
} else {
this.onDomResize, this, true);
this.resizeMonitor = null;
}
},
/**
* Returns a String representation of the Object.
* @method toString
* @return {String} The string representation of the Module
*/
toString: function () {
return "Module " + this.id;
}
};
}());
(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.
* @namespace YAHOO.widget
* @class Overlay
* @extends Module
* @param {String} el The element ID representing the Overlay <em>OR</em>
* @param {HTMLElement} el The element representing the Overlay
* @param {Object} userConfig The configuration object literal containing
* the configuration that should be set for this Overlay. See configuration
* documentation for more details.
* @constructor
*/
};
/**
* Constant representing the name of the Overlay's events
* @property EVENT_TYPES
* @private
* @final
* @type Object
*/
EVENT_TYPES = {
"BEFORE_MOVE": "beforeMove",
"MOVE": "move"
},
/**
* Constant representing the Overlay's configuration properties
* @property DEFAULT_CONFIG
* @private
* @final
* @type Object
*/
DEFAULT_CONFIG = {
"X": {
key: "x",
suppressEvent: true,
supercedes: ["iframe"]
},
"Y": {
key: "y",
suppressEvent: true,
supercedes: ["iframe"]
},
"XY": {
key: "xy",
suppressEvent: true,
supercedes: ["iframe"]
},
"CONTEXT": {
key: "context",
suppressEvent: true,
supercedes: ["iframe"]
},
"FIXED_CENTER": {
key: "fixedcenter",
value: false,
},
"WIDTH": {
key: "width",
suppressEvent: true,
},
"HEIGHT": {
key: "height",
suppressEvent: true,
},
"ZINDEX": {
key: "zindex",
value: null
},
"CONSTRAIN_TO_VIEWPORT": {
key: "constraintoviewport",
value: false,
},
"IFRAME": {
key: "iframe",
supercedes: ["zindex"]
}
};
/**
* The URL that will be placed in the iframe
* @property YAHOO.widget.Overlay.IFRAME_SRC
* @static
* @final
* @type String
*/
/**
* Number representing how much the iframe shim should be offset from each
* side of an Overlay instance.
* @property YAHOO.widget.Overlay.IFRAME_SRC
* @default 3
* @static
* @final
* @type Number
*/
/**
* Constant representing the top left corner of an element, used for
* configuring the context element alignment
* @property YAHOO.widget.Overlay.TOP_LEFT
* @static
* @final
* @type String
*/
/**
* Constant representing the top right corner of an element, used for
* configuring the context element alignment
* @property YAHOO.widget.Overlay.TOP_RIGHT
* @static
* @final
* @type String
*/
/**
* Constant representing the top bottom left corner of an element, used for
* configuring the context element alignment
* @property YAHOO.widget.Overlay.BOTTOM_LEFT
* @static
* @final
* @type String
*/
/**
* Constant representing the bottom right corner of an element, used for
* configuring the context element alignment
* @property YAHOO.widget.Overlay.BOTTOM_RIGHT
* @static
* @final
* @type String
*/
/**
* Constant representing the default CSS class used for an Overlay
* @property YAHOO.widget.Overlay.CSS_OVERLAY
* @static
* @final
* @type String
*/
/**
* A singleton CustomEvent used for reacting to the DOM event for
* window scroll
* @event YAHOO.widget.Overlay.windowScrollEvent
*/
/**
* A singleton CustomEvent used for reacting to the DOM event for
* window resize
* @event YAHOO.widget.Overlay.windowResizeEvent
*/
/**
* The DOM event handler used to fire the CustomEvent for window scroll
* @method YAHOO.widget.Overlay.windowScrollHandler
* @static
* @param {DOMEvent} e The DOM scroll event
*/
Overlay.windowScrollHandler = function (e) {
}
}, 1);
} else {
}
};
/**
* The DOM event handler used to fire the CustomEvent for window resize
* @method YAHOO.widget.Overlay.windowResizeHandler
* @static
* @param {DOMEvent} e The DOM resize event
*/
Overlay.windowResizeHandler = function (e) {
}
}, 100);
} else {
}
};
/**
* A boolean that indicated whether the window resize and scroll events have
* already been subscribed to.
* @property YAHOO.widget.Overlay._initialized
* @private
* @type Boolean
*/
Overlay._initialized = null;
if (Overlay._initialized === null) {
Overlay._initialized = true;
}
/**
* The Overlay initialization method, which is executed for Overlay and
* all of its subclasses. 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.
* @method init
* @param {String} el The element ID representing the Overlay <em>OR</em>
* @param {HTMLElement} el The element representing the Overlay
* @param {Object} userConfig The configuration object literal
* containing the configuration that should be set for this Overlay.
* See configuration documentation for more details.
*/
/*
Note that we don't pass the user config in here yet because we
only want it executed once, at the lowest subclass level
*/
if (userConfig) {
}
this.showMacGeckoScrollbars, this)) {
this, true);
}
this.hideMacGeckoScrollbars, this)) {
this, true);
}
}
},
/**
* Initializes the custom events for Overlay which are fired
* automatically at appropriate times by the Overlay class.
* @method initEvents
*/
initEvents: function () {
/**
* CustomEvent fired before the Overlay is moved.
* @event beforeMoveEvent
* @param {Number} x x coordinate
* @param {Number} y y coordinate
*/
/**
* CustomEvent fired after the Overlay is moved.
* @event moveEvent
* @param {Number} x x coordinate
* @param {Number} y y coordinate
*/
},
/**
* Initializes the class's configurable properties which can be changed
* using the Overlay's Config object (cfg).
* @method initDefaultConfig
*/
initDefaultConfig: function () {
// Add overlay config properties //
/**
* The absolute x-coordinate position of the Overlay
* @config x
* @type Number
* @default null
*/
});
/**
* The absolute y-coordinate position of the Overlay
* @config y
* @type Number
* @default null
*/
});
/**
* An array with the absolute x and y positions of the Overlay
* @config xy
* @type Number[]
* @default null
*/
});
/**
* The array of context arguments for context-sensitive positioning.
* The format is: [id or element, element corner, context corner].
* For example, setting this property to ["img1", "tl", "bl"] would
* align the Overlay's top left corner to the context element's
* bottom left corner.
* @config context
* @type Array
* @default null
*/
handler: this.configContext,
});
/**
* True if the Overlay should be anchored to the center of
* the viewport.
* @config fixedcenter
* @type Boolean
* @default false
*/
handler: this.configFixedCenter,
});
/**
* CSS width of the Overlay.
* @config width
* @type String
* @default null
*/
handler: this.configWidth,
});
/**
* CSS height of the Overlay.
* @config height
* @type String
* @default null
*/
handler: this.configHeight,
});
/**
* CSS z-index of the Overlay.
* @config zIndex
* @type Number
* @default null
*/
handler: this.configzIndex,
});
/**
* True if the Overlay should be prevented from being positioned
* out of the viewport.
* @config constraintoviewport
* @type Boolean
* @default false
*/
handler: this.configConstrainToViewport,
});
/**
* @config iframe
* @description Boolean indicating whether or not the Overlay should
* have an IFRAME shim; used to prevent <SELECT> elements from
* poking through an Overlay instance in IE6. When set to "true",
* the iframe shim is created when the Overlay instance is intially
* made visible.
* @type Boolean
* @default true for IE6 and below, false for all other browsers.
*/
handler: this.configIframe,
});
},
/**
* Moves the Overlay to the specified position. This function is
* identical to calling this.cfg.setProperty("xy", [x,y]);
* @method moveTo
* @param {Number} x The Overlay's new x position
* @param {Number} y The Overlay's new y position
*/
moveTo: function (x, y) {
},
/**
* Adds a CSS class ("hide-scrollbars") and removes a CSS class
* ("show-scrollbars") to the Overlay to fix a bug in Gecko on Mac OS X
* @method hideMacGeckoScrollbars
*/
hideMacGeckoScrollbars: function () {
},
/**
* Adds a CSS class ("show-scrollbars") and removes a CSS class
* ("hide-scrollbars") to the Overlay to fix a bug in Gecko on Mac OS X
* @method showMacGeckoScrollbars
*/
showMacGeckoScrollbars: function () {
},
// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
/**
* The default event handler fired when the "visible" property is
* changed. This method is responsible for firing showEvent
* and hideEvent.
* @method configVisible
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
effectInstances = [],
if (currentVis == "inherit") {
e = this.element.parentNode;
if (currentVis != "inherit") {
break;
}
e = e.parentNode;
}
if (currentVis == "inherit") {
currentVis = "visible";
}
}
if (effect) {
if (effect instanceof Array) {
for (i = 0; i < nEffects; i++) {
}
} else {
}
}
if (visible) { // Show
if (isMacGecko) {
this.showMacGeckoScrollbars();
}
if (effect) { // Animate in
if (visible) { // Animate in if not showing
this.beforeShowEvent.fire();
for (j = 0; j < nEffectInstances; j++) {
ei = effectInstances[j];
if (j === 0 && !alreadySubscribed(
/*
Delegate showEvent until end
of animateInComplete
*/
}
}
}
}
} else { // Show
this.beforeShowEvent.fire();
}
}
} else { // Hide
if (isMacGecko) {
this.hideMacGeckoScrollbars();
}
if (effect) { // Animate out if showing
if (currentVis == "visible") {
this.beforeHideEvent.fire();
for (k = 0; k < nEffectInstances; k++) {
h = effectInstances[k];
if (k === 0 && !alreadySubscribed(
this.hideEvent)) {
/*
Delegate hideEvent until end
of animateOutComplete
*/
}
h.animateOut();
}
} else if (currentVis === "") {
}
} else { // Simple hide
this.beforeHideEvent.fire();
}
}
}
},
/**
* the Overlay is visible
* @method doCenterOnDOMEvent
*/
doCenterOnDOMEvent: function () {
this.center();
}
},
/**
* The default event handler fired when the "fixedcenter" property
* is changed.
* @method configFixedCenter
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
if (val) {
this.center();
if (!alreadySubscribed(this.beforeShowEvent,
this.center, this)) {
}
this.doCenterOnDOMEvent, this)) {
this, true);
}
this.doCenterOnDOMEvent, this)) {
this, true);
}
} else {
}
},
/**
* The default event handler fired when the "height" property is changed.
* @method configHeight
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
},
/**
* The default event handler fired when the "width" property is changed.
* @method configWidth
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
},
/**
* The default event handler fired when the "zIndex" property is changed.
* @method configzIndex
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
if (! zIndex) {
zIndex = 0;
}
}
if (this.iframe) {
if (zIndex <= 0) {
zIndex = 1;
}
}
},
/**
* The default event handler fired when the "xy" property is changed.
* @method configXY
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
x = pos[0],
y = pos[1];
this.beforeMoveEvent.fire([x, y]);
},
/**
* The default event handler fired when the "x" property is changed.
* @method configX
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
var x = args[0],
this.beforeMoveEvent.fire([x, y]);
},
/**
* The default event handler fired when the "y" property is changed.
* @method configY
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
y = args[0];
this.beforeMoveEvent.fire([x, y]);
},
/**
* Shows the iframe shim, if it has been enabled.
* @method showIframe
*/
showIframe: function () {
if (oIFrame) {
}
}
},
/**
* Hides the iframe shim, if it has been enabled.
* @method hideIframe
*/
hideIframe: function () {
if (this.iframe) {
}
},
/**
* Syncronizes the size and position of iframe shim to that of its
* corresponding Overlay instance.
* @method syncIframe
*/
syncIframe: function () {
aXY;
if (oIFrame) {
// Size <iframe>
// Position <iframe>
this.syncPosition();
}
}
},
/**
* The default event handler fired when the "iframe" property is changed.
* @method configIframe
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
function createIFrame() {
aXY;
if (!oIFrame) {
if (!m_oIFrameTemplate) {
if (this.isSecure) {
}
/*
Set the opacity of the <iframe> to 0 so that it
doesn't modify the opacity of any transparent
elements that may be on top of it (like a shadow).
*/
/*
Need to set the "frameBorder" property to 0
supress the default <iframe> border in IE.
Setting the CSS "border" property alone
doesn't supress it.
*/
}
else {
}
}
if (oParent) {
} else {
}
}
/*
Show the <iframe> before positioning it since the "setXY"
method of DOM requires the element be in the document
and visible.
*/
this.showIframe();
/*
Syncronize the size and position of the <iframe> to that
of the Overlay.
*/
this.syncIframe();
// Add event listeners to update the <iframe> when necessary
if (!this._hasIframeEventListeners) {
this._hasIframeEventListeners = true;
}
}
function onBeforeShow() {
createIFrame.call(this);
this._iframeDeferred = false;
}
if (bIFrame) { // <iframe> shim is enabled
createIFrame.call(this);
}
else {
if (!this._iframeDeferred) {
this._iframeDeferred = true;
}
}
} else { // <iframe> shim is disabled
this.hideIframe();
if (this._hasIframeEventListeners) {
this._hasIframeEventListeners = false;
}
}
},
/**
* The default event handler fired when the "constraintoviewport"
* property is changed.
* @method configConstrainToViewport
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for
* the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
if (val) {
this.enforceConstraints, this)) {
this, true);
}
} else {
}
},
/**
* The default event handler fired when the "context" property
* is changed.
* @method configContext
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
if (contextArgs) {
if (contextEl) {
if (typeof contextEl == "string") {
true);
}
if (elementMagnetCorner && contextMagnetCorner) {
}
}
}
},
// END BUILT-IN PROPERTY EVENT HANDLERS //
/**
* Aligns the Overlay to its context element using the specified corner
* points (represented by the constants TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT,
* and BOTTOM_RIGHT.
* @method align
* @param {String} elementAlign The String representing the corner of
* the Overlay that should be aligned to the context element
* @param {String} contextAlign The corner of the context element
* that the elementAlign corner should stick to.
*/
me = this,
function doAlign(v, h) {
switch (elementAlign) {
break;
break;
case Overlay.BOTTOM_LEFT:
break;
case Overlay.BOTTOM_RIGHT:
(v - element.offsetHeight));
break;
}
}
if (contextArgs) {
me = this;
if (! elementAlign) {
}
if (! contextAlign) {
}
switch (contextAlign) {
break;
break;
case Overlay.BOTTOM_LEFT:
break;
case Overlay.BOTTOM_RIGHT:
break;
}
}
}
},
/**
* The default event handler executed when the moveEvent is fired, if the
* "constraintoviewport" is set to true.
* @method enforceConstraints
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
x = pos[0],
y = pos[1],
if (x < leftConstraint) {
x = leftConstraint;
} else if (x > rightConstraint) {
x = rightConstraint;
}
if (y < topConstraint) {
y = topConstraint;
} else if (y > bottomConstraint) {
y = bottomConstraint;
}
},
/**
* Centers the container in the viewport.
* @method center
*/
center: function () {
},
/**
* Synchronizes the Panel's "xy", "x", and "y" properties with the
* Panel's position in the DOM. This is primarily used to update
* position information during drag & drop.
* @method syncPosition
*/
syncPosition: function () {
},
/**
* Event handler fired when the resize monitor element is resized.
* @method onDomResize
* @param {DOMEvent} e The resize DOM event
* @param {Object} obj The scope object
*/
onDomResize: function (e, obj) {
var me = this;
setTimeout(function () {
me.syncPosition();
}, 0);
},
/**
* Places the Overlay on top of all other instances of
* YAHOO.widget.Overlay.
* @method bringToTop
*/
bringToTop: function() {
var aOverlays = [],
return -1;
return 1;
} else {
return 0;
}
}
function isOverlayElement(p_oElement) {
}
else {
}
}
}
if (oTopOverlay) {
}
}
},
/**
* Removes the Overlay element from the DOM and sets all child
* elements to null.
* @method destroy
*/
destroy: function () {
if (this.iframe) {
}
this.iframe = null;
this.doCenterOnDOMEvent, this);
this.doCenterOnDOMEvent, this);
},
/**
* Returns a String representation of the object.
* @method toString
* @return {String} The string representation of the Overlay.
*/
toString: function () {
return "Overlay " + this.id;
}
});
}());
(function () {
/**
* OverlayManager is used for maintaining the focus status of
* multiple Overlays.
* @namespace YAHOO.widget
* @namespace YAHOO.widget
* @class OverlayManager
* @constructor
* @param {Array} overlays Optional. A collection of Overlays to register
* with the manager.
* @param {Object} userConfig The object literal representing the user
* configuration of the OverlayManager
*/
this.init(userConfig);
};
/**
* The CSS class representing a focused Overlay
* @property OverlayManager.CSS_FOCUSED
* @static
* @final
* @type String
*/
/**
* The class's constructor function
* @property contructor
* @type Function
*/
/**
* The array of Overlays that are currently registered
* @property overlays
* @type YAHOO.widget.Overlay[]
*/
overlays: null,
/**
* Initializes the default configuration of the OverlayManager
* @method initDefaultConfig
*/
initDefaultConfig: function () {
/**
* The collection of registered Overlays in use by
* the OverlayManager
* @config overlays
* @type YAHOO.widget.Overlay[]
* @default null
*/
/**
* The default DOM event that should be used to focus an Overlay
* @config focusevent
* @type String
* @default "mousedown"
*/
},
/**
* Initializes the OverlayManager
* @method init
* @param {Overlay[]} overlays Optional. A collection of Overlays to
* register with the manager.
* @param {Object} userConfig The object literal representing the user
* configuration of the OverlayManager
*/
init: function (userConfig) {
/**
* The OverlayManager's Config object used for monitoring
* configuration properties.
* @property cfg
* @type Config
*/
this.initDefaultConfig();
if (userConfig) {
}
/**
* The currently activated Overlay
* @property activeOverlay
* @private
* @type YAHOO.widget.Overlay
*/
var activeOverlay = null;
/**
* Returns the currently focused Overlay
* @method getActive
* @return {Overlay} The currently focused Overlay
*/
this.getActive = function () {
return activeOverlay;
};
/**
* Focuses the specified Overlay
* @method focus
* @param {Overlay} overlay The Overlay to focus
* @param {String} overlay The id of the Overlay to focus
*/
if (o) {
if (activeOverlay != o) {
if (activeOverlay) {
}
this.bringToTop(o);
activeOverlay = o;
o.focusEvent.fire();
}
}
};
/**
* Removes the specified Overlay from the manager
* @method remove
* @param {Overlay} overlay The Overlay to remove
* @param {String} overlay The id of the Overlay to remove
*/
if (o) {
if (activeOverlay == o) {
activeOverlay = null;
}
this.overlays =
if (o.element) {
this._onOverlayElementFocus);
}
o.focusEvent.unsubscribeAll();
o.blurEvent.unsubscribeAll();
o.focusEvent = null;
o.blurEvent = null;
o.focus = null;
o.blur = null;
}
};
/**
* Removes focus from all registered Overlays in the manager
* @method blurAll
*/
this.blurAll = function () {
i;
if (nOverlays > 0) {
i = nOverlays - 1;
do {
}
while(i--);
}
};
activeOverlay = null;
};
if (! this.overlays) {
this.overlays = [];
}
if (overlays) {
}
},
/**
* @method _onOverlayElementFocus
* @description Event handler for the DOM event that is used to focus
* the Overlay instance as specified by the "focusevent"
* configuration property.
* @private
* @param {Event} p_oEvent Object representing the DOM event
* object passed back by the event utility (Event).
*/
_onOverlayElementFocus: function (p_oEvent) {
this.blur();
}
else {
this.focus();
}
},
/**
* @method _onOverlayDestroy
* @description "destroy" event handler for the Overlay.
* @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 {Overlay} p_oOverlay Object representing the menu that
* fired the event.
*/
this.remove(p_oOverlay);
},
/**
* Registers an Overlay or an array of Overlays with the manager. Upon
* registration, the Overlay receives functions for focus and blur,
* along with CustomEvents for each.
* @method register
* @param {Overlay} overlay An Overlay to register with the manager.
* @param {Overlay[]} overlay An array of Overlays to register with
* the manager.
* @return {Boolean} True if any Overlays are registered.
*/
var mgr = this,
i,
};
}
};
overlay, this);
this._onOverlayElementFocus, null, overlay);
} else {
}
this.bringToTop(overlay);
return true;
} else if (overlay instanceof Array) {
regcount = 0;
for (i = 0; i < nOverlays; i++) {
regcount++;
}
}
if (regcount > 0) {
return true;
}
} else {
return false;
}
},
/**
* Places the specified Overlay instance on top of all other
* Overlay instances.
* @method bringToTop
* @param {YAHOO.widget.Overlay} p_oOverlay Object representing an
* Overlay instance.
* @param {String} p_oOverlay String representing the id of an
* Overlay instance.
*/
bringToTop: function (p_oOverlay) {
if (oOverlay) {
if (oTopOverlay) {
}
}
}
},
/**
* Attempts to locate an Overlay by instance or ID.
* @method find
* @param {Overlay} overlay An Overlay to locate within the manager
* @param {String} overlay An Overlay id to locate within the manager
* @return {Overlay} The requested Overlay, if found, or null if it
* cannot be located.
*/
i;
if (nOverlays > 0) {
i = nOverlays - 1;
do {
return aOverlays[i];
}
}
while(i--);
} else if (typeof overlay == "string") {
do {
return aOverlays[i];
}
}
while(i--);
}
return null;
}
},
/**
* Used for sorting the manager's Overlays by z-index.
* @method compareZIndexDesc
* @private
* @return {Number} 0, 1, or -1, depending on where the Overlay should
* fall in the stacking order.
*/
return -1;
return 1;
} else {
return 0;
}
},
/**
* Shows all Overlays in the manager.
* @method showAll
*/
showAll: function () {
i;
if (nOverlays > 0) {
i = nOverlays - 1;
do {
}
while(i--);
}
},
/**
* Hides all Overlays in the manager.
* @method hideAll
*/
hideAll: function () {
i;
if (nOverlays > 0) {
i = nOverlays - 1;
do {
}
while(i--);
}
},
/**
* Returns a string representation of the object.
* @method toString
* @return {String} The string representation of the OverlayManager
*/
toString: function () {
return "OverlayManager";
}
};
}());
(function () {
/**
* Tooltip is an implementation of Overlay that behaves like an OS tooltip,
* displaying when the user mouses over a particular element, and
* disappearing on mouse out.
* @namespace YAHOO.widget
* @class Tooltip
* @extends YAHOO.widget.Overlay
* @constructor
* @param {String} el The element ID representing the Tooltip <em>OR</em>
* @param {HTMLElement} el The element representing the Tooltip
* @param {Object} userConfig The configuration object literal containing
* the configuration that should be set for this Overlay. See configuration
* documentation for more details.
*/
};
/**
* Constant representing the Tooltip's configuration properties
* @property DEFAULT_CONFIG
* @private
* @final
* @type Object
*/
DEFAULT_CONFIG = {
"PREVENT_OVERLAP": {
key: "preventoverlap",
value: true,
},
"SHOW_DELAY": {
key: "showdelay",
value: 200,
},
"AUTO_DISMISS_DELAY": {
key: "autodismissdelay",
value: 5000,
},
"HIDE_DELAY": {
key: "hidedelay",
value: 250,
},
"TEXT": {
key: "text",
suppressEvent: true
},
"CONTAINER": {
key: "container"
}
};
/**
* Constant representing the Tooltip CSS class
* @property YAHOO.widget.Tooltip.CSS_TOOLTIP
* @static
* @final
* @type String
*/
/*
"hide" event handler that sets a Tooltip instance's "width"
configuration property back to its original value before
"setWidthToOffsetWidth" was called.
*/
if (sCurrentWidth == sNewWidth) {
}
}
/*
"beforeShow" event handler that sets a Tooltip instance's "width"
configuration property to the value of its root HTML
elements's offsetWidth
*/
oClone = null;
}
}
// "onDOMReady" that renders the ToolTip
}
// "init" event handler that automatically renders the Tooltip
function onInit() {
}
/**
* The Tooltip initialization method. This method is automatically
* called by the constructor. A Tooltip is automatically rendered by
* the init method, and it also is set to be invisible by default,
* and constrained to viewport by default as well.
* @method init
* @param {String} el The element ID representing the Tooltip <em>OR</em>
* @param {HTMLElement} el The element representing the Tooltip
* @param {Object} userConfig The configuration object literal
* containing the configuration that should be set for this Tooltip.
* See configuration documentation for more details.
*/
if (userConfig) {
}
this.setBody("");
},
/**
* Initializes the class's configurable properties which can be
* changed using the Overlay's Config object (cfg).
* @method initDefaultConfig
*/
initDefaultConfig: function () {
/**
* Specifies whether the Tooltip should be kept from overlapping
* its context element.
* @config preventoverlap
* @type Boolean
* @default true
*/
});
/**
* The number of milliseconds to wait before showing a Tooltip
* on mouseover.
* @config showdelay
* @type Number
* @default 200
*/
handler: this.configShowDelay,
value: 200,
});
/**
* The number of milliseconds to wait before automatically
* dismissing a Tooltip after the mouse has been resting on the
* context element.
* @config autodismissdelay
* @type Number
* @default 5000
*/
handler: this.configAutoDismissDelay,
});
/**
* The number of milliseconds to wait before hiding a Tooltip
* on mouseover.
* @config hidedelay
* @type Number
* @default 250
*/
handler: this.configHideDelay,
});
/**
* Specifies the Tooltip's text.
* @config text
* @type String
* @default null
*/
handler: this.configText,
});
/**
* Specifies the container element that the Tooltip's markup
* should be rendered into.
* @config container
* @type HTMLElement/String
* @default document.body
*/
handler: this.configContainer,
});
/**
* Specifies the element or elements that the Tooltip should be
* anchored to on mouseover.
* @config context
* @type HTMLElement[]/String[]
* @default null
*/
/**
* String representing the width of the Tooltip. <em>Please note:
* </em> As of version 2.3 if either no value or a value of "auto"
* is specified, and the Toolip's "container" configuration property
* is set to something other than <code>document.body</code> or
* its "context" element resides outside the immediately visible
* portion of the document, the width of the Tooltip will be
* calculated based on the offsetWidth of its root HTML and set just
* before it is made visible. The original value will be
* restored when the Tooltip is hidden. This ensures the Tooltip is
* rendered at a usable width. For more information see
* SourceForge bug #1685496 and SourceForge
* bug #1735423.
* @config width
* @type String
* @default null
*/
},
// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
/**
* The default event handler fired when the "text" property is changed.
* @method configText
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
if (text) {
}
},
/**
* The default event handler fired when the "container" property
* is changed.
* @method configContainer
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For
* configuration handlers, args[0] will equal the newly applied value
* for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
if (typeof container == 'string') {
}
},
/**
* @method _removeEventListeners
* @description Removes all of the DOM event handlers from the HTML
* element(s) that trigger the display of the tooltip.
* @protected
*/
_removeEventListeners: function () {
i;
if (aElements) {
if (nElements > 0) {
i = nElements - 1;
do {
this.onContextMouseOver);
this.onContextMouseMove);
this.onContextMouseOut);
}
while (i--);
}
}
},
/**
* The default event handler fired when the "context" property
* is changed.
* @method configContext
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
i;
if (context) {
// Normalize parameter into an array
if (! (context instanceof Array)) {
if (typeof context == "string") {
} else { // Assuming this is an element
}
}
this._removeEventListeners();
if (aElements) {
if (nElements > 0) {
i = nElements - 1;
do {
this.onContextMouseOver, this);
this.onContextMouseMove, this);
this.onContextMouseOut, this);
}
while (i--);
}
}
}
},
// END BUILT-IN PROPERTY EVENT HANDLERS //
// BEGIN BUILT-IN DOM EVENT HANDLERS //
/**
* The default event handler fired when the user moves the mouse while
* over the context element.
* @method onContextMouseMove
* @param {DOMEvent} e The current DOM event
* @param {Object} obj The object argument
*/
onContextMouseMove: function (e, obj) {
},
/**
* The default event handler fired when the user mouses over the
* context element.
* @method onContextMouseOver
* @param {DOMEvent} e The current DOM event
* @param {Object} obj The object argument
*/
onContextMouseOver: function (e, obj) {
var context = this;
if (obj.hideProcId) {
obj.hideProcId = null;
}
}
/**
* The unique process ID associated with the thread responsible
* for showing the Tooltip.
* @type int
*/
},
/**
* The default event handler fired when the user mouses out of
* the context element.
* @method onContextMouseOut
* @param {DOMEvent} e The current DOM event
* @param {Object} obj The object argument
*/
onContextMouseOut: function (e, obj) {
var el = this;
if (obj._tempTitle) {
obj._tempTitle = null;
}
if (obj.showProcId) {
obj.showProcId = null;
}
if (obj.hideProcId) {
obj.hideProcId = null;
}
},
// END BUILT-IN DOM EVENT HANDLERS //
/**
* Processes the showing of the Tooltip by setting the timeout delay
* and offset of the Tooltip.
* @method doShow
* @param {DOMEvent} e The current DOM event
* @return {Number} The process ID of the timeout function associated
* with doShow
*/
var yOffset = 25,
me = this;
yOffset += 12;
}
return setTimeout(function () {
if (me._tempTitle) {
} else {
}
}
},
/**
* Sets the timeout for the auto-dismiss delay, which by default is 5
* seconds, meaning that a tooltip will automatically dismiss itself
* after 5 seconds of being displayed.
* @method doHide
*/
doHide: function () {
var me = this;
return setTimeout(function () {
},
/**
* Fired when the Tooltip is moved, this event handler is used to
* prevent the Tooltip from overlapping with its context element.
* @method preventOverlay
* @param {Number} pageX The x coordinate position of the mouse pointer
* @param {Number} pageY The y coordinate position of the mouse pointer
*/
}
},
/**
* @method onRender
* @description "render" event handler for the Tooltip.
* @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 sizeShadow() {
if (oShadow) {
}
}
function addShadowVisibleClass() {
}
function removeShadowVisibleClass() {
}
function createShadow() {
nIE,
me;
if (!oShadow) {
me = this;
if (!m_oShadowTemplate) {
}
addShadowVisibleClass.call(this);
if (nIE == 6 ||
window.setTimeout(function () {
}, 0);
this, true);
this.subscribe("destroy", function () {
this);
});
}
}
}
function onBeforeShow() {
createShadow.call(this);
}
createShadow.call(this);
}
else {
}
},
/**
* Removes the Tooltip element from the DOM and sets all child
* elements to null.
* @method destroy
*/
destroy: function () {
this._removeEventListeners();
},
/**
* Returns a string representation of the object.
* @method toString
* @return {String} The string representation of the Tooltip
*/
toString: function () {
return "Tooltip " + this.id;
}
});
}());
(function () {
/**
* Panel is an implementation of Overlay that behaves like an OS window,
* with a draggable header and an optional close icon at the top right.
* @namespace YAHOO.widget
* @class Panel
* @extends Overlay
* @constructor
* @param {String} el The element ID representing the Panel <em>OR</em>
* @param {HTMLElement} el The element representing the Panel
* @param {Object} userConfig The configuration object literal containing
* the configuration that should be set for this Panel. See configuration
* documentation for more details.
*/
};
/**
* Constant representing the name of the Panel's events
* @property EVENT_TYPES
* @private
* @final
* @type Object
*/
EVENT_TYPES = {
"SHOW_MASK": "showMask",
"HIDE_MASK": "hideMask",
"DRAG": "drag"
},
/**
* Constant representing the Panel's configuration properties
* @property DEFAULT_CONFIG
* @private
* @final
* @type Object
*/
DEFAULT_CONFIG = {
"CLOSE": {
key: "close",
value: true,
supercedes: ["visible"]
},
"DRAGGABLE": {
key: "draggable",
supercedes: ["visible"]
},
"UNDERLAY": {
key: "underlay",
value: "shadow",
supercedes: ["visible"]
},
"MODAL": {
key: "modal",
value: false,
supercedes: ["visible"]
},
"KEY_LISTENERS": {
key: "keylisteners",
suppressEvent: true,
supercedes: ["visible"]
}
};
/**
* Constant representing the default CSS class used for a Panel
* @property YAHOO.widget.Panel.CSS_PANEL
* @static
* @final
* @type String
*/
/**
* Constant representing the default CSS class used for a Panel's
* wrapping container
* @property YAHOO.widget.Panel.CSS_PANEL_CONTAINER
* @static
* @final
* @type String
*/
// Private CustomEvent listeners
/*
"beforeRender" event handler that creates an empty header for a Panel
instance if its "draggable" configuration property is set to "true"
and no header has been created.
*/
if (!this.header) {
this.setHeader(" ");
}
}
/*
"hide" event handler that sets a Panel instance's "width"
configuration property back to its original value before
"setWidthToOffsetWidth" was called.
*/
if (sCurrentWidth == sNewWidth) {
}
}
/*
"beforeShow" event handler that sets a Panel instance's "width"
configuration property to the value of its root HTML
elements's offsetWidth
*/
}
}
}
/*
"focus" event handler for a focuable element. Used to automatically
blur the element when it receives focus to ensure that a Panel
instance's modality is not compromised.
*/
function onElementFocus() {
this.blur();
}
/*
"showMask" event handler that adds a "focus" event handler to all
focusable elements in the document to enforce a Panel instance's
modality from being compromised.
*/
var me = this;
function isFocusable(el) {
bFocusable = false;
switch (sTagName) {
case "A":
case "BUTTON":
case "SELECT":
case "TEXTAREA":
bFocusable = true;
}
break;
case "INPUT":
bFocusable = true;
}
break;
}
return bFocusable;
}
}
/*
"hideMask" event handler that removes all "focus" event handlers added
by the "addFocusEventHandlers" method.
*/
var aElements = this.focusableElements,
el2,
i;
for (i = 0; i < nElements; i++) {
}
}
/**
* The Overlay initialization method, which is executed for Overlay and
* all of its subclasses. 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.
* @method init
* @param {String} el The element ID representing the Overlay <em>OR</em>
* @param {HTMLElement} el The element representing the Overlay
* @param {Object} userConfig The configuration object literal
* containing the configuration that should be set for this Overlay.
* See configuration documentation for more details.
*/
/*
Note that we don't pass the user config in here yet because
we only want it executed once, at the lowest subclass level
*/
this.buildWrapper();
if (userConfig) {
}
},
/**
* Initializes the custom events for Module which are fired
* automatically at appropriate times by the Module class.
*/
initEvents: function () {
/**
* CustomEvent fired after the modality mask is shown
* @event showMaskEvent
*/
/**
* CustomEvent fired after the modality mask is hidden
* @event hideMaskEvent
*/
/**
* CustomEvent when the Panel is dragged
* @event dragEvent
*/
},
/**
* Initializes the class's configurable properties which can be changed
* using the Panel's Config object (cfg).
* @method initDefaultConfig
*/
initDefaultConfig: function () {
// Add panel config properties //
/**
* True if the Panel should display a "close" button
* @config close
* @type Boolean
* @default true
*/
handler: this.configClose,
});
/**
* Boolean specifying if the Panel should be draggable. The default
* value is "true" if the Drag and Drop utility is included,
* otherwise it is "false." <strong>PLEASE NOTE:</strong> There is a
* known issue in IE 6 (Strict Mode and Quirks Mode) and IE 7
* (Quirks Mode) where Panels that either don't have a value set for
* their "width" configuration property, or their "width"
* configuration property is set to "auto" will only be draggable by
* placing the mouse on the text of the Panel's header element.
* To fix this bug, draggable Panels missing a value for their
* "width" configuration property, or whose "width" configuration
* property is set to "auto" will have it set to the value of
* their root HTML element's offsetWidth before they are made
* visible. The calculated width is then removed when the Panel is
* hidden. <em>This fix is only applied to draggable Panels in IE 6
* (Strict Mode and Quirks Mode) and IE 7 (Quirks Mode)</em>. For
* more information on this issue see:
* SourceForge bugs #1726972 and #1589210.
* @config draggable
* @type Boolean
* @default true
*/
handler: this.configDraggable,
});
/**
* Sets the type of underlay to display for the Panel. Valid values
* are "shadow," "matte," and "none". <strong>PLEASE NOTE:</strong>
* The creation of the underlay element is deferred until the Panel
* is initially made visible. For Gecko-based browsers on Mac
* OS X the underlay elment is always created as it is used as a
* shim to prevent Aqua scrollbars below a Panel instance from poking
* through it (See SourceForge bug #836476).
* @config underlay
* @type String
* @default shadow
*/
handler: this.configUnderlay,
});
/**
* True if the Panel should be displayed in a modal fashion,
* automatically creating a transparent mask over the document that
* will not be removed until the Panel is dismissed.
* @config modal
* @type Boolean
* @default false
*/
handler: this.configModal,
});
/**
* A KeyListener (or array of KeyListeners) that will be enabled
* when the Panel is shown, and disabled when the Panel is hidden.
* @config keylisteners
* @type YAHOO.util.KeyListener[]
* @default null
*/
handler: this.configKeyListeners,
});
},
// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
/**
* The default event handler fired when the "close" property is changed.
* The method controls the appending or hiding of the close icon at the
* top right of the Panel.
* @method configClose
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
}
if (val) {
if (!oClose) {
if (!m_oCloseIconTemplate) {
}
} else {
}
} else {
if (oClose) {
}
}
},
/**
* The default event handler fired when the "draggable" property
* is changed.
* @method configDraggable
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
if (val) {
if (!DD) {
return;
}
if (this.header) {
this.registerDragDrop();
}
} else {
if (this.dd) {
}
if (this.header) {
}
}
},
/**
* The default event handler fired when the "underlay" property
* is changed.
* @method configUnderlay
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
function createUnderlay() {
var nIE;
if (!oUnderlay) { // create if not already in DOM
if (!m_oUnderlayTemplate) {
}
if (nIE == 6 ||
this.sizeUnderlay();
this.sizeUnderlay);
this.sizeUnderlay);
this.sizeUnderlay, this, true);
}
}
}
function onBeforeShow() {
createUnderlay.call(this);
this._underlayDeferred = false;
}
function destroyUnderlay() {
if (this._underlayDeferred) {
this._underlayDeferred = false;
}
if (oUnderlay) {
this.sizeUnderlay);
this.sizeUnderlay);
this.sizeUnderlay, this, true);
this.underlay = null;
}
}
switch (sUnderlay) {
case "shadow":
break;
case "matte":
if (!bMacGecko) {
destroyUnderlay.call(this);
}
break;
default:
if (!bMacGecko) {
destroyUnderlay.call(this);
}
break;
}
createUnderlay.call(this);
}
else {
if (!this._underlayDeferred) {
this._underlayDeferred = true;
}
}
}
},
/**
* The default event handler fired when the "modal" property is
* changed. This handler subscribes or unsubscribes to the show and hide
* events to handle the display or hide of the modality mask.
* @method configModal
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
if (modal) {
if (!this._hasModalityEventListeners) {
this, true);
this._hasModalityEventListeners = true;
}
} else {
if (this._hasModalityEventListeners) {
this.hideMask();
this.removeMask();
}
this._hasModalityEventListeners = false;
}
}
},
/**
* Removes the modality mask.
* @method removeMask
*/
removeMask: function () {
if (oMask) {
/*
Hide the mask before destroying it to ensure that DOM
event handlers on focusable elements get removed.
*/
this.hideMask();
if (oParentNode) {
}
this.mask = null;
}
},
/**
* The default event handler fired when the "keylisteners" property
* is changed.
* @method configKeyListeners
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
i;
if (listeners) {
if (listeners instanceof Array) {
for (i = 0; i < nListeners; i++) {
listener, true);
}
listener, true);
listener, true);
}
}
} else {
listeners, true);
}
listeners, true);
listeners, true);
}
}
}
},
/**
* The default event handler fired when the "height" property is changed.
* @method configHeight
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
el = this.innerElement;
},
/**
* The default event handler fired when the "width" property is changed.
* @method configWidth
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
el = this.innerElement;
},
/**
* The default event handler fired when the "zIndex" property is changed.
* @method configzIndex
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
var maskZ = 0,
if (this.mask) {
currentZ = 0;
}
if (currentZ === 0) {
} else {
}
}
},
// END BUILT-IN PROPERTY EVENT HANDLERS //
/**
* Builds the wrapping container around the Panel that is used for
* positioning the shadow and matte underlays. The container element is
* assigned to a local instance variable called container, and the
* element is reinserted inside of it.
* @method buildWrapper
*/
buildWrapper: function () {
originalElement = this.element,
if (elementParent) {
}
this.innerElement = originalElement;
},
/**
* Adjusts the size of the shadow based on the size of the element.
* @method sizeUnderlay
*/
sizeUnderlay: function () {
if (oUnderlay) {
}
},
/**
* Registers the Panel's header for drag & drop capability.
* @method registerDragDrop
*/
registerDragDrop: function () {
var me = this;
if (this.header) {
if (!DD) {
return;
}
}
var offsetHeight,
}
this.minX = leftConstraint;
this.maxX = rightConstraint;
this.constrainX = true;
this.minY = topConstraint;
this.maxY = bottomConstraint;
this.constrainY = true;
} else {
this.constrainX = false;
this.constrainY = false;
}
};
me.syncPosition();
this.showMacGeckoScrollbars();
}
};
}
};
}
},
/**
* Builds the mask that is laid over the document when the Panel is
* configured to be modal.
* @method buildMask
*/
buildMask: function () {
if (!oMask) {
if (!m_oMaskTemplate) {
}
}
},
/**
* Hides the modality mask.
* @method hideMask
*/
hideMask: function () {
this.hideMaskEvent.fire();
}
},
/**
* Shows the modality mask.
* @method showMask
*/
showMask: function () {
this.sizeMask();
this.showMaskEvent.fire();
}
},
/**
* Sets the size of the modality mask to cover the entire scrollable
* area of the document
* @method sizeMask
*/
sizeMask: function () {
if (this.mask) {
}
},
/**
* Renders the Panel by inserting the elements that are not already in
* the main Panel into their correct places. Optionally appends the
* Panel to the specified node prior to the render's execution. NOTE:
* For Panels without existing markup, the appendToNode argument is
* REQUIRED. If this argument is ommitted and the current element is
* not present in the document, the function will return false,
* indicating that the render was a failure.
* @method render
* @param {String} appendToNode The element id to which the Module
* should be appended to prior to rendering <em>OR</em>
* @param {HTMLElement} appendToNode The element to which the Module
* should be appended to prior to rendering
* @return {boolean} Success or failure of the render
*/
render: function (appendToNode) {
appendToNode, this.innerElement);
},
/**
* Removes the Panel element from the DOM and sets all child elements
* to null.
* @method destroy
*/
destroy: function () {
this.removeMask();
if (this.close) {
}
},
/**
* Returns a String representation of the object.
* @method toString
* @return {String} The string representation of the Panel.
*/
toString: function () {
return "Panel " + this.id;
}
});
}());
(function () {
/**
* Dialog is an implementation of Panel that can be used to submit form
* data. Built-in functionality for buttons with event handlers is included,
* and button sets can be build dynamically, or the preincluded ones for
* ways -- via an asynchronous Connection utility call, a simple form
* POST or GET, or manually.
* @namespace YAHOO.widget
* @class Dialog
* @extends YAHOO.widget.Panel
* @constructor
* @param {String} el The element ID representing the Dialog <em>OR</em>
* @param {HTMLElement} el The element representing the Dialog
* @param {Object} userConfig The configuration object literal containing
* the configuration that should be set for this Dialog. See configuration
* documentation for more details.
*/
};
/**
* Constant representing the name of the Dialog's events
* @property EVENT_TYPES
* @private
* @final
* @type Object
*/
EVENT_TYPES = {
"BEFORE_SUBMIT": "beforeSubmit",
"SUBMIT": "submit",
"MANUAL_SUBMIT": "manualSubmit",
"ASYNC_SUBMIT": "asyncSubmit",
"FORM_SUBMIT": "formSubmit",
"CANCEL": "cancel"
},
/**
* Constant representing the Dialog's configuration properties
* @property DEFAULT_CONFIG
* @private
* @final
* @type Object
*/
DEFAULT_CONFIG = {
"POST_METHOD": {
key: "postmethod",
value: "async"
},
"BUTTONS": {
key: "buttons",
value: "none"
}
};
/**
* Constant representing the default CSS class used for a Dialog
* @property YAHOO.widget.Dialog.CSS_DIALOG
* @static
* @final
* @type String
*/
function removeButtonEventHandlers() {
i;
if (nButtons > 0) {
i = nButtons - 1;
do {
}
}
}
while (i--);
}
}
}
/**
* @property form
* @description Object reference to the Dialog's
* <code><form></code> element.
* @default null
* @type <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
* level-one-html.html#ID-40002357">HTMLFormElement</a>
*/
form: null,
/**
* Initializes the class's configurable properties which can be changed
* using the Dialog's Config object (cfg).
* @method initDefaultConfig
*/
initDefaultConfig: function () {
/**
* The internally maintained callback object for use with the
* Connection utility
* @property callback
* @type Object
*/
this.callback = {
/**
* The function to execute upon success of the
* Connection submission
* @property callback.success
* @type Function
*/
success: null,
/**
* The function to execute upon failure of the
* Connection submission
* @property callback.failure
* @type Function
*/
failure: null,
/**
* The arbitraty argument or arguments to pass to the Connection
* callback functions
* @property callback.argument
* @type Object
*/
argument: null
};
// Add form dialog config properties //
/**
* The method to use for posting the Dialog's form. Possible values
* are "async", "form", and "manual".
* @config postmethod
* @type String
* @default async
*/
handler: this.configPostMethod,
val != "manual") {
return false;
} else {
return true;
}
}
});
/**
* Array of object literals, each containing a set of properties
* defining a button to be appended into the Dialog's footer.
* Each button object in the buttons array can have three properties:
* <dt>text:</dt>
* <dd>The text that will display on the face of the button. <em>
* Please note:</em> As of version 2.3, the text can include
* HTML.</dd>
* <dt>handler:</dt>
* <dd>Can be either:
* <ol>
* <li>A reference to a function that should fire when the
* button is clicked. (In this case scope of this function is
* always its Dialog instance.)</li>
* <li>An object literal representing the code to be
* executed when the button is clicked. Format:<br> <code> {<br>
* <strong>fn:</strong> Function, // The handler to call
* when the event fires.<br> <strong>obj:</strong> Object,
* // An object to pass back to the handler.<br> <strong>
* scope:</strong> Object // The object to use for the
* scope of the handler. <br> } </code> <br><em>Please note: this
* functionality was added in version 2.3.</em></li>
* </ol>
* </dd>
* <dt>isDefault:</dt>
* <dd>An optional boolean value that specifies that a button
* should be highlighted and focused by default.</dd>
* @config buttons
* @type {Array|String}
* @default "none"
*/
handler: this.configButtons,
});
},
/**
* Initializes the custom events for Dialog which are fired
* automatically at appropriate times by the Dialog class.
* @method initEvents
*/
initEvents: function () {
/**
* CustomEvent fired prior to submission
* @event beforeSubmitEvent
*/
this.beforeSubmitEvent =
/**
* CustomEvent fired after submission
* @event submitEvent
*/
/**
* CustomEvent fired prior to manual submission
* @event manualSubmitEvent
*/
this.manualSubmitEvent =
/**
* CustomEvent fired prior to asynchronous submission
* @event asyncSubmitEvent
*/
/**
* CustomEvent fired prior to form-based submission
* @event formSubmitEvent
*/
/**
* CustomEvent fired after cancel
* @event cancelEvent
*/
},
/**
* The Dialog initialization method, which is executed for Dialog and
* all of its subclasses. 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.
* @method init
* @param {String} el The element ID representing the Dialog <em>OR</em>
* @param {HTMLElement} el The element representing the Dialog
* @param {Object} userConfig The configuration object literal
* containing the configuration that should be set for this Dialog.
* See configuration documentation for more details.
*/
/*
Note that we don't pass the user config in here yet because
we only want it executed once, at the lowest subclass level
*/
if (userConfig) {
}
},
/**
* Submits the Dialog's form depending on the value of the
* "postmethod" configuration property. <strong>Please note:
* </strong> As of version 2.3 this method will automatically handle
* asyncronous file uploads should the Dialog instance's form contain
* <code><input type="file"></code> elements. If a Dialog
* instance will be handling asyncronous file uploads, its
* <code>callback</code> property will need to be setup with a
* <code>upload</code> handler rather than the standard
* <code>success</code> and, or <code>failure</code> handlers. For more
* information, see the <a href="http://developer.yahoo.com/yui/
* connection/#file">Connection Manager documenation on file uploads</a>.
* @method doSubmit
*/
doSubmit: function () {
bUseFileUpload = false,
bUseSecureFileUpload = false,
i,
case "async":
if (nElements > 0) {
i = nElements - 1;
do {
bUseFileUpload = true;
break;
}
}
while(i--);
}
bUseSecureFileUpload = true;
}
sMethod =
this.callback);
this.asyncSubmitEvent.fire();
break;
case "form":
this.formSubmitEvent.fire();
break;
case "none":
case "manual":
this.manualSubmitEvent.fire();
break;
}
},
/**
* Prepares the Dialog's internal FORM object, creating one if one is
* not currently present.
* @method registerForm
*/
registerForm: function () {
me = this,
if (this.form) {
return;
}
else {
this.form = null;
}
}
if (!form) {
}
if (form) {
this.submit();
});
this.firstFormElement = function () {
for (f = 0; f < nElements; f++) {
return el;
}
}
return null;
}();
this.lastFormElement = function () {
return el;
}
}
return null;
}();
if (firstElement) {
correctScope: true });
this.preventBackTab, true);
this.preventBackTab, true);
}
if (lastElement) {
correctScope: true });
this.preventTabOut, true);
this.preventTabOut, true);
}
}
}
},
// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
/**
* The default event handler fired when the "close" property is
* changed. The method controls the appending or hiding of the close
* icon at the top right of the Dialog.
* @method configClose
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For
* configuration handlers, args[0] will equal the newly applied value
* for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
}
if (val) {
if (! this.close) {
} else {
}
} else {
if (this.close) {
}
}
},
/**
* The default event handler for the "buttons" configuration property
* @method configButtons
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
oInnerElement = this.innerElement,
i;
removeButtonEventHandlers.call(this);
this._aButtons = null;
this._aButtons = [];
for (i = 0; i < nButtons; i++) {
if (Button) {
this.defaultHtmlButton = oButtonEl;
}
}
}
}
else {
this.defaultHtmlButton = oButtonEl;
}
this, true);
}
}
}
if (i === 0) {
this.firstButton = oButtonEl;
}
if (i == (nButtons - 1)) {
this.lastButton = oButtonEl;
}
}
}
this.buttonSpan = oSpan;
} else { // Do cleanup
oSpan = this.buttonSpan;
this.buttonSpan = null;
this.firstButton = null;
this.lastButton = null;
this.defaultHtmlButton = null;
}
}
},
/**
* @method getButtons
* @description Returns an array containing each of the Dialog's
* buttons, by default an array of HTML <code><BUTTON<</code>
* elements. If the Dialog's buttons were created using the
* YAHOO.widget.Button class (via the inclusion of the optional Button
* dependancy on the page), an array of YAHOO.widget.Button instances
* is returned.
* @return {Array}
*/
getButtons: function () {
if (aButtons) {
return aButtons;
}
},
/**
* Sets focus to the first element in the Dialog's form or the first
* button defined via the "buttons" configuration property. Called
* when the Dialog is made visible.
* @method focusFirst
*/
var oElement = this.firstFormElement,
if (args) {
if (oEvent) {
}
}
if (oElement) {
/*
block to prevent IE from throwing JavaScript errors if
the element is disabled or hidden.
*/
try {
}
catch(oException) {
}
} else {
this.focusDefaultButton();
}
},
/**
* Sets focus to the last element in the Dialog's form or the last
* button defined via the "buttons" configuration property.
* @method focusLast
*/
oElement = this.lastFormElement,
if (args) {
if (oEvent) {
}
}
this.focusLastButton();
} else {
if (oElement) {
/*
block to prevent IE from throwing JavaScript errors if
the element is disabled or hidden.
*/
try {
}
catch(oException) {
}
}
}
},
/**
* Sets the focus to the button that is designated as the default via
* the "buttons" configuration property. By default, this method is
* called when the Dialog is made visible.
* @method focusDefaultButton
*/
focusDefaultButton: function () {
var oElement = this.defaultHtmlButton;
if (oElement) {
/*
block to prevent IE from throwing JavaScript errors if
the element is disabled or hidden.
*/
try {
}
catch(oException) {
}
}
},
/**
* Blurs all the buttons defined via the "buttons"
* configuration property.
* @method blurButtons
*/
blurButtons: function () {
i;
if (nButtons > 0) {
i = (nButtons - 1);
do {
if (oButton) {
if (oElement) {
/*
Place the call to the "blur" method inside
throwing JavaScript errors if the element
is disabled or hidden.
*/
try {
}
catch(oException) {
}
}
}
}
while(i--);
}
}
},
/**
* Sets the focus to the first button created via the "buttons"
* configuration property.
* @method focusFirstButton
*/
focusFirstButton: function () {
if (oButton) {
if (oElement) {
/*
Place the call to the "focus" method inside a
JavaScript errors if the element is disabled
or hidden.
*/
try {
}
catch(oException) {
}
}
}
}
},
/**
* Sets the focus to the last button created via the "buttons"
* configuration property.
* @method focusLastButton
*/
focusLastButton: function () {
if (nButtons > 0) {
if (oButton) {
if (oElement) {
/*
Place the call to the "focus" method inside a
JavaScript errors if the element is disabled
or hidden.
*/
try {
}
catch(oException) {
}
}
}
}
}
},
/**
* The default event handler for the "postmethod" configuration property
* @method configPostMethod
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For
* configuration handlers, args[0] will equal the newly applied value
* for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
this.registerForm();
},
// END BUILT-IN PROPERTY EVENT HANDLERS //
/**
* Built-in function hook for writing a validation function that will
* be checked for a "true" value prior to a submit. This function, as
* implemented by default, always returns true, so it should be
* overridden if validation is necessary.
* @method validate
*/
validate: function () {
return true;
},
/**
* Executes a submit of the Dialog followed by a hide, if validation
* is successful.
* @method submit
*/
submit: function () {
if (this.validate()) {
this.beforeSubmitEvent.fire();
this.doSubmit();
this.submitEvent.fire();
this.hide();
return true;
} else {
return false;
}
},
/**
* Executes the cancel of the Dialog followed by a hide.
* @method cancel
*/
cancel: function () {
this.cancelEvent.fire();
this.hide();
},
/**
* Returns a JSON-compatible data structure representing the data
* currently contained in the form.
* @method getData
* @return {Object} A JSON object reprsenting the data of the
* current form.
*/
getData: function () {
i,
n;
function isFormElement(p_oElement) {
}
if (oForm) {
oData = {};
for (i = 0; i < nTotalElements; i++) {
/*
Using "Dom.getElementsBy" to safeguard user from JS
errors that result from giving a form field (or set of
fields) the same name as a native method of a form
(like "submit") or a DOM collection (such as the "item"
method). Originally tried accessing fields via the
"namedItem" method of the "element" collection, but
discovered that it won't return a collection of fields
in Gecko.
*/
if (nElements > 0) {
if (nElements == 1) {
switch (sTagName) {
case "INPUT":
if (sType == "checkbox") {
}
else if (sType != "radio") {
}
break;
case "TEXTAREA":
break;
case "SELECT":
aValues = [];
for (n = 0; n < nOptions; n++) {
}
}
}
break;
}
}
else {
switch (sType) {
case "radio":
for (n = 0; n < nElements; n++) {
break;
}
}
break;
case "checkbox":
aValues = [];
for (n = 0; n < nElements; n++) {
}
}
break;
}
}
}
}
}
return oData;
},
/**
* Removes the Panel element from the DOM and sets all child elements
* to null.
* @method destroy
*/
destroy: function () {
removeButtonEventHandlers.call(this);
this._aButtons = null;
if (oForm) {
this.form = null;
}
}
},
/**
* Returns a string representation of the object.
* @method toString
* @return {String} The string representation of the Dialog
*/
toString: function () {
return "Dialog " + this.id;
}
});
}());
(function () {
/**
* SimpleDialog is a simple implementation of Dialog that can be used to
* submit a single value. Forms can be processed in 3 ways -- via an
* asynchronous Connection utility call, a simple form POST or GET,
* or manually.
* @namespace YAHOO.widget
* @class SimpleDialog
* @extends YAHOO.widget.Dialog
* @constructor
* @param {String} el The element ID representing the SimpleDialog
* <em>OR</em>
* @param {HTMLElement} el The element representing the SimpleDialog
* @param {Object} userConfig The configuration object literal containing
* the configuration that should be set for this SimpleDialog. See
* configuration documentation for more details.
*/
el, userConfig);
};
/**
* Constant representing the SimpleDialog's configuration properties
* @property DEFAULT_CONFIG
* @private
* @final
* @type Object
*/
DEFAULT_CONFIG = {
"ICON": {
key: "icon",
value: "none",
suppressEvent: true
},
"TEXT": {
key: "text",
value: "",
suppressEvent: true,
supercedes: ["icon"]
}
};
/**
* Constant for the standard network icon for a blocking action
* @property YAHOO.widget.SimpleDialog.ICON_BLOCK
* @static
* @final
* @type String
*/
/**
* Constant for the standard network icon for alarm
* @property YAHOO.widget.SimpleDialog.ICON_ALARM
* @static
* @final
* @type String
*/
/**
* Constant for the standard network icon for help
* @property YAHOO.widget.SimpleDialog.ICON_HELP
* @static
* @final
* @type String
*/
/**
* Constant for the standard network icon for info
* @property YAHOO.widget.SimpleDialog.ICON_INFO
* @static
* @final
* @type String
*/
/**
* Constant for the standard network icon for warn
* @property YAHOO.widget.SimpleDialog.ICON_WARN
* @static
* @final
* @type String
*/
/**
* Constant for the standard network icon for a tip
* @property YAHOO.widget.SimpleDialog.ICON_TIP
* @static
* @final
* @type String
*/
/**
* Constant representing the name of the CSS class applied to the element
* created by the "icon" configuration property.
* @property YAHOO.widget.SimpleDialog.ICON_CSS_CLASSNAME
* @static
* @final
* @type String
*/
/**
* Constant representing the default CSS class used for a SimpleDialog
* @property YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG
* @static
* @final
* @type String
*/
/**
* Initializes the class's configurable properties which can be changed
* using the SimpleDialog's Config object (cfg).
* @method initDefaultConfig
*/
initDefaultConfig: function () {
// Add dialog config properties //
/**
* Sets the informational icon for the SimpleDialog
* @config icon
* @type String
* @default "none"
*/
handler: this.configIcon,
});
/**
* Sets the text for the SimpleDialog
* @config text
* @type String
* @default ""
*/
handler: this.configText,
});
},
/**
* The SimpleDialog initialization method, which is executed for
* SimpleDialog and all of its subclasses. 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.
* @method init
* @param {String} el The element ID representing the SimpleDialog
* <em>OR</em>
* @param {HTMLElement} el The element representing the SimpleDialog
* @param {Object} userConfig The configuration object literal
* containing the configuration that should be set for this
* SimpleDialog. See configuration documentation for more details.
*/
/*
Note that we don't pass the user config in here yet because we
only want it executed once, at the lowest subclass level
*/
if (userConfig) {
}
this.beforeRenderEvent.subscribe(function () {
if (! this.body) {
this.setBody("");
}
}, this, true);
},
/**
* Prepares the SimpleDialog's internal FORM object, creating one if one
* is not currently present, and adding the value hidden field.
* @method registerForm
*/
registerForm: function () {
this.id + "\" value=\"\"/>";
},
// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
/**
* Fired when the "icon" property is set.
* @method configIcon
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
if (oIcon) {
if (oIconParent) {
oIcon = null;
}
}
} else {
}
if (oIcon) {
}
}
},
/**
* Fired when the "text" property is set.
* @method configText
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
if (text) {
}
},
// END BUILT-IN PROPERTY EVENT HANDLERS //
/**
* Returns a string representation of the object.
* @method toString
* @return {String} The string representation of the SimpleDialog
*/
toString: function () {
return "SimpleDialog " + this.id;
}
});
}());
(function () {
/**
* ContainerEffect encapsulates animation transitions that are executed when
* an Overlay is shown or hidden.
* @namespace YAHOO.widget
* @class ContainerEffect
* @constructor
* @param {YAHOO.widget.Overlay} overlay The Overlay that the animation
* should be associated with
* @param {Object} attrIn The object literal representing the animation
* arguments to be used for the animate-in transition. The arguments for
* this literal are: attributes(object, see YAHOO.util.Anim for description),
* duration(Number), and method(i.e. Easing.easeIn).
* @param {Object} attrOut The object literal representing the animation
* arguments to be used for the animate-out transition. The arguments for
* this literal are: attributes(object, see YAHOO.util.Anim for description),
* duration(Number), and method(i.e. Easing.easeIn).
* @param {HTMLElement} targetElement Optional. The target element that
* should be animated during the transition. Defaults to overlay.element.
* @param {class} Optional. The animation class to instantiate. Defaults to
* YAHOO.util.Anim. Other options include YAHOO.util.Motion.
*/
if (!animClass) {
}
/**
* The overlay to animate
* @property overlay
* @type YAHOO.widget.Overlay
*/
/**
* The animation attributes to use when transitioning into view
* @property attrIn
* @type Object
*/
/**
* The animation attributes to use when transitioning out of view
* @property attrOut
* @type Object
*/
/**
* The target element to be animated
* @property targetElement
* @type HTMLElement
*/
/**
* The animation class to use for animating the overlay
* @property animClass
* @type class
*/
};
/**
* A pre-configured ContainerEffect instance that can be used for fading
* an overlay in and out.
* @method FADE
* @static
* @param {YAHOO.widget.Overlay} overlay The Overlay object to animate
* @param {Number} dur The duration of the animation
* @return {YAHOO.widget.ContainerEffect} The configured ContainerEffect object
*/
}
}
};
}
}
};
}
};
}
};
return fade;
};
/**
* A pre-configured ContainerEffect instance that can be used for sliding an
* overlay in and out.
* @method SLIDE
* @static
* @param {YAHOO.widget.Overlay} overlay The Overlay object to animate
* @param {Number} dur The duration of the animation
* @return {YAHOO.widget.ContainerEffect} The configured ContainerEffect object
*/
};
"hidden" && currentX < x) {
}
};
};
};
};
};
return slide;
};
/**
* Initializes the animation classes and events.
* @method init
*/
init: function () {
this.animateOutCompleteEvent =
this.createEvent("animateOutComplete");
this);
this);
},
/**
* Triggers the in-animation.
* @method animateIn
*/
animateIn: function () {
this.beforeAnimateInEvent.fire();
},
/**
* Triggers the out-animation.
* @method animateOut
*/
animateOut: function () {
this.beforeAnimateOutEvent.fire();
},
/**
* The default onStart handler for the in-animation.
* @method handleStartAnimateIn
* @param {String} type The CustomEvent type
* @param {Object[]} args The CustomEvent arguments
* @param {Object} obj The scope object
*/
/**
* The default onTween handler for the in-animation.
* @method handleTweenAnimateIn
* @param {String} type The CustomEvent type
* @param {Object[]} args The CustomEvent arguments
* @param {Object} obj The scope object
*/
/**
* The default onComplete handler for the in-animation.
* @method handleCompleteAnimateIn
* @param {String} type The CustomEvent type
* @param {Object[]} args The CustomEvent arguments
* @param {Object} obj The scope object
*/
/**
* The default onStart handler for the out-animation.
* @method handleStartAnimateOut
* @param {String} type The CustomEvent type
* @param {Object[]} args The CustomEvent arguments
* @param {Object} obj The scope object
*/
/**
* The default onTween handler for the out-animation.
* @method handleTweenAnimateOut
* @param {String} type The CustomEvent type
* @param {Object[]} args The CustomEvent arguments
* @param {Object} obj The scope object
*/
/**
* The default onComplete handler for the out-animation.
* @method handleCompleteAnimateOut
* @param {String} type The CustomEvent type
* @param {Object[]} args The CustomEvent arguments
* @param {Object} obj The scope object
*/
/**
* Returns a string representation of the object.
* @method toString
* @return {String} The string representation of the ContainerEffect
*/
toString: function () {
var output = "ContainerEffect";
if (this.overlay) {
}
return output;
}
};
})();