summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TValidationSummary.php
diff options
context:
space:
mode:
authorxue <>2006-09-04 19:15:47 +0000
committerxue <>2006-09-04 19:15:47 +0000
commit56fee292c37e162c03fab9eeadd6a8b9ab85c251 (patch)
tree923510b93c707868098ae4e5f404eb3766a59553 /framework/Web/UI/WebControls/TValidationSummary.php
parentb107cad91733d4a2a80f42cdbaab41a4f7b41c9d (diff)
merge from 3.0 branch till 1387
Diffstat (limited to 'framework/Web/UI/WebControls/TValidationSummary.php')
-rw-r--r--framework/Web/UI/WebControls/TValidationSummary.php72
1 files changed, 58 insertions, 14 deletions
diff --git a/framework/Web/UI/WebControls/TValidationSummary.php b/framework/Web/UI/WebControls/TValidationSummary.php
index 796a62f0..e42652ff 100644
--- a/framework/Web/UI/WebControls/TValidationSummary.php
+++ b/framework/Web/UI/WebControls/TValidationSummary.php
@@ -52,20 +52,19 @@ class TValidationSummary extends TWebControl
}
/**
- * @return string the display behavior (None, Static, Dynamic) of the error message in a validation summary component.
+ * @return TValidationSummaryDisplayStyle the style of displaying the error messages. Defaults to TValidationSummaryDisplayStyle::Fixed.
*/
public function getDisplay()
{
- return $this->getViewState('Display','Static');
+ return $this->getViewState('Display',TValidationSummaryDisplayStyle::Fixed);
}
/**
- * Sets the display behavior (None, Static, Dynamic) of the error message in a validation summary component.
- * @param string the display behavior (None, Static, Dynamic)
+ * @param TValidationSummaryDisplayStyle the style of displaying the error messages
*/
public function setDisplay($value)
{
- $this->setViewState('Display',TPropertyValue::ensureEnum($value,'None','Dynamic','Static'),'Static');
+ $this->setViewState('Display',TPropertyValue::ensureEnum($value,'TValidationSummaryDisplayStyle'),TValidationSummaryDisplayStyle::Fixed);
}
/**
@@ -86,20 +85,19 @@ class TValidationSummary extends TWebControl
}
/**
- * @return string the display mode (BulletList, List, SingleParagraph) of the validation summary. Defaults to BulletList.
+ * @return TValidationSummaryDisplayMode the mode of displaying error messages. Defaults to TValidationSummaryDisplayMode::BulletList.
*/
public function getDisplayMode()
{
- return $this->getViewState('DisplayMode','BulletList');
+ return $this->getViewState('DisplayMode',TValidationSummaryDisplayMode::BulletList);
}
/**
- * Sets the display mode (BulletList, List, SingleParagraph) of the validation summary.
- * @param string the display mode (BulletList, List, SingleParagraph)
+ * @param TValidationSummaryDisplayMode the mode of displaying error messages
*/
public function setDisplayMode($value)
{
- $this->setViewState('DisplayMode',TPropertyValue::ensureEnum($value,'List','SingleParagraph','BulletList'),'BulletList');
+ $this->setViewState('DisplayMode',TPropertyValue::ensureEnum($value,'TValidationSummaryDisplayMode'),TValidationSummaryDisplayMode::BulletList);
}
/**
@@ -206,7 +204,7 @@ class TValidationSummary extends TWebControl
$visible=$this->getEnabled(true) && count($this->getErrorMessages()) > 0;
if(!$visible)
{
- if($display==='None' || $display==='Dynamic')
+ if($display===TValidationSummaryDisplayStyle::None || $display===TValidationSummaryDisplayStyle::Dynamic)
$writer->addStyleAttribute('display','none');
else
$writer->addStyleAttribute('visibility','hidden');
@@ -317,13 +315,13 @@ class TValidationSummary extends TWebControl
// $this->setStyle('display:block');
switch($this->getDisplayMode())
{
- case 'List':
+ case TValidationSummaryDisplayMode::SimpleList:
$this->renderList($writer);
break;
- case 'SingleParagraph':
+ case TValidationSummaryDisplayMode::SingleParagraph:
$this->renderSingleParagraph($writer);
break;
- case 'BulletList':
+ case TValidationSummaryDisplayMode::BulletList:
$this->renderBulletList($writer);
break;
}
@@ -460,4 +458,50 @@ class TClientSideValidationSummaryOptions extends TClientSideOptions
}
}
+
+/**
+ * TValidationSummaryDisplayMode class.
+ * TValidationSummaryDisplayMode defines the enumerable type for the possible modes
+ * that a {@link TValidationSummary} can organize and display the collected error messages.
+ *
+ * The following enumerable values are defined:
+ * - SimpleList: the error messages are displayed as a list without any decorations.
+ * - SingleParagraph: the error messages are concatenated together into a paragraph.
+ * - BulletList: the error messages are displayed as a bulleted list.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TValidationSummaryDisplayMode extends TEnumerable
+{
+ const SimpleList='SimpleList';
+ const SingleParagraph='SingleParagraph';
+ const BulletList='BulletList';
+}
+
+
+/**
+ * TValidationSummaryDisplay class.
+ * TValidationSummaryDisplay defines the enumerable type for the possible styles
+ * that a {@link TValidationSummary} can display the collected error messages.
+ *
+ * The following enumerable values are defined:
+ * - None: the error messages are not displayed
+ * - Dynamic: the error messages are dynamically added to display as the corresponding validators fail
+ * - Fixed: Similar to Dynamic except that the error messages physically occupy the page layout (even though they may not be visible)
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TValidationSummaryDisplayStyle extends TEnumerable
+{
+ const None='None';
+ const Dynamic='Dynamic';
+ const Fixed='Fixed';
+}
+
?>