From 5d88ad05e5956071d5904662d133625f157ce230 Mon Sep 17 00:00:00 2001
From: xue <>
Date: Thu, 19 Jan 2006 02:54:27 +0000
Subject: Added documentation to validator controls.
---
.../Web/UI/WebControls/TValidationSummary.php | 83 ++++++----------------
1 file changed, 20 insertions(+), 63 deletions(-)
(limited to 'framework/Web/UI/WebControls/TValidationSummary.php')
diff --git a/framework/Web/UI/WebControls/TValidationSummary.php b/framework/Web/UI/WebControls/TValidationSummary.php
index 0ac7584a..056c8f3e 100644
--- a/framework/Web/UI/WebControls/TValidationSummary.php
+++ b/framework/Web/UI/WebControls/TValidationSummary.php
@@ -13,29 +13,21 @@
/**
* TValidationSummary class
*
- * TValidationSummary displays a summary of all validation errors inline on a Web page,
- * in a message box, or both. The summary can be displayed as a list, as a bulleted list,
- * or as a single paragraph based on the DisplayMode property.
- * The summary can be displayed on the Web page and in a message box by setting
- * the ShowSummary and ShowMessageBox properties, respectively.
+ * TValidationSummary displays a summary of validation errors inline on a Web page,
+ * in a message box, or both. By default, a validation summary will collect
+ * {@link TBaseValidator::getErrorMessage ErrorMessage} of all failed validators
+ * on the page. If {@link getValidationGroup ValidationGroup} is not
+ * empty, only those validators who belong to the group will show their error messages
+ * in the summary.
*
- * Namespace: System.Web.UI.WebControls
+ * The summary can be displayed as a list, as a bulleted list, or as a single
+ * paragraph based on the {@link setDisplayMode DisplayMode} property.
+ * The messages shown can be prefixed with {@link setHeaderText HeaderText}.
*
- * Properties
- * - DisplayMode, string, default=BulletList, kept in viewstate
- *
Gets or sets the display mode (BulletList, List, SingleParagraph) of the validation summary.
- * - HeaderText, string, kept in viewstate
- *
Gets or sets the header text displayed at the top of the summary.
- * - EnableClientScript, boolean, default=true, kept in viewstate
- *
Gets or sets a value indicating whether the TValidationSummary component
- * updates itself using client-side script.
- * - ShowMessageBox, boolean, default=false, kept in viewstate
- *
Gets or sets a value indicating whether the validation summary is displayed in a message box.
- * If EnableClientScript is false, this property has no effect.
- * - ShowSummary, boolean, default=true, kept in viewstate
- *
Gets or sets a value indicating whether the validation summary is displayed inline.
- * - Group, string, kept in viewstate
- *
Gets or sets the validation group ID.
+ * The summary can be displayed on the Web page and in a message box by setting
+ * the {@link setShowSummary ShowSummary} and {@link setShowMessageBox ShowMessageBox}
+ * properties, respectively. Note, the latter is only effective when
+ * {@link setEnableClientScript EnableClientScript} is true.
*
* @author Qiang Xue
* @version $Revision: $ $Date: $
@@ -44,20 +36,6 @@
*/
class TValidationSummary extends TWebControl
{
-
- protected static $currentGroup;
-
- public static function setCurrentGroup($group)
- {
- self::$currentGroup = $group;
- }
-
- public static function getCurrentGroup()
- {
- return self::$currentGroup;
- }
-
-
/**
* @return string the header text displayed at the top of the summary
*/
@@ -190,29 +168,6 @@ class TValidationSummary extends TWebControl
$this->setViewState('ValidationGroup',$value,'');
}
- /**
- * Get a list of validators considering the validation groups.
- * @return array list of validators.
- */
- protected function getValidators()
- {
- $groupID = $this->getGroup();
- if(empty($groupID)) return $this->getPage()->getValidators();
-
- $parent = $this->getParent();
- $group = $parent->findObject($groupID);
-
- $validators = array();
-
- foreach($group->getMembers() as $member)
- {
- $control = $parent->findObject($member);
- if(!is_null($control))
- $validators[] = $control;
- }
- return $validators;
- }
-
protected function addAttributesToRender($writer)
{
$writer->addAttribute('id',$this->getClientID());
@@ -341,11 +296,13 @@ class TValidationSummary extends TWebControl
$header=$this->getHeaderText();
$messages=$this->getErrorMessages();
$content = $header;
- $show = count($messages) > 0;
- if($show) $content .= "\n";
- foreach($messages as $message)
- $content.= '- '.$message."
\n";
- if($show) $content .= "
\n";
+ if(count($messages)>0)
+ {
+ $content .= "\n";
+ foreach($messages as $message)
+ $content.= '- '.$message."
\n";
+ $content .= "
\n";
+ }
$writer->write($content);
}
}
--
cgit v1.2.3