1// Name: MicrosoftAjaxWebForms.debug.js 2// Assembly: AjaxControlToolkit 3// Version: 4.1.51116.0 4// FileVersion: 4.1.51116 5// (c) 2010 CodePlex Foundation 6(function() { 7 8function execute() { 9 10Type._registerScript("MicrosoftAjaxWebForms.js", [ 11 "MicrosoftAjaxCore.js", 12 "MicrosoftAjaxSerialization.js", 13 "MicrosoftAjaxNetwork.js", 14 "MicrosoftAjaxComponentModel.js"]); 15var $type, $prototype; 16Type.registerNamespace('Sys.WebForms'); 17 18$type = Sys.WebForms.BeginRequestEventArgs = function BeginRequestEventArgs(request, postBackElement, updatePanelsToUpdate) { 19 /// <summary locid="M:J#Sys.WebForms.BeginRequestEventArgs.#ctor">The arguments for the PageRequestManager's beginRequest event. The beginRequest event is raised when a request is about to be made.</summary> 20 /// <param name="request" type="Sys.Net.WebRequest">The web request for the EventArgs.</param> 21 /// <param name="postBackElement" domElement="true" mayBeNull="true">The postback element that initiated the async postback.</param> 22 /// <param name="updatePanelsToUpdate" type="Array" elementType="String" mayBeNull="true" optional="true">A list of UniqueIDs for UpdatePanel controls that are requested to update their rendering by the client. Server-side processing may update additional UpdatePanels.</param> 23 var e = Function._validateParams(arguments, [ 24 {name: "request", type: Sys.Net.WebRequest}, 25 {name: "postBackElement", mayBeNull: true, domElement: true}, 26 {name: "updatePanelsToUpdate", type: Array, mayBeNull: true, optional: true, elementType: String} 27 ]); 28 if (e) throw e; 29 Sys.WebForms.BeginRequestEventArgs.initializeBase(this); 30 this._request = request; 31 this._postBackElement = postBackElement; 32 this._updatePanelsToUpdate = updatePanelsToUpdate; 33} 34 35$type.prototype = { 36 get_postBackElement: function BeginRequestEventArgs$get_postBackElement() { 37 /// <value domElement="true" mayBeNull="true" locid="P:J#Sys.WebForms.BeginRequestEventArgs.postBackElement"></value> 38 if (arguments.length !== 0) throw Error.parameterCount(); 39 return this._postBackElement; 40 }, 41 get_request: function BeginRequestEventArgs$get_request() { 42 /// <value type="Sys.Net.WebRequest" locid="P:J#Sys.WebForms.BeginRequestEventArgs.request"></value> 43 if (arguments.length !== 0) throw Error.parameterCount(); 44 return this._request; 45 }, 46 get_updatePanelsToUpdate: function BeginRequestEventArgs$get_updatePanelsToUpdate() { 47 /// <value type="Array" elementType="String" locid="P:J#Sys.WebForms.BeginRequestEventArgs.updatePanelsToUpdate"></value> 48 if (arguments.length !== 0) throw Error.parameterCount(); 49 return this._updatePanelsToUpdate ? Array.clone(this._updatePanelsToUpdate) : []; 50 } 51} 52 53$type.registerClass('Sys.WebForms.BeginRequestEventArgs', Sys.EventArgs); 54$type = Sys.WebForms.EndRequestEventArgs = function EndRequestEventArgs(error, dataItems, response) { 55 /// <summary locid="M:J#Sys.WebForms.EndRequestEventArgs.#ctor">The arguments for the PageRequestManager's endRequest event. The endRequest event is raised when a response has finished processing.</summary> 56 /// <param name="error" type="Error" mayBeNull="true"></param> 57 /// <param name="dataItems" type="Object" mayBeNull="true"></param> 58 /// <param name="response" type="Sys.Net.WebRequestExecutor"></param> 59 var e = Function._validateParams(arguments, [ 60 {name: "error", type: Error, mayBeNull: true}, 61 {name: "dataItems", type: Object, mayBeNull: true}, 62 {name: "response", type: Sys.Net.WebRequestExecutor} 63 ]); 64 if (e) throw e; 65 66 Sys.WebForms.EndRequestEventArgs.initializeBase(this); 67 this._errorHandled = false; 68 this._error = error; 69 this._dataItems = dataItems || new Object(); 70 this._response = response; 71} 72 73$type.prototype = { 74 get_dataItems: function EndRequestEventArgs$get_dataItems() { 75 /// <value type="Object" locid="P:J#Sys.WebForms.EndRequestEventArgs.dataItems"></value> 76 if (arguments.length !== 0) throw Error.parameterCount(); 77 return this._dataItems; 78 }, 79 80 get_error: function EndRequestEventArgs$get_error() { 81 /// <value type="Error" locid="P:J#Sys.WebForms.EndRequestEventArgs.error"></value> 82 if (arguments.length !== 0) throw Error.parameterCount(); 83 return this._error; 84 }, 85 86 get_errorHandled: function EndRequestEventArgs$get_errorHandled() { 87 /// <value type="Boolean" locid="P:J#Sys.WebForms.EndRequestEventArgs.errorHandled"></value> 88 if (arguments.length !== 0) throw Error.parameterCount(); 89 return this._errorHandled; 90 }, 91 set_errorHandled: function EndRequestEventArgs$set_errorHandled(value) { 92 var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]); 93 if (e) throw e; 94 this._errorHandled = value; 95 }, 96 97 get_response: function EndRequestEventArgs$get_response() { 98 /// <value type="Sys.Net.WebRequestExecutor" locid="P:J#Sys.WebForms.EndRequestEventArgs.response"></value> 99 if (arguments.length !== 0) throw Error.parameterCount(); 100 return this._response; 101 } 102} 103 104$type.registerClass('Sys.WebForms.EndRequestEventArgs', Sys.EventArgs); 105$type = Sys.WebForms.InitializeRequestEventArgs = function InitializeRequestEventArgs(request, postBackElement, updatePanelsToUp
105date) { 106 /// <summary locid="M:J#Sys.WebForms.InitializeRequestEventArgs.#ctor">The arguments for the PageRequestManager's initializeRequest event. The initializeRequest event is raised when a request is being prepared and can be cancelled.</summary> 107 /// <param name="request" type="Sys.Net.WebRequest">The web request to be packaged in this EventArgs.</param> 108 /// <param name="postBackElement" domElement="true" mayBeNull="true">The postback element that initiated the async postback.</param> 109 /// <param name="updatePanelsToUpdate" type="Array" elementType="String" mayBeNull="true" optional="true">A list of UniqueIDs for UpdatePanel controls that are requested to update their rendering by the client. Server-side processing may update additional UpdatePanels.</param> 110 var e = Function._validateParams(arguments, [ 111 {name: "request", type: Sys.Net.WebRequest}, 112 {name: "postBackElement", mayBeNull: true, domElement: true}, 113 {name: "updatePanelsToUpdate", type: Array, mayBeNull: true, optional: true, elementType: String} 114 ]); 115 if (e) throw e; 116 Sys.WebForms.InitializeRequestEventArgs.initializeBase(this); 117 this._request = request; 118 this._postBackElement = postBackElement; 119 this._updatePanelsToUpdate = updatePanelsToUpdate; 120} 121 122$type.prototype = { 123 get_postBackElement: function InitializeRequestEventArgs$get_postBackElement() { 124 /// <value domElement="true" mayBeNull="true" locid="P:J#Sys.WebForms.InitializeRequestEventArgs.postBackElement"></value> 125 if (arguments.length !== 0) throw Error.parameterCount(); 126 return this._postBackElement; 127 }, 128 get_request: function InitializeRequestEventArgs$get_request() { 129 /// <value type="Sys.Net.WebRequest" locid="P:J#Sys.WebForms.InitializeRequestEventArgs.request"></value> 130 if (arguments.length !== 0) throw Error.parameterCount(); 131 return this._request; 132 }, 133 get_updatePanelsToUpdate: function InitializeRequestEventArgs$get_updatePanelsToUpdate() { 134 /// <value type="Array" elementType="String" locid="P:J#Sys.WebForms.InitializeRequestEventArgs.updatePanelsToUpdate"></value> 135 if (arguments.length !== 0) throw Error.parameterCount(); 136 return this._updatePanelsToUpdate ? Array.clone(this._updatePanelsToUpdate) : []; 137 }, 138 set_updatePanelsToUpdate: function InitializeRequestEventArgs$set_updatePanelsToUpdate(value) { 139 var e = Function._validateParams(arguments, [{name: "value", type: Array, elementType: String}]); 140 if (e) throw e; 141 this._updated = true; 142 this._updatePanelsToUpdate = value; 143 } 144} 145 146$type.registerClass('Sys.WebForms.InitializeRequestEventArgs', Sys.CancelEventArgs); 147$type = Sys.WebForms.PageLoadedEventArgs = function PageLoadedEventArgs(panelsUpdated, panelsCreated, dataItems) { 148 /// <summary locid="M:J#Sys.WebForms.PageLoadedEventArgs.#ctor">The arguments for the PageRequestManager's pageLoaded event. The pageLoaded event is raised after the DOM has been updated.</summary> 149 /// <param name="panelsUpdated" type="Array">An array of UpdatePanels that were updated.</param> 150 /// <param name="panelsCreated" type="Array">An array of UpdatePanels that were created.</param> 151 /// <param name="dataItems" type="Object" mayBeNull="true"></param> 152 var e = Function._validateParams(arguments, [ 153 {name: "panelsUpdated", type: Array}, 154 {name: "panelsCreated", type: Array}, 155 {name: "dataItems", type: Object, mayBeNull: true} 156 ]); 157 if (e) throw e; 158 Sys.WebForms.PageLoadedEventArgs.initializeBase(this); 159 160 this._panelsUpdated = panelsUpdated; 161 this._panelsCreated = panelsCreated; 162 this._dataItems = dataItems || new Object(); 163} 164 165$type.prototype = { 166 get_dataItems: function PageLoadedEventArgs$get_dataItems() { 167 /// <value type="Object" locid="P:J#Sys.WebForms.PageLoadedEventArgs.dataItems"></value> 168 if (arguments.length !== 0) throw Error.parameterCount(); 169 return this._dataItems; 170 }, 171 172 get_panelsCreated: function PageLoadedEventArgs$get_panelsCreated() { 173 /// <value type="Array" locid="P:J#Sys.WebForms.PageLoadedEventArgs.panelsCreated"></value> 174 if (arguments.length !== 0) throw Error.parameterCount(); 175 return this._panelsCreated; 176 }, 177 178 get_panelsUpdated: function PageLoadedEventArgs$get_panelsUpdated() { 179 /// <value type="Array" locid="P:J#Sys.WebForms.PageLoadedEventArgs.panelsUpdated"></value> 180 if (arguments.length !== 0) throw Error.parameterCount(); 181 return this._panelsUpdated; 182 } 183} 184 185$type.registerClass('Sys.WebForms.PageLoadedEventArgs', Sys.EventArgs); 186$type = Sys.WebForms.PageLoadingEventArgs = function PageLoadingEventArgs(panelsUpdating, panelsDeleting, dataItems) { 187 /// <summary locid="M:J#Sys.WebForms.PageLoadingEventArgs.#ctor">The arguments for the PageRequestManager's pageLoading event. The pageLoading event is raised before the DOM has been updated.</summary> 188 /// <param name="panelsUpdating" type="Array">An array of UpdatePanels that are going to be updated.</param> 189 /// <param name="panelsDeleting" type="Array">An array of UpdatePanels that are going to be deleted.</param> 190 /// <param name="dataItems" type="Object" mayBeNull="true"></param> 191 var e = Function._validateParams(arguments, [ 192 {name: "panelsUpdating", type: Array}, 193 {name: "panelsDeleting", type: Array}, 194 {name: "dataItems", type: Object, mayBeNull: true} 195 ]); 196 if (e) throw e; 197 Sys.WebForms.PageLoadingEventArgs.initializeBase(this); 198 199 this._panelsUpdating = panelsUpdating; 200 this._panelsDeleting = panelsDeleting; 201 this._dataItems = dataItems || new Object(); 202} 203 204$type.prototype = { 205 get_dataItems: function PageLoadingEventArgs$get_dataItems() { 206 /// <value type="Object" locid="P:J#Sys.WebForms.PageLoadingEventArgs.dataItems"></value> 207 if (arguments.length !== 0) throw Error.parameterCount(); 208 return this._dataItems; 209 }, 210 211 get_panelsDeleting: function PageLoadingEventArgs$get_panelsDeleting() { 212 /// <value type="Array" locid="P:J#Sys.WebForms.PageLoadingEventArgs.panelsDeleting"></value> 213 if (arguments.length !== 0) throw Error.parameterCount(); 214 return this._panelsDeleting; 215 }, 216 217 get_panelsUpdating: function PageLoadingEventArgs$get_panelsUpdating() { 218 /// <value type="Array" locid="P:J#Sys.WebForms.PageLoadingEventArgs.panelsUpdating"></value> 219 if (arguments.length !== 0) throw Error.parameterCount(); 220 return this._panelsUpdating; 221 } 222} 223 224$type.registerClass('Sys.WebForms.PageLoadingEventArgs', Sys.EventArgs); 225 226$type = Sys._ScriptLoaderTask = function _ScriptLoaderTask(scriptElement, completedCallback) { 227 /// <summary locid="M:J#Sys._ScriptLoaderTask.#ctor"></summary> 228 /// <param name="scriptElement" domElement="true">The script element to add to the DOM.</param> 229 /// <param name="completedCallback" type="Function">Callback to call when the script has loaded or failed to load.</param> 230 var e = Function._validateParams(arguments, [ 231 { name: "scriptElement", domElement: true }, 232 { name: "completedCallback", type: Function } 233 ]); 234 if (e) throw e; 235 this._scriptElement = scriptElement; 236 this._completedCallback = completedCallback; 237} 238$type.prototype = { 239 get_scriptElement: function _ScriptLoaderTask$get_scriptElement() { 240 /// <value domElement="true" locid="P:J#Sys._ScriptLoaderTask.scriptElement">The script element.</value> 241 if (arguments.length !== 0) throw Error.parameterCount(); 242 return this._scriptElement; 243 }, 244 245 dispose: function _ScriptLoaderTask$dispose() { 246 if (this._disposed) { 247 return; 248 } 249 this._disposed = true; 250 this._removeScriptElementHandlers(); 251 Sys._ScriptLoaderTask._clearScript(this._scriptElement); 252 this._scriptElement = null; 253 }, 254 255 execute: function _ScriptLoaderTask$execute() { 256 /// <summary locid="M:J#Sys._ScriptLoaderTask.execute">
256Begins loading the given script element.</summary> 257 if (arguments.length !== 0) throw Error.parameterCount(); 258 this._addScriptElementHandlers(); 259 var headElements = document.getElementsByTagName('head'); 260 if (headElements.length === 0) { 261 throw new Error.invalidOperation(Sys.Res.scriptLoadFailedNoHead); 262 } 263 else { 264 headElements[0].appendChild(this._scriptElement); 265 } 266 }, 267 268 _addScriptElementHandlers: function _ScriptLoaderTask$_addScriptElementHandlers() { 269 this._scriptLoadDelegate = Function.createDelegate(this, this._scriptLoadHandler); 270 271 if (document.addEventListener) { 272 if (!this._scriptElement.readyState) 273 this._scriptElement.readyState = 'loaded'; 274 $addHandler(this._scriptElement, 'load', this._scriptLoadDelegate); 275 } 276 else { 277 $addHandler(this._scriptElement, 'readystatechange', this._scriptLoadDelegate); 278 } 279 if (this._scriptElement.addEventListener) { 280 this._scriptErrorDelegate = Function.createDelegate(this, this._scriptErrorHandler); 281 this._scriptElement.addEventListener('error', this._scriptErrorDelegate, false); 282 } 283 }, 284 285 _removeScriptElementHandlers: function _ScriptLoaderTask$_removeScriptElementHandlers() { 286 if (this._scriptLoadDelegate) { 287 var scriptElement = this.get_scriptElement(); 288 if (document.addEventListener) { 289 $removeHandler(scriptElement, 'load', this._scriptLoadDelegate); 290 } 291 else { 292 $removeHandler(scriptElement, 'readystatechange', this._scriptLoadDelegate); 293 } 294 if (this._scriptErrorDelegate) { 295 this._scriptElement.removeEventListener('error', this._scriptErrorDelegate, false); 296 this._scriptErrorDelegate = null; 297 } 298 this._scriptLoadDelegate = null; 299 } 300 }, 301 302 _scriptErrorHandler: function _ScriptLoaderTask$_scriptErrorHandler() { 303 if (this._disposed) { 304 return; 305 } 306 307 this._completedCallback(this.get_scriptElement(), false); 308 }, 309 310 _scriptLoadHandler: function _ScriptLoaderTask$_scriptLoadHandler() { 311 if (this._disposed) { 312 return; 313 } 314 315 var scriptElement = this.get_scriptElement(); 316 if ((scriptElement.readyState !== 'loaded') && 317 (scriptElement.readyState !== 'complete')) { 318 return; 319 } 320 321 this._completedCallback(scriptElement, true); 322 } 323} 324$type.registerClass("Sys._ScriptLoaderTask", null, Sys.IDisposable); 325 326$type._clearScript = function _ScriptLoaderTask$_clearScript(scriptElement) { 327 if (!Sys.Debug.isDebug) { 328 scriptElement.parentNode.removeChild(scriptElement); 329 } 330} 331 332$type = Sys._ScriptLoader = function _ScriptLoader() { 333 this._scriptsToLoad = null; 334 this._sessions = []; 335 this._scriptLoadedDelegate = Function.createDelegate(this, this._scriptLoadedHandler); 336} 337$type.prototype = { 338 dispose: function _ScriptLoader$dispose() { 339 this._stopSession(); 340 this._loading = false; 341 if(this._events) { 342 delete this._events; 343 } 344 this._sessions = null; 345 this._currentSession = null; 346 this._scriptLoadedDelegate = null; 347 }, 348 349 loadScripts: function _ScriptLoader$loadScripts(scriptTimeout, allScriptsLoadedCallback, scriptLoadFailedCallback, scriptLoadTimeoutCallback) { 350 /// <summary locid="M:J#Sys._ScriptLoader.loadScripts">Begins loading scripts that have been queued.</summary> 351 /// <param name="scriptTimeout" type="Number" integer="true">Timeout in seconds for loading all scripts.</param> 352 /// <param name="allScriptsLoadedCallback" type="Function" mayBeNull="true">Callback for notification when all scripts have successfully loaded.</param> 353 /// <param name="scriptLoadFailedCallback" type="Function" mayBeNull="true">Callback for notification when a script fails to load.</param> 354 /// <param name="scriptLoadTimeoutCallback" type="Function" mayBeNull="true">Callback for notification when scripts have not finished loading within the given timeout.</param> 355 var e = Function._validateParams(arguments, [ 356 {name: "scriptTimeout", type: Number, integer: true}, 357 {name: "allScriptsLoadedCallback", type: Function, mayBeNull: true}, 358 {name: "scriptLoadFailedCallback", type: Function, mayBeNull: true}, 359 {name: "scriptLoadTimeoutCallback", type: Function, mayBeNull: true} 360 ]); 361 if (e) throw e; 362 var session = { 363 allScriptsLoadedCallback: allScriptsLoadedCallback, 364 scriptLoadFailedCallback: scriptLoadFailedCallback, 365 scriptLoadTimeoutCallback: scriptLoadTimeoutCallback, 366 scriptsToLoad: this._scriptsToLoad, 367 scriptTimeout: scriptTimeout }; 368 this._scriptsToLoad = null; 369 this._sessions.push(session); 370 371 if (!this._loading) { 372 this._nextSession(); 373 } 374 }, 375 376 queueCustomScriptTag: function _ScriptLoader$queueCustomScriptTag(scriptAttributes) { 377 /// <summary locid="M:J#Sys._ScriptLoader.queueCustomScriptTag">Queues a script reference with the given set of custom script element attributes.</summary> 378 /// <param name="scriptAttributes" mayBeNull="false">A JSON object that describtes the attributes to apply to the script element.</param> 379 var e = Function._validateParams(arguments, [ 380 {name: "scriptAttributes"} 381 ]); 382 if (e) throw e; 383 if(!this._scriptsToLoad) { 384 this._scriptsToLoad = []; 385 } 386 Array.add(this._scriptsToLoad, scriptAttributes); 387 }, 388 389 queueScriptBlock: function _ScriptLoader$queueScriptBlock(scriptContent) { 390 /// <summary locid="M:J#Sys._ScriptLoader.queueScriptBlock">Queues a script reference with literal script.</summary> 391 /// <param name="scriptContent" type="String" mayBeNull="false">Literal script to execute.</param> 392 var e = Function._validateParams(arguments, [
393 {name: "scriptContent", type: String} 394 ]); 395 if (e) throw e; 396 if(!this._scriptsToLoad) { 397 this._scriptsToLoad = []; 398 } 399 Array.add(this._scriptsToLoad, {text: scriptContent}); 400 }, 401 402 queueScriptReference: function _ScriptLoader$queueScriptReference(scriptUrl) { 403 /// <summary locid="M:J#Sys._ScriptLoader.queueScriptReference">Queues a script reference to the given script URL.</summary> 404 /// <param name="scriptUrl" type="String" mayBeNull="false">URL to the script to reference.</param> 405 var e = Function._validateParams(arguments, [ 406 {name: "scriptUrl", type: String} 407 ]); 408 if (e) throw e; 409 if(!this._scriptsToLoad) { 410 this._scriptsToLoad = []; 411 } 412 Array.add(this._scriptsToLoad, {src: scriptUrl}); 413 }, 414 415 _createScriptElement: function _ScriptLoader$_createScriptElement(queuedScript) { 416 var scriptElement = document.createElement('script'); 417 418 scriptElement.type = 'text/javascript'; 419 420 for (var attr in queuedScript) { 421 scriptElement[attr] = queuedScript[attr]; 422 } 423 424 return scriptElement; 425 }, 426 427 _loadScriptsInternal: function _ScriptLoader$_loadScriptsInternal() { 428 var session = this._currentSession; 429 if (session.scriptsToLoad && session.scriptsToLoad.length > 0) { 430 var nextScript = Array.dequeue(session.scriptsToLoad); 431 var scriptElement = this._createScriptElement(nextScript); 432 433 if (scriptElement.text && Sys.Browser.agent === Sys.Browser.Safari) { 434 scriptElement.innerHTML = scriptElement.text; 435 delete scriptElement.text; 436 } 437 438 if (typeof(nextScript.src) === "string") { 439 this._currentTask = new Sys._ScriptLoaderTask(scriptElement, this._scriptLoadedDelegate); 440 this._currentTask.execute(); 441 } 442 else { 443 var headElements = document.getElementsByTagName('head'); 444 if (headElements.length === 0) { 445 throw new Error.invalidOperation(Sys.Res.scriptLoadFailedNoHead); 446 } 447 else { 448 headElements[0].appendChild(scriptElement); 449 } 450 451 452 Sys._ScriptLoaderTask._clearScript(scriptElement); 453 this._loadScriptsInternal(); 454 } 455 } 456 else { 457 this._stopSession(); 458 var callback = session.allScriptsLoadedCallback; 459 if(callback) { 460 callback(this); 461 } 462 this._nextSession(); 463 } 464 }, 465 466 _nextSession: function _ScriptLoader$_nextSession() { 467 if (this._sessions.length === 0) { 468 this._loading = false; 469 this._currentSession = null; 470 return; 471 } 472 this._loading = true; 473 474 var session = Array.dequeue(this._sessions); 475 this._currentSession = session; 476 this._loadScriptsInternal(); 477 }, 478 479 _raiseError: function _ScriptLoader$_raiseError() { 480 var callback = this._currentSession.scriptLoadFailedCallback; 481 var scriptElement = this._currentTask.get_scriptElement(); 482 this._stopSession(); 483 484 if(callback) { 485 callback(this, scriptElement); 486 this._nextSession(); 487 } 488 else { 489 this._loading = false; 490 throw Sys._ScriptLoader._errorScriptLoadFailed(scriptElement.src); 491 } 492 }, 493 494 _scriptLoadedHandler: function _ScriptLoader$_scriptLoadedHandler(scriptElement, loaded) { 495 if (loaded) { 496 Array.add(Sys._ScriptLoader._getLoadedScripts(), scriptElement.src); 497 this._currentTask.dispose(); 498 this._currentTask = null; 499 this._loadScriptsInternal(); 500 } 501 else { 502 this._raiseError(); 503 } 504 }, 505 _stopSession: function _ScriptLoader$_stopSession() { 506 if(this._currentTask) { 507 this._currentTask.dispose(); 508 this._currentTask = null; 509 } 510 } 511} 512$type.registerClass('Sys._ScriptLoader', null, Sys.IDisposable); 513 514$type.getInstance = function _ScriptLoader$getInstance() { 515 var sl = Sys._ScriptLoader._activeInstance; 516 if(!sl) { 517 sl = Sys._ScriptLoader._activeInstance = new Sys._ScriptLoader(); 518 } 519 return sl; 520} 521 522$type.isScriptLoaded = function _ScriptLoader$isScriptLoaded(scriptSrc) { 523 var dummyScript = document.createElement('script'); 524 dummyScript.src = scriptSrc; 525 return Array.contains(Sys._ScriptLoader._getLoadedScripts(), dummyScript.src); 526} 527 528$type.readLoadedScripts = function _ScriptLoader$readLoadedScripts() { 529 if(!Sys._ScriptLoader._referencedScripts) { 530 var referencedScripts = Sys._ScriptLoader._referencedScripts = []; 531 532 var existingScripts = document.getElementsByTagName('script'); 533 for (var i = existingScripts.length - 1; i >= 0; i--) { 534 var scriptNode = existingScripts[i]; 535 var scriptSrc = scriptNode.src; 536 if (scriptSrc.length) { 537 if (!Array.contains(referencedScripts, scriptSrc)) { 538 Array.add(referencedScripts, scriptSrc); 539 } 540 } 541 } 542 } 543} 544 545$type._errorScriptLoadFailed = function _ScriptLoader$_errorScriptLoadFailed(scriptUrl) { 546 var errorMessage; 547 errorMessage = Sys.Res.scriptLoadFailedDebug; 548 549 var displayMessage = "Sys.ScriptLoadFailedException: " + String.format(errorMessage, scriptUrl); 550 var e = Error.create(displayMessage, {name: 'Sys.ScriptLoadFailedException', 'scriptUrl': scriptUrl }); 551 e.popStackFrame(); 552 return e; 553} 554
555$type._getLoadedScripts = function _ScriptLoader$_getLoadedScripts() { 556 if(!Sys._ScriptLoader._referencedScripts) { 557 Sys._ScriptLoader._referencedScripts = []; 558 Sys._ScriptLoader.readLoadedScripts(); 559 } 560 return Sys._ScriptLoader._referencedScripts; 561} 562$type = Sys.WebForms.PageRequestManager = function PageRequestManager() { 563 this._form = null; 564 this._activeDefaultButton = null; 565 this._activeDefaultButtonClicked = false; 566 this._updatePanelIDs = null; 567 this._updatePanelClientIDs = null; 568 this._updatePanelHasChildrenAsTriggers = null; 569 this._asyncPostBackControlIDs = null; 570 this._asyncPostBackControlClientIDs = null; 571 this._postBackControlIDs = null; 572 this._postBackControlClientIDs = null; 573 this._scriptManagerID = null; 574 this._pageLoadedHandler = null; 575 576 this._additionalInput = null; 577 this._onsubmit = null; 578 this._onSubmitStatements = []; 579 this._originalDoPostBack = null; 580 this._originalDoPostBackWithOptions = null; 581 this._originalFireDefaultButton = null; 582 this._originalDoCallback = null; 583 this._isCrossPost = false; 584 this._postBackSettings = null; 585 this._request = null; 586 this._onFormSubmitHandler = null; 587 this._onFormElementClickHandler = null; 588 this._onWindowUnloadHandler = null; 589 this._asyncPostBackTimeout = null; 590 591 this._controlIDToFocus = null; 592 this._scrollPosition = null; 593 this._processingRequest = false; 594 this._scriptDisposes = {}; 595 596 this._transientFields = ["__VIEWSTATEENCRYPTED", "__VIEWSTATEFIELDCOUNT"]; 597} 598 599$type.prototype = { 600 get_isInAsyncPostBack: function PageRequestManager$get_isInAsyncPostBack() { 601 /// <value type="Boolean" locid="P:J#Sys.WebForms.PageRequestManager.isInAsyncPostBack"></value> 602 if (arguments.length !== 0) throw Error.parameterCount(); 603 return this._request !== null; 604 }, 605 606 add_beginRequest: function PageRequestManager$add_beginRequest(handler) { 607 /// <summary locid="E:J#Sys.WebForms.PageRequestManager.beginRequest">Adds a beginRequest event handler.</summary> 608 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); 609 if (e) throw e; 610 Sys.Observer.addEventHandler(this, "beginRequest", handler); 611 }, 612 remove_beginRequest: function PageRequestManager$remove_beginRequest(handler) { 613 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); 614 if (e) throw e; 615 Sys.Observer.removeEventHandler(this, "beginRequest", handler); 616 }, 617 618 add_endRequest: function PageRequestManager$add_endRequest(handler) { 619 /// <summary locid="E:J#Sys.WebForms.PageRequestManager.endRequest">Adds a endRequest event handler.</summary> 620 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); 621 if (e) throw e; 622 Sys.Observer.addEventHandler(this, "endRequest", handler); 623 }, 624 remove_endRequest: function PageRequestManager$remove_endRequest(handler) { 625 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); 626 if (e) throw e; 627 Sys.Observer.removeEventHandler(this, "endRequest", handler); 628 }, 629 630 add_initializeRequest: function PageRequestManager$add_initializeRequest(handler) { 631 /// <summary locid="E:J#Sys.WebForms.PageRequestManager.initializeRequest">Adds a initializeRequest event handler.</summary> 632 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); 633 if (e) throw e; 634 Sys.Observer.addEventHandler(this, "initializeRequest", handler); 635 }, 636 remove_initializeRequest: function PageRequestManager$remove_initializeRequest(handler) { 637 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); 638 if (e) throw e; 639 Sys.Observer.removeEventHandler(this, "initializeRequest", handler); 640 }, 641 642 add_pageLoaded: function PageRequestManager$add_pageLoaded(handler) { 643 /// <summary locid="E:J#Sys.WebForms.PageRequestManager.pageLoaded">Adds a pageLoaded event handler.</summary> 644 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); 645 if (e) throw e; 646 Sys.Observer.addEventHandler(this, "pageLoaded", handler); 647 }, 648 remove_pageLoaded: function PageRequestManager$remove_pageLoaded(handler) { 649 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); 650 if (e) throw e; 651 Sys.Observer.removeEventHandler(this, "pageLoaded", handler); 652 }, 653 654 add_pageLoading: function PageRequestManager$add_pageLoading(handler) { 655 /// <summary locid="E:J#Sys.WebForms.PageRequestManager.pageLoading">Adds a pageLoading event handler.</summary> 656 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); 657 if (e) throw e; 658 Sys.Observer.addEventHandler(this, "pageLoading", handler); 659 }, 660 remove_pageLoading: function PageRequestManager$remove_pageLoading(handler) { 661 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); 662 if (e) throw e; 663 Sys.Observer.removeEventHandler(this, "pageLoading", handler); 664 }, 665 666 abortPostBack: function PageRequestManager$abortPostBack() { 667 if (!this._processingRequest && this._request) { 668 this._request.get_executor().abort(); 669 this._request = null; 670 } 671 }, 672 673 beginAsyncPostBack: function PageRequestManager$beginAsyncPostBack(updatePanelsToUp
673date, eventTarget, eventArgument, causesValidation, validationGroup) { 674 /// <summary locid="M:J#Sys.WebForms.PageRequestManager.beginAsyncPostBack">Begins an asynchronous postback.</summary> 675 /// <param name="updatePanelsToUpdate" type="Array" elementType="String" mayBeNull="true" optional="true">A list of UniqueIDs or ClientIDs of UpdatePanel controls that should have their rendering updated.</param> 676 /// <param name="eventTarget" type="String" mayBeNull="true" optional="true"></param> 677 /// <param name="eventArgument" type="String" mayBeNull="true" optional="true"></param> 678 /// <param name="causesValidation" type="Boolean" mayBeNull="true" optional="true"></param> 679 /// <param name="validationGroup" type="String" mayBeNull="true" optional="true"></param> 680 var e = Function._validateParams(arguments, [ 681 {name: "updatePanelsToUpdate", type: Array, mayBeNull: true, optional: true, elementType: String}, 682 {name: "eventTarget", type: String, mayBeNull: true, optional: true}, 683 {name: "eventArgument", type: String, mayBeNull: true, optional: true}, 684 {name: "causesValidation", type: Boolean, mayBeNull: true, optional: true}, 685 {name: "validationGroup", type: String, mayBeNull: true, optional: true} 686 ]); 687 if (e) throw e; 688 if (causesValidation && (typeof(Page_ClientValidate) === 'function') && !Page_ClientValidate(validationGroup || null)) { 689 return; 690 } 691 this._postBackSettings = this._createPostBackSettings(true, updatePanelsToUpdate, eventTarget); 692 var form = this._form; 693 form.__EVENTTARGET.value = (eventTarget || ""); 694 form.__EVENTARGUMENT.value = (eventArgument || ""); 695 this._isCrossPost = false; 696 this._additionalInput = null; 697 this._onFormSubmit(); 698 }, 699 700 _cancelPendingCallbacks: function PageRequestManager$_cancelPendingCallbacks() { 701 for (var i = 0, l = window.__pendingCallbacks.length; i < l; i++) { 702 var callback = window.__pendingCallbacks[i]; 703 if (callback) { 704 if (!callback.async) { 705 window.__synchronousCallBackIndex = -1; 706 } 707 window.__pendingCallbacks[i] = null; 708 var callbackFrameID = "__CALLBACKFRAME" + i; 709 var xmlRequestFrame = document.getElementById(callbackFrameID); 710 if (xmlRequestFrame) { 711 xmlRequestFrame.parentNode.removeChild(xmlRequestFrame); 712 } 713 } 714 } 715 }, 716 717 _commitControls: function PageRequestManager$_commitControls(updatePanelData, asyncPostBackTimeout) { 718 if (updatePanelData) { 719 this._updatePanelIDs = updatePanelData.updatePanelIDs; 720 this._updatePanelClientIDs = updatePanelData.updatePanelClientIDs; 721 this._updatePanelHasChildrenAsTriggers = updatePanelData.updatePanelHasChildrenAsTriggers; 722 this._asyncPostBackControlIDs = updatePanelData.asyncPostBackControlIDs; 723 this._asyncPostBackControlClientIDs = updatePanelData.asyncPostBackControlClientIDs; 724 this._postBackControlIDs = updatePanelData.postBackControlIDs; 725 this._postBackControlClientIDs = updatePanelData.postBackControlClientIDs; 726 } 727 if (typeof(asyncPostBackTimeout) !== 'undefined' && asyncPostBackTimeout !== null) { 728 this._asyncPostBackTimeout = asyncPostBackTimeout * 1000; 729 } 730 }, 731 732 _createHiddenField: function PageRequestManager$_createHiddenField(id, value) { 733 var container, field = document.getElementById(id); 734 735 if (field) { 736 if (!field._isContained) { 737 field.parentNode.removeChild(field); 738 } 739 else { 740 container = field.parentNode; 741 } 742 } 743 if (!container) { 744 container = document.createElement('span'); 745 container.style.cssText = "display:none !important"; 746 this._form.appendChild(container); 747 } 748 container.innerHTML = "<input type='hidden' />"; 749 field = container.childNodes[0]; 750 field._isContained = true; 751 field.id = field.name = id; 752 field.value = value; 753 }, 754 755 _createPageRequestManagerTimeoutError: function PageRequestManager$_createPageRequestManagerTimeoutError() { 756 var displayMessage = "Sys.WebForms.PageRequestManagerTimeoutException: " + Sys.WebForms.Res.PRM_TimeoutError; 757 var e = Error.create(displayMessage, {name: 'Sys.WebForms.PageRequestManagerTimeoutException'}); 758 e.popStackFrame(); 759 return e; 760 }, 761 762 _createPageRequestManagerServerError: function PageRequestManager$_createPageRequestManagerServerError(httpStatusCode, message) { 763 var displayMessage = "Sys.WebForms.PageRequestManagerServerErrorException: " + 764 (message || String.format(Sys.WebForms.Res.PRM_ServerError, httpStatusCode));
765 var e = Error.create(displayMessage, { 766 name: 'Sys.WebForms.PageRequestManagerServerErrorException', 767 httpStatusCode: httpStatusCode 768 }); 769 e.popStackFrame(); 770 return e; 771 }, 772 773 _createPageRequestManagerParserError: function PageRequestManager$_createPageRequestManagerParserError(parserErrorMessage) { 774 var displayMessage = "Sys.WebForms.PageRequestManagerParserErrorException: " + String.format(Sys.WebForms.Res.PRM_ParserError, parserErrorMessage); 775 var e = Error.create(displayMessage, {name: 'Sys.WebForms.PageRequestManagerParserErrorException'}); 776 e.popStackFrame(); 777 return e; 778 }, 779 780 _createPanelID: function PageRequestManager$_createPanelID(panelsToUpdate, postBackSettings) { 781 var asyncTarget = postBackSettings.asyncTarget, 782 toUpdate = this._ensureUniqueIds(panelsToUpdate || postBackSettings.panelsToUpdate), 783 panelArg = (toUpdate instanceof Array) 784 ? toUpdate.join(',') 785 : (toUpdate || this._scriptManagerID); 786 if (asyncTarget) { 787 panelArg += "|" + asyncTarget; 788 } 789 return encodeURIComponent(this._scriptManagerID) + '=' + encodeURIComponent(panelArg) + '&'; 790 }, 791 792 _createPostBackSettings: function PageRequestManager$_createPostBackSettings(async, panelsToUpdate, asyncTarget, sourceElement) { 793 return { async:async, asyncTarget: asyncTarget, panelsToUpdate: panelsToUpdate, sourceElement: sourceElement }; 794 }, 795 796 _convertToClientIDs: function PageRequestManager$_convertToClientIDs(source, destinationIDs, destinationClientIDs, version4) { 797 if (source) { 798 for (var i = 0, l = source.length; i < l; i += (version4 ? 2 : 1)) { 799 var uniqueID = source[i], 800 clientID = (version4 ? source[i+1] : "") || this._uniqueIDToClientID(uniqueID); 801 Array.add(destinationIDs, uniqueID); 802 Array.add(destinationClientIDs, clientID); 803 } 804 } 805 }, 806 807 dispose: function PageRequestManager$dispose() { 808 Sys.Observer.clearEventHandlers(this); 809 if (this._form) { 810 Sys.UI.DomEvent.removeHandler(this._form, 'submit', this._onFormSubmitHandler); 811 Sys.UI.DomEvent.removeHandler(this._form, 'click', this._onFormElementClickHandler); 812 Sys.UI.DomEvent.removeHandler(window, 'unload', this._onWindowUnloadHandler); 813 Sys.UI.DomEvent.removeHandler(window, 'load', this._pageLoadedHandler); 814 } 815 816 if (this._originalDoPostBack) { 817 window.__doPostBack = this._originalDoPostBack; 818 this._originalDoPostBack = null; 819 } 820 if (this._originalDoPostBackWithOptions) { 821 window.WebForm_DoPostBackWithOptions = this._originalDoPostBackWithOptions; 822 this._originalDoPostBackWithOptions = null; 823 } 824 if (this._originalFireDefaultButton) { 825 window.WebForm_FireDefaultButton = this._originalFireDefaultButton; 826 this._originalFireDefaultButton = null; 827 } 828 if (this._originalDoCallback) { 829 window.WebForm_DoCallback = this._originalDoCallback; 830 this._originalDoCallback = null; 831 } 832 833 this._form = null; 834 this._updatePanelIDs = null; 835 this._updatePanelClientIDs = null; 836 this._asyncPostBackControlIDs = null; 837 this._asyncPostBackControlClientIDs = null; 838 this._postBackControlIDs = null; 839 this._postBackControlClientIDs = null; 840 this._asyncPostBackTimeout = null; 841 this._scrollPosition = null; 842 }, 843 844 _doCallback: function PageRequestManager$_doCallback(eventTarget, eventArgument, eventCallback, context, errorCallback, useAsync) { 845 if (!this.get_isInAsyncPostBack()) { 846 this._originalDoCallback(eventTarget, eventArgument, eventCallback, context, errorCallback, useAsync); 847 } 848 }, 849 850 _doPostBack: function PageRequestManager$_doPostBack(eventTarget, eventArgument) { 851 this._additionalInput = null; 852 853 var form = this._form; 854 if ((eventTarget === null) || (typeof(eventTarget) === "undefined") || (this._isCrossPost)) { 855 this._postBackSettings = this._createPostBackSettings(false); 856 this._isCrossPost = false; 857 } 858 else { 859 var mpUniqueID = this._masterPageUniqueID; 860 var clientID = this._uniqueIDToClientID(eventTarget); 861 var postBackElement = document.getElementById(clientID); 862 if (!postBackElement && mpUniqueID) { 863 if (clientID.indexOf(mpUniqueID + "$") === 0) { 864 postBackElement = document.getElementById(clientID.substr(mpUniqueID.length + 1)); 865 } 866 } 867 if (!postBackElement) { 868 if (Array.contains(this._asyncPostBackControlIDs, eventTarget)) { 869 this._postBackSettings = this._createPostBackSettings(true, null, eventTarget); 870 } 871 else { 872 if (Array.contains(this._postBackControlIDs, eventTarget)) { 873 this._postBackSettings = this._createPostBackSettings(false); 874 } 875 else { 876 var nearestUniqueIDMatch = this._findNearestElement(eventTarget); 877 if (nearestUniqueIDMatch) { 878 this._postBackSettings = this._getPostBackSettings(nearestUniqueIDMatch, eventTarget); 879 } 880 else { 881 if (mpUniqueID) { 882 mpUniqueID += "$"; 883 if (eventTarget.indexOf(mpUniqueID) === 0) { 884 nearestUniqueIDMatch = this._findNearestElement(eventTarget.substr(mpUniqueID.length)); 885 } 886 } 887 if (nearestUniqueIDMatch) { 888 this._postBackSettings = this._getPostBackSettings(nearestUniqueIDMatch, eventTarget); 889 } 890 else { 891 this._postBackSettings = this._createPostBackSettings(false); 892 } 893 } 894 } 895 } 896 } 897 else { 898 this._postBackSettings = this._getPostBackSettings(postBackElement, eventTarget); 899 } 900 } 901 902 if (!this._postBackSettings.async) { 903 form.onsubmit = this._onsubmit; 904 this._originalDoPostBack(eventTarget, eventArgument); 905 form.onsubmit = null; 906 return; 907 } 908 909 form.__EVENTTARGET.value = eventTarget; 910 form.__EVENTARGUMENT.value = eventArgument; 911 this._onFormSubmit(); 912 }, 913 914 _doPostBackWithOptions: function PageRequestManager$_doPostBackWithOptions(options) { 915 this._isCrossPost = options && options.actionUrl; 916 this._originalDoPostBackWithOptions(options); 917 }, 918 919 _elementContains: function PageRequestManager$_elementContains(container, element) { 920 while (element) { 921 if (element === container) { 922 return true; 923 } 924 element = element.parentNode; 925 } 926 return false; 927 }, 928 929 _endPostBack: function PageRequestManager$_endPostBack(error, executor, data) {
930 if (this._request === executor.get_webRequest()) { 931 this._processingRequest = false; 932 this._additionalInput = null; 933 this._request = null; 934 } 935 936 var eventArgs = new Sys.WebForms.EndRequestEventArgs(error, data ? data.dataItems : {}, executor); 937 Sys.Observer.raiseEvent(this, "endRequest", eventArgs); 938 if (error && !eventArgs.get_errorHandled()) { 939 throw error; 940 } 941 }, 942 943 _ensureUniqueIds: function PageRequestManager$_ensureUniqueIds(ids) { 944 if (!ids) return ids; 945 ids = ids instanceof Array ? ids : [ids]; 946 var uniqueIds = []; 947 for (var i = 0, l = ids.length; i < l; i++) { 948 var id = ids[i], index = Array.indexOf(this._updatePanelClientIDs, id); 949 uniqueIds.push(index > -1 ? this._updatePanelIDs[index] : id); 950 } 951 return uniqueIds; 952 }, 953 954 _findNearestElement: function PageRequestManager$_findNearestElement(uniqueID) { 955 while (uniqueID.length > 0) { 956 var clientID = this._uniqueIDToClientID(uniqueID); 957 var element = document.getElementById(clientID); 958 if (element) { 959 return element; 960 } 961 var indexOfLastDollar = uniqueID.lastIndexOf('$'); 962 if (indexOfLastDollar === -1) { 963 return null; 964 } 965 uniqueID = uniqueID.substring(0, indexOfLastDollar); 966 } 967 return null; 968 }, 969 970 _findText: function PageRequestManager$_findText(text, location) { 971 var startIndex = Math.max(0, location - 20); 972 var endIndex = Math.min(text.length, location + 20); 973 return text.substring(startIndex, endIndex); 974 }, 975 976 _fireDefaultButton: function PageRequestManager$_fireDefaultButton(event, target) { 977 if (event.keyCode === 13) { 978 var src = event.srcElement || event.target; 979 if (!src || (src.tagName.toLowerCase() !== "textarea")) { 980 var defaultButton = document.getElementById(target); 981 982 if (defaultButton && (typeof(defaultButton.click) !== "undefined")) { 983 984 985 this._activeDefaultButton = defaultButton; 986 this._activeDefaultButtonClicked = false; 987 try { 988 defaultButton.click(); 989 } 990 finally { 991 this._activeDefaultButton = null; 992 } 993 994 995 event.cancelBubble = true; 996 if (typeof(event.stopPropagation) === "function") { 997 event.stopPropagation(); 998 } 999 return false; 1000 } 1001 } 1002 } 1003 return true; 1004 }, 1005 1006 _getPageLoadedEventArgs: function PageRequestManager$_getPageLoadedEventArgs(initialLoad, data) { 1007 1008 var updated = []; 1009 var created = []; 1010 var version4 = data ? data.version4 : false; 1011 var upData = data ? data.updatePanelData : null; 1012 1013 var newIDs, newClientIDs, childIDs, refreshedIDs; 1014 1015 if (!upData) { 1016 newIDs = this._updatePanelIDs; 1017 newClientIDs = this._updatePanelClientIDs; 1018 childIDs = null; 1019 refreshedIDs = null; 1020 } 1021 else { 1022 newIDs = upData.updatePanelIDs; 1023 newClientIDs = upData.updatePanelClientIDs; 1024 childIDs = upData.childUpdatePanelIDs; 1025 refreshedIDs = upData.panelsToRefreshIDs; 1026 } 1027 1028 var i, l, uniqueID, clientID; 1029 if (refreshedIDs) { 1030 for (i = 0, l = refreshedIDs.length; i < l; i += (version4 ? 2 : 1)) { 1031 uniqueID = refreshedIDs[i]; 1032 clientID = (version4 ? refreshedIDs[i+1] : "") || this._uniqueIDToClientID(uniqueID); 1033 Array.add(updated, document.getElementById(clientID)); 1034 } 1035 } 1036 1037 for (i = 0, l = newIDs.length; i < l; i++) { 1038 if (initialLoad || Array.indexOf(childIDs, newIDs[i]) !== -1) { 1039 Array.add(created, document.getElementById(newClientIDs[i])); 1040 } 1041 } 1042 1043 return new Sys.WebForms.PageLoadedEventArgs(updated, created, data ? data.dataItems : {}); 1044 }, 1045 1046 _getPageLoadingEventArgs: function PageRequestManager$_getPageLoadingEventArgs(data) { 1047 1048 var updated = [], 1049 deleted = [], 1050 upData = data.updatePanelData, 1051 oldIDs = upData.oldUpdatePanelIDs, 1052 oldClientIDs = upData.oldUpdatePanelClientIDs, 1053 newIDs = upData.updatePanelIDs, 1054 childIDs = upData.childUpdatePanelIDs, 1055 refreshedIDs = upData.panelsToRefreshIDs, 1056 i, l, uniqueID, clientID, 1057 version4 = data.version4; 1058 for (i = 0, l = refreshedIDs.length; i < l; i += (version4 ? 2 : 1)) { 1059 uniqueID = refreshedIDs[i]; 1060 clientID = (version4 ? refreshedIDs[i+1] : "") || this._uniqueIDToClientID(uniqueID); 1061 Array.add(updated, document.getElementById(clientID)); 1062 } 1063 1064 for (i = 0, l = oldIDs.length; i < l; i++) { 1065 uniqueID = oldIDs[i]; 1066 if (Array.indexOf(refreshedIDs, uniqueID) === -1 && 1067 (Array.indexOf(newIDs, uniqueID) === -1 || Array.indexOf(childIDs, uniqueID) > -1)) { 1068 Array.add(deleted, document.getElementById(oldClientIDs[i])); 1069 } 1070 } 1071 1072 return new Sys.WebForms.PageLoadingEventArgs(updated, deleted, data.dataItems); 1073 }, 1074 1075 _getPostBackSettings: function PageRequestManager$_getPostBackSettings(element, elementUniqueID) { 1076 1077 var originalElement = element; 1078 1079 var proposedSettings = null; 1080 1081 while (element) {
1082 if (element.id) { 1083 if (!proposedSettings && Array.contains(this._asyncPostBackControlClientIDs, element.id)) { 1084 proposedSettings = this._createPostBackSettings(true, null, elementUniqueID, originalElement); 1085 } 1086 else { 1087 if (!proposedSettings && Array.contains(this._postBackControlClientIDs, element.id)) { 1088 return this._createPostBackSettings(false); 1089 } 1090 else { 1091 var indexOfPanel = Array.indexOf(this._updatePanelClientIDs, element.id); 1092 if (indexOfPanel !== -1) { 1093 if (this._updatePanelHasChildrenAsTriggers[indexOfPanel]) { 1094 1095 return this._createPostBackSettings(true, [this._updatePanelIDs[indexOfPanel]], elementUniqueID, originalElement); 1096 } 1097 else { 1098 return this._createPostBackSettings(true, null, elementUniqueID, originalElement); 1099 } 1100 } 1101 } 1102 } 1103 1104 if (!proposedSettings && this._matchesParentIDInList(element.id, this._asyncPostBackControlClientIDs)) { 1105 proposedSettings = this._createPostBackSettings(true, null, elementUniqueID, originalElement); 1106 } 1107 else { 1108 if (!proposedSettings && this._matchesParentIDInList(element.id, this._postBackControlClientIDs)) { 1109 return this._createPostBackSettings(false); 1110 } 1111 } 1112 } 1113 1114 element = element.parentNode; 1115 } 1116 1117 if (!proposedSettings) { 1118 return this._createPostBackSettings(false); 1119 } 1120 else { 1121 return proposedSettings; 1122 } 1123 }, 1124 1125 _getScrollPosition: function PageRequestManager$_getScrollPosition() { 1126 var d = document.documentElement; 1127 if (d && (this._validPosition(d.scrollLeft) || this._validPosition(d.scrollTop))) { 1128 return { 1129 x: d.scrollLeft, 1130 y: d.scrollTop 1131 }; 1132 } 1133 else { 1134 d = document.body; 1135 if (d && (this._validPosition(d.scrollLeft) || this._validPosition(d.scrollTop))) { 1136 return { 1137 x: d.scrollLeft, 1138 y: d.scrollTop 1139 }; 1140 } 1141 else { 1142 if (this._validPosition(window.pageXOffset) || this._validPosition(window.pageYOffset)) { 1143 return { 1144 x: window.pageXOffset, 1145 y: window.pageYOffset 1146 }; 1147 } 1148 else { 1149 return { 1150 x: 0, 1151 y: 0 1152 }; 1153 } 1154 } 1155 } 1156 }, 1157 1158 _initializeInternal: function PageRequestManager$_initializeInternal(scriptManagerID, formElement, updatePanelIDs, asyncPostBackControlIDs, postBackControlIDs, asyncPostBackTimeout, masterPageUniqueID) { 1159 if (this._prmInitialized) { 1160 throw Error.invalidOperation(Sys.WebForms.Res.PRM_CannotRegisterTwice); 1161 } 1162 this._prmInitialized = true; 1163 this._masterPageUniqueID = masterPageUniqueID; 1164 this._scriptManagerID = scriptManagerID; 1165 this._form = Sys.UI.DomElement.resolveElement(formElement); 1166 this._onsubmit = this._form.onsubmit; 1167 this._form.onsubmit = null; 1168 this._onFormSubmitHandler = Function.createDelegate(this, this._onFormSubmit); 1169 this._onFormElementClickHandler = Function.createDelegate(this, this._onFormElementClick); 1170 this._onWindowUnloadHandler = Function.createDelegate(this, this._onWindowUnload); 1171 Sys.UI.DomEvent.addHandler(this._form, 'submit', this._onFormSubmitHandler); 1172 Sys.UI.DomEvent.addHandler(this._form, 'click', this._onFormElementClickHandler); 1173 Sys.UI.DomEvent.addHandler(window, 'unload', this._onWindowUnloadHandler); 1174 1175 this._originalDoPostBack = window.__doPostBack; 1176 if (this._originalDoPostBack) { 1177 window.__doPostBack = Function.createDelegate(this, this._doPostBack); 1178 } 1179 this._originalDoPostBackWithOptions = window.WebForm_DoPostBackWithOptions; 1180 if (this._originalDoPostBackWithOptions) { 1181 window.WebForm_DoPostBackWithOptions = Function.createDelegate(this, this._doPostBackWithOptions); 1182 } 1183 this._originalFireDefaultButton = window.WebForm_FireDefaultButton; 1184 if (this._originalFireDefaultButton) { 1185 window.WebForm_FireDefaultButton = Function.createDelegate(this, this._fireDefaultButton); 1186 } 1187 this._originalDoCallback = window.WebForm_DoCallback; 1188 if (this._originalDoCallback) { 1189 window.WebForm_DoCallback = Function.createDelegate(this, this._doCallback); 1190 } 1191 1192 this._pageLoadedHandler = Function.createDelegate(this, this._pageLoadedInitialLoad); 1193 Sys.UI.DomEvent.addHandler(window, 'load', this._pageLoadedHandler); 1194 if (updatePanelIDs) { 1195 this._updateControls(updatePanelIDs, asyncPostBackControlIDs, postBackControlIDs, asyncPostBackTimeout, true); 1196 } 1197 }, 1198 1199 _matchesParentIDInList: function PageRequestManager$_matchesParentIDInList(clientID, parentIDList) { 1200 for (var i = 0, l = parentIDList.length; i < l; i++) { 1201 if (clientID.startsWith(parentIDList[i] + "_")) { 1202 return true; 1203 } 1204 } 1205 return false; 1206 }, 1207 1208 _onFormElementActive: function PageRequestManager$_onFormElementActive(element, offsetX, offsetY) { 1209 if (element.disabled) { 1210 return; 1211 } 1212 1213 this._postBackSettings = this._getPostBackSettings(element, element.name); 1214 1215 if (element.name) { 1216 var tagName = element.tagName.toUpperCase(); 1217 if (tagName === 'INPUT') { 1218 var type = element.type; 1219 if (type === 'submit') { 1220 this._additionalInput = encodeURIComponent(element.name) + '=' + encodeURIComponent(element.value); 1221 } 1222 else if (type === 'image') { 1223 this._additionalInput = encodeURIComponent(element.name) + '.x=' + offsetX + '&' + encodeURIComponent(element.name) + '.y=' + offsetY; 1224 } 1225 } 1226 else if ((tagName === 'BUTTON') && (element.name.length !== 0) && (element.type === 'submit')) { 1227 this._additionalInput = encodeURIComponent(element.name) + '=' + encodeURIComponent(element.value); 1228 } 1229 } 1230 }, 1231 1232 _onFormElementClick: function PageRequestManager$_onFormElementClick(evt) { 1233 this._activeDefaultButtonClicked = (evt.target === this._activeDefaultButton); 1234 this._onFormElementActive(evt.target, evt.offsetX, evt.offsetY); 1235 }, 1236 1237 _onFormSubmit: function PageRequestManager$_onFormSubmit(evt) { 1238 var i, l, continueSubmit = true, 1239 isCrossPost = this._isCrossPost; 1240 this._isCrossPost = false; 1241 1242 if (this._onsubmit) { 1243 continueSubmit = this._onsubmit(); 1244 } 1245 1246 if (continueSubmit) { 1247 for (i = 0, l = this._onSubmitStatements.length; i < l; i++) { 1248 if (!this._onSubmitStatements[i]()) { 1249 continueSubmit = false; 1250 break; 1251 } 1252 } 1253 } 1254 1255 if (!continueSubmit) { 1256 if (evt) { 1257 evt.preventDefault(); 1258 } 1259 return; 1260 } 1261 1262 var form = this._form; 1263 if (isCrossPost) { 1264 return; 1265 } 1266 1267 if (this._activeDefaultButton && !this._activeDefaultButtonClicked) { 1268 this._onFormElementActive(this._activeDefaultButton, 0, 0); 1269 } 1270 1271 if (!this._postBackSettings || !this._postBackSettings.async) { 1272 return; 1273 } 1274 1275 var formBody = new Sys.StringBuilder(), 1276 count = form.elements.length, 1277 panelID = this._createPanelID(null, this._postBackSettings); 1278 formBody.append(panelID); 1279 1280 for (i = 0; i < count; i++) { 1281 var element = form.elements[i]; 1282 var name = element.name; 1283 if (typeof(name) === "undefined" || (name === null) || (name.length === 0) || (name === this._scriptManagerID)) { 1284 continue; 1285 } 1286 1287 var tagName = element.tagName.toUpperCase(); 1288 1289 if (tagName === 'INPUT') { 1290 var type = element.type; 1291 if ((type === 'text') || 1292 (type === 'password') || 1293 (type === 'hidden') || 1294 (((type === 'checkbox') || (type === 'radio')) && element.checked)) { 1295 formBody.append(encodeURIComponent(name)); 1296 formBody.append('='); 1297 formBody.append(encodeURIComponent(element.value)); 1298 formBody.append('&'); 1299 } 1300 } 1301 else if (tagName === 'SELECT') { 1302 var optionCount = element.options.length; 1303 for (var j = 0; j < optionCount; j++) { 1304 var option = element.options[j]; 1305 if (option.selected) { 1306 formBody.append(encodeURIComponent(name)); 1307 formBody.append('='); 1308 formBody.append(encodeURIComponent(option.value)); 1309 formBody.append('&'); 1310 } 1311 } 1312 } 1313 else if (tagName === 'TEXTAREA') { 1314 formBody.append(encodeURIComponent(name)); 1315 formBody.append('='); 1316 formBody.append(encodeURIComponent(element.value)); 1317 formBody.append('&'); 1318 } 1319 } 1320 1321 formBody.append("__ASYNCPOST=true&"); 1322 1323 if (this._additionalInput) { 1324 formBody.append(this._additionalInput); 1325 this._additionalInput = null; 1326 } 1327
1328 var request = new Sys.Net.WebRequest(); 1329 var action = form.action; 1330 if (Sys.Browser.agent === Sys.Browser.InternetExplorer) { 1331 var fragmentIndex = action.indexOf('#'); 1332 if (fragmentIndex !== -1) { 1333 action = action.substr(0, fragmentIndex); 1334 } 1335 var queryIndex = action.indexOf('?'); 1336 if (queryIndex !== -1) { 1337 var path = action.substr(0, queryIndex); 1338 if (path.indexOf("%") === -1) { 1339 action = encodeURI(path) + action.substr(queryIndex); 1340 } 1341 } 1342 else if (action.indexOf("%") === -1) { 1343 action = encodeURI(action); 1344 } 1345 } 1346 request.set_url(action); 1347 request.get_headers()['X-MicrosoftAjax'] = 'Delta=true'; 1348 request.get_headers()['Cache-Control'] = 'no-cache'; 1349 request.set_timeout(this._asyncPostBackTimeout); 1350 request.add_completed(Function.createDelegate(this, this._onFormSubmitCompleted)); 1351 request.set_body(formBody.toString()); 1352 var panelsToUpdate, eventArgs; 1353 panelsToUpdate = this._postBackSettings.panelsToUpdate; 1354 eventArgs = new Sys.WebForms.InitializeRequestEventArgs(request, this._postBackSettings.sourceElement, panelsToUpdate); 1355 Sys.Observer.raiseEvent(this, "initializeRequest", eventArgs); 1356 continueSubmit = !eventArgs.get_cancel(); 1357 1358 if (!continueSubmit) { 1359 if (evt) { 1360 evt.preventDefault(); 1361 } 1362 return; 1363 } 1364 1365 if (eventArgs && eventArgs._updated) { 1366 panelsToUpdate = eventArgs.get_updatePanelsToUpdate(); 1367 request.set_body(request.get_body().replace(panelID, this._createPanelID(panelsToUpdate, this._postBackSettings))); 1368 } 1369 1370 this._scrollPosition = this._getScrollPosition(); 1371 1372 1373 this.abortPostBack(); 1374 1375 eventArgs = new Sys.WebForms.BeginRequestEventArgs(request, this._postBackSettings.sourceElement, 1376 panelsToUpdate || this._postBackSettings.panelsToUpdate); 1377 Sys.Observer.raiseEvent(this, "beginRequest", eventArgs); 1378 1379 if (this._originalDoCallback) { 1380 this._cancelPendingCallbacks(); 1381 } 1382 1383 this._request = request; 1384 this._processingRequest = false; 1385 request.invoke(); 1386 1387 if (evt) { 1388 evt.preventDefault(); 1389 } 1390 }, 1391 1392 _onFormSubmitCompleted: function PageRequestManager$_onFormSubmitCompleted(sender, eventArgs) { 1393 this._processingRequest = true; 1394 1395 1396 if (sender.get_timedOut()) { 1397 this._endPostBack(this._createPageRequestManagerTimeoutError(), sender, null); 1398 return; 1399 } 1400 1401 if (sender.get_aborted()) { 1402 this._endPostBack(null, sender, null); 1403 return; 1404 } 1405 1406 if (!this._request || (sender.get_webRequest() !== this._request)) { 1407 return; 1408 } 1409 1410 if (sender.get_statusCode() !== 200) { 1411 this._endPostBack(this._createPageRequestManagerServerError(sender.get_statusCode()), sender, null); 1412 return; 1413 } 1414 1415 var data = this._parseDelta(sender); 1416 if (!data) return; 1417 1418 var i, l; 1419 1420 if (data.asyncPostBackControlIDsNode && data.postBackControlIDsNode && 1421 data.updatePanelIDsNode && data.panelsToRefreshNode && data.childUpdatePanelIDsNode) { 1422 1423 var oldUpdatePanelIDs = this._updatePanelIDs, 1424 oldUpdatePanelClientIDs = this._updatePanelClientIDs; 1425 var childUpdatePanelIDsString = data.childUpdatePanelIDsNode.content; 1426 var childUpdatePanelIDs = childUpdatePanelIDsString.length ? childUpdatePanelIDsString.split(',') : []; 1427 1428 var asyncPostBackControlIDsArray = this._splitNodeIntoArray(data.asyncPostBackControlIDsNode); 1429 var postBackControlIDsArray = this._splitNodeIntoArray(data.postBackControlIDsNode); 1430 var updatePanelIDsArray = this._splitNodeIntoArray(data.updatePanelIDsNode); 1431 var panelsToRefreshIDs = this._splitNodeIntoArray(data.panelsToRefreshNode); 1432 1433 var v4 = data.version4; 1434 for (i = 0, l = panelsToRefreshIDs.length; i < l; i+= (v4 ? 2 : 1)) { 1435 var panelClientID = (v4 ? panelsToRefreshIDs[i+1] : "") || this._uniqueIDToClientID(panelsToRefreshIDs[i]); 1436 if (!document.getElementById(panelClientID)) {
1437 this._endPostBack(Error.invalidOperation(String.format(Sys.WebForms.Res.PRM_MissingPanel, panelClientID)), sender, data); 1438 return; 1439 } 1440 } 1441 1442 var updatePanelData = this._processUpdatePanelArrays( 1443 updatePanelIDsArray, 1444 asyncPostBackControlIDsArray, 1445 postBackControlIDsArray, v4); 1446 updatePanelData.oldUpdatePanelIDs = oldUpdatePanelIDs; 1447 updatePanelData.oldUpdatePanelClientIDs = oldUpdatePanelClientIDs; 1448 updatePanelData.childUpdatePanelIDs = childUpdatePanelIDs; 1449 updatePanelData.panelsToRefreshIDs = panelsToRefreshIDs; 1450 data.updatePanelData = updatePanelData; 1451 } 1452 1453 data.dataItems = {}; 1454 var node; 1455 for (i = 0, l = data.dataItemNodes.length; i < l; i++) { 1456 node = data.dataItemNodes[i]; 1457 data.dataItems[node.id] = node.content; 1458 } 1459 for (i = 0, l = data.dataItemJsonNodes.length; i < l; i++) { 1460 node = data.dataItemJsonNodes[i]; 1461 data.dataItems[node.id] = Sys.Serialization.JavaScriptSerializer.deserialize(node.content); 1462 } 1463 1464 var handler = Sys.Observer._getContext(this, true).events.getHandler("pageLoading"); 1465 if (handler) { 1466 handler(this, this._getPageLoadingEventArgs(data)); 1467 } 1468 1469 1470 1471 Sys._ScriptLoader.readLoadedScripts(); 1472 1473 Sys.Application.beginCreateComponents(); 1474 1475 var scriptLoader = Sys._ScriptLoader.getInstance(); 1476 this._queueScripts(scriptLoader, data.scriptBlockNodes, true, false); 1477 1478 this._processingRequest = true; 1479 1480 scriptLoader.loadScripts(0, 1481 Function.createDelegate(this, Function.createCallback(this._scriptIncludesLoadComplete, data)), 1482 Function.createDelegate(this, Function.createCallback(this._scriptIncludesLoadFailed, data)), 1483 null); 1484 }, 1485 1486 _onWindowUnload: function PageRequestManager$_onWindowUnload(evt) { 1487 this.dispose(); 1488 }, 1489 1490 _pageLoaded: function PageRequestManager$_pageLoaded(initialLoad, data) { 1491 Sys.Observer.raiseEvent(this, "pageLoaded", this._getPageLoadedEventArgs(initialLoad, data)); 1492 if (!initialLoad) { 1493 Sys.Application.raiseLoad(); 1494 } 1495 }, 1496 1497 _pageLoadedInitialLoad: function PageRequestManager$_pageLoadedInitialLoad(evt) { 1498 this._pageLoaded(true, null); 1499 }, 1500 1501 _parseDelta: function PageRequestManager$_parseDelta(executor) { 1502 var reply = executor.get_responseData(); 1503 var delimiterIndex, len, type, id, content; 1504 var replyIndex = 0; 1505 var parserErrorDetails = null; 1506 var delta = []; 1507 1508 while (replyIndex < reply.length) { 1509 delimiterIndex = reply.indexOf('|', replyIndex); 1510 if (delimiterIndex === -1) { 1511 parserErrorDetails = this._findText(reply, replyIndex); 1512 break; 1513 } 1514 len = parseInt(reply.substring(replyIndex, delimiterIndex), 10); 1515 if ((len % 1) !== 0) { 1516 parserErrorDetails = this._findText(reply, replyIndex); 1517 break; 1518 } 1519 replyIndex = delimiterIndex + 1; 1520 1521 delimiterIndex = reply.indexOf('|', replyIndex); 1522 if (delimiterIndex === -1) { 1523 parserErrorDetails = this._findText(reply, replyIndex); 1524 break; 1525 } 1526 type = reply.substring(replyIndex, delimiterIndex); 1527 replyIndex = delimiterIndex + 1; 1528 1529 delimiterIndex = reply.indexOf('|', replyIndex); 1530 if (delimiterIndex === -1) { 1531 parserErrorDetails = this._findText(reply, replyIndex); 1532 break; 1533 } 1534 id = reply.substring(replyIndex, delimiterIndex); 1535 replyIndex = delimiterIndex + 1; 1536 1537 if ((replyIndex + len) >= reply.length) { 1538 parserErrorDetails = this._findText(reply, reply.length); 1539 break; 1540 } 1541 content = reply.substr(replyIndex, len); 1542 replyIndex += len; 1543 1544 if (reply.charAt(replyIndex) !== '|') { 1545 parserErrorDetails = this._findText(reply, replyIndex); 1546 break; 1547 } 1548 1549 replyIndex++; 1550 1551 Array.add(delta, {type: type, id: id, content: content}); 1552 } 1553 1554 if (parserErrorDetails) { 1555 this._endPostBack(this._createPageRequestManagerParserError(String.format(Sys.WebForms.Res.PRM_ParserErrorDetails, parserErrorDetails)), executor, null); 1556 return null; 1557 } 1558 1559 var updatePanelNodes = []; 1560 var hiddenFieldNodes = []; 1561 var arrayDeclarationNodes = []; 1562 var scriptBlockNodes = []; 1563 var scriptStartupNodes = []; 1564 var expandoNodes = []; 1565 var onSubmitNodes = []; 1566 var dataItemNodes = []; 1567 var dataItemJsonNodes = []; 1568 var scriptDisposeNodes = []; 1569 var asyncPostBackControlIDsNode, postBackControlIDsNode, 1570 updatePanelIDsNode, asyncPostBackTimeoutNode, 1571 childUpdatePanelIDsNode, panelsToRefreshNode, formActionNode, 1572 versionNode; 1573 1574 for (var i = 0, l = delta.length; i < l; i++) { 1575 var deltaNode = delta[i]; 1576 switch (deltaNode.type) { 1577 case "#": 1578 versionNode = deltaNode; 1579 break; 1580 case "updatePanel": 1581 Array.add(updatePanelNodes, deltaNode); 1582 break; 1583 case "hiddenField": 1584 Array.add(hiddenFieldNodes, deltaNode); 1585 break; 1586 case "arrayDeclaration": 1587 Array.add(arrayDeclarationNodes, deltaNode); 1588 break; 1589 case "scriptBlock": 1590 Array.add(scriptBlockNodes, deltaNode); 1591 break; 1592 case "scriptStartupBlock": 1593 Array.add(scriptStartupNodes, deltaNode); 1594 break; 1595 case "expando": 1596 Array.add(expandoNodes, deltaNode); 1597 break; 1598 case "onSubmit": 1599 Array.add(onSubmitNodes, deltaNode); 1600 break; 1601 case "asyncPostBackControlIDs": 1602 asyncPostBackControlIDsNode = deltaNode; 1603 break; 1604 case "postBackControlIDs": 1605 postBackControlIDsNode = deltaNode; 1606 break; 1607 case "updatePanelIDs": 1608 updatePanelIDsNode = deltaNode; 1609 break; 1610 case "asyncPostBackTimeout": 1611 asyncPostBackTimeoutNode = deltaNode; 1612 break; 1613 case "childUpdatePanelIDs": 1614 childUpdatePanelIDsNode = deltaNode; 1615 break; 1616 case "panelsToRefreshIDs": 1617 panelsToRefreshNode = deltaNode; 1618 break; 1619 case "formAction": 1620 formActionNode = deltaNode; 1621 break; 1622 case "dataItem": 1623 Array.add(dataItemNodes, deltaNode); 1624 break; 1625 case "dataItemJson": 1626 Array.add(dataItemJsonNodes, deltaNode); 1627 break; 1628 case "scriptDispose": 1629 Array.add(scriptDisposeNodes, deltaNode); 1630 break; 1631 case "pageRedirect": 1632 if (versionNode && parseFloat(versionNode.content) >= 4) { 1633 deltaNode.content = unescape(deltaNode.content); 1634 } 1635 if (Sys.Browser.agent === Sys.Browser.InternetExplorer) { 1636 var anchor = document.createElement("a"); 1637 anchor.style.display = 'none'; 1638 anchor.attachEvent("onclick", cancelBubble); 1639 anchor.href = deltaNode.content; 1640 this._form.parentNode.insertBefore(anchor, this._form); 1641 anchor.click(); 1642 anchor.detachEvent("onclick", cancelBubble); 1643 this._form.parentNode.removeChild(anchor); 1644 1645 function cancelBubble(e) { 1646 e.cancelBubble = true; 1647 } 1648 } 1649 else { 1650 window.location.href = deltaNode.content; 1651 } 1652 return null; 1653 case "error": 1654 this._endPostBack(this._createPageRequestManagerServerError(Number.parseInvariant(deltaNode.id), deltaNode.content), executor, null); 1655 return null; 1656 case "pageTitle": 1657 document.title = deltaNode.content; 1658 break; 1659 case "focus": 1660 this._controlIDToFocus = deltaNode.content; 1661 break; 1662 default: 1663 this._endPostBack(this._createPageRequestManagerParserError(String.format(Sys.WebForms.Res.PRM_UnknownToken, deltaNode.type)), executor, null); 1664 return null; 1665 } // switch 1666 } // for (var i = 0, l = delta.length; i < l; i++) 1667 return { 1668 version4: versionNode ? (parseFloat(versionNode.content) >= 4) : false, 1669 executor: executor, 1670 updatePanelNodes: updatePanelNodes, 1671 hiddenFieldNodes: hiddenFieldNodes, 1672 arrayDeclarationNodes: arrayDeclarationNodes, 1673 scriptBlockNodes: scriptBlockNodes, 1674 scriptStartupNodes: scriptStartupNodes, 1675 expandoNodes: expandoNodes, 1676 onSubmitNodes: onSubmitNodes, 1677 dataItemNodes: dataItemNodes, 1678 dataItemJsonNodes: dataItemJsonNodes, 1679 scriptDisposeNodes: scriptDisposeNodes, 1680 asyncPostBackControlIDsNode: asyncPostBackControlIDsNode, 1681 postBackControlIDsNode: postBackControlIDsNode, 1682 updatePanelIDsNode: updatePanelIDsNode, 1683 asyncPostBackTimeoutNode: asyncPostBackTimeoutNode, 1684 childUpdatePanelIDsNode: childUpdatePanelIDsNode, 1685 panelsToRefreshNode: panelsToRefreshNode, 1686 formActionNode: formActionNode }; 1687 }, 1688 1689 _processUpdatePanelArrays: function PageRequestManager$_processUpdatePanelArrays(updatePanelIDs, asyncPostBackControlIDs, postBackControlIDs, version4) { 1690 var newUpdatePanelIDs, newUpdatePanelClientIDs, newUpdatePanelHasChildrenAsTriggers; 1691 1692 if (updatePanelIDs) { 1693 var l = updatePanelIDs.length, 1694 m = version4 ? 2 : 1; 1695 newUpdatePanelIDs = new Array(l/m); 1696 newUpdatePanelClientIDs = new Array(l/m); 1697 newUpdatePanelHasChildrenAsTriggers = new Array(l/m); 1698 1699 for (var i = 0, j = 0; i < l; i += m, j++) { 1700 var ct, 1701 uniqueID = updatePanelIDs[i], 1702 clientID = version4 ? updatePanelIDs[i+1] : ""; 1703 ct = (uniqueID.charAt(0) === 't'); 1704 uniqueID = uniqueID.substr(1); 1705 if (!clientID) { 1706 clientID = this._uniqueIDToClientID(uniqueID); 1707 } 1708 newUpdatePanelHasChildrenAsTriggers[j] = ct; 1709 newUpdatePanelIDs[j] = uniqueID; 1710 newUpdatePanelClientIDs[j] = clientID; 1711 } 1712 } 1713 else { 1714 newUpdatePanelIDs = []; 1715 newUpdatePanelClientIDs = []; 1716 newUpdatePanelHasChildrenAsTriggers = []; 1717 } 1718 1719 var newAsyncPostBackControlIDs = []; 1720 var newAsyncPostBackControlClientIDs = []; 1721 this._convertToClientIDs(asyncPostBackControlIDs, newAsyncPostBackControlIDs, newAsyncPostBackControlClientIDs, version4); 1722 1723 var newPostBackControlIDs = []; 1724 var newPostBackControlClientIDs = []; 1725 this._convertToClientIDs(postBackControlIDs, newPostBackControlIDs, newPostBackControlClientIDs, version4); 1726 1727 return { 1728 updatePanelIDs: newUpdatePanelIDs, 1729 updatePanelClientIDs: newUpdatePanelClientIDs, 1730 updatePanelHasChildrenAsTriggers: newUpdatePanelHasChildrenAsTriggers, 1731 asyncPostBackControlIDs: newAsyncPostBackControlIDs, 1732 asyncPostBackControlClientIDs: newAsyncPostBackControlClientIDs, 1733 postBackControlIDs: newPostBackControlIDs, 1734 postBackControlClientIDs: newPostBackControlClientIDs 1735 }; 1736 }, 1737 1738 _queueScripts: function PageRequestManager$_queueScripts(scriptLoader, scriptBlockNodes, queueIncludes, queueBlocks) { 1739 for (var i = 0, l = scriptBlockNodes.length; i < l; i++) { 1740 var scriptBlockType = scriptBlockNodes[i].id; 1741 switch (scriptBlockType) { 1742 case "ScriptContentNoTags": 1743 if (!queueBlocks) { 1744 continue; 1745 } 1746 scriptLoader.queueScriptBlock(scriptBlockNodes[i].content); 1747 break; 1748 case "ScriptContentWithTags": 1749 var scriptTagAttributes = window.eval("(" + scriptBlockNodes[i].content + ")"); 1750 1751 if (scriptTagAttributes.src) { 1752 if (!queueIncludes || Sys._ScriptLoader.isScriptLoaded(scriptTagAttributes.src)) { 1753 continue; 1754 } 1755 } 1756 else if (!queueBlocks) { 1757 continue; 1758 } 1759 1760 scriptLoader.queueCustomScriptTag(scriptTagAttributes); 1761 break; 1762 case "ScriptPath": 1763 if (!queueIncludes || Sys._ScriptLoader.isScriptLoaded(scriptBlockNodes[i].content)) { 1764 continue; 1765 } 1766 1767 scriptLoader.queueScriptReference(scriptBlockNodes[i].content); 1768 break; 1769 } 1770 } 1771 }, 1772 1773 _registerDisposeScript: function PageRequestManager$_registerDisposeScript(panelID, disposeScript) { 1774 if (!this._scriptDisposes[panelID]) { 1775 this._scriptDisposes[panelID] = [disposeScript]; 1776 } 1777 else { 1778 Array.add(this._scriptDisposes[panelID], disposeScript); 1779 } 1780 }, 1781 1782 _scriptIncludesLoadComplete: function PageRequestManager$_scriptIncludesLoadComplete(scriptLoader, data) {
1783 if (data.executor.get_webRequest() !== this._request) { 1784 return; 1785 } 1786 1787 this._commitControls(data.updatePanelData, 1788 data.asyncPostBackTimeoutNode ? data.asyncPostBackTimeoutNode.content : null); 1789 1790 if (data.formActionNode) { 1791 this._form.action = data.formActionNode.content; 1792 } 1793 1794 var i, l, node; 1795 1796 for (i = 0, l = data.updatePanelNodes.length; i < l; i++) { 1797 node = data.updatePanelNodes[i]; 1798 var updatePanelElement = document.getElementById(node.id); 1799 1800 if (!updatePanelElement) { 1801 this._endPostBack(Error.invalidOperation(String.format(Sys.WebForms.Res.PRM_MissingPanel, node.id)), data.executor, data); 1802 return; 1803 } 1804 1805 this._updatePanel(updatePanelElement, node.content); 1806 } 1807 1808 for (i = 0, l = data.scriptDisposeNodes.length; i < l; i++) { 1809 node = data.scriptDisposeNodes[i]; 1810 this._registerDisposeScript(node.id, node.content); 1811 } 1812 1813 for (i = 0, l = this._transientFields.length; i < l; i++) { 1814 var field = document.getElementById(this._transientFields[i]); 1815 if (field) { 1816 var toRemove = field._isContained ? field.parentNode : field; 1817 toRemove.parentNode.removeChild(toRemove); 1818 } 1819 } 1820 for (i = 0, l = data.hiddenFieldNodes.length; i < l; i++) { 1821 node = data.hiddenFieldNodes[i]; 1822 this._createHiddenField(node.id, node.content); 1823 } 1824 1825 if (data.scriptsFailed) { 1826 throw Sys._ScriptLoader._errorScriptLoadFailed(data.scriptsFailed.src, data.scriptsFailed.multipleCallbacks); 1827 } 1828 1829 1830 this._queueScripts(scriptLoader, data.scriptBlockNodes, false, true); 1831 1832 var arrayScript = ''; 1833 for (i = 0, l = data.arrayDeclarationNodes.length; i < l; i++) { 1834 node = data.arrayDeclarationNodes[i]; 1835 arrayScript += "Sys.WebForms.PageRequestManager._addArrayElement('" + node.id + "', " + node.content + ");\r\n"; 1836 } 1837 1838 var expandoScript = ''; 1839 for (i = 0, l = data.expandoNodes.length; i < l; i++) { 1840 node = data.expandoNodes[i]; 1841 expandoScript += node.id + " = " + node.content + "\r\n"; 1842 } 1843 1844 if (arrayScript.length) { 1845 scriptLoader.queueScriptBlock(arrayScript); 1846 } 1847 if (expandoScript.length) { 1848 scriptLoader.queueScriptBlock(expandoScript); 1849 } 1850 1851 this._queueScripts(scriptLoader, data.scriptStartupNodes, true, true); 1852 1853 var onSubmitStatementScript = ''; 1854 for (i = 0, l = data.onSubmitNodes.length; i < l; i++) { 1855 if (i === 0) { 1856 onSubmitStatementScript = 'Array.add(Sys.WebForms.PageRequestManager.getInstance()._onSubmitStatements, function() {\r\n'; 1857 } 1858 onSubmitStatementScript += data.onSubmitNodes[i].content + "\r\n"; 1859 } 1860 if (onSubmitStatementScript.length) { 1861 onSubmitStatementScript += "\r\nreturn true;\r\n});\r\n"; 1862 scriptLoader.queueScriptBlock(onSubmitStatementScript); 1863 } 1864 1865 scriptLoader.loadScripts(0, 1866 Function.createDelegate(this, Function.createCallback(this._scriptsLoadComplete, data)), null, null); 1867 1868 }, 1869 1870 _scriptIncludesLoadFailed: function PageRequestManager$_scriptIncludesLoadFailed(scriptLoader, scriptElement, multipleCallbacks, data) { 1871 data.scriptsFailed = { src: scriptElement.src, multipleCallbacks: multipleCallbacks }; 1872 this._scriptIncludesLoadComplete(scriptLoader, data); 1873 }, 1874 1875 _scriptsLoadComplete: function PageRequestManager$_scriptsLoadComplete(scriptLoader, data) { 1876 var response = data.executor; 1877 1878 if (window.__theFormPostData) { 1879 window.__theFormPostData = ""; 1880 } 1881 if (window.__theFormPostCollection) { 1882 window.__theFormPostCollection = []; 1883 } 1884 if (window.WebForm_InitCallback) { 1885 window.WebForm_InitCallback(); 1886 } 1887 1888 if (this._scrollPosition) { 1889 if (window.scrollTo) { 1890 window.scrollTo(this._scrollPosition.x, this._scrollPosition.y); 1891 } 1892 this._scrollPosition = null; 1893 } 1894 1895 Sys.Application.endCreateComponents(); 1896 1897 this._pageLoaded(false, data); 1898 1899 this._endPostBack(null, response, data); 1900 1901 if (this._controlIDToFocus) { 1902 var focusTarget; 1903 var oldContentEditableSetting; 1904 if (Sys.Browser.agent === Sys.Browser.InternetExplorer) { 1905 var targetControl = $get(this._controlIDToFocus); 1906 1907 focusTarget = targetControl; 1908 if (targetControl && (!WebForm_CanFocus(targetControl))) { 1909 focusTarget = WebForm_FindFirstFocusableChild(targetControl); 1910 } 1911 if (focusTarget && (typeof(focusTarget.contentEditable) !== "undefined")) { 1912 oldContentEditableSetting = focusTarget.contentEditable; 1913 focusTarget.contentEditable = false; 1914 } 1915 else { 1916 focusTarget = null; 1917 } 1918 } 1919 WebForm_AutoFocus(this._controlIDToFocus); 1920 if (focusTarget) { 1921 focusTarget.contentEditable = oldContentEditableSetting; 1922 } 1923 this._controlIDToFocus = null; 1924 } 1925 }, 1926 1927 _splitNodeIntoArray: function PageRequestManager$_splitNodeIntoArray(node) { 1928 var str = node.content; 1929 var arr = str.length ? str.split(',') : []; 1930 return arr; 1931 }, 1932 1933 _uniqueIDToClientID: function PageRequestManager$_uniqueIDToClientID(uniqueID) { 1934 return uniqueID.replace(/\$/g, '_'); 1935 }, 1936 1937 _updateControls: function PageRequestManager$_updateControls(updatePanelIDs, asyncPostBackControlIDs, postBackControlIDs, asyncPostBackTimeout, version4) { 1938 this._commitControls( 1939 this._processUpdatePanelArrays(updatePanelIDs, asyncPostBackControlIDs, postBackControlIDs, version4), 1940 asyncPostBackTimeout); 1941 }, 1942 1943 _updatePanel: function PageRequestManager$_updatePanel(updatePanelElement, rendering) { 1944 for (var updatePanelID in this._scriptDisposes) { 1945 if (this._elementContains(updatePanelElement, document.getElementById(updatePanelID))) { 1946 var disposeScripts = this._scriptDisposes[updatePanelID]; 1947 for (var i = 0, l = disposeScripts.length; i < l; i++) { 1948 window.eval(disposeScripts[i]); 1949 } 1950 1951 delete this._scriptDisposes[updatePanelID]; 1952 } 1953 } 1954 1955 Sys.Application.disposeElement(updatePanelElement, true); 1956 1957 updatePanelElement.innerHTML = rendering; 1958 }, 1959 1960 _validPosition: function PageRequestManager$_validPosition(position) { 1961 return (typeof(position) !== "undefined") && (position !== null) && (position !== 0); 1962 } 1963} 1964 1965$type.getInstance = function PageRequestManager$getInstance() { 1966 /// <summary locid="M:J#Sys.WebForms.PageRequestManager.getInstance">Gets the current instance of the PageRequestManager.</summary> 1967 /// <returns type="Sys.WebForms.PageRequestManager"></returns> 1968 if (arguments.length !== 0) throw Error.parameterCount(); 1969 var prm = Sys.WebForms.PageRequestManager._instance; 1970 if (!prm) { 1971 prm = Sys.WebForms.PageRequestManager._instance = new Sys.WebForms.PageRequestManager(); 1972 } 1973 return prm; 1974} 1975 1976$type._addArrayElement = function PageRequestManager$_addArrayElement(arrayName) { 1977 if (!window[arrayName]) { 1978 window[arrayName] = new Array(); 1979 } 1980 1981 for (var i = 1, l = arguments.length; i < l; i++) { 1982 Array.add(window[arrayName], arguments[i]); 1983 } 1984} 1985 1986$type._initialize = function PageRequestManager$_initialize() { 1987 var prm = Sys.WebForms.PageRequestManager.getInstance(); 1988 prm._initializeInternal.apply(prm, arguments); 1989} 1990 1991$type.registerClass('Sys.WebForms.PageRequestManager'); 1992$type = Sys.UI._UpdateProgress = function _UpdateProgress(element) { 1993 Sys.UI._UpdateProgress.initializeBase(this,[element]);
1994 this._displayAfter = 500; 1995 this._dynamicLayout = true; 1996 this._associatedUpdatePanelId = null; 1997 this._beginRequestHandlerDelegate = null; 1998 this._startDelegate = null; 1999 this._endRequestHandlerDelegate = null; 2000 this._pageRequestManager = null; 2001 this._timerCookie = null; 2002} 2003$type.prototype = { 2004 get_displayAfter: function _UpdateProgress$get_displayAfter() { 2005 /// <value type="Number" locid="P:J#Sys.UI._UpdateProgress.displayAfter"></value> 2006 if (arguments.length !== 0) throw Error.parameterCount(); 2007 return this._displayAfter; 2008 }, 2009 set_displayAfter: function _UpdateProgress$set_displayAfter(value) { 2010 var e = Function._validateParams(arguments, [{name: "value", type: Number}]); 2011 if (e) throw e; 2012 this._displayAfter = value; 2013 }, 2014 get_dynamicLayout: function _UpdateProgress$get_dynamicLayout() { 2015 /// <value type="Boolean" locid="P:J#Sys.UI._UpdateProgress.dynamicLayout"></value> 2016 if (arguments.length !== 0) throw Error.parameterCount(); 2017 return this._dynamicLayout; 2018 }, 2019 set_dynamicLayout: function _UpdateProgress$set_dynamicLayout(value) { 2020 var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]); 2021 if (e) throw e; 2022 this._dynamicLayout = value; 2023 }, 2024 get_associatedUpdatePanelId: function _UpdateProgress$get_associatedUpdatePanelId() { 2025 /// <value type="String" mayBeNull="true" locid="P:J#Sys.UI._UpdateProgress.associatedUpdatePanelId"></value> 2026 if (arguments.length !== 0) throw Error.parameterCount(); 2027 return this._associatedUpdatePanelId; 2028 }, 2029 set_associatedUpdatePanelId: function _UpdateProgress$set_associatedUpdatePanelId(value) { 2030 var e = Function._validateParams(arguments, [{name: "value", type: String, mayBeNull: true}]); 2031 if (e) throw e; 2032 this._associatedUpdatePanelId = value; 2033 }, 2034 get_role: function _UpdateProgress$get_role() { 2035 /// <value type="String" locid="P:J#Sys.UI._UpdateProgress.role"></value> 2036 if (arguments.length !== 0) throw Error.parameterCount(); 2037 return "status"; 2038 }, 2039 _clearTimeout: function _UpdateProgress$_clearTimeout() { 2040 if (this._timerCookie) { 2041 window.clearTimeout(this._timerCookie); 2042 this._timerCookie = null; 2043 } 2044 }, 2045 _getUniqueID: function _UpdateProgress$_getUniqueID(clientID) { 2046 var i = Array.indexOf(this._pageRequestManager._updatePanelClientIDs, clientID); 2047 return i === -1 ? null : this._pageRequestManager._updatePanelIDs[i]; 2048 }, 2049 _handleBeginRequest: function _UpdateProgress$_handleBeginRequest(sender, arg) { 2050 var curElem = arg.get_postBackElement(), 2051 showProgress = true, 2052 upID = this._associatedUpdatePanelId; 2053 if (this._associatedUpdatePanelId) { 2054 var updating = arg.get_updatePanelsToUpdate(); 2055 if (updating && updating.length) { 2056 showProgress = (Array.contains(updating, upID) || Array.contains(updating, this._getUniqueID(upID))) 2057 } 2058 else { 2059 showProgress = false; 2060 } 2061 } 2062 while (!showProgress && curElem) { 2063 if (curElem.id && this._associatedUpdatePanelId === curElem.id) { 2064 showProgress = true; 2065 } 2066 curElem = curElem.parentNode; 2067 } 2068 if (showProgress) { 2069 this._timerCookie = window.setTimeout(this._startDelegate, this._displayAfter); 2070 } 2071 }, 2072 _startRequest: function _UpdateProgress$_startRequest() { 2073 if (this._pageRequestManager.get_isInAsyncPostBack()) { 2074 var element = this.get_element(); 2075 if (this._dynamicLayout) { 2076 element.style.display = 'block'; 2077 } 2078 else { 2079 element.style.visibility = 'visible'; 2080 } 2081 if (this.get_role() === "status") { 2082 element.setAttribute("aria-hidden", "false"); 2083 } 2084 } 2085 this._timerCookie = null; 2086 }, 2087 _handleEndRequest: function _UpdateProgress$_handleEndRequest(sender, arg) {
2088 var element = this.get_element(); 2089 if (this._dynamicLayout) { 2090 element.style.display = 'none'; 2091 } 2092 else { 2093 element.style.visibility = 'hidden'; 2094 } 2095 if (this.get_role() === "status") { 2096 element.setAttribute("aria-hidden", "true"); 2097 } 2098 this._clearTimeout(); 2099 }, 2100 dispose: function _UpdateProgress$dispose() { 2101 if (this._beginRequestHandlerDelegate !== null) { 2102 this._pageRequestManager.remove_beginRequest(this._beginRequestHandlerDelegate); 2103 this._pageRequestManager.remove_endRequest(this._endRequestHandlerDelegate); 2104 this._beginRequestHandlerDelegate = null; 2105 this._endRequestHandlerDelegate = null; 2106 } 2107 this._clearTimeout(); 2108 Sys.UI._UpdateProgress.callBaseMethod(this,"dispose"); 2109 }, 2110 initialize: function _UpdateProgress$initialize() { 2111 Sys.UI._UpdateProgress.callBaseMethod(this, 'initialize'); 2112 if (this.get_role() === "status") { 2113 this.get_element().setAttribute("aria-hidden", "true"); 2114 } 2115 this._beginRequestHandlerDelegate = Function.createDelegate(this, this._handleBeginRequest); 2116 this._endRequestHandlerDelegate = Function.createDelegate(this, this._handleEndRequest); 2117 this._startDelegate = Function.createDelegate(this, this._startRequest); 2118 if (Sys.WebForms && Sys.WebForms.PageRequestManager) { 2119 this._pageRequestManager = Sys.WebForms.PageRequestManager.getInstance(); 2120 } 2121 if (this._pageRequestManager !== null ) { 2122 this._pageRequestManager.add_beginRequest(this._beginRequestHandlerDelegate); 2123 this._pageRequestManager.add_endRequest(this._endRequestHandlerDelegate); 2124 } 2125 } 2126} 2127$type.registerClass('Sys.UI._UpdateProgress', Sys.UI.Control); 2128 2129} 2130 2131if (window.Sys && Sys.loader) { 2132 Sys.loader.registerScript("WebForms", ["ComponentModel", "Serialization", "Network"], execute); 2133} 2134else { 2135 execute(); 2136} 2137 2138})(); 2139 2140Type.registerNamespace('Sys.WebForms'); 2141Sys.WebForms.Res={ 2142"PRM_UnknownToken":"Unknown token: \u0027{0}\u0027.", 2143"PRM_MissingPanel":"Could not find UpdatePanel with ID \u0027{0}\u0027. If it is being updated dynamically then it must be inside another UpdatePanel.", 2144"PRM_ServerError":"An unknown error occurred while processing the request on the server. The status code returned from the server was: {0}", 2145"PRM_ParserError":"The message received from the server could not be parsed.", 2146"PRM_TimeoutError":"The server request timed out.", 2147"PRM_ParserErrorDetails":"Error parsing near \u0027{0}\u0027.", 2148"PRM_CannotRegisterTwice":"The PageRequestManager cannot be initialized more than once." 2149};
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.