summaryrefslogtreecommitdiff
path: root/framework/Web
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web')
-rw-r--r--framework/Web/UI/WebControls/TExpression.php24
-rw-r--r--framework/Web/UI/WebControls/TLabel.php18
-rw-r--r--framework/Web/UI/WebControls/TLiteral.php44
-rw-r--r--framework/Web/UI/WebControls/TPlaceHolder.php10
-rw-r--r--framework/Web/UI/WebControls/TStatements.php27
-rw-r--r--framework/Web/UI/WebControls/TStyle.php5
-rw-r--r--framework/Web/UI/WebControls/TWebControl.php5
7 files changed, 83 insertions, 50 deletions
diff --git a/framework/Web/UI/WebControls/TExpression.php b/framework/Web/UI/WebControls/TExpression.php
index 9168f178..eb1151b0 100644
--- a/framework/Web/UI/WebControls/TExpression.php
+++ b/framework/Web/UI/WebControls/TExpression.php
@@ -3,9 +3,9 @@
* TExpression class file
*
* @author Qiang Xue <qiang.xue@gmail.com>
- * @link http://www.xisc.com/
- * @copyright Copyright &copy; 2004-2005, Qiang Xue
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005 PradoSoft
+ * @license http://www.pradosoft.com/license/
* @version $Revision: $ $Date: $
* @package System.Web.UI.WebControls
*/
@@ -14,12 +14,12 @@
* TExpression class
*
* TExpression evaluates a PHP expression and renders the result.
- * The expression is evaluated during rendering stage. You can set
- * it via the property <b>Expression</b>. You should also specify
- * the context object by <b>Context</b> property which is used as
- * the object in which the expression is evaluated. If the <b>Context</b>
- * property is not set, the TExpression component itself will be
- * assumed as the context.
+ * The expression is evaluated during the rendering stage. The expression being
+ * evaluated can be set via the property {@link setExpression Expression}.
+ * The context of the expression evaluated is the TExpression object itself.
+ *
+ * Note, since TExpression allows evaluation of arbitrary PHP expression,
+ * make sure {@link setExpression Expression} does not come directly from user input.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Revision: $ $Date: $
@@ -28,6 +28,9 @@
*/
class TExpression extends TControl
{
+ /**
+ * @var string PHP expression to be evaluated
+ */
private $_e='';
/**
@@ -39,8 +42,7 @@ class TExpression extends TControl
}
/**
- * Sets the expression of the TExpression
- * @param string the expression to be set
+ * @param string the expression to be evaluated
*/
public function setExpression($value)
{
diff --git a/framework/Web/UI/WebControls/TLabel.php b/framework/Web/UI/WebControls/TLabel.php
index 15148732..f80ad758 100644
--- a/framework/Web/UI/WebControls/TLabel.php
+++ b/framework/Web/UI/WebControls/TLabel.php
@@ -3,9 +3,9 @@
* TLabel class file.
*
* @author Qiang Xue <qiang.xue@gmail.com>
- * @link http://www.xisc.com/
- * @copyright Copyright &copy; 2004-2005, Qiang Xue
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005 PradoSoft
+ * @license http://www.pradosoft.com/license/
* @version $Revision: $ $Date: $
* @package System.Web.UI.WebControls
*/
@@ -14,14 +14,14 @@
* TLabel class
*
* TLabel represents a label control that displays text on a Web pagge.
- * Use <b>Text</b> property to set the text to be displayed.
+ * Use {@link setText Text} property to set the text to be displayed.
* TLabel will render the contents enclosed within its component tag
- * if <b>Text</b> is empty.
+ * if {@link setText Text} is empty.
* To use TLabel as a form label, associate it with a control by setting the
- * <b>AssociateControlID</b> property. The associated control must be locatable
- * within the label's naming container.
+ * {@link setAssociateControlID AssociateControlID} property.
+ * The associated control must be locatable within the label's naming container.
*
- * Note, <b>Text</b> will NOT be encoded for rendering.
+ * Note, {@link setText Text} will NOT be encoded for rendering.
* Make usre it does not contain dangerous characters that you want to avoid.
*
* @author Qiang Xue <qiang.xue@gmail.com>
@@ -51,7 +51,7 @@ class TLabel extends TWebControl
if($control=$this->findControl($aid))
$writer->addAttribute('for',$control->getClientID());
else
- throw new TInvalidDataValueException('control_not_found',$aid);
+ throw new TInvalidDataValueException('label_associatedcontrol_invalid',$aid);
}
parent::addAttributesToRender($writer);
}
diff --git a/framework/Web/UI/WebControls/TLiteral.php b/framework/Web/UI/WebControls/TLiteral.php
index 459552f7..cda144dd 100644
--- a/framework/Web/UI/WebControls/TLiteral.php
+++ b/framework/Web/UI/WebControls/TLiteral.php
@@ -3,9 +3,9 @@
* TLiteral class file
*
* @author Qiang Xue <qiang.xue@gmail.com>
- * @link http://www.xisc.com/
- * @copyright Copyright &copy; 2004-2005, Qiang Xue
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005 PradoSoft
+ * @license http://www.pradosoft.com/license/
* @version $Revision: $ $Date: $
* @package System.Web.UI.WebControls
*/
@@ -13,18 +13,15 @@
/**
* TLiteral class
*
- * TLiteral reserves a location on the Web page to display static text or body content.
- * The TLiteral control is similar to the TLabel control, except the TLiteral
- * control does not allow you to apply a style to the displayed text.
+ * TLiteral displays a static text on the Web page.
+ * TLiteral is similar to the TLabel control, except that the TLiteral
+ * control does not allow child controls and do not have style properties (e.g. BackColor, Font, etc.)
* You can programmatically control the text displayed in the control by setting
- * the <b>Text</b> property. If the <b>Text</b> property is empty, the content
- * enclosed within the TLiteral control will be displayed. This is very useful
- * for reserving a location on a page because you can add text and controls
- * as children of TLiteral control and they will be rendered at the place.
+ * the {@link setText Text} property. The text displayed may be HTML-encoded
+ * if the {@link setEncode Encode} property is set true (defaults to false).
*
- * Note, <b>Text</b> is not HTML encoded before it is displayed in the TLiteral component.
- * If the values for the component come from user input, be sure to validate the values
- * to help prevent security vulnerabilities.
+ * Note, if {@link setEncode Encode} is false, make sure {@link setText Text}
+ * does not contain unwanted characters that may bring security vulnerabilities.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Revision: $ $Date: $
@@ -34,6 +31,17 @@
class TLiteral extends TControl
{
/**
+ * Processes an object that is created during parsing template.
+ * This method overrides the parent implementation by forbidding any child controls.
+ * @param string|TComponent text string or component parsed and instantiated in template
+ */
+ public function addParsedObject($object)
+ {
+ if($object instanceof TComponent)
+ throw new TConfigurationException('literal_body_forbidden');
+ }
+
+ /**
* @return string the static text of the TLiteral
*/
public function getText()
@@ -50,18 +58,24 @@ class TLiteral extends TControl
$this->setViewState('Text',$value,'');
}
+ /**
+ * @return boolean whether the rendered text should be HTML-encoded. Defaults to false.
+ */
public function getEncode()
{
return $this->getViewState('Encode',false);
}
+ /**
+ * @param boolean whether the rendered text should be HTML-encoded.
+ */
public function setEncode($value)
{
- $this->setViewState('Encode',$value,false);
+ $this->setViewState('Encode',TPropertyValue::ensureBoolean($value),false);
}
/**
- * Renders the evaluation result of the statements.
+ * Renders the literal control.
* @param THtmlWriter the writer used for the rendering purpose
*/
protected function render($writer)
diff --git a/framework/Web/UI/WebControls/TPlaceHolder.php b/framework/Web/UI/WebControls/TPlaceHolder.php
index 9149e180..91979a26 100644
--- a/framework/Web/UI/WebControls/TPlaceHolder.php
+++ b/framework/Web/UI/WebControls/TPlaceHolder.php
@@ -3,9 +3,9 @@
* TPlaceHolder class file
*
* @author Qiang Xue <qiang.xue@gmail.com>
- * @link http://www.xisc.com/
- * @copyright Copyright &copy; 2004-2005, Qiang Xue
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005 PradoSoft
+ * @license http://www.pradosoft.com/license/
* @version $Revision: $ $Date: $
* @package System.Web.UI.WebControls
*/
@@ -13,6 +13,10 @@
/**
* TPlaceHolder class
*
+ * TPlaceHolder reserves a place on a template, where static texts or controls
+ * may be inserted. You may add or remove texts or child controls of TPlaceHolder
+ * by manipulating the {@link TControl::getControls Controls} property.
+ *
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Revision: $ $Date: $
* @package System.Web.UI.WebControls
diff --git a/framework/Web/UI/WebControls/TStatements.php b/framework/Web/UI/WebControls/TStatements.php
index 5c1ffe1e..0474acf1 100644
--- a/framework/Web/UI/WebControls/TStatements.php
+++ b/framework/Web/UI/WebControls/TStatements.php
@@ -3,9 +3,9 @@
* TStatements class file
*
* @author Qiang Xue <qiang.xue@gmail.com>
- * @link http://www.xisc.com/
- * @copyright Copyright &copy; 2004-2005, Qiang Xue
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005 PradoSoft
+ * @license http://www.pradosoft.com/license/
* @version $Revision: $ $Date: $
* @package System.Web.UI.WebControls
*/
@@ -13,13 +13,14 @@
/**
* TStatements class
*
- * TStatements executes a set of PHP statements and renders the display
- * generated by the statements. The execution happens during rendering stage.
- * You can set the statements via the property <b>Statements</b>.
- * You should also specify the context object by <b>Context</b> property
- * which is used as the object in which the statements is evaluated.
- * If the <b>Context</b> property is not set, the TStatements component
- * itself will be assumed as the context.
+ * TStatements executes one or several PHP statements and renders the display
+ * generated during the execution. The execution happens during the rendering stage.
+ * The PHP statements being executed can be set via the property
+ * {@link setStatements Statements}. The context of the statemenets executed
+ * is the TStatements object itself.
+ *
+ * Note, since TStatements allows execution of arbitrary PHP statements,
+ * make sure {@link setStatements Statements} does not come directly from user input.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Revision: $ $Date: $
@@ -28,6 +29,9 @@
*/
class TStatements extends TControl
{
+ /**
+ * @var string PHP statements
+ */
private $_s='';
/**
@@ -39,8 +43,7 @@ class TStatements extends TControl
}
/**
- * Sets the statements of the TStatements
- * @param string the statements to be set
+ * @param string the PHP statements to be executed
*/
public function setStatements($value)
{
diff --git a/framework/Web/UI/WebControls/TStyle.php b/framework/Web/UI/WebControls/TStyle.php
index 8a046ff1..bb1d733a 100644
--- a/framework/Web/UI/WebControls/TStyle.php
+++ b/framework/Web/UI/WebControls/TStyle.php
@@ -11,6 +11,11 @@
*/
/**
+ * Includes TFont definition
+ */
+Prado::using('System.Web.UI.WebControls.TFont');
+
+/**
* TStyle class
*
* TStyle encapsulates the CSS style applied to a control.
diff --git a/framework/Web/UI/WebControls/TWebControl.php b/framework/Web/UI/WebControls/TWebControl.php
index b54f0e71..33f35c72 100644
--- a/framework/Web/UI/WebControls/TWebControl.php
+++ b/framework/Web/UI/WebControls/TWebControl.php
@@ -11,6 +11,11 @@
*/
/**
+ * Includes TStyle definition
+ */
+Prado::using('System.Web.UI.WebControls.TStyle');
+
+/**
* TWebControl class
*
* TWebControl is the base class for controls that share a common set