From a0ba7a2196cf4379c1772d36aeaf899b2cf47752 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Thu, 24 Oct 2013 23:45:36 +0200 Subject: More work on ajax --- .../UI/ActiveControls/TActiveControlAdapter.php | 20 ----------------- .../Web/UI/ActiveControls/TActiveImageButton.php | 12 ---------- framework/Web/UI/ActiveControls/TActiveListBox.php | 6 ----- .../UI/ActiveControls/TCallbackClientScript.php | 5 ----- framework/Web/UI/TControl.php | 10 --------- framework/Web/UI/TPage.php | 26 ---------------------- framework/Web/UI/WebControls/TDatePicker.php | 8 ------- framework/Web/UI/WebControls/TRadioButton.php | 10 --------- 8 files changed, 97 deletions(-) (limited to 'framework/Web/UI') diff --git a/framework/Web/UI/ActiveControls/TActiveControlAdapter.php b/framework/Web/UI/ActiveControls/TActiveControlAdapter.php index ab15f091..6c209ac5 100644 --- a/framework/Web/UI/ActiveControls/TActiveControlAdapter.php +++ b/framework/Web/UI/ActiveControls/TActiveControlAdapter.php @@ -89,7 +89,6 @@ class TActiveControlAdapter extends TControlAdapter public function render($writer) { $this->getPage()->getClientScript()->registerPradoScript('ajax'); - $this->renderCallbackClientScripts(); if($this->_control->getVisible(false)) { parent::render($writer); @@ -98,25 +97,6 @@ class TActiveControlAdapter extends TControlAdapter } } - /** - * Register the callback clientscripts and sets the post loader IDs. - */ - protected function renderCallbackClientScripts() - { - $cs = $this->getPage()->getClientScript(); - $key = 'Prado.CallbackRequest.addPostLoaders'; - if(!$cs->isEndScriptRegistered($key)) - { - $data = $this->getPage()->getPostDataLoaders(); - if(count($data) > 0) - { - $options = TJavaScript::encode($data,false); - $script = "Prado.CallbackRequest.addPostLoaders({$options});"; - $cs->registerEndScript($key, $script); - } - } - } - /** * @param TBaseActiveControl change base active control */ diff --git a/framework/Web/UI/ActiveControls/TActiveImageButton.php b/framework/Web/UI/ActiveControls/TActiveImageButton.php index b2aa9960..8fe5e33d 100644 --- a/framework/Web/UI/ActiveControls/TActiveImageButton.php +++ b/framework/Web/UI/ActiveControls/TActiveImageButton.php @@ -134,18 +134,6 @@ class TActiveImageButton extends TImageButton implements IActiveControl, ICallba { } - /** - * Register the x and y hidden input names of the position clicked. - * @param THtmlWriter the renderer. - */ - public function onPreRender($writer) - { - parent::onPreRender($writer); - $uid = $uid=$this->getUniqueID(); - $this->getPage()->registerPostDataLoader($uid.'_x'); - $this->getPage()->registerPostDataLoader($uid.'_y'); - } - /** * Ensure that the ID attribute is rendered and registers the javascript code * for initializing the active control. diff --git a/framework/Web/UI/ActiveControls/TActiveListBox.php b/framework/Web/UI/ActiveControls/TActiveListBox.php index dfb4bf6e..913cdeda 100644 --- a/framework/Web/UI/ActiveControls/TActiveListBox.php +++ b/framework/Web/UI/ActiveControls/TActiveListBox.php @@ -95,8 +95,6 @@ class TActiveListBox extends TListBox implements IActiveControl, ICallbackEventH $client = $this->getPage()->getCallbackClient(); $client->setAttribute($this, 'multiple', $multiple ? 'multiple' : false); $client->setAttribute($this, 'name', $multiple ? $multi_id : $id); - if($multiple) - $client->addPostDataLoader($multi_id); } } @@ -130,10 +128,6 @@ class TActiveListBox extends TListBox implements IActiveControl, ICallbackEventH { parent::onPreRender($param); $this->getAdapter()->updateListItems(); - $multiple = $this->getIsMultiSelect(); - $id = $this->getUniqueID(); $multi_id = $id.'[]'; - if($multiple) - $this->getPage()->registerPostDataLoader($multi_id); } /** diff --git a/framework/Web/UI/ActiveControls/TCallbackClientScript.php b/framework/Web/UI/ActiveControls/TCallbackClientScript.php index 15300727..a25e7f41 100644 --- a/framework/Web/UI/ActiveControls/TCallbackClientScript.php +++ b/framework/Web/UI/ActiveControls/TCallbackClientScript.php @@ -304,11 +304,6 @@ class TCallbackClientScript extends TApplicationComponent $this->jQuery($element, 'remove'); } - public function addPostDataLoader($name) - { - $this->callClientFunction('Prado.CallbackRequest.addPostLoaders', $name); - } - /** * Update the element's innerHTML with new content. * @param TControl control element or element id diff --git a/framework/Web/UI/TControl.php b/framework/Web/UI/TControl.php index 5ee20d61..cbc6a409 100644 --- a/framework/Web/UI/TControl.php +++ b/framework/Web/UI/TControl.php @@ -1330,20 +1330,10 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable $control->evaluateDynamicContent(); } } - $this->addToPostDataLoader(); } $this->_stage=self::CS_PRERENDERED; } - /** - * Add controls implementing IPostBackDataHandler to post data loaders. - */ - protected function addToPostDataLoader() - { - if($this instanceof IPostBackDataHandler) - $this->getPage()->registerPostDataLoader($this); - } - /** * Performs the Unload step for the control and all its child controls. * Only framework developers should use this method. diff --git a/framework/Web/UI/TPage.php b/framework/Web/UI/TPage.php index 39656e13..4e8652f4 100644 --- a/framework/Web/UI/TPage.php +++ b/framework/Web/UI/TPage.php @@ -154,10 +154,6 @@ class TPage extends TTemplateControl * @var string state string to be stored on the client side */ private $_clientState=''; - /** - * @var array post data loader IDs. - */ - protected $_postDataLoaders=array(); /** * @var boolean true if loading post data. */ @@ -426,27 +422,6 @@ class TPage extends TTemplateControl $this->getAdapter()->setCallbackEventParameter($value); } - /** - * Register post data loaders for Callback to collect post data. - * This method should only be called by framework developers. - * @param TControl control that requires post data. - * @see TControl::preRenderRecursive(); - */ - public function registerPostDataLoader($control) - { - $id=is_string($control)?$control:$control->getUniqueID(); - $this->_postDataLoaders[$id] = true; - } - - /** - * Get a list of IDs of controls that are enabled and require post data. - * @return array list of IDs implementing IPostBackDataHandler - */ - public function getPostDataLoaders() - { - return array_keys($this->_postDataLoaders); - } - /** * @return TForm the form on the page */ @@ -825,7 +800,6 @@ class TPage extends TTemplateControl { $id=is_string($control)?$control:$control->getUniqueID(); $this->_controlsRegisteredForPostData[$id]=true; - $this->registerPostDataLoader($id); $params=func_get_args(); foreach($this->getCachingStack() as $item) $item->registerAction('Page','registerRequiresPostData',array($id)); diff --git a/framework/Web/UI/WebControls/TDatePicker.php b/framework/Web/UI/WebControls/TDatePicker.php index a67997b8..b5ed8a86 100644 --- a/framework/Web/UI/WebControls/TDatePicker.php +++ b/framework/Web/UI/WebControls/TDatePicker.php @@ -406,14 +406,6 @@ class TDatePicker extends TTextBox public function onPreRender($param) { parent::onPreRender($param); - if($this->getInputMode() === TDatePickerInputMode::DropDownList) - { - $page = $this->getPage(); - $uniqueID = $this->getUniqueID(); - $page->registerPostDataLoader($uniqueID.TControl::ID_SEPARATOR.'day'); - $page->registerPostDataLoader($uniqueID.TControl::ID_SEPARATOR.'month'); - $page->registerPostDataLoader($uniqueID.TControl::ID_SEPARATOR.'year'); - } $this->publishCalendarStyle(); $this->registerCalendarClientScriptPre(); } diff --git a/framework/Web/UI/WebControls/TRadioButton.php b/framework/Web/UI/WebControls/TRadioButton.php index 144704b4..dbb0dac0 100644 --- a/framework/Web/UI/WebControls/TRadioButton.php +++ b/framework/Web/UI/WebControls/TRadioButton.php @@ -155,16 +155,6 @@ class TRadioButton extends TCheckBox $this->_uniqueGroupName=null; } - /** - * Add the group name as post data loader if group name is set. - */ - protected function addToPostDataLoader() - { - parent::addToPostDataLoader(); - $group = $this->getGroupName(); - if(!empty($group) || $this->getViewState('UniqueGroupName','') !== '') - $this->getPage()->registerPostDataLoader($this->getUniqueGroupName()); - } /** * @return string the name used to fetch radiobutton post data */ -- cgit v1.2.3