summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/UI/WebControls')
-rw-r--r--framework/Web/UI/WebControls/TBaseValidator.php65
-rw-r--r--framework/Web/UI/WebControls/TValidationSummary.php55
2 files changed, 39 insertions, 81 deletions
diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php
index ea1a5836..e7eb7e33 100644
--- a/framework/Web/UI/WebControls/TBaseValidator.php
+++ b/framework/Web/UI/WebControls/TBaseValidator.php
@@ -80,9 +80,9 @@ abstract class TBaseValidator extends TLabel implements IValidator
*/
private $_registered=false;
/**
- * @var TValidatorClientScript validator client-script options.
+ * @var TClientSideValidatorOptions validator client-script options.
*/
- private $_clientScript;
+ private $_clientSide;
/**
* Constructor.
@@ -154,14 +154,14 @@ abstract class TBaseValidator extends TLabel implements IValidator
$options['ControlCssClass'] = $this->getControlCssClass();
$options['ControlType'] = get_class($control);
- 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;
}
/**
- * Gets the TValidatorClientScript that allows modification of the client-
+ * Gets the TClientSideValidatorOptions that allows modification of the client-
* side validator events.
*
* The client-side validator supports the following events.
@@ -174,21 +174,21 @@ abstract class TBaseValidator extends TLabel implements IValidator
*
* You can attach custom javascript code to each of these events
*
- * @return TValidatorClientScript javascript validator event options.
+ * @return TClientSideValidatorOptions javascript validator 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->createClientSideOptions();
+ return $this->_clientSide;
}
/**
- * @return TValidatorClientScript javascript validator event options.
+ * @return TClientSideValidatorOptions javascript validator event options.
*/
- protected function createClientScript()
+ protected function createClientSideOptions()
{
- return new TValidatorClientScript;
+ return new TClientSideValidatorOptions;
}
/**
@@ -491,11 +491,11 @@ abstract class TBaseValidator extends TLabel implements IValidator
}
/**
- * TValidatorClientScript class.
+ * TClientSideValidatorOptions class.
*
* Client-side validator events can be modified through the {@link
* TBaseValidator::getClientSide ClientSide} property of a validator. The
- * subproperties of ClientSide are those of the TValidatorClientScript
+ * subproperties of ClientSide are those of the TClientSideValidatorOptions
* properties. The client-side validator supports the following events.
*
* The <tt>OnValidate</tt> event is raise before the validator validation
@@ -513,27 +513,14 @@ abstract class TBaseValidator extends TLabel implements IValidator
* @package System.Web.UI.WebControls
* @since 3.0
*/
-class TValidatorClientScript extends TComponent
+class TClientSideValidatorOptions extends TClientSideOptions
{
/**
- * @var TMap client-side validator event javascript code.
- */
- private $_options;
-
- /**
- * Constructor.
- */
- public function __construct()
- {
- $this->_options = new TMap;
- }
-
- /**
* @return string javascript code for client-side OnValidate event.
*/
public function getOnValidate()
{
- return $this->_options->itemAt['OnValidate'];
+ return $this->getOption('OnValidate');
}
/**
@@ -543,7 +530,7 @@ class TValidatorClientScript extends TComponent
*/
public function setOnValidate($javascript)
{
- $this->_options->add('OnValidate', $this->ensureFunction($javascript));
+ $this->getOptions()->add('OnValidate', $this->ensureFunction($javascript));
}
/**
@@ -553,7 +540,7 @@ class TValidatorClientScript extends TComponent
*/
public function setOnSuccess($javascript)
{
- $this->_options->add('OnSuccess', $this->ensureFunction($javascript));
+ $this->getOptions()->add('OnSuccess', $this->ensureFunction($javascript));
}
/**
@@ -561,7 +548,7 @@ class TValidatorClientScript extends TComponent
*/
public function getOnSuccess()
{
- return $this->_options->itemAt('OnSuccess');
+ return $this->getOption('OnSuccess');
}
/**
@@ -571,7 +558,7 @@ class TValidatorClientScript extends TComponent
*/
public function setOnError($javascript)
{
- $this->_options->add('OnError', $this->ensureFunction($javascript));
+ $this->getOptions()->add('OnError', $this->ensureFunction($javascript));
}
/**
@@ -579,15 +566,7 @@ class TValidatorClientScript extends TComponent
*/
public function getOnError()
{
- return $this->_options->itemAt('OnError');
- }
-
- /**
- * @return array list of client-side event code.
- */
- public function getOptions()
- {
- return $this->_options->toArray();
+ return $this->getOption('OnError');
}
/**
@@ -597,7 +576,7 @@ class TValidatorClientScript 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;
diff --git a/framework/Web/UI/WebControls/TValidationSummary.php b/framework/Web/UI/WebControls/TValidationSummary.php
index 87821292..49951e89 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->getOptions()->add('OnHideSummary', $this->ensureFunction($javascript));
}
/**
@@ -434,7 +421,7 @@ class TValidationSummaryClientScript extends TComponent
*/
public function setOnShowSummary($javascript)
{
- $this->_options->add('OnShowSummary', $this->ensureFunction($javascript));
+ $this->getOptions()->add('OnShowSummary', $this->ensureFunction($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,7 +439,7 @@ 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;