summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TLinkButton.php
diff options
context:
space:
mode:
authorwei <>2006-01-18 04:20:26 +0000
committerwei <>2006-01-18 04:20:26 +0000
commit0226f8f5f430d34b3cead40c4eb7b458933d16c6 (patch)
tree68b21c4bec09ed73edc64019b4e20a2e3853d477 /framework/Web/UI/WebControls/TLinkButton.php
parente2219c91b98088289080bfa451d3083851eddf76 (diff)
update javascript library and usage in web controls
Diffstat (limited to 'framework/Web/UI/WebControls/TLinkButton.php')
-rw-r--r--framework/Web/UI/WebControls/TLinkButton.php32
1 files changed, 8 insertions, 24 deletions
diff --git a/framework/Web/UI/WebControls/TLinkButton.php b/framework/Web/UI/WebControls/TLinkButton.php
index 16d670b3..01441d99 100644
--- a/framework/Web/UI/WebControls/TLinkButton.php
+++ b/framework/Web/UI/WebControls/TLinkButton.php
@@ -88,12 +88,7 @@ class TLinkButton extends TWebControl implements IPostBackEventHandler
//create unique no-op url references
$nop = "javascript:;//".$this->getClientID();
$writer->addAttribute('href', $url ? $url : $nop);
-
- $scripts = $this->getPage()->getClientScript();
- $options = $this->getPostBackOptions();
- $postback = $scripts->getPostBackEventReference($this, '', $options, false);
- $code = "{$postback}; Event.stop(e);";
- $scripts->registerClientEvent($this, "click", $code);
+ $this->getPage()->getClientScript()->registerPostBackControl($this);
}
else if($this->getEnabled()) // in this case, parent will not render 'disabled'
$writer->addAttribute('disabled','disabled');
@@ -104,25 +99,14 @@ class TLinkButton extends TWebControl implements IPostBackEventHandler
* This method is used by framework and control developers.
* @return TPostBackOptions parameters about how the button defines its postback behavior.
*/
- protected function getPostBackOptions()
+ public function getPostBackOptions()
{
- $flag=false;
-
- $option=new TPostBackOptions();
- $group = $this->getValidationGroup();
- $hasValidators = $this->getPage()->getValidators($group)->getCount()>0;
- if($this->getCausesValidation() && $hasValidators)
- {
- $flag=true;
- $options->setPerformValidation(true);
- $options->setValidationGroup($this->getValidationGroup());
- }
- if($this->getPostBackUrl()!=='')
- {
- $flag=true;
- $options->setActionUrl($this->getPostBackUrl());
- }
- return $flag?$options:null;
+ $options['EventTarget'] = $this->getUniqueID();
+ $options['CausesValidation'] = $this->getCausesValidation();
+ $options['ValidationGroup'] = $this->getValidationGroup();
+ $options['PostBackUrl'] = $this->getPostBackUrl();
+
+ return $options;
}
/**