1// Name: BaseScripts.debug.js 2// Assembly: AjaxControlToolkit 3// Version: 20.1.0.0 4// FileVersion: 20.1.0.0 5Type.registerNamespace('Sys.Extended.UI'); 6 7Sys.Extended.UI.BehaviorBase = function(element) { 8 // Base behavior for all extender behaviors 9 // "element" - element the behavior is associated with 10 Sys.Extended.UI.BehaviorBase.initializeBase(this,[element]); 11 12 this._clientStateFieldID = null; 13 this._pageRequestManager = null; 14 this._partialUpdateBeginRequestHandler = null; 15 this._partialUpdateEndRequestHandler = null; 16} 17Sys.Extended.UI.BehaviorBase.prototype = { 18 initialize : function() { 19 Sys.Extended.UI.BehaviorBase.callBaseMethod(this, 'initialize'); 20 }, 21 22 dispose : function() { 23 Sys.Extended.UI.BehaviorBase.callBaseMethod(this, 'dispose'); 24 25 if (this._pageRequestManager) { 26 if (this._partialUpdateBeginRequestHandler) { 27 this._pageRequestManager.remove_beginRequest(this._partialUpdateBeginRequestHandler); 28 this._partialUpdateBeginRequestHandler = null; 29 } 30 if (this._partialUpdateEndRequestHandler) { 31 this._pageRequestManager.remove_endRequest(this._partialUpdateEndRequestHandler); 32 this._partialUpdateEndRequestHandler = null; 33 } 34 this._pageRequestManager = null; 35 } 36 }, 37 38 get_ClientStateFieldID : function() { 39 // ID of the hidden field used to store client state 40 return this._clientStateFieldID; 41 }, 42 set_ClientStateFieldID : function(value) { 43 if (this._clientStateFieldID != value) { 44 this._clientStateFieldID = value; 45 this.raisePropertyChanged('ClientStateFieldID'); 46 } 47 }, 48 49 get_ClientState : function() { 50 if (this._clientStateFieldID) { 51 var input = document.getElementById(this._clientStateFieldID); 52 if (input) { 53 return input.value; 54 } 55 } 56 return null; 57 }, 58 set_ClientState : function(value) { 59 if (this._clientStateFieldID) { 60 var input = document.getElementById(this._clientStateFieldID); 61 if (input) { 62 input.value = value; 63 } 64 } 65 }, 66 67 registerPartialUpdateEvents : function() { 68 // Register for beginRequest and endRequest events on the PageRequestManager, 69 // (which cause _partialUpdateBeginRequest and _partialUpdateEndRequest to be 70 // called when an UpdatePanel refreshes) 71 72 if (Sys && Sys.WebForms && Sys.WebForms.PageRequestManager){ 73 this._pageRequestManager = Sys.WebForms.PageRequestManager.getInstance(); 74 if (this._pageRequestManager) { 75 this._partialUpdateBeginRequestHandler = Function.createDelegate(this, this._partialUpdateBeginRequest); 76 this._pageRequestManager.add_beginRequest(this._partialUpdateBeginRequestHandler); 77 this._partialUpdateEndRequestHandler = Function.createDelegate(this, this._partialUpdateEndRequest); 78 this._pageRequestManager.add_endRequest(this._partialUpdateEndRequestHandler); 79 } 80 } 81 }, 82 83 _partialUpdateBeginRequest : function(sender, beginRequestEventArgs) { 84 // Method that will be called when a partial update (via an UpdatePanel) begins, 85 // if registerPartialUpdateEvents() has been called. 86 // "sender" - sender 87 // "beginRequestEventArgs" - event arguments 88 }, 89 90 _partialUpdateEndRequest : function(sender, endRequestEventArgs) { 91 // Method that will be called when a partial update (via an UpdatePanel) finishes, 92 // if registerPartialUpdateEvents() has been called. 93 // "sender" - sender 94 // "endRequestEventArgs" - event arguments 95 } 96} 97Sys.Extended.UI.BehaviorBase.registerClass('Sys.Extended.UI.BehaviorBase', Sys.UI.Behavior); 98 99 100Sys.Extended.UI.DynamicPopulateBehaviorBase = function(element) { 101 /// DynamicPopulateBehaviorBase is used to add DynamicPopulateBehavior funcitonality 102 /// to other extenders. It will dynamically populate the contents of the target element 103 /// when its populate method is called. 104 /// "element" - DOM Element the behavior is associated with 105 Sys.Extended.UI.DynamicPopulateBehaviorBase.initializeBase(this, [element]); 106 107 this._DynamicControlID = null; 108 this._DynamicContextKey = null; 109 this._DynamicServicePath = null; 110 this._DynamicServiceMethod = null; 111 this._cacheDynamicResults = false;
112 this._dynamicPopulateBehavior = null; 113 this._populatingHandler = null; 114 this._populatedHandler = null; 115} 116Sys.Extended.UI.DynamicPopulateBehaviorBase.prototype = { 117 initialize : function() { 118 Sys.Extended.UI.DynamicPopulateBehaviorBase.callBaseMethod(this, 'initialize'); 119 120 this._populatingHandler = Function.createDelegate(this, this._onPopulating); 121 this._populatedHandler = Function.createDelegate(this, this._onPopulated); 122 }, 123 124 dispose : function() { 125 if (this._populatedHandler) { 126 if (this._dynamicPopulateBehavior) { 127 this._dynamicPopulateBehavior.remove_populated(this._populatedHandler); 128 } 129 this._populatedHandler = null; 130 } 131 if (this._populatingHandler) { 132 if (this._dynamicPopulateBehavior) { 133 this._dynamicPopulateBehavior.remove_populating(this._populatingHandler); 134 } 135 this._populatingHandler = null; 136 } 137 138 if (this._dynamicPopulateBehavior) { 139 this._dynamicPopulateBehavior.dispose(); 140 this._dynamicPopulateBehavior = null; 141 } 142 Sys.Extended.UI.DynamicPopulateBehaviorBase.callBaseMethod(this, 'dispose'); 143 }, 144 145 populate : function(contextKeyOverride) { 146 // Demand-create the DynamicPopulateBehavior and use it to populate the target element 147 // "contextKeyOverride" - an arbitrary string value to be passed to the web method. 148 // For example, if the element to be populated is within a data-bound repeater, this could be the ID of the current row. 149 150 if (this._dynamicPopulateBehavior && (this._dynamicPopulateBehavior.get_element() != $get(this._DynamicControlID))) { 151 this._dynamicPopulateBehavior.dispose(); 152 this._dynamicPopulateBehavior = null; 153 } 154 155 if (!this._dynamicPopulateBehavior && this._DynamicControlID && this._DynamicServiceMethod) { 156 this._dynamicPopulateBehavior = $create(Sys.Extended.UI.DynamicPopulateBehavior, 157 { 158 "id" : this.get_id() + "_DynamicPopulateBehavior", 159 "ContextKey" : this._DynamicContextKey, 160 "ServicePath" : this._DynamicServicePath, 161 "ServiceMethod" : this._DynamicServiceMethod, 162 "cacheDynamicResults" : this._cacheDynamicResults 163 }, null, null, $get(this._DynamicControlID)); 164 165 this._dynamicPopulateBehavior.add_populating(this._populatingHandler); 166 this._dynamicPopulateBehavior.add_populated(this._populatedHandler); 167 } 168 169 if (this._dynamicPopulateBehavior) { 170 this._dynamicPopulateBehavior.populate(contextKeyOverride ? contextKeyOverride : this._DynamicContextKey); 171 } 172 }, 173 174 _onPopulating : function(sender, eventArgs) { 175 // Handler for DynamicPopulate behavior's Populating event 176 // "sender" - DynamicPopulate behavior 177 // "eventArgs" - event args 178 this.raisePopulating(eventArgs); 179 }, 180 181 _onPopulated : function(sender, eventArgs) { 182 // Handler for DynamicPopulate behavior's Populated event 183 // "sender" - DynamicPopulate behavior 184 // "eventArgs" - event args 185 this.raisePopulated(eventArgs); 186 }, 187 188 get_dynamicControlID : function() { 189 // ID of the element to populate with dynamic content 190 return this._DynamicControlID; 191 }, 192 get_DynamicControlID : this.get_dynamicControlID, 193 set_dynamicControlID : function(value) { 194 if (this._DynamicControlID != value) { 195 this._DynamicControlID = value; 196 this.raisePropertyChanged('dynamicControlID'); 197 this.raisePropertyChanged('DynamicControlID'); 198 } 199 }, 200 set_DynamicControlID : this.set_dynamicControlID, 201 202 get_dynamicContextKey : function() { 203 // An arbitrary string value to be passed to the web method. 204 // For example, if the element to be populated is within a 205 // data-bound repeater, this could be the ID of the current row. 206 return this._DynamicContextKey; 207 }, 208 get_DynamicContextKey : this.get_dynamicContextKey, 209 set_dynamicContextKey : function(value) { 210 if (this._DynamicContextKey != value) { 211 this._DynamicContextKey = value; 212 this.raisePropertyChanged('dynamicContextKey'); 213 this.raisePropertyChanged('DynamicContextKey'); 214 } 215 }, 216 set_DynamicContextKey : this.set_dynamicContextKey, 217
218 get_dynamicServicePath : function() { 219 // The URL of the web service to call. If the ServicePath is not defined, then we will invoke a PageMethod instead of a web service. 220 return this._DynamicServicePath; 221 }, 222 get_DynamicServicePath : this.get_dynamicServicePath, 223 set_dynamicServicePath : function(value) { 224 if (this._DynamicServicePath != value) { 225 this._DynamicServicePath = value; 226 this.raisePropertyChanged('dynamicServicePath'); 227 this.raisePropertyChanged('DynamicServicePath'); 228 } 229 }, 230 set_DynamicServicePath : this.set_dynamicServicePath, 231 232 get_dynamicServiceMethod : function() { 233 // The name of the method to call on the page or web service 234 // The signature of the method must exactly match the following: 235 // [WebMethod] 236 // string DynamicPopulateMethod(string contextKey) 237 // { 238 // ... 239 // } 240 return this._DynamicServiceMethod; 241 }, 242 get_DynamicServiceMethod : this.get_dynamicServiceMethod, 243 set_dynamicServiceMethod : function(value) { 244 if (this._DynamicServiceMethod != value) { 245 this._DynamicServiceMethod = value; 246 this.raisePropertyChanged('dynamicServiceMethod'); 247 this.raisePropertyChanged('DynamicServiceMethod'); 248 } 249 }, 250 set_DynamicServiceMethod : this.set_dynamicServiceMethod, 251 252 get_cacheDynamicResults : function() { 253 // Whether the results of the dynamic population should be cached and 254 // not fetched again after the first load 255 return this._cacheDynamicResults; 256 }, 257 set_cacheDynamicResults : function(value) { 258 if (this._cacheDynamicResults != value) { 259 this._cacheDynamicResults = value; 260 this.raisePropertyChanged('cacheDynamicResults'); 261 } 262 }, 263 264 add_populated : function(handler) { 265 // Add a handler on the populated event 266 // "handler" - handler 267 this.get_events().addHandler("populated", handler); 268 }, 269 remove_populated : function(handler) { 270 // Remove a handler from the populated event 271 // "handler" - handler 272 this.get_events().removeHandler("populated", handler); 273 }, 274 raisePopulated : function(arg) { 275 // Raise the populated event 276 // "arg" - event arguments 277 var handler = this.get_events().getHandler("populated"); 278 if (handler) handler(this, arg); 279 }, 280 281 add_populating : function(handler) { 282 // Add an event handler for the populating event 283 // "handler" - event handler 284 this.get_events().addHandler('populating', handler); 285 }, 286 remove_populating : function(handler) { 287 // Remove an event handler from the populating event 288 // "handler" - event handler 289 this.get_events().removeHandler('populating', handler); 290 }, 291 raisePopulating : function(eventArgs) { 292 // Raise the populating event 293 // "eventArgs" - event arguments for the populating event 294 295 var handler = this.get_events().getHandler('populating'); 296 if (handler) { 297 handler(this, eventArgs); 298 } 299 } 300} 301Sys.Extended.UI.DynamicPopulateBehaviorBase.registerClass('Sys.Extended.UI.DynamicPopulateBehaviorBase', Sys.Extended.UI.BehaviorBase); 302 303 304Sys.Extended.UI.ControlBase = function(element) { 305 Sys.Extended.UI.ControlBase.initializeBase(this, [element]); 306 this._clientStateField = null; 307 this._callbackTarget = null; 308 this._onsubmit$delegate = Function.createDelegate(this, this._onsubmit); 309 this._oncomplete$delegate = Function.createDelegate(this, this._oncomplete); 310 this._onerror$delegate = Function.createDelegate(this, this._onerror); 311} 312 313Sys.Extended.UI.ControlBase._execOnSubmitCollection = function() { 314 if (!Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack()) { 315 for (var i = 0; i < Sys.Extended.UI.ControlBase.onsubmitCollection.length; i++) { 316 Sys.Extended.UI.ControlBase.onsubmitCollection[i](); 317 } 318 } 319} 320 321Sys.Extended.UI.ControlBase.__doPostBack = function(eventTarget, eventArgument) { 322 Sys.Extended.UI.ControlBase._execOnSubmitCollection(); 323 Function.createDelegate(window, Sys.Extended.UI.ControlBase.__doPostBackSaved)(eventTarget, eventArgument); 324} 325 326Sys.Extended.UI.ControlBase.__doPostBackWithOptions = function(options) { 327 Sys.Extended.UI.ControlBase._execOnSubmitCollection(); 328 Sys.Extended.UI.ControlBase.__doPostBackWithOptionsSaved(options); 329} 330 331Sys.Extended.UI.ControlBase.prototype = { 332 initialize: function() { 333 Sys.Extended.UI.ControlBase.callBaseMethod(this, "initialize"); 334 if (this._clientStateField) { 335 this.loadClientState(this._clientStateField.value); 336 } 337 if (typeof (Sys.WebForms) !== "undefined" && typeof (Sys.WebForms.PageRequestManager) !== "undefined") { 338 Array.add(Sys.WebForms.PageRequestManager.getInstance()._onSubmitStatements, this._onsubmit$delegate); 339 if (Sys.Extended.UI.ControlBase.__doPostBackSaved == null || typeof Sys.Extended.UI.ControlBase.__doPostBackSaved == "undefined") { 340 Sys.Extended.UI.ControlBase.__doPostBackSaved = window.__doPostBack; 341 window.__doPostBack = Sys.Extended.UI.ControlBase.__doPostBack; 342 Sys.Extended.UI.ControlBase.onsubmitCollection = new Array(); 343 } 344 if (!Sys.Extended.UI.ControlBase.__doPostBackWithOptionsSaved) { 345 Sys.Extended.UI.ControlBase.__doPostBackWithOptionsSaved = window.WebForm_DoPostBackWithOptions; 346 window.WebForm_DoPostBackWithOptions = Sys.Extended.UI.ControlBase.__doPostBackWithOptions; 347 } 348 Array.add(Sys.Extended.UI.ControlBase.onsubmitCollection, this._onsubmit$delegate); 349 } else { 350 $addHandler(document.forms[0], "submit", this._onsubmit$delegate); 351 } 352 }, 353 dispose: function() { 354 if (typeof (Sys.WebForms) !== "undefined" && typeof (Sys.WebForms.PageRequestManager) !== "undefined") { 355 Array.remove(Sys.Extended.UI.ControlBase.onsubmitCollection, this._onsubmit$delegate); 356 Array.remove(Sys.WebForms.PageRequestManager.getInstance()._onSubmitStatements, this._onsubmit$delegate); 357 } else { 358 $removeHandler(document.forms[0], "submit", this._onsubmit$delegate); 359 } 360 Sys.Extended.UI.ControlBase.callBaseMethod(this, "dispose"); 361 }, 362 363 findElement: function(id) { 364 return $get(this.get_id() + '_' + id.split(':').join('_')); 365 }, 366 get_clientStateField: function() { 367 return this._clientStateField; 368 }, 369 set_clientStateField: function(value) {
370 if (this.get_isInitialized()) throw Error.invalidOperation(Sys.Extended.UI.Resources.ExtenderBase_CannotSetClientStateField); 371 if (this._clientStateField != value) { 372 this._clientStateField = value; 373 this.raisePropertyChanged('clientStateField'); 374 } 375 }, 376 loadClientState: function(value) { 377 // override this method to intercept client state loading after a callback 378 }, 379 saveClientState: function() { 380 // override this method to intercept client state acquisition before a callback 381 return null; 382 }, 383 _invoke: function(name, args, cb) { 384 // invokes a callback method on the server control 385 if (!this._callbackTarget) { 386 throw Error.invalidOperation(Sys.Extended.UI.Resources.ExtenderBase_ControlNotRegisteredForCallbacks); 387 } 388 if (typeof (WebForm_DoCallback) === "undefined") { 389 throw Error.invalidOperation(Sys.Extended.UI.Resources.ExtenderBase_PageNotRegisteredForCallbacks); 390 } 391 var ar = []; 392 for (var i = 0; i < args.length; i++) 393 ar[i] = args[i]; 394 var clientState = this.saveClientState(); 395 if (clientState != null && !String.isInstanceOfType(clientState)) { 396 throw Error.invalidOperation(Sys.Extended.UI.Resources.ExtenderBase_InvalidClientStateType); 397 } 398 var payload = Sys.Serialization.JavaScriptSerializer.serialize({ name: name, args: ar, state: this.saveClientState() }); 399 WebForm_DoCallback(this._callbackTarget, payload, this._oncomplete$delegate, cb, this._onerror$delegate, true); 400 }, 401 _oncomplete: function(result, context) { 402 result = Sys.Serialization.JavaScriptSerializer.deserialize(result); 403 if (result.error) { 404 throw Error.create(result.error); 405 } 406 this.loadClientState(result.state); 407 context(result.result); 408 }, 409 _onerror: function(message, context) { 410 throw Error.create(message); 411 }, 412 _onsubmit: function() { 413 if (this._clientStateField) { 414 this._clientStateField.value = this.saveClientState(); 415 } 416 return true; 417 } 418 419} 420Sys.Extended.UI.ControlBase.registerClass("Sys.Extended.UI.ControlBase", Sys.UI.Control); 421 422var isUnminified = /param/.test(function(param) { }); 423 424Sys.Extended.Deprecated = function(oldMethodName, properMethodName) { 425 if(isUnminified && window.console && console.warn) 426 if(arguments.length == 1) 427 console.warn(oldMethodName + " is deprecated."); 428 else 429 console.warn(oldMethodName + " is deprecated. Use " + properMethodName + " instead."); 430}
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.