1// Name: ModalPopup.ModalPopupBehavior.debug.js 2// Assembly: AjaxControlToolkit 3// Version: 4.1.7.1213 4// FileVersion: 4.1.7.1213 5// (c) 2010 CodePlex Foundation 6 7 8 9/// <reference name="MicrosoftAjax.debug.js" /> 10/// <reference name="MicrosoftAjaxTimer.debug.js" /> 11/// <reference name="MicrosoftAjaxWebForms.debug.js" /> 12/// <reference path="../ExtenderBase/BaseScripts.js" /> 13/// <reference path="../Common/Common.js" /> 14/// <reference path="../DynamicPopulate/DynamicPopulateBehavior.js" /> 15/// <reference path="../RoundedCorners/RoundedCornersBehavior.js" /> 16/// <reference path="../Compat/Timer/Timer.js" /> 17/// <reference path="../DropShadow/DropShadowBehavior.js" /> 18/// <reference path="../Compat/DragDrop/DragDropScripts.js" /> 19/// <reference path="../DragPanel/FloatingBehavior.js" /> 20 21 22Type.registerNamespace('Sys.Extended.UI'); 23 24Sys.Extended.UI.ModalPopupRepositionMode = function () { 25 /// <summary> 26 /// The ModalPopupRepositionMode enumeration describes how the modal popup repositions 27 /// </summary> 28 /// <field name="None" type="Number" integer="true" /> 29 /// <field name="RepositionOnWindowResize" type="Number" integer="true" /> 30 /// <field name="RepositionOnWindowScroll" type="Number" integer="true" /> 31 /// <field name="RepositionOnWindowResizeAndScroll" type="Number" integer="true" /> 32 throw Error.invalidOperation(); 33}; 34Sys.Extended.UI.ModalPopupRepositionMode.prototype = { 35 None: 0, 36 RepositionOnWindowResize: 1, 37 RepositionOnWindowScroll: 2, 38 RepositionOnWindowResizeAndScroll: 3 39}; 40Sys.Extended.UI.ModalPopupRepositionMode.registerEnum('Sys.Extended.UI.ModalPopupRepositionMode'); 41 42 43Sys.Extended.UI.ModalPopupBehavior = function (element) { 44 /// <summary> 45 /// The ModalPopupBehavior is used to display the target element as a modal dialog 46 /// </summary> 47 /// <param name="element" type="Sys.UI.DomElement" domElement="true"> 48 /// DOM Element the behavior is associated with 49 /// </param> 50 Sys.Extended.UI.ModalPopupBehavior.initializeBase(this, [element]); 51 52 this._PopupControlID = null; 53 this._PopupDragHandleControlID = null;
54 this._BackgroundCssClass = null; 55 this._DropShadow = false; 56 this._Drag = false; 57 this._OkControlID = null; 58 this._CancelControlID = null; 59 this._OnOkScript = null; 60 this._OnCancelScript = null; 61 this._xCoordinate = -1; 62 this._yCoordinate = -1; 63 this._repositionMode = Sys.Extended.UI.ModalPopupRepositionMode.RepositionOnWindowResizeAndScroll; 64 this._onShown = new Sys.Extended.UI.Animation.GenericAnimationBehavior(element); //element replaced later with popuptarget 65 this._onHidden = new Sys.Extended.UI.Animation.GenericAnimationBehavior(element); 66 this._onShowing = new Sys.Extended.UI.Animation.GenericAnimationBehavior(element); 67 this._onHiding = new Sys.Extended.UI.Animation.GenericAnimationBehavior(element); 68 69 this._backgroundElement = null; 70 this._foregroundElement = null; 71 this._relativeOrAbsoluteParentElement = null; 72 this._popupElement = null; 73 this._dragHandleElement = null; 74 this._showHandler = null; 75 this._okHandler = null; 76 this._cancelHandler = null; 77 this._scrollHandler = null; 78 this._resizeHandler = null; 79 this._windowHandlersAttached = false; 80 this._dropShadowBehavior = null; 81 this._dragBehavior = null; 82 this._isIE6 = false; 83 84 this._saveTabIndexes = new Array(); 85 this._saveDesableSelect = new Array(); 86 this._tagWithTabIndex = new Array('A', 'AREA', 'BUTTON', 'INPUT', 'OBJECT', 'SELECT', 'TEXTAREA', 'IFRAME'); 87 88 this._isAnimationJustEnded = false; 89 this._hidingAnimationEndedHandler = null; 90 this._showingAnimationEndedHandler = null; 91 92}; 93Sys.Extended.UI.ModalPopupBehavior.prototype = { 94 initialize: function () { 95 /// <summary> 96 /// Initialize the behavior 97 /// </summary> 98 99 /* 100 <div superpopup - drag container resizable><div -- drag handle\dropshadow foreground></div></div> 101 */ 102 Sys.Extended.UI.ModalPopupBehavior.callBaseMethod(this, 'initialize'); 103 this._isIE6 = (Sys.Browser.agent == Sys.Browser.InternetExplorer && Sys.Browser.version < 7); 104 if (this._PopupDragHandleControlID) 105 this._dragHandleElement = $get(this._PopupDragHandleControlID); 106 107 this._popupElement = $get(this._PopupControlID); 108 if (this._DropShadow) { 109 this._foregroundElement = document.createElement('div'); 110 this._foregroundElement.id = this.get_id() + '_foregroundElement'; 111 this._popupElement.parentNode.appendChild(this._foregroundElement); 112 this._foregroundElement.appendChild(this._popupElement); 113 } 114 else { 115 this._foregroundElement = this._popupElement; 116 } 117 this._backgroundElement = document.createElement('div'); 118 this._backgroundElement.id = this.get_id() + '_backgroundElement'; 119 this._backgroundElement.style.display = 'none'; 120 this._backgroundElement.style.position = 'fixed'; 121 this._backgroundElement.style.left = '0px'; 122 this._backgroundElement.style.top = '0px'; 123 this._backgroundElement.style.zIndex = 10000;
124 if (this._BackgroundCssClass) { 125 this._backgroundElement.className = this._BackgroundCssClass; 126 } 127 this._foregroundElement.parentNode.appendChild(this._backgroundElement); 128 129 this._foregroundElement.style.display = 'none'; 130 this._foregroundElement.style.position = 'fixed'; 131 this._foregroundElement.style.zIndex = $common.getCurrentStyle(this._backgroundElement, 'zIndex', this._backgroundElement.style.zIndex) + 1; 132 133 this._showHandler = Function.createDelegate(this, this._onShow); 134 $addHandler(this.get_element(), 'click', this._showHandler); 135 136 if (this._OkControlID) { 137 this._okHandler = Function.createDelegate(this, this._onOk); 138 $addHandler($get(this._OkControlID), 'click', this._okHandler); 139 } 140 141 if (this._CancelControlID) { 142 this._cancelHandler = Function.createDelegate(this, this._onCancel); 143 $addHandler($get(this._CancelControlID), 'click', this._cancelHandler); 144 } 145 146 this._scrollHandler = Function.createDelegate(this, this._onLayout); 147 this._resizeHandler = Function.createDelegate(this, this._onLayout); 148 149 this.registerPartialUpdateEvents(); 150 151 this._resetAnimationsTarget(); 152 153 if (this._onHiding.get_animation()) { 154 this._hidingAnimationEndedHandler = Function.createDelegate(this, function () { 155 this._isAnimationJustEnded = true; 156 this.hide(); 157 }); 158 this._onHiding.get_animation().add_ended(this._hidingAnimationEndedHandler); 159 } 160 161 if (this._onShowing.get_animation()) { 162 this._showingAnimationEndedHandler = Function.createDelegate(this, function () { 163 this._isAnimationJustEnded = true; 164 this.show(); 165 }); 166 this._onShowing.get_animation().add_ended(this._showingAnimationEndedHandler); 167 } 168 }, 169 170 dispose: function () { 171 /// <summary> 172 /// Dispose the behavior 173 /// </summary> 174 175 this._hideImplementation(); 176 177 if (this._foregroundElement && this._foregroundElement.parentNode) { 178 this._foregroundElement.parentNode.removeChild(this._backgroundElement); 179 180 if (this._DropShadow) { 181 this._foregroundElement.parentNode.appendChild(this._popupElement); 182 this._foregroundElement.parentNode.removeChild(this._foregroundElement); 183 } 184 } 185 186 this._scrollHandler = null; 187 this._resizeHandler = null; 188 if (this._cancelHandler && $get(this._CancelControlID)) { 189 $removeHandler($get(this._CancelControlID), 'click', this._cancelHandler); 190 this._cancelHandler = null; 191 } 192 if (this._okHandler && $get(this._OkControlID)) { 193 $removeHandler($get(this._OkControlID), 'click', this._okHandler); 194 this._okHandler = null; 195 } 196 if (this._showHandler) { 197 $removeHandler(this.get_element(), 'click', this._showHandler); 198 this._showHandler = null; 199 } 200 201 if (this._hidingAnimationEndedHandler) { 202 this._onHiding.get_animation().remove_ended(this._hidingAnimationEndedHandler); 203 } 204 205 if (this._showingAnimationEndedHandler) { 206 this._onShowing.get_animation().remove_ended(this._showingAnimationEndedHandler); 207 } 208 209 Sys.Extended.UI.ModalPopupBehavior.callBaseMethod(this, 'dispose'); 210 }, 211 212 _attachPopup: function () { 213 /// <summary> 214 /// Attach the event handlers for the popup 215 /// </summary> 216 217 if (this._DropShadow && !this._dropShadowBehavior) { 218 this._dropShadowBehavior = $create(Sys.Extended.UI.DropShadowBehavior, {}, null, null, this._popupElement); 219 } 220 if (this._dragHandleElement && !this._dragBehavior) { 221 this._dragBehavior = $create(Sys.Extended.UI.FloatingBehavior, { "handle": this._dragHandleElement }, null, null, this._foregroundElement); 222 } 223 224 $addHandler(window, 'resize', this._resizeHandler); 225 $addHandler(window, 'scroll', this._scrollHandler); 226 this._windowHandlersAttached = true; 227 }, 228 229 _detachPopup: function () { 230 /// <summary> 231 /// Detach the event handlers for the popup 232 /// </summary> 233 234 if (this._windowHandlersAttached) { 235 if (this._scrollHandler) { 236 $removeHandler(window, 'scroll', this._scrollHandler); 237 } 238 if (this._resizeHandler) { 239 $removeHandler(window, 'resize', this._resizeHandler); 240 } 241 this._windowHandlersAttached = false; 242 } 243 244 if (this._dragBehavior) { 245 this._dragBehavior.dispose(); 246 this._dragBehavior = null; 247 } 248 249 if (this._dropShadowBehavior) { 250 this._dropShadowBehavior.dispose(); 251 this._dropShadowBehavior = null; 252 } 253 }, 254 255 _onShow: function (e) { 256 /// <summary> 257 /// Handler for the target's click event 258 /// </summary> 259 /// <param name="e" type="Sys.UI.DomEvent"> 260 /// Event info 261 /// </param> 262
263 if (!this.get_element().disabled) { 264 this.show(); 265 e.preventDefault(); 266 return false; 267 } 268 }, 269 270 _onOk: function (e) { 271 /// <summary> 272 /// Handler for the modal dialog's OK button click 273 /// </summary> 274 /// <param name="e" type="Sys.UI.DomEvent"> 275 /// Event info 276 /// </param> 277 278 var element = $get(this._OkControlID); 279 if (element && !element.disabled) { 280 if (this.hide() && this._OnOkScript) { 281 window.setTimeout(this._OnOkScript, 0); 282 } 283 e.preventDefault(); 284 return false; 285 } 286 }, 287 288 _onCancel: function (e) { 289 /// <summary> 290 /// Handler for the modal dialog's Cancel button click 291 /// </summary> 292 /// <param name="e" type="Sys.UI.DomEvent"> 293 /// Event info 294 /// </param> 295 296 var element = $get(this._CancelControlID); 297 if (element && !element.disabled) { 298 if (this.hide() && this._OnCancelScript) { 299 window.setTimeout(this._OnCancelScript, 0); 300 } 301 e.preventDefault(); 302 return false; 303 } 304 }, 305 306 _onLayout: function (e) { 307 /// <summary> 308 /// Handler for scrolling and resizing events that would require a repositioning of the modal dialog 309 /// </summary> 310 /// <param name="e" type="Sys.UI.DomEvent"> 311 /// Event info 312 /// </param> 313 var positioning = this.get_repositionMode(); 314 if (((positioning === Sys.Extended.UI.ModalPopupRepositionMode.RepositionOnWindowScroll) || 315 (positioning === Sys.Extended.UI.ModalPopupRepositionMode.RepositionOnWindowResizeAndScroll)) && (e.type === 'scroll')) { 316 this._layout(); 317 } else if (((positioning === Sys.Extended.UI.ModalPopupRepositionMode.RepositionOnWindowResize) || 318 (positioning === Sys.Extended.UI.ModalPopupRepositionMode.RepositionOnWindowResizeAndScroll)) && (e.type === 'resize')) { 319 this._layout(); 320 } else { 321 this._layoutBackgroundElement(); 322 } 323 }, 324 325 show: function () { 326 /// <summary> 327 /// Display the element referenced by PopupControlID as a modal dialog 328 /// </summary> 329 330 if (!this._isAnimationJustEnded) { 331 var eventArgs = new Sys.CancelEventArgs(); 332 this.raiseShowing(eventArgs); 333 if (eventArgs.get_cancel()) { 334 return; 335 } 336 else if (this._onShowing.get_animation()) { 337 this._onShowing.play(); 338 return; 339 } 340 } 341 else { 342 this._isAnimationJustEnded = false; 343 } 344 345 this.populate(); 346 this._attachPopup(); 347 348 this._backgroundElement.style.display = ''; 349 this._foregroundElement.style.display = ''; 350 this._popupElement.style.display = ''; 351 if (this._isIE6) { 352 this._foregroundElement.style.position = 'absolute'; 353 this._backgroundElement.style.position = 'absolute'; 354 var tempRelativeOrAbsoluteParent = this._foregroundElement.parentNode; 355 while (tempRelativeOrAbsoluteParent && (tempRelativeOrAbsoluteParent != document.documentElement)) { 356 if ((tempRelativeOrAbsoluteParent.style.position != 'relative') && (tempRelativeOrAbsoluteParent.style.position != 'absolute')) { 357 tempRelativeOrAbsoluteParent = tempRelativeOrAbsoluteParent.parentNode; 358 } else { 359 this._relativeOrAbsoluteParentElement = tempRelativeOrAbsoluteParent; 360 break; 361 } 362 } 363 } 364 365 366 this.disableTab(); 367 368 this._layout(); 369 this._layout(); 370 371 this.raiseShown(Sys.EventArgs.Empty); 372 373 this._onShown.play(); 374 }, 375 376 disableTab: function () { 377 /// <summary> 378 /// Change the tab indices so we only tab through the modal popup 379 /// (and hide SELECT tags in IE6) 380 /// </summary> 381 382 var i = 0; 383 var tagElements; 384 var tagElementsInPopUp = new Array(); 385 Array.clear(this._saveTabIndexes); 386 387 for (var j = 0; j < this._tagWithTabIndex.length; j++) { 388 tagElements = this._foregroundElement.getElementsByTagName(this._tagWithTabIndex[j]); 389 for (var k = 0; k < tagElements.length; k++) { 390 tagElementsInPopUp[i] = tagElements[k]; 391 i++; 392 } 393 } 394 395 i = 0; 396 for (var j = 0; j < this._tagWithTabIndex.length; j++) { 397 tagElements = document.getElementsByTagName(this._tagWithTabIndex[j]); 398 for (var k = 0; k < tagElements.length; k++) { 399 if (Array.indexOf(tagElementsInPopUp, tagElements[k]) == -1) { 400 this._saveTabIndexes[i] = { tag: tagElements[k], index: tagElements[k].tabIndex }; 401 tagElements[k].tabIndex = "-1"; 402 i++; 403 } 404 } 405 } 406 407 i = 0; 408 if ((Sys.Browser.agent === Sys.Browser.InternetExplorer) && (Sys.Browser.version < 7)) { 409 var tagSelectInPopUp = new Array(); 410 for (var j = 0; j < this._tagWithTabIndex.length; j++) { 411 tagElements = this._foregroundElement.getElementsByTagName('SELECT'); 412 for (var k = 0; k < tagElements.length; k++) { 413 tagSelectInPopUp[i] = tagElements[k]; 414 i++; 415 } 416 } 417 418 i = 0; 419 Array.clear(this._saveDesableSelect); 420 tagElements = document.getElementsByTagName('SELECT'); 421 for (var k = 0; k < tagElements.length; k++) { 422 if (Array.indexOf(tagSelectInPopUp, tagElements[k]) == -1) { 423 this._saveDesableSelect[i] = { tag: tagElements[k], visib: $common.getCurrentStyle(tagElements[k], 'visibility') }; 424 tagElements[k].style.visibility = 'hidden'; 425 i++; 426 } 427 } 428 } 429 }, 430 431 restoreTab: function () { 432 /// <summary> 433 /// Restore the tab indices so we tab through the page like normal 434 /// (and restore SELECT tags in IE6) 435 /// </summary> 436 437 for (var i = 0; i < this._saveTabIndexes.length; i++) { 438 this._saveTabIndexes[i].tag.tabIndex = this._saveTabIndexes[i].index; 439 } 440 Array.clear(this._saveTabIndexes); 441 442 if ((Sys.Browser.agent === Sys.Browser.InternetExplorer) && (Sys.Browser.version < 7)) { 443 for (var k = 0; k < this._saveDesableSelect.length; k++) { 444 this._saveDesableSelect[k].tag.style.visibility = this._saveDesableSelect[k].visib; 445 } 446 Array.clear(this._saveDesableSelect); 447 } 448 }, 449 450 hide: function () { 451 /// <summary> 452 /// Hide the modal dialog 453 /// </summary> 454 /// <returns type="Boolean" mayBeNull="false"> 455 /// Whether or not the dialog was hidden 456 /// </returns> 457 458 if (!this._isAnimationJustEnded) { 459 var eventArgs = new Sys.CancelEventArgs(); 460 this.raiseHiding(eventArgs); 461 if (eventArgs.get_cancel()) { 462 return false; 463 } 464 else if (this._onHiding.get_animation()) { 465 this._onHiding.play(); 466 return true; 467 } 468 } 469 else { 470 this._isAnimationJustEnded = false; 471 } 472 473 this._hideImplementation(); 474 475 this.raiseHidden(Sys.EventArgs.Empty); 476 477 this._onHidden.play(); 478 479 return true; 480 }, 481 482 _hideImplementation: function () { 483 /// <summary> 484 /// Internal implementation to hide the modal dialog 485 /// </summary> 486 487 this._backgroundElement.style.display = 'none'; 488 this._foregroundElement.style.display = 'none'; 489 490 this.restoreTab(); 491 492 this._detachPopup(); 493 }, 494 495 _layout: function () { 496 /// <summary> 497 /// Position the modal dialog 498 /// </summary> 499 var scrollLeft = (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft); 500 var scrollTop = (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); 501 502 var clientBounds = $common.getClientBounds(); 503 var clientWidth = clientBounds.width; 504 var clientHeight = clientBounds.height; 505
506 this._layoutBackgroundElement(); 507 508 var xCoord = 0; 509 var yCoord = 0; 510 if (this._xCoordinate < 0) { 511 var foregroundelementwidth = this._foregroundElement.offsetWidth ? this._foregroundElement.offsetWidth : this._foregroundElement.scrollWidth; 512 xCoord = ((clientWidth - foregroundelementwidth) / 2); 513 if (this._foregroundElement.style.position == 'absolute') { 514 xCoord += scrollLeft; 515 } 516 this._foregroundElement.style.left = xCoord + 'px'; 517 518 } else { 519 if (this._isIE6) { 520 this._foregroundElement.style.left = (this._xCoordinate + scrollLeft) + 'px'; 521 xCoord = this._xCoordinate + scrollLeft; 522 } 523 else { 524 this._foregroundElement.style.left = this._xCoordinate + 'px'; 525 xCoord = this._xCoordinate; 526 } 527 } 528 if (this._yCoordinate < 0) { 529 var foregroundelementheight = this._foregroundElement.offsetHeight ? this._foregroundElement.offsetHeight : this._foregroundElement.scrollHeight; 530 yCoord = ((clientHeight - foregroundelementheight) / 2); 531 if (this._foregroundElement.style.position == 'absolute') { 532 yCoord += scrollTop; 533 } 534 this._foregroundElement.style.top = yCoord + 'px'; 535 536 } else { 537 if (this._isIE6) { 538 this._foregroundElement.style.top = (this._yCoordinate + scrollTop) + 'px'; 539 yCoord = this._yCoordinate + scrollTop; 540 } 541 else { 542 this._foregroundElement.style.top = this._yCoordinate + 'px'; 543 yCoord = this._yCoordinate; 544 } 545 } 546 547 this._layoutForegroundElement(xCoord, yCoord); 548 549 if (this._dropShadowBehavior) { 550 this._dropShadowBehavior.setShadow(); 551 window.setTimeout(Function.createDelegate(this, this._fixupDropShadowBehavior), 0); 552 } 553 554 this._layoutBackgroundElement(); 555 }, 556 557 _layoutForegroundElement: function (xCoord, yCoord) { 558 /// <summary> 559 /// Set the correct location of the foreground element to ensure that it is absolutely 560 /// positioned with respect to the browser. This is just a workaround for IE 6 since 561 /// elements nested in relative parents cause modal popup positioning issues and 'fixed' 562 /// is not supported by IE 6. Hence we manually compute the right location of the popup. 563 /// </summary> 564 /// <param name="xCoord" type="Number" integer="true" maybenull="false"> 565 /// <param name="yCoord" type="Number" integer="true" maybenull="false"> 566 /// </params> 567 568 if (this._isIE6 && this._relativeOrAbsoluteParentElement) { 569 var foregroundLocation = $common.getLocation(this._foregroundElement); 570 var relativeParentLocation = $common.getLocation(this._relativeOrAbsoluteParentElement); 571 var getLocationXCoord = foregroundLocation.x; 572 if (getLocationXCoord != xCoord) { 573 this._foregroundElement.style.left = (xCoord - relativeParentLocation.x) + 'px'; 574 } 575 576 var getLocationYCoord = foregroundLocation.y; 577 if (getLocationYCoord != yCoord) { 578 this._foregroundElement.style.top = (yCoord - relativeParentLocation.y) + 'px'; 579 } 580 } 581 }, 582 583 _layoutBackgroundElement: function () { 584 /// <summary> 585 /// Set the correct location of the background element to ensure that it is absolutely 586 /// positioned with respect to the browser. 587 /// </summary> 588 589 if (this._isIE6) { 590 var backgroundLocation = $common.getLocation(this._backgroundElement); 591 var backgroundXCoord = backgroundLocation.x; 592 if (backgroundXCoord != 0) { 593 this._backgroundElement.style.left = (-backgroundXCoord) + 'px'; 594 } 595 596 var backgroundYCoord = backgroundLocation.y; 597 if (backgroundYCoord != 0) { 598 this._backgroundElement.style.top = (-backgroundYCoord) + 'px'; 599 } 600 } 601 var clientBounds = $common.getClientBounds(); 602 var clientWidth = clientBounds.width; 603 var clientHeight = clientBounds.height; 604 this._backgroundElement.style.width = Math.max(Math.max(document.documentElement.scrollWidth, document.body.scrollWidth), clientWidth) + 'px'; 605 this._backgroundElement.style.height = Math.max(Math.max(document.documentElement.scrollHeight, document.body.scrollHeight), clientHeight) + 'px'; 606 }, 607 608 _fixupDropShadowBehavior: function () { 609 /// <summary> 610 /// Some browsers don't update the location values immediately, so 611 /// the location of the drop shadow would always be a step behind 612 /// without this method 613 /// </summary> 614 615 if (this._dropShadowBehavior) { 616 this._dropShadowBehavior.setShadow(); 617 } 618 }, 619 620 _partialUpdateEndRequest: function (sender, endRequestEventArgs) { 621 /// <summary> 622 /// Show the popup if requested during a partial postback 623 /// </summary> 624 /// <param name="sender" type="Object"> 625 /// Sender 626 /// </param> 627 /// <param name="endRequestEventArgs" type="Sys.WebForms.EndRequestEventArgs"> 628 /// Event arguments 629 /// </param> 630 /// <returns /> 631 Sys.Extended.UI.ModalPopupBehavior.callBaseMethod(this, '_partialUpdateEndRequest', [sender, endRequestEventArgs]); 632
633 if (this.get_element()) { 634 var action = endRequestEventArgs.get_dataItems()[this.get_element().id]; 635 if ("show" == action) { 636 this.show(); 637 } else if ("hide" == action) { 638 this.hide(); 639 } 640 } 641 642 this._layout(); 643 }, 644 645 _onPopulated: function (sender, eventArgs) { 646 /// <summary> 647 /// Re-layout the popup after we've dynamically populated 648 /// </summary> 649 /// <param name="sender" type="Object"> 650 /// Sender 651 /// </param> 652 /// <param name="eventArgs" type="Sys.EventArgs"> 653 /// Event arguments 654 /// </param> 655 /// <returns /> 656 Sys.Extended.UI.ModalPopupBehavior.callBaseMethod(this, '_onPopulated', [sender, eventArgs]); 657 658 this._layout(); 659 }, 660 661 _replaceAnimationTarget: function (memberName, target) { 662 var json = this[memberName].get_json(); 663 this[memberName] = new Sys.Extended.UI.Animation.GenericAnimationBehavior(target); 664 this[memberName].set_json(json); 665 this[memberName].initialize(); 666 }, 667 668 _resetAnimationsTarget: function () { 669 670 var target = $get(this.get_PopupControlID()); 671 672 this._replaceAnimationTarget('_onShowing', target); 673 this._replaceAnimationTarget('_onShown', target); 674 this._replaceAnimationTarget('_onHiding', target); 675 this._replaceAnimationTarget('_onHidden', target); 676 }, 677 678 get_PopupControlID: function () { 679 /// <value type="String"> 680 /// The ID of the element to display as a modal popup 681 /// </value> 682 return this._PopupControlID; 683 }, 684 set_PopupControlID: function (value) { 685 if (this._PopupControlID != value) { 686 this._PopupControlID = value; 687 this.raisePropertyChanged('PopupControlID'); 688 } 689 }, 690 691 get_X: function () { 692 /// <value type="Number" integer="true"> 693 /// The number of pixels from the left of the browser to position the modal popup. 694 /// </value> 695 return this._xCoordinate; 696 }, 697 set_X: function (value) { 698 if (this._xCoordinate != value) { 699 this._xCoordinate = value; 700 this.raisePropertyChanged('X'); 701 } 702 }, 703 704 get_Y: function () { 705 /// <value type="Number" integer="true"> 706 /// The number of pixels from the top of the browser to position the modal popup. 707 /// </value> 708 return this._yCoordinate; 709 }, 710 set_Y: function (value) { 711 if (this._yCoordinate != value) { 712 this._yCoordinate = value; 713 this.raisePropertyChanged('Y'); 714 } 715 }, 716 717 get_PopupDragHandleControlID: function () { 718 /// <value type="String"> 719 /// The ID of the element to display as the drag handle for the modal popup 720 /// </value> 721 return this._PopupDragHandleControlID; 722 }, 723 set_PopupDragHandleControlID: function (value) { 724 if (this._PopupDragHandleControlID != value) { 725 this._PopupDragHandleControlID = value; 726 this.raisePropertyChanged('PopupDragHandleControlID'); 727 } 728 }, 729 730 get_BackgroundCssClass: function () { 731 /// <value type="String"> 732 /// The CSS class to apply to the background when the modal popup is displayed 733 /// </value>
734 return this._BackgroundCssClass; 735 }, 736 set_BackgroundCssClass: function (value) { 737 if (this._BackgroundCssClass != value) { 738 this._BackgroundCssClass = value; 739 this.raisePropertyChanged('BackgroundCssClass'); 740 } 741 }, 742 743 get_DropShadow: function () { 744 /// <value type="Boolean"> 745 /// Whether or not a drop-shadow should be added to the modal popup 746 /// </value> 747 return this._DropShadow; 748 }, 749 set_DropShadow: function (value) { 750 if (this._DropShadow != value) { 751 this._DropShadow = value; 752 this.raisePropertyChanged('DropShadow'); 753 } 754 }, 755 756 get_Drag: function () { 757 /// <value type="Boolean"> 758 /// Obsolete: Setting the _Drag property is a noop 759 /// </value> 760 return this._Drag; 761 }, 762 set_Drag: function (value) { 763 if (this._Drag != value) { 764 this._Drag = value; 765 this.raisePropertyChanged('Drag'); 766 } 767 }, 768 769 get_OkControlID: function () { 770 /// <value type="String"> 771 /// The ID of the element that dismisses the modal popup 772 /// </value> 773 return this._OkControlID; 774 }, 775 set_OkControlID: function (value) { 776 if (this._OkControlID != value) { 777 this._OkControlID = value; 778 this.raisePropertyChanged('OkControlID'); 779 } 780 }, 781 782 get_CancelControlID: function () { 783 /// <value type="String"> 784 /// The ID of the element that cancels the modal popup 785 /// </value> 786 return this._CancelControlID; 787 }, 788 set_CancelControlID: function (value) { 789 if (this._CancelControlID != value) { 790 this._CancelControlID = value; 791 this.raisePropertyChanged('CancelControlID'); 792 } 793 }, 794 795 get_OnOkScript: function () { 796 /// <value type="String"> 797 /// Script to run when the modal popup is dismissed with the OkControlID 798 /// </value> 799 return this._OnOkScript; 800 }, 801 set_OnOkScript: function (value) { 802 if (this._OnOkScript != value) { 803 this._OnOkScript = value; 804 this.raisePropertyChanged('OnOkScript'); 805 } 806 }, 807 808 get_OnCancelScript: function () { 809 /// <value type="String"> 810 /// Script to run when the modal popup is dismissed with the CancelControlID 811 /// </value> 812 return this._OnCancelScript; 813 }, 814 set_OnCancelScript: function (value) { 815 if (this._OnCancelScript != value) { 816 this._OnCancelScript = value; 817 this.raisePropertyChanged('OnCancelScript'); 818 } 819 }, 820 821 get_repositionMode: function () { 822 /// <value type="AjaxControlToolkit.ModalPopupRepositionMode"> 823 /// Determines if the ModalPopup should be repositioned on window resize/scroll 824 /// </value> 825 return this._repositionMode; 826 }, 827 set_repositionMode: function (value) { 828 if (this._repositionMode !== value) { 829 this._repositionMode = value; 830 this.raisePropertyChanged('RepositionMode'); 831 } 832 }, 833 834 get_OnShowing: function () { 835 /// <value type="String" mayBeNull="true"> 836 /// Generic OnShowing Animation's JSON definition. Played before the Popup is being shown. 837 /// </value> 838 return this._onShowing.get_json(); 839 }, 840 841 set_OnShowing: function (value) { 842 this._onShowing.set_json(value); 843 this.raisePropertyChanged('OnShowing'); 844 }, 845 846 get_OnShown: function () { 847 /// <value type="String" mayBeNull="true"> 848 /// Generic OnShown Animation's JSON definition. Played once the Popup is shown. 849 /// </value> 850 return this._onShown.get_json(); 851 }, 852 853 set_OnShown: function (value) { 854 this._onShown.set_json(value); 855 this.raisePropertyChanged('OnShown'); 856 }, 857 858 get_OnHiding: function () { 859 /// <value type="String" mayBeNull="true"> 860 /// Generic OnHiding Animation's JSON definition. Played before the Popup is being hidden. 861 /// </value> 862 return this._onHiding.get_json(); 863 }, 864 865 set_OnHiding: function (value) { 866 this._onHiding.set_json(value); 867 this.raisePropertyChanged('OnHiding'); 868 }, 869 870 get_OnHidden: function () { 871 /// <value type="String" mayBeNull="true"> 872 /// Generic OnHidden Animation's JSON definition. Played once the Popup is hidden. 873 /// </value> 874 return this._onHidden.get_json(); 875 }, 876 877 set_OnHidden: function (value) { 878 this._onHidden.set_json(value); 879 this.raisePropertyChanged('OnHidden'); 880 }, 881 882 add_showing: function (handler) { 883 /// <summary> 884 /// Add an event handler for the showing event 885 /// </summary> 886 /// <param name="handler" type="Function" mayBeNull="false"> 887 /// Event handler 888 /// </param> 889 /// <returns /> 890 this.get_events().addHandler('showing', handler); 891 }, 892 remove_showing: function (handler) { 893 /// <summary> 894 /// Remove an event handler from the showing event 895 /// </summary> 896 /// <param name="handler" type="Function" mayBeNull="false"> 897 /// Event handler 898 /// </param> 899 /// <returns /> 900 this.get_events().removeHandler('showing', handler); 901 }, 902 raiseShowing: function (eventArgs) { 903 /// <summary> 904 /// Raise the showing event 905 /// </summary> 906 /// <param name="eventArgs" type="Sys.CancelEventArgs" mayBeNull="false"> 907 /// Event arguments for the showing event 908 /// </param> 909 /// <returns /> 910 911 var handler = this.get_events().getHandler('showing'); 912 if (handler) { 913 handler(this, eventArgs); 914 } 915 }, 916 917 add_shown: function (handler) { 918 /// <summary> 919 /// Add an event handler for the shown event 920 /// </summary> 921 /// <param name="handler" type="Function" mayBeNull="false"> 922 /// Event handler 923 /// </param> 924 /// <returns /> 925 this.get_events().addHandler('shown', handler); 926 }, 927 remove_shown: function (handler) { 928 /// <summary> 929 /// Remove an event handler from the shown event 930 /// </summary> 931 /// <param name="handler" type="Function" mayBeNull="false"> 932 /// Event handler 933 /// </param> 934 /// <returns /> 935 this.get_events().removeHandler('shown', handler); 936 }, 937 raiseShown: function (eventArgs) { 938 /// <summary> 939 /// Raise the shown event 940 /// </summary> 941 /// <param name="eventArgs" type="Sys.EventArgs" mayBeNull="false"> 942 /// Event arguments for the shown event 943 /// </param> 944 /// <returns /> 945 946 var handler = this.get_events().getHandler('shown'); 947 if (handler) { 948 handler(this, eventArgs); 949 } 950 }, 951 952 add_hiding: function (handler) { 953 /// <summary> 954 /// Add an event handler for the hiding event 955 /// </summary> 956 /// <param name="handler" type="Function" mayBeNull="false"> 957 /// Event handler 958 /// </param> 959 /// <returns /> 960 this.get_events().addHandler('hiding', handler); 961 }, 962 remove_hiding: function (handler) { 963 /// <summary> 964 /// Remove an event handler from the hiding event 965 /// </summary> 966 /// <param name="handler" type="Function" mayBeNull="false"> 967 /// Event handler 968 /// </param> 969 /// <returns /> 970 this.get_events().removeHandler('hiding', handler); 971 }, 972 raiseHiding: function (eventArgs) { 973 /// <summary> 974 /// Raise the hiding event 975 /// </summary> 976 /// <param name="eventArgs" type="Sys.CancelEventArgs" mayBeNull="false"> 977 /// Event arguments for the hiding event 978 /// </param> 979 /// <returns /> 980 981 var handler = this.get_events().getHandler('hiding'); 982 if (handler) { 983 handler(this, eventArgs); 984 } 985 }, 986 987 add_hidden: function (handler) { 988 /// <summary> 989 /// Add an event handler for the hidden event 990 /// </summary> 991 /// <param name="handler" type="Function" mayBeNull="false"> 992 /// Event handler 993 /// </param> 994 /// <returns /> 995 this.get_events().addHandler('hidden', handler); 996 }, 997 remove_hidden: function (handler) { 998 /// <summary> 999 /// Remove an event handler from the hidden event 1000 /// </summary> 1001 /// <param name="handler" type="Function" mayBeNull="false"> 1002 /// Event handler 1003 /// </param> 1004 /// <returns /> 1005 this.get_events().removeHandler('hidden', handler); 1006 }, 1007 raiseHidden: function (eventArgs) { 1008 /// <summary> 1009 /// Raise the hidden event 1010 /// </summary> 1011 /// <param name="eventArgs" type="Sys.EventArgs" mayBeNull="false"> 1012 /// Event arguments for the hidden event 1013 /// </param> 1014 /// <returns /> 1015 1016 var handler = this.get_events().getHandler('hidden'); 1017 if (handler) { 1018 handler(this, eventArgs); 1019 } 1020 } 1021}; 1022Sys.Extended.UI.ModalPopupBehavior.registerClass('Sys.Extended.UI.ModalPopupBehavior', Sys.Extended.UI.DynamicPopulateBehaviorBase); 1023 1024Sys.Extended.UI.ModalPopupBehavior.invokeViaServer = function (behaviorID, show) { 1025 /// <summary> 1026 /// This static function (that is intended to be called from script emitted 1027 /// on the server) will show or hide the behavior associated with behaviorID 1028 /// (i.e. to use this, the ModalPopupExtender must have an ID or BehaviorID) and 1029 /// will either show or hide depending on the show parameter. 1030 /// </summary> 1031 /// <param name="behaviorID" type="String"> 1032 /// ID of the modal popup behavior 1033 /// </param> 1034 /// <param name="show" type="Boolean"> 1035 /// Whether to show or hide the modal popup 1036 /// </param> 1037 var behavior = $find(behaviorID); 1038 if (behavior) { 1039 if (show) { 1040 behavior.show(); 1041 } else { 1042 behavior.hide(); 1043 } 1044 } 1045}; 1046
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.