From 36f2ce766bde98c11d57b889fd9e1a7f8dff6010 Mon Sep 17 00:00:00 2001 From: wei <> Date: Sun, 1 Oct 2006 03:09:18 +0000 Subject: Fixed #350 and #148, Add TActiveRatingList, should remove TRatingList from WebControls. --- framework/Web/Javascripts/extended/event.js | 49 +++---- framework/Web/Javascripts/js/compressed/ajax.js | 45 ++++-- framework/Web/Javascripts/js/compressed/prado.js | 29 ++-- framework/Web/Javascripts/js/debug/ajax.js | 157 +++++++++++++++++++-- framework/Web/Javascripts/js/debug/prado.js | 136 +++++++----------- framework/Web/Javascripts/prado/activecontrols3.js | 31 ++-- framework/Web/Javascripts/prado/controls.js | 35 ++++- framework/Web/Javascripts/ratings/blocks.css | 24 +++- framework/Web/Javascripts/ratings/blocks.png | Bin 29885 -> 28159 bytes framework/Web/Javascripts/ratings/blocks_blank.gif | Bin 72 -> 0 bytes framework/Web/Javascripts/ratings/blocks_blank.png | Bin 0 -> 227 bytes .../Web/Javascripts/ratings/blocks_combined.png | Bin 0 -> 453 bytes framework/Web/Javascripts/ratings/blocks_half.gif | Bin 94 -> 0 bytes framework/Web/Javascripts/ratings/blocks_half.png | Bin 0 -> 247 bytes framework/Web/Javascripts/ratings/blocks_hover.gif | Bin 75 -> 0 bytes .../Web/Javascripts/ratings/blocks_selected.gif | Bin 75 -> 0 bytes .../Web/Javascripts/ratings/blocks_selected.png | Bin 0 -> 245 bytes framework/Web/Javascripts/ratings/default.css | 22 ++- framework/Web/Javascripts/ratings/default.png | Bin 0 -> 64293 bytes .../Web/Javascripts/ratings/default_blank.gif | Bin 271 -> 0 bytes .../Web/Javascripts/ratings/default_blank.png | Bin 0 -> 841 bytes .../Web/Javascripts/ratings/default_combined.png | Bin 0 -> 2672 bytes framework/Web/Javascripts/ratings/default_half.gif | Bin 619 -> 0 bytes framework/Web/Javascripts/ratings/default_half.png | Bin 0 -> 857 bytes .../Web/Javascripts/ratings/default_hover.gif | Bin 618 -> 0 bytes .../Web/Javascripts/ratings/default_selected.gif | Bin 614 -> 0 bytes .../Web/Javascripts/ratings/default_selected.png | Bin 0 -> 831 bytes framework/Web/Javascripts/ratings/ratings.js | 119 ++++++++++++---- framework/Web/Javascripts/ratings/stars1.png | Bin 53016 -> 0 bytes 29 files changed, 454 insertions(+), 193 deletions(-) delete mode 100644 framework/Web/Javascripts/ratings/blocks_blank.gif create mode 100644 framework/Web/Javascripts/ratings/blocks_blank.png create mode 100644 framework/Web/Javascripts/ratings/blocks_combined.png delete mode 100644 framework/Web/Javascripts/ratings/blocks_half.gif create mode 100644 framework/Web/Javascripts/ratings/blocks_half.png delete mode 100644 framework/Web/Javascripts/ratings/blocks_hover.gif delete mode 100644 framework/Web/Javascripts/ratings/blocks_selected.gif create mode 100644 framework/Web/Javascripts/ratings/blocks_selected.png create mode 100644 framework/Web/Javascripts/ratings/default.png delete mode 100644 framework/Web/Javascripts/ratings/default_blank.gif create mode 100644 framework/Web/Javascripts/ratings/default_blank.png create mode 100644 framework/Web/Javascripts/ratings/default_combined.png delete mode 100644 framework/Web/Javascripts/ratings/default_half.gif create mode 100644 framework/Web/Javascripts/ratings/default_half.png delete mode 100644 framework/Web/Javascripts/ratings/default_hover.gif delete mode 100644 framework/Web/Javascripts/ratings/default_selected.gif create mode 100644 framework/Web/Javascripts/ratings/default_selected.png delete mode 100644 framework/Web/Javascripts/ratings/stars1.png (limited to 'framework/Web/Javascripts') diff --git a/framework/Web/Javascripts/extended/event.js b/framework/Web/Javascripts/extended/event.js index e464fa94..e257931a 100644 --- a/framework/Web/Javascripts/extended/event.js +++ b/framework/Web/Javascripts/extended/event.js @@ -1,14 +1,14 @@ /** * @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. * * Event.OnLoad(function(){ alert("Page Loaded!"); }); @@ -16,18 +16,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) { @@ -36,64 +36,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 type on a DOM - * element. Only HTMLEvent and MouseEvent can be - * dispatched, keyboard events or UIEvent can not be dispatch + * Dispatch the DOM event of a given type on a DOM + * element. 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); 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-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;i0) 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-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 -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 * 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 type on a DOM - * element. Only HTMLEvent and MouseEvent can be - * dispatched, keyboard events or UIEvent can not be dispatch + * Dispatch the DOM event of a given type on a DOM + * element. 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 -1 ? - this.radios[index].value : this.options.caption; + for(var i = 0; i -1 ? - this.radios[index].value : this.options.caption; + 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