diff options
author | Andrew Dolgov <[email protected]> | 2012-08-14 18:59:10 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2012-08-14 18:59:18 +0400 |
commit | 1354d17270961fff662d40f90521223f8fd0d73b (patch) | |
tree | e9266be71587e47c800303446e968a6d3565e2cf /lib/dijit/Dialog.js | |
parent | d04f8c826f5283765f52cf6b98b42a1ed8f2d6bc (diff) |
update dojo to 1.7.3
Diffstat (limited to 'lib/dijit/Dialog.js')
-rw-r--r-- | lib/dijit/Dialog.js | 613 |
1 files changed, 2 insertions, 611 deletions
diff --git a/lib/dijit/Dialog.js b/lib/dijit/Dialog.js index 22d2dbedf..919f4b551 100644 --- a/lib/dijit/Dialog.js +++ b/lib/dijit/Dialog.js @@ -1,611 +1,2 @@ -/* - Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved. - Available via Academic Free License >= 2.1 OR the modified BSD license. - see: http://dojotoolkit.org/license for details -*/ - - -if(!dojo._hasResource["dijit.Dialog"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. -dojo._hasResource["dijit.Dialog"] = true; -dojo.provide("dijit.Dialog"); -dojo.require("dojo.dnd.move"); -dojo.require("dojo.dnd.TimedMoveable"); -dojo.require("dojo.fx"); -dojo.require("dojo.window"); -dojo.require("dijit._Widget"); -dojo.require("dijit._Templated"); -dojo.require("dijit._CssStateMixin"); -dojo.require("dijit.form._FormMixin"); -dojo.require("dijit._DialogMixin"); -dojo.require("dijit.DialogUnderlay"); -dojo.require("dijit.layout.ContentPane"); -dojo.requireLocalization("dijit", "common", null, "ROOT,ar,ca,cs,da,de,el,es,fi,fr,he,hu,it,ja,kk,ko,nb,nl,pl,pt,pt-pt,ro,ru,sk,sl,sv,th,tr,zh,zh-tw"); -dojo.require("dijit.TooltipDialog"); - - -// dijit/TooltipDialog required for back-compat. TODO: remove in 2.0 - -/*===== -dijit._underlay = function(kwArgs){ - // summary: - // A shared instance of a `dijit.DialogUnderlay` - // - // description: - // A shared instance of a `dijit.DialogUnderlay` created and - // used by `dijit.Dialog`, though never created until some Dialog - // or subclass thereof is shown. -}; -=====*/ -dojo.declare( - "dijit._DialogBase", - [dijit._Templated, dijit.form._FormMixin, dijit._DialogMixin, dijit._CssStateMixin], - { - // summary: - // A modal dialog Widget - // - // description: - // Pops up a modal dialog window, blocking access to the screen - // and also graying out the screen Dialog is extended from - // ContentPane so it supports all the same parameters (href, etc.) - // - // example: - // | <div dojoType="dijit.Dialog" href="test.html"></div> - // - // example: - // | var foo = new dijit.Dialog({ title: "test dialog", content: "test content" }; - // | dojo.body().appendChild(foo.domNode); - // | foo.startup(); - - templateString: dojo.cache("dijit", "templates/Dialog.html", "<div class=\"dijitDialog\" role=\"dialog\" aria-labelledby=\"${id}_title\">\n\t<div dojoAttachPoint=\"titleBar\" class=\"dijitDialogTitleBar\">\n\t<span dojoAttachPoint=\"titleNode\" class=\"dijitDialogTitle\" id=\"${id}_title\"></span>\n\t<span dojoAttachPoint=\"closeButtonNode\" class=\"dijitDialogCloseIcon\" dojoAttachEvent=\"ondijitclick: onCancel\" title=\"${buttonCancel}\" role=\"button\" tabIndex=\"-1\">\n\t\t<span dojoAttachPoint=\"closeText\" class=\"closeText\" title=\"${buttonCancel}\">x</span>\n\t</span>\n\t</div>\n\t\t<div dojoAttachPoint=\"containerNode\" class=\"dijitDialogPaneContent\"></div>\n</div>\n"), - - baseClass: "dijitDialog", - - cssStateNodes: { - closeButtonNode: "dijitDialogCloseIcon" - }, - - attributeMap: dojo.delegate(dijit._Widget.prototype.attributeMap, { - title: [ - { node: "titleNode", type: "innerHTML" }, - { node: "titleBar", type: "attribute" } - ], - "aria-describedby":"" - }), - - // open: [readonly] Boolean - // True if Dialog is currently displayed on screen. - open: false, - - // duration: Integer - // The time in milliseconds it takes the dialog to fade in and out - duration: dijit.defaultDuration, - - // refocus: Boolean - // A Toggle to modify the default focus behavior of a Dialog, which - // is to re-focus the element which had focus before being opened. - // False will disable refocusing. Default: true - refocus: true, - - // autofocus: Boolean - // A Toggle to modify the default focus behavior of a Dialog, which - // is to focus on the first dialog element after opening the dialog. - // False will disable autofocusing. Default: true - autofocus: true, - - // _firstFocusItem: [private readonly] DomNode - // The pointer to the first focusable node in the dialog. - // Set by `dijit._DialogMixin._getFocusItems`. - _firstFocusItem: null, - - // _lastFocusItem: [private readonly] DomNode - // The pointer to which node has focus prior to our dialog. - // Set by `dijit._DialogMixin._getFocusItems`. - _lastFocusItem: null, - - // doLayout: [protected] Boolean - // Don't change this parameter from the default value. - // This ContentPane parameter doesn't make sense for Dialog, since Dialog - // is never a child of a layout container, nor can you specify the size of - // Dialog in order to control the size of an inner widget. - doLayout: false, - - // draggable: Boolean - // Toggles the moveable aspect of the Dialog. If true, Dialog - // can be dragged by it's title. If false it will remain centered - // in the viewport. - draggable: true, - - //aria-describedby: String - // Allows the user to add an aria-describedby attribute onto the dialog. The value should - // be the id of the container element of text that describes the dialog purpose (usually - // the first text in the dialog). - // <div dojoType="dijit.Dialog" aria-describedby="intro" .....> - // <div id="intro">Introductory text</div> - // <div>rest of dialog contents</div> - // </div> - "aria-describedby":"", - - postMixInProperties: function(){ - var _nlsResources = dojo.i18n.getLocalization("dijit", "common"); - dojo.mixin(this, _nlsResources); - this.inherited(arguments); - }, - - postCreate: function(){ - dojo.style(this.domNode, { - display: "none", - position:"absolute" - }); - dojo.body().appendChild(this.domNode); - - this.inherited(arguments); - - this.connect(this, "onExecute", "hide"); - this.connect(this, "onCancel", "hide"); - this._modalconnects = []; - }, - - onLoad: function(){ - // summary: - // Called when data has been loaded from an href. - // Unlike most other callbacks, this function can be connected to (via `dojo.connect`) - // but should *not* be overridden. - // tags: - // callback - - // when href is specified we need to reposition the dialog after the data is loaded - // and find the focusable elements - this._position(); - if(this.autofocus && dijit._DialogLevelManager.isTop(this)){ - this._getFocusItems(this.domNode); - dijit.focus(this._firstFocusItem); - } - this.inherited(arguments); - }, - - _endDrag: function(e){ - // summary: - // Called after dragging the Dialog. Saves the position of the dialog in the viewport. - // tags: - // private - if(e && e.node && e.node === this.domNode){ - this._relativePosition = dojo.position(e.node); - } - }, - - _setup: function(){ - // summary: - // Stuff we need to do before showing the Dialog for the first - // time (but we defer it until right beforehand, for - // performance reasons). - // tags: - // private - - var node = this.domNode; - - if(this.titleBar && this.draggable){ - this._moveable = (dojo.isIE == 6) ? - new dojo.dnd.TimedMoveable(node, { handle: this.titleBar }) : // prevent overload, see #5285 - new dojo.dnd.Moveable(node, { handle: this.titleBar, timeout: 0 }); - this._dndListener = dojo.subscribe("/dnd/move/stop",this,"_endDrag"); - }else{ - dojo.addClass(node,"dijitDialogFixed"); - } - - this.underlayAttrs = { - dialogId: this.id, - "class": dojo.map(this["class"].split(/\s/), function(s){ return s+"_underlay"; }).join(" ") - }; - }, - - _size: function(){ - // summary: - // If necessary, shrink dialog contents so dialog fits in viewport - // tags: - // private - - this._checkIfSingleChild(); - - // If we resized the dialog contents earlier, reset them back to original size, so - // that if the user later increases the viewport size, the dialog can display w/out a scrollbar. - // Need to do this before the dojo.marginBox(this.domNode) call below. - if(this._singleChild){ - if(this._singleChildOriginalStyle){ - this._singleChild.domNode.style.cssText = this._singleChildOriginalStyle; - } - delete this._singleChildOriginalStyle; - }else{ - dojo.style(this.containerNode, { - width:"auto", - height:"auto" - }); - } - - var mb = dojo._getMarginSize(this.domNode); - var viewport = dojo.window.getBox(); - if(mb.w >= viewport.w || mb.h >= viewport.h){ - // Reduce size of dialog contents so that dialog fits in viewport - - var w = Math.min(mb.w, Math.floor(viewport.w * 0.75)), - h = Math.min(mb.h, Math.floor(viewport.h * 0.75)); - - if(this._singleChild && this._singleChild.resize){ - this._singleChildOriginalStyle = this._singleChild.domNode.style.cssText; - this._singleChild.resize({w: w, h: h}); - }else{ - dojo.style(this.containerNode, { - width: w + "px", - height: h + "px", - overflow: "auto", - position: "relative" // workaround IE bug moving scrollbar or dragging dialog - }); - } - }else{ - if(this._singleChild && this._singleChild.resize){ - this._singleChild.resize(); - } - } - }, - - _position: function(){ - // summary: - // Position modal dialog in the viewport. If no relative offset - // in the viewport has been determined (by dragging, for instance), - // center the node. Otherwise, use the Dialog's stored relative offset, - // and position the node to top: left: values based on the viewport. - // tags: - // private - if(!dojo.hasClass(dojo.body(),"dojoMove")){ - var node = this.domNode, - viewport = dojo.window.getBox(), - p = this._relativePosition, - bb = p ? null : dojo._getBorderBox(node), - l = Math.floor(viewport.l + (p ? p.x : (viewport.w - bb.w) / 2)), - t = Math.floor(viewport.t + (p ? p.y : (viewport.h - bb.h) / 2)) - ; - dojo.style(node,{ - left: l + "px", - top: t + "px" - }); - } - }, - - _onKey: function(/*Event*/ evt){ - // summary: - // Handles the keyboard events for accessibility reasons - // tags: - // private - - if(evt.charOrCode){ - var dk = dojo.keys; - var node = evt.target; - if(evt.charOrCode === dk.TAB){ - this._getFocusItems(this.domNode); - } - var singleFocusItem = (this._firstFocusItem == this._lastFocusItem); - // see if we are shift-tabbing from first focusable item on dialog - if(node == this._firstFocusItem && evt.shiftKey && evt.charOrCode === dk.TAB){ - if(!singleFocusItem){ - dijit.focus(this._lastFocusItem); // send focus to last item in dialog - } - dojo.stopEvent(evt); - }else if(node == this._lastFocusItem && evt.charOrCode === dk.TAB && !evt.shiftKey){ - if(!singleFocusItem){ - dijit.focus(this._firstFocusItem); // send focus to first item in dialog - } - dojo.stopEvent(evt); - }else{ - // see if the key is for the dialog - while(node){ - if(node == this.domNode || dojo.hasClass(node, "dijitPopup")){ - if(evt.charOrCode == dk.ESCAPE){ - this.onCancel(); - }else{ - return; // just let it go - } - } - node = node.parentNode; - } - // this key is for the disabled document window - if(evt.charOrCode !== dk.TAB){ // allow tabbing into the dialog for a11y - dojo.stopEvent(evt); - // opera won't tab to a div - }else if(!dojo.isOpera){ - try{ - this._firstFocusItem.focus(); - }catch(e){ /*squelch*/ } - } - } - } - }, - - show: function(){ - // summary: - // Display the dialog - // returns: dojo.Deferred - // Deferred object that resolves when the display animation is complete - - if(this.open){ return; } - - if(!this._started){ - this.startup(); - } - - // first time we show the dialog, there's some initialization stuff to do - if(!this._alreadyInitialized){ - this._setup(); - this._alreadyInitialized=true; - } - - if(this._fadeOutDeferred){ - this._fadeOutDeferred.cancel(); - } - - this._modalconnects.push(dojo.connect(window, "onscroll", this, "layout")); - this._modalconnects.push(dojo.connect(window, "onresize", this, function(){ - // IE gives spurious resize events and can actually get stuck - // in an infinite loop if we don't ignore them - var viewport = dojo.window.getBox(); - if(!this._oldViewport || - viewport.h != this._oldViewport.h || - viewport.w != this._oldViewport.w){ - this.layout(); - this._oldViewport = viewport; - } - })); - this._modalconnects.push(dojo.connect(this.domNode, "onkeypress", this, "_onKey")); - - dojo.style(this.domNode, { - opacity:0, - display:"" - }); - - this._set("open", true); - this._onShow(); // lazy load trigger - - this._size(); - this._position(); - - // fade-in Animation object, setup below - var fadeIn; - - this._fadeInDeferred = new dojo.Deferred(dojo.hitch(this, function(){ - fadeIn.stop(); - delete this._fadeInDeferred; - })); - - fadeIn = dojo.fadeIn({ - node: this.domNode, - duration: this.duration, - beforeBegin: dojo.hitch(this, function(){ - dijit._DialogLevelManager.show(this, this.underlayAttrs); - }), - onEnd: dojo.hitch(this, function(){ - if(this.autofocus && dijit._DialogLevelManager.isTop(this)){ - // find focusable items each time dialog is shown since if dialog contains a widget the - // first focusable items can change - this._getFocusItems(this.domNode); - dijit.focus(this._firstFocusItem); - } - this._fadeInDeferred.callback(true); - delete this._fadeInDeferred; - }) - }).play(); - - return this._fadeInDeferred; - }, - - hide: function(){ - // summary: - // Hide the dialog - // returns: dojo.Deferred - // Deferred object that resolves when the hide animation is complete - - // if we haven't been initialized yet then we aren't showing and we can just return - if(!this._alreadyInitialized){ - return; - } - if(this._fadeInDeferred){ - this._fadeInDeferred.cancel(); - } - - // fade-in Animation object, setup below - var fadeOut; - - this._fadeOutDeferred = new dojo.Deferred(dojo.hitch(this, function(){ - fadeOut.stop(); - delete this._fadeOutDeferred; - })); - - fadeOut = dojo.fadeOut({ - node: this.domNode, - duration: this.duration, - onEnd: dojo.hitch(this, function(){ - this.domNode.style.display = "none"; - dijit._DialogLevelManager.hide(this); - this.onHide(); - this._fadeOutDeferred.callback(true); - delete this._fadeOutDeferred; - }) - }).play(); - - if(this._scrollConnected){ - this._scrollConnected = false; - } - dojo.forEach(this._modalconnects, dojo.disconnect); - this._modalconnects = []; - - if(this._relativePosition){ - delete this._relativePosition; - } - this._set("open", false); - - return this._fadeOutDeferred; - }, - - layout: function(){ - // summary: - // Position the Dialog and the underlay - // tags: - // private - if(this.domNode.style.display != "none"){ - if(dijit._underlay){ // avoid race condition during show() - dijit._underlay.layout(); - } - this._position(); - } - }, - - destroy: function(){ - if(this._fadeInDeferred){ - this._fadeInDeferred.cancel(); - } - if(this._fadeOutDeferred){ - this._fadeOutDeferred.cancel(); - } - if(this._moveable){ - this._moveable.destroy(); - } - if(this._dndListener){ - dojo.unsubscribe(this._dndListener); - } - dojo.forEach(this._modalconnects, dojo.disconnect); - - dijit._DialogLevelManager.hide(this); - - this.inherited(arguments); - } - } -); - -dojo.declare( - "dijit.Dialog", - [dijit.layout.ContentPane, dijit._DialogBase], - {} -); - -dijit._DialogLevelManager = { - // summary: - // Controls the various active "levels" on the page, starting with the - // stuff initially visible on the page (at z-index 0), and then having an entry for - // each Dialog shown. - - show: function(/*dijit._Widget*/ dialog, /*Object*/ underlayAttrs){ - // summary: - // Call right before fade-in animation for new dialog. - // Saves current focus, displays/adjusts underlay for new dialog, - // and sets the z-index of the dialog itself. - // - // New dialog will be displayed on top of all currently displayed dialogs. - // - // Caller is responsible for setting focus in new dialog after the fade-in - // animation completes. - - var ds = dijit._dialogStack; - - // Save current focus - ds[ds.length-1].focus = dijit.getFocus(dialog); - - // Display the underlay, or if already displayed then adjust for this new dialog - var underlay = dijit._underlay; - if(!underlay || underlay._destroyed){ - underlay = dijit._underlay = new dijit.DialogUnderlay(underlayAttrs); - }else{ - underlay.set(dialog.underlayAttrs); - } - - // Set z-index a bit above previous dialog - var zIndex = ds[ds.length-1].dialog ? ds[ds.length-1].zIndex + 2 : 950; - if(ds.length == 1){ // first dialog - underlay.show(); - } - dojo.style(dijit._underlay.domNode, 'zIndex', zIndex - 1); - - // Dialog - dojo.style(dialog.domNode, 'zIndex', zIndex); - - ds.push({dialog: dialog, underlayAttrs: underlayAttrs, zIndex: zIndex}); - }, - - hide: function(/*dijit._Widget*/ dialog){ - // summary: - // Called when the specified dialog is hidden/destroyed, after the fade-out - // animation ends, in order to reset page focus, fix the underlay, etc. - // If the specified dialog isn't open then does nothing. - // - // Caller is responsible for either setting display:none on the dialog domNode, - // or calling dijit.popup.hide(), or removing it from the page DOM. - - var ds = dijit._dialogStack; - - if(ds[ds.length-1].dialog == dialog){ - // Removing the top (or only) dialog in the stack, return focus - // to previous dialog - - ds.pop(); - - var pd = ds[ds.length-1]; // the new active dialog (or the base page itself) - - // Adjust underlay - if(ds.length == 1){ - // Returning to original page. - // Hide the underlay, unless the underlay widget has already been destroyed - // because we are being called during page unload (when all widgets are destroyed) - if(!dijit._underlay._destroyed){ - dijit._underlay.hide(); - } - }else{ - // Popping back to previous dialog, adjust underlay - dojo.style(dijit._underlay.domNode, 'zIndex', pd.zIndex - 1); - dijit._underlay.set(pd.underlayAttrs); - } - - // Adjust focus - if(dialog.refocus){ - // If we are returning control to a previous dialog but for some reason - // that dialog didn't have a focused field, set focus to first focusable item. - // This situation could happen if two dialogs appeared at nearly the same time, - // since a dialog doesn't set it's focus until the fade-in is finished. - var focus = pd.focus; - if(!focus || (pd.dialog && !dojo.isDescendant(focus.node, pd.dialog.domNode))){ - pd.dialog._getFocusItems(pd.dialog.domNode); - focus = pd.dialog._firstFocusItem; - } - - try{ - dijit.focus(focus); - }catch(e){ - /* focus() will fail if user opened the dialog by clicking a non-focusable element */ - } - } - }else{ - // Removing a dialog out of order (#9944, #10705). - // Don't need to mess with underlay or z-index or anything. - var idx = dojo.indexOf(dojo.map(ds, function(elem){return elem.dialog}), dialog); - if(idx != -1){ - ds.splice(idx, 1); - } - } - }, - - isTop: function(/*dijit._Widget*/ dialog){ - // summary: - // Returns true if specified Dialog is the top in the task - var ds = dijit._dialogStack; - return ds[ds.length-1].dialog == dialog; - } -}; - -// Stack representing the various active "levels" on the page, starting with the -// stuff initially visible on the page (at z-index 0), and then having an entry for -// each Dialog shown. -// Each element in stack has form { -// dialog: dialogWidget, -// focus: returnFromGetFocus(), -// underlayAttrs: attributes to set on underlay (when this widget is active) -// } -dijit._dialogStack = [ - {dialog: null, focus: null, underlayAttrs: null} // entry for stuff at z-index: 0 -]; - -} +//>>built +require({cache:{"url:dijit/templates/Dialog.html":"<div class=\"dijitDialog\" role=\"dialog\" aria-labelledby=\"${id}_title\">\n\t<div data-dojo-attach-point=\"titleBar\" class=\"dijitDialogTitleBar\">\n\t<span data-dojo-attach-point=\"titleNode\" class=\"dijitDialogTitle\" id=\"${id}_title\"></span>\n\t<span data-dojo-attach-point=\"closeButtonNode\" class=\"dijitDialogCloseIcon\" data-dojo-attach-event=\"ondijitclick: onCancel\" title=\"${buttonCancel}\" role=\"button\" tabIndex=\"-1\">\n\t\t<span data-dojo-attach-point=\"closeText\" class=\"closeText\" title=\"${buttonCancel}\">x</span>\n\t</span>\n\t</div>\n\t\t<div data-dojo-attach-point=\"containerNode\" class=\"dijitDialogPaneContent\"></div>\n</div>\n"}});define("dijit/Dialog",["require","dojo/_base/array","dojo/_base/connect","dojo/_base/declare","dojo/_base/Deferred","dojo/dom","dojo/dom-class","dojo/dom-geometry","dojo/dom-style","dojo/_base/event","dojo/_base/fx","dojo/i18n","dojo/_base/kernel","dojo/keys","dojo/_base/lang","dojo/on","dojo/ready","dojo/_base/sniff","dojo/_base/window","dojo/window","dojo/dnd/Moveable","dojo/dnd/TimedMoveable","./focus","./_base/manager","./_Widget","./_TemplatedMixin","./_CssStateMixin","./form/_FormMixin","./_DialogMixin","./DialogUnderlay","./layout/ContentPane","dojo/text!./templates/Dialog.html",".","dojo/i18n!./nls/common"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,fx,_b,_c,_d,_e,on,_f,has,win,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_1a,_1b,_1c,_1d){var _1e=_4("dijit._DialogBase",[_16,_18,_19,_17],{templateString:_1c,baseClass:"dijitDialog",cssStateNodes:{closeButtonNode:"dijitDialogCloseIcon"},_setTitleAttr:[{node:"titleNode",type:"innerHTML"},{node:"titleBar",type:"attribute"}],open:false,duration:_14.defaultDuration,refocus:true,autofocus:true,_firstFocusItem:null,_lastFocusItem:null,doLayout:false,draggable:true,"aria-describedby":"",postMixInProperties:function(){var _1f=_b.getLocalization("dijit","common");_e.mixin(this,_1f);this.inherited(arguments);},postCreate:function(){_9.set(this.domNode,{display:"none",position:"absolute"});win.body().appendChild(this.domNode);this.inherited(arguments);this.connect(this,"onExecute","hide");this.connect(this,"onCancel","hide");this._modalconnects=[];},onLoad:function(){this._position();if(this.autofocus&&_20.isTop(this)){this._getFocusItems(this.domNode);_13.focus(this._firstFocusItem);}this.inherited(arguments);},_endDrag:function(){var _21=_8.position(this.domNode),_22=_10.getBox();_21.y=Math.min(Math.max(_21.y,0),(_22.h-_21.h));_21.x=Math.min(Math.max(_21.x,0),(_22.w-_21.w));this._relativePosition=_21;this._position();},_setup:function(){var _23=this.domNode;if(this.titleBar&&this.draggable){this._moveable=new ((has("ie")==6)?_12:_11)(_23,{handle:this.titleBar});this.connect(this._moveable,"onMoveStop","_endDrag");}else{_7.add(_23,"dijitDialogFixed");}this.underlayAttrs={dialogId:this.id,"class":_2.map(this["class"].split(/\s/),function(s){return s+"_underlay";}).join(" ")};},_size:function(){this._checkIfSingleChild();if(this._singleChild){if(this._singleChildOriginalStyle){this._singleChild.domNode.style.cssText=this._singleChildOriginalStyle;}delete this._singleChildOriginalStyle;}else{_9.set(this.containerNode,{width:"auto",height:"auto"});}var bb=_8.position(this.domNode);var _24=_10.getBox();if(bb.w>=_24.w||bb.h>=_24.h){var w=Math.min(bb.w,Math.floor(_24.w*0.75)),h=Math.min(bb.h,Math.floor(_24.h*0.75));if(this._singleChild&&this._singleChild.resize){this._singleChildOriginalStyle=this._singleChild.domNode.style.cssText;this._singleChild.resize({w:w,h:h});}else{_9.set(this.containerNode,{width:w+"px",height:h+"px",overflow:"auto",position:"relative"});}}else{if(this._singleChild&&this._singleChild.resize){this._singleChild.resize();}}},_position:function(){if(!_7.contains(win.body(),"dojoMove")){var _25=this.domNode,_26=_10.getBox(),p=this._relativePosition,bb=p?null:_8.position(_25),l=Math.floor(_26.l+(p?p.x:(_26.w-bb.w)/2)),t=Math.floor(_26.t+(p?p.y:(_26.h-bb.h)/2));_9.set(_25,{left:l+"px",top:t+"px"});}},_onKey:function(evt){if(evt.charOrCode){var _27=evt.target;if(evt.charOrCode===_d.TAB){this._getFocusItems(this.domNode);}var _28=(this._firstFocusItem==this._lastFocusItem);if(_27==this._firstFocusItem&&evt.shiftKey&&evt.charOrCode===_d.TAB){if(!_28){_13.focus(this._lastFocusItem);}_a.stop(evt);}else{if(_27==this._lastFocusItem&&evt.charOrCode===_d.TAB&&!evt.shiftKey){if(!_28){_13.focus(this._firstFocusItem);}_a.stop(evt);}else{while(_27){if(_27==this.domNode||_7.contains(_27,"dijitPopup")){if(evt.charOrCode==_d.ESCAPE){this.onCancel();}else{return;}}_27=_27.parentNode;}if(evt.charOrCode!==_d.TAB){_a.stop(evt);}else{if(!has("opera")){try{this._firstFocusItem.focus();}catch(e){}}}}}}},show:function(){if(this.open){return;}if(!this._started){this.startup();}if(!this._alreadyInitialized){this._setup();this._alreadyInitialized=true;}if(this._fadeOutDeferred){this._fadeOutDeferred.cancel();}this._modalconnects.push(on(window,"scroll",_e.hitch(this,"layout")));this._modalconnects.push(on(window,"resize",_e.hitch(this,function(){var _29=_10.getBox();if(!this._oldViewport||_29.h!=this._oldViewport.h||_29.w!=this._oldViewport.w){this.layout();this._oldViewport=_29;}})));this._modalconnects.push(on(this.domNode,_3._keypress,_e.hitch(this,"_onKey")));_9.set(this.domNode,{opacity:0,display:""});this._set("open",true);this._onShow();this._size();this._position();var _2a;this._fadeInDeferred=new _5(_e.hitch(this,function(){_2a.stop();delete this._fadeInDeferred;}));_2a=fx.fadeIn({node:this.domNode,duration:this.duration,beforeBegin:_e.hitch(this,function(){_20.show(this,this.underlayAttrs);}),onEnd:_e.hitch(this,function(){if(this.autofocus&&_20.isTop(this)){this._getFocusItems(this.domNode);_13.focus(this._firstFocusItem);}this._fadeInDeferred.callback(true);delete this._fadeInDeferred;})}).play();return this._fadeInDeferred;},hide:function(){if(!this._alreadyInitialized){return;}if(this._fadeInDeferred){this._fadeInDeferred.cancel();}var _2b;this._fadeOutDeferred=new _5(_e.hitch(this,function(){_2b.stop();delete this._fadeOutDeferred;}));this._fadeOutDeferred.then(_e.hitch(this,"onHide"));_2b=fx.fadeOut({node:this.domNode,duration:this.duration,onEnd:_e.hitch(this,function(){this.domNode.style.display="none";_20.hide(this);this._fadeOutDeferred.callback(true);delete this._fadeOutDeferred;})}).play();if(this._scrollConnected){this._scrollConnected=false;}var h;while(h=this._modalconnects.pop()){h.remove();}if(this._relativePosition){delete this._relativePosition;}this._set("open",false);return this._fadeOutDeferred;},layout:function(){if(this.domNode.style.display!="none"){if(_1d._underlay){_1d._underlay.layout();}this._position();}},destroy:function(){if(this._fadeInDeferred){this._fadeInDeferred.cancel();}if(this._fadeOutDeferred){this._fadeOutDeferred.cancel();}if(this._moveable){this._moveable.destroy();}var h;while(h=this._modalconnects.pop()){h.remove();}_20.hide(this);this.inherited(arguments);}});var _2c=_4("dijit.Dialog",[_1b,_1e],{});_2c._DialogBase=_1e;var _20=_2c._DialogLevelManager={_beginZIndex:950,show:function(_2d,_2e){ds[ds.length-1].focus=_13.curNode;var _2f=_1d._underlay;if(!_2f||_2f._destroyed){_2f=_1d._underlay=new _1a(_2e);}else{_2f.set(_2d.underlayAttrs);}var _30=ds[ds.length-1].dialog?ds[ds.length-1].zIndex+2:_2c._DialogLevelManager._beginZIndex;if(ds.length==1){_2f.show();}_9.set(_1d._underlay.domNode,"zIndex",_30-1);_9.set(_2d.domNode,"zIndex",_30);ds.push({dialog:_2d,underlayAttrs:_2e,zIndex:_30});},hide:function(_31){if(ds[ds.length-1].dialog==_31){ds.pop();var pd=ds[ds.length-1];if(ds.length==1){if(!_1d._underlay._destroyed){_1d._underlay.hide();}}else{_9.set(_1d._underlay.domNode,"zIndex",pd.zIndex-1);_1d._underlay.set(pd.underlayAttrs);}if(_31.refocus){var _32=pd.focus;if(pd.dialog&&(!_32||!_6.isDescendant(_32,pd.dialog.domNode))){pd.dialog._getFocusItems(pd.dialog.domNode);_32=pd.dialog._firstFocusItem;}if(_32){try{_32.focus();}catch(e){}}}}else{var idx=_2.indexOf(_2.map(ds,function(_33){return _33.dialog;}),_31);if(idx!=-1){ds.splice(idx,1);}}},isTop:function(_34){return ds[ds.length-1].dialog==_34;}};var ds=_2c._dialogStack=[{dialog:null,focus:null,underlayAttrs:null}];if(!_c.isAsync){_f(0,function(){var _35=["dijit/TooltipDialog"];_1(_35);});}return _2c;});
\ No newline at end of file |