summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorxue <>2006-07-02 18:05:42 +0000
committerxue <>2006-07-02 18:05:42 +0000
commit7e002c23edc5fb5db70935591aa6adeda25fc7fb (patch)
tree846feb337405448cc1559c2e7b4ed6f85798e0c7 /framework
parent618293517861b69334cd470068199394120cd20a (diff)
Merge from 3.0 branch till 1224.
Diffstat (limited to 'framework')
-rw-r--r--framework/Util/TLogRouter.php4
-rw-r--r--framework/Web/Javascripts/colorpicker/colorpicker.js4
-rwxr-xr-xframework/Web/Javascripts/colorpicker/spacer.gifbin0 -> 43 bytes
-rw-r--r--framework/Web/Javascripts/datepicker/datepicker.js8
-rw-r--r--framework/Web/Javascripts/js/colorpicker.js4
-rw-r--r--framework/Web/Javascripts/js/datepicker.js6
-rw-r--r--framework/Web/UI/WebControls/TBaseValidator.php23
-rw-r--r--framework/Web/UI/WebControls/TCheckBox.php46
-rw-r--r--framework/Web/UI/WebControls/THtmlArea.php2
-rw-r--r--framework/Web/UI/WebControls/TRadioButton.php3
10 files changed, 70 insertions, 30 deletions
diff --git a/framework/Util/TLogRouter.php b/framework/Util/TLogRouter.php
index fe0d2964..a9d37b2f 100644
--- a/framework/Util/TLogRouter.php
+++ b/framework/Util/TLogRouter.php
@@ -22,8 +22,8 @@
* or an external configuration file specified by {@link setConfigFile ConfigFile}.
* The format is as follows,
* <code>
- * &lt;route class="TFileLogRoute" Categories="System.Web.UI" Levels="Warning" /&gt;
- * &lt;route class="TEmailLogRoute" Categories="Application" Levels="Fatal" Emails="admin@pradosoft.com" /&gt;
+ * <route class="TFileLogRoute" Categories="System.Web.UI" Levels="Warning" />
+ * <route class="TEmailLogRoute" Categories="Application" Levels="Fatal" Emails="admin@pradosoft.com" />
* </code>
* You can specify multiple routes with different filtering conditions and different
* targets, even if the routes are of the same type.
diff --git a/framework/Web/Javascripts/colorpicker/colorpicker.js b/framework/Web/Javascripts/colorpicker/colorpicker.js
index 06cfb037..acf5531c 100644
--- a/framework/Web/Javascripts/colorpicker/colorpicker.js
+++ b/framework/Web/Javascripts/colorpicker/colorpicker.js
@@ -68,7 +68,7 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
{
var constructor = mode == "Basic" ? "getBasicPickerContainer": "getFullPickerContainer"
this.element = this[constructor](this.options['ID'], this.options['Palette'])
- document.body.appendChild(this.element);
+ this.input.parentNode.appendChild(this.element);
this.element.style.display = "none";
if(Prado.Browser().ie)
@@ -90,7 +90,7 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
{
if(!this.showing)
{
- var pos = Position.cumulativeOffset(this.input);
+ var pos = Position.positionedOffset(this.input);
pos[1] += this.input.offsetHeight;
this.element.style.top = (pos[1]-1) + "px";
diff --git a/framework/Web/Javascripts/colorpicker/spacer.gif b/framework/Web/Javascripts/colorpicker/spacer.gif
new file mode 100755
index 00000000..fc256098
--- /dev/null
+++ b/framework/Web/Javascripts/colorpicker/spacer.gif
Binary files differ
diff --git a/framework/Web/Javascripts/datepicker/datepicker.js b/framework/Web/Javascripts/datepicker/datepicker.js
index 11bee07e..4525c1ba 100644
--- a/framework/Web/Javascripts/datepicker/datepicker.js
+++ b/framework/Web/Javascripts/datepicker/datepicker.js
@@ -247,10 +247,10 @@ Prado.WebUI.TDatePicker.prototype =
this.iePopUp.style.position = "absolute"
this.iePopUp.scrolling="no"
this.iePopUp.frameBorder="0"
- document.body.appendChild(this.iePopUp);
+ this.control.parentNode.appendChild(this.iePopUp);
}
- document.body.appendChild(this._calDiv);
+ this.control.parentNode.appendChild(this._calDiv);
this.update();
this.updateHeader();
@@ -542,8 +542,8 @@ Prado.WebUI.TDatePicker.prototype =
if(!this.showing)
{
- var pos = Position.cumulativeOffset(this.control);
-
+ var pos = Position.positionedOffset(this.control);
+
pos[1] += this.getDatePickerOffsetHeight();
this._calDiv.style.display = "block";
diff --git a/framework/Web/Javascripts/js/colorpicker.js b/framework/Web/Javascripts/js/colorpicker.js
index 47949239..8429b5e6 100644
--- a/framework/Web/Javascripts/js/colorpicker.js
+++ b/framework/Web/Javascripts/js/colorpicker.js
@@ -33,7 +33,7 @@ Event.observe(this.button,"click",this._buttonOnClick);Event.observe(this.input,
{var mode=this.options['Mode'];if(this.element==null)
{var constructor=mode=="Basic"?"getBasicPickerContainer":"getFullPickerContainer"
this.element=this[constructor](this.options['ID'],this.options['Palette'])
-document.body.appendChild(this.element);this.element.style.display="none";if(Prado.Browser().ie)
+this.input.parentNode.appendChild(this.element);this.element.style.display="none";if(Prado.Browser().ie)
{this.iePopUp=document.createElement('iframe');this.iePopUp.src=Prado.WebUI.TColorPicker.UIImages['button.gif'];this.iePopUp.style.position="absolute"
this.iePopUp.scrolling="no"
this.iePopUp.frameBorder="0"
@@ -42,7 +42,7 @@ if(mode=="Full")
this.initializeFullPicker();}
this.show(mode);},show:function(type)
{if(!this.showing)
-{var pos=Position.cumulativeOffset(this.input);pos[1]+=this.input.offsetHeight;this.element.style.top=(pos[1]-1)+"px";this.element.style.left=pos[0]+"px";this.element.style.display="block";this.ieHack(type);this._documentClickEvent=this.hideOnClick.bindEvent(this,type);this._documentKeyDownEvent=this.keyPressed.bindEvent(this,type);Event.observe(document.body,"click",this._documentClickEvent);Event.observe(document,"keydown",this._documentKeyDownEvent);this.showing=true;if(type=="Full")
+{var pos=Position.positionedOffset(this.input);pos[1]+=this.input.offsetHeight;this.element.style.top=(pos[1]-1)+"px";this.element.style.left=pos[0]+"px";this.element.style.display="block";this.ieHack(type);this._documentClickEvent=this.hideOnClick.bindEvent(this,type);this._documentKeyDownEvent=this.keyPressed.bindEvent(this,type);Event.observe(document.body,"click",this._documentClickEvent);Event.observe(document,"keydown",this._documentKeyDownEvent);this.showing=true;if(type=="Full")
{this.observeMouseMovement();var color=Rico.Color.createFromHex(this.input.value);this.inputs.oldColor.style.backgroundColor=color.asHex();this.setColor(color,true);}}},hide:function(event)
{if(this.showing)
{if(this.iePopUp)
diff --git a/framework/Web/Javascripts/js/datepicker.js b/framework/Web/Javascripts/js/datepicker.js
index 090f3cbd..bbf81293 100644
--- a/framework/Web/Javascripts/js/datepicker.js
+++ b/framework/Web/Javascripts/js/datepicker.js
@@ -22,8 +22,8 @@ div=document.createElement("div");div.className="calendarFooter";this._calDiv.ap
{this.iePopUp=document.createElement('iframe');this.iePopUp.src=Prado.WebUI.TDatePicker.spacer;this.iePopUp.style.position="absolute"
this.iePopUp.scrolling="no"
this.iePopUp.frameBorder="0"
-document.body.appendChild(this.iePopUp);}
-document.body.appendChild(this._calDiv);this.update();this.updateHeader();this.ieHack(true);previousMonth.hideFocus=true;nextMonth.hideFocus=true;todayButton.hideFocus=true;Event.observe(previousMonth,"click",this.prevMonth.bindEvent(this));Event.observe(nextMonth,"click",this.nextMonth.bindEvent(this));Event.observe(todayButton,"click",this.selectToday.bindEvent(this));Event.observe(this._monthSelect,"change",this.monthSelect.bindEvent(this));Event.observe(this._yearSelect,"change",this.yearSelect.bindEvent(this));Event.observe(this._calDiv,"mousewheel",this.mouseWheelChange.bindEvent(this));Event.observe(calendarBody,"click",this.selectDate.bindEvent(this));Prado.Element.focus(this.control);},ieHack:function(cleanup)
+this.control.parentNode.appendChild(this.iePopUp);}
+this.control.parentNode.appendChild(this._calDiv);this.update();this.updateHeader();this.ieHack(true);previousMonth.hideFocus=true;nextMonth.hideFocus=true;todayButton.hideFocus=true;Event.observe(previousMonth,"click",this.prevMonth.bindEvent(this));Event.observe(nextMonth,"click",this.nextMonth.bindEvent(this));Event.observe(todayButton,"click",this.selectToday.bindEvent(this));Event.observe(this._monthSelect,"change",this.monthSelect.bindEvent(this));Event.observe(this._yearSelect,"change",this.yearSelect.bindEvent(this));Event.observe(this._calDiv,"mousewheel",this.mouseWheelChange.bindEvent(this));Event.observe(calendarBody,"click",this.selectDate.bindEvent(this));Prado.Element.focus(this.control);},ieHack:function(cleanup)
{if(this.iePopUp)
{this.iePopUp.style.display="block";this.iePopUp.style.top=(this._calDiv.offsetTop-1)+"px";this.iePopUp.style.left=(this._calDiv.offsetLeft-1)+"px";this.iePopUp.style.width=Math.abs(this._calDiv.offsetWidth-2)+"px";this.iePopUp.style.height=(this._calDiv.offsetHeight+1)+"px";if(cleanup)this.iePopUp.style.display="none";}},keyPressed:function(ev)
{if(!this.showing)return;if(!ev)ev=document.parentWindow.event;var kc=ev.keyCode!=null?ev.keyCode:ev.charCode;if(kc==Event.KEY_RETURN||kc==Event.KEY_SPACEBAR||kc==Event.KEY_TAB)
@@ -92,7 +92,7 @@ this.onChange();},getElement:function()
{if(this.options.InputMode=="TextBox")
return this.control.offsetHeight;var control=Prado.WebUI.TDatePicker.getDayListControl(this.control);if(control)return control.offsetHeight;var control=Prado.WebUI.TDatePicker.getMonthListControl(this.control);if(control)return control.offsetHeight;var control=Prado.WebUI.TDatePicker.getYearListControl(this.control);if(control)return control.offsetHeight;return 0;},show:function()
{this.create();if(!this.showing)
-{var pos=Position.cumulativeOffset(this.control);pos[1]+=this.getDatePickerOffsetHeight();this._calDiv.style.display="block";this._calDiv.style.top=(pos[1]-1)+"px";this._calDiv.style.left=pos[0]+"px";this.ieHack(false);this.documentClickEvent=this.hideOnClick.bindEvent(this);this.documentKeyDownEvent=this.keyPressed.bindEvent(this);Event.observe(document.body,"click",this.documentClickEvent);var date=this.getDateFromInput();if(date)
+{var pos=Position.positionedOffset(this.control);pos[1]+=this.getDatePickerOffsetHeight();this._calDiv.style.display="block";this._calDiv.style.top=(pos[1]-1)+"px";this._calDiv.style.left=pos[0]+"px";this.ieHack(false);this.documentClickEvent=this.hideOnClick.bindEvent(this);this.documentKeyDownEvent=this.keyPressed.bindEvent(this);Event.observe(document.body,"click",this.documentClickEvent);var date=this.getDateFromInput();if(date)
{this.selectedDate=date;this.setSelectedDate(date);}
Event.observe(document,"keydown",this.documentKeyDownEvent);this.showing=true;}},getDateFromInput:function()
{if(this.options.InputMode=="TextBox")
diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php
index a0801d4c..9366de62 100644
--- a/framework/Web/UI/WebControls/TBaseValidator.php
+++ b/framework/Web/UI/WebControls/TBaseValidator.php
@@ -124,7 +124,7 @@ abstract class TBaseValidator extends TLabel implements IValidator
}
/**
- * Adds attributes to renderer. Calls parent implementation and renders the
+ * Adds attributes to renderer. Calls parent implementation and renders the
* client control scripts.
* @param THtmlWriter the renderer
*/
@@ -237,7 +237,7 @@ abstract class TBaseValidator extends TLabel implements IValidator
$this->registerClientScriptValidator();
$this->updateControlCssClass();
}
-
+
/**
* Update the ControlToValidate component's css class depending
* if the ControlCssClass property is set, and whether this is valid.
@@ -635,6 +635,25 @@ class TClientSideValidatorOptions extends TClientSideOptions
}
/**
+ * @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()
+ {
+ if(($option=$this->getOption('ObserveChanges'))!==null)
+ return $option;
+ else
+ return true;
+ }
+
+ /**
* 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.
diff --git a/framework/Web/UI/WebControls/TCheckBox.php b/framework/Web/UI/WebControls/TCheckBox.php
index 6fe562c9..04733f95 100644
--- a/framework/Web/UI/WebControls/TCheckBox.php
+++ b/framework/Web/UI/WebControls/TCheckBox.php
@@ -60,13 +60,10 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl
public function loadPostData($key,$values)
{
$checked=$this->getChecked();
- if(isset($values[$key])!=$checked)
- {
- $this->setChecked(!$checked);
- return true;
- }
- else
- return false;
+ if($newChecked=isset($values[$key]))
+ $this->setValue($values[$key]);
+ $this->setChecked($newChecked);
+ return $newChecked!==$checked;
}
/**
@@ -134,6 +131,22 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl
}
/**
+ * @return string the value of the checkbox. Defaults to empty.
+ */
+ public function getValue()
+ {
+ return $this->getViewState('Value','');
+ }
+
+ /**
+ * @param string the value of the checkbox
+ */
+ public function setValue($value)
+ {
+ $this->setViewState('Value',$value,'');
+ }
+
+ /**
* @return string the alignment (Left or Right) of the text caption, defaults to Right.
*/
public function getTextAlign()
@@ -309,13 +322,18 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl
*/
protected function getValueAttribute()
{
- $attributes=$this->getViewState('InputAttributes',null);
- if($attributes && $attributes->contains('value'))
- return $attributes->itemAt('value');
- else if($this->hasAttribute('value'))
- return $this->getAttribute('value');
+ if(($value=$this->getValue())!=='')
+ return $value;
else
- return '';
+ {
+ $attributes=$this->getViewState('InputAttributes',null);
+ if($attributes && $attributes->contains('value'))
+ return $attributes->itemAt('value');
+ else if($this->hasAttribute('value'))
+ return $this->getAttribute('value');
+ else
+ return '';
+ }
}
/**
@@ -345,7 +363,7 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl
if($clientID!=='')
$writer->addAttribute('id',$clientID);
$writer->addAttribute('type','checkbox');
- if(($value = $this->getValueAttribute()) !== '')
+ if(($value=$this->getValueAttribute())!=='')
$writer->addAttribute('value',$value);
if(!empty($onclick))
$writer->addAttribute('onclick',$onclick);
diff --git a/framework/Web/UI/WebControls/THtmlArea.php b/framework/Web/UI/WebControls/THtmlArea.php
index 09f8328c..2a1e311d 100644
--- a/framework/Web/UI/WebControls/THtmlArea.php
+++ b/framework/Web/UI/WebControls/THtmlArea.php
@@ -219,7 +219,7 @@ class THtmlArea extends TTextBox
*/
protected function addAttributesToRender($writer)
{
- if($this->getEnableVisualEdit())
+ if($this->getEnableVisualEdit() && $this->getEnabled(true))
{
$writer->addAttribute('id',$this->getClientID());
$this->registerEditorClientScript($writer);
diff --git a/framework/Web/UI/WebControls/TRadioButton.php b/framework/Web/UI/WebControls/TRadioButton.php
index bb3e0658..2bbdf22e 100644
--- a/framework/Web/UI/WebControls/TRadioButton.php
+++ b/framework/Web/UI/WebControls/TRadioButton.php
@@ -101,6 +101,9 @@ class TRadioButton extends TCheckBox
$this->setViewState('GroupName',$value,'');
}
+ /**
+ * @return string the value attribute to be rendered
+ */
protected function getValueAttribute()
{
if(($value=parent::getValueAttribute())==='')