summaryrefslogtreecommitdiff
path: root/framework/Web/UI/TClientScriptManager.php
diff options
context:
space:
mode:
authorxue <>2006-03-17 22:58:05 +0000
committerxue <>2006-03-17 22:58:05 +0000
commit95764689f7681d5905c199727dd456671f2fd1b6 (patch)
tree6a7c4f74642de8189420679b2d43c4124fc1bf36 /framework/Web/UI/TClientScriptManager.php
parent261c29ece2ccf37e6419b9886cefd29f9dbb3c89 (diff)
Cleanup of usage of registerPostBackControl.
Diffstat (limited to 'framework/Web/UI/TClientScriptManager.php')
-rw-r--r--framework/Web/UI/TClientScriptManager.php29
1 files changed, 8 insertions, 21 deletions
diff --git a/framework/Web/UI/TClientScriptManager.php b/framework/Web/UI/TClientScriptManager.php
index a361d32e..01be9944 100644
--- a/framework/Web/UI/TClientScriptManager.php
+++ b/framework/Web/UI/TClientScriptManager.php
@@ -157,34 +157,21 @@ class TClientScriptManager extends TApplicationComponent
/**
* Registers postback javascript for a control.
- * @param TControl control to be registered with postback js
- * @param string js namespace for the control
+ * @param string javascript class responsible for the control being registered for postback
+ * @param array postback options
*/
- public function registerPostBackControl($control,$namespace='Prado.WebUI')
+ public function registerPostBackControl($jsClass,$options)
{
- $options = $this->getPostBackOptions($control);
- $type = get_class($control);
- $namespace = empty($namespace) ? "window" : $namespace;
- $code = "new {$namespace}.{$type}($options);";
+ if(!isset($options['FormID']))
+ $options['FormID']=$this->_page->getForm()->getClientID();
+ $optionString=TJavaScript::encode($options);
+ $code="new $jsClass($optionString);";
$this->registerEndScript(sprintf('%08X', crc32($code)), $code);
$this->registerHiddenField(TPage::FIELD_POSTBACK_TARGET,'');
$this->registerHiddenField(TPage::FIELD_POSTBACK_PARAMETER,'');
- $this->registerPradoScript('prado');
- }
- /**
- * @param TControl postback control
- * @return array postback options for the control
- */
- protected function getPostBackOptions($control)
- {
- $postback = $control->getPostBackOptions();
- if(!isset($postback['ID']))
- $postback['ID'] = $control->getClientID();
- if(!isset($postback['FormID']))
- $postback['FormID'] = $this->_page->getForm()->getClientID();
- return TJavaScript::encode($postback);
+ $this->registerPradoScript('prado');
}
/**