From 9fee2935d91e92235b068632d3608c748ef41bfe Mon Sep 17 00:00:00 2001 From: wei <> Date: Sun, 1 Oct 2006 10:37:06 +0000 Subject: fix image button, update functional test cases for opera --- framework/Web/Javascripts/js/compressed/ajax.js | 32 +++++++++++------------ framework/Web/Javascripts/js/debug/ajax.js | 34 ++++++++++++------------- framework/Web/Javascripts/js/debug/prado.js | 33 ------------------------ 3 files changed, 33 insertions(+), 66 deletions(-) (limited to 'framework/Web/Javascripts/js') diff --git a/framework/Web/Javascripts/js/compressed/ajax.js b/framework/Web/Javascripts/js/compressed/ajax.js index e620399f..4c3a8146 100644 --- a/framework/Web/Javascripts/js/compressed/ajax.js +++ b/framework/Web/Javascripts/js/compressed/ajax.js @@ -211,28 +211,28 @@ if(this.saving)return;this.effect=new Effect.Highlight(this.element,{startcolor: this.editing=false;this.saving=false;this.oldInnerHTML=null;this.onLeaveEditMode();},onComplete:function(transport){this.leaveEditMode();this.options.onComplete.bind(this)(transport,this.element);},onEnterEditMode:function(){},onLeaveEditMode:function(){},dispose:function(){if(this.oldInnerHTML){this.element.innerHTML=this.oldInnerHTML;} this.leaveEditMode();Event.stopObserving(this.element,'click',this.onclickListener);Event.stopObserving(this.element,'mouseover',this.mouseoverListener);Event.stopObserving(this.element,'mouseout',this.mouseoutListener);if(this.options.externalControl){Event.stopObserving(this.options.externalControl,'click',this.onclickListener);Event.stopObserving(this.options.externalControl,'mouseover',this.mouseoverListener);Event.stopObserving(this.options.externalControl,'mouseout',this.mouseoutListener);}}};Ajax.InPlaceCollectionEditor=Class.create();Object.extend(Ajax.InPlaceCollectionEditor.prototype,Ajax.InPlaceEditor.prototype);Object.extend(Ajax.InPlaceCollectionEditor.prototype,{createEditField:function(){if(!this.cached_selectTag){var selectTag=document.createElement("select");var collection=this.options.collection||[];var optionTag;collection.each(function(e,i){optionTag=document.createElement("option");optionTag.value=(e instanceof Array)?e[0]:e;if(this.options.value==optionTag.value)optionTag.selected=true;optionTag.appendChild(document.createTextNode((e instanceof Array)?e[1]:e));selectTag.appendChild(optionTag);}.bind(this));this.cached_selectTag=selectTag;} this.editField=this.cached_selectTag;if(this.options.loadTextURL)this.loadExternalText();this.form.appendChild(this.editField);this.options.callback=function(form,value){return"value="+encodeURIComponent(value);}}});Form.Element.DelayedObserver=Class.create();Form.Element.DelayedObserver.prototype={initialize:function(element,delay,callback){this.delay=delay||0.5;this.element=$(element);this.callback=callback;this.timer=null;this.lastValue=$F(this.element);Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));},delayedListener:function(event){if(this.lastValue==$F(this.element))return;if(this.timer)clearTimeout(this.timer);this.timer=setTimeout(this.onTimerEvent.bind(this),this.delay*1000);this.lastValue=$F(this.element);},onTimerEvent:function(){this.timer=null;this.callback(this.element,$F(this.element));}};Prado.WebUI.CallbackControl=Class.extend(Prado.WebUI.PostBackControl,{onPostBack:function(event,options) -{request=new Prado.CallbackRequest(options.EventTarget,options);request.dispatch();Event.stop(event);}});Prado.WebUI.TActiveButton=Class.extend(Prado.WebUI.CallbackControl);Prado.WebUI.TActiveLinkButton=Class.extend(Prado.WebUI.CallbackControl);Prado.WebUI.TActiveImageButton=Class.extend(Prado.WebUI.TImageButton,{onPostBack:function(event,options) -{this.addXYInput(event,options);request=new Prado.CallbackRequest(options.EventTarget,options);request.dispatch();Event.stop(event);}});Prado.WebUI.TActiveCheckBox=Class.extend(Prado.WebUI.CallbackControl,{onPostBack:function(event,options) -{request=new Prado.CallbackRequest(options.EventTarget,options);if(request.dispatch()==false) +{var request=new Prado.CallbackRequest(options.EventTarget,options);request.dispatch();Event.stop(event);}});Prado.WebUI.TActiveButton=Class.extend(Prado.WebUI.CallbackControl);Prado.WebUI.TActiveLinkButton=Class.extend(Prado.WebUI.CallbackControl);Prado.WebUI.TActiveImageButton=Class.extend(Prado.WebUI.TImageButton,{onPostBack:function(event,options) +{this.addXYInput(event,options);var request=new Prado.CallbackRequest(options.EventTarget,options);request.dispatch();Event.stop(event);}});Prado.WebUI.TActiveCheckBox=Class.extend(Prado.WebUI.CallbackControl,{onPostBack:function(event,options) +{var request=new Prado.CallbackRequest(options.EventTarget,options);if(request.dispatch()==false) Event.stop(event);}});Prado.WebUI.TActiveRadioButton=Class.extend(Prado.WebUI.TActiveCheckBox);Prado.WebUI.TActiveCheckBoxList=Base.extend({constructor:function(options) {for(var i=0;i0) +{var options=new Array(this.getToken(),"__TAutoComplete_onSuggest__");Prado.Callback(this.options.EventTarget,options,null,this.options);},onComplete:function(request,boundary) +{var result=Prado.Element.extractContent(request.transport.responseText,boundary);if(typeof(result)=="string"&&result.length>0) this.updateChoices(result);}});Prado.WebUI.TTimeTriggeredCallback=Base.extend({count:0,timeout:0,constructor:function(options) {this.options=Object.extend({Interval:1,DecayRate:0},options||{}) this.onComplete=this.options.onComplete;Prado.WebUI.TTimeTriggeredCallback.register(this);},startTimer:function() {this.options.onComplete=this.onRequestComplete.bind(this);this.timer=setTimeout(this.onTimerEvent.bind(this),200);},stopTimer:function() {(this.onComplete||Prototype.emptyFunction).apply(this,arguments);this.options.onComplete=undefined;clearTimeout(this.timer);this.timer=undefined;this.count=0;},onTimerEvent:function() -{this.options.params=this.timeout/1000;request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.dispatch();},onRequestComplete:function() +{this.options.params=this.timeout/1000;var request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.dispatch();},onRequestComplete:function() {(this.onComplete||Prototype.emptyFunction).apply(this,arguments);this.timer=setTimeout(this.onTimerEvent.bind(this),this.getNewTimeout())},getNewTimeout:function() {switch(this.options.DecayType) {case'Exponential':t=(Math.exp(this.options.DecayRate*this.count*this.options.Interval))-1;break;case'Linear':t=this.options.DecayRate*this.count*this.options.Interval;break;case'Quadratic':t=this.options.DecayRate*this.count*this.count*this.options.Interval;break;case'Cubic':t=this.options.DecayRate*this.count*this.count*this.count*this.options.Interval;break;default:t=0;} @@ -241,25 +241,25 @@ this.timeout=(t+this.options.Interval)*1000;this.count++;return parseInt(this.ti {Prado.WebUI.TTimeTriggeredCallback.timers[id].startTimer();},stop:function(id) {Prado.WebUI.TTimeTriggeredCallback.timers[id].stopTimer();}});Prado.WebUI.ActiveListControl=Base.extend({constructor:function(options) {this.element=$(options.ID);this.options=options;Event.observe(this.element,"change",this.doCallback.bind(this));},doCallback:function(event) -{request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.dispatch();Event.stop(event);}});Prado.WebUI.TActiveDropDownList=Prado.WebUI.ActiveListControl;Prado.WebUI.TActiveListBox=Prado.WebUI.ActiveListControl;Prado.WebUI.TEventTriggeredCallback=Base.extend({constructor:function(options) -{this.options=options;element=$(options['ControlID']);if(element) +{var request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.dispatch();Event.stop(event);}});Prado.WebUI.TActiveDropDownList=Prado.WebUI.ActiveListControl;Prado.WebUI.TActiveListBox=Prado.WebUI.ActiveListControl;Prado.WebUI.TEventTriggeredCallback=Base.extend({constructor:function(options) +{this.options=options;var element=$(options['ControlID']);if(element) Event.observe(element,this.getEventName(element),this.doCallback.bind(this));},getEventName:function(element) -{name=this.options.EventName;if(typeof(name)=="undefined"&&element.type) +{var name=this.options.EventName;if(typeof(name)=="undefined"&&element.type) {switch(element.type.toLowerCase()) {case'password':case'text':case'textarea':case'select-one':case'select-multiple':return'change';}} return typeof(name)=="undefined"||name=="undefined"?'click':name;},doCallback:function(event) -{request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.dispatch();if(this.options.StopEvent==true) +{var request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.dispatch();if(this.options.StopEvent==true) Event.stop(event);}});Prado.WebUI.TValueTriggeredCallback=Base.extend({count:1,observing:true,constructor:function(options) -{this.options=options;this.options.PropertyName=this.options.PropertyName||'value';element=$(options['ControlID']);this.value=element?element[this.options.PropertyName]:undefined;Prado.WebUI.TValueTriggeredCallback.register(this);this.startObserving();},stopObserving:function() +{this.options=options;this.options.PropertyName=this.options.PropertyName||'value';var element=$(options['ControlID']);this.value=element?element[this.options.PropertyName]:undefined;Prado.WebUI.TValueTriggeredCallback.register(this);this.startObserving();},stopObserving:function() {clearTimeout(this.timer);this.observing=false;},startObserving:function() {this.timer=setTimeout(this.checkChanges.bind(this),this.options.Interval*1000);},checkChanges:function() -{element=$(this.options.ControlID);if(element) -{value=element[this.options.PropertyName];if(this.value!=value) +{var element=$(this.options.ControlID);if(element) +{var value=element[this.options.PropertyName];if(this.value!=value) {this.doCallback(this.value,value);this.value=value;this.count=1;} else this.count=this.count+this.options.Decay;if(this.observing) this.time=setTimeout(this.checkChanges.bind(this),parseInt(this.options.Interval*1000*this.count));}},doCallback:function(oldValue,newValue) -{request=new Prado.CallbackRequest(this.options.EventTarget,this.options);param={'OldValue':oldValue,'NewValue':newValue};request.setCallbackParameter(param);request.dispatch();}},{timers:{},register:function(timer) +{var request=new Prado.CallbackRequest(this.options.EventTarget,this.options);var param={'OldValue':oldValue,'NewValue':newValue};request.setCallbackParameter(param);request.dispatch();}},{timers:{},register:function(timer) {Prado.WebUI.TValueTriggeredCallback.timers[timer.options.ID]=timer;},stop:function(id) {Prado.WebUI.TValueTriggeredCallback.timers[id].stopObserving();}});Prado.WebUI.TInPlaceTextBox=Base.extend({isSaving:false,isEditing:false,editField:null,constructor:function(options) {this.options=Object.extend({LoadTextFromSource:false,TextMode:'SingleLine'},options||{});this.element=$(this.options.ID);this.initializeListeners();},initializeListeners:function() diff --git a/framework/Web/Javascripts/js/debug/ajax.js b/framework/Web/Javascripts/js/debug/ajax.js index dc35043d..77df7bc2 100644 --- a/framework/Web/Javascripts/js/debug/ajax.js +++ b/framework/Web/Javascripts/js/debug/ajax.js @@ -2021,7 +2021,7 @@ Prado.WebUI.CallbackControl = Class.extend(Prado.WebUI.PostBackControl, { onPostBack : function(event, options) { - request = new Prado.CallbackRequest(options.EventTarget, options); + var request = new Prado.CallbackRequest(options.EventTarget, options); request.dispatch(); Event.stop(event); } @@ -2041,7 +2041,7 @@ Prado.WebUI.TActiveImageButton = Class.extend(Prado.WebUI.TImageButton, onPostBack : function(event, options) { this.addXYInput(event,options); - request = new Prado.CallbackRequest(options.EventTarget, options); + var request = new Prado.CallbackRequest(options.EventTarget, options); request.dispatch(); Event.stop(event); } @@ -2053,7 +2053,7 @@ Prado.WebUI.TActiveCheckBox = Class.extend(Prado.WebUI.CallbackControl, { onPostBack : function(event, options) { - request = new Prado.CallbackRequest(options.EventTarget, options); + var request = new Prado.CallbackRequest(options.EventTarget, options); if(request.dispatch()==false) Event.stop(event); } @@ -2097,7 +2097,7 @@ Prado.WebUI.TActiveTextBox = Class.extend(Prado.WebUI.TTextBox, doCallback : function(event, options) { - request = new Prado.CallbackRequest(options.EventTarget, options); + var request = new Prado.CallbackRequest(options.EventTarget, options); request.dispatch(); Event.stop(event); } @@ -2126,7 +2126,7 @@ Prado.WebUI.TAutoComplete = Class.extend(Prado.WebUI.TAutoComplete, { if(!this.active) { - request = new Prado.CallbackRequest(this.options.EventTarget, options); + var request = new Prado.CallbackRequest(this.options.EventTarget, options); request.dispatch(); Event.stop(event); } @@ -2144,13 +2144,13 @@ Prado.WebUI.TAutoComplete = Class.extend(Prado.WebUI.TAutoComplete, getUpdatedChoices : function() { - options = new Array(this.getToken(),"__TAutoComplete_onSuggest__"); + var options = new Array(this.getToken(),"__TAutoComplete_onSuggest__"); Prado.Callback(this.options.EventTarget, options, null, this.options); }, onComplete : function(request, boundary) { - result = Prado.Element.extractContent(request.transport.responseText, boundary); + var result = Prado.Element.extractContent(request.transport.responseText, boundary); if(typeof(result) == "string" && result.length > 0) this.updateChoices(result); } @@ -2194,7 +2194,7 @@ Prado.WebUI.TTimeTriggeredCallback = Base.extend( onTimerEvent : function() { this.options.params = this.timeout/1000; - request = new Prado.CallbackRequest(this.options.EventTarget, this.options); + var request = new Prado.CallbackRequest(this.options.EventTarget, this.options); request.dispatch(); }, @@ -2258,7 +2258,7 @@ Prado.WebUI.ActiveListControl = Base.extend( doCallback : function(event) { - request = new Prado.CallbackRequest(this.options.EventTarget, this.options); + var request = new Prado.CallbackRequest(this.options.EventTarget, this.options); request.dispatch(); Event.stop(event); } @@ -2275,14 +2275,14 @@ Prado.WebUI.TEventTriggeredCallback = Base.extend( constructor : function(options) { this.options = options; - element = $(options['ControlID']); + var element = $(options['ControlID']); if(element) Event.observe(element, this.getEventName(element), this.doCallback.bind(this)); }, getEventName : function(element) { - name = this.options.EventName; + var name = this.options.EventName; if(typeof(name) == "undefined" && element.type) { switch (element.type.toLowerCase()) @@ -2300,7 +2300,7 @@ Prado.WebUI.TEventTriggeredCallback = Base.extend( doCallback : function(event) { - request = new Prado.CallbackRequest(this.options.EventTarget, this.options); + var request = new Prado.CallbackRequest(this.options.EventTarget, this.options); request.dispatch(); if(this.options.StopEvent == true) Event.stop(event); @@ -2320,7 +2320,7 @@ Prado.WebUI.TValueTriggeredCallback = Base.extend( { this.options = options; this.options.PropertyName = this.options.PropertyName || 'value'; - element = $(options['ControlID']); + var element = $(options['ControlID']); this.value = element ? element[this.options.PropertyName] : undefined; Prado.WebUI.TValueTriggeredCallback.register(this); this.startObserving(); @@ -2339,10 +2339,10 @@ Prado.WebUI.TValueTriggeredCallback = Base.extend( checkChanges : function() { - element = $(this.options.ControlID); + var element = $(this.options.ControlID); if(element) { - value = element[this.options.PropertyName]; + var value = element[this.options.PropertyName]; if(this.value != value) { this.doCallback(this.value, value); @@ -2359,8 +2359,8 @@ Prado.WebUI.TValueTriggeredCallback = Base.extend( doCallback : function(oldValue, newValue) { - request = new Prado.CallbackRequest(this.options.EventTarget, this.options); - param = {'OldValue' : oldValue, 'NewValue' : newValue}; + var request = new Prado.CallbackRequest(this.options.EventTarget, this.options); + var param = {'OldValue' : oldValue, 'NewValue' : newValue}; request.setCallbackParameter(param); request.dispatch(); } diff --git a/framework/Web/Javascripts/js/debug/prado.js b/framework/Web/Javascripts/js/debug/prado.js index a455a0dd..920c2150 100644 --- a/framework/Web/Javascripts/js/debug/prado.js +++ b/framework/Web/Javascripts/js/debug/prado.js @@ -3252,39 +3252,6 @@ Prado.Element.Insert = Prado.WebUI = Class.create(); -//base postback-able controls -/*Prado.WebUI.PostBackControl = Class.create(); -Prado.WebUI.PostBackControl.prototype = -{ - initialize : function(options) - { - this.element = $(options['ID']); - -/* if(options.CausesValidation && typeof(Prado.Validation) != 'undefined') - { - Prado.Validation.registerTarget(options); - } - - //TODO: what do the following options do? - //options['PostBackUrl'] - //options['ClientSubmit'] - - if(this.onInit) - this.onInit(options); - } -}; - -//short cut to create postback components -Prado.WebUI.createPostBackComponent = function(definition) -{ - var component = Class.create(); - Object.extend(component.prototype, Prado.WebUI.PostBackControl.prototype); - if(definition) Object.extend(component.prototype, definition); - return component; -} - -Prado.WebUI.TButton = Prado.WebUI.createPostBackComponent(); -*/ Prado.WebUI.PostBackControl = Class.create(); Prado.WebUI.PostBackControl.prototype = -- cgit v1.2.3