/* * Copyright (c) 2004-2007, The Dojo Foundation All Rights Reserved. * * Licensed under the Academic Free License version 2.1 or above OR the modified * BSD license. For more information on Dojo licensing, see: * * http://dojotoolkit.org/book/dojo-book-0-9/introduction/licensing */ /* * This is a compiled version of Dojo, built for deployment and not for * development. To get an editable version, please visit: * * http://dojotoolkit.org * * for documentation and information on getting the source. */ if (!dojo._hasResource["dijit._base.focus"]) { dojo._hasResource["dijit._base.focus"] = true; dojo.provide("dijit._base.focus"); dojo.mixin(dijit, { _curFocus : null, _prevFocus : null, isCollapsed : function() { var _1 = dojo.global; var _2 = dojo.doc; if (_2.selection) { return !_2.selection.createRange().text; } else { if (_1.getSelection) { var _3 = _1.getSelection(); if (dojo.isString(_3)) { return !_3; } else { return _3.isCollapsed || !_3.toString(); } } } }, getBookmark : function() { var _4, _5 = dojo.doc.selection; if (_5) { var _6 = _5.createRange(); if (_5.type.toUpperCase() == "CONTROL") { _4 = _6.length ? dojo._toArray(_6) : null; } else { _4 = _6.getBookmark(); } } else { if (dojo.global.getSelection) { _5 = dojo.global.getSelection(); if (_5) { var _6 = _5.getRangeAt(0); _4 = _6.cloneRange(); } } else { console .debug("No idea how to store the current selection for this browser!"); } } return _4; }, moveToBookmark : function(_7) { var _8 = dojo.doc; if (_8.selection) { var _9; if (dojo.isArray(_7)) { _9 = _8.body.createControlRange(); dojo.forEach(_7, _9.addElement); } else { _9 = _8.selection.createRange(); _9.moveToBookmark(_7); } _9.select(); } else { var _a = dojo.global.getSelection && dojo.global.getSelection(); if (_a && _a.removeAllRanges) { _a.removeAllRanges(); _a.addRange(_7); } else { console .debug("No idea how to restore selection for this browser!"); } } }, getFocus : function(_b, _c) { return { node : _b && dojo.isDescendant(dijit._curFocus, _b.domNode) ? dijit._prevFocus : dijit._curFocus, bookmark : !dojo.withGlobal(_c || dojo.global, dijit.isCollapsed) ? dojo.withGlobal(_c || dojo.global, dijit.getBookmark) : null, openedForWindow : _c }; }, focus : function(_d) { if (!_d) { return; } var _e = "node" in _d ? _d.node : _d, _f = _d.bookmark, _10 = _d.openedForWindow; if (_e) { var _11 = (_e.tagName.toLowerCase() == "iframe") ? _e.contentWindow : _e; if (_11 && _11.focus) { try { _11.focus(); } catch (e) { } } dijit._onFocusNode(_e); } if (_f && dojo.withGlobal(_10 || dojo.global, dijit.isCollapsed)) { if (_10) { _10.focus(); } try { dojo.withGlobal(_10 || dojo.global, moveToBookmark, null, [_f]); } catch (e) { } } }, _activeStack : [], registerWin : function(_12) { if (!_12) { _12 = window; } dojo.connect(_12.document, "onmousedown", null, function(evt) { dijit._justMouseDowned = true; setTimeout(function() { dijit._justMouseDowned = false; }, 0); dijit._onTouchNode(evt.target || evt.srcElement); }); var _14 = _12.document.body || _12.document.getElementsByTagName("body")[0]; if (_14) { if (dojo.isIE) { _14.attachEvent("onactivate", function(evt) { if (evt.srcElement.tagName.toLowerCase() != "body") { dijit._onFocusNode(evt.srcElement); } }); _14.attachEvent("ondeactivate", function(evt) { dijit._onBlurNode(evt.srcElement); }); } else { _14.addEventListener("focus", function(evt) { dijit._onFocusNode(evt.target); }, true); _14.addEventListener("blur", function(evt) { dijit._onBlurNode(evt.target); }, true); } } _14 = null; }, _onBlurNode : function(_19) { dijit._prevFocus = dijit._curFocus; dijit._curFocus = null; var w = dijit.getEnclosingWidget(_19); if (w && w._setStateClass) { w._focused = false; w._setStateClass(); } if (dijit._justMouseDowned) { return; } if (dijit._clearActiveWidgetsTimer) { clearTimeout(dijit._clearActiveWidgetsTimer); } dijit._clearActiveWidgetsTimer = setTimeout(function() { delete dijit._clearActiveWidgetsTimer; dijit._setStack([]); }, 100); }, _onTouchNode : function(_1b) { if (dijit._clearActiveWidgetsTimer) { clearTimeout(dijit._clearActiveWidgetsTimer); delete dijit._clearActiveWidgetsTimer; } var _1c = []; try { while (_1b) { if (_1b.dijitPopupParent) { _1b = dijit.byId(_1b.dijitPopupParent).domNode; } else { if (_1b.tagName && _1b.tagName.toLowerCase() == "body") { if (_1b === dojo.body()) { break; } _1b = dojo.query("iframe").filter(function(_1d) { return _1d.contentDocument.body === _1b; })[0]; } else { var id = _1b.getAttribute && _1b.getAttribute("widgetId"); if (id) { _1c.unshift(id); } _1b = _1b.parentNode; } } } } catch (e) { } dijit._setStack(_1c); }, _onFocusNode : function(_1f) { if (_1f && _1f.tagName && _1f.tagName.toLowerCase() == "body") { return; } dijit._onTouchNode(_1f); if (_1f == dijit._curFocus) { return; } dijit._prevFocus = dijit._curFocus; dijit._curFocus = _1f; dojo.publish("focusNode", [_1f]); var w = dijit.getEnclosingWidget(_1f); if (w && w._setStateClass) { w._focused = true; w._setStateClass(); } }, _setStack : function(_21) { var _22 = dijit._activeStack; dijit._activeStack = _21; for (var _23 = 0; _23 < Math.min(_22.length, _21.length); _23++) { if (_22[_23] != _21[_23]) { break; } } for (var i = _22.length - 1; i >= _23; i--) { var _25 = dijit.byId(_22[i]); if (_25) { dojo.publish("widgetBlur", [_25]); if (_25._onBlur) { _25._onBlur(); } } } for (var i = _23; i < _21.length; i++) { var _25 = dijit.byId(_21[i]); if (_25) { dojo.publish("widgetFocus", [_25]); if (_25._onFocus) { _25._onFocus(); } } } } }); dojo.addOnLoad(dijit.registerWin); } if (!dojo._hasResource["dijit._base.manager"]) { dojo._hasResource["dijit._base.manager"] = true; dojo.provide("dijit._base.manager"); dojo.declare("dijit.WidgetSet", null, { constructor : function() { this._hash = {}; }, add : function(_26) { if (this._hash[_26.id]) { throw new Error("Tried to register widget with id==" + _26.id + " but that id is already registered"); } this._hash[_26.id] = _26; }, remove : function(id) { delete this._hash[id]; }, forEach : function(_28) { for (var id in this._hash) { _28(this._hash[id]); } }, filter : function(_2a) { var res = new dijit.WidgetSet(); this.forEach(function(_2c) { if (_2a(_2c)) { res.add(_2c); } }); return res; }, byId : function(id) { return this._hash[id]; }, byClass : function(cls) { return this.filter(function(_2f) { return _2f.declaredClass == cls; }); } }); dijit.registry = new dijit.WidgetSet(); dijit._widgetTypeCtr = {}; dijit.getUniqueId = function(_30) { var id; do { id = _30 + "_" + (dijit._widgetTypeCtr[_30] !== undefined ? ++dijit._widgetTypeCtr[_30] : dijit._widgetTypeCtr[_30] = 0); } while (dijit.byId(id)); return id; }; if (dojo.isIE) { dojo.addOnUnload(function() { dijit.registry.forEach(function(_32) { _32.destroy(); }); }); } dijit.byId = function(id) { return (dojo.isString(id)) ? dijit.registry.byId(id) : id; }; dijit.byNode = function(_34) { return dijit.registry.byId(_34.getAttribute("widgetId")); }; dijit.getEnclosingWidget = function(_35) { while (_35) { if (_35.getAttribute && _35.getAttribute("widgetId")) { return dijit.registry.byId(_35.getAttribute("widgetId")); } _35 = _35.parentNode; } return null; }; } if (!dojo._hasResource["dijit._base.place"]) { dojo._hasResource["dijit._base.place"] = true; dojo.provide("dijit._base.place"); dijit.getViewport = function() { var _36 = dojo.global; var _37 = dojo.doc; var w = 0, h = 0; if (dojo.isMozilla) { var _3a, _3b, _3c, _3d; if (_37.body.clientWidth > _37.documentElement.clientWidth) { _3a = _37.documentElement.clientWidth; _3c = _37.body.clientWidth; } else { _3c = _37.documentElement.clientWidth; _3a = _37.body.clientWidth; } if (_37.body.clientHeight > _37.documentElement.clientHeight) { _3b = _37.documentElement.clientHeight; _3d = _37.body.clientHeight; } else { _3d = _37.documentElement.clientHeight; _3b = _37.body.clientHeight; } w = (_3c > _36.innerWidth) ? _3a : _3c; h = (_3d > _36.innerHeight) ? _3b : _3d; } else { if (!dojo.isOpera && _36.innerWidth) { w = _36.innerWidth; h = _36.innerHeight; } else { if (dojo.isIE && _37.documentElement && _37.documentElement.clientHeight) { w = _37.documentElement.clientWidth; h = _37.documentElement.clientHeight; } else { if (dojo.body().clientWidth) { w = dojo.body().clientWidth; h = dojo.body().clientHeight; } } } } var _3e = dojo._docScroll(); return { w : w, h : h, l : _3e.x, t : _3e.y }; }; dijit.placeOnScreen = function(_3f, pos, _41, _42) { var _43 = dojo.map(_41, function(_44) { return { corner : _44, pos : pos }; }); return dijit._place(_3f, _43); }; dijit._place = function(_45, _46, _47) { var _48 = dijit.getViewport(); if (!_45.parentNode || String(_45.parentNode.tagName).toLowerCase() != "body") { dojo.body().appendChild(_45); } var _49 = null; for (var i = 0; i < _46.length; i++) { var _4b = _46[i].corner; var pos = _46[i].pos; if (_47) { _47(_4b); } var _4d = _45.style.display; var _4e = _45.style.visibility; _45.style.visibility = "hidden"; _45.style.display = ""; var mb = dojo.marginBox(_45); _45.style.display = _4d; _45.style.visibility = _4e; var _50 = (_4b.charAt(1) == "L" ? pos.x : Math.max(_48.l, pos.x - mb.w)), _51 = (_4b.charAt(0) == "T" ? pos.y : Math.max(_48.t, pos.y - mb.h)), _52 = (_4b.charAt(1) == "L" ? Math.min(_48.l + _48.w, _50 + mb.w) : pos.x), _53 = (_4b.charAt(0) == "T" ? Math.min(_48.t + _48.h, _51 + mb.h) : pos.y), _54 = _52 - _50, _55 = _53 - _51, _56 = (mb.w - _54) + (mb.h - _55); if (_49 == null || _56 < _49.overflow) { _49 = { corner : _4b, aroundCorner : _46[i].aroundCorner, x : _50, y : _51, w : _54, h : _55, overflow : _56 }; } if (_56 == 0) { break; } } _45.style.left = _49.x + "px"; _45.style.top = _49.y + "px"; return _49; }; dijit.placeOnScreenAroundElement = function(_57, _58, _59, _5a) { _58 = dojo.byId(_58); var _5b = _58.style.display; _58.style.display = ""; var _5c = _58.offsetWidth; var _5d = _58.offsetHeight; var _5e = dojo.coords(_58, true); _58.style.display = _5b; var _5f = []; for (var _60 in _59) { _5f.push({ aroundCorner : _60, corner : _59[_60], pos : { x : _5e.x + (_60.charAt(1) == "L" ? 0 : _5c), y : _5e.y + (_60.charAt(0) == "T" ? 0 : _5d) } }); } return dijit._place(_57, _5f, _5a); }; } if (!dojo._hasResource["dijit._base.window"]) { dojo._hasResource["dijit._base.window"] = true; dojo.provide("dijit._base.window"); dijit.getDocumentWindow = function(doc) { if (dojo.isSafari && !doc._parentWindow) { var fix = function(win) { win.document._parentWindow = win; for (var i = 0; i < win.frames.length; i++) { fix(win.frames[i]); } }; fix(window.top); } if (dojo.isIE && window !== document.parentWindow && !doc._parentWindow) { doc.parentWindow.execScript("document._parentWindow = window;", "Javascript"); var win = doc._parentWindow; doc._parentWindow = null; return win; } return doc._parentWindow || doc.parentWindow || doc.defaultView; }; } if (!dojo._hasResource["dijit._base.popup"]) { dojo._hasResource["dijit._base.popup"] = true; dojo.provide("dijit._base.popup"); dijit.popup = new function() { var _66 = [], _67 = 1000, _68 = 1; this.open = function(_69) { var _6a = _69.popup, _6b = _69.orient || { "BL" : "TL", "TL" : "BL" }, _6c = _69.around, id = (_69.around && _69.around.id) ? (_69.around.id + "_dropdown") : ("popup_" + _68++); var _6e = dojo.doc.createElement("div"); _6e.id = id; _6e.className = "dijitPopup"; _6e.style.zIndex = _67 + _66.length; _6e.style.visibility = "hidden"; if (_69.parent) { _6e.dijitPopupParent = _69.parent.id; } dojo.body().appendChild(_6e); _6a.domNode.style.display = ""; _6e.appendChild(_6a.domNode); var _6f = new dijit.BackgroundIframe(_6e); var _70 = _6c ? dijit.placeOnScreenAroundElement(_6e, _6c, _6b, _6a.orient ? dojo.hitch(_6a, "orient") : null) : dijit .placeOnScreen(_6e, _69, _6b == "R" ? ["TR", "BR", "TL", "BL"] : ["TL", "BL", "TR", "BR"]); _6e.style.visibility = "visible"; var _71 = []; function getTopPopup() { for (var pi = _66.length - 1; pi > 0 && _66[pi].parent === _66[pi - 1].widget; pi--) { } return _66[pi]; }; _71.push(dojo.connect(_6e, "onkeypress", this, function(evt) { if (evt.keyCode == dojo.keys.ESCAPE && _69.onCancel) { _69.onCancel(); } else { if (evt.keyCode == dojo.keys.TAB) { dojo.stopEvent(evt); var _74 = getTopPopup(); if (_74 && _74.onCancel) { _74.onCancel(); } } } })); if (_6a.onCancel) { _71.push(dojo.connect(_6a, "onCancel", null, _69.onCancel)); } _71.push(dojo.connect(_6a, _6a.onExecute ? "onExecute" : "onChange", null, function() { var _75 = getTopPopup(); if (_75 && _75.onExecute) { _75.onExecute(); } })); _66.push({ wrapper : _6e, iframe : _6f, widget : _6a, parent : _69.parent, onExecute : _69.onExecute, onCancel : _69.onCancel, onClose : _69.onClose, handlers : _71 }); if (_6a.onOpen) { _6a.onOpen(_70); } return _70; }; this.close = function(_76) { while (dojo.some(_66, function(_77) { return _77.widget == _76; })) { var top = _66.pop(), _79 = top.wrapper, _7a = top.iframe, _7b = top.widget, _7c = top.onClose; if (_7b.onClose) { _7b.onClose(); } dojo.forEach(top.handlers, dojo.disconnect); if (!_7b || !_7b.domNode) { return; } dojo.style(_7b.domNode, "display", "none"); dojo.body().appendChild(_7b.domNode); _7a.destroy(); dojo._destroyElement(_79); if (_7c) { _7c(); } } }; }(); dijit._frames = new function() { var _7d = []; this.pop = function() { var _7e; if (_7d.length) { _7e = _7d.pop(); _7e.style.display = ""; } else { if (dojo.isIE) { var _7f = "