diff options
Diffstat (limited to 'framework/Web/Javascripts/js')
-rw-r--r-- | framework/Web/Javascripts/js/compressed/ajax.js | 45 | ||||
-rw-r--r-- | framework/Web/Javascripts/js/compressed/prado.js | 29 | ||||
-rw-r--r-- | framework/Web/Javascripts/js/debug/ajax.js | 157 | ||||
-rw-r--r-- | framework/Web/Javascripts/js/debug/prado.js | 136 |
4 files changed, 246 insertions, 121 deletions
diff --git a/framework/Web/Javascripts/js/compressed/ajax.js b/framework/Web/Javascripts/js/compressed/ajax.js index 79ef1848..e620399f 100644 --- a/framework/Web/Javascripts/js/compressed/ajax.js +++ b/framework/Web/Javascripts/js/compressed/ajax.js @@ -214,7 +214,9 @@ this.editField=this.cached_selectTag;if(this.options.loadTextURL)this.loadExtern {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) -Event.stop(event);}});Prado.WebUI.TActiveRadioButton=Class.extend(Prado.WebUI.TActiveCheckBox);Prado.WebUI.TActiveTextBox=Class.extend(Prado.WebUI.TTextBox,{onInit:function(options) +Event.stop(event);}});Prado.WebUI.TActiveRadioButton=Class.extend(Prado.WebUI.TActiveCheckBox);Prado.WebUI.TActiveCheckBoxList=Base.extend({constructor:function(options) +{for(var i=0;i<options.ItemCount;i++) +{var checkBoxOptions=Object.extend({ID:options.ListID+"_c"+i,EventTarget:options.ListName+"$c"+i},options);new Prado.WebUI.TActiveCheckBox(checkBoxOptions);}}});Prado.WebUI.TActiveRadioButtonList=Prado.WebUI.TActiveCheckBoxList;Prado.WebUI.TActiveTextBox=Class.extend(Prado.WebUI.TTextBox,{onInit:function(options) {if(options['TextMode']!='MultiLine') Event.observe(this.element,"keydown",this.handleReturnKey.bind(this));Event.observe(this.element,"change",this.doCallback.bindEvent(this,options));},doCallback:function(event,options) {request=new Prado.CallbackRequest(options.EventTarget,options);request.dispatch();Event.stop(event);}});Prado.WebUI.TAutoComplete=Class.extend(Autocompleter.Base,Prado.WebUI.TActiveTextBox.prototype);Prado.WebUI.TAutoComplete=Class.extend(Prado.WebUI.TAutoComplete,{initialize:function(options) @@ -228,18 +230,16 @@ this.onInit(options);},doCallback:function(event,options) 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);setTimeout(this.onTimerEvent.bind(this),200);},stopTimer: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.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;} this.timeout=(t+this.options.Interval)*1000;this.count++;return parseInt(this.timeout);}},{timers:{},register:function(timer) -{this.timers[timer.options.ID]=timer;},start:function(id) -{if(this.timers[id]) -this.timers[id].startTimer();},stop:function(id) -{if(this.timers[id]) -this.timers[id].stopTimer();}});Prado.WebUI.ActiveListControl=Base.extend({constructor:function(options) +{Prado.WebUI.TTimeTriggeredCallback.timers[timer.options.ID]=timer;},start:function(id) +{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) @@ -260,9 +260,8 @@ 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) -{this.timers[timer.options.ID]=timer;},stop:function(id) -{if(this.timers[id]) -this.timers[id].stopObserving();}});Prado.WebUI.TInPlaceTextBox=Base.extend({isSaving:false,isEditing:false,editField:null,constructor:function(options) +{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() {this.onclickListener=this.enterEditMode.bindAsEventListener(this);Event.observe(this.element,'click',this.onclickListener);if(this.options.ExternalControl) Event.observe($(this.options.ExternalControl),'click',this.onclickListener);},enterEditMode:function(evt) @@ -303,4 +302,28 @@ this.showLabel();}},onTextChanged:function(text) {this.isSaving=false;this.isEditing=false;this.showLabel();},onTextChangedSuccess:function(sender,parameter) {this.isSaving=false;this.isEditing=false;if(this.options.AutoHide) this.showLabel();this.element.innerHTML=parameter==null?this.editField.value:parameter;this.editField.disabled=false;},onTextChangedFailure:function(sender,parameter) -{this.editField.disabled=false;this.isSaving=false;this.isEditing=false;}});
\ No newline at end of file +{this.editField.disabled=false;this.isSaving=false;this.isEditing=false;}});Prado.WebUI.TRatingList=Base.extend({selectedIndex:-1,enabled:true,constructor:function(options) +{var cap=$(options.CaptionID);this.options=Object.extend({caption:cap?cap.innerHTML:''},options||{});Prado.WebUI.TRatingList.register(this);this._init();this.selectedIndex=options.SelectedIndex;this.setRating(this.selectedIndex);},_init:function(options) +{Element.addClassName($(this.options.ListID),this.options.Style);var radios=document.getElementsByName(this.options.ListName);this.radios=new Array();var index=0;for(var i=0;i<radios.length;i++) +{var node=radios[i].parentNode;if(node.tagName.toLowerCase()=='td') +{this.radios.push(radios[i]);Event.observe(node,"mouseover",this.hover.bindEvent(this,index));Event.observe(node,"mouseout",this.recover.bindEvent(this,index));Event.observe(node,"click",this.click.bindEvent(this,index));index++;Element.addClassName(node,"rating");}}},hover:function(ev,index) +{if(this.enabled==false)return;for(var i=0;i<this.radios.length;i++) +{var action=i<=index?'addClassName':'removeClassName' +Element[action](this.radios[i].parentNode,"rating_hover");} +this.setCaption(index);},recover:function(ev,index) +{if(this.enabled==false)return;for(var i=0;i<=index;i++) +Element.removeClassName(this.radios[i].parentNode,"rating_hover");this.setRating(this.selectedIndex);},click:function(ev,index) +{if(this.enabled==false)return;for(var i=0;i<this.radios.length;i++) +this.radios[i].checked=(i==index);this.selectedIndex=index;this.setRating(index);var requestOptions=Object.extend({ID:this.options.ListID+"_c"+index,EventTarget:this.options.ListName+"$c"+index},this.options);var request=new Prado.CallbackRequest(requestOptions.EventTarget,requestOptions);if(request.dispatch()==false) +Event.stop(ev);},setRating:function(index) +{for(var i=0;i<this.radios.length;i++) +{var action=i<=index?'addClassName':'removeClassName' +Element[action](this.radios[i].parentNode,"rating_selected");} +this.setCaption(index);},setCaption:function(index) +{var value=index>-1?this.radios[index].value:this.options.caption;var caption=$(this.options.CaptionID);if(caption)caption.innerHTML=value;$(this.options.ListName).title=value;},setEnabled:function(value) +{this.enabled=value;for(var i=0;i<this.radios.length;i++) +{var action=value?'removeClassName':'addClassName' +Element[action](this.radios[i].parentNode,"rating_disabled");Element.removeClassName(this.radios[i].parentNode,"rating_hover");}}},{ratings:{},register:function(rating) +{Prado.WebUI.TRatingList.ratings[rating.options.ListID]=rating;},setEnabled:function(id,value) +{Prado.WebUI.TRatingList.ratings[id].setEnabled(value);},setRating:function(id,value) +{Prado.WebUI.TRatingList.ratings[id].setRating(value);Prado.WebUI.TRatingList.ratings[id].selectedIndex=value;}});
\ No newline at end of file diff --git a/framework/Web/Javascripts/js/compressed/prado.js b/framework/Web/Javascripts/js/compressed/prado.js index 2f6f7eed..376e3a7b 100644 --- a/framework/Web/Javascripts/js/compressed/prado.js +++ b/framework/Web/Javascripts/js/compressed/prado.js @@ -131,16 +131,16 @@ Event.observe(window,'unload',Event.unloadCache,false);Object.extend(Event,{OnLo {var w=document.addEventListener&&!window.addEventListener?document:window;Event.observe(w,'load',fn);},keyCode:function(e) {return e.keyCode!=null?e.keyCode:e.charCode},isHTMLEvent:function(type) {var events=['abort','blur','change','error','focus','load','reset','resize','scroll','select','submit','unload'];return events.include(type);},isMouseEvent:function(type) -{var events=['click','mousedown','mousemove','mouseout','mouseover','mouseup'];return events.include(type);},fireEvent:function(element,type) -{element=$(element);if(type=="submit") +{var events=['click','mousedown','mousemove','mouseout','mouseover','mouseup'];return events.include(type);},fireEvent:function(element,type,canBubble) +{canBubble=(typeof(canBubble)==undefined)?true:canBubble;element=$(element);if(type=="submit") return element.submit();if(document.createEvent) {if(Event.isHTMLEvent(type)) -{var event=document.createEvent('HTMLEvents');event.initEvent(type,true,true);} +{var event=document.createEvent('HTMLEvents');event.initEvent(type,canBubble,true);} else if(Event.isMouseEvent(type)) {var event=document.createEvent('MouseEvents');if(event.initMouseEvent) -{event.initMouseEvent(type,true,true,document.defaultView,1,0,0,0,0,false,false,false,false,0,null);} +{event.initMouseEvent(type,canBubble,true,document.defaultView,1,0,0,0,0,false,false,false,false,0,null);} else -{event.initEvent(type,true,true);}} +{event.initEvent(type,canBubble,true);}} element.dispatchEvent(event);} else if(document.createEventObject) {var evObj=document.createEventObject();element.fireEvent('on'+type,evObj);} @@ -390,17 +390,8 @@ text+=node.nodeValue;} if(text.length>0) window.clipboardData.setData("Text",text);},hover:function(obj) {obj.parentNode.className="copycode copycode_hover";},out:function(obj) -{obj.parentNode.className="copycode";}});Prado.WebUI.TRatingList=Class.create();Prado.WebUI.TRatingList.prototype={selectedIndex:-1,initialize:function(options) -{this.options=options;this.element=$(options['ID']);Element.addClassName(this.element,options.cssClass);this.radios=document.getElementsByName(options.field);for(var i=0;i<this.radios.length;i++) -{Event.observe(this.radios[i].parentNode,"mouseover",this.hover.bindEvent(this,i));Event.observe(this.radios[i].parentNode,"mouseout",this.recover.bindEvent(this,i));Event.observe(this.radios[i].parentNode,"click",this.click.bindEvent(this,i));} -this.caption=CAPTION();this.element.appendChild(this.caption);this.selectedIndex=options.selectedIndex;this.setRating(this.selectedIndex);},hover:function(ev,index) -{for(var i=0;i<this.radios.length;i++) -this.radios[i].parentNode.className=(i<=index)?"rating_hover":"";this.setCaption(index);},recover:function(ev,index) -{for(var i=0;i<=index;i++) -Element.removeClassName(this.radios[i].parentNode,"rating_hover");this.setRating(this.selectedIndex);},click:function(ev,index) -{for(var i=0;i<this.radios.length;i++) -this.radios[i].checked=(i==index);this.selectedIndex=index;this.setRating(index);if(isFunction(this.options.onChange)) -this.options.onChange(this,index);},setRating:function(index) -{for(var i=0;i<=index;i++) -this.radios[i].parentNode.className="rating_selected";this.setCaption(index);},setCaption:function(index) -{this.caption.innerHTML=index>-1?this.radios[index].value:this.options.caption;}}
\ No newline at end of file +{obj.parentNode.className="copycode";}});Prado.WebUI.TCheckBoxList=Base.extend({constructor:function(options) +{for(var i=0;i<options.ItemCount;i++) +{var checkBoxOptions=Object.extend({ID:options.ListID+"_c"+i,EventTarget:options.ListName+"$c"+i},options);new Prado.WebUI.TCheckBox(checkBoxOptions);}}});Prado.WebUI.TRadioButtonList=Base.extend({constructor:function(options) +{for(var i=0;i<options.ItemCount;i++) +{var radioButtonOptions=Object.extend({ID:options.ListID+"_c"+i,EventTarget:options.ListName+"$c"+i},options);new Prado.WebUI.TRadioButton(radioButtonOptions);}}});
\ No newline at end of file diff --git a/framework/Web/Javascripts/js/debug/ajax.js b/framework/Web/Javascripts/js/debug/ajax.js index 5acdfb63..dc35043d 100644 --- a/framework/Web/Javascripts/js/debug/ajax.js +++ b/framework/Web/Javascripts/js/debug/ajax.js @@ -2065,6 +2065,24 @@ Prado.WebUI.TActiveCheckBox = Class.extend(Prado.WebUI.CallbackControl, Prado.WebUI.TActiveRadioButton = Class.extend(Prado.WebUI.TActiveCheckBox);
+Prado.WebUI.TActiveCheckBoxList = Base.extend(
+{
+ constructor : function(options)
+ {
+ for(var i = 0; i<options.ItemCount; i++)
+ {
+ var checkBoxOptions = Object.extend(
+ {
+ ID : options.ListID+"_c"+i,
+ EventTarget : options.ListName+"$c"+i
+ }, options);
+ new Prado.WebUI.TActiveCheckBox(checkBoxOptions);
+ }
+ }
+});
+
+Prado.WebUI.TActiveRadioButtonList = Prado.WebUI.TActiveCheckBoxList;
+
/**
* TActiveTextBox control, handles onchange event.
*/
@@ -2161,7 +2179,7 @@ Prado.WebUI.TTimeTriggeredCallback = Base.extend( startTimer : function()
{
this.options.onComplete = this.onRequestComplete.bind(this);
- setTimeout(this.onTimerEvent.bind(this), 200);
+ this.timer = setTimeout(this.onTimerEvent.bind(this), 200);
},
stopTimer : function()
@@ -2215,19 +2233,17 @@ Prado.WebUI.TTimeTriggeredCallback = Base.extend( register : function(timer)
{
- this.timers[timer.options.ID] = timer;
+ Prado.WebUI.TTimeTriggeredCallback.timers[timer.options.ID] = timer;
},
start : function(id)
{
- if(this.timers[id])
- this.timers[id].startTimer();
+ Prado.WebUI.TTimeTriggeredCallback.timers[id].startTimer();
},
stop : function(id)
{
- if(this.timers[id])
- this.timers[id].stopTimer();
+ Prado.WebUI.TTimeTriggeredCallback.timers[id].stopTimer();
}
});
@@ -2355,13 +2371,12 @@ Prado.WebUI.TValueTriggeredCallback = Base.extend( register : function(timer)
{
- this.timers[timer.options.ID] = timer;
+ Prado.WebUI.TValueTriggeredCallback.timers[timer.options.ID] = timer;
},
stop : function(id)
{
- if(this.timers[id])
- this.timers[id].stopObserving();
+ Prado.WebUI.TValueTriggeredCallback.timers[id].stopObserving();
}
});
@@ -2595,3 +2610,127 @@ Prado.WebUI.TInPlaceTextBox = Base.extend( }
}); +Prado.WebUI.TRatingList = Base.extend(
+{
+ selectedIndex : -1,
+ enabled : true,
+
+ constructor : function(options)
+ {
+ var cap = $(options.CaptionID);
+ this.options = Object.extend(
+ {
+ caption : cap ? cap.innerHTML : ''
+ }, options || {});
+
+ Prado.WebUI.TRatingList.register(this);
+ this._init();
+ this.selectedIndex = options.SelectedIndex;
+ this.setRating(this.selectedIndex);
+ },
+
+ _init: function(options)
+ {
+ Element.addClassName($(this.options.ListID),this.options.Style);
+ var radios = document.getElementsByName(this.options.ListName);
+ this.radios = new Array();
+ var index=0;
+ for(var i = 0; i<radios.length; i++)
+ {
+ var node = radios[i].parentNode;
+ if(node.tagName.toLowerCase()=='td')
+ {
+ this.radios.push(radios[i]);
+ Event.observe(node, "mouseover", this.hover.bindEvent(this,index));
+ Event.observe(node, "mouseout", this.recover.bindEvent(this,index));
+ Event.observe(node, "click", this.click.bindEvent(this, index));
+ index++;
+ Element.addClassName(node,"rating");
+ }
+ }
+ },
+
+ hover : function(ev,index)
+ {
+ if(this.enabled==false) return;
+ for(var i = 0; i<this.radios.length; i++)
+ {
+ var action = i <= index ? 'addClassName' : 'removeClassName'
+ Element[action](this.radios[i].parentNode,"rating_hover");
+ }
+ this.setCaption(index);
+ },
+
+ recover : function(ev,index)
+ {
+ if(this.enabled==false) return;
+ for(var i = 0; i<=index; i++)
+ Element.removeClassName(this.radios[i].parentNode, "rating_hover");
+ this.setRating(this.selectedIndex);
+ },
+
+ click : function(ev, index)
+ {
+ if(this.enabled==false) return;
+ for(var i = 0; i<this.radios.length; i++)
+ this.radios[i].checked = (i == index);
+ this.selectedIndex = index;
+ this.setRating(index);
+ var requestOptions = Object.extend(
+ {
+ ID : this.options.ListID+"_c"+index,
+ EventTarget : this.options.ListName+"$c"+index
+ },this.options);
+ var request = new Prado.CallbackRequest(requestOptions.EventTarget, requestOptions);
+ if(request.dispatch()==false)
+ Event.stop(ev);
+ },
+
+ setRating: function(index)
+ {
+ for(var i = 0; i<this.radios.length; i++)
+ {
+ var action = i <= index ? 'addClassName' : 'removeClassName'
+ Element[action](this.radios[i].parentNode, "rating_selected");
+ }
+ this.setCaption(index);
+ },
+
+ setCaption : function(index)
+ {
+ var value = index > -1 ? this.radios[index].value : this.options.caption;
+ var caption = $(this.options.CaptionID);
+ if(caption) caption.innerHTML = value;
+ $(this.options.ListName).title = value;
+ },
+
+ setEnabled : function(value)
+ {
+ this.enabled = value;
+ for(var i = 0; i<this.radios.length; i++)
+ {
+ var action = value ? 'removeClassName' : 'addClassName'
+ Element[action](this.radios[i].parentNode, "rating_disabled");
+ Element.removeClassName(this.radios[i].parentNode, "rating_hover");
+ }
+ }
+},
+{
+ratings : {},
+register : function(rating)
+{
+ Prado.WebUI.TRatingList.ratings[rating.options.ListID] = rating;
+},
+
+setEnabled : function(id,value)
+{
+ Prado.WebUI.TRatingList.ratings[id].setEnabled(value);
+},
+
+setRating : function(id,value)
+{
+ Prado.WebUI.TRatingList.ratings[id].setRating(value);
+ Prado.WebUI.TRatingList.ratings[id].selectedIndex = value;
+}
+}); + diff --git a/framework/Web/Javascripts/js/debug/prado.js b/framework/Web/Javascripts/js/debug/prado.js index 122a5640..a455a0dd 100644 --- a/framework/Web/Javascripts/js/debug/prado.js +++ b/framework/Web/Javascripts/js/debug/prado.js @@ -1924,14 +1924,14 @@ if (navigator.appVersion.match(/\bMSIE\b/)) /**
* @class Event extensions.
*/
-Object.extend(Event,
+Object.extend(Event,
{
/**
- * Register a function to be executed when the page is loaded.
- * Note that the page is only loaded if all resources (e.g. images)
+ * Register a function to be executed when the page is loaded.
+ * Note that the page is only loaded if all resources (e.g. images)
* are loaded.
- *
- * Example: Show an alert box with message "Page Loaded!" when the
+ *
+ * Example: Show an alert box with message "Page Loaded!" when the
* page finished loading.
* <code>
* Event.OnLoad(function(){ alert("Page Loaded!"); });
@@ -1939,18 +1939,18 @@ Object.extend(Event, *
* @param {Function} function to execute when page is loaded.
*/
- OnLoad : function (fn)
+ OnLoad : function (fn)
{
// opera onload is in document, not window
- var w = document.addEventListener &&
+ var w = document.addEventListener &&
!window.addEventListener ? document : window;
Event.observe(w,'load',fn);
},
/**
* @param {Event} a keyboard event
- * @return {Number} the Unicode character code generated by the key
- * that was struck.
+ * @return {Number} the Unicode character code generated by the key
+ * that was struck.
*/
keyCode : function(e)
{
@@ -1959,64 +1959,65 @@ Object.extend(Event, /**
* @param {String} event type or event name.
- * @return {Boolean} true if event type is of HTMLEvent, false
+ * @return {Boolean} true if event type is of HTMLEvent, false
* otherwise
*/
isHTMLEvent : function(type)
{
- var events = ['abort', 'blur', 'change', 'error', 'focus',
- 'load', 'reset', 'resize', 'scroll', 'select',
+ var events = ['abort', 'blur', 'change', 'error', 'focus',
+ 'load', 'reset', 'resize', 'scroll', 'select',
'submit', 'unload'];
return events.include(type);
},
/**
* @param {String} event type or event name
- * @return {Boolean} true if event type is of MouseEvent,
+ * @return {Boolean} true if event type is of MouseEvent,
* false otherwise
*/
isMouseEvent : function(type)
{
- var events = ['click', 'mousedown', 'mousemove', 'mouseout',
+ var events = ['click', 'mousedown', 'mousemove', 'mouseout',
'mouseover', 'mouseup'];
return events.include(type);
},
/**
- * Dispatch the DOM event of a given <tt>type</tt> on a DOM
- * <tt>element</tt>. Only HTMLEvent and MouseEvent can be
- * dispatched, keyboard events or UIEvent can not be dispatch
+ * Dispatch the DOM event of a given <tt>type</tt> on a DOM
+ * <tt>element</tt>. Only HTMLEvent and MouseEvent can be
+ * dispatched, keyboard events or UIEvent can not be dispatch
* via javascript consistently.
* For the "submit" event the submit() method is called.
* @param {Object} element id string or a DOM element.
* @param {String} event type to dispatch.
*/
- fireEvent : function(element,type)
+ fireEvent : function(element,type,canBubble)
{
+ canBubble = (typeof(canBubble) == undefined) ? true : canBubble;
element = $(element);
if(type == "submit")
return element.submit();
if(document.createEvent)
- {
+ {
if(Event.isHTMLEvent(type))
{
var event = document.createEvent('HTMLEvents');
- event.initEvent(type, true, true);
+ event.initEvent(type, canBubble, true);
}
else if(Event.isMouseEvent(type))
{
- var event = document.createEvent('MouseEvents');
+ var event = document.createEvent('MouseEvents');
if (event.initMouseEvent)
{
- event.initMouseEvent(type,true,true,
- document.defaultView, 1, 0, 0, 0, 0, false,
+ event.initMouseEvent(type,canBubble,true,
+ document.defaultView, 1, 0, 0, 0, 0, false,
false, false, false, 0, null);
}
else
{
// Safari
// TODO we should be initialising other mouse-event related attributes here
- event.initEvent(type, true, true);
+ event.initEvent(type, canBubble, true);
}
}
element.dispatchEvent(event);
@@ -3471,7 +3472,7 @@ Prado.WebUI.DefaultButton.prototype = if(defaultButton)
{
this.triggered = true;
- $('PRADO_POSTBACK_TARGET').value = this.options.EventTarget;
+ $('PRADO_POSTBACK_TARGET').value = this.options.EventTarget;
Event.fireEvent(defaultButton, this.options['Event']);
Event.stop(ev);
}
@@ -3525,66 +3526,37 @@ Object.extend(Prado.WebUI.TTextHighlighter, obj.parentNode.className = "copycode";
}
});
- - -Prado.WebUI.TRatingList = Class.create();
-Prado.WebUI.TRatingList.prototype =
-{
- selectedIndex : -1,
- initialize : function(options)
+
+Prado.WebUI.TCheckBoxList = Base.extend(
+{
+ constructor : function(options)
{
- this.options = options;
- this.element = $(options['ID']);
- Element.addClassName(this.element,options.cssClass);
- this.radios = document.getElementsByName(options.field);
- for(var i = 0; i<this.radios.length; i++)
+ for(var i = 0; i<options.ItemCount; i++)
{
- Event.observe(this.radios[i].parentNode, "mouseover", this.hover.bindEvent(this,i));
- Event.observe(this.radios[i].parentNode, "mouseout", this.recover.bindEvent(this,i));
- Event.observe(this.radios[i].parentNode, "click", this.click.bindEvent(this, i));
- }
- this.caption = CAPTION();
- this.element.appendChild(this.caption);
- this.selectedIndex = options.selectedIndex;
- this.setRating(this.selectedIndex);
- },
-
- hover : function(ev,index)
- {
- for(var i = 0; i<this.radios.length; i++)
- this.radios[i].parentNode.className = (i<=index) ? "rating_hover" : "";
- this.setCaption(index);
- },
-
- recover : function(ev,index)
- {
- for(var i = 0; i<=index; i++)
- Element.removeClassName(this.radios[i].parentNode, "rating_hover");
- this.setRating(this.selectedIndex);
- },
-
- click : function(ev, index)
- {
- for(var i = 0; i<this.radios.length; i++)
- this.radios[i].checked = (i == index);
- this.selectedIndex = index;
- this.setRating(index);
- if(isFunction(this.options.onChange))
- this.options.onChange(this,index);
- },
-
- setRating: function(index)
- {
- for(var i = 0; i<=index; i++)
- this.radios[i].parentNode.className = "rating_selected";
- this.setCaption(index);
- },
-
- setCaption : function(index)
+ var checkBoxOptions = Object.extend(
+ {
+ ID : options.ListID+"_c"+i,
+ EventTarget : options.ListName+"$c"+i
+ }, options);
+ new Prado.WebUI.TCheckBox(checkBoxOptions);
+ }
+ }
+});
+
+Prado.WebUI.TRadioButtonList = Base.extend(
+{
+ constructor : function(options)
{
- this.caption.innerHTML = index > -1 ?
- this.radios[index].value : this.options.caption;
+ for(var i = 0; i<options.ItemCount; i++)
+ {
+ var radioButtonOptions = Object.extend(
+ {
+ ID : options.ListID+"_c"+i,
+ EventTarget : options.ListName+"$c"+i
+ }, options);
+ new Prado.WebUI.TRadioButton(radioButtonOptions);
+ }
}
-} +}); |