diff options
Diffstat (limited to 'framework/Web/UI')
-rw-r--r-- | framework/Web/UI/TClientScriptManager.php | 14 | ||||
-rw-r--r-- | framework/Web/UI/TPage.php | 2 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TClientScript.php | 2 |
3 files changed, 9 insertions, 9 deletions
diff --git a/framework/Web/UI/TClientScriptManager.php b/framework/Web/UI/TClientScriptManager.php index 08b528b1..0096e169 100644 --- a/framework/Web/UI/TClientScriptManager.php +++ b/framework/Web/UI/TClientScriptManager.php @@ -85,7 +85,7 @@ class TClientScriptManager extends TApplicationComponent private $_renderedHiddenFields; - private $_renderedScriptFiles; + private $_renderedScriptFiles=array(); private $_expandedPradoScripts; @@ -665,20 +665,19 @@ class TClientScriptManager extends TApplicationComponent public function renderScriptFilesBegin($writer) { - $this->renderScriptFilesInt($writer,true); + $this->renderScriptFilesInt($writer); } public function renderScriptFilesEnd($writer) { - $this->renderScriptFilesInt($writer,false); + $this->renderScriptFilesInt($writer); } /** * @param THtmlWriter writer for the rendering purpose */ - public function renderScriptFilesInt($writer, $initial) + public function renderScriptFilesInt($writer) { - if ($initial) $this->_renderedScriptFiles = array(); if(!empty($this->_scriptFiles)) { $addedScripts = array_diff($this->_scriptFiles,$this->_renderedScriptFiles); @@ -717,10 +716,11 @@ class TClientScriptManager extends TApplicationComponent /** * Flushes all pending script registrations * @param THtmlWriter writer for the rendering purpose + * @param TControl the control forcing the flush (used only in error messages) */ - public function flushScriptFiles($writer) + public function flushScriptFiles($writer, $control=null) { - assert($this->_page->InFormRender); + $this->_page->ensureRenderInForm($control); $this->renderScriptFilesInt($writer,false); } diff --git a/framework/Web/UI/TPage.php b/framework/Web/UI/TPage.php index 9d9ac37e..c227562c 100644 --- a/framework/Web/UI/TPage.php +++ b/framework/Web/UI/TPage.php @@ -968,7 +968,7 @@ class TPage extends TTemplateControl public function ensureRenderInForm($control)
{
if(!$this->getIsCallback() && !$this->_inFormRender)
- throw new TConfigurationException('page_control_outofform',get_class($control),$control->getUniqueID());
+ throw new TConfigurationException('page_control_outofform',get_class($control), $control ? $control->getUniqueID() : null);
}
/**
diff --git a/framework/Web/UI/WebControls/TClientScript.php b/framework/Web/UI/WebControls/TClientScript.php index 6eba3d57..8fe3b723 100644 --- a/framework/Web/UI/WebControls/TClientScript.php +++ b/framework/Web/UI/WebControls/TClientScript.php @@ -125,7 +125,7 @@ class TClientScript extends TControl public function render($writer) { if ($this->getFlushScriptFiles()) - $this->getPage()->getClientScript()->flushScriptFiles($writer); + $this->getPage()->getClientScript()->flushScriptFiles($writer, $this); $this->renderCustomScriptFile($writer); $this->renderCustomScript($writer); } |