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