summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Bas <ctrlaltca@gmail.com>2013-09-30 17:36:51 +0200
committerFabio Bas <ctrlaltca@gmail.com>2013-09-30 17:36:51 +0200
commit064053a81f4ce4e9cef5e8984dadfe7cca049fb9 (patch)
treebc3f21355f56918932569e33d3dfcc665d7b9cf2
parent4ef09ccaf27e31ac5112b2846c253a2877f8a520 (diff)
Fix use of TCallbackOptions with TActiveCheckBoxList, TActiveRadioButtonList, TActiveRatingList
-rw-r--r--framework/Web/UI/ActiveControls/TActiveCheckBoxList.php12
-rw-r--r--framework/Web/UI/ActiveControls/TActiveRadioButtonList.php11
-rw-r--r--framework/Web/UI/ActiveControls/TActiveRatingList.php11
-rw-r--r--framework/Web/UI/ActiveControls/TBaseActiveControl.php4
-rw-r--r--framework/Web/UI/WebControls/TCheckBoxList.php6
5 files changed, 42 insertions, 2 deletions
diff --git a/framework/Web/UI/ActiveControls/TActiveCheckBoxList.php b/framework/Web/UI/ActiveControls/TActiveCheckBoxList.php
index d51c4d95..a42044fb 100644
--- a/framework/Web/UI/ActiveControls/TActiveCheckBoxList.php
+++ b/framework/Web/UI/ActiveControls/TActiveCheckBoxList.php
@@ -105,5 +105,17 @@ class TActiveCheckBoxList extends TCheckBoxList implements IActiveControl, ICall
{
$this->raiseEvent('OnCallback', $this, $param);
}
+
+ /**
+ * Ensure that the ID attribute is rendered and registers the javascript code
+ * for initializing the active control.
+ */
+ protected function addAttributesToRender($writer)
+ {
+ parent::addAttributesToRender($writer);
+ $this->getActiveControl()->registerCallbackClientScript(
+ $this->getClientClassName(), $this->getPostBackOptions());
+ }
+
}
diff --git a/framework/Web/UI/ActiveControls/TActiveRadioButtonList.php b/framework/Web/UI/ActiveControls/TActiveRadioButtonList.php
index c106f479..3244ce11 100644
--- a/framework/Web/UI/ActiveControls/TActiveRadioButtonList.php
+++ b/framework/Web/UI/ActiveControls/TActiveRadioButtonList.php
@@ -106,5 +106,16 @@ class TActiveRadioButtonList extends TRadioButtonList implements IActiveControl,
{
$this->raiseEvent('OnCallback', $this, $param);
}
+
+ /**
+ * Ensure that the ID attribute is rendered and registers the javascript code
+ * for initializing the active control.
+ */
+ protected function addAttributesToRender($writer)
+ {
+ parent::addAttributesToRender($writer);
+ $this->getActiveControl()->registerCallbackClientScript(
+ $this->getClientClassName(), $this->getPostBackOptions());
+ }
}
diff --git a/framework/Web/UI/ActiveControls/TActiveRatingList.php b/framework/Web/UI/ActiveControls/TActiveRatingList.php
index 973dc1e5..022efe65 100644
--- a/framework/Web/UI/ActiveControls/TActiveRatingList.php
+++ b/framework/Web/UI/ActiveControls/TActiveRatingList.php
@@ -121,6 +121,17 @@ class TActiveRatingList extends TRatingList implements IActiveControl, ICallback
}
/**
+ * Ensure that the ID attribute is rendered and registers the javascript code
+ * for initializing the active control.
+ */
+ protected function addAttributesToRender($writer)
+ {
+ parent::addAttributesToRender($writer);
+ $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
diff --git a/framework/Web/UI/ActiveControls/TBaseActiveControl.php b/framework/Web/UI/ActiveControls/TBaseActiveControl.php
index 73503f3c..61230719 100644
--- a/framework/Web/UI/ActiveControls/TBaseActiveControl.php
+++ b/framework/Web/UI/ActiveControls/TBaseActiveControl.php
@@ -239,7 +239,9 @@ class TBaseActiveCallbackControl extends TBaseActiveControl
}
else
{
- $control=$this->getControl()->findControl($id);
+ // TCheckBoxList overrides findControl() with a fake implementation
+ // but accepts a second parameter to use the standard one
+ $control=$this->getControl()->findControl($id, true);
}
if($control instanceof TCallbackOptions)
diff --git a/framework/Web/UI/WebControls/TCheckBoxList.php b/framework/Web/UI/WebControls/TCheckBoxList.php
index ac278a16..5122432c 100644
--- a/framework/Web/UI/WebControls/TCheckBoxList.php
+++ b/framework/Web/UI/WebControls/TCheckBoxList.php
@@ -84,8 +84,10 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
* @param string control ID
* @return TControl control being found
*/
- public function findControl($id)
+ public function findControl($id, $real=false)
{
+ if ($real===true)
+ return parent::findControl($id);
return $this;
}
@@ -418,12 +420,14 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
$this->_repeatedControl->setTabIndex($tabIndex);
$this->setAccessKey('');
$this->setTabIndex(0);
+ $this->addAttributesToRender($writer);
$repeatInfo->renderRepeater($writer,$this);
$this->setAccessKey($accessKey);
$this->setTabIndex($tabIndex);
if ($needSpan)
$writer->renderEndTag();
}
+
//checkbox skipped the client control script in addAttributesToRender
if($this->getEnabled(true)
&& $this->getEnableClientScript()