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 @@ - - - - \ No newline at end of file diff --git a/demos/quickstart/protected/comments/CommentList.php b/demos/quickstart/protected/comments/CommentList.php deleted file mode 100644 index 3bfb7239..00000000 --- a/demos/quickstart/protected/comments/CommentList.php +++ /dev/null @@ -1,58 +0,0 @@ - - * @version : $ Sat May 27 17:53:15 AZOST 2006 $ - * @package Demo.Quickstart.comments - * @since 3.0 - */ -class CommentList extends TTemplateControl -{ - private $_exclude = array( - 'Comments', - 'Markdown', - 'Search', - 'GettingStarted.Introduction'); - - private $_quickstart; - - public function onLoad($param) - { - parent::onLoad($param); - - $this->_quickstart = new QuickStartComments(); - - $page = $this->getService()->getRequestedPagePath(); - - $this->listComments($page); - } - - protected function listComments($page) - { - $this->comments->setDataSource($this->_quickstart->getComments($page)); - $this->comments->dataBind(); - } - - public function addComment_Clicked($sender, $param) - { - $page = $this->getService()->getRequestedPagePath(); - $this->_quickstart->addNewComment($page, - $this->email->getText(), $this->content->getText()); - $this->multiView1->setActiveViewIndex(1); - } - - public function setVisible($value) - { - $page = $this->getService()->getRequestedPagePath(); - if(in_array($page, $this->_exclude)) - parent::setVisible(false); - else - parent::setVisible($value); - } -} - -?> \ No newline at end of file diff --git a/demos/quickstart/protected/comments/CommentList.tpl b/demos/quickstart/protected/comments/CommentList.tpl deleted file mode 100644 index 06cddd1e..00000000 --- a/demos/quickstart/protected/comments/CommentList.tpl +++ /dev/null @@ -1,105 +0,0 @@ -
- - - -

Comments - > - ( Add your comments ) - -

-
- -
- <%# $this->ItemIndex+1 %> - - - DataItem['date_added']) %> /> - -
- - - <%# $this->DataItem['comment'] %> - - -
-
-
-
- - > - -
-

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.

- -
- - - - -
-
- - -
- -
-
- content->Text) %> > -
-

Preview comment

-
- - - <%= $this->content->Text %> - - -
-
-
-
- - -
-
-
- -
-
Thank you, your comment is quequed for moderation.
-
-

Preview comment

