diff options
author | Fabio Bas <ctrlaltca@gmail.com> | 2014-01-05 22:42:37 +0100 |
---|---|---|
committer | Fabio Bas <ctrlaltca@gmail.com> | 2014-01-05 23:23:05 +0100 |
commit | 2a1b748241d09a600c8f4c3176059c87371f127b (patch) | |
tree | b5f176787c6a67aed9be656242ff8368cd6785e2 /framework/Web | |
parent | 4c4f1d563090c5e8805e52a39eade13cf63c4c5a (diff) |
Ensure script works in jQuery.noConflict() mode
Diffstat (limited to 'framework/Web')
12 files changed, 183 insertions, 181 deletions
diff --git a/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js b/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js index 71c9d73c..b471a300 100644 --- a/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js +++ b/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js @@ -108,9 +108,9 @@ Prado.WebUI.TJuiAutoComplete = jQuery.klass(Prado.WebUI.TActiveTextBox, }) jQuery('#'+options.ID).autocomplete(this.options) .data( "ui-autocomplete")._renderItem = function( ul, item ) { - return $( "<li>" ) + return jQuery( "<li>" ) .attr( "data-value", item.value ) - .append( $( "<a>" ).html( item.label ) ) + .append( jQuery( "<a>" ).html( item.label ) ) .appendTo( ul ); }; @@ -283,7 +283,7 @@ Prado.WebUI.TEventTriggeredCallback = jQuery.klass(Prado.WebUI.Control, onInit : function(options) { this.options = options || {} ; - var element = $('#'+options['ControlID']).get(0); + var element = jQuery('#'+options['ControlID']).get(0); if(element) this.observe(element, this.getEventName(element), this.doCallback.bind(this)); }, @@ -328,7 +328,7 @@ Prado.WebUI.TValueTriggeredCallback = jQuery.klass(Prado.WebUI.Control, { this.options = options || {} ; this.options.PropertyName = this.options.PropertyName || 'value'; - var element = $('#'+options['ControlID']).get(0); + var element = jQuery('#'+options['ControlID']).get(0); this.value = element ? element[this.options.PropertyName] : undefined; Prado.WebUI.TValueTriggeredCallback.register(this); this.startObserving(); @@ -347,7 +347,7 @@ Prado.WebUI.TValueTriggeredCallback = jQuery.klass(Prado.WebUI.Control, checkChanges : function() { - var element = $('#'+this.options.ControlID).get(0); + var element = jQuery('#'+this.options.ControlID).get(0); if(element) { var value = element[this.options.PropertyName]; @@ -401,7 +401,7 @@ Prado.WebUI.TActiveTableCell = jQuery.klass(Prado.WebUI.CallbackControl); Prado.WebUI.TActiveTableRow = jQuery.klass(Prado.WebUI.CallbackControl); Prado.WebUI.TActiveRatingList = jQuery.klass(Prado.WebUI.TRatingList, -{ +{ dispatchRequest : function(ev) { var requestOptions = jQuery.extend( @@ -413,5 +413,5 @@ Prado.WebUI.TActiveRatingList = jQuery.klass(Prado.WebUI.TRatingList, if(request.dispatch()==false) ev.preventDefault(); } - + }); diff --git a/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js b/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js index c0268077..dd0fc6f2 100755 --- a/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js +++ b/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js @@ -6,7 +6,7 @@ Prado.WebUI.TActiveDatePicker = jQuery.klass(Prado.WebUI.TDatePicker, onInit : function(options) { this.options = options || []; - this.control = $('#'+options.ID).get(0); + this.control = jQuery('#'+options.ID).get(0); this.dateSlot = new Array(42); this.weekSlot = new Array(6); this.minimalDaysInFirstWeek = 4; @@ -17,7 +17,7 @@ Prado.WebUI.TActiveDatePicker = jQuery.klass(Prado.WebUI.TDatePicker, //which element to trigger to show the calendar if(this.options.Trigger) { - this.trigger = $('#'+this.options.Trigger).get(0) ; + this.trigger = jQuery('#'+this.options.Trigger).get(0) ; var triggerEvent = this.options.TriggerEvent || "click"; } else @@ -25,7 +25,7 @@ Prado.WebUI.TActiveDatePicker = jQuery.klass(Prado.WebUI.TDatePicker, this.trigger = this.control; var triggerEvent = this.options.TriggerEvent || "focus"; } - + // Popup position if(this.options.PositionMode == 'Top') { @@ -36,12 +36,12 @@ Prado.WebUI.TActiveDatePicker = jQuery.klass(Prado.WebUI.TDatePicker, if (this.options.ShowCalendar) this.observe(this.trigger, triggerEvent, jQuery.proxy(this.show,this)); - - // Listen to change event + + // Listen to change event if(this.options.InputMode == "TextBox") { this.observe(this.control, "change", jQuery.proxy(this.onDateChanged,this)); - } + } else { var day = Prado.WebUI.TDatePicker.getDayListControl(this.control); @@ -50,11 +50,11 @@ Prado.WebUI.TActiveDatePicker = jQuery.klass(Prado.WebUI.TDatePicker, if (day) this.observe (day, "change", jQuery.proxy(this.onDateChanged,this)); if (month) this.observe (month, "change", jQuery.proxy(this.onDateChanged,this)); if (year) this.observe (year, "change", jQuery.proxy(this.onDateChanged,this)); - + } - }, - + }, + // Respond to change event on the textbox or dropdown list // This method raises OnDateChanged event on client side if it has been defined, // and raise the callback request @@ -64,7 +64,7 @@ Prado.WebUI.TActiveDatePicker = jQuery.klass(Prado.WebUI.TDatePicker, if (this.options.InputMode == "TextBox") { date=this.control.value; - } + } else { var day = Prado.WebUI.TDatePicker.getDayListControl(this.control); @@ -76,7 +76,7 @@ Prado.WebUI.TActiveDatePicker = jQuery.klass(Prado.WebUI.TDatePicker, date=new Date(year, month, day, 0,0,0).SimpleFormat(this.Format, this); } if (typeof(this.options.OnDateChanged) == "function") this.options.OnDateChanged(this, date); - + if(this.options['AutoPostBack']==true) { // Make callback request @@ -84,4 +84,4 @@ Prado.WebUI.TActiveDatePicker = jQuery.klass(Prado.WebUI.TDatePicker, request.dispatch(); } } -}); +}); diff --git a/framework/Web/Javascripts/source/prado/activecontrols/ajax3.js b/framework/Web/Javascripts/source/prado/activecontrols/ajax3.js index 0d306a89..597187bb 100644 --- a/framework/Web/Javascripts/source/prado/activecontrols/ajax3.js +++ b/framework/Web/Javascripts/source/prado/activecontrols/ajax3.js @@ -1,4 +1,4 @@ -Prado.CallbackRequestManager = +Prado.CallbackRequestManager = { /** * Callback request target POST field name. @@ -202,7 +202,7 @@ Prado.CallbackRequest = jQuery.klass(Prado.PostBack, if(this.options.onPreDispatch) this.options.onPreDispatch(this,null); - + // jQuery don't have all these states.. simulate them to avoid breaking old scripts if (this.options.onLoading) this.options.onLoading(this,null); @@ -352,7 +352,7 @@ Prado.CallbackRequest = jQuery.klass(Prado.PostBack, */ updatePageState : function(request, datain) { - var pagestate = $("#"+Prado.CallbackRequestManager.FIELD_CALLBACK_PAGESTATE); + var pagestate = jQuery("#"+Prado.CallbackRequestManager.FIELD_CALLBACK_PAGESTATE); var enabled = request.options.EnablePageStateUpdate; var aborted = false; //typeof(self.currentRequest) == 'undefined' || self.currentRequest == null; if(enabled && !aborted && pagestate) @@ -408,7 +408,7 @@ Prado.CallbackRequest = jQuery.klass(Prado.PostBack, }, /* - * Checks which assets are used by the response and ensures they're loaded + * Checks which assets are used by the response and ensures they're loaded */ loadAssets : function(request, datain, callback) { @@ -439,7 +439,7 @@ Prado.CallbackRequest = jQuery.klass(Prado.PostBack, }, /* - * Checks which scripts are used by the response and ensures they're loaded + * Checks which scripts are used by the response and ensures they're loaded */ loadScripts : function(request, datain, callback) { @@ -473,10 +473,10 @@ Prado.CallbackRequest = jQuery.klass(Prado.PostBack, { var url = this.ScriptsToLoad.shift(); var obj = this; if ( - Prado.ScriptManager.ensureAssetIsLoaded(url, - function() { - obj.loadNextScript(); - } + Prado.ScriptManager.ensureAssetIsLoaded(url, + function() { + obj.loadNextScript(); + } ) ) this.loadNextScript(); @@ -560,10 +560,10 @@ Prado.CallbackRequest = jQuery.klass(Prado.PostBack, { var url = this.StyleSheetsToLoad.shift(); var obj = this; if ( - Prado.StyleSheetManager.ensureAssetIsLoaded(url, - function() { - obj.loadNextStyleSheet(); - } + Prado.StyleSheetManager.ensureAssetIsLoaded(url, + function() { + obj.loadNextStyleSheet(); + } ) ) this.loadNextStyleSheet(); @@ -591,8 +591,10 @@ Prado.CallbackRequest = jQuery.klass(Prado.PostBack, if(typeof(Logger) != "undefined") Logger.warn("Invalid action:"+data); } else { - for(var key in json) - this.__run(this, json[key]); + var that = this; + jQuery.each(json, function(idx, item){ + that.__run(that, item); + }); } } }, @@ -659,7 +661,7 @@ jQuery(function() // /** // * Prado Callback client-side request handler. // */ -// Prado.CallbackRequestManager = +// Prado.CallbackRequestManager = // { // requestQueue : [], @@ -795,11 +797,11 @@ jQuery(function() // this.Enabled = true; // this.id = id; // this.randomId = this.randomString(); - + // if(typeof(id)=="string"){ // Prado.CallbackRequestManager.requests[id+"__"+this.randomId] = this; // } - + // Prado.CallbackRequestManager.requests[id+"__"+this.randomId].ActiveControl = this.options; // }, @@ -864,7 +866,7 @@ if (typeof(Prado.AssetManagerClass)=="undefined") { discoverLoadedAssets: function() { // wait until document has finished loading to avoid javascript errors - if (!document.body) return; + if (!document.body) return; var assets = this.findAssetUrlsInMarkup(); for(var i=0;i<assets.length;i++) @@ -873,11 +875,11 @@ if (typeof(Prado.AssetManagerClass)=="undefined") { /** * Extend url to a fully qualified url. - * @param string url + * @param string url */ makeFullUrl: function(url) { - // this is not intended to be a fully blown url "canonicalizator", + // this is not intended to be a fully blown url "canonicalizator", // just to handle the most common and basic asset paths used by Prado if (!this.baseUri) this.baseUri = window.location; @@ -906,7 +908,7 @@ if (typeof(Prado.AssetManagerClass)=="undefined") { /** * Mark asset as being already loaded - * @param string url of the asset + * @param string url of the asset */ markAssetAsLoaded: function(url) { url = this.makeFullUrl(url); @@ -987,7 +989,7 @@ Prado.ScriptManagerClass = jQuery.klass(Prado.AssetManagerClass, { var urls = new Array(); var scripts = document.getElementsByTagName('script'); for(var i=0;i<scripts.length;i++) - { + { var e = scripts[i]; var src = e.src; if (src!="") urls.push(src); @@ -1011,7 +1013,7 @@ Prado.StyleSheetManagerClass = jQuery.klass(Prado.AssetManagerClass, { var urls = new Array(); var scripts = document.getElementsByTagName('link'); for(var i=0;i<scripts.length;i++) - { + { var e = scripts[i]; var href = e.href; if ((e.rel=="stylesheet") && (href.length>0)) urls.push(href); diff --git a/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js b/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js index 29c9e3d4..15998278 100755 --- a/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js +++ b/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js @@ -4,21 +4,21 @@ Prado.WebUI.TActiveFileUpload = jQuery.klass(Prado.WebUI.Control, { this.options = options || {}; Prado.WebUI.TActiveFileUpload.register(this); - - this.input = $('#'+options.inputID).get(0); - this.flag = $('#'+options.flagID).get(0); - this.form = $('#'+options.formID).get(0); - - this.indicator = $('#'+options.indicatorID).get(0); - this.complete = $('#'+options.completeID).get(0); - this.error = $('#'+options.errorID).get(0); - + + this.input = jQuery('#'+options.inputID).get(0); + this.flag = jQuery('#'+options.flagID).get(0); + this.form = jQuery('#'+options.formID).get(0); + + this.indicator = jQuery('#'+options.indicatorID).get(0); + this.complete = jQuery('#'+options.completeID).get(0); + this.error = jQuery('#'+options.errorID).get(0); + // set up events if (options.autoPostBack){ this.observe(this.input,"change",this.fileChanged.bind(this)); } }, - + fileChanged : function(){ // show the upload indicator, and hide the complete and error indicators (if they areSn't already). this.flag.value = '1'; @@ -43,7 +43,7 @@ Prado.WebUI.TActiveFileUpload = jQuery.klass(Prado.WebUI.Control, this.form.method = this.oldFormMethod; this.form.enctype = this.oldFormEnctype; }, - + finishUpload : function(options){ if (this.options.targetID == options.targetID) @@ -82,7 +82,7 @@ Prado.WebUI.TActiveFileUpload = jQuery.klass(Prado.WebUI.Control, }); -jQuery.extend(Prado.WebUI.TActiveFileUpload, +jQuery.extend(Prado.WebUI.TActiveFileUpload, { //class methods @@ -92,12 +92,12 @@ jQuery.extend(Prado.WebUI.TActiveFileUpload, { Prado.WebUI.TActiveFileUpload.controls[control.options.ID] = control; }, - + onFileUpload : function(options) { Prado.WebUI.TActiveFileUpload.controls[options.clientID].finishUpload(options); }, - + fileChanged : function(controlID){ Prado.WebUI.TActiveFileUpload.controls[controlID].fileChanged(); } diff --git a/framework/Web/Javascripts/source/prado/colorpicker/colorpicker.js b/framework/Web/Javascripts/source/prado/colorpicker/colorpicker.js index 54680922..9915eb81 100644 --- a/framework/Web/Javascripts/source/prado/colorpicker/colorpicker.js +++ b/framework/Web/Javascripts/source/prado/colorpicker/colorpicker.js @@ -93,7 +93,7 @@ Rico.Color.prototype = { toColorPart: function(number) { number = (number > 255 ? 255 : (number < 0 ? 0 : number)); var hex = number.toString(16); - return hex.length < 2 ? "0" + hex : hex; + return hex.length < 2 ? "0" + hex : hex; } }; @@ -265,13 +265,13 @@ Prado.WebUI.TColorPicker = jQuery.klass(Prado.WebUI.Control, { options = jQuery.extend(basics, options); this.options = options; - this.input = $('#'+options['ID']).get(0); - this.button = $('#'+options['ID']+'_button').get(0); + this.input = jQuery('#'+options['ID']).get(0); + this.button = jQuery('#'+options['ID']+'_button').get(0); this._buttonOnClick = jQuery.proxy(this.buttonOnClick, this); if(options['ShowColorPicker']) this.observe(this.button, "click", this._buttonOnClick); this.observe(this.input, "change", jQuery.proxy(this.updatePicker, this)); - + Prado.Registry[options.ID] = this; }, diff --git a/framework/Web/Javascripts/source/prado/controls/controls.js b/framework/Web/Javascripts/source/prado/controls/controls.js index 0f0b01f4..fa01e2e2 100644 --- a/framework/Web/Javascripts/source/prado/controls/controls.js +++ b/framework/Web/Javascripts/source/prado/controls/controls.js @@ -60,11 +60,11 @@ Prado.WebUI.Control = jQuery.klass({ // from the old wrapper to this new one (which then could live on, while the old // one could get destroyed), or to copy the new, changed options to the old wrapper, // (which could then left intact to keep working, while this new wrapper could be - // disposed of by exiting its initialization without installing any handlers or + // disposed of by exiting its initialization without installing any handlers or // leaving any references to it) // - // for now this method is simply deinitializing and deregistering the old wrapper, + // for now this method is simply deinitializing and deregistering the old wrapper, // and then registering the new wrapper for the control id if (oldwrapper.deinitialize) @@ -74,7 +74,7 @@ Prado.WebUI.Control = jQuery.klass({ }, /** - * Registers an event observer which will be automatically disposed of when the wrapper + * Registers an event observer which will be automatically disposed of when the wrapper * is deregistered * @param element DOM element reference or id to attach the event handler to * @param string event name to observe @@ -99,7 +99,7 @@ Prado.WebUI.Control = jQuery.klass({ var e = { _element: element, _eventName: eventName, _handler: handler }; var idx = -1; for(var i=0;i<this.observers.length;i++) - { + { var o = this.observers[i]; if ((o._element===element) && (o._eventName===eventName) && (o._handler===handler)) { @@ -109,7 +109,7 @@ Prado.WebUI.Control = jQuery.klass({ } return idx; }, - + /** * Degisters an event observer from the list of automatically disposed handlers @@ -133,11 +133,11 @@ Prado.WebUI.Control = jQuery.klass({ * wrapper hasn't been destroyed in the meantime * @param code function or code snippet to execute * @param int number of milliseconds to wait before executing - * @return int unique ID that can be used to cancel the scheduled execution + * @return int unique ID that can be used to cancel the scheduled execution */ setTimeout: function(func, delay) { - if (!jQuery.isFunction(func)) + if (!jQuery.isFunction(func)) { var expr = func; func = function() { return eval(expr); } @@ -209,11 +209,11 @@ Prado.WebUI.Control = jQuery.klass({ this.onDone(); // automatically stop all intervals - while (this.intervals.length>0) + while (this.intervals.length>0) window.clearInterval(this.intervals.pop()); // automatically deregister all installed observers - while (this.observers.length>0) + while (this.observers.length>0) { var e = this.observers.pop(); jQuery(e._element).unbind(e._eventName, e._handler); @@ -235,7 +235,7 @@ Prado.WebUI.PostBackControl = jQuery.klass(Prado.WebUI.Control, { { this._elementOnClick = null; - if (!this.element) + if (!this.element) debugger; // element not found else { @@ -284,7 +284,7 @@ Prado.WebUI.TImageMap = jQuery.klass(Prado.WebUI.PostBackControl); * TImageButton client-side behaviour. With validation, Firefox needs * to capture the x,y point of the clicked image in hidden form fields. */ -Prado.WebUI.TImageButton = jQuery.klass(Prado.WebUI.PostBackControl, +Prado.WebUI.TImageButton = jQuery.klass(Prado.WebUI.PostBackControl, { /** * Override parent onPostBack function, tried to add hidden forms @@ -351,7 +351,7 @@ Prado.WebUI.TRadioButton = jQuery.klass(Prado.WebUI.PostBackControl, { initialize : function($super, options) { - this.element = $("#" + options['ID']).get(0); + this.element = jQuery("#" + options['ID']).get(0); if(this.element) { if(!this.element.checked) @@ -386,14 +386,14 @@ Prado.WebUI.TTextBox = jQuery.klass(Prado.WebUI.PostBackControl, { if(this.options['AutoPostBack']==true) { - $(target).trigger( "change" ); + jQuery(target).trigger( "change" ); e.stopPropagation(); } else { if(this.options['CausesValidation'] && typeof(Prado.Validation) != "undefined") { - if(!Prado.Validation.validate(this.options['FormID'], this.options['ValidationGroup'], $(this.options['ID']))) + if(!Prado.Validation.validate(this.options['FormID'], this.options['ValidationGroup'], jQuery(this.options['ID']))) return e.stopPropagation(); } } @@ -432,10 +432,10 @@ Prado.WebUI.DefaultButton = jQuery.klass(Prado.WebUI.Control, var isTextArea = ev.target.tagName.toLowerCase() == "textarea"; var isHyperLink = ev.target.tagName.toLowerCase() == "a" && ev.target.hasAttribute("href"); var isValidButton = ev.target.tagName.toLowerCase() == "input" && ev.target.type.toLowerCase() == "submit"; - + if(enterPressed && !isTextArea && !isValidButton && !isHyperLink) { - var defaultButton = $('#'+this.options['Target']); + var defaultButton = jQuery('#'+this.options['Target']); if(defaultButton) { this.triggered = true; diff --git a/framework/Web/Javascripts/source/prado/controls/htmlarea.js b/framework/Web/Javascripts/source/prado/controls/htmlarea.js index 819e853c..7bf820ab 100644 --- a/framework/Web/Javascripts/source/prado/controls/htmlarea.js +++ b/framework/Web/Javascripts/source/prado/controls/htmlarea.js @@ -1,6 +1,6 @@ /* - * + * * HtmlArea (tinyMCE) wrapper * * @author Gabor Berczi <gabor.berczi@devworx.hu> @@ -24,7 +24,7 @@ Prado.WebUI.THtmlArea = jQuery.klass(Prado.WebUI.Control, this.registerInstance(); }, - + registerInstance: function() @@ -38,7 +38,7 @@ Prado.WebUI.THtmlArea = jQuery.klass(Prado.WebUI.Control, { // we're in a callback // try it again in some time, as tinyMCE is most likely still loading - this.setTimeout(this.registerInstance.bind(this), 50); + this.setTimeout(this.registerInstance.bind(this), 50); return; } throw "TinyMCE libraries must be loaded first"; @@ -62,7 +62,7 @@ Prado.WebUI.THtmlArea = jQuery.klass(Prado.WebUI.Control, } } }, - + compressedScriptsLoaded: function() { Prado.WebUI.THtmlArea.tinyMCELoadState = 255; @@ -119,14 +119,14 @@ Prado.WebUI.THtmlArea = jQuery.klass(Prado.WebUI.Control, if (prev) try { - tinyMCE.execCommand('mceFocus', false, this.ID); + tinyMCE.execCommand('mceFocus', false, this.ID); // when removed, tinyMCE restores its content to the textarea. If the textarea content has been // updated in this same callback, it will be overwritten with the old content. Workaround this. - var curtext = $('#'+this.ID).get(0).value; + var curtext = jQuery('#'+this.ID).get(0).value; tinyMCE.execCommand('mceRemoveControl', false, this.ID); - $('#'+this.ID).get(0).value = curtext; + jQuery('#'+this.ID).get(0).value = curtext; } - catch (e) + catch (e) { // suppress error here in case editor can't be properly removed // (happens when <textarea> has been removed from DOM tree without deinitialzing the tinyMCE editor first) @@ -139,7 +139,7 @@ Prado.WebUI.THtmlArea = jQuery.klass(Prado.WebUI.Control, } }); -jQuery.extend(Prado.WebUI.THtmlArea, +jQuery.extend(Prado.WebUI.THtmlArea, { pendingRegistrations : [], tinyMCELoadState : 0 diff --git a/framework/Web/Javascripts/source/prado/controls/htmlarea4.js b/framework/Web/Javascripts/source/prado/controls/htmlarea4.js index 418a6e19..64a78176 100644 --- a/framework/Web/Javascripts/source/prado/controls/htmlarea4.js +++ b/framework/Web/Javascripts/source/prado/controls/htmlarea4.js @@ -1,6 +1,6 @@ /* - * + * * HtmlArea (tinyMCE 4) wrapper * * @author Gabor Berczi <gabor.berczi@devworx.hu> @@ -39,14 +39,14 @@ Prado.WebUI.THtmlArea4 = jQuery.klass(Prado.WebUI.Control, if (prev) try { - tinyMCE.execCommand('mceFocus', false, this.ID); + tinyMCE.execCommand('mceFocus', false, this.ID); // when removed, tinyMCE restores its content to the textarea. If the textarea content has been // updated in this same callback, it will be overwritten with the old content. Workaround this. - // var curtext = $(this.ID).html(); + // var curtext = jQuery(this.ID).html(); tinyMCE.execCommand('mceRemoveControl', false, this.ID); - // $(this.ID).html(curtext); + // jQuery(this.ID).html(curtext); } - catch (e) + catch (e) { // suppress error here in case editor can't be properly removed // (happens when <textarea> has been removed from DOM tree without deinitialzing the tinyMCE editor first) diff --git a/framework/Web/Javascripts/source/prado/controls/slider.js b/framework/Web/Javascripts/source/prado/controls/slider.js index 28d7d4ac..e18fde84 100644 --- a/framework/Web/Javascripts/source/prado/controls/slider.js +++ b/framework/Web/Javascripts/source/prado/controls/slider.js @@ -9,33 +9,33 @@ Prado.WebUI.TSlider = jQuery.klass(Prado.WebUI.PostBackControl, { var slider = this; this.options=options || {}; - this.track = $('#'+options.ID+'_track').get(0); - this.handle =$('#'+options.ID+'_handle').get(0); - this.progress = $('#'+options.ID+'_progress').get(0); + this.track = jQuery('#'+options.ID+'_track').get(0); + this.handle =jQuery('#'+options.ID+'_handle').get(0); + this.progress = jQuery('#'+options.ID+'_progress').get(0); this.axis = this.options.axis || 'horizontal'; this.range = this.options.range || [0, 1]; this.value = 0; this.maximum = this.options.maximum || this.range[1]; this.minimum = this.options.minimum || this.range[0]; - this.hiddenField=$('#'+this.options.ID+'_1').get(0); - + this.hiddenField=jQuery('#'+this.options.ID+'_1').get(0); + // Will be used to align the handle onto the track, if necessary this.alignX = parseInt(this.options.alignX || - this.track.offsetLeft); this.alignY = parseInt(this.options.alignY || - this.track.offsetTop); - + this.trackLength = this.maximumOffset() - this.minimumOffset(); - this.handleLength = this.isVertical() ? - (this.handle.offsetHeight != 0 ? - this.handle.offsetHeight : this.handles.style.height.replace(/px$/,"")) : - (this.handle.offsetWidth != 0 ? this.handle.offsetWidth : + this.handleLength = this.isVertical() ? + (this.handle.offsetHeight != 0 ? + this.handle.offsetHeight : this.handles.style.height.replace(/px$/,"")) : + (this.handle.offsetWidth != 0 ? this.handle.offsetWidth : this.handle.style.width.replace(/px$/,"")); - + this.active = false; this.dragging = false; this.disabled = false; if(this.options.disabled) this.setDisabled(); - + // Allowed values array this.allowedValues = this.options.values ? this.options.values.sort() : false; if(this.allowedValues) { @@ -50,15 +50,15 @@ Prado.WebUI.TSlider = jQuery.klass(Prado.WebUI.PostBackControl, // Initialize handle this.setValue(parseFloat(slider.options.sliderValue)); this.observe (this.handle, "mousedown", this.eventMouseDown); - + this.observe (this.track, "mousedown", this.eventMouseDown); if (this.progress) this.observe (this.progress, "mousedown", this.eventMouseDown); - + this.observe (document, "mouseup", this.eventMouseUp); this.observe (document, "mousemove", this.eventMouseMove); - + this.initialized=true; - + if(this.options['AutoPostBack']==true) this.observe(this.hiddenField, "change", jQuery.proxy(this.doPostback,this,options)); }, @@ -67,20 +67,20 @@ Prado.WebUI.TSlider = jQuery.klass(Prado.WebUI.PostBackControl, { new Prado.PostBack(options, event); }, - + setDisabled: function(){ this.disabled = true; }, setEnabled: function(){ this.disabled = false; - }, + }, getNearestValue: function(value){ if(this.allowedValues){ var max = Math.max.apply( Math, this.allowedValues ); var min = Math.min.apply( Math, this.allowedValues ); if(value >= max) return(max); if(value <= min) return(min); - + var offset = Math.abs(this.allowedValues[0] - value); var newValue = this.allowedValues[0]; jQuery.each(this.allowedValues, function(idx, v) { @@ -88,7 +88,7 @@ Prado.WebUI.TSlider = jQuery.klass(Prado.WebUI.PostBackControl, if(currentOffset <= offset){ newValue = v; offset = currentOffset; - } + } }); return newValue; } @@ -96,7 +96,7 @@ Prado.WebUI.TSlider = jQuery.klass(Prado.WebUI.PostBackControl, if(value < this.range[0]) return this.range[0]; return value; }, - + setValue: function(sliderValue){ if(!this.active) { this.updateStyles(); @@ -106,47 +106,47 @@ Prado.WebUI.TSlider = jQuery.klass(Prado.WebUI.PostBackControl, this.handle.style[this.isVertical() ? 'top' : 'left'] = pixelValue; if (this.progress) this.progress.style[this.isVertical() ? 'height' : 'width'] = pixelValue; - + //this.drawSpans(); if(!this.dragging || !this.event) this.updateFinished(); }, - + setValueBy: function(delta) { this.setValue(this.value + delta); }, - + translateToPx: function(value) { return Math.round( ((this.trackLength-this.handleLength)/(this.range[1]-this.range[0])) * (value - this.range[0])) + "px"; }, - + translateToValue: function(offset) { return ((offset/(this.trackLength-this.handleLength) * (this.range[1]-this.range[0])) + this.range[0]); }, - + minimumOffset: function(){ return(this.isVertical() ? this.alignY : this.alignX); }, - + maximumOffset: function(){ - return(this.isVertical() ? + return(this.isVertical() ? (this.track.offsetHeight != 0 ? this.track.offsetHeight : - this.track.style.height.replace(/px$/,"")) - this.alignY : - (this.track.offsetWidth != 0 ? this.track.offsetWidth : + this.track.style.height.replace(/px$/,"")) - this.alignY : + (this.track.offsetWidth != 0 ? this.track.offsetWidth : this.track.style.width.replace(/px$/,"")) - this.alignX); }, - + isVertical: function(){ return (this.axis == 'vertical'); }, - + updateStyles: function() { - if (this.active) + if (this.active) jQuery(this.handle).addClass('selected'); else jQuery(this.handle).removeClass('selected'); }, - + startDrag: function(event) { if (event.which === 1) { // left click @@ -158,7 +158,7 @@ Prado.WebUI.TSlider = jQuery.klass(Prado.WebUI.PostBackControl, if(track==this.track) { var offsets = jQuery(this.track).offset(); this.event = event; - this.setValue(this.translateToValue( + this.setValue(this.translateToValue( (this.isVertical() ? pointer[1]-offsets['top'] : pointer[0]-offsets['left'])-(this.handleLength/2) )); var offsets = jQuery(this.handle).offset(); @@ -174,7 +174,7 @@ Prado.WebUI.TSlider = jQuery.klass(Prado.WebUI.PostBackControl, event.stopPropagation(); } }, - + update: function(event) { if(this.active) { if(!this.dragging) this.dragging = true; @@ -182,7 +182,7 @@ Prado.WebUI.TSlider = jQuery.klass(Prado.WebUI.PostBackControl, event.stopPropagation(); } }, - + draw: function(event) { var pointer = [event.pageX, event.pageY]; var offsets = jQuery(this.track).offset(); @@ -193,7 +193,7 @@ Prado.WebUI.TSlider = jQuery.klass(Prado.WebUI.PostBackControl, if(this.initialized && this.options.onSlide) this.options.onSlide(this.value, this); }, - + endDrag: function(event) { if(this.active && this.dragging) { this.finishDrag(event, true); @@ -201,18 +201,18 @@ Prado.WebUI.TSlider = jQuery.klass(Prado.WebUI.PostBackControl, } this.active = false; this.dragging = false; - }, - + }, + finishDrag: function(event, success) { this.active = false; this.dragging = false; this.updateFinished(); }, - + updateFinished: function() { this.hiddenField.value=this.value; this.updateStyles(); - if(this.initialized && this.options.onChange) + if(this.initialized && this.options.onChange) this.options.onChange(this.value, this); this.event = null; if (this.options['AutoPostBack']==true) diff --git a/framework/Web/Javascripts/source/prado/controls/tabpanel.js b/framework/Web/Javascripts/source/prado/controls/tabpanel.js index 78f6478c..866e45fb 100644 --- a/framework/Web/Javascripts/source/prado/controls/tabpanel.js +++ b/framework/Web/Javascripts/source/prado/controls/tabpanel.js @@ -4,7 +4,7 @@ Prado.WebUI.TTabPanel = jQuery.klass(Prado.WebUI.Control, { this.views = options.Views; this.viewsvis = options.ViewsVis; - this.hiddenField = $("#"+options.ID+'_1').get(0); + this.hiddenField = jQuery("#"+options.ID+'_1').get(0); this.activeCssClass = options.ActiveCssClass; this.normalCssClass = options.NormalCssClass; var length = options.Views.length; @@ -18,10 +18,10 @@ Prado.WebUI.TTabPanel = jQuery.klass(Prado.WebUI.Control, if (options.AutoSwitch) this.observe(element, "mouseenter", jQuery.proxy(this.elementClicked,this,item)); } - + if(element) { - var view = $("#"+options.Views[i]).get(0); + var view = jQuery("#"+options.Views[i]).get(0); if (view) if(this.hiddenField.value == i) { diff --git a/framework/Web/Javascripts/source/prado/datepicker/datepicker.js b/framework/Web/Javascripts/source/prado/datepicker/datepicker.js index bca801b9..012f2ef8 100644 --- a/framework/Web/Javascripts/source/prado/datepicker/datepicker.js +++ b/framework/Web/Javascripts/source/prado/datepicker/datepicker.js @@ -22,18 +22,18 @@ Prado.WebUI.TDatePicker = jQuery.klass(Prado.WebUI.Control, onInit : function(options) { this.options = options || []; - this.control = $('#'+options.ID).get(0); + this.control = jQuery('#'+options.ID).get(0); this.dateSlot = new Array(42); this.weekSlot = new Array(6); this.minimalDaysInFirstWeek = 4; this.positionMode = 'Bottom'; - + Prado.Registry[options.ID] = this; //which element to trigger to show the calendar if(this.options.Trigger) { - this.trigger = $('#'+this.options.Trigger).get(0); + this.trigger = jQuery('#'+this.options.Trigger).get(0); var triggerEvent = this.options.TriggerEvent || "click"; } else @@ -41,7 +41,7 @@ Prado.WebUI.TDatePicker = jQuery.klass(Prado.WebUI.Control, this.trigger = this.control; var triggerEvent = this.options.TriggerEvent || "focus"; } - + // Popup position if(this.options.PositionMode == 'Top') { @@ -51,16 +51,16 @@ Prado.WebUI.TDatePicker = jQuery.klass(Prado.WebUI.Control, jQuery.extend(this,options); // generate default date _after_ extending options this.selectedDate = this.newDate(); - + this.observe(this.trigger, triggerEvent, jQuery.proxy(this.show,this)); - + // Listen to change event if needed if (typeof(this.options.OnDateChanged) == "function") { if(this.options.InputMode == "TextBox") { this.observe(this.control, "change", jQuery.proxy(this.onDateChanged,this)); - } + } else { var day = Prado.WebUI.TDatePicker.getDayListControl(this.control); @@ -69,10 +69,10 @@ Prado.WebUI.TDatePicker = jQuery.klass(Prado.WebUI.Control, this.observe (day, "change", jQuery.proxy(this.onDateChanged,this)); this.observe (month, "change", jQuery.proxy(this.onDateChanged,this)); this.observe (year, "change", jQuery.proxy(this.onDateChanged,this)); - + } - - + + } }, @@ -407,7 +407,7 @@ Prado.WebUI.TDatePicker = jQuery.klass(Prado.WebUI.Control, if (this.options.InputMode == "TextBox") { date=this.control.value; - } + } else { var day = Prado.WebUI.TDatePicker.getDayListControl(this.control).selectedIndex+1; @@ -438,9 +438,9 @@ Prado.WebUI.TDatePicker = jQuery.klass(Prado.WebUI.Control, else jQuery(element).trigger("change"); }, - + onChange : function(ref, date, capevents) - { + { if(this.options.InputMode == "TextBox") { this.control.value = this.formatDate(); @@ -587,7 +587,7 @@ Prado.WebUI.TDatePicker = jQuery.klass(Prado.WebUI.Control, } this.observe(document,"keydown", this.documentKeyDownEvent); this.showing = true; - + if(this.positionMode=='Top') { this._calDiv.style.top = ((pos[1]-1) - this.getDatePickerOffsetHeight() - this._calDiv.offsetHeight) + 'px'; @@ -744,16 +744,16 @@ jQuery.extend(Prado.WebUI.TDatePicker, getYearListControl : function(control) { - return $('#'+control.id+"_year").get(0); + return jQuery('#'+control.id+"_year").get(0); }, getMonthListControl : function(control) { - return $('#'+control.id+"_month").get(0); + return jQuery('#'+control.id+"_month").get(0); }, getDayListControl : function(control) { - return $('#'+control.id+"_day").get(0); + return jQuery('#'+control.id+"_day").get(0); } });
\ No newline at end of file diff --git a/framework/Web/Javascripts/source/prado/prado.js b/framework/Web/Javascripts/source/prado/prado.js index 2e3ffbaa..1d69a034 100644 --- a/framework/Web/Javascripts/source/prado/prado.js +++ b/framework/Web/Javascripts/source/prado/prado.js @@ -1,11 +1,11 @@ /* * Low Pro JQ * ---------- - * + * * Author: Dan Webb (dan@danwebb.net) * GIT: github.com:danwrong/low-pro-for-jquery.git * Download: http://github.com/danwrong/low-pro-for-jquery/tree/master/src/lowpro.jquery.js?raw=true - * + * * A jQuery port of the Low Pro behavior framework that was originally written for Prototype. * * Prado actually uses it as a base to emulate OOP subclassing, inheritance and contructor events. @@ -185,9 +185,9 @@ Remote.Link = $.klass(Remote.Base, { onclick: function(e) { - var options = $.extend({ - url: $(this).attr('href'), - type: 'GET' + var options = $.extend({ + url: $(this).attr('href'), + type: 'GET' }, this.options); return e.data.behavior._makeRequest(e.data.behavior.options); } @@ -203,9 +203,9 @@ onsubmit: function(e) { var elm = $(this), data = elm.serializeArray(); - if (e.data.behavior._submitButton) data.push({ - name: e.data.behavior._submitButton.name, - value: e.data.behavior._submitButton.value + if (e.data.behavior._submitButton) data.push({ + name: e.data.behavior._submitButton.name, + value: e.data.behavior._submitButton.value }); var options = $.extend({ @@ -241,7 +241,7 @@ var Prado = * @var Version */ Version: '3.2.3', - + /** * Registry for Prado components * @var Registry @@ -249,7 +249,7 @@ var Prado = Registry: {}, }; -Prado.RequestManager = +Prado.RequestManager = { FIELD_POSTBACK_TARGET : 'PRADO_POSTBACK_TARGET', @@ -262,8 +262,8 @@ Prado.RequestManager = * @param event - Event that triggered this postback * @... {string} FormID - Form that should be posted back * @... {optional boolean} CausesValidation - Validate before PostBack if true - * @... {optional string} ValidationGroup - Group to Validate - * @... {optional string} ID - Validation ID + * @... {optional string} ValidationGroup - Group to Validate + * @... {optional string} ID - Validation ID * @... {optional string} PostBackUrl - Postback URL * @... {optional boolean} TrackFocus - Keep track of focused element if true * @... {string} EventTarget - Id of element that triggered PostBack @@ -289,7 +289,7 @@ Prado.PostBack = jQuery.klass( var form = this.getForm(); if(this.options['CausesValidation'] && typeof(Prado.Validation) != "undefined") { - if(!Prado.Validation.validate(this.options['FormID'], this.options['ValidationGroup'], $("#" + this.options['ID']))) + if(!Prado.Validation.validate(this.options['FormID'], this.options['ValidationGroup'], jQuery("#" + this.options['ID']))) return event.preventDefault(); } @@ -298,7 +298,7 @@ Prado.PostBack = jQuery.klass( if(this.options['TrackFocus']) { - var lastFocus = $('PRADO_LASTFOCUS'); + var lastFocus = jQuery('#PRADO_LASTFOCUS'); if(lastFocus) { var active = document.activeElement; //where did this come from @@ -356,7 +356,7 @@ Prado.Element = * @param {string} element - Element id * @param {string} method - Name of any {@link Prado.Element.Selection} method * @param {array|boolean|string} value - Values that should be selected - * @param {int} total - Number of elements + * @param {int} total - Number of elements */ select : function(element, method, value, total) { @@ -407,16 +407,16 @@ Prado.Element = offset : 50 }; jQuery.extend(op, options || {}); - $('html, body').animate({ - scrollTop: $("#"+element).offset().top - op.offset + jQuery('html, body').animate({ + scrollTop: jQuery("#"+element).offset().top - op.offset }, op.duration); }, /** - * Sets the options for a select element. + * Sets the options for a select element. * @function ? * @param {string} element - Element id - * @param {array[]} options - Array of options, each an array of structure + * @param {array[]} options - Array of options, each an array of structure * [ "optionText" , "optionValue" , "optionGroup" ] */ setOptions : function(element, options) @@ -436,9 +436,9 @@ Prado.Element = }, /** - * Create opt-group options from an array of options. + * Create opt-group options from an array of options. * @function {array} ? - * @param {array[]} options - Array of options, each an array of structure + * @param {array[]} options - Array of options, each an array of structure * [ "optionText" , "optionValue" , "optionGroup" ] * @returns Array of option DOM elements */ @@ -599,7 +599,7 @@ Prado.Element.Selection = /** * Set selected attribute for elements options by value. * If value is boolean, all elements options selected attribute will be set - * to value. Otherwhise all options that have the given value will be selected. + * to value. Otherwhise all options that have the given value will be selected. * @function ? * @param {element[]} elements - Array of selectable DOM elements * @param {boolean|string} value - Value of options that should be selected or boolean value of selection status @@ -735,7 +735,7 @@ Prado.Element.Selection = var el; for(var i = 0; i < total; i++) { - el = $("#"+element+"_c"+i).get(0); + el = jQuery("#"+element+"_c"+i).get(0); if(el) elements.push(el); } @@ -744,12 +744,12 @@ Prado.Element.Selection = /** * Set checked attribute of elements by value. - * If value is boolean, checked attribute will be set to value. - * Otherwhise all elements that have the given value will be checked. + * If value is boolean, checked attribute will be set to value. + * Otherwhise all elements that have the given value will be checked. * @function ? * @param {element[]} elements - Array of checkable DOM elements * @param {boolean|String} value - Value that should be checked or boolean value of checked status - * + * */ checkValue : function(elements, value) { @@ -767,7 +767,7 @@ Prado.Element.Selection = * @function ? * @param {element[]} elements - Array of checkable DOM elements * @param {string[]} values - Values that should be checked - * + * */ checkValues : function(elements, values) { @@ -928,7 +928,7 @@ jQuery.extend(String.prototype, { /** * Convert period separated function names into a function reference. * <br />Example: - * <pre> + * <pre> * "Prado.AJAX.Callback.Action.setValue".toFunction() * </pre> * @function {function} ? |