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