summaryrefslogtreecommitdiff
path: root/framework/Web/UI/ActiveControls
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/UI/ActiveControls')
-rw-r--r--framework/Web/UI/ActiveControls/TActiveControlAdapter.php10
-rwxr-xr-xframework/Web/UI/ActiveControls/TDraggable.php19
-rwxr-xr-xframework/Web/UI/ActiveControls/TDropContainer.php13
3 files changed, 34 insertions, 8 deletions
diff --git a/framework/Web/UI/ActiveControls/TActiveControlAdapter.php b/framework/Web/UI/ActiveControls/TActiveControlAdapter.php
index e8f947af..99c5e71e 100644
--- a/framework/Web/UI/ActiveControls/TActiveControlAdapter.php
+++ b/framework/Web/UI/ActiveControls/TActiveControlAdapter.php
@@ -75,6 +75,15 @@ class TActiveControlAdapter extends TControlAdapter
$this->_activeControlType = $type;
}
+ /**
+ * Publish the ajax script
+ */
+ public function onPreRender($param)
+ {
+ parent::onPreRender($param);
+ $this->getPage()->getClientScript()->registerPradoScript('ajax');
+ }
+
/**
* Renders the callback client scripts.
*/
@@ -93,7 +102,6 @@ class TActiveControlAdapter extends TControlAdapter
$key = 'Prado.CallbackRequest.addPostLoaders';
if(!$cs->isEndScriptRegistered($key))
{
- $cs->registerPradoScript('ajax');
$data = $this->getPage()->getPostDataLoaders();
if(count($data) > 0)
{
diff --git a/framework/Web/UI/ActiveControls/TDraggable.php b/framework/Web/UI/ActiveControls/TDraggable.php
index 34d8c548..10e78b9b 100755
--- a/framework/Web/UI/ActiveControls/TDraggable.php
+++ b/framework/Web/UI/ActiveControls/TDraggable.php
@@ -136,6 +136,20 @@ class TDraggable extends TPanel
$this->setViewState('Constraint', TPropertyValue::ensureEnum($value, 'TDraggableConstraint'), TDraggableConstraint::None);
}
+ /**
+ * Registers clientscripts
+ *
+ * This method overrides the parent implementation and is invoked before render.
+ * @param mixed event parameter
+ */
+ public function onPreRender($param)
+ {
+ parent::onPreRender($param);
+ if ($this->getGhosting()==TDraggableGhostingOptions::SuperGhosting)
+ $cs->registerPradoScript('dragdropextra');
+ else
+ $cs->registerPradoScript('dragdrop');
+ }
/**
* Ensure that the ID attribute is rendered and registers the javascript code
@@ -145,11 +159,6 @@ class TDraggable extends TPanel
{
parent::addAttributesToRender($writer);
$writer->addAttribute('id',$this->getClientID());
- $cs=$this->getPage()->getClientScript();
- if ($this->getGhosting()==TDraggableGhostingOptions::SuperGhosting)
- $cs->registerPradoScript('dragdropextra');
- else
- $cs->registerPradoScript('dragdrop');
$options=TJavascript::encode($this->getPostBackOptions());
$class=$this->getClientClassName();
$code="new {$class}('{$this->getClientId()}', {$options}) ";
diff --git a/framework/Web/UI/ActiveControls/TDropContainer.php b/framework/Web/UI/ActiveControls/TDropContainer.php
index 915aa8f9..e6933147 100755
--- a/framework/Web/UI/ActiveControls/TDropContainer.php
+++ b/framework/Web/UI/ActiveControls/TDropContainer.php
@@ -172,6 +172,17 @@ class TDropContainer extends TPanel implements IActiveControl, ICallbackEventHan
return 'Prado.WebUI.DropContainer';
}
+ /**
+ * Registers clientscripts
+ *
+ * This method overrides the parent implementation and is invoked before render.
+ * @param mixed event parameter
+ */
+ public function onPreRender($param)
+ {
+ parent::onPreRender($param);
+ $this->getPage()->getClientScript()->registerPradoScript('dragdrop');
+ }
/**
* Ensure that the ID attribute is rendered and registers the javascript code
@@ -182,8 +193,6 @@ class TDropContainer extends TPanel implements IActiveControl, ICallbackEventHan
parent::addAttributesToRender($writer);
$writer->addAttribute('id',$this->getClientID());
- $this->getPage()->getClientScript()->registerPradoScript('dragdrop');
-
$this->getActiveControl()->registerCallbackClientScript(
$this->getClientClassName(), $this->getPostBackOptions());
}