Commit inicial Ventas Productivo
This commit is contained in:
403
Scripts/AjaxControlToolkit/Debug/BaseScripts.debug.js
Normal file
403
Scripts/AjaxControlToolkit/Debug/BaseScripts.debug.js
Normal file
@@ -0,0 +1,403 @@
|
||||
Type.registerNamespace('Sys.Extended.UI');
|
||||
|
||||
Sys.Extended.UI.BehaviorBase = function(element) {
|
||||
// Base behavior for all extender behaviors
|
||||
// "element" - element the behavior is associated with
|
||||
Sys.Extended.UI.BehaviorBase.initializeBase(this,[element]);
|
||||
|
||||
this._clientStateFieldID = null;
|
||||
this._pageRequestManager = null;
|
||||
this._partialUpdateBeginRequestHandler = null;
|
||||
this._partialUpdateEndRequestHandler = null;
|
||||
}
|
||||
Sys.Extended.UI.BehaviorBase.prototype = {
|
||||
initialize : function() {
|
||||
Sys.Extended.UI.BehaviorBase.callBaseMethod(this, 'initialize');
|
||||
},
|
||||
|
||||
dispose : function() {
|
||||
Sys.Extended.UI.BehaviorBase.callBaseMethod(this, 'dispose');
|
||||
|
||||
if (this._pageRequestManager) {
|
||||
if (this._partialUpdateBeginRequestHandler) {
|
||||
this._pageRequestManager.remove_beginRequest(this._partialUpdateBeginRequestHandler);
|
||||
this._partialUpdateBeginRequestHandler = null;
|
||||
}
|
||||
if (this._partialUpdateEndRequestHandler) {
|
||||
this._pageRequestManager.remove_endRequest(this._partialUpdateEndRequestHandler);
|
||||
this._partialUpdateEndRequestHandler = null;
|
||||
}
|
||||
this._pageRequestManager = null;
|
||||
}
|
||||
},
|
||||
|
||||
get_ClientStateFieldID : function() {
|
||||
// ID of the hidden field used to store client state
|
||||
return this._clientStateFieldID;
|
||||
},
|
||||
set_ClientStateFieldID : function(value) {
|
||||
if (this._clientStateFieldID != value) {
|
||||
this._clientStateFieldID = value;
|
||||
this.raisePropertyChanged('ClientStateFieldID');
|
||||
}
|
||||
},
|
||||
|
||||
get_ClientState : function() {
|
||||
if (this._clientStateFieldID) {
|
||||
var input = document.getElementById(this._clientStateFieldID);
|
||||
if (input) {
|
||||
return input.value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
},
|
||||
set_ClientState : function(value) {
|
||||
if (this._clientStateFieldID) {
|
||||
var input = document.getElementById(this._clientStateFieldID);
|
||||
if (input) {
|
||||
input.value = value;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
registerPartialUpdateEvents : function() {
|
||||
// Register for beginRequest and endRequest events on the PageRequestManager,
|
||||
// (which cause _partialUpdateBeginRequest and _partialUpdateEndRequest to be
|
||||
// called when an UpdatePanel refreshes)
|
||||
|
||||
if (Sys && Sys.WebForms && Sys.WebForms.PageRequestManager){
|
||||
this._pageRequestManager = Sys.WebForms.PageRequestManager.getInstance();
|
||||
if (this._pageRequestManager) {
|
||||
this._partialUpdateBeginRequestHandler = Function.createDelegate(this, this._partialUpdateBeginRequest);
|
||||
this._pageRequestManager.add_beginRequest(this._partialUpdateBeginRequestHandler);
|
||||
this._partialUpdateEndRequestHandler = Function.createDelegate(this, this._partialUpdateEndRequest);
|
||||
this._pageRequestManager.add_endRequest(this._partialUpdateEndRequestHandler);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_partialUpdateBeginRequest : function(sender, beginRequestEventArgs) {
|
||||
// Method that will be called when a partial update (via an UpdatePanel) begins,
|
||||
// if registerPartialUpdateEvents() has been called.
|
||||
// "sender" - sender
|
||||
// "beginRequestEventArgs" - event arguments
|
||||
},
|
||||
|
||||
_partialUpdateEndRequest : function(sender, endRequestEventArgs) {
|
||||
// Method that will be called when a partial update (via an UpdatePanel) finishes,
|
||||
// if registerPartialUpdateEvents() has been called.
|
||||
// "sender" - sender
|
||||
// "endRequestEventArgs" - event arguments
|
||||
}
|
||||
}
|
||||
Sys.Extended.UI.BehaviorBase.registerClass('Sys.Extended.UI.BehaviorBase', Sys.UI.Behavior);
|
||||
|
||||
|
||||
Sys.Extended.UI.DynamicPopulateBehaviorBase = function(element) {
|
||||
/// DynamicPopulateBehaviorBase is used to add DynamicPopulateBehavior funcitonality
|
||||
/// to other extenders. It will dynamically populate the contents of the target element
|
||||
/// when its populate method is called.
|
||||
/// "element" - DOM Element the behavior is associated with
|
||||
Sys.Extended.UI.DynamicPopulateBehaviorBase.initializeBase(this, [element]);
|
||||
|
||||
this._DynamicControlID = null;
|
||||
this._DynamicContextKey = null;
|
||||
this._DynamicServicePath = null;
|
||||
this._DynamicServiceMethod = null;
|
||||
this._cacheDynamicResults = false;
|
||||
this._dynamicPopulateBehavior = null;
|
||||
this._populatingHandler = null;
|
||||
this._populatedHandler = null;
|
||||
}
|
||||
Sys.Extended.UI.DynamicPopulateBehaviorBase.prototype = {
|
||||
initialize : function() {
|
||||
Sys.Extended.UI.DynamicPopulateBehaviorBase.callBaseMethod(this, 'initialize');
|
||||
|
||||
this._populatingHandler = Function.createDelegate(this, this._onPopulating);
|
||||
this._populatedHandler = Function.createDelegate(this, this._onPopulated);
|
||||
},
|
||||
|
||||
dispose : function() {
|
||||
if (this._populatedHandler) {
|
||||
if (this._dynamicPopulateBehavior) {
|
||||
this._dynamicPopulateBehavior.remove_populated(this._populatedHandler);
|
||||
}
|
||||
this._populatedHandler = null;
|
||||
}
|
||||
if (this._populatingHandler) {
|
||||
if (this._dynamicPopulateBehavior) {
|
||||
this._dynamicPopulateBehavior.remove_populating(this._populatingHandler);
|
||||
}
|
||||
this._populatingHandler = null;
|
||||
}
|
||||
|
||||
if (this._dynamicPopulateBehavior) {
|
||||
this._dynamicPopulateBehavior.dispose();
|
||||
this._dynamicPopulateBehavior = null;
|
||||
}
|
||||
Sys.Extended.UI.DynamicPopulateBehaviorBase.callBaseMethod(this, 'dispose');
|
||||
},
|
||||
|
||||
populate : function(contextKeyOverride) {
|
||||
// Demand-create the DynamicPopulateBehavior and use it to populate the target element
|
||||
// "contextKeyOverride" - an arbitrary string value to be passed to the web method.
|
||||
// For example, if the element to be populated is within a data-bound repeater, this could be the ID of the current row.
|
||||
|
||||
if (this._dynamicPopulateBehavior && (this._dynamicPopulateBehavior.get_element() != $get(this._DynamicControlID))) {
|
||||
this._dynamicPopulateBehavior.dispose();
|
||||
this._dynamicPopulateBehavior = null;
|
||||
}
|
||||
|
||||
if (!this._dynamicPopulateBehavior && this._DynamicControlID && this._DynamicServiceMethod) {
|
||||
this._dynamicPopulateBehavior = $create(Sys.Extended.UI.DynamicPopulateBehavior,
|
||||
{
|
||||
"id" : this.get_id() + "_DynamicPopulateBehavior",
|
||||
"ContextKey" : this._DynamicContextKey,
|
||||
"ServicePath" : this._DynamicServicePath,
|
||||
"ServiceMethod" : this._DynamicServiceMethod,
|
||||
"cacheDynamicResults" : this._cacheDynamicResults
|
||||
}, null, null, $get(this._DynamicControlID));
|
||||
|
||||
this._dynamicPopulateBehavior.add_populating(this._populatingHandler);
|
||||
this._dynamicPopulateBehavior.add_populated(this._populatedHandler);
|
||||
}
|
||||
|
||||
if (this._dynamicPopulateBehavior) {
|
||||
this._dynamicPopulateBehavior.populate(contextKeyOverride ? contextKeyOverride : this._DynamicContextKey);
|
||||
}
|
||||
},
|
||||
|
||||
_onPopulating : function(sender, eventArgs) {
|
||||
// Handler for DynamicPopulate behavior's Populating event
|
||||
// "sender" - DynamicPopulate behavior
|
||||
// "eventArgs" - event args
|
||||
this.raisePopulating(eventArgs);
|
||||
},
|
||||
|
||||
_onPopulated : function(sender, eventArgs) {
|
||||
// Handler for DynamicPopulate behavior's Populated event
|
||||
// "sender" - DynamicPopulate behavior
|
||||
// "eventArgs" - event args
|
||||
this.raisePopulated(eventArgs);
|
||||
},
|
||||
|
||||
get_dynamicControlID : function() {
|
||||
// ID of the element to populate with dynamic content
|
||||
return this._DynamicControlID;
|
||||
},
|
||||
get_DynamicControlID : this.get_dynamicControlID,
|
||||
set_dynamicControlID : function(value) {
|
||||
if (this._DynamicControlID != value) {
|
||||
this._DynamicControlID = value;
|
||||
this.raisePropertyChanged('dynamicControlID');
|
||||
this.raisePropertyChanged('DynamicControlID');
|
||||
}
|
||||
},
|
||||
set_DynamicControlID : this.set_dynamicControlID,
|
||||
|
||||
get_dynamicContextKey : function() {
|
||||
// An arbitrary string value to be passed to the web method.
|
||||
// For example, if the element to be populated is within a
|
||||
// data-bound repeater, this could be the ID of the current row.
|
||||
return this._DynamicContextKey;
|
||||
},
|
||||
get_DynamicContextKey : this.get_dynamicContextKey,
|
||||
set_dynamicContextKey : function(value) {
|
||||
if (this._DynamicContextKey != value) {
|
||||
this._DynamicContextKey = value;
|
||||
this.raisePropertyChanged('dynamicContextKey');
|
||||
this.raisePropertyChanged('DynamicContextKey');
|
||||
}
|
||||
},
|
||||
set_DynamicContextKey : this.set_dynamicContextKey,
|
||||
|
||||
get_dynamicServicePath : function() {
|
||||
// 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.
|
||||
return this._DynamicServicePath;
|
||||
},
|
||||
get_DynamicServicePath : this.get_dynamicServicePath,
|
||||
set_dynamicServicePath : function(value) {
|
||||
if (this._DynamicServicePath != value) {
|
||||
this._DynamicServicePath = value;
|
||||
this.raisePropertyChanged('dynamicServicePath');
|
||||
this.raisePropertyChanged('DynamicServicePath');
|
||||
}
|
||||
},
|
||||
set_DynamicServicePath : this.set_dynamicServicePath,
|
||||
|
||||
get_dynamicServiceMethod : function() {
|
||||
// The name of the method to call on the page or web service
|
||||
// The signature of the method must exactly match the following:
|
||||
// [WebMethod]
|
||||
// string DynamicPopulateMethod(string contextKey)
|
||||
// {
|
||||
// ...
|
||||
// }
|
||||
return this._DynamicServiceMethod;
|
||||
},
|
||||
get_DynamicServiceMethod : this.get_dynamicServiceMethod,
|
||||
set_dynamicServiceMethod : function(value) {
|
||||
if (this._DynamicServiceMethod != value) {
|
||||
this._DynamicServiceMethod = value;
|
||||
this.raisePropertyChanged('dynamicServiceMethod');
|
||||
this.raisePropertyChanged('DynamicServiceMethod');
|
||||
}
|
||||
},
|
||||
set_DynamicServiceMethod : this.set_dynamicServiceMethod,
|
||||
|
||||
get_cacheDynamicResults : function() {
|
||||
// Whether the results of the dynamic population should be cached and
|
||||
// not fetched again after the first load
|
||||
return this._cacheDynamicResults;
|
||||
},
|
||||
set_cacheDynamicResults : function(value) {
|
||||
if (this._cacheDynamicResults != value) {
|
||||
this._cacheDynamicResults = value;
|
||||
this.raisePropertyChanged('cacheDynamicResults');
|
||||
}
|
||||
},
|
||||
|
||||
add_populated : function(handler) {
|
||||
// Add a handler on the populated event
|
||||
// "handler" - handler
|
||||
this.get_events().addHandler("populated", handler);
|
||||
},
|
||||
remove_populated : function(handler) {
|
||||
// Remove a handler from the populated event
|
||||
// "handler" - handler
|
||||
this.get_events().removeHandler("populated", handler);
|
||||
},
|
||||
raisePopulated : function(arg) {
|
||||
// Raise the populated event
|
||||
// "arg" - event arguments
|
||||
var handler = this.get_events().getHandler("populated");
|
||||
if (handler) handler(this, arg);
|
||||
},
|
||||
|
||||
add_populating : function(handler) {
|
||||
// Add an event handler for the populating event
|
||||
// "handler" - event handler
|
||||
this.get_events().addHandler('populating', handler);
|
||||
},
|
||||
remove_populating : function(handler) {
|
||||
// Remove an event handler from the populating event
|
||||
// "handler" - event handler
|
||||
this.get_events().removeHandler('populating', handler);
|
||||
},
|
||||
raisePopulating : function(eventArgs) {
|
||||
// Raise the populating event
|
||||
// "eventArgs" - event arguments for the populating event
|
||||
|
||||
var handler = this.get_events().getHandler('populating');
|
||||
if (handler) {
|
||||
handler(this, eventArgs);
|
||||
}
|
||||
}
|
||||
}
|
||||
Sys.Extended.UI.DynamicPopulateBehaviorBase.registerClass('Sys.Extended.UI.DynamicPopulateBehaviorBase', Sys.Extended.UI.BehaviorBase);
|
||||
|
||||
|
||||
Sys.Extended.UI.ControlBase = function(element) {
|
||||
Sys.Extended.UI.ControlBase.initializeBase(this, [element]);
|
||||
this._clientStateField = null;
|
||||
this._callbackTarget = null;
|
||||
this._onsubmit$delegate = Function.createDelegate(this, this._onsubmit);
|
||||
this._oncomplete$delegate = Function.createDelegate(this, this._oncomplete);
|
||||
this._onerror$delegate = Function.createDelegate(this, this._onerror);
|
||||
}
|
||||
|
||||
Sys.Extended.UI.ControlBase.__doPostBack = function(eventTarget, eventArgument) {
|
||||
if (!Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack()) {
|
||||
for (var i = 0; i < Sys.Extended.UI.ControlBase.onsubmitCollection.length; i++) {
|
||||
Sys.Extended.UI.ControlBase.onsubmitCollection[i]();
|
||||
}
|
||||
}
|
||||
Function.createDelegate(window, Sys.Extended.UI.ControlBase.__doPostBackSaved)(eventTarget, eventArgument);
|
||||
}
|
||||
|
||||
Sys.Extended.UI.ControlBase.prototype = {
|
||||
initialize: function() {
|
||||
Sys.Extended.UI.ControlBase.callBaseMethod(this, "initialize");
|
||||
if (this._clientStateField) {
|
||||
this.loadClientState(this._clientStateField.value);
|
||||
}
|
||||
if (typeof (Sys.WebForms) !== "undefined" && typeof (Sys.WebForms.PageRequestManager) !== "undefined") {
|
||||
Array.add(Sys.WebForms.PageRequestManager.getInstance()._onSubmitStatements, this._onsubmit$delegate);
|
||||
if (Sys.Extended.UI.ControlBase.__doPostBackSaved == null || typeof Sys.Extended.UI.ControlBase.__doPostBackSaved == "undefined") {
|
||||
Sys.Extended.UI.ControlBase.__doPostBackSaved = window.__doPostBack;
|
||||
window.__doPostBack = Sys.Extended.UI.ControlBase.__doPostBack;
|
||||
Sys.Extended.UI.ControlBase.onsubmitCollection = new Array();
|
||||
}
|
||||
Array.add(Sys.Extended.UI.ControlBase.onsubmitCollection, this._onsubmit$delegate);
|
||||
} else {
|
||||
$addHandler(document.forms[0], "submit", this._onsubmit$delegate);
|
||||
}
|
||||
},
|
||||
dispose: function() {
|
||||
if (typeof (Sys.WebForms) !== "undefined" && typeof (Sys.WebForms.PageRequestManager) !== "undefined") {
|
||||
Array.remove(Sys.Extended.UI.ControlBase.onsubmitCollection, this._onsubmit$delegate);
|
||||
Array.remove(Sys.WebForms.PageRequestManager.getInstance()._onSubmitStatements, this._onsubmit$delegate);
|
||||
} else {
|
||||
$removeHandler(document.forms[0], "submit", this._onsubmit$delegate);
|
||||
}
|
||||
Sys.Extended.UI.ControlBase.callBaseMethod(this, "dispose");
|
||||
},
|
||||
|
||||
findElement: function(id) {
|
||||
return $get(this.get_id() + '_' + id.split(':').join('_'));
|
||||
},
|
||||
get_clientStateField: function() {
|
||||
return this._clientStateField;
|
||||
},
|
||||
set_clientStateField: function(value) {
|
||||
if (this.get_isInitialized()) throw Error.invalidOperation(Sys.Extended.UI.Resources.ExtenderBase_CannotSetClientStateField);
|
||||
if (this._clientStateField != value) {
|
||||
this._clientStateField = value;
|
||||
this.raisePropertyChanged('clientStateField');
|
||||
}
|
||||
},
|
||||
loadClientState: function(value) {
|
||||
// override this method to intercept client state loading after a callback
|
||||
},
|
||||
saveClientState: function() {
|
||||
// override this method to intercept client state acquisition before a callback
|
||||
return null;
|
||||
},
|
||||
_invoke: function(name, args, cb) {
|
||||
// invokes a callback method on the server control
|
||||
if (!this._callbackTarget) {
|
||||
throw Error.invalidOperation(Sys.Extended.UI.Resources.ExtenderBase_ControlNotRegisteredForCallbacks);
|
||||
}
|
||||
if (typeof (WebForm_DoCallback) === "undefined") {
|
||||
throw Error.invalidOperation(Sys.Extended.UI.Resources.ExtenderBase_PageNotRegisteredForCallbacks);
|
||||
}
|
||||
var ar = [];
|
||||
for (var i = 0; i < args.length; i++)
|
||||
ar[i] = args[i];
|
||||
var clientState = this.saveClientState();
|
||||
if (clientState != null && !String.isInstanceOfType(clientState)) {
|
||||
throw Error.invalidOperation(Sys.Extended.UI.Resources.ExtenderBase_InvalidClientStateType);
|
||||
}
|
||||
var payload = Sys.Serialization.JavaScriptSerializer.serialize({ name: name, args: ar, state: this.saveClientState() });
|
||||
WebForm_DoCallback(this._callbackTarget, payload, this._oncomplete$delegate, cb, this._onerror$delegate, true);
|
||||
},
|
||||
_oncomplete: function(result, context) {
|
||||
result = Sys.Serialization.JavaScriptSerializer.deserialize(result);
|
||||
if (result.error) {
|
||||
throw Error.create(result.error);
|
||||
}
|
||||
this.loadClientState(result.state);
|
||||
context(result.result);
|
||||
},
|
||||
_onerror: function(message, context) {
|
||||
throw Error.create(message);
|
||||
},
|
||||
_onsubmit: function() {
|
||||
if (this._clientStateField) {
|
||||
this._clientStateField.value = this.saveClientState();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
Sys.Extended.UI.ControlBase.registerClass("Sys.Extended.UI.ControlBase", Sys.UI.Control);
|
||||
Reference in New Issue
Block a user