summaryrefslogtreecommitdiff
path: root/framework/Web
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web')
-rw-r--r--framework/Web/UI/ActiveControls/TActiveCheckBox.php16
-rw-r--r--framework/Web/UI/ActiveControls/TActiveCheckBoxList.php13
-rw-r--r--framework/Web/UI/ActiveControls/TActiveCustomValidator.php13
-rw-r--r--framework/Web/UI/ActiveControls/TActiveListBox.php20
-rw-r--r--framework/Web/UI/ActiveControls/TActiveRadioButton.php13
-rw-r--r--framework/Web/UI/ActiveControls/TActiveRadioButtonList.php14
-rw-r--r--framework/Web/UI/ActiveControls/TActiveTextBox.php28
-rw-r--r--framework/Web/UI/ActiveControls/TAutoComplete.php17
-rw-r--r--framework/Web/UI/ActiveControls/TInPlaceTextBox.php24
-rw-r--r--framework/Web/UI/WebControls/TBaseValidator.php9
10 files changed, 83 insertions, 84 deletions
diff --git a/framework/Web/UI/ActiveControls/TActiveCheckBox.php b/framework/Web/UI/ActiveControls/TActiveCheckBox.php
index 2f60d9fb..777ff6ad 100644
--- a/framework/Web/UI/ActiveControls/TActiveCheckBox.php
+++ b/framework/Web/UI/ActiveControls/TActiveCheckBox.php
@@ -111,10 +111,24 @@ class TActiveCheckBox extends TCheckBox implements ICallbackEventHandler, IActiv
}
/**
- * Registers the javascript code for initializing the active control.
+ * Override parent implementation, no javascript is rendered here instead
+ * the javascript required for active control is registered in {@link addAttributesToRender}.
*/
protected function renderClientControlScript($writer)
{
+ }
+
+ /**
+ * Ensure that the ID attribute is rendered and registers the javascript code
+ * for initializing the active control.
+ * @param THtmlWriter the writer for the rendering purpose
+ * @param string checkbox id
+ * @param string onclick js
+ */
+ protected function renderInputTag($writer,$clientID,$onclick)
+ {
+ parent::renderInputTag($writer,$clientID,$onclick);
+ $writer->addAttribute('id',$this->getClientID());
$this->getActiveControl()->registerCallbackClientScript(
$this->getClientClassName(), $this->getPostBackOptions());
}
diff --git a/framework/Web/UI/ActiveControls/TActiveCheckBoxList.php b/framework/Web/UI/ActiveControls/TActiveCheckBoxList.php
index 09ad9236..0b86f4bf 100644
--- a/framework/Web/UI/ActiveControls/TActiveCheckBoxList.php
+++ b/framework/Web/UI/ActiveControls/TActiveCheckBoxList.php
@@ -65,20 +65,11 @@ class TActiveCheckBoxList extends TCheckBoxList implements IActiveControl, ICall
}
/**
- * @return string javascript client-side control class name.
- */
- protected function getClientClassName()
- {
- return 'Prado.WebUI.TActiveCheckBoxList';
- }
-
- /**
- * Registers the javascript code for initializing the active control.
+ * Override parent implementation, no javascript is rendered here instead
+ * the javascript required for active control is registered in {@link addAttributesToRender}.
*/
protected function renderClientControlScript($writer)
{
- $this->getActiveControl()->registerCallbackClientScript(
- $this->getClientClassName(), $this->getPostBackOptions());
}
/**
diff --git a/framework/Web/UI/ActiveControls/TActiveCustomValidator.php b/framework/Web/UI/ActiveControls/TActiveCustomValidator.php
index 1668b54f..ad0dd51e 100644
--- a/framework/Web/UI/ActiveControls/TActiveCustomValidator.php
+++ b/framework/Web/UI/ActiveControls/TActiveCustomValidator.php
@@ -128,7 +128,7 @@ class TActiveCustomValidator extends TCustomValidator
* Sets the text for the error message. Updates client-side erorr message.
* @param string the error message
*/
- public function setErrorMessage($value)
+ public function setErrorMessage($value)
{
parent::setErrorMessage($value);
if($this->getActiveControl()->canUpdateClientSide())
@@ -139,13 +139,14 @@ class TActiveCustomValidator extends TCustomValidator
}
}
- /**
- * Register the javascript for the active custom validator.
+ /**
+ * Ensure that the ID attribute is rendered and registers the javascript code
+ * for initializing the active control.
*/
- protected function registerClientScriptValidator()
+ protected function addAttributesToRender($writer)
{
- $this->getActiveControl()->registerCallbackClientScript(
- $this->getClientClassName(), $this->getClientScriptOptions());
+ parent::addAttributesToRender($writer);
+ TBaseValidator::registerClientScriptValidator();
}
/**
diff --git a/framework/Web/UI/ActiveControls/TActiveListBox.php b/framework/Web/UI/ActiveControls/TActiveListBox.php
index 97b28ac7..cafb3a29 100644
--- a/framework/Web/UI/ActiveControls/TActiveListBox.php
+++ b/framework/Web/UI/ActiveControls/TActiveListBox.php
@@ -132,6 +132,26 @@ class TActiveListBox extends TListBox implements IActiveControl, ICallbackEventH
if($multiple)
$this->getPage()->registerPostDataLoader($multi_id);
}
+
+ /**
+ * Override parent implementation, no javascript is rendered here instead
+ * the javascript required for active control is registered in {@link addAttributesToRender}.
+ */
+ protected function renderClientControlScript($writer)
+ {
+ }
+
+ /**
+ * Ensure that the ID attribute is rendered and registers the javascript code
+ * for initializing the active control.
+ */
+ protected function addAttributesToRender($writer)
+ {
+ parent::addAttributesToRender($writer);
+ $writer->addAttribute('id',$this->getClientID());
+ $this->getActiveControl()->registerCallbackClientScript(
+ $this->getClientClassName(), $this->getPostBackOptions());
+ }
}
?> \ No newline at end of file
diff --git a/framework/Web/UI/ActiveControls/TActiveRadioButton.php b/framework/Web/UI/ActiveControls/TActiveRadioButton.php
index 425cf1c7..16a91688 100644
--- a/framework/Web/UI/ActiveControls/TActiveRadioButton.php
+++ b/framework/Web/UI/ActiveControls/TActiveRadioButton.php
@@ -121,10 +121,21 @@ class TActiveRadioButton extends TRadioButton implements IActiveControl, ICallba
}
/**
- * Registers the javascript code for initializing the active control.
+ * Override parent implementation, no javascript is rendered here instead
+ * the javascript required for active control is registered in {@link addAttributesToRender}.
*/
protected function renderClientControlScript($writer)
{
+ }
+
+ /**
+ * Ensure that the ID attribute is rendered and registers the javascript code
+ * for initializing the active control.
+ */
+ protected function renderInputTag($writer,$clientID,$onclick)
+ {
+ parent::renderInputTag($writer,$clientID,$onclick);
+ $writer->addAttribute('id',$this->getClientID());
$this->getActiveControl()->registerCallbackClientScript(
$this->getClientClassName(), $this->getPostBackOptions());
}
diff --git a/framework/Web/UI/ActiveControls/TActiveRadioButtonList.php b/framework/Web/UI/ActiveControls/TActiveRadioButtonList.php
index 6e3fef6f..52a4b036 100644
--- a/framework/Web/UI/ActiveControls/TActiveRadioButtonList.php
+++ b/framework/Web/UI/ActiveControls/TActiveRadioButtonList.php
@@ -60,20 +60,11 @@ class TActiveRadioButtonList extends TRadioButtonList implements IActiveControl,
}
/**
- * @return string javascript client-side control class name.
- */
- protected function getClientClassName()
- {
- return 'Prado.WebUI.TActiveRadioButtonList';
- }
-
- /**
- * Registers the javascript code for initializing the active control.
+ * Override parent implementation, no javascript is rendered here instead
+ * the javascript required for active control is registered in {@link addAttributesToRender}.
*/
protected function renderClientControlScript($writer)
{
- $this->getActiveControl()->registerCallbackClientScript(
- $this->getClientClassName(), $this->getPostBackOptions());
}
/**
@@ -95,7 +86,6 @@ class TActiveRadioButtonList extends TRadioButtonList implements IActiveControl,
*/
public function raiseCallbackEvent($param)
{
- var_dump($_POST);
$this->onCallback($param);
}
diff --git a/framework/Web/UI/ActiveControls/TActiveTextBox.php b/framework/Web/UI/ActiveControls/TActiveTextBox.php
index 8e6c86dd..c7ee916d 100644
--- a/framework/Web/UI/ActiveControls/TActiveTextBox.php
+++ b/framework/Web/UI/ActiveControls/TActiveTextBox.php
@@ -93,23 +93,33 @@ class TActiveTextBox extends TTextBox implements ICallbackEventHandler, IActiveC
}
/**
- * Renders the javascript for textbox.
+ * Gets the name of the javascript class responsible for performing postback for this control.
+ * This method overrides the parent implementation.
+ * @return string the javascript class name
+ */
+ protected function getClientClassName()
+ {
+ return 'Prado.WebUI.TActiveTextBox';
+ }
+
+ /**
+ * Override parent implementation, no javascript is rendered here instead
+ * the javascript required for active control is registered in {@link addAttributesToRender}.
*/
protected function renderClientControlScript($writer)
{
- $writer->addAttribute('id',$this->getClientID());
- $this->getActiveControl()->registerCallbackClientScript(
- $this->getClientClassName(), $this->getPostBackOptions());
}
/**
- * Gets the name of the javascript class responsible for performing postback for this control.
- * This method overrides the parent implementation.
- * @return string the javascript class name
+ * Ensure that the ID attribute is rendered and registers the javascript code
+ * for initializing the active control.
*/
- protected function getClientClassName()
+ protected function addAttributesToRender($writer)
{
- return 'Prado.WebUI.TActiveTextBox';
+ parent::addAttributesToRender($writer);
+ $writer->addAttribute('id',$this->getClientID());
+ $this->getActiveControl()->registerCallbackClientScript(
+ $this->getClientClassName(), $this->getPostBackOptions());
}
}
diff --git a/framework/Web/UI/ActiveControls/TAutoComplete.php b/framework/Web/UI/ActiveControls/TAutoComplete.php
index 07fa652b..f94a826f 100644
--- a/framework/Web/UI/ActiveControls/TAutoComplete.php
+++ b/framework/Web/UI/ActiveControls/TAutoComplete.php
@@ -270,7 +270,7 @@ class TAutoComplete extends TActiveTextBox implements INamingContainer
/**
* @return array list of callback options.
*/
- protected function getAutoCompleteOptions()
+ protected function getPostBackOptions()
{
$this->getActiveControl()->getClientSide()->setEnablePageStateUpdate(false);
$options = array();
@@ -282,7 +282,7 @@ class TAutoComplete extends TActiveTextBox implements INamingContainer
}
if($this->getAutoPostBack())
{
- $options = array_merge($options,$this->getPostBackOptions());
+ $options = array_merge($options,parent::getPostBackOptions());
$options['AutoPostBack'] = true;
}
$options['ResultPanel'] = $this->getResultPanel()->getClientID();
@@ -300,19 +300,6 @@ class TAutoComplete extends TActiveTextBox implements INamingContainer
}
/**
- * Ensure that the ID attribute is rendered and registers the javascript code
- * for initializing the active control.
- */
-
- public function addAttributesToRender($writer)
- {
- parent::addAttributesToRender($writer);
- $writer->addAttribute('id',$this->getClientID());
- $this->getActiveControl()->registerCallbackClientScript(
- $this->getClientClassName(), $this->getAutoCompleteOptions());
- }
-
- /**
* @return string corresponding javascript class name for this TActiveButton.
*/
protected function getClientClassName()
diff --git a/framework/Web/UI/ActiveControls/TInPlaceTextBox.php b/framework/Web/UI/ActiveControls/TInPlaceTextBox.php
index 16ffafb7..88db2d8f 100644
--- a/framework/Web/UI/ActiveControls/TInPlaceTextBox.php
+++ b/framework/Web/UI/ActiveControls/TInPlaceTextBox.php
@@ -150,21 +150,6 @@ class TInPlaceTextBox extends TActiveTextBox
}
/**
- * Adds attributes to renderer.
- * @param THtmlWriter the renderer
- * @throws TInvalidDataValueException if associated control cannot be found using the ID
- */
- protected function addAttributesToRender($writer)
- {
- TWebControl::addAttributesToRender($writer);
- $page=$this->getPage();
- $page->ensureRenderInForm($this);
- $writer->addAttribute('id', $this->getLabelClientID());
- if(!$this->getReadOnly())
- $this->renderClientControlScript($writer);
- }
-
- /**
* Renders the body content of the label.
* @param THtmlWriter the writer for rendering
*/
@@ -241,15 +226,6 @@ class TInPlaceTextBox extends TActiveTextBox
}
/**
- * Registers the javascript code for initializing the active control.
- */
- protected function renderClientControlScript($writer)
- {
- $this->getActiveControl()->registerCallbackClientScript(
- $this->getClientClassName(), $this->getPostBackOptions());
- }
-
- /**
* @return string corresponding javascript class name for this TInPlaceTextBox
*/
protected function getClientClassName()
diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php
index 99a81375..a755d605 100644
--- a/framework/Web/UI/WebControls/TBaseValidator.php
+++ b/framework/Web/UI/WebControls/TBaseValidator.php
@@ -172,8 +172,7 @@ abstract class TBaseValidator extends TLabel implements IValidator
if($control instanceof TDatePicker)
$options['DateFormat'] = $control->getDateFormat();
- if(!is_null($this->_clientSide))
- $options = array_merge($options,$this->_clientSide->getOptions()->toArray());
+ $options = array_merge($options,$this->getClientSide()->getOptions()->toArray());
return $options;
}
@@ -242,7 +241,7 @@ abstract class TBaseValidator extends TLabel implements IValidator
$scripts->registerPradoScript('validator');
$scripts->registerEndScript($scriptKey, "new Prado.ValidationManager({$options});");
}
- if($this->getEnableClientScript())
+ if($this->getEnableClientScript() & $this->getEnabled(true))
$this->registerClientScriptValidator();
$this->updateControlCssClass();
}
@@ -272,9 +271,9 @@ abstract class TBaseValidator extends TLabel implements IValidator
*/
protected function registerClientScriptValidator()
{
- if($this->getEnabled(true))
+ $key = 'prado:'.$this->getClientID();
+ if(!$this->getPage()->getClientScript()->isEndScriptRegistered($key))
{
- $key = 'prado:'.$this->getClientID();
$options = TJavaScript::encode($this->getClientScriptOptions());
$script = 'new '.$this->getClientClassName().'('.$options.');';
$this->getPage()->getClientScript()->registerEndScript($key, $script);