1// Name: ModalPopup.debug.js 2// Assembly: AjaxControlToolkit 3// Version: 20.1.0.0 4// FileVersion: 20.1.0.0 5Type.registerNamespace('Sys.Extended.UI'); 6 7Sys.Extended.UI.ModalPopupRepositionMode = function() { 8 // The ModalPopupRepositionMode enumeration describes how the modal popup repositions 9 throw Error.invalidOperation(); 10}; 11 12Sys.Extended.UI.ModalPopupRepositionMode.prototype = { 13 None: 0, 14 RepositionOnWindowResize: 1, 15 RepositionOnWindowScroll: 2, 16 RepositionOnWindowResizeAndScroll: 3 17}; 18 19Sys.Extended.UI.ModalPopupRepositionMode.registerEnum('Sys.Extended.UI.ModalPopupRepositionMode'); 20 21Sys.Extended.UI.ModalPopupBehavior = function(element) { 22 // The ModalPopupBehavior is used to display the target element as a modal dialog 23 Sys.Extended.UI.ModalPopupBehavior.initializeBase(this, [element]); 24 25 // Properties 26 this._popupControlID = null; 27 this._popupDragHandleControlID = null; 28 this._backgroundCssClass = null; 29 this._dropShadow = false; 30 this._drag = false; 31 this._okControlID = null; 32 this._cancelControlID = null; 33 this._onOkScript = null; 34 this._onCancelScript = null; 35 this._xCoordinate = -1; 36 this._yCoordinate = -1; 37 this._repositionMode = Sys.Extended.UI.ModalPopupRepositionMode.RepositionOnWindowResizeAndScroll; 38 this._onShown = new Sys.Extended.UI.Animation.GenericAnimationBehavior(element); //element replaced later with popuptarget 39 this._onHidden = new Sys.Extended.UI.Animation.GenericAnimationBehavior(element); 40 this._onShowing = new Sys.Extended.UI.Animation.GenericAnimationBehavior(element); 41 this._onHiding = new Sys.Extended.UI.Animation.GenericAnimationBehavior(element); 42 43 // Variables 44 this._backgroundElement = null; 45 this._foregroundElement = null; 46 this._relativeOrAbsoluteParentElement = null; 47 this._popupElement = null; 48 this._dragHandleElement = null; 49 this._showHandler = null; 50 this._okHandler = null; 51 this._cancelHandler = null; 52 this._scrollHandler = null; 53 this._resizeHandler = null; 54 this._windowHandlersAttached = false; 55 this._dropShadowBehavior = null; 56 this._dragBehavior = null; 57 this._isIE6 = false; 58 59 this._saveTabIndexes = new Array(); 60 this._saveDesableSelect = new Array(); 61 this._tagWithTabIndex = new Array('A', 'AREA', 'BUTTON', 'INPUT', 'OBJECT', 'SELECT', 'TEXTAREA', 'IFRAME'); 62 63 this._isAnimationJustEnded = false; 64 this._hidingAnimationEndedHandler = null; 65 this._showingAnimationEndedHandler = null; 66 67}; 68 69Sys.Extended.UI.ModalPopupBehavior.prototype = { 70 71 initialize: function() { 72 // <div superpopup - drag container resizable><div -- drag handle\dropshadow foreground></div></div> 73 Sys.Extended.UI.ModalPopupBehavior.callBaseMethod(this, 'initialize'); 74 75 this._isIE6 = (Sys.Browser.agent == Sys.Browser.InternetExplorer && Sys.Browser.version < 7); 76 if(this._popupDragHandleControlID) 77 this._dragHandleElement = $get(this._popupDragHandleControlID); 78 79 this._popupElement = $get(this._popupControlID); 80 81 this._createDomElements(); 82 83 this._showHandler = Function.createDelegate(this, this._onShow); 84 $addHandler(this.get_element(), 'click', this._showHandler); 85 86 if(this._okControlID) { 87 this._okHandler = Function.createDelegate(this, this._onOk); 88 $addHandler($get(this._okControlID), 'click', this._okHandler); 89 } 90 91 if(this._cancelControlID) { 92 this._cancelHandler = Function.createDelegate(this, this._onCancel); 93 $addHandler($get(this._cancelControlID), 'click', this._cancelHandler); 94 } 95 96 this._scrollHandler = Function.createDelegate(this, this._onLayout); 97 this._resizeHandler = Function.createDelegate(this, this._onLayout); 98 99 // Need to know when partial updates complete 100 this.registerPartialUpdateEvents(); 101 102 // We initally set it to the element, but needs to be targeted at 103 // the popup contorl 104 this._resetAnimationsTarget(); 105 106 // attach to animation end events to signal hiding animation completed 107 // an call hide()/show() to hide/show the popup. 108 if(this._onHiding.get_animation()) { 109 this._hidingAnimationEndedHandler = Function.createDelegate(this, function() { 110 this._isAnimationJustEnded = true; 111 this.hide(); 112 }); 113 this._onHiding.get_animation().add_ended(this._hidingAnimationEndedHandler); 114 } 115 116 if(this._onShowing.get_animation()) { 117 this._showingAnimationEndedHandler = Function.createDelegate(this, function() { 118 this._isAnimationJustEnded = true; 119 this.show(); 120 }); 121 this._onShowing.get_animation().add_ended(this._showingAnimationEndedHandler); 122 } 123 }, 124 125 dispose: function() { 126 // Going away; restore any changes to the page 127 this._hideImplementation(); 128 129 if(this._foregroundElement && this._foregroundElement.parentNode) { 130 // Remove background we added to the DOM 131 this._foregroundElement.parentNode.removeChild(this._backgroundElement); 132 133 if(this._dropShadow) { 134 // Remove DIV wrapper added in initialize 135 this._foregroundElement.parentNode.appendChild(this._popupElement); 136 this._foregroundElement.parentNode.removeChild(this._foregroundElement); 137 } 138 } 139 140 this._scrollHandler = null; 141 this._resizeHandler = null; 142 143 if(this._cancelHandler && $get(this._cancelControlID)) { 144 $removeHandler($get(this._cancelControlID), 'click', this._cancelHandler); 145 this._cancelHandler = null; 146 } 147 148 if(this._okHandler && $get(this._okControlID)) { 149 $removeHandler($get(this._okControlID), 'click', this._okHandler); 150 this._okHandler = null; 151 } 152 153 if(this._showHandler) {
154 $removeHandler(this.get_element(), 'click', this._showHandler); 155 this._showHandler = null; 156 } 157 158 if(this._hidingAnimationEndedHandler) { 159 this._onHiding.get_animation().remove_ended(this._hidingAnimationEndedHandler); 160 } 161 162 if(this._showingAnimationEndedHandler) { 163 this._onShowing.get_animation().remove_ended(this._showingAnimationEndedHandler); 164 } 165 166 Sys.Extended.UI.ModalPopupBehavior.callBaseMethod(this, 'dispose'); 167 }, 168 169 _createDomElements: function() { 170 if(this._dropShadow) { 171 this._foregroundElement = document.createElement('div'); 172 this._foregroundElement.id = this.get_id() + '_foregroundElement'; 173 this._popupElement.parentNode.appendChild(this._foregroundElement); 174 this._foregroundElement.appendChild(this._popupElement); 175 } else { 176 this._foregroundElement = this._popupElement; 177 } 178 179 this._backgroundElement = document.createElement('div'); 180 this._backgroundElement.setAttribute('data-act-control-type', 'modalPopupBackground'); 181 this._backgroundElement.id = this.get_id() + '_backgroundElement'; 182 this._backgroundElement.style.display = 'none'; 183 this._backgroundElement.style.position = 'fixed'; 184 this._backgroundElement.style.left = '0px'; 185 this._backgroundElement.style.top = '0px'; 186 187 if(this._backgroundCssClass) 188 this._backgroundElement.className = this._backgroundCssClass; 189 190 this._foregroundElement.parentNode.appendChild(this._backgroundElement); 191 this._foregroundElement.style.display = 'none'; 192 this._foregroundElement.style.position = 'fixed'; 193 194 this._setZIndex(); 195 }, 196 197 _setZIndex: function() { 198 var topModalPopupBackgroundZIndex = parseInt(this._findTopModalPopupBackgroundZIndex()); 199 // Want zIndex to big enough that the background sits above everything else 200 // CSS 2.1 defines no bounds for the <integer> type, so pick arbitrarily 201 this._backgroundElement.style.zIndex = topModalPopupBackgroundZIndex ? parseInt(topModalPopupBackgroundZIndex + 1) : parseInt(Sys.Extended.UI.zIndex.ModalPopupBackground); 202 this._foregroundElement.style.zIndex = parseInt($common.getCurrentStyle(this._backgroundElement, 'zIndex', this._backgroundElement.style.zIndex)) + 1; 203 }, 204 205 _findTopModalPopupBackgroundZIndex: function () { 206 var lastPopup = this._getLastPopup(); 207 return lastPopup ? lastPopup._backgroundElement.style.zIndex : undefined; 208 }, 209 210 _getLastPopup: function () { 211 var popups = Sys.Extended.UI.ModalPopupBehavior.popups; 212 return popups.length ? popups[popups.length - 1] : undefined; 213 }, 214 215 _attachPopup: function() { 216 Sys.Extended.UI.ModalPopupBehavior.popups.push(this); 217 218 if(this._dropShadow && !this._dropShadowBehavior) 219 this._dropShadowBehavior = $create(Sys.Extended.UI.DropShadowBehavior, {}, null, null, this._popupElement); 220 221 if(this._dragHandleElement && !this._dragBehavior) 222 this._dragBehavior = $create(Sys.Extended.UI.FloatingBehavior, { "handle": this._dragHandleElement }, null, null, this._foregroundElement); 223 224 $addHandler(window, 'resize', this._resizeHandler); 225 $addHandler(window, 'scroll', this._scrollHandler); 226 227 this._windowHandlersAttached = true; 228 }, 229 230 _detachPopup: function() { 231 if(this._windowHandlersAttached) { 232 if(this._scrollHandler) 233 $removeHandler(window, 'scroll', this._scrollHandler); 234 235 if(this._resizeHandler) 236 $removeHandler(window, 'resize', this._resizeHandler); 237 238 this._windowHandlersAttached = false; 239 } 240 241 if(this._dragBehavior) { 242 this._dragBehavior.dispose(); 243 this._dragBehavior = null; 244 } 245 246 if(this._dropShadowBehavior) { 247 this._dropShadowBehavior.dispose(); 248 this._dropShadowBehavior = null; 249 } 250 251 if(this._getLastPopup() == this) 252 Sys.Extended.UI.ModalPopupBehavior.popups.pop(); 253 }, 254 255 _onShow: function(e) { 256 // Handler for the target's click event
257 if(!this.get_element().disabled) { 258 this.show(); 259 e.preventDefault(); 260 261 return false; 262 } 263 }, 264 265 _onOk: function(e) { 266 // Handler for the modal dialog's OK button click 267 var element = $get(this._okControlID); 268 269 if(element && !element.disabled) { 270 if(this.hide() && this._onOkScript) 271 window.setTimeout(this._onOkScript, 0); 272 273 e.preventDefault(); 274 275 return false; 276 } 277 }, 278 279 _onCancel: function(e) { 280 // Handler for the modal dialog's Cancel button click 281 var element = $get(this._cancelControlID); 282 283 if(element && !element.disabled) { 284 if(this.hide() && this._onCancelScript) 285 window.setTimeout(this._onCancelScript, 0); 286 287 e.preventDefault(); 288 289 return false; 290 } 291 }, 292 293 _onLayout: function(e) { 294 // Handler for scrolling and resizing events that would require a repositioning of the modal dialog 295 var positioning = this.get_repositionMode(); 296 297 if(((positioning === Sys.Extended.UI.ModalPopupRepositionMode.RepositionOnWindowScroll) || 298 (positioning === Sys.Extended.UI.ModalPopupRepositionMode.RepositionOnWindowResizeAndScroll)) && (e.type === 'scroll')) { 299 this._layout(); 300 } else if(((positioning === Sys.Extended.UI.ModalPopupRepositionMode.RepositionOnWindowResize) || 301 (positioning === Sys.Extended.UI.ModalPopupRepositionMode.RepositionOnWindowResizeAndScroll)) && (e.type === 'resize')) { 302 this._layout(); 303 } else { 304 // Layout background element again to make sure it covers the whole background. 305 // This needs to be called separately since _layout will not be always called 306 // to reposition the popup depending on the RepositionMode but the background needs 307 // to handle the resize/scroll every time. 308 this._layoutBackgroundElement(); 309 } 310 }, 311 312 /// <summary> 313 /// Displays an element that is referenced by the PopupControlID property as a modal dialog box 314 /// </summary> 315 /// <member name="cM:AjaxControlToolkit.ModalPopupExtender.show" /> 316 show: function() { 317 // Display the element referenced by PopupControlID as a modal dialog 318 if(!this._isAnimationJustEnded) { 319 var eventArgs = new Sys.CancelEventArgs(); 320 this.raise_showing(eventArgs); 321 322 if(eventArgs.get_cancel()) { 323 return; 324 } else if(this._onShowing.get_animation()) { 325 this._onShowing.play(); 326 return; 327 } 328 } else { 329 this._isAnimationJustEnded = false; 330 } 331 332 this.populate(); 333 this._attachPopup(); 334 335 this._setZIndex(); 336 337 this._backgroundElement.style.display = ''; 338 this._foregroundElement.style.display = ''; 339 this._popupElement.style.display = ''; 340 341 if(this._isIE6) { 342 this._foregroundElement.style.position = 'absolute'; 343 this._backgroundElement.style.position = 'absolute'; 344 345 // find the relative or absolute parent 346 var tempRelativeOrAbsoluteParent = this._foregroundElement.parentNode; 347 while(tempRelativeOrAbsoluteParent && (tempRelativeOrAbsoluteParent != document.documentElement)) { 348 if((tempRelativeOrAbsoluteParent.style.position != 'relative') && (tempRelativeOrAbsoluteParent.style.position != 'absolute')) { 349 tempRelativeOrAbsoluteParent = tempRelativeOrAbsoluteParent.parentNode; 350 } else { 351 this._relativeOrAbsoluteParentElement = tempRelativeOrAbsoluteParent; 352 break; 353 } 354 } 355 } 356 357 // Disable TAB 358 this.disableTab(); 359 360 this._layout(); 361 // On pages that don't need scrollbars, Firefox and Safari act like 362 // one or both are present the first time the layout code runs which 363 // obviously leads to display issues - run the layout code a second 364 // time to work around this problem 365 this._layout(); 366 367 this.raise_shown(Sys.EventArgs.Empty); 368 369 this._onShown.play(); 370 }, 371 372 /// <summary> 373 /// Changes tab indices so that tabbing moves focus only through the modal dialog box 374 /// </summary> 375 /// <member name="cM:AjaxControlToolkit.ModalPopupExtender.disableTab" /> 376 disableTab: function() { 377 // Change the tab indices so we only tab through the modal popup 378 // (and hide SELECT tags in IE6) 379 380 var i = 0, 381 tagElements, 382 tagElementsInPopUp = new Array(); 383 384 Array.clear(this._saveTabIndexes); 385 386 //Save all popup's tag in tagElementsInPopUp 387 for(var j = 0; j < this._tagWithTabIndex.length; j++) { 388 tagElements = this._foregroundElement.getElementsByTagName(this._tagWithTabIndex[j]); 389 390 for(var k = 0; k < tagElements.length; k++) { 391 tagElementsInPopUp[i] = tagElements[k]; 392 i++; 393 } 394 } 395 396 i = 0; 397 for(var j = 0; j < this._tagWithTabIndex.length; j++) { 398 tagElements = document.getElementsByTagName(this._tagWithTabIndex[j]); 399 400 for(var k = 0; k < tagElements.length; k++) { 401 if(Array.indexOf(tagElementsInPopUp, tagElements[k]) == -1) { 402 this._saveTabIndexes[i++] = { tag: tagElements[k], index: tagElements[k].tabIndex }; 403 tagElements[k].tabIndex = "-1"; 404 } 405 } 406 } 407
408 //IE6 Bug with SELECT element always showing up on top 409 i = 0; 410 if((Sys.Browser.agent === Sys.Browser.InternetExplorer) && (Sys.Browser.version < 7)) { 411 //Save SELECT in PopUp 412 var tagSelectInPopUp = new Array(); 413 414 for(var j = 0; j < this._tagWithTabIndex.length; j++) { 415 tagElements = this._foregroundElement.getElementsByTagName('SELECT'); 416 417 for(var k = 0; k < tagElements.length; k++) { 418 tagSelectInPopUp[i] = tagElements[k]; 419 i++; 420 } 421 } 422 423 i = 0; 424 Array.clear(this._saveDesableSelect); 425 tagElements = document.getElementsByTagName('SELECT'); 426 427 for(var k = 0; k < tagElements.length; k++) 428 if(Array.indexOf(tagSelectInPopUp, tagElements[k]) == -1) { 429 this._saveDesableSelect[i++] = { tag: tagElements[k], visib: $common.getCurrentStyle(tagElements[k], 'visibility') }; 430 tagElements[k].style.visibility = 'hidden'; 431 } 432 } 433 }, 434 435 /// <summary> 436 /// Restores tab indices from the page 437 /// </summary> 438 /// <member name="cM:AjaxControlToolkit.ModalPopupExtender.restoreTab" /> 439 restoreTab: function() { 440 // Restore the tab indices so we tab through the page like normal 441 // (and restore SELECT tags in IE6) 442 for(var i = 0; i < this._saveTabIndexes.length; i++) { 443 this._saveTabIndexes[i].tag.tabIndex = this._saveTabIndexes[i].index; 444 } 445 Array.clear(this._saveTabIndexes); 446 447 //IE6 Bug with SELECT element always showing up on top 448 if((Sys.Browser.agent === Sys.Browser.InternetExplorer) && (Sys.Browser.version < 7)) { 449 for(var k = 0; k < this._saveDesableSelect.length; k++) 450 this._saveDesableSelect[k].tag.style.visibility = this._saveDesableSelect[k].visib; 451 452 Array.clear(this._saveDesableSelect); 453 } 454 }, 455 456 /// <summary> 457 /// Hides an element that is referenced by the PopupControlID property 458 /// </summary> 459 /// <returns type="Boolean">Whether the popup was hidden</returns> 460 /// <member name="cM:AjaxControlToolkit.ModalPopupExtender.hide" /> 461 hide: function() { 462 // Hide the modal dialog 463 if(!this._isAnimationJustEnded) { 464 var eventArgs = new Sys.CancelEventArgs(); 465 this.raise_hiding(eventArgs); 466 467 if(eventArgs.get_cancel()) 468 return false; 469 else if(this._onHiding.get_animation()) { 470 this._onHiding.play(); 471 return true; 472 } 473 } else { 474 this._isAnimationJustEnded = false; 475 } 476 477 this._hideImplementation(); 478 this.raise_hidden(Sys.EventArgs.Empty); 479 this._onHidden.play(); 480 481 return true; 482 }, 483 484 _hideImplementation: function() { 485 // Internal implementation to hide the modal dialog 486 this._backgroundElement.style.display = 'none'; 487 this._foregroundElement.style.display = 'none'; 488 489 this.restoreTab(); 490 this._detachPopup(); 491 }, 492 493 _layout: function() { 494 var scrollLeft = (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft), 495 scrollTop = (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); 496 497 var clientBounds = $common.getClientBounds(), 498 clientWidth = clientBounds.width, 499 clientHeight = clientBounds.height; 500 501 // Setup the location of the background element 502 this._layoutBackgroundElement(); 503 504 var xCoord = 0; 505 var yCoord = 0; 506 if(this._xCoordinate < 0) { 507 var foregroundelementwidth = this._getForegroundElementWidth(); 508 xCoord = ((clientWidth - foregroundelementwidth) / 2); 509 510 // workaround for drag behavior which calls setlocation which in turn 511 // changes the position of the panel to be absolute and requiring us 512 // to add the scrollLeft so that it is positioned correctly. 513 if(this._foregroundElement.style.position == 'absolute') { 514 var parentPopup = this._getParentPopup(); 515 516 if(parentPopup) 517 xCoord = (parentPopup._getForegroundElementWidth() - foregroundelementwidth) / 2; 518 else 519 xCoord += scrollLeft; 520 } 521 522 this._foregroundElement.style.left = xCoord + 'px'; 523 } else { 524 if(this._isIE6) { 525 this._foregroundElement.style.left = (this._xCoordinate + scrollLeft) + 'px'; 526 xCoord = this._xCoordinate + scrollLeft; 527 } else { 528 this._foregroundElement.style.left = this._xCoordinate + 'px'; 529 xCoord = this._xCoordinate; 530 } 531 } 532 533 if(this._yCoordinate < 0) { 534 var foregroundelementheight = this._getForegroundElementHeight(); 535 yCoord = ((clientHeight - foregroundelementheight) / 2); 536 537 // workaround for drag behavior which calls setlocation which in turn 538 // changes the position of the panel to be absolute and requiring us 539 // to add the scrollLeft so that it is positioned correctly. 540 if(this._foregroundElement.style.position == 'absolute') { 541 var parentPopup = this._getParentPopup(); 542 543 if(parentPopup) 544 yCoord = (parentPopup._getForegroundElementHeight() - foregroundelementheight) / 2; 545 else 546 yCoord += scrollTop; 547 } 548 549 this._foregroundElement.style.top = yCoord + 'px'; 550 } else { 551 if(this._isIE6) { 552 this._foregroundElement.style.top = (this._yCoordinate + scrollTop) + 'px'; 553 yCoord = this._yCoordinate + scrollTop; 554 } else { 555 this._foregroundElement.style.top = this._yCoordinate + 'px'; 556 yCoord = this._yCoordinate; 557 } 558 } 559 560 // make sure get location agrees with the location of the foreground element 561 this._layoutForegroundElement(xCoord, yCoord); 562 563 if(this._dropShadowBehavior) { 564 this._dropShadowBehavior.setShadow(); 565 window.setTimeout(Function.createDelegate(this, this._fixupDropShadowBehavior), 0); 566 } 567 568 // layout background element again to make sure it covers the whole background 569 // in case things moved around when laying out the foreground element
570 this._layoutBackgroundElement(); 571 }, 572 573 _getForegroundElementWidth: function (){ 574 return this._foregroundElement.offsetWidth ? this._foregroundElement.offsetWidth : this._foregroundElement.scrollWidth; 575 }, 576 577 _getForegroundElementHeight: function() { 578 return this._foregroundElement.offsetHeight ? this._foregroundElement.offsetHeight : this._foregroundElement.scrollHeight; 579 }, 580 581 _getParentPopup: function () { 582 var el = this._foregroundElement; 583 var otherForegrounds = this._getOtherForegrounds(); 584 585 while(el.parentNode) { 586 el = el.parentNode; 587 588 var index = Array.indexOf(otherForegrounds, el) 589 590 if(index !== -1) 591 return Sys.Extended.UI.ModalPopupBehavior.popups[index]; 592 } 593 594 return null; 595 }, 596 597 _getOtherForegrounds: function () { 598 var foregrounds = []; 599 var popups = Sys.Extended.UI.ModalPopupBehavior.popups; 600 601 for(var i = 0; i < popups.length; i++) 602 foregrounds.push(popups[i]._foregroundElement); 603 604 return foregrounds; 605 }, 606 607 608 _layoutForegroundElement: function(xCoord, yCoord) { 609 // Set the correct location of the foreground element to ensure that it is absolutely 610 // positioned with respect to the browser. This is just a workaround for IE 6 since 611 // elements nested in relative parents cause modal popup positioning issues and 'fixed' 612 // is not supported by IE 6. Hence we manually compute the right location of the popup. 613 614 if(this._isIE6 && this._relativeOrAbsoluteParentElement) { 615 var foregroundLocation = $common.getLocation(this._foregroundElement), 616 relativeParentLocation = $common.getLocation(this._relativeOrAbsoluteParentElement), 617 getLocationXCoord = foregroundLocation.x; 618 619 if(getLocationXCoord != xCoord) 620 // offset it by that amount 621 this._foregroundElement.style.left = (xCoord - relativeParentLocation.x) + 'px'; 622 623 var getLocationYCoord = foregroundLocation.y; 624 if(getLocationYCoord != yCoord) 625 // offset it by that amount 626 this._foregroundElement.style.top = (yCoord - relativeParentLocation.y) + 'px'; 627 } 628 }, 629 630 _layoutBackgroundElement: function() { 631 // Set the correct location of the background element to ensure that it is absolutely 632 // positioned with respect to the browser. 633 634 // Background element needs to cover the visible client area completely hence its 635 // top and left coordinates need to be 0, and if relatively positioned its getlocation 636 // value needs to be 0. 637 if(this._isIE6) { 638 var backgroundLocation = $common.getLocation(this._backgroundElement), 639 backgroundXCoord = backgroundLocation.x; 640 641 if(backgroundXCoord != 0) 642 // offset it by that amount. This is assuming only one level of nesting. If 643 // multiple parents with absolute/relative positioning are setup this may not 644 // cover the whole background. 645 this._backgroundElement.style.left = (-backgroundXCoord) + 'px'; 646 647 var backgroundYCoord = backgroundLocation.y; 648 if(backgroundYCoord != 0) 649 // offset it by that amount. This is assuming only one level of nesting. If 650 // multiple parents with absolute/relative positioning are setup this may not 651 // cover the whole background. 652 this._backgroundElement.style.top = (-backgroundYCoord) + 'px'; 653 } 654 655 var clientBounds = $common.getClientBounds(), 656 clientWidth = clientBounds.width, 657 clientHeight = clientBounds.height; 658 659 this._backgroundElement.style.width = Math.max(Math.max(document.documentElement.scrollWidth, document.body.scrollWidth), clientWidth) + 'px'; 660 this._backgroundElement.style.height = Math.max(Math.max(document.documentElement.scrollHeight, document.body.scrollHeight), clientHeight) + 'px'; 661 }, 662 663 _fixupDropShadowBehavior: function() { 664 // Some browsers don't update the location values immediately, so 665 // the location of the drop shadow would always be a step behind 666 // without this method 667 if(this._dropShadowBehavior) 668 this._dropShadowBehavior.setShadow(); 669 }, 670 671 _partialUpdateEndRequest: function(sender, endRequestEventArgs) { 672 // Show the popup if requested during a partial postback 673 Sys.Extended.UI.ModalPopupBehavior.callBaseMethod(this, '_partialUpdateEndRequest', [sender, endRequestEventArgs]); 674
675 if(this.get_element()) { 676 // Look up result by element's ID 677 var action = endRequestEventArgs.get_dataItems()[this.get_element().id]; 678 679 if("show" == action) 680 this.show(); 681 else if("hide" == action) 682 this.hide(); 683 } 684 685 // Async postback may have added content; re-layout to accomodate it 686 this._layout(); 687 }, 688 689 _onPopulated: function(sender, eventArgs) { 690 // Re-layout the popup after we've dynamically populated 691 Sys.Extended.UI.ModalPopupBehavior.callBaseMethod(this, '_onPopulated', [sender, eventArgs]); 692 693 // Dynamic populate may have added content; re-layout to accomodate it 694 this._layout(); 695 }, 696 697 _replaceAnimationTarget: function(memberName, target) { 698 var json = this[memberName].get_json(); 699 700 this[memberName] = new Sys.Extended.UI.Animation.GenericAnimationBehavior(target); 701 this[memberName].set_json(json); 702 this[memberName].initialize(); 703 }, 704 705 _resetAnimationsTarget: function() { 706 var target = $get(this.get_popupControlID()); 707 708 this._replaceAnimationTarget('_onShowing', target); 709 this._replaceAnimationTarget('_onShown', target); 710 this._replaceAnimationTarget('_onHiding', target); 711 this._replaceAnimationTarget('_onHidden', target); 712 }, 713 714 /// <summary> 715 /// ID of an element to display as a modal popup 716 /// </summary> 717 /// <getter>get_popupControlID</getter> 718 /// <setter>set_popupControlID</setter> 719 /// <member name="cP:AjaxControlToolkit.ModalPopupExtender.popupControlID" /> 720 get_popupControlID: function() { 721 return this._popupControlID; 722 }, 723 set_popupControlID: function(value) { 724 if(this._popupControlID != value) { 725 this._popupControlID = value; 726 this.raisePropertyChanged('popupControlID'); 727 } 728 }, 729 730 get_PopupControlID: function() { 731 Sys.Extended.Deprecated("get_PopupControlID()", "get_popupControlID()"); 732 return this.get_popupControlID(); 733 }, 734 set_PopupControlID: function(value) { 735 Sys.Extended.Deprecated("set_PopupControlID(value)", "set_popupControlID(value)"); 736 this.set_popupControlID(value); 737 }, 738 739 /// <summary> 740 /// The distance from the left side of the modal popup to the left border of the browser window in pixels 741 /// </summary> 742 /// <getter>get_x</getter> 743 /// <setter>set_x</setter> 744 /// <member name="cP:AjaxControlToolkit.ModalPopupExtender.x" /> 745 get_x: function() { 746 return this._xCoordinate; 747 }, 748 set_x: function(value) { 749 if(this._xCoordinate != value) { 750 this._xCoordinate = value; 751 this.raisePropertyChanged('x'); 752 } 753 }, 754 755 get_X: function() { 756 Sys.Extended.Deprecated("get_X()", "get_x()"); 757 return this.get_x(); 758 }, 759 set_X: function(value) { 760 Sys.Extended.Deprecated("set_X(value)", "set_x(value)"); 761 this.set_x(value); 762 }, 763 764 /// <summary> 765 /// The distance from the top side of the modal popup to the top border of the browser window in pixels 766 /// </summary> 767 /// <getter>get_y</getter> 768 /// <setter>set_y</setter> 769 /// <member name="cP:AjaxControlToolkit.ModalPopupExtender.y" /> 770 get_y: function() { 771 return this._yCoordinate; 772 }, 773 set_y: function(value) { 774 if(this._yCoordinate != value) { 775 this._yCoordinate = value; 776 this.raisePropertyChanged('y'); 777 } 778 }, 779 780 get_Y: function() { 781 Sys.Extended.Deprecated("get_Y()", "get_y()"); 782 return this.get_y(); 783 }, 784 set_Y: function(value) { 785 Sys.Extended.Deprecated("set_Y(value)", "set_y(value)"); 786 this.set_y(value); 787 }, 788 789 /// <summary> 790 /// ID of an element to display as a drag handle for the modal popup 791 /// </summary> 792 /// <getter>get_popupDragHandleControlID</getter> 793 /// <setter>set_popupDragHandleControlID</setter> 794 /// <member name="cP:AjaxControlToolkit.ModalPopupExtender.popupDragHandleControlID" /> 795 get_popupDragHandleControlID: function() { 796 return this._popupDragHandleControlID; 797 }, 798 set_popupDragHandleControlID: function(value) { 799 if(this._popupDragHandleControlID != value) { 800 this._popupDragHandleControlID = value; 801 this.raisePropertyChanged('popupDragHandleControlID'); 802 } 803 }, 804 805 get_PopupDragHandleControlID: function() { 806 Sys.Extended.Deprecated("get_PopupDragHandleControlID()", "get_popupDragHandleControlID()"); 807 return this.get_popupDragHandleControlID(); 808 }, 809 set_PopupDragHandleControlID: function(value) { 810 Sys.Extended.Deprecated("set_PopupDragHandleControlID(value)", "set_popupDragHandleControlID(value)"); 811 this.set_popupDragHandleControlID(value); 812 }, 813 814 /// <summary> 815 /// A CSS class to apply to the background when the modal popup is displayed 816 /// </summary> 817 /// <getter>get_backgroundCssClass</getter> 818 /// <setter>set_backgroundCssClass</setter> 819 /// <member name="cP:AjaxControlToolkit.ModalPopupExtender.backgroundCssClass" /> 820 get_backgroundCssClass: function() { 821 return this._backgroundCssClass; 822 }, 823 set_backgroundCssClass: function(value) { 824 if(this._backgroundCssClass != value) { 825 this._backgroundCssClass = value; 826 this.raisePropertyChanged('backgroundCssClass'); 827 } 828 }, 829
830 get_BackgroundCssClass: function() { 831 Sys.Extended.Deprecated("get_BackgroundCssClass()", "get_backgroundCssClass()"); 832 return this.get_backgroundCssClass(); 833 }, 834 set_BackgroundCssClass: function(value) { 835 Sys.Extended.Deprecated("set_BackgroundCssClass(value)", "set_backgroundCssClass(value)"); 836 this.set_backgroundCssClass(value); 837 }, 838 839 /// <summary> 840 /// A Boolean value that specifies whether or not a drop shadow should be added to the modal popup 841 /// </summary> 842 /// <getter>get_dropShadow</getter> 843 /// <setter>set_dropShadow</setter> 844 /// <member name="cP:AjaxControlToolkit.ModalPopupExtender.dropShadow" /> 845 get_dropShadow: function() { 846 return this._dropShadow; 847 }, 848 set_dropShadow: function(value) { 849 if(this._dropShadow != value) { 850 this._dropShadow = value; 851 this.raisePropertyChanged('dropShadow'); 852 } 853 }, 854 855 get_DropShadow: function() { 856 Sys.Extended.Deprecated("get_DropShadow()", "get_dropShadow()"); 857 return this.get_dropShadow(); 858 }, 859 set_DropShadow: function(value) { 860 Sys.Extended.Deprecated("set_DropShadow(value)", "set_dropShadow(value)"); 861 this.set_dropShadow(value); 862 }, 863 864 /// <summary> 865 /// A Boolean value that specifies whether or not the modal popup can be dragged 866 /// </summary> 867 /// <remarks> 868 /// This property is obsolete. 869 /// </remarks> 870 /// <getter>get_drag</getter> 871 /// <setter>set_drag</setter> 872 /// <member name="cP:AjaxControlToolkit.ModalPopupExtender.drag" /> 873 get_drag: function() { 874 // Obsolete: Setting the _drag property is a noop 875 return this._drag; 876 }, 877 set_drag: function(value) { 878 if(this._drag != value) { 879 this._drag = value; 880 this.raisePropertyChanged('drag'); 881 } 882 }, 883 884 get_Drag: function() { 885 Sys.Extended.Deprecated("get_Drag()", "get_drag()"); 886 return this.get_drag(); 887 }, 888 set_Drag: function(value) { 889 Sys.Extended.Deprecated("set_Drag(value)", "set_drag(value)"); 890 this.set_drag(value); 891 }, 892 893 /// <summary> 894 /// ID of an element that dismisses the modal popup 895 /// </summary> 896 /// <getter>get_okControlID</getter> 897 /// <setter>set_okControlID</setter> 898 /// <member name="cP:AjaxControlToolkit.ModalPopupExtender.okControlID" /> 899 get_okControlID: function() { 900 return this._okControlID; 901 }, 902 set_okControlID: function(value) { 903 if(this._okControlID != value) { 904 this._okControlID = value; 905 this.raisePropertyChanged('okControlID'); 906 } 907 }, 908 909 get_OkControlID: function() { 910 Sys.Extended.Deprecated("get_OkControlID()", "get_okControlID()"); 911 return this.get_okControlID(); 912 }, 913 set_OkControlID: function(value) { 914 Sys.Extended.Deprecated("set_OkControlID(value)", "set_okControlID(value)"); 915 this.set_okControlID(value); 916 }, 917 918 /// <summary> 919 /// ID of an element that cancels the modal popup 920 /// </summary> 921 /// <getter>get_cancelControlID</getter> 922 /// <setter>set_cancelControlID</setter> 923 /// <member name="cP:AjaxControlToolkit.ModalPopupExtender.cancelControlID" /> 924 get_cancelControlID: function() { 925 return this._cancelControlID; 926 }, 927 set_cancelControlID: function(value) { 928 if(this._cancelControlID != value) { 929 this._cancelControlID = value; 930 this.raisePropertyChanged('cancelControlID'); 931 } 932 }, 933 934 get_CancelControlID: function() { 935 Sys.Extended.Deprecated("get_CancelControlID()", "get_cancelControlID()"); 936 return this.get_cancelControlID(); 937 }, 938 set_CancelControlID: function(value) { 939 Sys.Extended.Deprecated("set_CancelControlID(value)", "set_cancelControlID(value)"); 940 this.set_cancelControlID(value); 941 }, 942 943 /// <summary> 944 /// A script to run when the modal popup is dismissed by the element specified using the okControlID property 945 /// </summary> 946 /// <getter>get_onOkScript</getter> 947 /// <setter>set_onOkScript</setter> 948 /// <member name="cP:AjaxControlToolkit.ModalPopupExtender.onOkScript" /> 949 get_onOkScript: function() { 950 return this._onOkScript; 951 }, 952 set_onOkScript: function(value) { 953 if(this._onOkScript != value) { 954 this._onOkScript = value; 955 this.raisePropertyChanged('onOkScript'); 956 } 957 }, 958 959 get_OnOkScript: function() { 960 Sys.Extended.Deprecated("get_OnOkScript()", "get_onOkScript()"); 961 return this.get_onOkScript(); 962 }, 963 set_OnOkScript: function(value) { 964 Sys.Extended.Deprecated("set_OnOkScript(value)", "set_onOkScript(value)"); 965 this.set_onOkScript(value); 966 }, 967 968 /// <summary> 969 /// A script to run when the modal popup is dismissed by the element specified using the cancelControlID property 970 /// </summary> 971 /// <getter>get_onCancelScript</getter> 972 /// <setter>set_onCancelScript</setter> 973 /// <member name="cP:AjaxControlToolkit.ModalPopupExtender.onCancelScript" /> 974 get_onCancelScript: function() { 975 return this._onCancelScript; 976 }, 977 set_onCancelScript: function(value) { 978 if(this._onCancelScript != value) { 979 this._onCancelScript = value; 980 this.raisePropertyChanged('onCancelScript'); 981 } 982 }, 983 984 get_OnCancelScript: function() { 985 Sys.Extended.Deprecated("get_OnCancelScript()", "get_onCancelScript()"); 986 return this.get_onCancelScript(); 987 }, 988 set_OnCancelScript: function(value) { 989 Sys.Extended.Deprecated("set_OnCancelScript(value)", "set_onCancelScript(value)"); 990 this.set_onCancelScript(value); 991 }, 992 993 /// <summary> 994 /// The Sys.Extended.UI.ModalPopupRepositionMode object that determines whether the modal 995 /// popup should be repositioned on window resize or scroll 996 /// </summary> 997 /// <getter>get_repositionMode</getter> 998 /// <setter>set_repositionMode</setter> 999 /// <member name="cP:AjaxControlToolkit.ModalPopupExtender.repositionMode" /> 1000 get_repositionMode: function() { 1001 return this._repositionMode; 1002 }, 1003 set_repositionMode: function(value) { 1004 if(this._repositionMode !== value) { 1005 this._repositionMode = value; 1006 this.raisePropertyChanged('repositionMode'); 1007 } 1008 }, 1009 1010 /// <summary> 1011 /// A JSON definition of generic OnShowing Animation. Played before the Popup is being shown 1012 /// </summary> 1013 /// <getter>get_onShowing</getter> 1014 /// <setter>set_onShowing</setter> 1015 /// <member name="cP:AjaxControlToolkit.ModalPopupExtender.onShowing" /> 1016 get_onShowing: function() { 1017 return this._onShowing.get_json(); 1018 }, 1019 set_onShowing: function(value) { 1020 this._onShowing.set_json(value); 1021 this.raisePropertyChanged('onShowing'); 1022 }, 1023 1024 get_OnShowing: function() { 1025 Sys.Extended.Deprecated("get_OnShowing()", "get_onShowing()"); 1026 return this.get_onShowing(); 1027 }, 1028 set_OnShowing: function(value) { 1029 Sys.Extended.Deprecated("set_OnShowing(value)", "set_onShowing(value)"); 1030 this.set_onShowing(value); 1031 }, 1032 1033 /// <summary> 1034 /// A JSON definition of generic OnShowing Animation. Played before the Popup is shown 1035 /// </summary> 1036 /// <getter>get_onShown</getter> 1037 /// <setter>set_onShown</setter> 1038 /// <member name="cP:AjaxControlToolkit.ModalPopupExtender.onShown" /> 1039 get_onShown: function() { 1040 return this._onShown.get_json(); 1041 }, 1042 set_onShown: function(value) { 1043 this._onShown.set_json(value); 1044 this.raisePropertyChanged('onShown'); 1045 }, 1046 1047 get_OnShown: function() { 1048 Sys.Extended.Deprecated("get_OnShown()", "get_onShown()"); 1049 return this.get_onShown(); 1050 }, 1051 set_OnShown: function(value) { 1052 Sys.Extended.Deprecated("set_OnShown(value)", "set_onShown(value)"); 1053 this.set_onShown(value); 1054 }, 1055 1056 /// <summary> 1057 /// A JSON definition of generic OnShowing Animation. Played before the Popup is being hidden 1058 /// </summary> 1059 /// <getter>get_onHiding</getter> 1060 /// <setter>set_onHiding</setter> 1061 /// <member name="cP:AjaxControlToolkit.ModalPopupExtender.onHiding" /> 1062 get_onHiding: function() { 1063 return this._onHiding.get_json(); 1064 }, 1065 set_onHiding: function(value) { 1066 this._onHiding.set_json(value); 1067 this.raisePropertyChanged('onHiding'); 1068 }, 1069 1070 get_OnHiding: function() { 1071 Sys.Extended.Deprecated("get_OnHiding()", "get_onHiding()"); 1072 return this.get_onHiding(); 1073 }, 1074 set_OnHiding: function(value) { 1075 Sys.Extended.Deprecated("set_OnHiding(value)", "set_onHiding(value)");
1076 this.set_onHiding(value); 1077 }, 1078 1079 /// <summary> 1080 /// A JSON definition of generic OnShowing Animation. Played before the Popup is hidden 1081 /// </summary> 1082 /// <getter>get_onHidden</getter> 1083 /// <setter>set_onHidden</setter> 1084 /// <member name="cP:AjaxControlToolkit.ModalPopupExtender.onHidden" /> 1085 get_onHidden: function() { 1086 return this._onHidden.get_json(); 1087 }, 1088 set_onHidden: function(value) { 1089 this._onHidden.set_json(value); 1090 this.raisePropertyChanged('onHidden'); 1091 }, 1092 1093 get_OnHidden: function() { 1094 Sys.Extended.Deprecated("get_OnHidden()", "get_onHidden()"); 1095 return this.get_onHidden(); 1096 }, 1097 set_OnHidden: function(value) { 1098 Sys.Extended.Deprecated("set_OnHidden(value)", "set_onHidden(value)"); 1099 this.set_onHidden(value); 1100 }, 1101 1102 /// <summary> 1103 /// Fires when the popup is being shown 1104 /// </summary> 1105 /// <event add="add_showing" remove="remove_showing" raise="raise_showing" /> 1106 /// <member name="cE:AjaxControlToolkit.ModalPopupExtender.showing" /> 1107 add_showing: function(handler) { 1108 // Add an event handler for the showing event 1109 this.get_events().addHandler('showing', handler); 1110 }, 1111 remove_showing: function(handler) { 1112 // Remove an event handler from the showing event 1113 this.get_events().removeHandler('showing', handler); 1114 }, 1115 raise_showing: function(eventArgs) { 1116 var handler = this.get_events().getHandler('showing'); 1117 1118 if(handler) 1119 handler(this, eventArgs); 1120 }, 1121 raiseShowing: function(eventArgs) { 1122 Sys.Extended.Deprecated("raiseShowing(eventArgs)", "raise_showing(eventArgs)"); 1123 this.raise_showing(eventArgs); 1124 }, 1125 1126 /// <summary> 1127 /// Fires when the popup is shown 1128 /// </summary> 1129 /// <event add="add_shown" remove="remove_shown" raise="raise_shown" /> 1130 /// <member name="cE:AjaxControlToolkit.ModalPopupExtender.shown" /> 1131 add_shown: function(handler) { 1132 this.get_events().addHandler('shown', handler); 1133 }, 1134 remove_shown: function(handler) { 1135 this.get_events().removeHandler('shown', handler); 1136 }, 1137 raise_shown: function(eventArgs) { 1138 var handler = this.get_events().getHandler('shown'); 1139 1140 if(handler) 1141 handler(this, eventArgs); 1142 }, 1143 raiseShown: function(eventArgs) { 1144 Sys.Extended.Deprecated("raiseShown(eventArgs)", "raise_shown(eventArgs)"); 1145 this.raise_shown(eventArgs); 1146 }, 1147 1148 /// <summary> 1149 /// Fires when the popup is being hidden 1150 /// </summary> 1151 /// <event add="add_hiding" remove="remove_hiding" raise="raise_hiding" /> 1152 /// <member name="cE:AjaxControlToolkit.ModalPopupExtender.hiding" /> 1153 add_hiding: function(handler) { 1154 this.get_events().addHandler('hiding', handler); 1155 }, 1156 remove_hiding: function(handler) { 1157 this.get_events().removeHandler('hiding', handler); 1158 }, 1159 raise_hiding: function(eventArgs) { 1160 var handler = this.get_events().getHandler('hiding'); 1161 1162 if(handler) 1163 handler(this, eventArgs); 1164 }, 1165 raiseHiding: function(eventArgs) { 1166 Sys.Extended.Deprecated("raiseHiding(eventArgs)", "raise_hiding(eventArgs)"); 1167 this.raise_hiding(eventArgs); 1168 }, 1169 1170 /// <summary> 1171 /// Fires when the popup is hidden 1172 /// </summary> 1173 /// <event add="add_hidden" remove="remove_hidden" raise="raise_hidden" /> 1174 /// <member name="cE:AjaxControlToolkit.ModalPopupExtender.hidden" /> 1175 add_hidden: function(handler) { 1176 this.get_events().addHandler('hidden', handler); 1177 }, 1178 remove_hidden: function(handler) { 1179 this.get_events().removeHandler('hidden', handler); 1180 }, 1181 raise_hidden: function(eventArgs) { 1182 var handler = this.get_events().getHandler('hidden'); 1183 1184 if(handler) 1185 handler(this, eventArgs); 1186 }, 1187 raiseHidden: function(eventArgs) { 1188 Sys.Extended.Deprecated("raiseHidden(eventArgs)", "raise_hidden(eventArgs)"); 1189 this.raise_hidden(eventArgs); 1190 } 1191}; 1192 1193Sys.Extended.UI.ModalPopupBehavior.registerClass('Sys.Extended.UI.ModalPopupBehavior', Sys.Extended.UI.DynamicPopulateBehaviorBase); 1194 1195Sys.Extended.UI.ModalPopupBehavior.invokeViaServer = function(behaviorID, show) { 1196 // This static function (that is intended to be called from script emitted 1197 // on the server) will show or hide the behavior associated with behaviorID 1198 // (i.e. to use this, the ModalPopupExtender must have an ID or BehaviorID) and 1199 // will either show or hide depending on the show parameter. 1200 var behavior = $find(behaviorID); 1201 1202 if(behavior) { 1203 if(show) 1204 behavior.show(); 1205 else 1206 behavior.hide(); 1207 } 1208}; 1209 1210Sys.Extended.UI.ModalPopupBehavior.popups = [];
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.