From 47d05516b1d1c465217c59732bf8442ab0cfd497 Mon Sep 17 00:00:00 2001 From: wei <> Date: Fri, 5 May 2006 06:58:04 +0000 Subject: Added prioritize callback and enabled viewstate update on callback return. --- .../Web/UI/WebControls/TValidationSummary.php | 63 +++++++--------------- 1 file changed, 18 insertions(+), 45 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 87821292..8148036b 100644 --- a/framework/Web/UI/WebControls/TValidationSummary.php +++ b/framework/Web/UI/WebControls/TValidationSummary.php @@ -37,9 +37,9 @@ class TValidationSummary extends TWebControl { /** - * @var TValidatorClientScript validator client-script options. + * @var TClientSideValidationSummaryOptions validation client side options. */ - private $_clientScript; + private $_clientSide; /** * Constructor. @@ -248,30 +248,30 @@ class TValidationSummary extends TWebControl $options['ValidationGroup'] = $this->getValidationGroup(); $options['Display'] = $this->getDisplay(); - if(!is_null($this->_clientScript)) - $options = array_merge($options,$this->_clientScript->getOptions()); + if(!is_null($this->_clientSide)) + $options = array_merge($options,$this->_clientSide->getOptions()->toArray()); return $options; } /** - * @return TValidationSummaryClientScript client-side validation summary + * @return TClientSideValidationSummaryOptions client-side validation summary * event options. */ public function getClientSide() { - if(is_null($this->_clientScript)) - $this->_clientScript = $this->createClientScript(); - return $this->_clientScript; + if(is_null($this->_clientSide)) + $this->_clientSide = $this->createClientScript(); + return $this->_clientSide; } /** - * @return TValidationSummaryClientScript javascript validation summary + * @return TClientSideValidationSummaryOptions javascript validation summary * event options. */ protected function createClientScript() { - return new TValidationSummaryClientScript; + return new TClientSideValidationSummaryOptions; } /** * Get the list of validation error messages. @@ -372,7 +372,7 @@ class TValidationSummary extends TWebControl } /** - * TValidationSummaryClientScript class. + * TClientSideValidationSummaryOptions class. * * Client-side validation summary events such as {@link setOnHideSummary * OnHideSummary} and {@link setOnShowSummary OnShowSummary} can be modified @@ -392,27 +392,14 @@ class TValidationSummary extends TWebControl * @package System.Web.UI.WebControls * @since 3.0 */ -class TValidationSummaryClientScript extends TComponent +class TClientSideValidationSummaryOptions extends TClientSideOptions { - /** - * @var TMap client-side validation summary event javascript code. - */ - private $_options; - - /** - * Constructor. - */ - public function __construct() - { - $this->_options = new TMap; - } - /** * @return string javascript code for client-side OnHideSummary event. */ public function getOnHideSummary() { - return $this->_options->itemAt['OnHideSummary']; + return $this->getOption('OnHideSummary'); } /** @@ -423,7 +410,7 @@ class TValidationSummaryClientScript extends TComponent */ public function setOnHideSummary($javascript) { - $this->_options->add('OnHideSummary', $this->ensureFunction($javascript)); + $this->setFunction('OnHideSummary', $javascript); } /** @@ -434,7 +421,7 @@ class TValidationSummaryClientScript extends TComponent */ public function setOnShowSummary($javascript) { - $this->_options->add('OnShowSummary', $this->ensureFunction($javascript)); + $this->setFunction('OnShowSummary', $javascript); } /** @@ -442,15 +429,7 @@ class TValidationSummaryClientScript extends TComponent */ public function getOnShowSummary() { - return $this->_options->itemAt('OnShowSummary'); - } - - /** - * @return array list of client-side event code. - */ - public function getOptions() - { - return $this->_options->toArray(); + return $this->getOption('OnShowSummary'); } /** @@ -460,15 +439,9 @@ class TValidationSummaryClientScript extends TComponent * @param string javascript code. * @return string javascript function code. */ - private function ensureFunction($javascript) + protected function ensureFunction($javascript) { - if(TJavascript::isFunction($javascript)) - return $javascript; - else - { - $code = "function(summary, validators){ {$javascript} }"; - return TJavascript::quoteFunction($code); - } + return "function(summary, validators){ {$javascript} }"; } } -- cgit v1.2.3