/// Type.registerNamespace("Contensis.Web.UI"); Contensis.Web.UI.BaseAjaxControl = function(element) { Contensis.Web.UI.BaseAjaxControl.initializeBase(this, [element]); this._Browser = null; }; Contensis.Web.UI.BaseAjaxControl.prototype = { Properties: { AjaxControllerID: { type: String }, visible: { type: Boolean }, get_visible: function() { return Contensis.Web.UI.BaseAjaxControl.callBaseMethod(this, 'get_visible'); }, set_visible: function(value) { if (value != this.get_visible()) { Contensis.Web.UI.BaseAjaxControl.callBaseMethod(this, 'set_visible', [value]); this.raisePropertyChanged('visible'); } }, document: { type: Object, readOnly: true }, get_document: function() { if (this.get_element()) { return this.get_element().ownerDocument; } } }, initialize: function() { Contensis.Web.UI.BaseAjaxControl.callBaseMethod(this, 'initialize'); // Add custom initialization here }, dispose: function() { // add code here var storeName = Contensis.Web.UI.$Contensis.PrivateStoreName; if (typeof (this[storeName]) != 'undefined') { for (var i = 0, ilen = this[storeName].HTMLElements.length; i < ilen; i++) { var propName = this[storeName].HTMLElements[i]; this[propName] = null; } } $clearDomHandlers(this); Contensis.Web.UI.BaseAjaxControl.callBaseMethod(this, 'dispose'); }, AjaxRequest: function(Action, NameValueCollection, func) { var args = []; args[0] = null; for (var i = 3, ilen = arguments.length; i < ilen; i++) { args[args.length] = arguments[i]; } var self = this; var f = function(nv) { args[0] = nv; func.apply(self, args); }; $j.ContensisAjaxManager.AjaxRequest(this.get_AjaxControllerID(), Action, NameValueCollection, f); }, CreateCallback: function(func) { var args = []; args[0] = func; args[1] = this; Array.Load(args, arguments, 1); return this.CreateCallbackWithContext.apply(this, args); }, CreateCallbackWithContext: function(func, context) { var newArgs = []; Array.Load(newArgs, arguments, 2); return function() { var originalContext = this; var args = []; args[0] = originalContext; Array.addRange(args, newArgs); Array.Load(args, arguments); func.apply(context, args); } }, AddHandler: function(element, eventName, func) { if (!element) { return; } var result; var args = []; Array.Load(args, arguments); Array.insert(args, 3, this); if (element.jquery) { for (var i = 0; i < element.length; i++) { args[0] = element[i]; $addDomHandler.apply(null, args); } } else { result = $addDomHandler.apply(null, args); } return result; }, AddKeyPressHandler: function(el, func) { var args = []; args[0] = el; args[1] = 'keypress'; Array.Load(args, arguments, 1); this.AddHandler.apply(this, args); }, AddReturnHandler: function(el, func) { var self = this; var f = function(e) { if (e.charCode == 13) { var result = func.apply(self, arguments); if (!result) { return e.Kill(); } } }; var args = []; Array.Load(args, arguments); args[1] = f; this.AddKeyPressHandler.apply(this, args); }, AddSubmitHandler: function(el, btn) { var f = function() { btn.click(); } this.AddReturnHandler(el, f); }, ForEach: function(obj, func) { if (!obj) { return; } var result; if (typeof (obj.length) != 'undefined') { for (var i = 0; i < obj.length; i++) { result = func.call(this, obj[i], i); if (result) { break; } } } else { for (var prop in obj) { result = func.call(this, obj[prop], prop); if (result) { break; } } } return result; }, getElement: function(suffix) { return document.getElementById(this.get_id() + suffix); }, ToggleVisible: function() { this.set_visible(!this.get_visible()); }, Wait: function(func, delay) { window.setTimeout(Function.createDelegate(this, func), delay); } }; Contensis.Web.UI.BaseAjaxControl.registerClass('Contensis.Web.UI.BaseAjaxControl', Sys.UI.Control); Contensis.Web.UI.BaseAjaxJQueryControl = function(element) { Contensis.Web.UI.BaseAjaxJQueryControl.initializeBase(this, [element]); var self = this; if (typeof (jQuery) == 'function') { jQuery(function() { self.OnDocumentReady(); }); } this.$element = $j(element); var getJQuerySetter = function(propertyName, f) { return function(value) { var s = ''; f.call(this, value); this['$' + propertyName] = jQuery(value); }; }; if (typeof (this.Properties) != 'undefined') { for (var propertyName in this.Properties) { if (typeof (this.Properties[propertyName]) != 'function') { var definition = this.Properties[propertyName]; var doJQuery = false; if (definition.jQuery) { doJQuery = true; } if (definition.type) { if (definition.type == Sys.UI.DomElement) { doJQuery = true; } } if (typeof (jQuery) != 'undefined') { if (doJQuery) { var f = this['set_' + propertyName]; this['set_' + propertyName] = getJQuerySetter(propertyName, f); } } } } } }; Contensis.Web.UI.BaseAjaxJQueryControl.prototype = { initialize: function() { Contensis.Web.UI.BaseAjaxJQueryControl.callBaseMethod(this, 'initialize'); // Add custom initialization here }, dispose: function() { Contensis.Web.UI.BaseAjaxJQueryControl.callBaseMethod(this, 'dispose'); }, OnDocumentReady: function() { } } Contensis.Web.UI.BaseAjaxJQueryControl.registerClass('Contensis.Web.UI.BaseAjaxJQueryControl', Contensis.Web.UI.BaseAjaxControl); if (typeof (Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();