From 95764689f7681d5905c199727dd456671f2fd1b6 Mon Sep 17 00:00:00 2001 From: xue <> Date: Fri, 17 Mar 2006 22:58:05 +0000 Subject: Cleanup of usage of registerPostBackControl. --- framework/Web/UI/WebControls/TBulletedList.php | 6 +++--- framework/Web/UI/WebControls/TButton.php | 9 +++++---- framework/Web/UI/WebControls/TCheckBox.php | 7 ++++--- framework/Web/UI/WebControls/TImageButton.php | 5 +++-- framework/Web/UI/WebControls/TLinkButton.php | 7 ++++--- framework/Web/UI/WebControls/TListControl.php | 7 ++++--- framework/Web/UI/WebControls/TRadioButton.php | 2 +- framework/Web/UI/WebControls/TTextBox.php | 9 +++++---- 8 files changed, 29 insertions(+), 23 deletions(-) (limited to 'framework/Web/UI/WebControls') diff --git a/framework/Web/UI/WebControls/TBulletedList.php b/framework/Web/UI/WebControls/TBulletedList.php index da9d196e..05cbaab1 100644 --- a/framework/Web/UI/WebControls/TBulletedList.php +++ b/framework/Web/UI/WebControls/TBulletedList.php @@ -321,7 +321,7 @@ class TBulletedList extends TListControl implements IPostBackEventHandler else { $this->_currentRenderItemIndex = $index; - $this->getPage()->getClientScript()->registerPostbackControl($this); + $this->getPage()->getClientScript()->registerPostBackControl('Prado.WebUI.TBulletedList',$this->getPostBackOptions()); $writer->addAttribute('id', $this->getClientID().$index); $writer->addAttribute('href', "javascript:;//".$this->getClientID().$index); } @@ -333,9 +333,9 @@ class TBulletedList extends TListControl implements IPostBackEventHandler } /** - * @return TPostBackOptions postback options used for linkbuttons. + * @return array postback options used for linkbuttons. */ - public function getPostBackOptions() + protected function getPostBackOptions() { $options['ValidationGroup'] = $this->getValidationGroup(); $options['CausesValidation'] = $this->getCausesValidation(); diff --git a/framework/Web/UI/WebControls/TButton.php b/framework/Web/UI/WebControls/TButton.php index 2ced3098..6751687c 100644 --- a/framework/Web/UI/WebControls/TButton.php +++ b/framework/Web/UI/WebControls/TButton.php @@ -77,7 +77,7 @@ class TButton extends TWebControl implements IPostBackEventHandler if($this->canCauseValidation()) { $writer->addAttribute('id',$this->getClientID()); - $this->getPage()->getClientScript()->registerPostBackControl($this); + $this->getPage()->getClientScript()->registerPostBackControl('Prado.WebUI.TButton',$this->getPostBackOptions()); } } else if($this->getEnabled()) // in this case, parent will not render 'disabled' @@ -105,10 +105,11 @@ class TButton extends TWebControl implements IPostBackEventHandler * This method is used by framework and control developers. * @return array parameters about how the button defines its postback behavior. */ - public function getPostBackOptions() + protected function getPostBackOptions() { - $options['CausesValidation'] = $this->getCausesValidation(); - $options['ValidationGroup'] = $this->getValidationGroup(); + $options['ID']=$this->getClientID(); + $options['CausesValidation']=$this->getCausesValidation(); + $options['ValidationGroup']=$this->getValidationGroup(); return $options; } diff --git a/framework/Web/UI/WebControls/TCheckBox.php b/framework/Web/UI/WebControls/TCheckBox.php index f1299849..c3e5e640 100644 --- a/framework/Web/UI/WebControls/TCheckBox.php +++ b/framework/Web/UI/WebControls/TCheckBox.php @@ -351,7 +351,7 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl $page=$this->getPage(); if($this->getEnabled(true) && $this->getAutoPostBack() && $page->getClientSupportsJavaScript()) - $page->getClientScript()->registerPostBackControl($this); + $page->getClientScript()->registerPostBackControl('Prado.WebUI.TCheckBox',$this->getPostBackOptions()); if(($accesskey=$this->getAccessKey())!=='') $writer->addAttribute('accesskey',$accesskey); @@ -364,11 +364,12 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl } /** - * Sets the post back options for this checkbox. + * Gets the post back options for this checkbox. * @return array */ - public function getPostBackOptions() + protected function getPostBackOptions() { + $options['ID'] = $this->getClientID(); $options['ValidationGroup'] = $this->getValidationGroup(); $options['CausesValidation'] = $this->getCausesValidation(); $options['EventTarget'] = $this->getUniqueID(); diff --git a/framework/Web/UI/WebControls/TImageButton.php b/framework/Web/UI/WebControls/TImageButton.php index f98cccb1..e5e5f3b9 100644 --- a/framework/Web/UI/WebControls/TImageButton.php +++ b/framework/Web/UI/WebControls/TImageButton.php @@ -92,7 +92,7 @@ class TImageButton extends TImage implements IPostBackDataHandler, IPostBackEven if($this->canCauseValidation()) { $writer->addAttribute('id',$this->getClientID()); - $this->getPage()->getClientScript()->registerPostBackControl($this); + $this->getPage()->getClientScript()->registerPostBackControl('Prado.WebUI.TImageButton',$this->getPostBackOptions()); } } else if($this->getEnabled()) // in this case, parent will not render 'disabled' @@ -119,8 +119,9 @@ class TImageButton extends TImage implements IPostBackDataHandler, IPostBackEven * This method is used by framework and control developers. * @return array parameters about how the button defines its postback behavior. */ - public function getPostBackOptions() + protected function getPostBackOptions() { + $options['ID'] = $this->getClientID(); $options['CausesValidation'] = $this->getCausesValidation(); $options['ValidationGroup'] = $this->getValidationGroup(); diff --git a/framework/Web/UI/WebControls/TLinkButton.php b/framework/Web/UI/WebControls/TLinkButton.php index f1ed95f8..95490f8d 100644 --- a/framework/Web/UI/WebControls/TLinkButton.php +++ b/framework/Web/UI/WebControls/TLinkButton.php @@ -85,7 +85,7 @@ class TLinkButton extends TWebControl implements IPostBackEventHandler //create unique no-op url references $nop = "#".$this->getClientID(); $writer->addAttribute('href', $nop); - $this->getPage()->getClientScript()->registerPostBackControl($this); + $this->getPage()->getClientScript()->registerPostBackControl('Prado.WebUI.TLinkButton',$this->getPostBackOptions()); } else if($this->getEnabled()) // in this case, parent will not render 'disabled' $writer->addAttribute('disabled','disabled'); @@ -94,10 +94,11 @@ class TLinkButton extends TWebControl implements IPostBackEventHandler /** * Returns postback specifications for the button. * This method is used by framework and control developers. - * @return TPostBackOptions parameters about how the button defines its postback behavior. + * @return array parameters about how the button defines its postback behavior. */ - public function getPostBackOptions() + protected function getPostBackOptions() { + $options['ID'] = $this->getClientID(); $options['EventTarget'] = $this->getUniqueID(); $options['CausesValidation'] = $this->getCausesValidation(); $options['ValidationGroup'] = $this->getValidationGroup(); diff --git a/framework/Web/UI/WebControls/TListControl.php b/framework/Web/UI/WebControls/TListControl.php index be0abd38..7ea22e1d 100644 --- a/framework/Web/UI/WebControls/TListControl.php +++ b/framework/Web/UI/WebControls/TListControl.php @@ -116,7 +116,7 @@ abstract class TListControl extends TDataBoundControl if($this->getEnabled(true) && $this->getAutoPostBack() && $page->getClientSupportsJavaScript()) { $writer->addAttribute('id',$this->getClientID()); - $this->getPage()->getClientScript()->registerPostBackControl($this); + $this->getPage()->getClientScript()->registerPostBackControl('Prado.WebUI.'.get_class($this),$this->getPostBackOptions()); } if($this->getEnabled(true) && !$this->getEnabled()) $writer->addAttribute('disabled','disabled'); @@ -124,10 +124,11 @@ abstract class TListControl extends TDataBoundControl } /** - * @return TPostBackOptions postback options for JS postback code + * @return array postback options for JS postback code */ - public function getPostBackOptions() + protected function getPostBackOptions() { + $options['ID'] = $this->getClientID(); $options['CausesValidation'] = $this->getCausesValidation(); $options['ValidationGroup'] = $this->getValidationGroup(); $options['EventTarget'] = $this->getUniqueID(); diff --git a/framework/Web/UI/WebControls/TRadioButton.php b/framework/Web/UI/WebControls/TRadioButton.php index cb0454ae..dc5320b6 100644 --- a/framework/Web/UI/WebControls/TRadioButton.php +++ b/framework/Web/UI/WebControls/TRadioButton.php @@ -146,7 +146,7 @@ class TRadioButton extends TCheckBox $page=$this->getPage(); if($this->getEnabled(true) && $this->getAutoPostBack() && $page->getClientSupportsJavaScript()) - $page->getClientScript()->registerPostBackControl($this); + $page->getClientScript()->registerPostBackControl('Prado.WebUI.TRadioButton',$this->getPostBackOptions()); if(($accesskey=$this->getAccessKey())!=='') $writer->addAttribute('accesskey',$accesskey); diff --git a/framework/Web/UI/WebControls/TTextBox.php b/framework/Web/UI/WebControls/TTextBox.php index 7d1b9cba..bc490cdc 100644 --- a/framework/Web/UI/WebControls/TTextBox.php +++ b/framework/Web/UI/WebControls/TTextBox.php @@ -144,17 +144,18 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable if($this->getEnabled(true) && $this->getAutoPostBack() && $page->getClientSupportsJavaScript()) { $writer->addAttribute('id',$this->getClientID()); - $this->getPage()->getClientScript()->registerPostBackControl($this); + $this->getPage()->getClientScript()->registerPostBackControl('Prado.WebUI.TTextBox',$this->getPostBackOptions()); } parent::addAttributesToRender($writer); } /** - * Sets the post back options for this textbox. - * @return TPostBackOptions + * Gets the post back options for this textbox. + * @return array */ - public function getPostBackOptions() + protected function getPostBackOptions() { + $options['ID'] = $this->getClientID(); $options['EventTarget'] = $this->getUniqueID(); $options['CausesValidation'] = $this->getCausesValidation(); $options['ValidationGroup'] = $this->getValidationGroup(); -- cgit v1.2.3