From 0226f8f5f430d34b3cead40c4eb7b458933d16c6 Mon Sep 17 00:00:00 2001 From: wei <> Date: Wed, 18 Jan 2006 04:20:26 +0000 Subject: update javascript library and usage in web controls --- framework/Web/UI/WebControls/TLinkButton.php | 32 +++++++--------------------- 1 file changed, 8 insertions(+), 24 deletions(-) (limited to 'framework/Web/UI/WebControls/TLinkButton.php') 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; } /** -- cgit v1.2.3