* @link http://www.pradosoft.com/
- * @copyright Copyright © 2005-2008 PradoSoft
+ * @copyright Copyright © 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web.UI.WebControls
@@ -218,7 +218,7 @@ class TSlider extends TWebControl implements IPostBackDataHandler, IDataRenderer
public function setValues($value)
{
$this->setViewState('Values', TPropertyValue::ensureArray($value), array());
- }
+ }
/**
* @return boolean a value indicating whether an automatic postback to the server
@@ -488,7 +488,7 @@ class TSlider extends TWebControl implements IPostBackDataHandler, IDataRenderer
// Add max if it's not in the array because of step
if (!in_array($maxValue, $values)) $values[]=$maxValue;
}
- $options['values'] = TJavascript::Encode($values,false);
+ $options['values'] = TJavaScript::Encode($values,false);
if($this->_clientScript!==null)
$options = array_merge($options,$this->_clientScript->getOptions()->toArray());
return $options;
@@ -572,4 +572,3 @@ class TSliderDirection extends TEnumerable
}
-?>
diff --git a/framework/Web/UI/WebControls/TStatements.php b/framework/Web/UI/WebControls/TStatements.php
index 09c03cb9..d07e68a1 100644
--- a/framework/Web/UI/WebControls/TStatements.php
+++ b/framework/Web/UI/WebControls/TStatements.php
@@ -61,4 +61,3 @@ class TStatements extends TControl
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TStyle.php b/framework/Web/UI/WebControls/TStyle.php
index c81a6db9..7cb1d8c8 100644
--- a/framework/Web/UI/WebControls/TStyle.php
+++ b/framework/Web/UI/WebControls/TStyle.php
@@ -891,4 +891,3 @@ class TTableGridLines extends TEnumerable
const Both='Both';
}
-?>
diff --git a/framework/Web/UI/WebControls/TTable.php b/framework/Web/UI/WebControls/TTable.php
index 9fa9130d..57efa7f7 100644
--- a/framework/Web/UI/WebControls/TTable.php
+++ b/framework/Web/UI/WebControls/TTable.php
@@ -408,4 +408,3 @@ class TTableCaptionAlign extends TEnumerable
const Right='Right';
}
-?>
diff --git a/framework/Web/UI/WebControls/TTableCell.php b/framework/Web/UI/WebControls/TTableCell.php
index 10d4f457..8bc83c52 100644
--- a/framework/Web/UI/WebControls/TTableCell.php
+++ b/framework/Web/UI/WebControls/TTableCell.php
@@ -220,4 +220,3 @@ class TTableCell extends TWebControl implements IDataRenderer
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TTableFooterRow.php b/framework/Web/UI/WebControls/TTableFooterRow.php
index f3c35dc3..dd0de143 100644
--- a/framework/Web/UI/WebControls/TTableFooterRow.php
+++ b/framework/Web/UI/WebControls/TTableFooterRow.php
@@ -45,4 +45,3 @@ class TTableFooterRow extends TTableRow
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TTableHeaderCell.php b/framework/Web/UI/WebControls/TTableHeaderCell.php
index a1a8919a..1e18cee3 100644
--- a/framework/Web/UI/WebControls/TTableHeaderCell.php
+++ b/framework/Web/UI/WebControls/TTableHeaderCell.php
@@ -122,4 +122,3 @@ class TTableHeaderScope extends TEnumerable
const Column='Column';
}
-?>
diff --git a/framework/Web/UI/WebControls/TTableHeaderRow.php b/framework/Web/UI/WebControls/TTableHeaderRow.php
index fa7e4515..7b8488bd 100644
--- a/framework/Web/UI/WebControls/TTableHeaderRow.php
+++ b/framework/Web/UI/WebControls/TTableHeaderRow.php
@@ -45,4 +45,3 @@ class TTableHeaderRow extends TTableRow
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TTableRow.php b/framework/Web/UI/WebControls/TTableRow.php
index be93529e..c70f28dd 100644
--- a/framework/Web/UI/WebControls/TTableRow.php
+++ b/framework/Web/UI/WebControls/TTableRow.php
@@ -206,4 +206,3 @@ class TTableRowSection extends TEnumerable
const Footer='Footer';
}
-?>
diff --git a/framework/Web/UI/WebControls/TTemplateColumn.php b/framework/Web/UI/WebControls/TTemplateColumn.php
index de4bc2ef..21190f23 100644
--- a/framework/Web/UI/WebControls/TTemplateColumn.php
+++ b/framework/Web/UI/WebControls/TTemplateColumn.php
@@ -254,4 +254,3 @@ class TTemplateColumn extends TDataGridColumn
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TTextBox.php b/framework/Web/UI/WebControls/TTextBox.php
index 3c3e6d0e..4e6a66e9 100644
--- a/framework/Web/UI/WebControls/TTextBox.php
+++ b/framework/Web/UI/WebControls/TTextBox.php
@@ -67,6 +67,7 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
*/
private $_safeText;
private $_dataChanged=false;
+ private $_isValid=true;
/**
* @return string tag name of the textbox
@@ -243,6 +244,23 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
return $this->getText();
}
+ /**
+ * Returns true if this control validated successfully.
+ * Defaults to true.
+ * @return bool wether this control validated successfully.
+ */
+ public function getIsValid()
+ {
+ return $this->_isValid;
+ }
+ /**
+ * @param bool wether this control is valid.
+ */
+ public function setIsValid($value)
+ {
+ $this->_isValid=TPropertyValue::ensureBoolean($value);
+ }
+
/**
* Raises OnTextChanged event.
* This method is invoked when the value of the {@link getText Text}
@@ -618,4 +636,3 @@ class TTextBoxAutoCompleteType extends TEnumerable
const Search='Search';
}
-?>
diff --git a/framework/Web/UI/WebControls/TTextHighlighter.php b/framework/Web/UI/WebControls/TTextHighlighter.php
index 0356c4e7..890deb05 100644
--- a/framework/Web/UI/WebControls/TTextHighlighter.php
+++ b/framework/Web/UI/WebControls/TTextHighlighter.php
@@ -198,4 +198,3 @@ class TTextHighlighterLineNumberStyle extends TEnumerable
const Li='Li';
const Table='Table';
}
-?>
diff --git a/framework/Web/UI/WebControls/TTextProcessor.php b/framework/Web/UI/WebControls/TTextProcessor.php
index ccb78196..26dab754 100644
--- a/framework/Web/UI/WebControls/TTextProcessor.php
+++ b/framework/Web/UI/WebControls/TTextProcessor.php
@@ -84,4 +84,3 @@ abstract class TTextProcessor extends TWebControl
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TValidationSummary.php b/framework/Web/UI/WebControls/TValidationSummary.php
index 4e0e0e50..95679e15 100644
--- a/framework/Web/UI/WebControls/TValidationSummary.php
+++ b/framework/Web/UI/WebControls/TValidationSummary.php
@@ -504,4 +504,3 @@ class TValidationSummaryDisplayStyle extends TEnumerable
const Fixed='Fixed';
}
-?>
diff --git a/framework/Web/UI/WebControls/TWebControl.php b/framework/Web/UI/WebControls/TWebControl.php
index 829a9d03..2e1899ad 100644
--- a/framework/Web/UI/WebControls/TWebControl.php
+++ b/framework/Web/UI/WebControls/TWebControl.php
@@ -432,4 +432,3 @@ class TWebControl extends TControl implements IStyleable
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TWebControlAdapter.php b/framework/Web/UI/WebControls/TWebControlAdapter.php
index 35e157af..a99afe7f 100644
--- a/framework/Web/UI/WebControls/TWebControlAdapter.php
+++ b/framework/Web/UI/WebControls/TWebControlAdapter.php
@@ -69,4 +69,3 @@ class TWebControlAdapter extends TControlAdapter
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TWizard.php b/framework/Web/UI/WebControls/TWizard.php
index 1f9e886b..774096f7 100644
--- a/framework/Web/UI/WebControls/TWizard.php
+++ b/framework/Web/UI/WebControls/TWizard.php
@@ -2153,4 +2153,3 @@ class TWizardStepType extends TEnumerable
const Finish='Finish';
}
-?>
diff --git a/framework/Web/UI/WebControls/TWizardNavigationButtonStyle.php b/framework/Web/UI/WebControls/TWizardNavigationButtonStyle.php
index 6eebce74..54d585c4 100644
--- a/framework/Web/UI/WebControls/TWizardNavigationButtonStyle.php
+++ b/framework/Web/UI/WebControls/TWizardNavigationButtonStyle.php
@@ -153,4 +153,3 @@ class TWizardNavigationButtonStyle extends TStyle
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TXmlTransform.php b/framework/Web/UI/WebControls/TXmlTransform.php
index ab49ae61..991aed39 100644
--- a/framework/Web/UI/WebControls/TXmlTransform.php
+++ b/framework/Web/UI/WebControls/TXmlTransform.php
@@ -191,4 +191,3 @@ class TXmlTransform extends TControl {
}
}
-?>
diff --git a/framework/Web/UI/WebControls/assets/captcha.php b/framework/Web/UI/WebControls/assets/captcha.php
index bff2f61a..8c9ff0a3 100644
--- a/framework/Web/UI/WebControls/assets/captcha.php
+++ b/framework/Web/UI/WebControls/assets/captcha.php
@@ -221,4 +221,3 @@ function morphImage($image,$width,$height)
}
}
-?>
diff --git a/framework/Xml/TXmlDocument.php b/framework/Xml/TXmlDocument.php
index 9325c62a..d7ddf187 100644
--- a/framework/Xml/TXmlDocument.php
+++ b/framework/Xml/TXmlDocument.php
@@ -547,4 +547,3 @@ class TXmlElementList extends TList
}
}
-?>
diff --git a/framework/interfaces.php b/framework/interfaces.php
index 634a6e51..2012dff7 100644
--- a/framework/interfaces.php
+++ b/framework/interfaces.php
@@ -379,4 +379,3 @@ interface IDataRenderer
*/
public function setData($value);
}
-?>
diff --git a/framework/prado.php b/framework/prado.php
index 4690617c..3777f763 100644
--- a/framework/prado.php
+++ b/framework/prado.php
@@ -56,4 +56,3 @@ require_once(dirname(__FILE__).'/TApplication.php');
*/
require_once(dirname(__FILE__).'/TShellApplication.php');
-?>
diff --git a/index.html b/index.html
index 07f10f4e..4a323035 100644
--- a/index.html
+++ b/index.html
@@ -1,172 +1,172 @@
-
-
-
-PRADO Framework for PHP 5
-
-
-
-
-
-PRADO Framework for PHP 5
-Version 3.1.3, To Be Released
-Copyright© 2004-2008 by Prado Software
-All Rights Reserved.
-
-
-
-PRADO is a component-based and event-driven framework for Web application development in PHP 5.
-
-
-PRADO is best suitable for creating Web applications that are highly user-interactive. It can be used to develop systems as simple as a blog system to those as complex as a content management system (CMS) or a complete e-commerce solution. Because PRADO promotes object-oriented programming (OOP) through its component-based methodology, it fits extremely well for team work and enterprise development. Its event-driven programming pattern helps developers gain better focus on business logic rather than distracted by various tedious and repetitive low-level coding handling.
-
-
-PRADO comes with many features that can cut down development time signficantly. In particular, it provides a rich set of pluggable Web controls, complete database support including both active record and complex object mapper, seamless AJAX support, theme and skin, internationalization and localization, various caching solutions, security measures, and many other features that are seldom found in other programming frameworks.
-
-
-Developers who have sufficient OOP experience will find PRADO is easy to learn and understand. In fact, PRADO shares many similarities with ASP.NET and other RAD kits for Windows GUI development, such as Borland Delphi and Microsoft Visual Basic.
-
-
-Requirements
-
-The sole requirement for PRADO is PHP 5.1.0 or higher. Please run requirement checker to obtain more detailed requirement information.
-
-
-PRADO has been tested with Apache 2.0 on both Windows XP and RedHat Linux.
-
-
-Installation
-
-After downloading the latest PRADO release file, unpack it to a Web-accessible directory. The installation is done! You will see the following subdirectories:
-
-
- - framework - contains the core code of PRADO. This is the only directory that you will need in order to deploy with your PRADO application. It does NOT need to reside in a Web-accessible directory.
- - demos - contains PRADO demo applications.
- - docs - contains tutorials and documentation about PRADO.
- - editors - contains editor plugins for PRADO.
- - requirements - contains a requirement checker script that can check if your system can run PRADO applications.
- - tests - contains test tools that can be used to do unit test and functionality test about Web applications.
-
-
-Included Demos
-
-
-Editor Support
-
-A Macromedia Dreamweaver extension can be found under editors/Dreamweaver.
-This extension contains a tag library that enables Dreamweaver to auto-complete
-PRADO component tags when you use it to edit PRADO templates.
-
-
-Documentation
-
-
-Credits
-
-Prado v3 Developer Team
-
-
-Translations
-
-- Indonesian: Zaenal Mutaqin
-- French: Eric Marchetti
-- Japanese: Yoshinari Ueyama, Shinya Kawamura, Tsuchimoto Hiroki
-
-
-Prado v2 Maintenance Team
-
-
-Past Team Members
-
-
-Special Credits To
-
-- Stever for providing an Apple G3 notebook for testing safari browser issues.
-- Stanislav Yordanov - the script of generating Dreameweaver extension for PRADO
-- Andres Adolfo Testi - original concept and naming for Active Controls.
-- Jack Slocum - inspiration for the quickstart commenting system.
-- Cesar Ramos - Active Record driver for IBM DB2.
-- Sergey Morkovkin - TKeyboard control
-- Tomasz Wolny - TTabPanel control
-- All PRADO users - great suggestions, feedback and support
-- ASP.NET 2.0 for its great inspiration and reference
-- All third-party work used in PRADO
-
-
-
-License
-
-The PRADO framework and the included demos are free software. They are released under
-the terms of the following BSD License.
-
-
-Copyright 2004-2008 by The PRADO Group (http://www.pradosoft.com)
-All rights reserved.
-
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
-
-
-- Redistributions of source code must retain the above copyright notice, this
-list of conditions and the following disclaimer.
-- Redistributions in binary form must reproduce the above copyright notice,
-this list of conditions and the following disclaimer in the documentation and/or
-other materials provided with the distribution.
-- Neither the name of the PRADO Group nor the names of its contributors may be
-used to endorse or promote products derived from this software without specific
-prior written permission.
-
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
-OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-
-
-
+
+
+
+PRADO Framework for PHP 5
+
+
+
+
+
+PRADO Framework for PHP 5
+Version 3.2, To be released
+Copyright© 2004-2008 by Prado Software
+All Rights Reserved.
+
+
+
+PRADO is a component-based and event-driven framework for Web application development in PHP 5.
+
+
+PRADO is best suitable for creating Web applications that are highly user-interactive. It can be used to develop systems as simple as a blog system to those as complex as a content management system (CMS) or a complete e-commerce solution. Because PRADO promotes object-oriented programming (OOP) through its component-based methodology, it fits extremely well for team work and enterprise development. Its event-driven programming pattern helps developers gain better focus on business logic rather than distracted by various tedious and repetitive low-level coding handling.
+
+
+PRADO comes with many features that can cut down development time signficantly. In particular, it provides a rich set of pluggable Web controls, complete database support including both active record and complex object mapper, seamless AJAX support, theme and skin, internationalization and localization, various caching solutions, security measures, and many other features that are seldom found in other programming frameworks.
+
+
+Developers who have sufficient OOP experience will find PRADO is easy to learn and understand. In fact, PRADO shares many similarities with ASP.NET and other RAD kits for Windows GUI development, such as Borland Delphi and Microsoft Visual Basic.
+
+
+Requirements
+
+The sole requirement for PRADO is PHP 5.1.0 or higher. Please run requirement checker to obtain more detailed requirement information.
+
+
+PRADO has been tested with Apache 2.0 on both Windows XP and RedHat Linux.
+
+
+Installation
+
+After downloading the latest PRADO release file, unpack it to a Web-accessible directory. The installation is done! You will see the following subdirectories:
+
+
+ - framework - contains the core code of PRADO. This is the only directory that you will need in order to deploy with your PRADO application. It does NOT need to reside in a Web-accessible directory.
+ - demos - contains PRADO demo applications.
+ - docs - contains tutorials and documentation about PRADO.
+ - editors - contains editor plugins for PRADO.
+ - requirements - contains a requirement checker script that can check if your system can run PRADO applications.
+ - tests - contains test tools that can be used to do unit test and functionality test about Web applications.
+
+
+Included Demos
+
+
+Editor Support
+
+A Macromedia Dreamweaver extension can be found under editors/Dreamweaver.
+This extension contains a tag library that enables Dreamweaver to auto-complete
+PRADO component tags when you use it to edit PRADO templates.
+
+
+Documentation
+
+
+Credits
+
+Prado v3 Developer Team
+
+
+Translations
+
+- Indonesian: Zaenal Mutaqin
+- French: Eric Marchetti
+- Japanese: Yoshinari Ueyama, Shinya Kawamura, Tsuchimoto Hiroki
+
+
+Prado v2 Maintenance Team
+
+
+Past Team Members
+
+
+Special Credits To
+
+- Stever for providing an Apple G3 notebook for testing safari browser issues.
+- Stanislav Yordanov - the script of generating Dreameweaver extension for PRADO
+- Andres Adolfo Testi - original concept and naming for Active Controls.
+- Jack Slocum - inspiration for the quickstart commenting system.
+- Cesar Ramos - Active Record driver for IBM DB2.
+- Sergey Morkovkin - TKeyboard control
+- Tomasz Wolny - TTabPanel control
+- All PRADO users - great suggestions, feedback and support
+- ASP.NET 2.0 for its great inspiration and reference
+- All third-party work used in PRADO
+
+
+
+License
+
+The PRADO framework and the included demos are free software. They are released under
+the terms of the following BSD License.
+
+
+Copyright 2004-2008 by The PRADO Group (http://www.pradosoft.com)
+All rights reserved.
+
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+
+- Redistributions of source code must retain the above copyright notice, this
+list of conditions and the following disclaimer.
+- Redistributions in binary form must reproduce the above copyright notice,
+this list of conditions and the following disclaimer in the documentation and/or
+other materials provided with the distribution.
+- Neither the name of the PRADO Group nor the names of its contributors may be
+used to endorse or promote products derived from this software without specific
+prior written permission.
+
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+OF SUCH DAMAGE.
+
+
+
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveDatePicker.page b/tests/FunctionalTests/active-controls/protected/pages/ActiveDatePicker.page
new file mode 100755
index 00000000..ed35293e
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveDatePicker.page
@@ -0,0 +1,17 @@
+
+
+
+
+TActiveDatePicker test
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveDatePicker.php b/tests/FunctionalTests/active-controls/protected/pages/ActiveDatePicker.php
new file mode 100755
index 00000000..6d78a664
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveDatePicker.php
@@ -0,0 +1,42 @@
+IsPostBack)
+ $this->datepicker->setTimeStamp(time());
+ }
+
+ public function testDatePicker($sender, $param){
+ $this->status->Text = $this->datepicker->getText();
+ }
+
+ public function today ($sender, $param)
+ {
+ $this->datepicker->setTimestamp(time());
+ }
+
+ public function increase ($sender, $param)
+ {
+ $this->datepicker->setTimestamp(strtotime('+1 day', $this->datepicker->getTimestamp()));
+ }
+ public function decrease ($sender, $param)
+ {
+ $this->datepicker->setTimestamp(strtotime('-1 day', $this->datepicker->getTimestamp()));
+ }
+
+ public function toggleMode ($sender, $param)
+ {
+ if ($this->datepicker->getInputMode()==TDatePickerInputMode::DropDownList)
+ $this->datepicker->setInputMode(TDatePickerInputMode::TextBox);
+ else
+ $this->datepicker->setInputMode(TDatePickerInputMode::DropDownList);
+ }
+
+ }
+
+
+?>
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListAllowInputTest.page b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListAllowInputTest.page
new file mode 100644
index 00000000..35fcadc7
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListAllowInputTest.page
@@ -0,0 +1,14 @@
+
+
+ TActiveRatingList AllowInput Test Case
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListAllowInputTest.php b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListAllowInputTest.php
new file mode 100644
index 00000000..c825f3f8
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListAllowInputTest.php
@@ -0,0 +1,27 @@
+
+ * @version Creation Date: Oct 13, 2008
+ */
+
+/**
+ * TRatingListTest.php class
+ *
+ *
+ *
+ * Properties
+ * -
+ *
+ * @author Bradley Booms
+ * @version Modified Date: Oct 13, 2008
+ *
+ * Modifications:
+ */
+class ActiveRatingListAllowInputTest extends TPage{
+ public function ratingChanged($sender, $param){
+ $this->Status->setText($sender->getRating().' : '.$sender->getSelectedValue());
+ }
+}
+?>
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListAutoPostBackTest.page b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListAutoPostBackTest.page
new file mode 100644
index 00000000..84ce4ef3
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListAutoPostBackTest.page
@@ -0,0 +1,16 @@
+
+
+ TActiveRatingList AutoPostBack Test Case
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListAutoPostBackTest.php b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListAutoPostBackTest.php
new file mode 100644
index 00000000..4b087b76
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListAutoPostBackTest.php
@@ -0,0 +1,27 @@
+
+ * @version Creation Date: Oct 13, 2008
+ */
+
+/**
+ * TRatingListTest.php class
+ *
+ *
+ *
+ * Properties
+ * -
+ *
+ * @author Bradley Booms
+ * @version Modified Date: Oct 13, 2008
+ *
+ * Modifications:
+ */
+class ActiveRatingListAutoPostBackTest extends TPage{
+ public function ratingChanged($sender, $param){
+ $this->Status->setText($sender->getRating().' : '.$sender->getSelectedValue());
+ }
+}
+?>
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListCheckBoxesTest.page b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListCheckBoxesTest.page
new file mode 100644
index 00000000..36f4404d
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListCheckBoxesTest.page
@@ -0,0 +1,12 @@
+
+
+ TActiveRatingList Check Boxes Test Case
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListCheckBoxesTest.php b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListCheckBoxesTest.php
new file mode 100644
index 00000000..5c6dfa70
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListCheckBoxesTest.php
@@ -0,0 +1,23 @@
+
+ * @version Creation Date: Oct 13, 2008
+ */
+
+/**
+ * TRatingListTest.php class
+ *
+ *
+ *
+ * Properties
+ * -
+ *
+ * @author Bradley Booms
+ * @version Modified Date: Oct 13, 2008
+ *
+ * Modifications:
+ */
+class ActiveRatingListCheckBoxesTest extends TPage{ }
+?>
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListEnabledTest.page b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListEnabledTest.page
new file mode 100644
index 00000000..5f732e0d
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListEnabledTest.page
@@ -0,0 +1,17 @@
+
+
+ TActiveRatingList Enabled Test Case
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListEnabledTest.php b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListEnabledTest.php
new file mode 100644
index 00000000..0cac7418
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListEnabledTest.php
@@ -0,0 +1,37 @@
+
+ * @version Creation Date: Oct 13, 2008
+ */
+
+/**
+ * TRatingListTest.php class
+ *
+ *
+ *
+ * Properties
+ * -
+ *
+ * @author Bradley Booms
+ * @version Modified Date: Oct 13, 2008
+ *
+ * Modifications:
+ */
+class ActiveRatingListEnabledTest extends TPage{
+ public function ratingChanged($sender, $param){
+ $this->Status->setText($sender->getRating().' : '.$sender->getSelectedValue());
+ }
+
+ public function enable($sender, $param){
+ $this->RatingList->setEnabled(true);
+ $this->Status->setText('Enabled=true');
+ }
+
+ public function disable($sender, $param){
+ $this->RatingList->setEnabled(false);
+ $this->Status->setText('Enabled=false');
+ }
+}
+?>
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListHoverCaptionTest.page b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListHoverCaptionTest.page
new file mode 100644
index 00000000..01e47a34
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListHoverCaptionTest.page
@@ -0,0 +1,14 @@
+
+
+ TActiveRatingList Hover Caption Test Case
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListHoverCaptionTest.php b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListHoverCaptionTest.php
new file mode 100644
index 00000000..06d82d39
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListHoverCaptionTest.php
@@ -0,0 +1,27 @@
+
+ * @version Creation Date: Oct 13, 2008
+ */
+
+/**
+ * TRatingListTest.php class
+ *
+ *
+ *
+ * Properties
+ * -
+ *
+ * @author Bradley Booms
+ * @version Modified Date: Oct 13, 2008
+ *
+ * Modifications:
+ */
+class ActiveRatingListHoverCaptionTest extends TPage{
+ public function ratingChanged($sender, $param){
+ $sender->setCaption($sender->getRating().' : '.$sender->getSelectedValue());
+ }
+}
+?>
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListRatingTest.page b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListRatingTest.page
new file mode 100644
index 00000000..942a5b45
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListRatingTest.page
@@ -0,0 +1,17 @@
+
+
+ TActiveRatingList Rating Test Case
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListRatingTest.php b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListRatingTest.php
new file mode 100644
index 00000000..fe5c8404
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListRatingTest.php
@@ -0,0 +1,32 @@
+
+ * @version Creation Date: Oct 13, 2008
+ */
+
+/**
+ * TRatingListTest.php class
+ *
+ *
+ *
+ * Properties
+ * -
+ *
+ * @author Bradley Booms
+ * @version Modified Date: Oct 13, 2008
+ *
+ * Modifications:
+ */
+class ActiveRatingListRatingTest extends TPage{
+ public function ratingChanged($sender, $param){
+ $this->Status->setText('Rating: '.$sender->getRating());
+ }
+
+ public function setRating($sender, $param){
+ $this->RatingList->setRating(3);
+ $this->ratingChanged($this->RatingList, null);
+ }
+}
+?>
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListReadOnlyTest.page b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListReadOnlyTest.page
new file mode 100644
index 00000000..dad3fd6e
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListReadOnlyTest.page
@@ -0,0 +1,17 @@
+
+
+ TActiveRatingList ReadOnly Test Case
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListReadOnlyTest.php b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListReadOnlyTest.php
new file mode 100644
index 00000000..070fd13f
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListReadOnlyTest.php
@@ -0,0 +1,38 @@
+
+ * @version Creation Date: Oct 13, 2008
+ */
+
+/**
+ * TRatingListTest.php class
+ *
+ *
+ *
+ * Properties
+ * -
+ *
+ * @author Bradley Booms
+ * @version Modified Date: Oct 13, 2008
+ *
+ * Modifications:
+ */
+class ActiveRatingListReadOnlyTest extends TPage{
+ public function ratingChanged($sender, $param){
+ $this->Status->setText($sender->getRating().' : '.$sender->getSelectedValue());
+ }
+
+ public function readOnly($sender, $param){
+ $this->RatingList->setReadOnly(true);
+ $this->Status->setText('ReadOnly=true');
+ }
+
+ public function writable($sender, $param){
+ $this->RatingList->setReadOnly(false);
+ $this->Status->setText('ReadOnly=false');
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListSelectedIndexTest.page b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListSelectedIndexTest.page
new file mode 100644
index 00000000..6fb52822
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListSelectedIndexTest.page
@@ -0,0 +1,17 @@
+
+
+ TActiveRatingList SelectedIndex Test Case
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListSelectedIndexTest.php b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListSelectedIndexTest.php
new file mode 100644
index 00000000..4dbc6949
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveRatingListSelectedIndexTest.php
@@ -0,0 +1,32 @@
+
+ * @version Creation Date: Oct 13, 2008
+ */
+
+/**
+ * TRatingListTest.php class
+ *
+ *
+ *
+ * Properties
+ * -
+ *
+ * @author Bradley Booms
+ * @version Modified Date: Oct 13, 2008
+ *
+ * Modifications:
+ */
+class ActiveRatingListSelectedIndexTest extends TPage{
+ public function ratingChanged($sender, $param){
+ $this->Status->setText('SelectedIndex: '.$sender->getSelectedIndex());
+ }
+
+ public function setSelectedIndex($sender, $param){
+ $this->RatingList->setSelectedIndex(5);
+ $this->ratingChanged($this->RatingList, null);
+ }
+}
+?>
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/RatingList.page b/tests/FunctionalTests/active-controls/protected/pages/RatingList.page
index f9be4aee..ba9c2e5d 100644
--- a/tests/FunctionalTests/active-controls/protected/pages/RatingList.page
+++ b/tests/FunctionalTests/active-controls/protected/pages/RatingList.page
@@ -3,22 +3,11 @@
diff --git a/tests/FunctionalTests/active-controls/tests/ActiveDatePickerTestCase.php b/tests/FunctionalTests/active-controls/tests/ActiveDatePickerTestCase.php
new file mode 100755
index 00000000..b8e9594e
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/tests/ActiveDatePickerTestCase.php
@@ -0,0 +1,97 @@
+open("active-controls/index.php?page=ActiveDatePicker");
+ $this->verifyTextPresent("TActiveDatePicker test");
+ $this->verifyText("status", "");
+ $this->verifyValue("datepicker", date('m-d-Y'));
+ $this->click("increaseButton");
+ $this->pause(800);
+ $this->verifyValue("datepicker", date('m-d-Y', strtotime('+ 1 day')));
+ $this->verifyText("status", date('m-d-Y', strtotime('+ 1 day')));
+ $this->click("increaseButton");
+ $this->pause(800);
+ $this->verifyValue("datepicker", date('m-d-Y', strtotime('+ 2 day')));
+ $this->verifyText("status", date('m-d-Y', strtotime('+ 2 day')));
+ $this->click("todayButton");
+ $this->pause(800);
+ $this->verifyValue("datepicker", date('m-d-Y'));
+ $this->verifyText("status", date('m-d-Y'));
+ $this->click("decreaseButton");
+ $this->pause(800);
+ $this->verifyValue("datepicker", date('m-d-Y', strtotime('- 1 day')));
+ $this->verifyText("status", date('m-d-Y', strtotime('- 1 day')));
+ $this->click("datepicker");
+ $this->pause(800);
+ $this->click("css=input.todayButton");
+ $this->pause(800);
+ $this->verifyValue("datepicker", date('m-d-Y'));
+ $this->verifyText("status", date('m-d-Y'));
+ $this->click("css=input.nextMonthButton");
+ $this->pause(800);
+ $this->verifyValue("datepicker", date('m-d-Y', strtotime('+ 1 month')));
+ $this->verifyText("status", date('m-d-Y', strtotime('+1 month')));
+
+ $this->click('toggleButton');
+ $this->pause(1000);
+
+ $this->click("todayButton");
+ $this->pause(800);
+ $this->verifySelected("datepicker_month", date('m'));
+ $this->verifyText("status", date('m-d-Y'));
+
+ $this->click("increaseButton");
+ $this->pause(800);
+ $dateToCheck=strtotime('+ 1 day');
+ $this->verifySelected("datepicker_month", date('m', $dateToCheck));
+ $this->verifySelected("datepicker_day", date('d', $dateToCheck));
+ $this->verifySelected("datepicker_year", date('Y', $dateToCheck));
+ $this->verifyText("status", date('m-d-Y', $dateToCheck));
+
+ $this->click("increaseButton");
+ $this->pause(800);
+ $dateToCheck=strtotime('+ 2 day');
+ $this->verifySelected("datepicker_month", date('m', $dateToCheck));
+ $this->verifySelected("datepicker_day", date('d', $dateToCheck));
+ $this->verifySelected("datepicker_year", date('Y', $dateToCheck));
+ $this->verifyText("status", date('m-d-Y', $dateToCheck));
+
+ $this->click("todayButton");
+ $this->pause(800);
+ $dateToCheck=time();
+ $this->verifySelected("datepicker_month", date('m', $dateToCheck));
+ $this->verifySelected("datepicker_day", date('d', $dateToCheck));
+ $this->verifySelected("datepicker_year", date('Y', $dateToCheck));
+ $this->verifyText("status", date('m-d-Y', $dateToCheck));
+
+ $this->click("decreaseButton");
+ $this->pause(800);
+ $dateToCheck=strtotime('- 1 day');
+ $this->verifySelected("datepicker_month", date('m', $dateToCheck));
+ $this->verifySelected("datepicker_day", date('d', $dateToCheck));
+ $this->verifySelected("datepicker_year", date('Y', $dateToCheck));
+ $this->verifyText("status", date('m-d-Y', $dateToCheck));
+
+ $this->click("datepickerbutton");
+ $this->pause(800);
+ $this->click("css=input.todayButton");
+ $this->pause(800);
+ $dateToCheck=time();
+ $this->verifySelected("datepicker_month", date('m', $dateToCheck));
+ $this->verifySelected("datepicker_day", date('d', $dateToCheck));
+ $this->verifySelected("datepicker_year", date('Y', $dateToCheck));
+ $this->verifyText("status", date('m-d-Y', $dateToCheck));
+
+ $this->click("css=input.nextMonthButton");
+ $this->pause(800);
+ $dateToCheck=strtotime('+ 1 month');
+ $this->verifySelected("datepicker_month", date('m', $dateToCheck));
+ $this->verifySelected("datepicker_day", date('d', $dateToCheck));
+ $this->verifySelected("datepicker_year", date('Y', $dateToCheck));
+ $this->verifyText("status", date('m-d-Y', $dateToCheck));
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controlstests/ActiveRatingListTestCase.php b/tests/FunctionalTests/active-controlstests/ActiveRatingListTestCase.php
new file mode 100644
index 00000000..c6dc50c2
--- /dev/null
+++ b/tests/FunctionalTests/active-controlstests/ActiveRatingListTestCase.php
@@ -0,0 +1,253 @@
+
+ * @version Creation Date: Oct 22, 2008
+ */
+
+/**
+ * ActiveRatingListTestCase.php class
+ *
+ *
+ *
+ * Properties
+ * -
+ *
+ * @author Bradley Booms
+ * @version Modified Date: Oct 22, 2008
+ *
+ * Modifications:
+ */
+class ActiveRatingListTestCase extends SeleniumTestCase
+{
+ function testCheckBoxes()
+ {
+ // Verify we're on the right page.
+ $this->open("active-controls/index.php?page=ActiveRatingListCheckBoxesTest");
+ $this->verifyTextPresent("TActiveRatingList Check Boxes Test Case");
+ $this->assertCheckBoxes("RatingList", array(2), 6);
+
+ // Change the list and make sure the radio buttons get updated properly.
+ $this->clickTD("RatingList_c4");
+ $this->pause(800);
+ $this->assertCheckBoxes("RatingList", array(4), 6);
+
+ $this->clickTD("RatingList_c2");
+ $this->pause(800);
+ $this->assertCheckBoxes("RatingList", array(2), 6);
+ }
+
+ function testRating()
+ {
+ // Verify we're on the right page.
+ $this->open("active-controls/index.php?page=ActiveRatingListRatingTest");
+ $this->verifyTextPresent("TActiveRatingList Rating Test Case");
+
+ // Check the list, make sure it starts out with 5 stars.
+ $this->assertText("Status", "Rating: 5");
+
+ // Click on 1 star and make sure the Rating property updates.
+ $this->clickTD("RatingList_c0");
+ $this->pause(800);
+ $this->assertText("Status", "Rating: 1");
+
+ // Then set Rating to three on the server side and make sure it's correct.
+ $this->click("SetRating");
+ $this->pause(800);
+ $this->assertText("Status", "Rating: 3");
+ }
+
+ function testSelectedIndex()
+ {
+ // Verify we're on the right page.
+ $this->open("active-controls/index.php?page=ActiveRatingListSelectedIndexTest");
+ $this->verifyTextPresent("TActiveRatingList SelectedIndex Test Case");
+ $this->assertText("Status", " SelectedIndex: 1");
+
+ // Click on 5 stars and make sure the SelectedIndex property updates.
+ $this->clickTD("RatingList_c4");
+ $this->pause(800);
+ $this->assertText("Status", " SelectedIndex: 4");
+
+ // Then set SelectedIndex to 5 on the server side and make sure it's correct.
+ $this->click("SetSelectedIndex");
+ $this->pause(800);
+ $this->assertText("Status", " SelectedIndex: 5");
+ }
+
+ function testAutoPostBack()
+ {
+ // Verify we're on the right page.
+ $this->open("active-controls/index.php?page=ActiveRatingListAutoPostBackTest");
+ $this->verifyTextPresent("TActiveRatingList AutoPostBack Test Case");
+ $this->assertText("Status", "AutoPostback=false");
+
+ // Make sure that it doesn't auto post when clicked.
+ $this->clickTD("RatingList_c3");
+ $this->pause(800);
+ $this->assertText("Status", "AutoPostback=false");
+
+ // Then submit with an active button and make sure it updates.
+ $this->click("Submit");
+ $this->pause(800);
+ $this->assertText("Status", "4 : Good");
+ }
+
+ function testAllowInput()
+ {
+ // Verify we're on the right page.
+ $this->open("active-controls/index.php?page=ActiveRatingListAllowInputTest");
+ $this->verifyTextPresent("TActiveRatingList AllowInput Test Case");
+ $this->assertText("Status", "AllowInput=false");
+ $this->assertCheckBoxes("RatingList", array(3), 6);
+
+ // Make sure that clicking doesn't change anything.
+ $this->clickTD("RatingList_c5");
+ $this->pause(800);
+ $this->assertText("Status", "AllowInput=false");
+ $this->assertCheckBoxes("RatingList", array(3), 6);
+ }
+
+ function testReadOnly()
+ {
+ // Verify we're on the right page.
+ $this->open("active-controls/index.php?page=ActiveRatingListReadOnlyTest");
+ $this->verifyTextPresent("TActiveRatingList ReadOnly Test Case");
+ $this->assertText("Status", "ReadOnly=true");
+ $this->assertCheckBoxes("RatingList", array(0), 6);
+
+ $this->clickTD("RatingList_c4");
+ $this->pause(800);
+ $this->assertText("Status", "ReadOnly=true");
+ $this->assertCheckBoxes("RatingList", array(0), 6);
+
+ // Then set ReadOnly to false, and make sure it works.
+ $this->click("Writable");
+ $this->pause(800);
+ $this->assertText("Status", "ReadOnly=false");
+ $this->assertCheckBoxes("RatingList", array(0), 6);
+
+
+ $this->clickTD("RatingList_c1");
+ $this->pause(800);
+ $this->assertText("Status", "2 : Fair");
+ $this->assertCheckBoxes("RatingList", array(1), 6);
+
+ // Then set ReadOnly to true, and make sure it doesn't work anymore.
+ $this->click("ReadOnly");
+ $this->pause(800);
+ $this->assertText("Status", "ReadOnly=true");
+ $this->assertCheckBoxes("RatingList", array(1), 6);
+
+
+ $this->clickTD("RatingList_c2");
+ $this->pause(800);
+ $this->assertText("Status", "ReadOnly=true");
+ $this->assertCheckBoxes("RatingList", array(1), 6);
+ }
+
+ function testEnabled()
+ {
+ // Verify we're on the right page.
+ $this->open("active-controls/index.php?page=ActiveRatingListEnabledTest");
+ $this->verifyTextPresent("TActiveRatingList Enabled Test Case");
+ $this->assertText("Status", "Enabled=false");
+ $this->assertCheckBoxes("RatingList", array(5), 6);
+
+ $this->clickTD("RatingList_c4");
+ $this->pause(800);
+ $this->assertText("Status", "Enabled=false");
+ $this->assertCheckBoxes("RatingList", array(5), 6);
+
+ // Then set Enable to true, and make sure it works.
+ $this->click("Enable");
+ $this->pause(800);
+ $this->assertText("Status", "Enabled=true");
+ $this->assertCheckBoxes("RatingList", array(5), 6);
+
+
+ $this->clickTD("RatingList_c3");
+ $this->pause(800);
+ $this->assertText("Status", "4 : Good");
+ $this->assertCheckBoxes("RatingList", array(3), 6);
+
+ // Then set Enable to false, and make sure it doesn't work anymore.
+ $this->click("Disable");
+ $this->pause(800);
+ $this->assertText("Status", "Enabled=false");
+ $this->assertCheckBoxes("RatingList", array(3), 6);
+
+
+ $this->clickTD("RatingList_c5");
+ $this->pause(800);
+ $this->assertText("Status", "Enabled=false");
+ $this->assertCheckBoxes("RatingList", array(3), 6);
+ }
+
+ function testHoverCaption()
+ {
+ // Verify we're on the right page.
+ $this->open("active-controls/index.php?page=ActiveRatingListHoverCaptionTest");
+ $this->verifyTextPresent("TActiveRatingList Hover Caption Test Case");
+ $this->assertText("Status", "CaptionID='Status'");
+ $this->assertElementPresent("//input[@id='RatingList_c0']/../..[contains(@class, 'rating_selected')]");
+ $this->assertElementPresent("//input[@id='RatingList_c1']/../..[contains(@class, 'rating_selected')]");
+ $this->assertElementPresent("//input[@id='RatingList_c2']/../..[contains(@class, 'rating_selected')]");
+ $this->assertElementPresent("//input[@id='RatingList_c3']/../..[contains(@class, 'rating_half')]");
+ $this->assertElementPresent("//input[@id='RatingList_c3']/../..[contains(@class, 'rating')]");
+ $this->assertElementPresent("//input[@id='RatingList_c4']/../..[contains(@class, 'rating')]");
+ $this->assertElementPresent("//input[@id='RatingList_c5']/../..[contains(@class, 'rating')]");
+
+ $this->mouseOver("//input[@id='RatingList_c4']/../../");
+ $this->assertText("Status", "Excellent");
+ $this->assertElementPresent("//input[@id='RatingList_c0']/../..[contains(@class, 'rating_hover')]");
+ $this->assertElementPresent("//input[@id='RatingList_c1']/../..[contains(@class, 'rating_hover')]");
+ $this->assertElementPresent("//input[@id='RatingList_c2']/../..[contains(@class, 'rating_hover')]");
+ $this->assertElementPresent("//input[@id='RatingList_c3']/../..[contains(@class, 'rating_hover')]");
+ $this->assertElementPresent("//input[@id='RatingList_c4']/../..[contains(@class, 'rating_hover')]");
+ $this->assertElementNotPresent("//input[@id='RatingList_c5']/../..[contains(@class, 'rating_hover')]");
+ $this->assertElementPresent("//input[@id='RatingList_c5']/../..[contains(@class, 'rating')]");
+
+ $this->mouseOut("//input[@id='RatingList_c4']/../../");
+ $this->assertText("Status", "CaptionID='Status'");
+ $this->assertElementPresent("//input[@id='RatingList_c0']/../..[contains(@class, 'rating_selected')]");
+ $this->assertElementPresent("//input[@id='RatingList_c1']/../..[contains(@class, 'rating_selected')]");
+ $this->assertElementPresent("//input[@id='RatingList_c2']/../..[contains(@class, 'rating_selected')]");
+ $this->assertElementNotPresent("//input[@id='RatingList_c3']/../..[contains(@class, 'rating_selected')]");
+ $this->assertElementPresent("//input[@id='RatingList_c3']/../..[contains(@class, 'rating')]");
+ $this->assertElementPresent("//input[@id='RatingList_c4']/../..[contains(@class, 'rating')]");
+ $this->assertElementPresent("//input[@id='RatingList_c5']/../..[contains(@class, 'rating')]");
+
+
+ $this->mouseOver("//input[@id='RatingList_c1']/../../");
+ $this->assertText("Status", "Fair");
+
+ $this->click("//input[@id='RatingList_c1']/../../");
+ $this->pause(800);
+ $this->assertText("Status", "2 : Fair");
+ $this->assertElementPresent("//input[@id='RatingList_c0']/../..[contains(@class, 'rating_selected')]");
+ $this->assertElementPresent("//input[@id='RatingList_c1']/../..[contains(@class, 'rating_selected')]");
+ $this->assertElementNotPresent("//input[@id='RatingList_c2']/../..[contains(@class, 'rating_selected')]");
+ $this->assertElementPresent("//input[@id='RatingList_c2']/../..[contains(@class, 'rating')]");
+ $this->assertElementPresent("//input[@id='RatingList_c3']/../..[contains(@class, 'rating')]");
+ $this->assertElementPresent("//input[@id='RatingList_c4']/../..[contains(@class, 'rating')]");
+ $this->assertElementPresent("//input[@id='RatingList_c5']/../..[contains(@class, 'rating')]");
+ }
+
+ function clickTD($clientID){
+ $this->click("//input[@id='{$clientID}']/../..");
+ }
+
+ function assertCheckBoxes($clientID, $checks, $total = 5)
+ {
+ for($i = 0; $i < $total; $i++)
+ {
+ if(in_array($i, $checks))
+ $this->assertChecked("{$clientID}_c{$i}");
+ else
+ $this->assertNotChecked("{$clientID}_c{$i}");
+ }
+ }
+}
+?>
\ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/protected/application.xml b/tests/FunctionalTests/tickets/protected/application.xml
index 29273a2f..113b8455 100644
--- a/tests/FunctionalTests/tickets/protected/application.xml
+++ b/tests/FunctionalTests/tickets/protected/application.xml
@@ -1,8 +1,9 @@
-
+
+
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket284Component.php b/tests/FunctionalTests/tickets/protected/pages/Ticket284Component.php
index 892bdc87..da6ad153 100644
--- a/tests/FunctionalTests/tickets/protected/pages/Ticket284Component.php
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket284Component.php
@@ -2,6 +2,7 @@
class Ticket284Component extends TTemplateControl implements IValidatable
{
+ private $_isValid;
public function onPreRender($param)
{
if (!$this->ShowHours && $this->ShowMinutes)
@@ -90,5 +91,13 @@ class Ticket284Component extends TTemplateControl implements IValidatable
return $this->TimeStamp;
}
}
+ public function getIsValid()
+ {
+ return $this->_isValid;
+ }
+ public function setIsValid($value)
+ {
+ $this->_isValid=TPropertyValue::ensureBoolean($value);
+ }
}
-?>
\ No newline at end of file
+?>
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket900.page b/tests/FunctionalTests/tickets/protected/pages/Ticket900.page
new file mode 100644
index 00000000..41c0fbc2
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket900.page
@@ -0,0 +1,45 @@
+
+
+Current Command:
+
+
+
+
+
+ Parent->Data['title']%>/>
+
+
+ Parent->Data['title']%>/>
+
+
+
+
+
+
+
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket900.php b/tests/FunctionalTests/tickets/protected/pages/Ticket900.php
new file mode 100644
index 00000000..21e87f67
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket900.php
@@ -0,0 +1,58 @@
+IsPostBack)
+ {
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+ }
+
+
+ protected function getData()
+ {
+ return array(
+ array( 'title' => 'Title A'),
+ array( 'title' => 'Title B'),
+ array( 'title' => 'Title C')
+ );
+ }
+
+
+ public function editItem($sender,$param)
+ {
+ $this->CommandName->Text='edit';
+ $this->DataGrid->EditItemIndex=$param->Item->ItemIndex;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function saveItem($sender,$param)
+ {
+ $this->CommandName->Text='save';
+ $this->DataGrid->EditItemIndex=-1;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function cancelItem($sender,$param)
+ {
+ $this->CommandName->Text='cancel';
+ $this->DataGrid->EditItemIndex=-1;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function deleteItem($sender,$param)
+ {
+ $this->CommandName->Text='delete';
+ $this->DataGrid->EditItemIndex=-1;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+}
+?>
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket922.page b/tests/FunctionalTests/tickets/protected/pages/Ticket922.page
new file mode 100644
index 00000000..87932680
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket922.page
@@ -0,0 +1,12 @@
+
+
+Problem with TUrlMapping and urlencoding
+
+Enter a string with spaces that will be used as URL parameter
+
+
+
+
+Decoded String:
+
+
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket922.php b/tests/FunctionalTests/tickets/protected/pages/Ticket922.php
new file mode 100644
index 00000000..52d4e411
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket922.php
@@ -0,0 +1,13 @@
+Text->Text;
+ $url= $this->getService()->constructUrl('Ticket922', array('text'=>$text));
+ $this->getResponse()->redirect($url);
+ }
+
+ public function onLoad($param) {
+ if ($this->Request->contains('text'))
+ $this->Result->setText($this->Request->itemAt('text'));
+ }
+}
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket925.page b/tests/FunctionalTests/tickets/protected/pages/Ticket925.page
new file mode 100755
index 00000000..cdb1e0fe
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket925.page
@@ -0,0 +1,11 @@
+
+
+
+ Timer 1 :
+ Timer 2 :
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket925.php b/tests/FunctionalTests/tickets/protected/pages/Ticket925.php
new file mode 100755
index 00000000..0284bd66
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket925.php
@@ -0,0 +1,76 @@
+getViewState('timer1', 0);
+ }
+
+ public function getTimer2Value()
+ {
+ return $this->getViewState('timer2', 0);
+ }
+
+ public function setTimer1Value($value)
+ {
+ $this->setViewState('timer1', $value, 0);
+ }
+
+ public function setTimer2Value($value)
+ {
+ $this->setViewState('timer2', $value, 0);
+ }
+
+ public function startTimer1($sender, $param)
+ {
+ $this->timer1->startTimer();
+ }
+
+ public function stopTimer1($sender, $param)
+ {
+ $this->timer1->stopTimer();
+ }
+
+ public function startTimer2($sender, $param)
+ {
+ $this->timer2->startTimer();
+ }
+
+ public function stopTimer2($sender, $param)
+ {
+ $this->timer2->stopTimer();
+ }
+
+ public function changeIntervalTimer1($sender, $param)
+ {
+ $this->timer1->setInterval(1);
+ }
+
+ public function timer1callback ($sender, $param)
+ {
+ $this->timer1result->Text .= ($this->Timer1Value+=$this->timer1->Interval).'... ';
+ if ($this->Timer1Value > 20)
+ {
+ $this->timer1Value=0;
+ $this->timer1result->Text='';
+ $this->timer1->stopTimer();
+ }
+
+ }
+
+ public function timer2callback ($sender, $param)
+ {
+ $this->timer2result->Text .= ($this->Timer2Value+=$this->timer2->Interval).'... ';
+ if ($this->Timer2Value > 20)
+ {
+ $this->timer2Value=0;
+ $this->timer2result->Text='';
+ $this->timer2->stopTimer();
+ }
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/tests/Ticket595TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket595TestCase.php
index e2487f25..4321bd67 100644
--- a/tests/FunctionalTests/tickets/tests/Ticket595TestCase.php
+++ b/tests/FunctionalTests/tickets/tests/Ticket595TestCase.php
@@ -18,7 +18,7 @@ class Ticket595TestCase extends SeleniumTestCase
$this->type($base.'A', 'test@pradosoft.com');
$this->click($base.'ctl2');
$this->pause(800);
- $this->assertAttribute($base.'A@class','');
+ $this->assertAttribute($base.'A@class','null');
$this->click($base.'ctl5');
@@ -33,7 +33,7 @@ class Ticket595TestCase extends SeleniumTestCase
$this->type($base.'B', 'test@pradosoft.com');
$this->click($base.'ctl5');
$this->pause(800);
- $this->assertAttribute($base.'B@class','');
+ $this->assertAttribute($base.'B@class','null');
}
}
?>
diff --git a/tests/FunctionalTests/tickets/tests/Ticket900TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket900TestCase.php
new file mode 100644
index 00000000..b80e1187
--- /dev/null
+++ b/tests/FunctionalTests/tickets/tests/Ticket900TestCase.php
@@ -0,0 +1,19 @@
+open('tickets/index.php?page=Ticket900');
+ $this->assertTitle("Verifying Ticket 900");
+ $base = 'ctl0_Content_';
+
+ $this->clickAndWait('ctl0$Content$DataGrid$ctl1$ctl3');
+ $this->type($base.'DataGrid_ctl1_TextBox', '');
+ $this->click($base.'DataGrid_ctl1_ctl3');
+ $this->clickAndWait('ctl0$Content$DataGrid$ctl1$ctl4');
+ $this->assertText($base.'CommandName', 'cancel');
+ }
+}
+
+?>
diff --git a/tests/FunctionalTests/tickets/tests/Ticket922TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket922TestCase.php
new file mode 100644
index 00000000..8420c10d
--- /dev/null
+++ b/tests/FunctionalTests/tickets/tests/Ticket922TestCase.php
@@ -0,0 +1,18 @@
+open('tickets/index.php?page=Ticket922');
+ $this->assertTitle("Verifying Ticket 922");
+ $base = 'ctl0_Content_';
+
+ $this->type($base.'Text', 'two words');
+ $this->clickAndWait('ctl0$Content$ctl0');
+ $this->assertText($base.'Result','two words');
+
+ }
+}
+
+?>
--
cgit v1.2.3
From 736e92efbc75908a2bf26fe333a03990e3bb8100 Mon Sep 17 00:00:00 2001
From: carlgmathisen <>
Date: Sun, 7 Dec 2008 13:05:05 +0000
Subject: work on php style configuration
---
.gitattributes | 15 +++
demos/blog/index_php.php | 20 ++++
demos/blog/protected/Data/Settings.php | 13 ++
demos/blog/protected/Pages/Admin/config.php | 13 ++
demos/blog/protected/Pages/Posts/config.php | 20 ++++
demos/blog/protected/application.php | 86 ++++++++++++++
demos/blog/protected/application.xml | 10 +-
demos/chat/index_php.php | 27 +++++
demos/chat/protected/application.php | 25 ++++
demos/chat/protected/pages/config.php | 31 +++++
demos/northwind-db/index_php.php | 26 ++++
demos/northwind-db/protected/application.php | 29 +++++
demos/personal/protected/Pages/config.php | 2 +-
demos/personal/protected/application.php | 2 +-
demos/sqlmap/index_php.php | 18 +++
demos/sqlmap/protected/pages/Manual/config.php | 18 +++
demos/time-tracker/index_php.php | 33 ++++++
demos/time-tracker/protected/application.php | 49 ++++++++
.../protected/pages/TimeTracker/config.php | 30 +++++
framework/Exceptions/messages/messages.txt | 8 +-
framework/I18N/TGlobalization.php | 23 ++--
framework/Security/TUserManager.php | 49 ++++++--
framework/TApplication.php | 45 ++++++-
framework/Util/TLogRouter.php | 77 ++++++++----
framework/Util/TParameterModule.php | 76 ++++++++----
framework/Web/Services/TFeedService.php | 86 ++++++++++----
framework/Web/Services/TJsonService.php | 76 +++++++++---
framework/Web/Services/TPageService.php | 10 +-
framework/Web/Services/TSoapService.php | 25 ++--
framework/Web/TUrlMapping.php | 132 +++++++++++++--------
30 files changed, 900 insertions(+), 174 deletions(-)
create mode 100644 demos/blog/index_php.php
create mode 100644 demos/blog/protected/Data/Settings.php
create mode 100644 demos/blog/protected/Pages/Admin/config.php
create mode 100644 demos/blog/protected/Pages/Posts/config.php
create mode 100644 demos/blog/protected/application.php
create mode 100644 demos/chat/index_php.php
create mode 100644 demos/chat/protected/application.php
create mode 100644 demos/chat/protected/pages/config.php
create mode 100644 demos/northwind-db/index_php.php
create mode 100644 demos/northwind-db/protected/application.php
create mode 100644 demos/sqlmap/index_php.php
create mode 100644 demos/sqlmap/protected/pages/Manual/config.php
create mode 100644 demos/time-tracker/index_php.php
create mode 100644 demos/time-tracker/protected/application.php
create mode 100644 demos/time-tracker/protected/pages/TimeTracker/config.php
(limited to 'demos/personal/protected/application.php')
diff --git a/.gitattributes b/.gitattributes
index eeda95c0..d4935b74 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -992,6 +992,7 @@ demos/blog-tutorial/themes/PradoSoft/mantissample.jpg -text
demos/blog-tutorial/themes/PradoSoft/pradologo.gif -text
demos/blog-tutorial/themes/PradoSoft/style.css -text
demos/blog/index.php -text
+demos/blog/index_php.php -text
demos/blog/protected/.htaccess -text
demos/blog/protected/Common/BlogDataModule.php -text
demos/blog/protected/Common/BlogErrorHandler.php -text
@@ -1002,6 +1003,7 @@ demos/blog/protected/Common/BlogUserManager.php -text
demos/blog/protected/Common/XListMenu.php -text
demos/blog/protected/Common/messages.txt -text
demos/blog/protected/Common/schema.sql -text
+demos/blog/protected/Data/Settings.php -text
demos/blog/protected/Data/Settings.xml -text
demos/blog/protected/Layouts/MainLayout.php -text
demos/blog/protected/Layouts/MainLayout.tpl -text
@@ -1013,6 +1015,7 @@ demos/blog/protected/Pages/Admin/PostMan.page -text
demos/blog/protected/Pages/Admin/PostMan.php -text
demos/blog/protected/Pages/Admin/UserMan.page -text
demos/blog/protected/Pages/Admin/UserMan.php -text
+demos/blog/protected/Pages/Admin/config.php -text
demos/blog/protected/Pages/Admin/config.xml -text
demos/blog/protected/Pages/ErrorReport.page -text
demos/blog/protected/Pages/ErrorReport.php -text
@@ -1030,6 +1033,7 @@ demos/blog/protected/Pages/Posts/NewPost.page -text
demos/blog/protected/Pages/Posts/NewPost.php -text
demos/blog/protected/Pages/Posts/ViewPost.page -text
demos/blog/protected/Pages/Posts/ViewPost.php -text
+demos/blog/protected/Pages/Posts/config.php -text
demos/blog/protected/Pages/Posts/config.xml -text
demos/blog/protected/Pages/SearchPost.page -text
demos/blog/protected/Pages/SearchPost.php -text
@@ -1053,22 +1057,26 @@ demos/blog/protected/Portlets/LoginPortlet.tpl -text
demos/blog/protected/Portlets/Portlet.php -text
demos/blog/protected/Portlets/SearchPortlet.php -text
demos/blog/protected/Portlets/SearchPortlet.tpl -text
+demos/blog/protected/application.php -text
demos/blog/protected/application.xml -text
demos/blog/themes/Fall/style.css -text
demos/blog/themes/Spring/style.css -text
demos/blog/themes/Summer/style.css -text
demos/blog/themes/Winter/style.css -text
demos/chat/index.php -text
+demos/chat/index_php.php -text
demos/chat/protected/.htaccess -text
demos/chat/protected/App_Code/ChatBufferRecord.php -text
demos/chat/protected/App_Code/ChatUserManager.php -text
demos/chat/protected/App_Code/ChatUserRecord.php -text
demos/chat/protected/App_Code/chat.db -text
+demos/chat/protected/application.php -text
demos/chat/protected/application.xml -text
demos/chat/protected/pages/Home.page -text
demos/chat/protected/pages/Home.php -text
demos/chat/protected/pages/Login.page -text
demos/chat/protected/pages/Login.php -text
+demos/chat/protected/pages/config.php -text
demos/chat/protected/pages/config.xml -text
demos/chat/protected/pages/send.gif -text
demos/chat/protected/pages/send.png -text
@@ -1098,7 +1106,9 @@ demos/helloworld/protected/.htaccess -text
demos/helloworld/protected/pages/Home.page -text
demos/helloworld/protected/pages/Home.php -text
demos/northwind-db/index.php -text
+demos/northwind-db/index_php.php -text
demos/northwind-db/protected/.htaccess -text
+demos/northwind-db/protected/application.php -text
demos/northwind-db/protected/application.xml -text
demos/northwind-db/protected/data/Northwind.db -text
demos/northwind-db/protected/database/Category.php -text
@@ -1839,6 +1849,7 @@ demos/soap/protected/pages/Home.page -text
demos/soap/protected/pages/Home.php -text
demos/soap/protected/webservices/SimpleService.php -text
demos/sqlmap/index.php -text
+demos/sqlmap/index_php.php -text
demos/sqlmap/protected/.htaccess -text
demos/sqlmap/protected/APP_CODE/Person.php -text
demos/sqlmap/protected/App_Data/person.xml -text
@@ -1877,6 +1888,7 @@ demos/sqlmap/protected/pages/Manual/Tutorial/example1.png -text
demos/sqlmap/protected/pages/Manual/Tutorial/grid1.png -text
demos/sqlmap/protected/pages/Manual/Tutorial/grid2.png -text
demos/sqlmap/protected/pages/Manual/WorkingWithDataMaps.page -text
+demos/sqlmap/protected/pages/Manual/config.php -text
demos/sqlmap/protected/pages/Manual/config.xml -text
demos/sqlmap/protected/pages/Manual/diagram.png -text
demos/sqlmap/protected/pages/Sample/Home.page -text
@@ -1885,6 +1897,7 @@ demos/sqlmap/protected/pages/Sample/crud1.php -text
demos/sqlmap/protected/pages/Sample/crud2.page -text
demos/sqlmap/protected/pages/Sample/crud2.php -text
demos/time-tracker/index.php -text
+demos/time-tracker/index_php.php -text
demos/time-tracker/protected/.htaccess -text
demos/time-tracker/protected/App_Code/Dao/BaseDao.php -text
demos/time-tracker/protected/App_Code/Dao/CategoryDao.php -text
@@ -1919,6 +1932,7 @@ demos/time-tracker/protected/App_Data/SQLite/users.xml -text
demos/time-tracker/protected/App_Data/TimeTrackerUserTypeHandler.php -text
demos/time-tracker/protected/App_Data/mysql4-sqlmap.xml -text
demos/time-tracker/protected/App_Data/sqlite-sqlmap.xml -text
+demos/time-tracker/protected/application.php -text
demos/time-tracker/protected/application.xml -text
demos/time-tracker/protected/pages/TimeTracker/CategoryDataList.php -text
demos/time-tracker/protected/pages/TimeTracker/CategoryDataList.tpl -text
@@ -1946,6 +1960,7 @@ demos/time-tracker/protected/pages/TimeTracker/UserCreate.page -text
demos/time-tracker/protected/pages/TimeTracker/UserCreate.php -text
demos/time-tracker/protected/pages/TimeTracker/UserList.page -text
demos/time-tracker/protected/pages/TimeTracker/UserList.php -text
+demos/time-tracker/protected/pages/TimeTracker/config.php -text
demos/time-tracker/protected/pages/TimeTracker/config.xml -text
demos/time-tracker/protected/pages/Welcome.page -text
demos/time-tracker/tests/functional.php -text
diff --git a/demos/blog/index_php.php b/demos/blog/index_php.php
new file mode 100644
index 00000000..a5434860
--- /dev/null
+++ b/demos/blog/index_php.php
@@ -0,0 +1,20 @@
+run();
\ No newline at end of file
diff --git a/demos/blog/protected/Data/Settings.php b/demos/blog/protected/Data/Settings.php
new file mode 100644
index 00000000..a4adcd9f
--- /dev/null
+++ b/demos/blog/protected/Data/Settings.php
@@ -0,0 +1,13 @@
+ 'MyBlog',
+ 'SiteSubtitle' => 'A Prado-driven weblog',
+ 'SiteOwner' => 'Prado User',
+ 'AdminEmail' => 'admin@example.com',
+ 'MultipleUser' => false,
+ 'AccountApproval' => false,
+ 'PostPerPage' => 6,
+ 'RecentComments' => 6,
+ 'PostApproval' => false,
+ 'ThemeName' => 'Winter'
+);
\ No newline at end of file
diff --git a/demos/blog/protected/Pages/Admin/config.php b/demos/blog/protected/Pages/Admin/config.php
new file mode 100644
index 00000000..d392da4e
--- /dev/null
+++ b/demos/blog/protected/Pages/Admin/config.php
@@ -0,0 +1,13 @@
+ array(
+ array(
+ 'action' => 'allow',
+ 'roles' => 'admin',
+ ),
+ array(
+ 'action' => 'deny',
+ 'users' => '*',
+ ),
+ ),
+);
\ No newline at end of file
diff --git a/demos/blog/protected/Pages/Posts/config.php b/demos/blog/protected/Pages/Posts/config.php
new file mode 100644
index 00000000..8af0dd56
--- /dev/null
+++ b/demos/blog/protected/Pages/Posts/config.php
@@ -0,0 +1,20 @@
+ array(
+ array(
+ 'action' => 'deny',
+ 'pages' => 'EditPost,NewPost,MyPost',
+ 'users' => '?',
+ ),
+ array(
+ 'action' => 'allow',
+ 'pages' => 'NewCategory,EditCategory',
+ 'users' => 'admin',
+ ),
+ array(
+ 'action' => 'deny',
+ 'pages' => 'NewCategory,EditCategory',
+ 'users' => '*',
+ ),
+ )
+);
\ No newline at end of file
diff --git a/demos/blog/protected/application.php b/demos/blog/protected/application.php
new file mode 100644
index 00000000..c6f26c7e
--- /dev/null
+++ b/demos/blog/protected/application.php
@@ -0,0 +1,86 @@
+ array(
+ 'id' => 'blog',
+ 'mode' => 'Debug'
+ ),
+ 'paths' => array(
+ 'using' => array(
+ 'Application.Common.*',
+ ),
+ ),
+ // Modules configured and loaded for all services
+ 'modules' => array(
+ 'request' => array(
+ 'class' => 'THttpRequest',
+ 'properties' => array(
+ 'UrlFormat' => 'Path',
+ 'UrlManager' => 'friendly-url',
+ ),
+ ),
+
+ 'cache' => array(
+ 'class' => 'System.Caching.TSqliteCache',
+ ),
+
+ 'error' => array(
+ 'class' => 'Application.Common.BlogErrorHandler',
+ ),
+ array(
+ 'class' => 'System.Util.TLogRouter',
+ 'routes' => array(
+ array(
+ 'class' => 'TFileLogRoute',
+ 'properties' => array(
+ 'Categories' => 'BlogApplication',
+ ),
+ ),
+ ),
+ ),
+ array(
+ 'class' => 'System.Util.TParameterModule',
+ 'properties' => array(
+ 'ParameterFile' => 'Application.Data.Settings',
+ ),
+ ),
+ 'friendly-url' => array(
+ 'class' => 'System.Web.TUrlMapping',
+ 'properties' => array(
+ 'EnableCustomUrl' => true,
+ ),
+ 'urls' => array(
+ array('properties' => array('ServiceParameter'=>'Posts.ViewPost','pattern'=>'post/{id}/?','parameters.id'=>'\d+')),
+ ),
+ ),
+ ),
+ 'services' => array(
+ 'page' => array(
+ 'class' => 'TPageService',
+ 'properties' => array(
+ 'BasePath' => 'Application.Pages',
+ 'DefaultPage' => 'Posts.ListPost',
+ ),
+ 'modules' => array(
+ 'users' => array(
+ 'class' => 'Application.Common.BlogUserManager',
+ ),
+ 'auth' => array(
+ 'class' => 'System.Security.TAuthManager',
+ 'properties' => array(
+ 'UserManager' => 'users',
+ 'LoginPage' => 'Posts.ListPost',
+ ),
+ ),
+ 'data' => array(
+ 'class' => 'Application.Common.BlogDataModule',
+ ),
+ ),
+ ),
+ ),
+ 'pages' => array(
+ 'properties' => array(
+ 'MasterClass' => 'Application.Layouts.MainLayout',
+ 'Theme' => 'Basic',
+ ),
+ ),
+);
\ No newline at end of file
diff --git a/demos/blog/protected/application.xml b/demos/blog/protected/application.xml
index d28b2dd7..1ab6a9c0 100644
--- a/demos/blog/protected/application.xml
+++ b/demos/blog/protected/application.xml
@@ -6,10 +6,10 @@
-
-
+
+
+
+
@@ -17,7 +17,7 @@
-
+
diff --git a/demos/chat/index_php.php b/demos/chat/index_php.php
new file mode 100644
index 00000000..88427e4a
--- /dev/null
+++ b/demos/chat/index_php.php
@@ -0,0 +1,27 @@
+run();
\ No newline at end of file
diff --git a/demos/chat/protected/application.php b/demos/chat/protected/application.php
new file mode 100644
index 00000000..ae4e1d8c
--- /dev/null
+++ b/demos/chat/protected/application.php
@@ -0,0 +1,25 @@
+ array(
+ 'id' => 'Chat',
+ 'mode' => 'Debug'
+ ),
+ 'paths' => array(
+ 'using'=>array(
+ 'Application.App_Code.*',
+ 'System.Data.*',
+ 'System.Data.ActiveRecord.*',
+ 'System.Security.*',
+ 'System.Web.UI.ActiveControls.*',
+ ),
+ ),
+ 'modules' => array(
+ 'db' => array(
+ 'class' => 'TActiveRecordConfig',
+ 'properties' => array(
+ 'EnableCache' => 'true',
+ 'Database.ConnectionString'=>"sqlite:protected/App_Code/chat.db",
+ )
+ ),
+ ),
+);
\ No newline at end of file
diff --git a/demos/chat/protected/pages/config.php b/demos/chat/protected/pages/config.php
new file mode 100644
index 00000000..926bf150
--- /dev/null
+++ b/demos/chat/protected/pages/config.php
@@ -0,0 +1,31 @@
+ array(
+ 'users' => array(
+ 'class' => 'ChatUserManager',
+ ),
+ 'auth' => array(
+ 'class' => 'TAuthManager',
+ 'properties' => array(
+ 'UserManager' => 'users',
+ 'LoginPage' => 'Login',
+ ),
+ ),
+ ),
+
+ 'authorization' => array(
+ array(
+ 'action' => 'allow',
+ 'pages' => 'Login',
+ 'users' => '?',
+ ),
+ array(
+ 'action' => 'allow',
+ 'roles' => 'normal',
+ ),
+ array(
+ 'action' => 'deny',
+ 'users' => '*',
+ ),
+ ),
+);
\ No newline at end of file
diff --git a/demos/northwind-db/index_php.php b/demos/northwind-db/index_php.php
new file mode 100644
index 00000000..d3fe038b
--- /dev/null
+++ b/demos/northwind-db/index_php.php
@@ -0,0 +1,26 @@
+run();
\ No newline at end of file
diff --git a/demos/northwind-db/protected/application.php b/demos/northwind-db/protected/application.php
new file mode 100644
index 00000000..2d6d4ec7
--- /dev/null
+++ b/demos/northwind-db/protected/application.php
@@ -0,0 +1,29 @@
+ array(
+ 'id' => 'northwind-db',
+ 'mode' => 'Debug'
+ ),
+ 'paths' => array(
+ 'using'=>array(
+ 'System.Data.*',
+ 'System.Data.ActiveRecord.*',
+ 'System.Data.ActiveRecord.Scaffold.*',
+ 'Application.database.*',
+ ),
+ ),
+ 'modules' => array(
+ 'db' => array(
+ 'class' => 'TActiveRecordConfig',
+ 'database' => array(
+ 'ConnectionString' => 'sqlite:protected/data/Northwind.db',
+ ),
+ ),
+ 'i81n' => array(
+ 'class' => 'System.I18N.TGlobalization',
+ 'properties' => array(
+ 'DefaultCharSet'=>'UTF-8',
+ ),
+ ),
+ ),
+);
\ No newline at end of file
diff --git a/demos/personal/protected/Pages/config.php b/demos/personal/protected/Pages/config.php
index 23cb184e..7a42d866 100644
--- a/demos/personal/protected/Pages/config.php
+++ b/demos/personal/protected/Pages/config.php
@@ -4,7 +4,7 @@ return array(
array(
'action' => 'deny',
'pages' => 'Settings',
- 'users' => '?',
+ 'users' => '?',
),
),
'pages' => array(
diff --git a/demos/personal/protected/application.php b/demos/personal/protected/application.php
index 26100576..0d9cadd4 100644
--- a/demos/personal/protected/application.php
+++ b/demos/personal/protected/application.php
@@ -5,7 +5,7 @@ return array(
'mode' => 'Debug',
),
'paths' => array(
- 'using'=>array('Application.Common.*'),
+ 'using'=>array('Application.common.*'),
),
'modules' => array(
),
diff --git a/demos/sqlmap/index_php.php b/demos/sqlmap/index_php.php
new file mode 100644
index 00000000..4c382999
--- /dev/null
+++ b/demos/sqlmap/index_php.php
@@ -0,0 +1,18 @@
+run('protected',false,TApplication::CONFIG_TYPE_PHP);
\ No newline at end of file
diff --git a/demos/sqlmap/protected/pages/Manual/config.php b/demos/sqlmap/protected/pages/Manual/config.php
new file mode 100644
index 00000000..ca1ec772
--- /dev/null
+++ b/demos/sqlmap/protected/pages/Manual/config.php
@@ -0,0 +1,18 @@
+ array(
+ 'theme' => array(
+ 'class' => 'System.Web.UI.TThemeManager',
+ 'properties' => array(
+ 'BasePath' => 'Quickstart.themes',
+ 'BaseUrl' => '../quickstart/themes',
+ ),
+ ),
+ ),
+ 'pages' => array(
+ 'properties' => array(
+ 'MasterClass' => 'Application.pages.Manual.Layout',
+ 'Theme' => 'PradoSoft',
+ ),
+ ),
+);
\ No newline at end of file
diff --git a/demos/time-tracker/index_php.php b/demos/time-tracker/index_php.php
new file mode 100644
index 00000000..b74690e4
--- /dev/null
+++ b/demos/time-tracker/index_php.php
@@ -0,0 +1,33 @@
+getGlobalization();
+ $charset = $app ? $app->getCharset() : 'UTF-8';
+ return htmlentities($text, ENT_QUOTES, $charset);
+}
+
+$application=new TApplication;
+$application->run('protected',false,TApplication::CONFIG_TYPE_PHP);
\ No newline at end of file
diff --git a/demos/time-tracker/protected/application.php b/demos/time-tracker/protected/application.php
new file mode 100644
index 00000000..4fd65d04
--- /dev/null
+++ b/demos/time-tracker/protected/application.php
@@ -0,0 +1,49 @@
+ array(
+ 'id'=>'Time-Tracker',
+ 'Mode'=>'Debug'
+ ),
+ 'paths' => array(
+ 'aliases' => array(
+ 'Quickstart' => '../../quickstart',
+ ),
+ 'using' => array(
+ 'System.Data.*',
+ 'System.Security.*',
+ 'Application.App_Code.*',
+ 'Application.App_Code.Dao.*',
+ 'Application.App_Data.*',
+ ),
+ ),
+ 'modules' => array(
+ 'daos' => array(
+ 'class' => 'DaoManager',
+ 'properties' => array(
+ 'EnableCache' => 'true',
+ 'configFile' => 'Application.App_Data.sqlite-sqlmap',
+ ),
+ 'daos' => array(
+ 'UserDao' => 'Application.App_Code.Dao.UserDao',
+ 'ProjectDao' => 'Application.App_Code.Dao.ProjectDao',
+ 'TimeEntryDao' => 'Application.App_Code.Dao.TimeEntryDao',
+ 'CategoryDao' => 'Application.App_Code.Dao.CategoryDao',
+ 'ReportDao' => 'Application.App_Code.Dao.ReportDao',
+ )
+ ),
+ 'globalization' => array(
+ 'class' => 'System.I18N.TGlobalization',
+ 'properties' => array(
+ 'CharSet' => 'UTF-8',
+ ),
+ ),
+ ),
+ 'services' => array(
+ 'page' => array(
+ 'class' => 'TPageService',
+ 'properties' => array(
+ 'DefaultPage' => 'TimeTracker.LogTimeEntry',
+ ),
+ ),
+ ),
+);
\ No newline at end of file
diff --git a/demos/time-tracker/protected/pages/TimeTracker/config.php b/demos/time-tracker/protected/pages/TimeTracker/config.php
new file mode 100644
index 00000000..8668ca15
--- /dev/null
+++ b/demos/time-tracker/protected/pages/TimeTracker/config.php
@@ -0,0 +1,30 @@
+ array(
+ 'users' => array(
+ 'class' => 'Application.App_Code.UserManager',
+ ),
+ 'auth' => array(
+ 'class' => 'Application.App_Code.TrackerAuthManager',
+ 'properties' => array(
+ 'UserManager' => 'users',
+ 'LoginPage' => 'TimeTracker.Login'
+ ),
+ ),
+ ),
+ 'authorization' => array(
+ array('action'=>'allow','pages'=>'ProjectList, ProjectDetails, ReportResource, ReportProject','roles'=>'manager'),
+ array('action'=>'allow','pages'=>'LogTimeEntry','roles'=>'consultant'),
+ array('action'=>'allow','pages'=>'UserCrate,Logout,Login','users'=>'*'),
+ array('action'=>'deny','users'=>'*'),
+ ),
+ 'pages' => array(
+ 'properties' => array(
+ 'MasterClass' => 'Application.pages.TimeTracker.MainLayout',
+ 'Theme' => 'TimeTracker',
+ ),
+ ),
+ 'parameters' => array(
+ 'NewUserRoles' => 'admin,manager,consultant',
+ ),
+);
\ No newline at end of file
diff --git a/framework/Exceptions/messages/messages.txt b/framework/Exceptions/messages/messages.txt
index fc2b63f1..ee5fc317 100644
--- a/framework/Exceptions/messages/messages.txt
+++ b/framework/Exceptions/messages/messages.txt
@@ -24,7 +24,7 @@ map_item_unremovable = The item cannot be removed from the map.
map_data_not_iterable = Data must be either an array or an object implementing Traversable interface.
map_readonly = {0} is read-only.
-application_includefile_invalid = Unable to find application configuration {0}. Make sure it is in namespace format and the file ends with ".xml".
+application_includefile_invalid = Unable to find application configuration {0}. Make sure it is in namespace format and the file ends with ".xml" or ".php".
application_basepath_invalid = Application base path '{0}' does not exist or is not a directory.
application_runtimepath_invalid = Application runtime path '{0}' does not exist or is not writable by Web server process.
application_service_invalid = Service '{0}' must implement IService interface.
@@ -114,7 +114,7 @@ pageservice_page_required = Page Name Required
pageservice_defaultpage_unchangeable = TPageService.DefaultPage cannot be modified after the service is initialized.
pageservice_basepath_unchangeable = TPageService.BasePath cannot be modified after the service is initialized.
pageservice_pageclass_invalid = Page class {0} is invalid. It should be TPage or extend from TPage.
-pageservice_includefile_invalid = Unable to find page service configuration {0}. Make sure it is in namespace format and the file ends with ".xml".
+pageservice_includefile_invalid = Unable to find page service configuration {0}. Make sure it is in namespace format and the file ends with ".xml" or ".php".
pageserviceconf_file_invalid = Unable to open page directory configuration file '{0}'.
pageserviceconf_aliaspath_invalid = uses an invalid file path "{1}" in page directory configuration file '{2}'.
@@ -315,7 +315,7 @@ htmlarea_textmode_readonly = THtmlArea.TextMode is read-only.
htmlarea_tarfile_invalid = THtmlArea is unable to locate the TinyMCE tar file.
parametermodule_parameterfile_unchangeable = TParameterModule.ParameterFile is not changeable because the module is already initialized.
-parametermodule_parameterfile_invalid = TParameterModule.ParameterFile '{0}' is invalid. Make sure it is in namespace format and the file extension is '.xml'.
+parametermodule_parameterfile_invalid = TParameterModule.ParameterFile '{0}' is invalid. Make sure it is in namespace format and the file extension is '.xml' or '.php'.
parametermodule_parameterid_required = Parameter element must have 'id' attribute.
datagridcolumn_id_invalid = {0}.ID '{1}' is invalid. Only alphanumeric and underline characters are allowed. The first character must be an alphabetic or underline character.
@@ -401,7 +401,7 @@ dbtablegateway_invalid_table_info = Table must be a string or an instance of TD
directorycachedependency_directory_invalid = TDirectoryCacheDependency.Directory {0} does not refer to a valid directory.
cachedependencylist_cachedependency_required = Only objects implementing ICacheDependency can be added into TCacheDependencyList.
-soapservice_configfile_invalid = TSoapService.ConfigFile '{0}' does not exist. Note, it has to be specified in a namespace format and the file extension must be '.xml'.
+soapservice_configfile_invalid = TSoapService.ConfigFile '{0}' does not exist. Note, it has to be specified in a namespace format and the file extension must be '.xml' or '.php'.
soapservice_request_invalid = SOAP server '{0}' not found.
soapservice_serverid_required = element must have 'id' attribute.
soapservice_serverid_duplicated = SOAP server ID '{0}' is duplicated.
diff --git a/framework/I18N/TGlobalization.php b/framework/I18N/TGlobalization.php
index 1d158ce9..7a7dce00 100644
--- a/framework/I18N/TGlobalization.php
+++ b/framework/I18N/TGlobalization.php
@@ -4,7 +4,7 @@
*
* @author Wei Zhuo
* @link http://www.pradosoft.com/
- * @copyright Copyright © 2005-2008 PradoSoft
+ * @copyright Copyright © 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.I18N
@@ -62,20 +62,27 @@ class TGlobalization extends TModule
* You should override this method if you want a different way of
* setting the Culture and/or Charset for your application.
* If you override this method, call parent::init($xml) first.
- * @param TXmlElement application configuration
+ * @param mixed application configuration
*/
- public function init($xml)
+ public function init($config)
{
if($this->_charset===null)
$this->_charset=$this->getDefaultCharset();
if($this->_culture===null)
$this->_culture=$this->getDefaultCulture();
- if($xml!==null)
+ if($config!==null)
{
- $translation = $xml->getElementByTagName('translation');
+ if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
+ $translation = isset($config['translate'])?$config['translate']:null;
+ else
+ {
+ $t = $config->getElementByTagName('translation');
+ if($t)
+ $translation = $t->getAttributes();
+ }
if($translation)
- $this->setTranslationConfiguration($translation->getAttributes());
+ $this->setTranslationConfiguration($translation);
}
$this->getApplication()->setGlobalization($this);
}
@@ -165,9 +172,9 @@ class TGlobalization extends TModule
* $config['marker'] = '@@'; // surround untranslated text with '@@'
*
* Throws exception is source is not found.
- * @param TMap configuration options
+ * @param TMap|array configuration options
*/
- protected function setTranslationConfiguration(TMap $config)
+ protected function setTranslationConfiguration($config)
{
if($config['type'] == 'XLIFF' || $config['type'] == 'gettext')
{
diff --git a/framework/Security/TUserManager.php b/framework/Security/TUserManager.php
index dbaa5ffb..878ca864 100644
--- a/framework/Security/TUserManager.php
+++ b/framework/Security/TUserManager.php
@@ -29,6 +29,26 @@ Prado::using('System.Security.TUser');
*
*
*
+ * PHP configuration style:
+ *
+ * array(
+ * 'users' => array(
+ * 'class' => 'System.Security.TUserManager',
+ * 'properties' => array(
+ * 'PasswordMode' => 'Clear',
+ * ),
+ * 'users' => array(
+ * array('name'=>'Joe','password'=>'demo'),
+ * array('name'=>'John','password'=>'demo'),
+ * ),
+ * 'roles' => array(
+ * array('name'=>'Administrator','users'=>'John'),
+ * array('name'=>'Writer','users'=>'Joe,John'),
+ * ),
+ * ),
+ * )
+ *
+ *
* In addition, user information can also be loaded from an external file
* specified by {@link setUserFile UserFile} property. Note, the property
* only accepts a file path in namespace format. The user file format is
@@ -43,6 +63,7 @@ Prado::using('System.Security.TUser');
* how users are authenticated and authorized in a Prado application.
*
* @author Qiang Xue
+ * @author Carl Mathisen
* @version $Id$
* @package System.Security
* @since 3.0
@@ -87,17 +108,13 @@ class TUserManager extends TModule implements IUserManager
*/
public function init($config)
{
- $isPhp = $this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP;
- if($isPhp)
- $this->loadUserDataFromPhp($config);
- else
- $this->loadUserDataFromXml($config);
-
+ $this->loadUserData($config);
if($this->_userFile!==null)
{
- if($isPhp)
+ if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
{
- $this->loadUserDataFromPhp($config);
+ $userFile = include $this->_userFile;
+ $this->loadUserDataFromPhp($userFile);
}
else
{
@@ -108,7 +125,23 @@ class TUserManager extends TModule implements IUserManager
}
$this->_initialized=true;
}
+
+ /*
+ * Loads user/role information
+ * @param mixed the variable containing the user information
+ */
+ private function loadUserData($config)
+ {
+ if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
+ $this->loadUserDataFromPhp($config);
+ else
+ $this->loadUserDataFromXml($config);
+ }
+ /**
+ * Loads user/role information from an php array.
+ * @param array the array containing the user information
+ */
private function loadUserDataFromPhp($config)
{
if(isset($config['users']) && is_array($config['users']))
diff --git a/framework/TApplication.php b/framework/TApplication.php
index e690aa96..d9298d90 100644
--- a/framework/TApplication.php
+++ b/framework/TApplication.php
@@ -148,7 +148,6 @@ class TApplication extends TComponent
* Configuration file type, application.php and config.php
*/
const CONFIG_TYPE_PHP = 'php';
-
/**
* Runtime directory name
*/
@@ -588,16 +587,25 @@ class TApplication extends TComponent
$this->_configFile=$value;
}
+ /**
+ * @return string the application configuration file (absolute path)
+ */
public function getConfigurationType()
{
return $this->_configType;
}
+ /**
+ * @param string the application configuration type. 'xml' and 'php' are valid values
+ */
public function setConfigurationType($value)
{
$this->_configType = $value;
}
+ /**
+ * @return string the applictaion configuration type. default is 'xml'
+ */
public function getConfigurationFileExt()
{
if($this->_configFileExt===null)
@@ -614,6 +622,9 @@ class TApplication extends TComponent
return $this->_configFileExt;
}
+ /**
+ * @return string the default configuration file name
+ */
public function getConfigurationFileName()
{
static $fileName;
@@ -1242,6 +1253,7 @@ class TApplicationMode extends TEnumerable
* This class is used internally by TApplication to parse and represent application configuration.
*
* @author Qiang Xue
+ * @author Carl G. Mathisen
* @version $Id$
* @package System
* @since 3.0
@@ -1309,6 +1321,11 @@ class TApplicationConfiguration extends TComponent
return $this->_empty;
}
+ /**
+ * Parses the application configuration given in terms of a PHP array.
+ * @param array the PHP array
+ * @param string the context path (for specifying relative paths)
+ */
public function loadFromPhp($config, $configPath)
{
// application properties
@@ -1377,6 +1394,11 @@ class TApplicationConfiguration extends TComponent
}
}
+ /**
+ * Loads the paths PHP array
+ * @param array the paths PHP array
+ * @param string the context path (for specifying relative paths)
+ */
protected function loadPathsPhp($pathsNode, $configPath)
{
if(isset($pathsNode['aliases']) && is_array($pathsNode['aliases']))
@@ -1451,6 +1473,11 @@ class TApplicationConfiguration extends TComponent
}
}
+ /**
+ * Loads the modules PHP array.
+ * @param array the modules PHP array
+ * @param string the context path (for specifying relative paths)
+ */
protected function loadModulesPhp($modulesNode, $configPath)
{
foreach($modulesNode as $id=>$module)
@@ -1499,6 +1526,11 @@ class TApplicationConfiguration extends TComponent
}
}
+ /**
+ * Loads the services PHP array.
+ * @param array the services PHP array
+ * @param string the context path (for specifying relative paths)
+ */
protected function loadServicesPhp($servicesNode,$configPath)
{
foreach($servicesNode as $id => $service)
@@ -1506,7 +1538,6 @@ class TApplicationConfiguration extends TComponent
if(!isset($service['class']))
throw new TConfigurationException('appconfig_servicetype_required');
$type = $service['class'];
- unset($service['class']);
$properties = isset($service['properties']) ? $service['properties'] : array();
unset($service['properties']);
$properties['id'] = $id;
@@ -1540,6 +1571,11 @@ class TApplicationConfiguration extends TComponent
}
}
+ /**
+ * Loads the parameters PHP array.
+ * @param array the parameters PHP array
+ * @param string the context path (for specifying relative paths)
+ */
protected function loadParametersPhp($parametersNode,$configPath)
{
foreach($parametersNode as $id => $parameter)
@@ -1592,6 +1628,11 @@ class TApplicationConfiguration extends TComponent
}
}
+ /**
+ * Loads the external PHP array.
+ * @param array the application PHP array
+ * @param string the context path (for specifying relative paths)
+ */
protected function loadExternalPhp($includeNode,$configPath)
{
foreach($includeNode as $include)
diff --git a/framework/Util/TLogRouter.php b/framework/Util/TLogRouter.php
index aa772194..c693d24a 100644
--- a/framework/Util/TLogRouter.php
+++ b/framework/Util/TLogRouter.php
@@ -27,20 +27,21 @@ Prado::using('System.Data.TDbConnection');
*
*
*
+ * PHP configuration style:
+ *
+ *
+ *
* You can specify multiple routes with different filtering conditions and different
* targets, even if the routes are of the same type.
*
* @author Qiang Xue
+ * @author Carl G. Mathisen
* @version $Id$
* @package System.Util
* @since 3.0
*/
class TLogRouter extends TModule
{
- /**
- * File extension of external configuration file
- */
- const CONFIG_FILE_EXT='.xml';
/**
* @var array list of routes available
*/
@@ -53,7 +54,7 @@ class TLogRouter extends TModule
/**
* Initializes this module.
* This method is required by the IModule interface.
- * @param TXmlElement configuration for this module, can be null
+ * @param mixed configuration for this module, can be null
* @throws TConfigurationException if {@link getConfigFile ConfigFile} is invalid.
*/
public function init($config)
@@ -62,9 +63,17 @@ class TLogRouter extends TModule
{
if(is_file($this->_configFile))
{
- $dom=new TXmlDocument;
- $dom->loadFromFile($this->_configFile);
- $this->loadConfig($dom);
+ if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
+ {
+ $phpConfig = include $this->_configFile;
+ $this->loadConfig($phpConfig);
+ }
+ else
+ {
+ $dom=new TXmlDocument;
+ $dom->loadFromFile($this->_configFile);
+ $this->loadConfig($dom);
+ }
}
else
throw new TConfigurationException('logrouter_configfile_invalid',$this->_configFile);
@@ -74,24 +83,46 @@ class TLogRouter extends TModule
}
/**
- * Loads configuration from an XML element
- * @param TXmlElement configuration node
+ * Loads configuration from an XML element or PHP array
+ * @param mixed configuration node
* @throws TConfigurationException if log route class or type is not specified
*/
- private function loadConfig($xml)
+ private function loadConfig($config)
{
- foreach($xml->getElementsByTagName('route') as $routeConfig)
+ if(is_array($config))
{
- $properties=$routeConfig->getAttributes();
- if(($class=$properties->remove('class'))===null)
- throw new TConfigurationException('logrouter_routeclass_required');
- $route=Prado::createComponent($class);
- if(!($route instanceof TLogRoute))
- throw new TConfigurationException('logrouter_routetype_invalid');
- foreach($properties as $name=>$value)
- $route->setSubproperty($name,$value);
- $this->_routes[]=$route;
- $route->init($routeConfig);
+ if(isset($config['routes']) && is_array($config['routes']))
+ {
+ foreach($config['routes'] as $route)
+ {
+ $properties = isset($route['properties'])?$route['properties']:array();
+ if(!isset($route['class']))
+ throw new TConfigurationException('logrouter_routeclass_required');
+ $route=Prado::createComponent($route['class']);
+ if(!($route instanceof TLogRoute))
+ throw new TConfigurationException('logrouter_routetype_invalid');
+ foreach($properties as $name=>$value)
+ $route->setSubproperty($name,$value);
+ $this->_routes[]=$route;
+ $route->init($routeConfig);
+ }
+ }
+ }
+ else
+ {
+ foreach($config->getElementsByTagName('route') as $routeConfig)
+ {
+ $properties=$routeConfig->getAttributes();
+ if(($class=$properties->remove('class'))===null)
+ throw new TConfigurationException('logrouter_routeclass_required');
+ $route=Prado::createComponent($class);
+ if(!($route instanceof TLogRoute))
+ throw new TConfigurationException('logrouter_routetype_invalid');
+ foreach($properties as $name=>$value)
+ $route->setSubproperty($name,$value);
+ $this->_routes[]=$route;
+ $route->init($routeConfig);
+ }
}
}
@@ -124,7 +155,7 @@ class TLogRouter extends TModule
*/
public function setConfigFile($value)
{
- if(($this->_configFile=Prado::getPathOfNamespace($value,self::CONFIG_FILE_EXT))===null)
+ if(($this->_configFile=Prado::getPathOfNamespace($value,$this->getApplication()->getConfigurationFileExt()))===null)
throw new TConfigurationException('logrouter_configfile_invalid',$value);
}
diff --git a/framework/Util/TParameterModule.php b/framework/Util/TParameterModule.php
index 529f20ca..7bc03e3b 100644
--- a/framework/Util/TParameterModule.php
+++ b/framework/Util/TParameterModule.php
@@ -4,7 +4,7 @@
*
* @author Qiang Xue
* @link http://www.pradosoft.com/
- * @copyright Copyright © 2005-2008 PradoSoft
+ * @copyright Copyright © 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Util
@@ -46,63 +46,95 @@
*/
class TParameterModule extends TModule
{
+ /**
+ * @deprecated since 3.2
+ */
const PARAM_FILE_EXT='.xml';
private $_initialized=false;
private $_paramFile=null;
/**
* Initializes the module by loading parameters.
- * @param TXmlElement content enclosed within the module tag
+ * @param mixed content enclosed within the module tag
*/
public function init($config)
{
$this->loadParameters($config);
if($this->_paramFile!==null)
{
+ $configFile = null;
if(($cache=$this->getApplication()->getCache())!==null)
{
$cacheKey='TParameterModule:'.$this->_paramFile;
if(($dom=$cache->get($cacheKey))===false)
{
- $dom=new TXmlDocument;
- $dom->loadFromFile($this->_paramFile);
- $cache->set($cacheKey,$dom,0,new TFileCacheDependency($this->_paramFile));
+ if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
+ $configFile = include $this->_paramFile;
+ else
+ {
+ $configFile=new TXmlDocument;
+ $configFile->loadFromFile($this->_paramFile);
+ }
+ $cache->set($cacheKey,$configFile,0,new TFileCacheDependency($this->_paramFile));
}
}
else
{
- $dom=new TXmlDocument;
- $dom->loadFromFile($this->_paramFile);
+ if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
+ $configFile = include $this->_paramFile;
+ else
+ {
+ $configFile=new TXmlDocument;
+ $configFile->loadFromFile($this->_paramFile);
+ }
}
- $this->loadParameters($dom);
+ $this->loadParameters($configFile);
}
$this->_initialized=true;
}
/**
* Loads parameters into application.
- * @param TXmlElement XML representation of the parameters
+ * @param mixed XML or PHP representation of the parameters
* @throws TConfigurationException if the parameter file format is invalid
*/
- protected function loadParameters($xmlNode)
+ protected function loadParameters($config)
{
$parameters=array();
- foreach($xmlNode->getElementsByTagName('parameter') as $node)
+ if(is_array($config))
+ {
+ foreach($config as $id => $parameter)
+ {
+ if(is_array($parameter) && isset($parameter['class']))
+ {
+ $properties = isset($parameter['properties'])?$parameter['properties']:array();
+ $parameters[$id]=array($parameter['class'],$properties);
+ }
+ else
+ {
+ $parameters[$id] = $parameter;
+ }
+ }
+ }
+ else if($config instanceof TXmlElement)
{
- $properties=$node->getAttributes();
- if(($id=$properties->remove('id'))===null)
- throw new TConfigurationException('parametermodule_parameterid_required');
- if(($type=$properties->remove('class'))===null)
+ foreach($config->getElementsByTagName('parameter') as $node)
{
- if(($value=$properties->remove('value'))===null)
- $parameters[$id]=$node;
+ $properties=$node->getAttributes();
+ if(($id=$properties->remove('id'))===null)
+ throw new TConfigurationException('parametermodule_parameterid_required');
+ if(($type=$properties->remove('class'))===null)
+ {
+ if(($value=$properties->remove('value'))===null)
+ $parameters[$id]=$node;
+ else
+ $parameters[$id]=$value;
+ }
else
- $parameters[$id]=$value;
+ $parameters[$id]=array($type,$properties->toArray());
}
- else
- $parameters[$id]=array($type,$properties->toArray());
}
-
+
$appParams=$this->getApplication()->getParameters();
foreach($parameters as $id=>$parameter)
{
@@ -136,7 +168,7 @@ class TParameterModule extends TModule
{
if($this->_initialized)
throw new TInvalidOperationException('parametermodule_parameterfile_unchangeable');
- else if(($this->_paramFile=Prado::getPathOfNamespace($value,self::PARAM_FILE_EXT))===null || !is_file($this->_paramFile))
+ else if(($this->_paramFile=Prado::getPathOfNamespace($value,$this->getApplication()->getConfigurationFileExt()))===null || !is_file($this->_paramFile))
throw new TConfigurationException('parametermodule_parameterfile_invalid',$value);
}
}
diff --git a/framework/Web/Services/TFeedService.php b/framework/Web/Services/TFeedService.php
index 7ecd10a7..d4afbade 100644
--- a/framework/Web/Services/TFeedService.php
+++ b/framework/Web/Services/TFeedService.php
@@ -5,7 +5,7 @@
* @author Qiang Xue
* @author Knut Urdalen
* @link http://www.pradosoft.com
- * @copyright Copyright © 2005-2008 PradoSoft
+ * @copyright Copyright © 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web.Services
@@ -28,6 +28,20 @@
*
*
* where each <feed> element specifies a feed identified by its "id" value (case-sensitive).
+ *
+ * PHP configuration style:
+ *
+ * array(
+ * 'feed' => array(
+ * 'ch1' => array(
+ * 'class' => 'Path.To.FeedClass1',
+ * 'properties' => array(
+ * ...
+ * ),
+ * ),
+ * )
+ *
+ *
* The class attribute indicates which PHP class will provide the actual feed
* content. Note, the class must implement {@link IFeedContentProvider} interface.
* Other initial properties for the feed class may also be specified in the
@@ -38,6 +52,7 @@
*
* @author Qiang Xue
* @author Knut Urdalen
+ * @author Carl G. Mathisen
* @package System.Web.Services
* @since 3.1
*/
@@ -48,16 +63,27 @@ class TFeedService extends TService
/**
* Initializes this module.
* This method is required by the IModule interface.
- * @param TXmlElement configuration for this module, can be null
+ * @param mixed configuration for this module, can be null
*/
public function init($config)
{
- foreach($config->getElementsByTagName('feed') as $feed)
+ if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
{
- if(($id=$feed->getAttributes()->remove('id'))!==null)
- $this->_feeds[$id]=$feed;
- else
- throw new TConfigurationException('feedservice_id_required');
+ if(is_array($config))
+ {
+ foreach($config as $id => $feed)
+ $this->_feeds[$id] = $feed;
+ }
+ }
+ else
+ {
+ foreach($config->getElementsByTagName('feed') as $feed)
+ {
+ if(($id=$feed->getAttributes()->remove('id'))!==null)
+ $this->_feeds[$id]=$feed;
+ else
+ throw new TConfigurationException('feedservice_id_required');
+ }
}
}
@@ -79,27 +105,43 @@ class TFeedService extends TService
if(isset($this->_feeds[$id]))
{
$feedConfig=$this->_feeds[$id];
- $properties=$feedConfig->getAttributes();
- if(($class=$properties->remove('class'))!==null)
+ $properties = array();
+ $feed = null;
+ if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
{
- $feed=Prado::createComponent($class);
- if($feed instanceof IFeedContentProvider)
+ if(isset($feedConfig['class']))
{
- // init feed properties
- foreach($properties as $name=>$value)
- $feed->setSubproperty($name,$value);
- $feed->init($feedConfig);
-
- $content=$feed->getFeedContent();
- //$this->getResponse()->setContentType('application/rss+xml');
- $this->getResponse()->setContentType($feed->getContentType());
- $this->getResponse()->write($content);
+ $feed=Prado::createComponent($feedConfig['class']);
+ if($service instanceof IFeedContentProvider)
+ $properties=isset($feedConfig['properties'])?$feedConfig['properties']:array();
+ else
+ throw new TConfigurationException('jsonservice_response_type_invalid',$id);
}
else
- throw new TConfigurationException('feedservice_feedtype_invalid',$id);
+ throw new TConfigurationException('jsonservice_class_required',$id);
}
else
- throw new TConfigurationException('feedservice_class_required',$id);
+ {
+ $properties=$feedConfig->getAttributes();
+ if(($class=$properties->remove('class'))!==null)
+ {
+ $feed=Prado::createComponent($class);
+ if(!($feed instanceof IFeedContentProvider))
+ throw new TConfigurationException('feedservice_feedtype_invalid',$id);
+ }
+ else
+ throw new TConfigurationException('feedservice_class_required',$id);
+ }
+
+ // init feed properties
+ foreach($properties as $name=>$value)
+ $feed->setSubproperty($name,$value);
+ $feed->init($feedConfig);
+
+ $content=$feed->getFeedContent();
+ //$this->getResponse()->setContentType('application/rss+xml');
+ $this->getResponse()->setContentType($feed->getContentType());
+ $this->getResponse()->write($content);
}
else
throw new THttpException(404,'feedservice_feed_unknown',$id);
diff --git a/framework/Web/Services/TJsonService.php b/framework/Web/Services/TJsonService.php
index e3ed9a7f..84f2dee2 100644
--- a/framework/Web/Services/TJsonService.php
+++ b/framework/Web/Services/TJsonService.php
@@ -29,10 +29,24 @@
* where each JSON response is specified via a <json> element.
* Initial property values can be configured in a <json> element.
*
+ *
+ * PHP configuration style:
+ *
+ * 'services' => array(
+ * 'get_article' => array(
+ * 'class' => 'Path.To.JsonResponseClass1',
+ * 'properties' => array(
+ * ...
+ * )
+ * )
+ * )
+ *
+ *
* To retrieve the JSON content provided by "get_article", use the URL
* index.php?json=get_article
*
* @author Wei Zhuo
+ * @author Carl G. Mathisen
* @version $Id$
* @package System.Web.Services
* @since 3.1
@@ -47,7 +61,7 @@ class TJsonService extends TService
/**
* Initializes this module.
* This method is required by the IModule interface.
- * @param TXmlElement configuration for this module, can be null
+ * @param mixed configuration for this module, can be null
*/
public function init($xml)
{
@@ -56,16 +70,27 @@ class TJsonService extends TService
/**
* Load the service definitions.
- * @param TXmlElement configuration for this module, can be null
+ * @param mixed configuration for this module, can be null
*/
- protected function loadJsonServices($xml)
+ protected function loadJsonServices($config)
{
- foreach($xml->getElementsByTagName('json') as $config)
+ if($this->getApplication->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
{
- if(($id=$config->getAttribute('id'))!==null)
- $this->_services[$id]=$config;
- else
- throw new TConfigurationException('jsonservice_id_required');
+ if(is_array($config))
+ {
+ foreach($config as $id => $json)
+ $this->_services[$id] = $json;
+ }
+ }
+ else
+ {
+ foreach($config->getElementsByTagName('json') as $json)
+ {
+ if(($id=$json->getAttribute('id'))!==null)
+ $this->_services[$id]=$config;
+ else
+ throw new TConfigurationException('jsonservice_id_required');
+ }
}
}
@@ -79,20 +104,39 @@ class TJsonService extends TService
if(isset($this->_services[$id]))
{
$serviceConfig=$this->_services[$id];
- $properties=$serviceConfig->getAttributes();
- if(($class=$properties->remove('class'))!==null)
+ if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
{
- $service=Prado::createComponent($class);
- if($service instanceof TJsonResponse)
- $this->createJsonResponse($service,$properties,$serviceConfig);
+ if(isset($serviceConfig['class']))
+ {
+ $service=Prado::createComponent($serviceConfig['class']);
+ if($service instanceof JsonResponse)
+ {
+ $properties = isset($serviceConfig['properties'])?$serviceConfig['properties']:array();
+ $this->createJsonResponse($service,$properties,$serviceConfig);
+ }
+ else
+ throw new TConfigurationException('jsonservice_response_type_invalid',$id);
+ }
else
- throw new TConfigurationException('jsonservice_response_type_invalid',$id);
+ throw new TConfigurationException('jsonservice_class_required',$id);
}
else
- throw new TConfigurationException('jsonservice_class_required',$id);
+ {
+ $properties=$serviceConfig->getAttributes();
+ if(($class=$properties->remove('class'))!==null)
+ {
+ $service=Prado::createComponent($class);
+ if($service instanceof TJsonResponse)
+ $this->createJsonResponse($service,$properties,$serviceConfig);
+ else
+ throw new TConfigurationException('jsonservice_response_type_invalid',$id);
+ }
+ else
+ throw new TConfigurationException('jsonservice_class_required',$id);
+ }
}
else
- throw new THttpException(404,'jsonservice_provider_unknown',$id);
+ throw new THttpException(404,'jsonservice_feed_unknown',$id);
}
/**
diff --git a/framework/Web/Services/TPageService.php b/framework/Web/Services/TPageService.php
index 10c7da6e..4d08ed4c 100644
--- a/framework/Web/Services/TPageService.php
+++ b/framework/Web/Services/TPageService.php
@@ -69,6 +69,7 @@ Prado::using('System.Web.UI.TThemeManager');
* accessing to any resources.
*
* @author Qiang Xue
+ * @author Carl G. Mathisen
* @version $Id$
* @package System.Web.Services
* @since 3.0
@@ -274,7 +275,12 @@ class TPageService extends TService
{
$pageConfig=new TPageConfiguration($pagePath);
if($config!==null)
- $pageConfig->loadPageConfigurationFromXml($config,$application->getBasePath(),'');
+ {
+ if($application->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
+ $pageConfig->loadPageConfigurationFromPhp($config,$application->getBasePath(),'');
+ else
+ $pageConfig->loadPageConfigurationFromXml($config,$application->getBasePath(),'');
+ }
$pageConfig->loadFromFiles($this->getBasePath());
$cache->set(self::CONFIG_CACHE_PREFIX.$this->getID().$pagePath,array($pageConfig,$currentTimestamp));
}
@@ -721,6 +727,7 @@ class TPageConfiguration extends TComponent
$rules[]=new TAuthorizationRule($action,$users,$roles,$verb,$ips);
}
}
+ $this->_rules=array_merge($rules,$this->_rules);
}
// pages
if(isset($config['pages']) && is_array($config['pages']))
@@ -747,7 +754,6 @@ class TPageConfiguration extends TComponent
if($matching)
$this->_properties=array_merge($this->_properties,$properties);
}
- $this->_rules=array_merge($rules,$this->_rules);
}
// external configurations
diff --git a/framework/Web/Services/TSoapService.php b/framework/Web/Services/TSoapService.php
index f5962647..d528fe1d 100644
--- a/framework/Web/Services/TSoapService.php
+++ b/framework/Web/Services/TSoapService.php
@@ -30,12 +30,16 @@
*
*
*
- *
- * The above example specifies a single SOAP provider named "stockquote"
- * whose class is "MyStockQuote". A SOAP client can then obtain the WSDL for
- * this provider via the following URL:
+ * PHP configuration style:
*
- * http://hostname/path/to/index.php?soap=stockquote.wsdl
+ * 'services' => array(
+ * 'soap' => array(
+ * 'class' => 'System.Web.Services.TSoapService'
+ * 'properties' => array(
+ * 'provider' => 'MyStockQuote'
+ * )
+ * )
+ * )
*
*
* The WSDL for the provider class "MyStockQuote" is generated based on special
@@ -79,13 +83,13 @@
*
* @author Knut Urdalen
* @author Qiang Xue
+ * @author Carl G. Mathisen
* @package System.Web.Services
* @since 3.1
*/
class TSoapService extends TService
{
const DEFAULT_SOAP_SERVER='TSoapServer';
- const CONFIG_FILE_EXT='.xml';
private $_servers=array();
private $_configFile=null;
private $_wsdlRequest=false;
@@ -195,7 +199,7 @@ class TSoapService extends TService
*/
public function setConfigFile($value)
{
- if(($this->_configFile=Prado::getPathOfNamespace($value,self::CONFIG_FILE_EXT))===null)
+ if(($this->_configFile=Prado::getPathOfNamespace($value,Prado::getApplication()->getConfigurationFileExt()))===null)
throw new TConfigurationException('soapservice_configfile_invalid',$value);
}
@@ -237,7 +241,12 @@ class TSoapService extends TService
protected function createServer()
{
$properties=$this->_servers[$this->_serverID];
- if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP || ($serverClass=$properties->remove('class'))===null)
+ $serverClass=null;
+ if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP && isset($config['class']))
+ $serverClass=$config['class'];
+ else if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_XML)
+ $serverClass=$properties->remove('class');
+ if($serverClass===null)
$serverClass=self::DEFAULT_SOAP_SERVER;
Prado::using($serverClass);
$className=($pos=strrpos($serverClass,'.'))!==false?substr($serverClass,$pos+1):$serverClass;
diff --git a/framework/Web/TUrlMapping.php b/framework/Web/TUrlMapping.php
index 83dd99b6..30e62496 100644
--- a/framework/Web/TUrlMapping.php
+++ b/framework/Web/TUrlMapping.php
@@ -4,7 +4,7 @@
*
* @author Wei Zhuo
* @link http://www.pradosoft.com/
- * @copyright Copyright © 2005-2008 PradoSoft
+ * @copyright Copyright © 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web
@@ -69,10 +69,6 @@ Prado::using('System.Collections.TAttributeCollection');
*/
class TUrlMapping extends TUrlManager
{
- /**
- * File extension of external configuration file
- */
- const CONFIG_FILE_EXT='.xml';
/**
* @var TUrlMappingPattern[] list of patterns.
*/
@@ -101,17 +97,17 @@ class TUrlMapping extends TUrlManager
/**
* Initializes this module.
* This method is required by the IModule interface.
- * @param TXmlElement configuration for this module, can be null
+ * @param mixed configuration for this module, can be null
* @throws TConfigurationException if module is configured in the global scope.
*/
- public function init($xml)
+ public function init($config)
{
- parent::init($xml);
+ parent::init($config);
if($this->getRequest()->getRequestResolved())
throw new TConfigurationException('urlmapping_global_required');
if($this->_configFile!==null)
$this->loadConfigFile();
- $this->loadUrlMappings($xml);
+ $this->loadUrlMappings($config);
if($this->_urlPrefix==='')
$this->_urlPrefix=$this->getRequest()->getApplicationUrl();
$this->_urlPrefix=rtrim($this->_urlPrefix,'/');
@@ -125,9 +121,17 @@ class TUrlMapping extends TUrlManager
{
if(is_file($this->_configFile))
{
- $dom=new TXmlDocument;
- $dom->loadFromFile($this->_configFile);
- $this->loadUrlMappings($dom);
+ if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
+ {
+ $config = include $this->_configFile;
+ $this->loadUrlMappings($dom);
+ }
+ else
+ {
+ $dom=new TXmlDocument;
+ $dom->loadFromFile($this->_configFile);
+ $this->loadUrlMappings($dom);
+ }
}
else
throw new TConfigurationException('urlmapping_configfile_inexistent',$this->_configFile);
@@ -191,7 +195,7 @@ class TUrlMapping extends TUrlManager
*/
public function setConfigFile($value)
{
- if(($this->_configFile=Prado::getPathOfNamespace($value,self::CONFIG_FILE_EXT))===null)
+ if(($this->_configFile=Prado::getPathOfNamespace($value,$this->getApplication()->getConfigurationFileExt()))===null)
throw new TConfigurationException('urlmapping_configfile_invalid',$value);
}
@@ -218,28 +222,52 @@ class TUrlMapping extends TUrlManager
/**
* Load and configure each url mapping pattern.
- * @param TXmlElement configuration node
+ * @param mixed configuration node
* @throws TConfigurationException if specific pattern class is invalid
*/
- protected function loadUrlMappings($xml)
+ protected function loadUrlMappings($config)
{
- foreach($xml->getElementsByTagName('url') as $url)
+ if(is_array($config))
{
- $properties=$url->getAttributes();
- if(($class=$properties->remove('class'))===null)
- $class=$this->getDefaultMappingClass();
- $pattern=Prado::createComponent($class,$this);
- if(!($pattern instanceof TUrlMappingPattern))
- throw new TConfigurationException('urlmapping_urlmappingpattern_required');
- foreach($properties as $name=>$value)
- $pattern->setSubproperty($name,$value);
- $this->_patterns[]=$pattern;
- $pattern->init($url);
-
- $key=$pattern->getServiceID().':'.$pattern->getServiceParameter();
- $this->_constructRules[$key][]=$pattern;
+ if(isset($config['urls']) && is_array($config['urls']))
+ {
+ foreach($config['urls'] as $url)
+ {
+ $class=null;
+ if(!isset($url['class']))
+ $class=$this->getDefaultMappingClass();
+ $pattern=Prado::createComponent($class,$this);
+ $properties = isset($url['properties'])?$url['properties']:array();
+ $this->buildUrlMapping($class,$pattern,$properties,$url);
+ }
+ }
+ }
+ else
+ {
+ foreach($config->getElementsByTagName('url') as $url)
+ {
+ $properties=$url->getAttributes();
+ if(($class=$properties->remove('class'))===null)
+ $class=$this->getDefaultMappingClass();
+ $pattern=Prado::createComponent($class,$this);
+ $this->buildUrlMapping($class,$pattern,$properties,$url);
+ }
}
}
+
+ private function buildUrlMapping($class, $pattern, $properties, $url)
+ {
+ $pattern=Prado::createComponent($class,$this);
+ if(!($pattern instanceof TUrlMappingPattern))
+ throw new TConfigurationException('urlmapping_urlmappingpattern_required');
+ foreach($properties as $name=>$value)
+ $pattern->setSubproperty($name,$value);
+ $this->_patterns[]=$pattern;
+ $pattern->init($url);
+
+ $key=$pattern->getServiceID().':'.$pattern->getServiceParameter();
+ $this->_constructRules[$key][]=$pattern;
+ }
/**
* Parses the request URL and returns an array of input parameters.
@@ -264,7 +292,7 @@ class TUrlMapping extends TUrlManager
if(is_string($key))
$params[$key]=$value;
}
- if (!$pattern->getIsWildCardPattern())
+ if (!$pattern->getIsWildCardPattern())
$params[$pattern->getServiceID()]=$pattern->getServiceParameter();
return $params;
}
@@ -300,8 +328,8 @@ class TUrlMapping extends TUrlManager
if(!(is_array($getItems) || ($getItems instanceof Traversable)))
$getItems=array();
$key=$serviceID.':'.$serviceParam;
- $wildCardKey = ($pos=strrpos($serviceParam,'.'))!==false ?
- $serviceID.':'.substr($serviceParam,0,$pos).'.*' : $serviceID.':*';
+ $wildCardKey = ($pos=strrpos($serviceParam,'.'))!==false ?
+ $serviceID.':'.substr($serviceParam,0,$pos).'.*' : $serviceID.':*';
if(isset($this->_constructRules[$key]))
{
foreach($this->_constructRules[$key] as $rule)
@@ -309,16 +337,16 @@ class TUrlMapping extends TUrlManager
if($rule->supportCustomUrl($getItems))
return $rule->constructUrl($getItems,$encodeAmpersand,$encodeGetItems);
}
- }
- elseif(isset($this->_constructRules[$wildCardKey]))
- {
+ }
+ elseif(isset($this->_constructRules[$wildCardKey]))
+ {
foreach($this->_constructRules[$wildCardKey] as $rule)
{
if($rule->supportCustomUrl($getItems))
- {
- $getItems['*']= $pos ? substr($serviceParam,$pos+1) : $serviceParam;
+ {
+ $getItems['*']= $pos ? substr($serviceParam,$pos+1) : $serviceParam;
return $rule->constructUrl($getItems,$encodeAmpersand,$encodeGetItems);
- }
+ }
}
}
}
@@ -413,8 +441,8 @@ class TUrlMappingPattern extends TComponent
private $_manager;
private $_caseSensitive=true;
-
- private $_isWildCardPattern=false;
+
+ private $_isWildCardPattern=false;
/**
* Constructor.
@@ -444,8 +472,8 @@ class TUrlMappingPattern extends TComponent
{
if($this->_serviceParameter===null)
throw new TConfigurationException('urlmappingpattern_serviceparameter_required', $this->getPattern());
- if(strpos($this->_serviceParameter,'*')!==false)
- $this->_isWildCardPattern=true;
+ if(strpos($this->_serviceParameter,'*')!==false)
+ $this->_isWildCardPattern=true;
}
/**
@@ -462,11 +490,11 @@ class TUrlMappingPattern extends TComponent
$params[]='{'.$key.'}';
$values[]='(?P<'.$key.'>'.$value.')';
}
- if ($this->getIsWildCardPattern()) {
- $params[]='{*}';
- // service parameter must not contain '=' and '/'
- $values[]='(?P<'.$this->getServiceID().'>[^=/]+)';
- }
+ if ($this->getIsWildCardPattern()) {
+ $params[]='{*}';
+ // service parameter must not contain '=' and '/'
+ $values[]='(?P<'.$this->getServiceID().'>[^=/]+)';
+ }
$params[]='/';
$values[]='\\/';
$regexp=str_replace($params,$values,trim($this->getPattern(),'/').'/');
@@ -608,13 +636,13 @@ class TUrlMappingPattern extends TComponent
}
/**
- * @return boolean whether this pattern is a wildcard pattern
+ * @return boolean whether this pattern is a wildcard pattern
* @since 3.1.4
*/
- public function getIsWildCardPattern() {
- return $this->_isWildCardPattern;
- }
-
+ public function getIsWildCardPattern() {
+ return $this->_isWildCardPattern;
+ }
+
/**
* @param array list of GET items to be put in the constructed URL
* @return boolean whether this pattern IS the one for constructing the URL with the specified GET items.
--
cgit v1.2.3