summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorwei <>2006-10-06 03:46:05 +0000
committerwei <>2006-10-06 03:46:05 +0000
commitfe60cc221f922ea362826e2d00431c5df28fe85f (patch)
tree9c0449718a862a5b51d62c4ac9697db15c13863f /framework
parent9fee2935d91e92235b068632d3608c748ef41bfe (diff)
fixed #410 #412
Diffstat (limited to 'framework')
-rw-r--r--framework/TComponent.php4
-rw-r--r--framework/Web/Javascripts/extra/logger.js17
-rw-r--r--framework/Web/Javascripts/js/compressed/ajax.js20
-rw-r--r--framework/Web/Javascripts/js/compressed/logger.js14
-rw-r--r--framework/Web/Javascripts/js/compressed/prado.js4
-rw-r--r--framework/Web/Javascripts/js/debug/ajax.js32
-rw-r--r--framework/Web/Javascripts/js/debug/logger.js17
-rw-r--r--framework/Web/Javascripts/js/debug/prado.js4
-rw-r--r--framework/Web/Javascripts/prado/controls.js4
-rw-r--r--framework/Web/Javascripts/ratings/blocks.css11
-rw-r--r--framework/Web/Javascripts/ratings/blocks.pngbin28159 -> 27953 bytes
-rw-r--r--framework/Web/Javascripts/ratings/blocks_blank.gifbin0 -> 72 bytes
-rw-r--r--framework/Web/Javascripts/ratings/blocks_blank.pngbin227 -> 0 bytes
-rw-r--r--framework/Web/Javascripts/ratings/blocks_combined.gifbin0 -> 237 bytes
-rw-r--r--framework/Web/Javascripts/ratings/blocks_combined.pngbin453 -> 0 bytes
-rw-r--r--framework/Web/Javascripts/ratings/blocks_half.gifbin0 -> 94 bytes
-rw-r--r--framework/Web/Javascripts/ratings/blocks_half.pngbin247 -> 0 bytes
-rw-r--r--framework/Web/Javascripts/ratings/blocks_selected.gifbin0 -> 75 bytes
-rw-r--r--framework/Web/Javascripts/ratings/blocks_selected.pngbin245 -> 0 bytes
-rw-r--r--framework/Web/Javascripts/ratings/default.css12
-rw-r--r--framework/Web/Javascripts/ratings/default.pngbin64293 -> 52075 bytes
-rw-r--r--framework/Web/Javascripts/ratings/default_blank.gifbin0 -> 158 bytes
-rw-r--r--framework/Web/Javascripts/ratings/default_blank.pngbin841 -> 0 bytes
-rw-r--r--framework/Web/Javascripts/ratings/default_combined.gifbin0 -> 1001 bytes
-rw-r--r--framework/Web/Javascripts/ratings/default_combined.pngbin2672 -> 0 bytes
-rw-r--r--framework/Web/Javascripts/ratings/default_half.gifbin0 -> 610 bytes
-rw-r--r--framework/Web/Javascripts/ratings/default_half.pngbin857 -> 0 bytes
-rw-r--r--framework/Web/Javascripts/ratings/default_selected.gifbin0 -> 603 bytes
-rw-r--r--framework/Web/Javascripts/ratings/default_selected.pngbin831 -> 0 bytes
-rw-r--r--framework/Web/Javascripts/ratings/ratings.js32
-rw-r--r--framework/Web/UI/ActiveControls/TActiveButton.php8
-rw-r--r--framework/Web/UI/ActiveControls/TActiveCheckBox.php8
-rw-r--r--framework/Web/UI/ActiveControls/TActiveCheckBoxList.php8
-rw-r--r--framework/Web/UI/ActiveControls/TActiveCustomValidator.php74
-rw-r--r--framework/Web/UI/ActiveControls/TActiveDropDownList.php8
-rw-r--r--framework/Web/UI/ActiveControls/TActiveImageButton.php8
-rw-r--r--framework/Web/UI/ActiveControls/TActiveLinkButton.php8
-rw-r--r--framework/Web/UI/ActiveControls/TActiveListBox.php8
-rw-r--r--framework/Web/UI/ActiveControls/TActiveRadioButton.php8
-rw-r--r--framework/Web/UI/ActiveControls/TActiveRadioButtonList.php8
-rw-r--r--framework/Web/UI/ActiveControls/TActiveRatingList.php125
-rw-r--r--framework/Web/UI/ActiveControls/TActiveTextBox.php8
-rw-r--r--framework/Web/UI/ActiveControls/TCallback.php8
-rw-r--r--framework/Web/UI/WebControls/TBaseValidator.php12
-rw-r--r--framework/Web/UI/WebControls/TJavascriptLogger.php5
45 files changed, 367 insertions, 108 deletions
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
index 923cda09..0da75b19 100644
--- a/framework/Web/Javascripts/ratings/blocks.png
+++ b/framework/Web/Javascripts/ratings/blocks.png
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/blocks_blank.gif b/framework/Web/Javascripts/ratings/blocks_blank.gif
new file mode 100644
index 00000000..c0db17c2
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/blocks_blank.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/blocks_blank.png b/framework/Web/Javascripts/ratings/blocks_blank.png
deleted file mode 100644
index d5004d2d..00000000
--- a/framework/Web/Javascripts/ratings/blocks_blank.png
+++ /dev/null
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/blocks_combined.gif b/framework/Web/Javascripts/ratings/blocks_combined.gif
new file mode 100644
index 00000000..04e8f7b8
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/blocks_combined.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/blocks_combined.png b/framework/Web/Javascripts/ratings/blocks_combined.png
deleted file mode 100644
index 57c07672..00000000
--- a/framework/Web/Javascripts/ratings/blocks_combined.png
+++ /dev/null
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/blocks_half.gif b/framework/Web/Javascripts/ratings/blocks_half.gif
new file mode 100644
index 00000000..a9e23d7c
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/blocks_half.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/blocks_half.png b/framework/Web/Javascripts/ratings/blocks_half.png
deleted file mode 100644
index 344aa207..00000000
--- a/framework/Web/Javascripts/ratings/blocks_half.png
+++ /dev/null
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/blocks_selected.gif b/framework/Web/Javascripts/ratings/blocks_selected.gif
new file mode 100644
index 00000000..f743d27e
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/blocks_selected.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/blocks_selected.png b/framework/Web/Javascripts/ratings/blocks_selected.png
deleted file mode 100644
index dfdb6889..00000000
--- a/framework/Web/Javascripts/ratings/blocks_selected.png
+++ /dev/null
Binary files differ
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
index f9f380a9..17bc39a1 100644
--- a/framework/Web/Javascripts/ratings/default.png
+++ b/framework/Web/Javascripts/ratings/default.png
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/default_blank.gif b/framework/Web/Javascripts/ratings/default_blank.gif
new file mode 100644
index 00000000..0337ad16
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/default_blank.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/default_blank.png b/framework/Web/Javascripts/ratings/default_blank.png
deleted file mode 100644
index f857ff17..00000000
--- a/framework/Web/Javascripts/ratings/default_blank.png
+++ /dev/null
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/default_combined.gif b/framework/Web/Javascripts/ratings/default_combined.gif
new file mode 100644
index 00000000..fe02b446
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/default_combined.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/default_combined.png b/framework/Web/Javascripts/ratings/default_combined.png
deleted file mode 100644
index 1756f912..00000000
--- a/framework/Web/Javascripts/ratings/default_combined.png
+++ /dev/null
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/default_half.gif b/framework/Web/Javascripts/ratings/default_half.gif
new file mode 100644
index 00000000..ed214acd
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/default_half.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/default_half.png b/framework/Web/Javascripts/ratings/default_half.png
deleted file mode 100644
index 6c826054..00000000
--- a/framework/Web/Javascripts/ratings/default_half.png
+++ /dev/null
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/default_selected.gif b/framework/Web/Javascripts/ratings/default_selected.gif
new file mode 100644
index 00000000..98704fad
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/default_selected.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/default_selected.png b/framework/Web/Javascripts/ratings/default_selected.png
deleted file mode 100644
index e40d6b04..00000000
--- a/framework/Web/Javascripts/ratings/default_selected.png
+++ /dev/null
Binary files differ
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 &copy; 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}");
}
}