summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TImageButton.php
diff options
context:
space:
mode:
authorwei <>2006-10-01 03:09:18 +0000
committerwei <>2006-10-01 03:09:18 +0000
commit36f2ce766bde98c11d57b889fd9e1a7f8dff6010 (patch)
tree87c33c9e4447e20159932824b4de6167da495d49 /framework/Web/UI/WebControls/TImageButton.php
parent1c32172efb18e8d08ea483e2460813670ebfe1a5 (diff)
Fixed #350 and #148, Add TActiveRatingList, should remove TRatingList from WebControls.
Diffstat (limited to 'framework/Web/UI/WebControls/TImageButton.php')
-rw-r--r--framework/Web/UI/WebControls/TImageButton.php31
1 files changed, 24 insertions, 7 deletions
diff --git a/framework/Web/UI/WebControls/TImageButton.php b/framework/Web/UI/WebControls/TImageButton.php
index ad5d7bf0..3e96abdc 100644
--- a/framework/Web/UI/WebControls/TImageButton.php
+++ b/framework/Web/UI/WebControls/TImageButton.php
@@ -76,6 +76,22 @@ class TImageButton extends TImage implements IPostBackDataHandler, IPostBackEven
}
/**
+ * @return boolean whether to render javascript.
+ */
+ public function getEnableClientScript()
+ {
+ return $this->getViewState('EnableClientScript',true);
+ }
+
+ /**
+ * @param boolean whether to render javascript.
+ */
+ public function setEnableClientScript($value)
+ {
+ $this->setViewState('EnableClientScript',TPropertyValue::ensureBoolean($value),true);
+ }
+
+ /**
* Adds attribute name-value pairs to renderer.
* This overrides the parent implementation with additional button specific attributes.
* @param THtmlWriter the writer used for the rendering purpose
@@ -87,8 +103,12 @@ class TImageButton extends TImage implements IPostBackDataHandler, IPostBackEven
$writer->addAttribute('type','image');
if(($uniqueID=$this->getUniqueID())!=='')
$writer->addAttribute('name',$uniqueID);
- if($this->getEnabled(true))
+ if($this->getEnabled(true)
+ && $this-canCauseValidation()
+ && $this->getEnableClientScript())
+ {
$this->renderClientControlScript($writer);
+ }
else if($this->getEnabled()) // in this case, parent will not render 'disabled'
$writer->addAttribute('disabled','disabled');
parent::addAttributesToRender($writer);
@@ -99,12 +119,9 @@ class TImageButton extends TImage implements IPostBackDataHandler, IPostBackEven
*/
protected function renderClientControlScript($writer)
{
- if($this->canCauseValidation())
- {
- $writer->addAttribute('id',$this->getClientID());
- $cs = $this->getPage()->getClientScript();
- $cs->registerPostBackControl($this->getClientClassName(),$this->getPostBackOptions());
- }
+ $writer->addAttribute('id',$this->getClientID());
+ $cs = $this->getPage()->getClientScript();
+ $cs->registerPostBackControl($this->getClientClassName(),$this->getPostBackOptions());
}
/**