| 1 |
define([ |
| 2 |
"require", |
| 3 |
"dojo/_base/array", |
| 4 |
"dojo/aspect", |
| 5 |
"dojo/_base/declare", |
| 6 |
"dojo/Deferred", |
| 7 |
"dojo/dom", |
| 8 |
"dojo/dom-class", |
| 9 |
"dojo/dom-geometry", |
| 10 |
"dojo/dom-style", |
| 11 |
"dojo/_base/fx", |
| 12 |
"dojo/i18n", |
| 13 |
"dojo/keys", |
| 14 |
"dojo/_base/lang", |
| 15 |
"dojo/on", |
| 16 |
"dojo/ready", |
| 17 |
"dojo/sniff", |
| 18 |
"dojo/touch", |
| 19 |
"dojo/window", |
| 20 |
"dojo/dnd/Moveable", |
| 21 |
"dojo/dnd/TimedMoveable", |
| 22 |
"./focus", |
| 23 |
"./_base/manager", |
| 24 |
"./_Widget", |
| 25 |
"./_TemplatedMixin", |
| 26 |
"./_CssStateMixin", |
| 27 |
"./form/_FormMixin", |
| 28 |
"./_DialogMixin", |
| 29 |
"./DialogUnderlay", |
| 30 |
"./layout/ContentPane", |
| 31 |
"./layout/utils", |
| 32 |
"dojo/text!./templates/Dialog.html", |
| 33 |
"./a11yclick", |
| 34 |
"dojo/i18n!./nls/common" |
| 35 |
], function(require, array, aspect, declare, Deferred, |
| 36 |
dom, domClass, domGeometry, domStyle, fx, i18n, keys, lang, on, ready, has, touch, winUtils, |
| 37 |
Moveable, TimedMoveable, focus, manager, _Widget, _TemplatedMixin, _CssStateMixin, _FormMixin, _DialogMixin, |
| 38 |
DialogUnderlay, ContentPane, utils, template){ |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
var resolvedDeferred = new Deferred(); |
| 44 |
resolvedDeferred.resolve(true); |
| 45 |
|
| 46 |
function nop(){} |
| 47 |
|
| 48 |
var _DialogBase = declare("dijit._DialogBase" + (has("dojo-bidi") ? "_NoBidi" : ""), [_TemplatedMixin, _FormMixin, _DialogMixin, _CssStateMixin], { |
| 49 |
templateString: template, |
| 50 |
|
| 51 |
baseClass: "dijitDialog", |
| 52 |
|
| 53 |
cssStateNodes: { |
| 54 |
closeButtonNode: "dijitDialogCloseIcon" |
| 55 |
}, |
| 56 |
|
| 57 |
|
| 58 |
_setTitleAttr: { node: "titleNode", type: "innerHTML" }, |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
open: false, |
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
duration: manager.defaultDuration, |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
refocus: true, |
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
autofocus: true, |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
_firstFocusItem: null, |
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
_lastFocusItem: null, |
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
draggable: true, |
| 95 |
_setDraggableAttr: function( val){ |
| 96 |
|
| 97 |
|
| 98 |
this._set("draggable", val); |
| 99 |
}, |
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
maxRatio: 0.9, |
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
closable: true, |
| 108 |
_setClosableAttr: function(val){ |
| 109 |
this.closeButtonNode.style.display = val ? "" : "none"; |
| 110 |
this._set("closable", val); |
| 111 |
}, |
| 112 |
|
| 113 |
postMixInProperties: function(){ |
| 114 |
var _nlsResources = i18n.getLocalization("dijit", "common"); |
| 115 |
lang.mixin(this, _nlsResources); |
| 116 |
this.inherited(arguments); |
| 117 |
}, |
| 118 |
|
| 119 |
postCreate: function(){ |
| 120 |
domStyle.set(this.domNode, { |
| 121 |
display: "none", |
| 122 |
position: "absolute" |
| 123 |
}); |
| 124 |
this.ownerDocumentBody.appendChild(this.domNode); |
| 125 |
|
| 126 |
this.inherited(arguments); |
| 127 |
|
| 128 |
aspect.after(this, "onExecute", lang.hitch(this, "hide"), true); |
| 129 |
aspect.after(this, "onCancel", lang.hitch(this, "hide"), true); |
| 130 |
on(this.closeButtonNode, touch.press, function(e){ |
| 131 |
e.stopPropagation(); |
| 132 |
}); |
| 133 |
|
| 134 |
this._modalconnects = []; |
| 135 |
}, |
| 136 |
|
| 137 |
onLoad: function(){ |
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
this.resize(); |
| 148 |
this._position(); |
| 149 |
|
| 150 |
if(this.autofocus && DialogLevelManager.isTop(this)){ |
| 151 |
this._getFocusItems(); |
| 152 |
focus.focus(this._firstFocusItem); |
| 153 |
} |
| 154 |
|
| 155 |
this.inherited(arguments); |
| 156 |
}, |
| 157 |
|
| 158 |
focus: function(){ |
| 159 |
this._getFocusItems(); |
| 160 |
focus.focus(this._firstFocusItem); |
| 161 |
}, |
| 162 |
|
| 163 |
_endDrag: function(){ |
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
var nodePosition = domGeometry.position(this.domNode), |
| 168 |
viewport = winUtils.getBox(this.ownerDocument); |
| 169 |
nodePosition.y = Math.min(Math.max(nodePosition.y, 0), (viewport.h - nodePosition.h)); |
| 170 |
nodePosition.x = Math.min(Math.max(nodePosition.x, 0), (viewport.w - nodePosition.w)); |
| 171 |
this._relativePosition = nodePosition; |
| 172 |
this._position(); |
| 173 |
}, |
| 174 |
|
| 175 |
_setup: function(){ |
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
var node = this.domNode; |
| 184 |
|
| 185 |
if(this.titleBar && this.draggable){ |
| 186 |
this._moveable = new ((has("ie") == 6) ? TimedMoveable |
| 187 |
: Moveable)(node, { handle: this.titleBar }); |
| 188 |
aspect.after(this._moveable, "onMoveStop", lang.hitch(this, "_endDrag"), true); |
| 189 |
}else{ |
| 190 |
domClass.add(node, "dijitDialogFixed"); |
| 191 |
} |
| 192 |
|
| 193 |
this.underlayAttrs = { |
| 194 |
dialogId: this.id, |
| 195 |
"class": array.map(this["class"].split(/\s/),function(s){ |
| 196 |
return s + "_underlay"; |
| 197 |
}).join(" "), |
| 198 |
_onKeyDown: lang.hitch(this, "_onKey"), |
| 199 |
ownerDocument: this.ownerDocument |
| 200 |
}; |
| 201 |
}, |
| 202 |
|
| 203 |
_size: function(){ |
| 204 |
|
| 205 |
this.resize(); |
| 206 |
}, |
| 207 |
|
| 208 |
_position: function(){ |
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
if(!domClass.contains(this.ownerDocumentBody, "dojoMove")){ |
| 217 |
var node = this.domNode, |
| 218 |
viewport = winUtils.getBox(this.ownerDocument), |
| 219 |
p = this._relativePosition, |
| 220 |
bb = domGeometry.position(node), |
| 221 |
l = Math.floor(viewport.l + (p ? Math.min(p.x, viewport.w - bb.w) : (viewport.w - bb.w) / 2)), |
| 222 |
t = Math.floor(viewport.t + (p ? Math.min(p.y, viewport.h - bb.h) : (viewport.h - bb.h) / 2)); |
| 223 |
|
| 224 |
domStyle.set(node, { |
| 225 |
left: l + "px", |
| 226 |
top: t + "px" |
| 227 |
}); |
| 228 |
} |
| 229 |
}, |
| 230 |
|
| 231 |
_onKey: function( evt){ |
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
if(evt.keyCode == keys.TAB){ |
| 238 |
this._getFocusItems(); |
| 239 |
var node = evt.target; |
| 240 |
if(this._firstFocusItem == this._lastFocusItem){ |
| 241 |
|
| 242 |
evt.stopPropagation(); |
| 243 |
evt.preventDefault(); |
| 244 |
}else if(node == this._firstFocusItem && evt.shiftKey){ |
| 245 |
|
| 246 |
focus.focus(this._lastFocusItem); |
| 247 |
evt.stopPropagation(); |
| 248 |
evt.preventDefault(); |
| 249 |
}else if(node == this._lastFocusItem && !evt.shiftKey){ |
| 250 |
|
| 251 |
focus.focus(this._firstFocusItem); |
| 252 |
evt.stopPropagation(); |
| 253 |
evt.preventDefault(); |
| 254 |
} |
| 255 |
}else if(this.closable && evt.keyCode == keys.ESCAPE){ |
| 256 |
this.onCancel(); |
| 257 |
evt.stopPropagation(); |
| 258 |
evt.preventDefault(); |
| 259 |
} |
| 260 |
}, |
| 261 |
|
| 262 |
show: function(){ |
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
if(this.open){ |
| 269 |
return resolvedDeferred.promise; |
| 270 |
} |
| 271 |
|
| 272 |
if(!this._started){ |
| 273 |
this.startup(); |
| 274 |
} |
| 275 |
|
| 276 |
|
| 277 |
if(!this._alreadyInitialized){ |
| 278 |
this._setup(); |
| 279 |
this._alreadyInitialized = true; |
| 280 |
} |
| 281 |
|
| 282 |
if(this._fadeOutDeferred){ |
| 283 |
|
| 284 |
|
| 285 |
this._fadeOutDeferred.cancel(); |
| 286 |
DialogLevelManager.hide(this); |
| 287 |
} |
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
|
| 292 |
var win = winUtils.get(this.ownerDocument); |
| 293 |
this._modalconnects.push(on(win, "scroll", lang.hitch(this, "resize", null))); |
| 294 |
|
| 295 |
this._modalconnects.push(on(this.domNode, "keydown", lang.hitch(this, "_onKey"))); |
| 296 |
|
| 297 |
domStyle.set(this.domNode, { |
| 298 |
opacity: 0, |
| 299 |
display: "" |
| 300 |
}); |
| 301 |
|
| 302 |
this._set("open", true); |
| 303 |
this._onShow(); |
| 304 |
|
| 305 |
this.resize(); |
| 306 |
this._position(); |
| 307 |
|
| 308 |
|
| 309 |
var fadeIn; |
| 310 |
|
| 311 |
this._fadeInDeferred = new Deferred(lang.hitch(this, function(){ |
| 312 |
fadeIn.stop(); |
| 313 |
delete this._fadeInDeferred; |
| 314 |
})); |
| 315 |
this._fadeInDeferred.then(undefined, nop); |
| 316 |
|
| 317 |
|
| 318 |
var promise = this._fadeInDeferred.promise; |
| 319 |
|
| 320 |
fadeIn = fx.fadeIn({ |
| 321 |
node: this.domNode, |
| 322 |
duration: this.duration, |
| 323 |
beforeBegin: lang.hitch(this, function(){ |
| 324 |
DialogLevelManager.show(this, this.underlayAttrs); |
| 325 |
}), |
| 326 |
onEnd: lang.hitch(this, function(){ |
| 327 |
if(this.autofocus && DialogLevelManager.isTop(this)){ |
| 328 |
|
| 329 |
|
| 330 |
this._getFocusItems(); |
| 331 |
focus.focus(this._firstFocusItem); |
| 332 |
} |
| 333 |
this._fadeInDeferred.resolve(true); |
| 334 |
delete this._fadeInDeferred; |
| 335 |
}) |
| 336 |
}).play(); |
| 337 |
|
| 338 |
return promise; |
| 339 |
}, |
| 340 |
|
| 341 |
hide: function(){ |
| 342 |
|
| 343 |
|
| 344 |
|
| 345 |
|
| 346 |
|
| 347 |
|
| 348 |
|
| 349 |
if(!this._alreadyInitialized || !this.open){ |
| 350 |
return resolvedDeferred.promise; |
| 351 |
} |
| 352 |
if(this._fadeInDeferred){ |
| 353 |
this._fadeInDeferred.cancel(); |
| 354 |
} |
| 355 |
|
| 356 |
|
| 357 |
var fadeOut; |
| 358 |
|
| 359 |
this._fadeOutDeferred = new Deferred(lang.hitch(this, function(){ |
| 360 |
fadeOut.stop(); |
| 361 |
delete this._fadeOutDeferred; |
| 362 |
})); |
| 363 |
this._fadeOutDeferred.then(undefined, nop); |
| 364 |
|
| 365 |
|
| 366 |
this._fadeOutDeferred.then(lang.hitch(this, 'onHide')); |
| 367 |
|
| 368 |
|
| 369 |
var promise = this._fadeOutDeferred.promise; |
| 370 |
|
| 371 |
fadeOut = fx.fadeOut({ |
| 372 |
node: this.domNode, |
| 373 |
duration: this.duration, |
| 374 |
onEnd: lang.hitch(this, function(){ |
| 375 |
this.domNode.style.display = "none"; |
| 376 |
DialogLevelManager.hide(this); |
| 377 |
this._fadeOutDeferred.resolve(true); |
| 378 |
delete this._fadeOutDeferred; |
| 379 |
}) |
| 380 |
}).play(); |
| 381 |
|
| 382 |
if(this._scrollConnected){ |
| 383 |
this._scrollConnected = false; |
| 384 |
} |
| 385 |
var h; |
| 386 |
while(h = this._modalconnects.pop()){ |
| 387 |
h.remove(); |
| 388 |
} |
| 389 |
|
| 390 |
if(this._relativePosition){ |
| 391 |
delete this._relativePosition; |
| 392 |
} |
| 393 |
this._set("open", false); |
| 394 |
|
| 395 |
return promise; |
| 396 |
}, |
| 397 |
|
| 398 |
resize: function(dim){ |
| 399 |
|
| 400 |
|
| 401 |
|
| 402 |
|
| 403 |
|
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
|
| 408 |
if(this.domNode.style.display != "none"){ |
| 409 |
|
| 410 |
this._checkIfSingleChild(); |
| 411 |
|
| 412 |
if(!dim){ |
| 413 |
if(this._shrunk){ |
| 414 |
|
| 415 |
if(this._singleChild){ |
| 416 |
if(typeof this._singleChildOriginalStyle != "undefined"){ |
| 417 |
this._singleChild.domNode.style.cssText = this._singleChildOriginalStyle; |
| 418 |
delete this._singleChildOriginalStyle; |
| 419 |
} |
| 420 |
} |
| 421 |
array.forEach([this.domNode, this.containerNode, this.titleBar, this.actionBarNode], function(node){ |
| 422 |
if(node){ |
| 423 |
domStyle.set(node, { |
| 424 |
position: "static", |
| 425 |
width: "auto", |
| 426 |
height: "auto" |
| 427 |
}); |
| 428 |
} |
| 429 |
}); |
| 430 |
this.domNode.style.position = "absolute"; |
| 431 |
} |
| 432 |
|
| 433 |
|
| 434 |
|
| 435 |
var viewport = winUtils.getBox(this.ownerDocument); |
| 436 |
viewport.w *= this.maxRatio; |
| 437 |
viewport.h *= this.maxRatio; |
| 438 |
|
| 439 |
var bb = domGeometry.position(this.domNode); |
| 440 |
this._shrunk = false; |
| 441 |
|
| 442 |
if(bb.w >= viewport.w){ |
| 443 |
dim = { |
| 444 |
w: viewport.w |
| 445 |
}; |
| 446 |
domGeometry.setMarginBox(this.domNode, dim); |
| 447 |
bb = domGeometry.position(this.domNode); |
| 448 |
this._shrunk = true; |
| 449 |
} |
| 450 |
|
| 451 |
if(bb.h >= viewport.h){ |
| 452 |
if(!dim){ |
| 453 |
dim = { |
| 454 |
w: bb.w |
| 455 |
}; |
| 456 |
} |
| 457 |
dim.h = viewport.h; |
| 458 |
this._shrunk = true; |
| 459 |
} |
| 460 |
if(dim){ |
| 461 |
if(!dim.w){ |
| 462 |
dim.w = bb.w; |
| 463 |
} |
| 464 |
if(!dim.h){ |
| 465 |
dim.h = bb.h; |
| 466 |
} |
| 467 |
} |
| 468 |
} |
| 469 |
|
| 470 |
|
| 471 |
if(dim){ |
| 472 |
|
| 473 |
domGeometry.setMarginBox(this.domNode, dim); |
| 474 |
|
| 475 |
|
| 476 |
var layoutNodes = []; |
| 477 |
if(this.titleBar){ |
| 478 |
layoutNodes.push({domNode: this.titleBar, region: "top"}); |
| 479 |
} |
| 480 |
if(this.actionBarNode){ |
| 481 |
layoutNodes.push({domNode: this.actionBarNode, region: "bottom"}); |
| 482 |
} |
| 483 |
var centerSize = {domNode: this.containerNode, region: "center"}; |
| 484 |
layoutNodes.push(centerSize); |
| 485 |
|
| 486 |
var contentDim = utils.marginBox2contentBox(this.domNode, dim); |
| 487 |
utils.layoutChildren(this.domNode, contentDim, layoutNodes); |
| 488 |
|
| 489 |
|
| 490 |
|
| 491 |
if(this._singleChild){ |
| 492 |
var cb = utils.marginBox2contentBox(this.containerNode, centerSize); |
| 493 |
|
| 494 |
|
| 495 |
this._singleChild.resize({w: cb.w, h: cb.h}); |
| 496 |
|
| 497 |
}else{ |
| 498 |
this.containerNode.style.overflow = "auto"; |
| 499 |
this._layoutChildren(); |
| 500 |
} |
| 501 |
}else{ |
| 502 |
this._layoutChildren(); |
| 503 |
} |
| 504 |
|
| 505 |
if(!has("touch") && !dim){ |
| 506 |
|
| 507 |
|
| 508 |
|
| 509 |
this._position(); |
| 510 |
} |
| 511 |
} |
| 512 |
}, |
| 513 |
|
| 514 |
_layoutChildren: function(){ |
| 515 |
|
| 516 |
|
| 517 |
|
| 518 |
array.forEach(this.getChildren(), function(widget){ |
| 519 |
if(widget.resize){ |
| 520 |
widget.resize(); |
| 521 |
} |
| 522 |
}); |
| 523 |
}, |
| 524 |
|
| 525 |
destroy: function(){ |
| 526 |
if(this._fadeInDeferred){ |
| 527 |
this._fadeInDeferred.cancel(); |
| 528 |
} |
| 529 |
if(this._fadeOutDeferred){ |
| 530 |
this._fadeOutDeferred.cancel(); |
| 531 |
} |
| 532 |
if(this._moveable){ |
| 533 |
this._moveable.destroy(); |
| 534 |
} |
| 535 |
var h; |
| 536 |
while(h = this._modalconnects.pop()){ |
| 537 |
h.remove(); |
| 538 |
} |
| 539 |
|
| 540 |
DialogLevelManager.hide(this); |
| 541 |
|
| 542 |
this.inherited(arguments); |
| 543 |
} |
| 544 |
}); |
| 545 |
|
| 546 |
if(has("dojo-bidi")){ |
| 547 |
_DialogBase = declare("dijit._DialogBase", _DialogBase, { |
| 548 |
_setTitleAttr: function( title){ |
| 549 |
this._set("title", title); |
| 550 |
this.titleNode.innerHTML = title; |
| 551 |
this.applyTextDir(this.titleNode); |
| 552 |
}, |
| 553 |
|
| 554 |
_setTextDirAttr: function(textDir){ |
| 555 |
if(this._created && this.textDir != textDir){ |
| 556 |
this._set("textDir", textDir); |
| 557 |
this.set("title", this.title); |
| 558 |
} |
| 559 |
} |
| 560 |
}); |
| 561 |
} |
| 562 |
|
| 563 |
var Dialog = declare("dijit.Dialog", [ContentPane, _DialogBase], { |
| 564 |
|
| 565 |
|
| 566 |
|
| 567 |
|
| 568 |
|
| 569 |
|
| 570 |
|
| 571 |
|
| 572 |
|
| 573 |
|
| 574 |
|
| 575 |
|
| 576 |
}); |
| 577 |
Dialog._DialogBase = _DialogBase; |
| 578 |
|
| 579 |
var DialogLevelManager = Dialog._DialogLevelManager = { |
| 580 |
|
| 581 |
|
| 582 |
|
| 583 |
|
| 584 |
|
| 585 |
_beginZIndex: 950, |
| 586 |
|
| 587 |
show: function( dialog, underlayAttrs){ |
| 588 |
|
| 589 |
|
| 590 |
|
| 591 |
|
| 592 |
|
| 593 |
|
| 594 |
|
| 595 |
|
| 596 |
|
| 597 |
|
| 598 |
|
| 599 |
ds[ds.length - 1].focus = focus.curNode; |
| 600 |
|
| 601 |
|
| 602 |
var zIndex = ds[ds.length - 1].dialog ? ds[ds.length - 1].zIndex + 2 : Dialog._DialogLevelManager._beginZIndex; |
| 603 |
domStyle.set(dialog.domNode, 'zIndex', zIndex); |
| 604 |
|
| 605 |
|
| 606 |
DialogUnderlay.show(underlayAttrs, zIndex - 1); |
| 607 |
|
| 608 |
ds.push({dialog: dialog, underlayAttrs: underlayAttrs, zIndex: zIndex}); |
| 609 |
}, |
| 610 |
|
| 611 |
hide: function( dialog){ |
| 612 |
|
| 613 |
|
| 614 |
|
| 615 |
|
| 616 |
|
| 617 |
|
| 618 |
|
| 619 |
|
| 620 |
if(ds[ds.length - 1].dialog == dialog){ |
| 621 |
|
| 622 |
|
| 623 |
|
| 624 |
ds.pop(); |
| 625 |
|
| 626 |
var pd = ds[ds.length - 1]; |
| 627 |
|
| 628 |
|
| 629 |
if(ds.length == 1){ |
| 630 |
|
| 631 |
DialogUnderlay.hide(); |
| 632 |
}else{ |
| 633 |
|
| 634 |
DialogUnderlay.show(pd.underlayAttrs, pd.zIndex - 1); |
| 635 |
} |
| 636 |
|
| 637 |
|
| 638 |
|
| 639 |
|
| 640 |
|
| 641 |
if(dialog.refocus){ |
| 642 |
|
| 643 |
|
| 644 |
|
| 645 |
|
| 646 |
var focus = pd.focus; |
| 647 |
if(pd.dialog && (!focus || !dom.isDescendant(focus, pd.dialog.domNode))){ |
| 648 |
pd.dialog._getFocusItems(); |
| 649 |
focus = pd.dialog._firstFocusItem; |
| 650 |
} |
| 651 |
|
| 652 |
if(focus){ |
| 653 |
|
| 654 |
|
| 655 |
|
| 656 |
try{ |
| 657 |
focus.focus(); |
| 658 |
}catch(e){ |
| 659 |
} |
| 660 |
} |
| 661 |
} |
| 662 |
}else{ |
| 663 |
|
| 664 |
|
| 665 |
var idx = array.indexOf(array.map(ds, function(elem){ |
| 666 |
return elem.dialog; |
| 667 |
}), dialog); |
| 668 |
if(idx != -1){ |
| 669 |
ds.splice(idx, 1); |
| 670 |
} |
| 671 |
} |
| 672 |
}, |
| 673 |
|
| 674 |
isTop: function( dialog){ |
| 675 |
|
| 676 |
|
| 677 |
return ds[ds.length - 1].dialog == dialog; |
| 678 |
} |
| 679 |
}; |
| 680 |
|
| 681 |
|
| 682 |
|
| 683 |
|
| 684 |
|
| 685 |
|
| 686 |
|
| 687 |
|
| 688 |
|
| 689 |
var ds = Dialog._dialogStack = [ |
| 690 |
{dialog: null, focus: null, underlayAttrs: null} |
| 691 |
]; |
| 692 |
|
| 693 |
|
| 694 |
|
| 695 |
|
| 696 |
|
| 697 |
focus.watch("curNode", function(attr, oldNode, node){ |
| 698 |
|
| 699 |
var topDialog = ds[ds.length - 1].dialog; |
| 700 |
|
| 701 |
|
| 702 |
|
| 703 |
if(node && topDialog && !topDialog._fadeOutDeferred && node.ownerDocument == topDialog.ownerDocument){ |
| 704 |
|
| 705 |
|
| 706 |
do{ |
| 707 |
if(node == topDialog.domNode || domClass.contains(node, "dijitPopup")){ return; } |
| 708 |
}while(node = node.parentNode); |
| 709 |
|
| 710 |
|
| 711 |
|
| 712 |
topDialog.focus(); |
| 713 |
} |
| 714 |
}); |
| 715 |
|
| 716 |
|
| 717 |
if(has("dijit-legacy-requires")){ |
| 718 |
ready(0, function(){ |
| 719 |
var requires = ["dijit/TooltipDialog"]; |
| 720 |
require(requires); |
| 721 |
}); |
| 722 |
} |
| 723 |
|
| 724 |
return Dialog; |
| 725 |
}); |