From 7e002c23edc5fb5db70935591aa6adeda25fc7fb Mon Sep 17 00:00:00 2001
From: xue <>
Date: Sun, 2 Jul 2006 18:05:42 +0000
Subject: Merge from 3.0 branch till 1224.
---
.gitattributes | 5 +-
HISTORY | 6 +
demos/quickstart/protected/application.xml | 4 -
.../quickstart/protected/comments/CommentList.php | 58 -------
.../quickstart/protected/comments/CommentList.tpl | 105 -------------
.../protected/comments/QuickStartComments.php | 175 ---------------------
demos/quickstart/protected/comments/comments.db | Bin 6144 -> 0 bytes
demos/quickstart/protected/controls/Layout.tpl | 1 -
framework/Util/TLogRouter.php | 4 +-
.../Web/Javascripts/colorpicker/colorpicker.js | 4 +-
framework/Web/Javascripts/colorpicker/spacer.gif | Bin 0 -> 43 bytes
framework/Web/Javascripts/datepicker/datepicker.js | 8 +-
framework/Web/Javascripts/js/colorpicker.js | 4 +-
framework/Web/Javascripts/js/datepicker.js | 6 +-
framework/Web/UI/WebControls/TBaseValidator.php | 23 ++-
framework/Web/UI/WebControls/TCheckBox.php | 46 ++++--
framework/Web/UI/WebControls/THtmlArea.php | 2 +-
framework/Web/UI/WebControls/TRadioButton.php | 3 +
tests/FunctionalTests/index.php | 2 +-
.../tickets/protected/pages/Home.page | 3 +
.../tickets/protected/pages/Home.php | 34 ++++
.../tickets/protected/pages/Ticket200.page | 6 +
.../tickets/protected/pages/Ticket200.php | 16 ++
.../tickets/protected/pages/Ticket202.page | 19 +++
.../tickets/protected/pages/Ticket205.page | 26 +++
.../tickets/protected/pages/Ticket205.php | 11 ++
.../tickets/protected/pages/Ticket207.page | 24 +++
.../tickets/protected/pages/Ticket227.page | 4 +
.../tickets/protected/pages/Ticket246.page | 17 ++
.../tickets/tests/Ticket205TestCase.php | 23 +++
.../tickets/tests/Ticket207TestCase.php | 37 +++++
.../tickets/tests/Ticket227TestCase.php | 12 ++
.../tickets/tests/Ticket246TestCase.php | 12 ++
.../validators/protected/pages/Home.page | 3 +
.../validators/protected/pages/Home.php | 34 ++++
35 files changed, 359 insertions(+), 378 deletions(-)
delete mode 100644 demos/quickstart/protected/comments/CommentList.php
delete mode 100644 demos/quickstart/protected/comments/CommentList.tpl
delete mode 100644 demos/quickstart/protected/comments/QuickStartComments.php
delete mode 100644 demos/quickstart/protected/comments/comments.db
create mode 100755 framework/Web/Javascripts/colorpicker/spacer.gif
create mode 100755 tests/FunctionalTests/tickets/protected/pages/Home.page
create mode 100755 tests/FunctionalTests/tickets/protected/pages/Home.php
create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket200.page
create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket200.php
create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket202.page
create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket205.page
create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket205.php
create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket207.page
create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket227.page
create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket246.page
create mode 100644 tests/FunctionalTests/tickets/tests/Ticket205TestCase.php
create mode 100644 tests/FunctionalTests/tickets/tests/Ticket207TestCase.php
create mode 100644 tests/FunctionalTests/tickets/tests/Ticket227TestCase.php
create mode 100644 tests/FunctionalTests/tickets/tests/Ticket246TestCase.php
create mode 100755 tests/FunctionalTests/validators/protected/pages/Home.page
create mode 100755 tests/FunctionalTests/validators/protected/pages/Home.php
diff --git a/.gitattributes b/.gitattributes
index 04b42000..ea016ff1 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -696,10 +696,6 @@ demos/quickstart/index.php -text
demos/quickstart/index2.php -text
demos/quickstart/protected/.htaccess -text
demos/quickstart/protected/application.xml -text
-demos/quickstart/protected/comments/CommentList.php -text
-demos/quickstart/protected/comments/CommentList.tpl -text
-demos/quickstart/protected/comments/QuickStartComments.php -text
-demos/quickstart/protected/comments/comments.db -text
demos/quickstart/protected/controls/DocLink.php -text
demos/quickstart/protected/controls/Layout.php -text
demos/quickstart/protected/controls/Layout.tpl -text
@@ -1500,6 +1496,7 @@ framework/Web/Javascripts/colorpicker/colorpicker.js -text
framework/Web/Javascripts/colorpicker/default.css -text
framework/Web/Javascripts/colorpicker/hue.gif -text
framework/Web/Javascripts/colorpicker/slider.gif -text
+framework/Web/Javascripts/colorpicker/spacer.gif -text
framework/Web/Javascripts/colorpicker/target_black.gif -text
framework/Web/Javascripts/colorpicker/target_white.gif -text
framework/Web/Javascripts/datepicker/calendar.png -text
diff --git a/HISTORY b/HISTORY
index e3d35ac6..d2b8721f 100644
--- a/HISTORY
+++ b/HISTORY
@@ -13,11 +13,14 @@ Version 3.0.2 July 2, 2006
==========================
BUG: Ticket#182 - List and validator controls cause problem in child classes (Qiang)
BUG: Ticket#191 - Duplicated postbacks occur when using TButton with validators (Qiang)
+BUG: Ticket#207 - Validators ClientSide.OnError triggered twice (Wei)
BUG: Ticket#213 - PRADO Requirements Checker charset error (Qiang)
+BUG: Ticket#227 - Enabled property doesn't works with THtmlArea (Wei)
BUG: Ticket#234 - Postback target could be out of date (Qiang)
BUG: Ticket#239 - Ondeactivate handler for the first View of MultiView is always fired (Qiang)
BUG: Ticket#244 - redirect() needs absolute URL (Qiang)
BUG: Ticket#245 - getIsSecureConnection() is not working correctly (Qiang)
+BUG: Ticket#246 - TDatePicker wrong popup position in scrolled div (Wei)
BUG: Ticket#260 - Wrong value of a configuration option in setUseTransparentSessionID (Qiang)
CHG: ensureChildControls() is now invoked in TControl::initRecursive (Qiang)
CHG: Postback enabled control will always disable default client-side browser action. (Qiang)
@@ -28,12 +31,15 @@ ENH: Ticket#231 - Added TButton.ButtonType property to allow reset button (Qiang
ENH: Ticket#232 - Allow <%# %> and <%= %> embedded within property values (Qiang)
ENH: Ticket#256 - Datagrid columns can now be accessed via IDs (Qiang)
ENH: Ticket#257 - OnSelectedIndexChanged event of TDataList and TDataGrid now passes the original command parameter (Qiang)
+ENH: Ticket#262 - Added TCheckBox.Value property (Qiang)
ENH: TRepeater, TDataList and TDataGrid will store data indices in DataKeys if DataKeyField is not set. (Qiang)
ENH: Added TPageService.BasePageClass property (Qiang)
ENH: Added TDataGrid.EmptyTemplate property (Qiang)
ENH: Added paging feature to all TDataBoundControl-derived controls (Qiang)
+ENH: ClientSide.ObserveChanges="false" to only revalidate client side validator when control changes (Wei)
NEW: Added TPager (Qiang)
NEW: Added Dreamweaver taglib extension (Stanislav, Qiang)
+NEW: Prado Command line script to create a new project, see framework/prado-cli.php (Wei)
Version 3.0.1 June 4, 2006
==========================
diff --git a/demos/quickstart/protected/application.xml b/demos/quickstart/protected/application.xml
index 79ee4529..3e2374d8 100644
--- a/demos/quickstart/protected/application.xml
+++ b/demos/quickstart/protected/application.xml
@@ -16,12 +16,8 @@
- * <route class="TFileLogRoute" Categories="System.Web.UI" Levels="Warning" />
- * <route class="TEmailLogRoute" Categories="Application" Levels="Fatal" Emails="admin@pradosoft.com" />
+ *
+ *
*
* 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
Binary files /dev/null and b/framework/Web/Javascripts/colorpicker/spacer.gif 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.
@@ -634,6 +634,25 @@ class TClientSideValidatorOptions extends TClientSideOptions
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()
+ {
+ 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
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;
}
/**
@@ -133,6 +130,22 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl
$this->setViewState('Text',$value,'');
}
+ /**
+ * @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.
*/
@@ -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())==='')
diff --git a/tests/FunctionalTests/index.php b/tests/FunctionalTests/index.php
index ceba599a..c4b3123b 100644
--- a/tests/FunctionalTests/index.php
+++ b/tests/FunctionalTests/index.php
@@ -14,4 +14,4 @@ Prado Functional Test Suites
Comments - >
- ( Add your comments )
-
-
-Post a comment
-Note: - Please only use the comments in relation to this page for -
-- questions/critcisms/suggestions on the documentation,
- - small notes that can solve or clarify a particular problem or task.
-
- If you experience errors please file a ticket - or ask at the forum. - Please use the Prado wiki for longer pieces and detailed solutions. - -Comments will be periodically reviewed, integrated into the documentation and removed. - You may use markdown syntax in your comment.
- -Preview comment
-Preview comment
-