diff options
59 files changed, 494 insertions, 193 deletions
diff --git a/.gitattributes b/.gitattributes index 5b131e88..072669b8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1769,16 +1769,16 @@ framework/Web/Javascripts/prototype/selector.js -text framework/Web/Javascripts/prototype/string.js -text framework/Web/Javascripts/ratings/blocks.css -text framework/Web/Javascripts/ratings/blocks.png -text -framework/Web/Javascripts/ratings/blocks_blank.png -text -framework/Web/Javascripts/ratings/blocks_combined.png -text -framework/Web/Javascripts/ratings/blocks_half.png -text -framework/Web/Javascripts/ratings/blocks_selected.png -text +framework/Web/Javascripts/ratings/blocks_blank.gif -text +framework/Web/Javascripts/ratings/blocks_combined.gif -text +framework/Web/Javascripts/ratings/blocks_half.gif -text +framework/Web/Javascripts/ratings/blocks_selected.gif -text framework/Web/Javascripts/ratings/default.css -text framework/Web/Javascripts/ratings/default.png -text -framework/Web/Javascripts/ratings/default_blank.png -text -framework/Web/Javascripts/ratings/default_combined.png -text -framework/Web/Javascripts/ratings/default_half.png -text -framework/Web/Javascripts/ratings/default_selected.png -text +framework/Web/Javascripts/ratings/default_blank.gif -text +framework/Web/Javascripts/ratings/default_combined.gif -text +framework/Web/Javascripts/ratings/default_half.gif -text +framework/Web/Javascripts/ratings/default_selected.gif -text framework/Web/Javascripts/ratings/ratings.js -text framework/Web/Javascripts/rico/colors.js -text framework/Web/Javascripts/rico/extension.js -text diff --git a/demos/quickstart/protected/pages/ActiveControls/ActiveButton.page b/demos/quickstart/protected/pages/ActiveControls/ActiveButton.page index 7bbe05ea..adf50d22 100644 --- a/demos/quickstart/protected/pages/ActiveControls/ActiveButton.page +++ b/demos/quickstart/protected/pages/ActiveControls/ActiveButton.page @@ -60,8 +60,7 @@ public function button_callback($sender, $param) <p>With in the <tt>ActiveControl</tt> property is an instance of
<a href="?page=ActiveControls.CallbackClientSide">TCallbackClientSide</a> available
-as a property <tt>ClientSide</tt> of <tt>ActiveControl</tt> or similarly
-as a sub-property <tt>ActiveControl.ClientSide</tt> of <tt>TActiveButton</tt>.
+as a property <tt>ClientSide</tt> of <tt>TActiveButton</tt>.
The <tt>ClientSide</tt> property contains sub-properties, such as <tt>RequestTimeOut</tt>,
and client-side javascript event handler, such as <tt>OnLoading</tt>,
that are used by the client-side when making a callback request.
@@ -77,7 +76,7 @@ when the client-side is making a callback request. Text="Click Me"
OnCallback="button_callback"
ActiveControl.CallbackParameter="value" >
- <prop:ActiveControl.ClientSide
+ <prop:ClientSide
OnLoading="Element.show('callback_status')"
OnComplete="Element.hide('callback_status')" />
</com:TActiveButton>
@@ -85,9 +84,9 @@ when the client-side is making a callback request. <p>The example loads the "effects" javascript library using the
<a href="?page=Controls.ClientScript">TClientScript</a> component.
-The <tt>ActiveControl.ClientSide.OnLoading</tt> property value contains
+The <tt>ClientSide.OnLoading</tt> property value contains
javascript statement that uses the "effects" library to show the "Loading..."
-span tag. Similarly, <tt>ActiveControl.ClientSide.OnComplete</tt> property
+span tag. Similarly, <tt>ClientSide.OnComplete</tt> property
value contains the javascript statement that hides the "Loading..." span tag.
See <a href="?page=ActiveControls.CallbackClientSide">TCallbackClientSide</a> for
further details on client-side property details.
diff --git a/demos/quickstart/protected/pages/ActiveControls/Home.page b/demos/quickstart/protected/pages/ActiveControls/Home.page index 38fee25d..bef855c9 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Home.page +++ b/demos/quickstart/protected/pages/ActiveControls/Home.page @@ -5,7 +5,7 @@ for a quick overview of the concept behind active controls (AJAX enabled controls).
Most active controls have a property of
<a href="?page=ActiveControls.BaseActiveControl">ActiveControl</a> and
-a sub-property <a href="?page=ActiveControls.CallbackClientSide">ActiveControl.ClientSide</a>
+a sub-property <a href="?page=ActiveControls.CallbackClientSide">ClientSide</a>
that provides many properties to customize the controls. The
<a href="?page=TCallbackClientScript">CallbackClient</a> property of the
<tt>TPage</tt> class provides many methods to update and alter the client-side content
diff --git a/framework/TComponent.php b/framework/TComponent.php index 95186800..54fe7ec7 100644 --- a/framework/TComponent.php +++ b/framework/TComponent.php @@ -618,7 +618,9 @@ class TPropertyValue if($types[$enums]->hasConstant($value))
return $value;
else
- throw new TInvalidDataValueException('propertyvalue_enumvalue_invalid',$value,$enums);
+ throw new TInvalidDataValueException(
+ 'propertyvalue_enumvalue_invalid',$value,
+ implode(' | ',$types[$enums]->getConstants()));
}
else if(!is_array($enums))
{
diff --git a/framework/Web/Javascripts/extra/logger.js b/framework/Web/Javascripts/extra/logger.js index d1434361..5771f2f4 100644 --- a/framework/Web/Javascripts/extra/logger.js +++ b/framework/Web/Javascripts/extra/logger.js @@ -195,6 +195,8 @@ LogConsole.prototype = { commandHistory : [],
commandIndex : 0,
+ hidden : true,
+
// Methods
// -------
@@ -207,7 +209,7 @@ LogConsole.prototype = { document.body.appendChild(this.logElement)
Element.hide(this.logElement)
- this.logElement.style.position = "absolute"
+ this.logElement.style.position = "absolute"
this.logElement.style.left = '0px'
this.logElement.style.width = '100%'
@@ -272,8 +274,15 @@ LogConsole.prototype = { Event.observe(this.inputElement, 'keyup', this.handleInput.bind(this))
Event.observe(this.inputElement, 'click', function() {this.inputElement.select()}.bind(this))
+ if(document.all && !window.opera)
+ {
window.setInterval(this.repositionWindow.bind(this), 500)
- this.repositionWindow()
+ }
+ else
+ {
+ this.logElement.style.position="fixed";
+ this.logElement.style.bottom="0px";
+ }
// Listen to the logger....
Logger.onupdate.addListener(this.logUpdate.bind(this))
@@ -310,11 +319,15 @@ LogConsole.prototype = { show : function() {
Element.show(this.logElement)
this.outputElement.scrollTop = this.outputElement.scrollHeight // Scroll to bottom when toggled
+ if(document.all && !window.opera)
+ this.repositionWindow();
Cookie.set('ConsoleVisible', 'true')
this.inputElement.select()
+ this.hidden = false;
},
hide : function() {
+ this.hidden = true;
Element.hide(this.logElement)
Cookie.set('ConsoleVisible', 'false')
},
diff --git a/framework/Web/Javascripts/js/compressed/ajax.js b/framework/Web/Javascripts/js/compressed/ajax.js index 4c3a8146..696968c7 100644 --- a/framework/Web/Javascripts/js/compressed/ajax.js +++ b/framework/Web/Javascripts/js/compressed/ajax.js @@ -302,28 +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;}});Prado.WebUI.TRatingList=Base.extend({selectedIndex:-1,enabled:true,constructor:function(options) +{this.editField.disabled=false;this.isSaving=false;this.isEditing=false;}});Prado.WebUI.TRatingList=Base.extend({selectedIndex:-1,enabled:true,readOnly:false,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) +{Element.addClassName($(this.options.ListID),this.options.Style);this.radios=new Array();var index=0;for(var i=0;i<this.options.ItemCount;i++) +{var radio=$(this.options.ListID+'_c'+i);var td=radio.parentNode;if(radio&&td.tagName.toLowerCase()=='td') +{this.radios.push(radio);Event.observe(td,"mouseover",this.hover.bindEvent(this,index));Event.observe(td,"mouseout",this.recover.bindEvent(this,index));Event.observe(td,"click",this.click.bindEvent(this,index));index++;Element.addClassName(td,"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");} +Element[action](this.radios[i].parentNode,"rating_selected");} 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) +Element.removeClassName(this.radios[i].parentNode,"rating_selected");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) +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.ListID+"$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' +{var node=this.radios[i].parentNode;var action=i>index?'removeClassName':'addClassName' 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) +{var value=index>-1?this.radios[index].value:this.options.caption;var caption=$(this.options.CaptionID);if(caption)caption.innerHTML=value;$(this.options.ListID).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) +Element[action](this.radios[i].parentNode,"rating_disabled");}}},{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/logger.js b/framework/Web/Javascripts/js/compressed/logger.js index 728c81e5..342b4234 100644 --- a/framework/Web/Javascripts/js/compressed/logger.js +++ b/framework/Web/Javascripts/js/compressed/logger.js @@ -40,7 +40,7 @@ LogEntry=Class.create() LogEntry.prototype={initialize:function(message,tag){this.message=message this.tag=tag}} LogConsole=Class.create() -LogConsole.prototype={commandHistory:[],commandIndex:0,initialize:function(){this.outputCount=0 +LogConsole.prototype={commandHistory:[],commandIndex:0,hidden:true,initialize:function(){this.outputCount=0 this.tagPattern=Cookie.get('tagPattern')||".*" this.logElement=document.createElement('div') document.body.appendChild(this.logElement) @@ -93,8 +93,10 @@ this.inputElement.value='Type command here' this.inputElement.setAttribute('autocomplete','off') Event.observe(this.inputElement,'keyup',this.handleInput.bind(this)) Event.observe(this.inputElement,'click',function(){this.inputElement.select()}.bind(this)) -window.setInterval(this.repositionWindow.bind(this),500) -this.repositionWindow() +if(document.all&&!window.opera) +{window.setInterval(this.repositionWindow.bind(this),500)} +else +{this.logElement.style.position="fixed";this.logElement.style.bottom="0px";} Logger.onupdate.addListener(this.logUpdate.bind(this)) Logger.onclear.addListener(this.clear.bind(this)) for(var i=0;i<Logger.logEntries.length;i++){this.logUpdate(Logger.logEntries[i])} @@ -105,8 +107,10 @@ document.body.appendChild(accessElement) if(Cookie.get('ConsoleVisible')=='true'){this.toggle()}},toggle:function(){if(this.logElement.style.display=='none'){this.show()} else{this.hide()}},show:function(){Element.show(this.logElement) this.outputElement.scrollTop=this.outputElement.scrollHeight -Cookie.set('ConsoleVisible','true') -this.inputElement.select()},hide:function(){Element.hide(this.logElement) +if(document.all&&!window.opera) +this.repositionWindow();Cookie.set('ConsoleVisible','true') +this.inputElement.select() +this.hidden=false;},hide:function(){this.hidden=true;Element.hide(this.logElement) Cookie.set('ConsoleVisible','false')},output:function(message,style){var shouldScroll=(this.outputElement.scrollTop+(2*this.outputElement.clientHeight))>=this.outputElement.scrollHeight this.outputCount++ style=(style?style+=';':'') diff --git a/framework/Web/Javascripts/js/compressed/prado.js b/framework/Web/Javascripts/js/compressed/prado.js index 376e3a7b..9f8cdb19 100644 --- a/framework/Web/Javascripts/js/compressed/prado.js +++ b/framework/Web/Javascripts/js/compressed/prado.js @@ -392,6 +392,6 @@ window.clipboardData.setData("Text",text);},hover:function(obj) {obj.parentNode.className="copycode copycode_hover";},out:function(obj) {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) +{var checkBoxOptions=Object.extend({ID:options.ListID+"_c"+i,EventTarget:options.ListID+"$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 +{var radioButtonOptions=Object.extend({ID:options.ListID+"_c"+i,EventTarget:options.ListID+"$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 77df7bc2..ba777546 100644 --- a/framework/Web/Javascripts/js/debug/ajax.js +++ b/framework/Web/Javascripts/js/debug/ajax.js @@ -2614,6 +2614,7 @@ Prado.WebUI.TRatingList = Base.extend( {
selectedIndex : -1,
enabled : true,
+ readOnly : false,
constructor : function(options)
{
@@ -2632,20 +2633,20 @@ Prado.WebUI.TRatingList = Base.extend( _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++)
+ for(var i = 0; i<this.options.ItemCount; i++)
{
- var node = radios[i].parentNode;
- if(node.tagName.toLowerCase()=='td')
+ var radio = $(this.options.ListID+'_c'+i);
+ var td = radio.parentNode;
+ if(radio && td.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));
+ this.radios.push(radio);
+ Event.observe(td, "mouseover", this.hover.bindEvent(this,index));
+ Event.observe(td, "mouseout", this.recover.bindEvent(this,index));
+ Event.observe(td, "click", this.click.bindEvent(this, index));
index++;
- Element.addClassName(node,"rating");
+ Element.addClassName(td,"rating");
}
}
},
@@ -2656,7 +2657,7 @@ Prado.WebUI.TRatingList = Base.extend( for(var i = 0; i<this.radios.length; i++)
{
var action = i <= index ? 'addClassName' : 'removeClassName'
- Element[action](this.radios[i].parentNode,"rating_hover");
+ Element[action](this.radios[i].parentNode,"rating_selected");
}
this.setCaption(index);
},
@@ -2665,7 +2666,7 @@ Prado.WebUI.TRatingList = Base.extend( {
if(this.enabled==false) return;
for(var i = 0; i<=index; i++)
- Element.removeClassName(this.radios[i].parentNode, "rating_hover");
+ Element.removeClassName(this.radios[i].parentNode, "rating_selected");
this.setRating(this.selectedIndex);
},
@@ -2679,7 +2680,7 @@ Prado.WebUI.TRatingList = Base.extend( var requestOptions = Object.extend(
{
ID : this.options.ListID+"_c"+index,
- EventTarget : this.options.ListName+"$c"+index
+ EventTarget : this.options.ListID+"$c"+index
},this.options);
var request = new Prado.CallbackRequest(requestOptions.EventTarget, requestOptions);
if(request.dispatch()==false)
@@ -2688,9 +2689,11 @@ Prado.WebUI.TRatingList = Base.extend( setRating: function(index)
{
+
for(var i = 0; i<this.radios.length; i++)
{
- var action = i <= index ? 'addClassName' : 'removeClassName'
+ var node = this.radios[i].parentNode;
+ var action = i > index ? 'removeClassName' : 'addClassName'
Element[action](this.radios[i].parentNode, "rating_selected");
}
this.setCaption(index);
@@ -2701,7 +2704,7 @@ Prado.WebUI.TRatingList = Base.extend( 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;
+ $(this.options.ListID).title = value;
},
setEnabled : function(value)
@@ -2711,7 +2714,6 @@ Prado.WebUI.TRatingList = Base.extend( {
var action = value ? 'removeClassName' : 'addClassName'
Element[action](this.radios[i].parentNode, "rating_disabled");
- Element.removeClassName(this.radios[i].parentNode, "rating_hover");
}
}
},
diff --git a/framework/Web/Javascripts/js/debug/logger.js b/framework/Web/Javascripts/js/debug/logger.js index 2a376904..5d465d56 100644 --- a/framework/Web/Javascripts/js/debug/logger.js +++ b/framework/Web/Javascripts/js/debug/logger.js @@ -195,6 +195,8 @@ LogConsole.prototype = { commandHistory : [],
commandIndex : 0,
+ hidden : true,
+
// Methods
// -------
@@ -207,7 +209,7 @@ LogConsole.prototype = { document.body.appendChild(this.logElement)
Element.hide(this.logElement)
- this.logElement.style.position = "absolute"
+ this.logElement.style.position = "absolute"
this.logElement.style.left = '0px'
this.logElement.style.width = '100%'
@@ -272,8 +274,15 @@ LogConsole.prototype = { Event.observe(this.inputElement, 'keyup', this.handleInput.bind(this))
Event.observe(this.inputElement, 'click', function() {this.inputElement.select()}.bind(this))
+ if(document.all && !window.opera)
+ {
window.setInterval(this.repositionWindow.bind(this), 500)
- this.repositionWindow()
+ }
+ else
+ {
+ this.logElement.style.position="fixed";
+ this.logElement.style.bottom="0px";
+ }
// Listen to the logger....
Logger.onupdate.addListener(this.logUpdate.bind(this))
@@ -310,11 +319,15 @@ LogConsole.prototype = { show : function() {
Element.show(this.logElement)
this.outputElement.scrollTop = this.outputElement.scrollHeight // Scroll to bottom when toggled
+ if(document.all && !window.opera)
+ this.repositionWindow();
Cookie.set('ConsoleVisible', 'true')
this.inputElement.select()
+ this.hidden = false;
},
hide : function() {
+ this.hidden = true;
Element.hide(this.logElement)
Cookie.set('ConsoleVisible', 'false')
},
diff --git a/framework/Web/Javascripts/js/debug/prado.js b/framework/Web/Javascripts/js/debug/prado.js index 920c2150..aaae6bad 100644 --- a/framework/Web/Javascripts/js/debug/prado.js +++ b/framework/Web/Javascripts/js/debug/prado.js @@ -3504,7 +3504,7 @@ Prado.WebUI.TCheckBoxList = Base.extend( var checkBoxOptions = Object.extend(
{
ID : options.ListID+"_c"+i,
- EventTarget : options.ListName+"$c"+i
+ EventTarget : options.ListID+"$c"+i
}, options);
new Prado.WebUI.TCheckBox(checkBoxOptions);
}
@@ -3520,7 +3520,7 @@ Prado.WebUI.TRadioButtonList = Base.extend( var radioButtonOptions = Object.extend(
{
ID : options.ListID+"_c"+i,
- EventTarget : options.ListName+"$c"+i
+ EventTarget : options.ListID+"$c"+i
}, options);
new Prado.WebUI.TRadioButton(radioButtonOptions);
}
diff --git a/framework/Web/Javascripts/prado/controls.js b/framework/Web/Javascripts/prado/controls.js index 0f1bb4d4..c26026ae 100644 --- a/framework/Web/Javascripts/prado/controls.js +++ b/framework/Web/Javascripts/prado/controls.js @@ -252,7 +252,7 @@ Prado.WebUI.TCheckBoxList = Base.extend( var checkBoxOptions = Object.extend(
{
ID : options.ListID+"_c"+i,
- EventTarget : options.ListName+"$c"+i
+ EventTarget : options.ListID+"$c"+i
}, options);
new Prado.WebUI.TCheckBox(checkBoxOptions);
}
@@ -268,7 +268,7 @@ Prado.WebUI.TRadioButtonList = Base.extend( var radioButtonOptions = Object.extend(
{
ID : options.ListID+"_c"+i,
- EventTarget : options.ListName+"$c"+i
+ EventTarget : options.ListID+"$c"+i
}, options);
new Prado.WebUI.TRadioButton(radioButtonOptions);
}
diff --git a/framework/Web/Javascripts/ratings/blocks.css b/framework/Web/Javascripts/ratings/blocks.css index 63cb7c2b..5d13a859 100644 --- a/framework/Web/Javascripts/ratings/blocks.css +++ b/framework/Web/Javascripts/ratings/blocks.css @@ -16,7 +16,7 @@ .TRatingList_blocks td.rating
{
- background-image: url(blocks_combined.png);
+ background-image: url(blocks_combined.gif);
background-repeat: no-repeat;
cursor: pointer;
background-position: 1px 0px;
@@ -26,15 +26,6 @@ background-position: 1px -100px;
}
-.TRatingList_blocks td.rating_hover
-{
- background-position: 1px -200px;
-}
-.TRatingList_blocks td.rating_half
-{
- background-position: 1px -300px;
-}
-
.TRatingList_blocks td.rating_disabled
{
cursor: default !important;
diff --git a/framework/Web/Javascripts/ratings/blocks.png b/framework/Web/Javascripts/ratings/blocks.png Binary files differindex 923cda09..0da75b19 100644 --- a/framework/Web/Javascripts/ratings/blocks.png +++ b/framework/Web/Javascripts/ratings/blocks.png diff --git a/framework/Web/Javascripts/ratings/blocks_blank.gif b/framework/Web/Javascripts/ratings/blocks_blank.gif Binary files differnew file mode 100644 index 00000000..c0db17c2 --- /dev/null +++ b/framework/Web/Javascripts/ratings/blocks_blank.gif diff --git a/framework/Web/Javascripts/ratings/blocks_blank.png b/framework/Web/Javascripts/ratings/blocks_blank.png Binary files differdeleted file mode 100644 index d5004d2d..00000000 --- a/framework/Web/Javascripts/ratings/blocks_blank.png +++ /dev/null diff --git a/framework/Web/Javascripts/ratings/blocks_combined.gif b/framework/Web/Javascripts/ratings/blocks_combined.gif Binary files differnew file mode 100644 index 00000000..04e8f7b8 --- /dev/null +++ b/framework/Web/Javascripts/ratings/blocks_combined.gif diff --git a/framework/Web/Javascripts/ratings/blocks_combined.png b/framework/Web/Javascripts/ratings/blocks_combined.png Binary files differdeleted file mode 100644 index 57c07672..00000000 --- a/framework/Web/Javascripts/ratings/blocks_combined.png +++ /dev/null diff --git a/framework/Web/Javascripts/ratings/blocks_half.gif b/framework/Web/Javascripts/ratings/blocks_half.gif Binary files differnew file mode 100644 index 00000000..a9e23d7c --- /dev/null +++ b/framework/Web/Javascripts/ratings/blocks_half.gif diff --git a/framework/Web/Javascripts/ratings/blocks_half.png b/framework/Web/Javascripts/ratings/blocks_half.png Binary files differdeleted file mode 100644 index 344aa207..00000000 --- a/framework/Web/Javascripts/ratings/blocks_half.png +++ /dev/null diff --git a/framework/Web/Javascripts/ratings/blocks_selected.gif b/framework/Web/Javascripts/ratings/blocks_selected.gif Binary files differnew file mode 100644 index 00000000..f743d27e --- /dev/null +++ b/framework/Web/Javascripts/ratings/blocks_selected.gif diff --git a/framework/Web/Javascripts/ratings/blocks_selected.png b/framework/Web/Javascripts/ratings/blocks_selected.png Binary files differdeleted file mode 100644 index dfdb6889..00000000 --- a/framework/Web/Javascripts/ratings/blocks_selected.png +++ /dev/null diff --git a/framework/Web/Javascripts/ratings/default.css b/framework/Web/Javascripts/ratings/default.css index cf8f7558..aa7913bf 100644 --- a/framework/Web/Javascripts/ratings/default.css +++ b/framework/Web/Javascripts/ratings/default.css @@ -16,25 +16,17 @@ .TRatingList_default td.rating
{
- background-image: url(default_combined.png);
+ background-image: url(default_combined.gif);
background-repeat: no-repeat;
cursor: pointer;
background-position: 0px 0px;
}
+
.TRatingList_default td.rating_selected
{
background-position: 0px -100px;
}
-.TRatingList_default td.rating_hover
-{
- background-position: 0px -200px;
-}
-.TRatingList_default td.rating_half
-{
- background-position: 0px -300px;
-}
-
.TRatingList_default td.rating_disabled
{
cursor: default !important;
diff --git a/framework/Web/Javascripts/ratings/default.png b/framework/Web/Javascripts/ratings/default.png Binary files differindex f9f380a9..17bc39a1 100644 --- a/framework/Web/Javascripts/ratings/default.png +++ b/framework/Web/Javascripts/ratings/default.png diff --git a/framework/Web/Javascripts/ratings/default_blank.gif b/framework/Web/Javascripts/ratings/default_blank.gif Binary files differnew file mode 100644 index 00000000..0337ad16 --- /dev/null +++ b/framework/Web/Javascripts/ratings/default_blank.gif diff --git a/framework/Web/Javascripts/ratings/default_blank.png b/framework/Web/Javascripts/ratings/default_blank.png Binary files differdeleted file mode 100644 index f857ff17..00000000 --- a/framework/Web/Javascripts/ratings/default_blank.png +++ /dev/null diff --git a/framework/Web/Javascripts/ratings/default_combined.gif b/framework/Web/Javascripts/ratings/default_combined.gif Binary files differnew file mode 100644 index 00000000..fe02b446 --- /dev/null +++ b/framework/Web/Javascripts/ratings/default_combined.gif diff --git a/framework/Web/Javascripts/ratings/default_combined.png b/framework/Web/Javascripts/ratings/default_combined.png Binary files differdeleted file mode 100644 index 1756f912..00000000 --- a/framework/Web/Javascripts/ratings/default_combined.png +++ /dev/null diff --git a/framework/Web/Javascripts/ratings/default_half.gif b/framework/Web/Javascripts/ratings/default_half.gif Binary files differnew file mode 100644 index 00000000..ed214acd --- /dev/null +++ b/framework/Web/Javascripts/ratings/default_half.gif diff --git a/framework/Web/Javascripts/ratings/default_half.png b/framework/Web/Javascripts/ratings/default_half.png Binary files differdeleted file mode 100644 index 6c826054..00000000 --- a/framework/Web/Javascripts/ratings/default_half.png +++ /dev/null diff --git a/framework/Web/Javascripts/ratings/default_selected.gif b/framework/Web/Javascripts/ratings/default_selected.gif Binary files differnew file mode 100644 index 00000000..98704fad --- /dev/null +++ b/framework/Web/Javascripts/ratings/default_selected.gif diff --git a/framework/Web/Javascripts/ratings/default_selected.png b/framework/Web/Javascripts/ratings/default_selected.png Binary files differdeleted file mode 100644 index e40d6b04..00000000 --- a/framework/Web/Javascripts/ratings/default_selected.png +++ /dev/null diff --git a/framework/Web/Javascripts/ratings/ratings.js b/framework/Web/Javascripts/ratings/ratings.js index 04ebd31d..9299d8d8 100644 --- a/framework/Web/Javascripts/ratings/ratings.js +++ b/framework/Web/Javascripts/ratings/ratings.js @@ -2,6 +2,7 @@ Prado.WebUI.TRatingList = Base.extend( {
selectedIndex : -1,
enabled : true,
+ readOnly : false,
constructor : function(options)
{
@@ -20,20 +21,20 @@ Prado.WebUI.TRatingList = Base.extend( _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++)
+ for(var i = 0; i<this.options.ItemCount; i++)
{
- var node = radios[i].parentNode;
- if(node.tagName.toLowerCase()=='td')
+ var radio = $(this.options.ListID+'_c'+i);
+ var td = radio.parentNode;
+ if(radio && td.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));
+ this.radios.push(radio);
+ Event.observe(td, "mouseover", this.hover.bindEvent(this,index));
+ Event.observe(td, "mouseout", this.recover.bindEvent(this,index));
+ Event.observe(td, "click", this.click.bindEvent(this, index));
index++;
- Element.addClassName(node,"rating");
+ Element.addClassName(td,"rating");
}
}
},
@@ -44,7 +45,7 @@ Prado.WebUI.TRatingList = Base.extend( for(var i = 0; i<this.radios.length; i++)
{
var action = i <= index ? 'addClassName' : 'removeClassName'
- Element[action](this.radios[i].parentNode,"rating_hover");
+ Element[action](this.radios[i].parentNode,"rating_selected");
}
this.setCaption(index);
},
@@ -53,7 +54,7 @@ Prado.WebUI.TRatingList = Base.extend( {
if(this.enabled==false) return;
for(var i = 0; i<=index; i++)
- Element.removeClassName(this.radios[i].parentNode, "rating_hover");
+ Element.removeClassName(this.radios[i].parentNode, "rating_selected");
this.setRating(this.selectedIndex);
},
@@ -67,7 +68,7 @@ Prado.WebUI.TRatingList = Base.extend( var requestOptions = Object.extend(
{
ID : this.options.ListID+"_c"+index,
- EventTarget : this.options.ListName+"$c"+index
+ EventTarget : this.options.ListID+"$c"+index
},this.options);
var request = new Prado.CallbackRequest(requestOptions.EventTarget, requestOptions);
if(request.dispatch()==false)
@@ -76,9 +77,11 @@ Prado.WebUI.TRatingList = Base.extend( setRating: function(index)
{
+
for(var i = 0; i<this.radios.length; i++)
{
- var action = i <= index ? 'addClassName' : 'removeClassName'
+ var node = this.radios[i].parentNode;
+ var action = i > index ? 'removeClassName' : 'addClassName'
Element[action](this.radios[i].parentNode, "rating_selected");
}
this.setCaption(index);
@@ -89,7 +92,7 @@ Prado.WebUI.TRatingList = Base.extend( 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;
+ $(this.options.ListID).title = value;
},
setEnabled : function(value)
@@ -99,7 +102,6 @@ Prado.WebUI.TRatingList = Base.extend( {
var action = value ? 'removeClassName' : 'addClassName'
Element[action](this.radios[i].parentNode, "rating_disabled");
- Element.removeClassName(this.radios[i].parentNode, "rating_hover");
}
}
},
diff --git a/framework/Web/UI/ActiveControls/TActiveButton.php b/framework/Web/UI/ActiveControls/TActiveButton.php index 030361fb..62027264 100644 --- a/framework/Web/UI/ActiveControls/TActiveButton.php +++ b/framework/Web/UI/ActiveControls/TActiveButton.php @@ -55,6 +55,14 @@ class TActiveButton extends TButton implements ICallbackEventHandler, IActiveCon }
/**
+ * @return TCallbackClientSide client side request options.
+ */
+ public function getClientSide()
+ {
+ return $this->getAdapter()->getBaseActiveControl()->getClientSide();
+ }
+
+ /**
* Raises the callback event. This method is required by {@link
* ICallbackEventHandler} interface. If {@link getCausesValidation
* CausesValidation} is true, it will invoke the page's {@link TPage::
diff --git a/framework/Web/UI/ActiveControls/TActiveCheckBox.php b/framework/Web/UI/ActiveControls/TActiveCheckBox.php index 7cf5c005..2f60d9fb 100644 --- a/framework/Web/UI/ActiveControls/TActiveCheckBox.php +++ b/framework/Web/UI/ActiveControls/TActiveCheckBox.php @@ -53,6 +53,14 @@ class TActiveCheckBox extends TCheckBox implements ICallbackEventHandler, IActiv } /** + * @return TCallbackClientSide client side request options. + */ + public function getClientSide() + { + return $this->getAdapter()->getBaseActiveControl()->getClientSide(); + } + + /** * Raises the callback event. This method is required by {@link * ICallbackEventHandler} interface. * This method is mainly used by framework and control developers. diff --git a/framework/Web/UI/ActiveControls/TActiveCheckBoxList.php b/framework/Web/UI/ActiveControls/TActiveCheckBoxList.php index b18d0d0d..09ad9236 100644 --- a/framework/Web/UI/ActiveControls/TActiveCheckBoxList.php +++ b/framework/Web/UI/ActiveControls/TActiveCheckBoxList.php @@ -57,6 +57,14 @@ class TActiveCheckBoxList extends TCheckBoxList implements IActiveControl, ICall } /** + * @return TCallbackClientSide client side request options. + */ + public function getClientSide() + { + return $this->getAdapter()->getBaseActiveControl()->getClientSide(); + } + + /** * @return string javascript client-side control class name. */ protected function getClientClassName() diff --git a/framework/Web/UI/ActiveControls/TActiveCustomValidator.php b/framework/Web/UI/ActiveControls/TActiveCustomValidator.php index 686149eb..0a6b7b84 100644 --- a/framework/Web/UI/ActiveControls/TActiveCustomValidator.php +++ b/framework/Web/UI/ActiveControls/TActiveCustomValidator.php @@ -10,6 +10,8 @@ * @package System.Web.UI.ActiveControls
*/
+Prado::using('System.Web.UI.ActiveControls.TCallbackClientSide');
+
/**
* TActiveCustomValidator Class
*
@@ -55,6 +57,7 @@ class TActiveCustomValidator extends TCustomValidator {
parent::__construct();
$this->setAdapter(new TActiveControlAdapter($this));
+ $this->getActiveControl()->setClientSide(new TActiveCustomValidatorClientSide);
}
/**
@@ -66,6 +69,14 @@ class TActiveCustomValidator extends TCustomValidator }
/**
+ * @return TCallbackClientSide client side request options.
+ */
+ public function getClientSide()
+ {
+ return $this->getAdapter()->getBaseActiveControl()->getClientSide();
+ }
+
+ /**
* Client validation function is NOT supported.
*/
public function setClientValidationFunction($value)
@@ -131,4 +142,67 @@ class TActiveCustomValidator extends TCustomValidator }
}
+/**
+ * Custom Validator callback client side options class.
+ *
+ * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @version $Id$
+ * @package System.Web.UI.ActiveControls
+ * @since 3.1
+ */
+class TActiveCustomValidatorClientSide extends TCallbackClientSide
+{
+ /**
+ * @return string javascript code for client-side OnValidate event.
+ */
+ public function getOnValidate()
+ {
+ return $this->getOption('OnValidate');
+ }
+
+ /**
+ * Client-side OnValidate validator event is raise before the validators
+ * validation functions are called.
+ * @param string javascript code for client-side OnValidate event.
+ */
+ public function setOnValidate($javascript)
+ {
+ $this->setFunction('OnValidate', $javascript);
+ }
+
+ /**
+ * Client-side OnError event is raised after validation failure.
+ * This will override the default client-side validator behaviour.
+ * @param string javascript code for client-side OnError event.
+ */
+ public function setOnError($javascript)
+ {
+ $this->setFunction('OnError', $javascript);
+ }
+
+ /**
+ * @return string javascript code for client-side OnError event.
+ */
+ public function getOnError()
+ {
+ return $this->getOption('OnError');
+ }
+
+ /**
+ * @param boolean true to revalidate when the control to validate changes value.
+ */
+ public function setObserveChanges($value)
+ {
+ $this->setOption('ObserveChanges', TPropertyValue::ensureBoolean($value));
+ }
+
+ /**
+ * @return boolean true to observe changes.
+ */
+ public function getObserveChanges()
+ {
+ $changes = $this->getOption('ObserveChanges');
+ return is_null($changes) ? true : $changes;
+ }
+}
?>
\ No newline at end of file diff --git a/framework/Web/UI/ActiveControls/TActiveDropDownList.php b/framework/Web/UI/ActiveControls/TActiveDropDownList.php index c628e98c..215b1e5a 100644 --- a/framework/Web/UI/ActiveControls/TActiveDropDownList.php +++ b/framework/Web/UI/ActiveControls/TActiveDropDownList.php @@ -59,6 +59,14 @@ class TActiveDropDownList extends TDropDownList implements ICallbackEventHandler } /** + * @return TCallbackClientSide client side request options. + */ + public function getClientSide() + { + return $this->getAdapter()->getBaseActiveControl()->getClientSide(); + } + + /** * No client class for this control. * This method overrides the parent implementation. * @return null no javascript class name. diff --git a/framework/Web/UI/ActiveControls/TActiveImageButton.php b/framework/Web/UI/ActiveControls/TActiveImageButton.php index fe4cb385..bb20793e 100644 --- a/framework/Web/UI/ActiveControls/TActiveImageButton.php +++ b/framework/Web/UI/ActiveControls/TActiveImageButton.php @@ -47,6 +47,14 @@ class TActiveImageButton extends TImageButton implements IActiveControl, ICallba } /** + * @return TCallbackClientSide client side request options. + */ + public function getClientSide() + { + return $this->getAdapter()->getBaseActiveControl()->getClientSide(); + } + + /** * Sets the alternative text to be displayed in the TImage when the image is unavailable. * @param string the alternative text */ diff --git a/framework/Web/UI/ActiveControls/TActiveLinkButton.php b/framework/Web/UI/ActiveControls/TActiveLinkButton.php index 30c62723..8b86d11a 100644 --- a/framework/Web/UI/ActiveControls/TActiveLinkButton.php +++ b/framework/Web/UI/ActiveControls/TActiveLinkButton.php @@ -50,6 +50,14 @@ class TActiveLinkButton extends TLinkButton implements IActiveControl, ICallback } /** + * @return TCallbackClientSide client side request options. + */ + public function getClientSide() + { + return $this->getAdapter()->getBaseActiveControl()->getClientSide(); + } + + /** * Raises the callback event. This method is required by {@link * ICallbackEventHandler} interface. If {@link getCausesValidation * CausesValidation} is true, it will invoke the page's {@link TPage:: diff --git a/framework/Web/UI/ActiveControls/TActiveListBox.php b/framework/Web/UI/ActiveControls/TActiveListBox.php index e433fa09..21816961 100644 --- a/framework/Web/UI/ActiveControls/TActiveListBox.php +++ b/framework/Web/UI/ActiveControls/TActiveListBox.php @@ -43,6 +43,14 @@ class TActiveListBox extends TListBox implements IActiveControl, ICallbackEventH } /** + * @return TCallbackClientSide client side request options. + */ + public function getClientSide() + { + return $this->getAdapter()->getBaseActiveControl()->getClientSide(); + } + + /** * Creates a collection object to hold list items. A specialized * TActiveListItemCollection is created to allow the drop down list options * to be added. diff --git a/framework/Web/UI/ActiveControls/TActiveRadioButton.php b/framework/Web/UI/ActiveControls/TActiveRadioButton.php index fe26165c..425cf1c7 100644 --- a/framework/Web/UI/ActiveControls/TActiveRadioButton.php +++ b/framework/Web/UI/ActiveControls/TActiveRadioButton.php @@ -52,6 +52,14 @@ class TActiveRadioButton extends TRadioButton implements IActiveControl, ICallba } /** + * @return TCallbackClientSide client side request options. + */ + public function getClientSide() + { + return $this->getAdapter()->getBaseActiveControl()->getClientSide(); + } + + /** * Raises the callback event. This method is required by {@link * ICallbackEventHandler} interface. * This method is mainly used by framework and control developers. diff --git a/framework/Web/UI/ActiveControls/TActiveRadioButtonList.php b/framework/Web/UI/ActiveControls/TActiveRadioButtonList.php index f971228f..0eb3f83a 100644 --- a/framework/Web/UI/ActiveControls/TActiveRadioButtonList.php +++ b/framework/Web/UI/ActiveControls/TActiveRadioButtonList.php @@ -52,6 +52,14 @@ class TActiveRadioButtonList extends TRadioButtonList implements IActiveControl, } /** + * @return TCallbackClientSide client side request options. + */ + public function getClientSide() + { + return $this->getAdapter()->getBaseActiveControl()->getClientSide(); + } + + /** * @return string javascript client-side control class name. */ protected function getClientClassName() diff --git a/framework/Web/UI/ActiveControls/TActiveRatingList.php b/framework/Web/UI/ActiveControls/TActiveRatingList.php index 1ce49a0c..ec8eee46 100644 --- a/framework/Web/UI/ActiveControls/TActiveRatingList.php +++ b/framework/Web/UI/ActiveControls/TActiveRatingList.php @@ -1,9 +1,35 @@ <?php
+/**
+ * TActiveRatingList class file.
+ *
+ * @author Wei Zhuo <weizhuo[at]gamil[dot]com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2006 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Id$
+ * @package System.Web.UI.ActiveControls
+ */
+/**
+ * TActiveRatingList Class
+ *
+ * Displays clickable images that represent a TActiveRadioButtonList
+ *
+ * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @version $Id$
+ * @package System.Web.UI.ActiveControls
+ * @since 3.1
+ */
class TActiveRatingList extends TActiveRadioButtonList
{
+ /**
+ * @var array list of published rating images.
+ */
private $_ratingImages = array();
+ /**
+ * Sets the default repeat direction to horizontal.
+ */
public function __construct()
{
parent::__construct();
@@ -18,6 +44,19 @@ class TActiveRatingList extends TActiveRadioButtonList return $this->getViewState('ReadOnly',false);
}
+ /**
+ * @param boolean whether the items in the column can be edited
+ */
+ public function setReadOnly($value)
+ {
+ $this->setViewState('ReadOnly',TPropertyValue::ensureBoolean($value),false);
+ }
+
+ /**
+ * The repeat layout must be Table.
+ * @param string repeat layout type
+ * @throws TInvaliddataValueException when repeat layout is not Table.
+ */
public function setRepeatLayout($value)
{
if($value!==TRepeatLayout::Table)
@@ -27,23 +66,24 @@ class TActiveRatingList extends TActiveRadioButtonList }
/**
- * @param boolean whether the items in the column can be edited
+ * @return float rating value for read-only display.
*/
- public function setReadOnly($value)
- {
- $this->setViewState('ReadOnly',TPropertyValue::ensureBoolean($value),false);
- }
-
public function getRating()
{
return $this->getViewState('Rating',0);
}
+ /**
+ * @param float rating value for read-only display.
+ */
public function setRating($value)
{
$this->setViewState('Rating', TPropertyValue::ensureFloat($value),0);
}
+ /**
+ * @param int change the rating selection index
+ */
public function setSelectedIndex($value)
{
$canUpdate = $this->getActiveControl()->getEnableUpdate();
@@ -54,6 +94,11 @@ class TActiveRatingList extends TActiveRadioButtonList $this->callClientFunction('setRating',$value);
}
+ /**
+ * Calls the client-side static method for this control class.
+ * @param string static method name
+ * @param mixed method parmaeter
+ */
protected function callClientFunction($func,$value)
{
$client = $this->getPage()->getCallbackClient();
@@ -62,7 +107,7 @@ class TActiveRatingList extends TActiveRadioButtonList }
/**
- * @return string caption text.
+ * @return string control or html element ID for displaying a caption.
*/
public function getCaptionID()
{
@@ -70,13 +115,16 @@ class TActiveRatingList extends TActiveRadioButtonList }
/**
- * @param string caption text
+ * @param string control or html element ID for displaying a caption.
*/
public function setCaptionID($value)
{
$this->setViewState('CaptionID', $value, '');
}
+ /**
+ * @param boolean true to enable the rating to be changed.
+ */
public function setEnabled($value)
{
parent::setEnabled($value);
@@ -85,7 +133,7 @@ class TActiveRatingList extends TActiveRadioButtonList }
/**
- * @param string set the rating style
+ * @param string set the rating style, default is "default"
*/
public function setRatingStyle($value)
{
@@ -100,22 +148,36 @@ class TActiveRatingList extends TActiveRadioButtonList return $this->getViewState('RatingStyle', 'default');
}
- public function setHalfRatingLimit($value)
+ /**
+ * Sets the interval such that those rating values within the interval
+ * will be considered as a half star rating.
+ * @param array rating display half value interval, default is array(0.3, 0.7);
+ */
+ public function setHalfRatingInterval($value)
{
$this->setViewState('HalfRating',
TPropertyValue::ensureArray($value), array(0.3, 0.7));
}
- public function getHalfRatingLimit()
+ /**
+ * @return array rating display half value interval, default is array(0.3, 0.7);
+ */
+ public function getHalfRatingInterval()
{
return $this->getViewState('HalfRating', array(0.3, 0.7));
}
+ /**
+ * @return string rating style css class name.
+ */
protected function getRatingStyleCssClass()
{
return 'TRatingList_'.$this->getRatingStyle();
}
+ /**
+ * @return array list of post back options.
+ */
protected function getPostBackOptions()
{
$options = parent::getPostBackOptions();
@@ -126,7 +188,8 @@ class TActiveRatingList extends TActiveRadioButtonList }
/**
- * Registers the javascript code for initializing the active control.
+ * Registers the javascript code for initializing the active control
+ * only if {@link setReadOnly ReadOnly} property is false.
*/
protected function renderClientControlScript($writer)
{
@@ -134,6 +197,9 @@ class TActiveRatingList extends TActiveRadioButtonList parent::renderClientControlScript($writer);
}
+ /**
+ * @return string find the client ID of the caption control.
+ */
protected function getCaptionControl()
{
if(($id=$this->getCaptionID())!=='')
@@ -149,6 +215,10 @@ class TActiveRatingList extends TActiveRadioButtonList return '';
}
+ /**
+ * @param string rating style name
+ * @return string URL of the css style file
+ */
protected function publishRatingListStyle($style)
{
$cs = $this->getPage()->getClientScript();
@@ -161,7 +231,12 @@ class TActiveRatingList extends TActiveRadioButtonList return $url;
}
- protected function publishRatingListImages($style, $fileExt='.png')
+ /**
+ * @param string rating style name
+ * @param string rating image file extension, default is '.gif'
+ * @return array URL of publish the rating images
+ */
+ protected function publishRatingListImages($style, $fileExt='.gif')
{
$images['blank'] = "System.Web.Javascripts.ratings.{$style}_blank";
$images['selected'] = "System.Web.Javascripts.ratings.{$style}_selected";
@@ -177,18 +252,21 @@ class TActiveRatingList extends TActiveRadioButtonList return $files;
}
+ /**
+ * Add rating style class name to the class attribute
+ * when {@link setReadOnly ReadOnly} property is true and when the
+ * {@link setCssClass CssClass} property is empty.
+ * @param THtmlWriter renderer
+ */
public function render($writer)
{
if($this->getReadOnly())
- {
$writer->addAttribute('class', $this->getRatingStyleCssClass());
- $writer->addAttribute('title', $this->getRating());
- }
parent::render($writer);
}
/**
- * @param THtmlWriter writer
+ * Publish the the rating style css file and rating image files.
*/
public function onPreRender($param)
{
@@ -198,6 +276,10 @@ class TActiveRatingList extends TActiveRadioButtonList $this->_ratingImages = $this->publishRatingListImages($this->getRatingStyle());
}
+ /**
+ * Renders the rating images if {@link setReadOnly ReadOnly} is true
+ * otherwise render the radio buttons.
+ */
public function renderItem($writer,$repeatInfo,$itemType,$index)
{
if($this->getReadOnly())
@@ -206,6 +288,9 @@ class TActiveRatingList extends TActiveRadioButtonList parent::renderItem($writer, $repeatInfo, $itemType, $index);
}
+ /**
+ * Renders the static rating images.
+ */
protected function renderStaticRating($writer, $repeatInfo, $itemType, $index)
{
$image = new TImage;
@@ -214,11 +299,15 @@ class TActiveRatingList extends TActiveRadioButtonList $image->render($writer);
}
+ /**
+ * @param integer rating image index
+ * @return string the rating image corresponding to current index to be rendered.
+ */
protected function getRatingImageType($index)
{
$rating = floatval($this->getRating());
$int = intval($rating);
- $limit = $this->getHalfRatingLimit();
+ $limit = $this->getHalfRatingInterval();
if($index < $int || ($rating < $index+1 && $rating > $index+$limit[1]))
return 'selected';
if($rating >= $index+$limit[0] && $rating <= $index+$limit[1])
diff --git a/framework/Web/UI/ActiveControls/TActiveTextBox.php b/framework/Web/UI/ActiveControls/TActiveTextBox.php index bee97dbb..8e6c86dd 100644 --- a/framework/Web/UI/ActiveControls/TActiveTextBox.php +++ b/framework/Web/UI/ActiveControls/TActiveTextBox.php @@ -51,6 +51,14 @@ class TActiveTextBox extends TTextBox implements ICallbackEventHandler, IActiveC }
/**
+ * @return TCallbackClientSide client side request options.
+ */
+ public function getClientSide()
+ {
+ return $this->getAdapter()->getBaseActiveControl()->getClientSide();
+ }
+
+ /**
* Client-side Text property can only be updated after the OnLoad stage.
* @param string text content for the textbox
*/
diff --git a/framework/Web/UI/ActiveControls/TCallback.php b/framework/Web/UI/ActiveControls/TCallback.php index b7444127..60bdaf10 100644 --- a/framework/Web/UI/ActiveControls/TCallback.php +++ b/framework/Web/UI/ActiveControls/TCallback.php @@ -62,6 +62,14 @@ class TCallback extends TControl implements ICallbackEventHandler, IActiveContro }
/**
+ * @return TCallbackClientSide client side request options.
+ */
+ public function getClientSide()
+ {
+ return $this->getAdapter()->getBaseActiveControl()->getClientSide();
+ }
+
+ /**
* Raises the callback event. This method is required by {@link
* ICallbackEventHandler} interface. If {@link getCausesValidation
* ActiveControl.CausesValidation} is true, it will invoke the page's {@link TPage::
diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php index 77abdd9a..ad901e17 100644 --- a/framework/Web/UI/WebControls/TBaseValidator.php +++ b/framework/Web/UI/WebControls/TBaseValidator.php @@ -661,18 +661,6 @@ class TValidatorClientSide extends TClientSideOptions $changes = $this->getOption('ObserveChanges'); return is_null($changes) ? true : $changes; } - - /** - * Ensure the string is a valid javascript function. If the string begins - * with "javascript:" valid javascript function is assumed, otherwise the - * code block is enclosed with "function(validator, sender){ }" block. - * @param string javascript code. - * @return string javascript function code. - */ - protected function ensureFunction($javascript) - { - return "function(validator, sender){ {$javascript} }"; - } } diff --git a/framework/Web/UI/WebControls/TJavascriptLogger.php b/framework/Web/UI/WebControls/TJavascriptLogger.php index 3a294b6b..a873d8d8 100644 --- a/framework/Web/UI/WebControls/TJavascriptLogger.php +++ b/framework/Web/UI/WebControls/TJavascriptLogger.php @@ -57,8 +57,9 @@ class TJavascriptLogger extends TWebControl public function renderContents($writer)
{
$info = '(<a href="http://gleepglop.com/javascripts/logger/" target="_blank">more info</a>).';
- $usage = 'Press ALT-D (Or CTRL-D on OS X) to toggle the javascript log console';
- $writer->write("{$usage} {$info}");
+ $link = '<a href="javascript:if(logConsole)logConsole.toggle()">toggle the javascript log console.</a>';
+ $usage = 'Press ALT-D (Or CTRL-D on OS X) to';
+ $writer->write("{$usage} {$link} {$info}");
}
}
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveCheckBoxTest.page b/tests/FunctionalTests/active-controls/protected/pages/ActiveCheckBoxTest.page index 9ff09bb6..431d42f2 100644 --- a/tests/FunctionalTests/active-controls/protected/pages/ActiveCheckBoxTest.page +++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveCheckBoxTest.page @@ -2,25 +2,25 @@ <h1>Active CheckBox Test</h1> <com:TActiveCheckBox ID="checkbox1" Text="CheckBox 1" OnCallback="checkbox_requested" /> <com:TActiveCheckBox ID="checkbox2" Text="CheckBox 2" OnCallback="checkbox_requested"> - <prop:ActiveControl.ClientSide OnLoading="$('status').show()" OnComplete="$('status').hide()" /> + <prop:ClientSide OnLoading="$('status').show()" OnComplete="$('status').hide()" /> </com:TActiveCheckBox> <div style="margin:1em; padding:0.5em; text-align:center; border:1px solid #ccc;"> <com:TActiveLabel ID="label1" Text="Label 1" /> </div> <div style="margin:1em; padding: 1em; text-align: center"> - <com:TActiveButton id="change_text1" + <com:TActiveButton id="change_text1" OnClick="change_checkbox1_text" Text="Change CheckBox 1 Text"/> <com:TActiveButton id="change_checked1" OnClick="change_checkbox1_checked" Text="Toggle CheckBox 1"/> - <com:TActiveButton id="change_text2" + <com:TActiveButton id="change_text2" OnClick="change_checkbox2_text" Text="Change CheckBox 2 Text"/> <com:TActiveButton id="change_checked2" OnClick="change_checkbox2_checked" Text="Toggle CheckBox 2"/> </div> - <div id="status" style="margin:1em; padding:0.5em; - text-align:center; - background-color:#900; + <div id="status" style="margin:1em; padding:0.5em; + text-align:center; + background-color:#900; color:white; display: none; position: absolute; right: 0; top: 0"> Loading... diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveRadioButtonTest.page b/tests/FunctionalTests/active-controls/protected/pages/ActiveRadioButtonTest.page index c5c40c44..2bb4c9de 100644 --- a/tests/FunctionalTests/active-controls/protected/pages/ActiveRadioButtonTest.page +++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveRadioButtonTest.page @@ -6,7 +6,7 @@ <com:TActiveRadioButton ID="radio2"
GroupName="group1" Text="Radio Button 2"
OnCallback="radiobutton_requested">
- <prop:ActiveControl.ClientSide OnLoading="$('status').show()" OnComplete="$('status').hide()" />
+ <prop:ClientSide OnLoading="$('status').show()" OnComplete="$('status').hide()" />
</com:TActiveRadioButton>
<com:TActiveRadioButton ID="radio3"
Text="Radio Button 3"
diff --git a/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.page b/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.page index b7429c60..6d2168be 100644 --- a/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.page +++ b/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.page @@ -1,5 +1,5 @@ <com:TForm ID="form1"> - + <style> .autocomplete { @@ -15,8 +15,8 @@ font-family: Tahoma, Arial, Helvetica, sans-serif; color: #333; } - - ul.different + + ul.different { background-color: pink; } @@ -31,31 +31,34 @@ background-color: #ffc; } </style> - + <h1 id="heading">TAutoComplete Test</h1> <div><strong>Manual Testing Required</strong></div> - + <com:TAutoComplete Style="width: 20em" ID="textbox1" OnSuggest="suggestCountries" - Separator=", " + Separator=", " ResultPanel.CssClass="autocomplete" /> <com:TAutoComplete Style="width: 30em; height: 20em" TextMode="MultiLine" + ID="textbox2" OnSuggest="suggestCountries" - Separator=", \n" + OnCallback="callback_requested" + AutoPostBack="true" + Separator=", \n" ResultPanel.CssClass="autocomplete"> <prop:Suggestions.HeaderTemplate> <ul class="different"> </prop:Suggestions.HeaderTemplate> </com:TAutoComplete> - + <com:TAutoComplete Style="width: 20em" id="textbox3" OnSuggest="suggestCountries" OnCallback="callback_requested" Separator=", " AutoPostBack="true" - ResultPanel.CssClass="autocomplete" /> + ResultPanel.CssClass="autocomplete" /> <p><br /></p> <com:TActiveLabel ID="label1" Text="Label 1" /> diff --git a/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php b/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php index 997e9bdd..dbce7531 100644 --- a/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php +++ b/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php @@ -15,7 +15,7 @@ class AutoCompleteTest extends TPage public function callback_requested($sender, $param) { - $this->label1->Text = "Label 1: ".$this->textbox3->Text; + $this->label1->Text = "Label 1: ".$sender->Text; } protected function matchCountries($token) diff --git a/tests/FunctionalTests/active-controls/protected/pages/CallbackCustomValidatorTest.page b/tests/FunctionalTests/active-controls/protected/pages/CallbackCustomValidatorTest.page index 2af4b3c8..ae1fe3d2 100644 --- a/tests/FunctionalTests/active-controls/protected/pages/CallbackCustomValidatorTest.page +++ b/tests/FunctionalTests/active-controls/protected/pages/CallbackCustomValidatorTest.page @@ -24,10 +24,9 @@ ErrorMessage="*"
ControlCssClass="required"
OnServerValidate="validate_text1">
- <prop:ClientSide
- OnError="$('status').innerHTML='Error '+(new Date())"
- OnSuccess="$('status').innerHTML='Success '+(new Date())" />
- <prop:ActiveControl.ClientSide
+ <prop:ClientSide
+ OnError="$('status').innerHTML='Error '+(new Date())"
+ OnSuccess="$('status').innerHTML='Success '+(new Date())"
OnLoading="Element.show('loader')"
OnComplete="Element.hide('loader')" />
</com:TActiveCustomValidator>
diff --git a/tests/FunctionalTests/active-controls/protected/pages/CallbackOptionsTest.page b/tests/FunctionalTests/active-controls/protected/pages/CallbackOptionsTest.page index 6e8b8a1e..3cecbade 100644 --- a/tests/FunctionalTests/active-controls/protected/pages/CallbackOptionsTest.page +++ b/tests/FunctionalTests/active-controls/protected/pages/CallbackOptionsTest.page @@ -1,6 +1,6 @@ <com:TForm ID="form1"> <h1>TCallbackOptions Test</h1> - + <com:TCallbackOptions ID="options1"> <prop:ClientSide.OnLoading> $("status").show(); @@ -12,23 +12,23 @@ Element.update("label1", "Button 1 has returned"); </prop:ClientSide.OnSuccess> </com:TCallbackOptions> - + <com:TActiveButton id="button1" Text="Button 1" ActiveControl.CallbackOptions="options1" /> <com:TActiveButton id="button2" Text="Button 2" ActiveControl.CallbackOptions="options1"> - <prop:ActiveControl.ClientSide.OnSuccess> + <prop:ClientSide.OnSuccess> Element.update("label2", "Button 2 has returned"); - </prop:ActiveControl.ClientSide.OnSuccess> + </prop:ClientSide.OnSuccess> </com:TActiveButton> <com:TActiveButton id="button3" Text="Button 3"> - <prop:ActiveControl.ClientSide.OnSuccess> + <prop:ClientSide.OnSuccess> Element.update("label3", "Button 3 has returned"); - </prop:ActiveControl.ClientSide.OnSuccess> + </prop:ClientSide.OnSuccess> </com:TActiveButton> - + <div id="label1">Label 1</div> <div id="label2">Label 2</div> <div id="label3">Label 3</div> <div id="status" style="display:none; background-color: #c00; color:white; text-align:center; padding: 1em" > - Loading... + Loading... </div> </com:TForm>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/protected/pages/RatingList.page b/tests/FunctionalTests/active-controls/protected/pages/RatingList.page index 190e6020..a615363b 100644 --- a/tests/FunctionalTests/active-controls/protected/pages/RatingList.page +++ b/tests/FunctionalTests/active-controls/protected/pages/RatingList.page @@ -1,57 +1,69 @@ <com:THead/>
<com:TForm>
<style>
- body
+ .more td
{
- background-color: pink
+ border: 1px solid #eee;
+ width: 40px;
+ height: 40px;
+ }
+ .more td.rating
+ {
+ background-position: 10px 10px;
+ }
+ .more td.rating_selected
+ {
+ background-position: 10px -90px;
}
</style>
<com:TLabel ID="label1" Text="Rate It:" />
<com:TActiveRatingList ID="list1" CaptionID="label1" RatingStyle="blocks" OnCallback="list1_oncallback">
- <com:TListItem Text="1 Star" />
- <com:TListItem Text="2 Star" />
- <com:TListItem Text="3 Star" />
- <com:TListItem Text="4 Star" />
- <com:TListItem Text="5 Star" />
- <prop:ActiveControl.ClientSide
+ <com:TListItem Text="1 Block" />
+ <com:TListItem Text="2 Blocks" />
+ <com:TListItem Text="3 Blocks" />
+ <com:TListItem Text="4 Blocks" />
+ <com:TListItem Text="5 Blocks" />
+ <prop:ClientSide
OnLoading="Element.show('status')"
OnComplete="Element.hide('status')" />
</com:TActiveRatingList>
+<br />
-<com:TActiveRatingList ID="list2" Rating="3.5" RatingStyle="blocks" ReadOnly="true">
- <com:TListItem Text="1 Star" />
- <com:TListItem Text="2 Star" />
- <com:TListItem Text="3 Star" />
- <com:TListItem Text="4 Star" />
- <com:TListItem Text="5 Star" />
+<com:TActiveRatingList ID="list2" Rating="3.5"
+ Attributes.title="3.5 Blocks" RatingStyle="blocks" ReadOnly="true">
+ <com:TListItem Text="1 Block" />
+ <com:TListItem Text="2 Blocks" />
+ <com:TListItem Text="3 Blocks" />
+ <com:TListItem Text="4 Blocks" />
+ <com:TListItem Text="5 Blocks" />
</com:TActiveRatingList>
<br />
-<com:TActiveRatingList RepeatColumns="5">
+<com:TActiveRatingList CssClass="more" RepeatColumns="2" RepeatDirection="Vertical">
<com:TListItem Text="1 Star" />
- <com:TListItem Text="2 Star" />
- <com:TListItem Text="3 Star" />
- <com:TListItem Text="4 Star" />
- <com:TListItem Text="5 Star" />
- <com:TListItem Text="6 Star" />
- <com:TListItem Text="7 Star" />
- <com:TListItem Text="8 Star" />
- <com:TListItem Text="9 Star" />
- <com:TListItem Text="10 Star" />
- <prop:ActiveControl.ClientSide
+ <com:TListItem Text="2 Stars" />
+ <com:TListItem Text="3 Stars" />
+ <com:TListItem Text="4 Stars" />
+ <com:TListItem Text="5 Stars" />
+ <com:TListItem Text="6 Stars" />
+ <com:TListItem Text="7 Stars" />
+ <com:TListItem Text="8 Stars" />
+ <com:TListItem Text="9 Stars" />
+ <com:TListItem Text="10 Stars" />
+ <prop:ClientSide
OnLoading="Element.show('status')"
OnComplete="Element.hide('status')" />
</com:TActiveRatingList>
+<br />
-
-<com:TActiveRatingList ID="list3" Rating="3.5" ReadOnly="true">
+<com:TActiveRatingList ID="list3" Rating="3.5" Attributes.title="3.5 Stars" ReadOnly="true">
<com:TListItem Text="1 Star" />
- <com:TListItem Text="2 Star" />
- <com:TListItem Text="3 Star" />
- <com:TListItem Text="4 Star" />
- <com:TListItem Text="5 Star" />
+ <com:TListItem Text="2 Stars" />
+ <com:TListItem Text="3 Stars" />
+ <com:TListItem Text="4 Stars" />
+ <com:TListItem Text="5 Stars" />
</com:TActiveRatingList>
<br />
@@ -64,8 +76,9 @@ Loading...
</div>
-<com:TActiveButton ID="button1" Text="Enable List" OnClick="button1_clicked" />
-<com:TActiveButton ID="button2" Text="Set Index 3" OnClick="button2_clicked" />
+<com:TActiveButton ID="button1" Text="Enable" OnClick="button1_clicked" />
+<com:TActiveButton ID="button2" Text="Disable" OnClick="button2_clicked" />
+<com:TActiveButton ID="button5" Text="Index=3" OnClick="button5_clicked" />
<com:TJavascriptLogger />
diff --git a/tests/FunctionalTests/active-controls/protected/pages/RatingList.php b/tests/FunctionalTests/active-controls/protected/pages/RatingList.php index d31b6166..c6661182 100644 --- a/tests/FunctionalTests/active-controls/protected/pages/RatingList.php +++ b/tests/FunctionalTests/active-controls/protected/pages/RatingList.php @@ -4,7 +4,6 @@ class RatingList extends TPage {
function list1_oncallback($sender, $param)
{
- $sender->Enabled=false;
}
function button1_clicked($sender, $param)
@@ -14,9 +13,13 @@ class RatingList extends TPage function button2_clicked($sender, $param)
{
- $this->list1->SelectedIndex=3;
$this->list1->Enabled=false;
}
+
+ function button5_clicked($sender, $param)
+ {
+ $this->list1->SelectedIndex=3;
+ }
}
?>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/protected/pages/TInPlaceTextBoxTest.page b/tests/FunctionalTests/active-controls/protected/pages/TInPlaceTextBoxTest.page index 7010ca0f..cf43dea6 100644 --- a/tests/FunctionalTests/active-controls/protected/pages/TInPlaceTextBoxTest.page +++ b/tests/FunctionalTests/active-controls/protected/pages/TInPlaceTextBoxTest.page @@ -43,9 +43,9 @@ EditTriggerControlID="link1"
CssClass="textbox"
Text="Label 1">
- <prop:ActiveControl.ClientSide
- OnLoading="Element.show('loader')"
- OnComplete="Element.hide('loader')" />
+ <prop:ClientSide
+ OnLoading="$('loader').show()"
+ OnComplete="$('loader').hide()" />
</com:TInPlaceTextBox>
<com:TRequiredFieldValidator
diff --git a/tests/FunctionalTests/active-controls/protected/pages/TimeTriggeredCallbackTest.page b/tests/FunctionalTests/active-controls/protected/pages/TimeTriggeredCallbackTest.page index 36b3bc05..f7515a36 100644 --- a/tests/FunctionalTests/active-controls/protected/pages/TimeTriggeredCallbackTest.page +++ b/tests/FunctionalTests/active-controls/protected/pages/TimeTriggeredCallbackTest.page @@ -6,7 +6,7 @@ <com:TActiveLabel ID="label1" Text="ViewState Counter : " /> </div> <com:TTimeTriggeredCallback ID="timer1" Interval="0.1" OnCallback="tick"> - <prop:ActiveControl.ClientSide + <prop:ClientSide OnLoading="$('status').show()" OnComplete="$('status').hide()" /> </com:TTimeTriggeredCallback> diff --git a/tests/FunctionalTests/active-controls/tests/AutoCompleteTestCase.php b/tests/FunctionalTests/active-controls/tests/AutoCompleteTestCase.php index cb1a6604..96c0fb4b 100644 --- a/tests/FunctionalTests/active-controls/tests/AutoCompleteTestCase.php +++ b/tests/FunctionalTests/active-controls/tests/AutoCompleteTestCase.php @@ -9,12 +9,37 @@ class AutoCompleteTestCase extends SeleniumTestCase $this->assertText("label1", "Label 1"); - $this->type("textbox3", "Australia"); - $this->pause(800); + $this->keyPress("textbox3", 'a'); + $this->pause(1000); + $this->verifyTextPresent('Andorra'); + $this->keyPress("textbox3", 'u'); + $this->pause(1000); + $this->verifyTextPresent('Australia'); $this->click("heading"); //click somewhere else. + $this->waitForText("label1", "suggestion for au"); + $this->assertText("label1", "suggestion for au"); + $this->click("css=#textbox3_result ul li"); + $this->pause(800); + $this->assertText("label1", "Label 1: Austria"); + + $this->keyPress("textbox2", "c"); + $this->pause(800); + $this->keyPress("textbox2", "u"); + $this->pause(800); + $this->click('css=#textbox2_result ul li'); $this->pause(800); - $this->assertText("label1", "Label 1: Australia"); + $this->assertText("label1", "Label 1: Cuba"); + $this->keyPress("textbox2", ","); + + $this->keyPress("textbox2", "m"); + $this->pause(800); + + $this->keyPress("textbox2", "e"); + $this->pause(800); + $this->click('css=#textbox2_result ul li'); + $this->pause(800); + $this->assertText("label1", "Label 1: Cuba,Mexico"); } } |