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