-
- - - <%= $this->content->Text %> - - -
-
-
-
-
-
\ No newline at end of file diff --git a/demos/quickstart/protected/comments/QuickStartComments.php b/demos/quickstart/protected/comments/QuickStartComments.php deleted file mode 100644 index 7b504caf..00000000 --- a/demos/quickstart/protected/comments/QuickStartComments.php +++ /dev/null @@ -1,175 +0,0 @@ - - * @version : $ Sat May 27 16:49:19 AZOST 2006 $ - * @package Demos.QuickStart.comments - * @since 3.0 - */ -class QuickStartComments -{ - /** - * @var string sqlite database source. - */ - private $_database; - /** - * @var sqlite connection. - */ - private $_connection; - - /** - * Sets the sqlite comment database file. - */ - public function __construct() - { - $this->_database = realpath(dirname(__FILE__).'/comments.db'); - } - - /** - * Closed the database connection. - */ - public function __destruct() - { - if(!is_null($this->_connection)) - sqlite_close($this->_connection); - } - - /** - * @return resource sqlite database connection. - */ - protected function getConnection() - { - if(is_null($this->_connection)) - $this->_connection = sqlite_open($this->_database); - return $this->_connection; - } - - /** - * Quote database input data. - */ - protected function quote($value) - { - return sqlite_escape_string($value); - } - - /** - * Executes an sqlite query. - * @param string SQL - * @return mixed query results. - */ - protected function query($sql) - { - return sqlite_query($this->getConnection(), $sql); - } - - /** - * Returns a row from the sqlite result. - * @param resource sqlite result - * @return array database record. - */ - protected function fetch($resource) - { - if($resource !== false) - return sqlite_fetch_array($resource); - else - return false; - } - - /** - * Fetch all the records for given SQL query. - * @param string SQL query. - * @return array result set. - */ - protected function fetchAll($sql) - { - $rs = $this->query($sql); - $rows = array(); - while($row = $this->fetch($rs)) - $rows[] = $row; - return $rows; - } - - /** - * Returns all the comments for a given page. - * @param string specific page comments - * @return array list of comments - */ - public function getComments($pageID) - { - $page = $this->quote($pageID); - $sql = "SELECT * FROM comments WHERE page='$page' AND approved = 1 ORDER BY date_added ASC"; - return $this->fetchAll($sql); - } - - /** - * Adds a new comment for moderation. - * @param string ID of the page to comment belongs - * @param string email address of the commenter - * @param string comment contents - */ - public function addNewComment($pageID, $email, $comment) - { - $page = $this->quote($pageID); - $email = $this->quote($email); - $comment = $this->quote($comment); - $date_added = time(); - $sql = <<query($sql); - } - - /** - * Update an existing comment. - * @param string comment ID - * @param string page ID - * @param string email address - * @param string updated comment. - */ - public function updateComment($commentID, $page, $email, $content) - { - $ID = intval($commentID); - $email = $this->quote($email); - $comment = $this->quote($content); - $page = $this->quote($page); - $sql = <<query($sql); - } - - /** - * Delete a comment. - * @param string comment ID - */ - public function deleteComment($commentID) - { - $ID = intval($commentID); - $this->query("DELETE FROM comments WHERE id=$ID"); - } - - /** - * @return array all the quequed comments. - */ - public function getQuequedComments() - { - return $this->fetchAll("SELECT * FROM comments WHERE approved != 1"); - } - - /** - * Approve a quequed comment. - * @param string comment ID. - */ - public function approveComment($commentID) - { - $ID = intval($commentID); - $this->query("UPDATE comments SET approved = 1 WHERE id=$ID"); - } -} - -?> \ No newline at end of file diff --git a/demos/quickstart/protected/comments/comments.db b/demos/quickstart/protected/comments/comments.db deleted file mode 100644 index b81d7123..00000000 Binary files a/demos/quickstart/protected/comments/comments.db and /dev/null differ diff --git a/demos/quickstart/protected/controls/Layout.tpl b/demos/quickstart/protected/controls/Layout.tpl index 733bf6e1..52ab5bc4 100644 --- a/demos/quickstart/protected/controls/Layout.tpl +++ b/demos/quickstart/protected/controls/Layout.tpl @@ -32,7 +32,6 @@
- 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, * - * <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
  • Tests of New Features (list of new features)
  • - \ No newline at end of file + diff --git a/tests/FunctionalTests/tickets/protected/pages/Home.page b/tests/FunctionalTests/tickets/protected/pages/Home.page new file mode 100755 index 00000000..d4ac162c --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Home.page @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Home.php b/tests/FunctionalTests/tickets/protected/pages/Home.php new file mode 100755 index 00000000..37804419 --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Home.php @@ -0,0 +1,34 @@ +getPageList(dirname(__FILE__),''); + $this->List->DataSource=$list; + $this->List->dataBind(); + } + + protected function getPageList($directory,$basePath) + { + $list=array(); + $folder=@opendir($directory); + while($entry=@readdir($folder)) + { + if($entry[0]==='.') + continue; + else if(is_file($directory.'/'.$entry)) + { + if(($page=basename($entry,'.page'))!==$entry && strpos($page,'.')===false) + $list['?page='.$basePath.$page]=$basePath.$page; + } + else + $list=array_merge($list,$this->getPageList($directory.'/'.$entry,$basePath.$entry.'.')); + } + closedir($folder); + return $list; + } +} + +?> \ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket200.page b/tests/FunctionalTests/tickets/protected/pages/Ticket200.page new file mode 100644 index 00000000..76c60f40 --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket200.page @@ -0,0 +1,6 @@ + + +


    + +


    +
    \ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket200.php b/tests/FunctionalTests/tickets/protected/pages/Ticket200.php new file mode 100644 index 00000000..a80a3b8a --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket200.php @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket202.page b/tests/FunctionalTests/tickets/protected/pages/Ticket202.page new file mode 100644 index 00000000..ae984c2d --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket202.page @@ -0,0 +1,19 @@ +<%@ MasterPage="" %> + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket205.page b/tests/FunctionalTests/tickets/protected/pages/Ticket205.page new file mode 100644 index 00000000..1481a227 --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket205.page @@ -0,0 +1,26 @@ + +

    TCustomValidator not enabling ControlCssClass or prop:ClientSide.OnError after postback.

    + + + + + +
    \ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket205.php b/tests/FunctionalTests/tickets/protected/pages/Ticket205.php new file mode 100644 index 00000000..6145af9a --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket205.php @@ -0,0 +1,11 @@ +IsValid = $this->textbox1->Text == "Prado"; + } +} + +?> \ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket207.page b/tests/FunctionalTests/tickets/protected/pages/Ticket207.page new file mode 100644 index 00000000..556c5aae --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket207.page @@ -0,0 +1,24 @@ + +

    Validators ClientSide.OnError triggered twice

    +

    Use ClientSide.ObseveChanges="false"

    +
    + +
    +
    + +
    + +

    Conditions

    +
    +	(TextBox? B is just there to prevent server submission)
    +	To verify try exactly this:
    +
    +	1. Enter nothing and click on submit : 1 error event will be triggered
    +	2. Enter something into TextBox? T and click on submit : no error event (ok)
    +	3. Delete your text from TextBox? T again and click on submit : error event will be triggered twice
    +
    +
    \ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket227.page b/tests/FunctionalTests/tickets/protected/pages/Ticket227.page new file mode 100644 index 00000000..ab481fa2 --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket227.page @@ -0,0 +1,4 @@ + +

    Disabled HTMLArea

    + +
    \ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket246.page b/tests/FunctionalTests/tickets/protected/pages/Ticket246.page new file mode 100644 index 00000000..e25a484b --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket246.page @@ -0,0 +1,17 @@ + +

    TDatePicker inside absolute DIV with scrollbar

    + +
    +

    + +

    + + + + +

    +
    +
    \ No newline at end of file diff --git a/tests/FunctionalTests/tickets/tests/Ticket205TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket205TestCase.php new file mode 100644 index 00000000..85785697 --- /dev/null +++ b/tests/FunctionalTests/tickets/tests/Ticket205TestCase.php @@ -0,0 +1,23 @@ +open("tickets/index.php?page=Ticket205"); + $this->assertTitle("Verifying Ticket 205"); + $this->assertNotVisible("{$base}validator1"); + + $this->type("{$base}textbox1", "test"); + $this->click("{$base}button1"); + $this->assertVisible("{$base}validator1"); + $this->assertAlert("error"); + + $this->type("{$base}textbox1", "Prado"); + $this->clickAndWait("{$base}button1"); + $this->assertNotVisible("{$base}validator1"); + } +} + +?> \ No newline at end of file diff --git a/tests/FunctionalTests/tickets/tests/Ticket207TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket207TestCase.php new file mode 100644 index 00000000..53ae6528 --- /dev/null +++ b/tests/FunctionalTests/tickets/tests/Ticket207TestCase.php @@ -0,0 +1,37 @@ +open('tickets/index.php?page=Ticket207'); + $this->assertTitle("Verifying Ticket 207"); + $this->assertNotVisible("{$base}validator1"); + $this->assertNotVisible("{$base}validator2"); + + $this->click("{$base}button1"); + $this->assertAlert('error on text1 fired'); + $this->assertVisible("{$base}validator1"); + $this->assertVisible("{$base}validator2"); + + $this->type("{$base}text1", 'test'); + $this->assertVisible("{$base}validator1"); + $this->assertVisible("{$base}validator2"); + + $this->click("{$base}button1"); + $this->assertNotVisible("{$base}validator1"); + $this->assertVisible("{$base}validator2"); + + $this->type("{$base}text1", ''); + $this->assertNotVisible("{$base}validator1"); + $this->assertVisible("{$base}validator2"); + + $this->click("{$base}button1"); + $this->assertAlert('error on text1 fired'); + $this->assertVisible("{$base}validator1"); + $this->assertVisible("{$base}validator2"); + } +} + +?> \ No newline at end of file diff --git a/tests/FunctionalTests/tickets/tests/Ticket227TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket227TestCase.php new file mode 100644 index 00000000..c0dd2a98 --- /dev/null +++ b/tests/FunctionalTests/tickets/tests/Ticket227TestCase.php @@ -0,0 +1,12 @@ +open('tickets/index.php?page=Ticket227'); + $this->assertTitle('Verifying Ticket 227'); + } +} + +?> \ No newline at end of file diff --git a/tests/FunctionalTests/tickets/tests/Ticket246TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket246TestCase.php new file mode 100644 index 00000000..8f07790e --- /dev/null +++ b/tests/FunctionalTests/tickets/tests/Ticket246TestCase.php @@ -0,0 +1,12 @@ +open('tickets/index.php?page=Ticket246'); + $this->assertTitle('Verifying Ticket 246'); + } +} + +?> \ No newline at end of file diff --git a/tests/FunctionalTests/validators/protected/pages/Home.page b/tests/FunctionalTests/validators/protected/pages/Home.page new file mode 100755 index 00000000..d4ac162c --- /dev/null +++ b/tests/FunctionalTests/validators/protected/pages/Home.page @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/tests/FunctionalTests/validators/protected/pages/Home.php b/tests/FunctionalTests/validators/protected/pages/Home.php new file mode 100755 index 00000000..37804419 --- /dev/null +++ b/tests/FunctionalTests/validators/protected/pages/Home.php @@ -0,0 +1,34 @@ +getPageList(dirname(__FILE__),''); + $this->List->DataSource=$list; + $this->List->dataBind(); + } + + protected function getPageList($directory,$basePath) + { + $list=array(); + $folder=@opendir($directory); + while($entry=@readdir($folder)) + { + if($entry[0]==='.') + continue; + else if(is_file($directory.'/'.$entry)) + { + if(($page=basename($entry,'.page'))!==$entry && strpos($page,'.')===false) + $list['?page='.$basePath.$page]=$basePath.$page; + } + else + $list=array_merge($list,$this->getPageList($directory.'/'.$entry,$basePath.$entry.'.')); + } + closedir($folder); + return $list; + } +} + +?> \ No newline at end of file -- cgit v1.2.3