summaryrefslogtreecommitdiff
path: root/framework/Web
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web')
-rw-r--r--framework/Web/Javascripts/source/prado/prado.js8
-rw-r--r--framework/Web/UI/ActiveControls/TCallbackClientScript.php18
-rw-r--r--framework/Web/UI/JuiControls/TJuiDialog.php26
3 files changed, 43 insertions, 9 deletions
diff --git a/framework/Web/Javascripts/source/prado/prado.js b/framework/Web/Javascripts/source/prado/prado.js
index ec7f68fc..01c0d630 100644
--- a/framework/Web/Javascripts/source/prado/prado.js
+++ b/framework/Web/Javascripts/source/prado/prado.js
@@ -525,8 +525,9 @@ Prado.Element =
* @param {string|element} element - DOM element or element id
* @param {optional string} content - New content of element
* @param {optional string} boundary - Boundary of new content
+ * @param {optional boolean} self - Whether to replace itself or just the inner content
*/
- replace : function(element, content, boundary)
+ replace : function(element, content, boundary, self)
{
if(boundary)
{
@@ -534,7 +535,10 @@ Prado.Element =
if(result != null)
content = result;
}
- jQuery('#'+element).replaceWith(content);
+ if(self)
+ jQuery('#'+element).replaceWith(content);
+ else
+ jQuery('#'+element).html(content);
},
/**
diff --git a/framework/Web/UI/ActiveControls/TCallbackClientScript.php b/framework/Web/UI/ActiveControls/TCallbackClientScript.php
index 82f597bb..71f8f63e 100644
--- a/framework/Web/UI/ActiveControls/TCallbackClientScript.php
+++ b/framework/Web/UI/ActiveControls/TCallbackClientScript.php
@@ -411,14 +411,14 @@ class TCallbackClientScript extends TApplicationComponent
* a TControl component, its rendered method will be called and its contents
* will be used for replacement.
* @param TControl control element or HTML element id.
- * @param string HTML fragement or the control to be rendered
- * @param string provide a custom boundary.
+ * @param string HTML fragement or the control to be rendered.
+ * @param boolean whether to fully replace the element or just its inner content.
* @see insertAbout
* @see insertBelow
* @see insertBefore
* @see insertAfter
*/
- protected function replace($element, $content, $boundary=null)
+ protected function replace($element, $content, $self)
{
if($content instanceof TControl)
{
@@ -430,20 +430,24 @@ class TCallbackClientScript extends TApplicationComponent
$boundary = $this->getResponseContentBoundary($content);
$content = null;
}
+ else
+ $boundary = null;
- $this->callClientFunction('Prado.Element.replace', array($element, $content, $boundary));
+ $this->callClientFunction('Prado.Element.replace', array($element, $content, $boundary, $self));
}
/**
* Replace the content of an element with new content contained in writer.
* @param TControl control element or HTML element id.
- * @param string HTML fragement or the control to be rendered
+ * @param string HTML fragement or the control to be rendered.
+ * @param boolean whether to fully replace the element or just its inner content, defaults to true.
*/
- public function replaceContent($element,$content)
+ public function replaceContent($element, $content, $self=true)
{
- $this->replace($element, $content);
+ $this->replace($element, $content, $self);
}
+
/**
* Evaluate a block of javascript enclosed in a boundary.
* @param THtmlWriter writer for the content.
diff --git a/framework/Web/UI/JuiControls/TJuiDialog.php b/framework/Web/UI/JuiControls/TJuiDialog.php
index 7817c3b1..0e369cc2 100644
--- a/framework/Web/UI/JuiControls/TJuiDialog.php
+++ b/framework/Web/UI/JuiControls/TJuiDialog.php
@@ -164,6 +164,32 @@ class TJuiDialog extends TActivePanel implements IJuiOptions, ICallbackEventHand
$code = "jQuery('#".$this->getClientId()."').dialog('".$method."');";
$cs->registerEndScript(sprintf('%08X', crc32($code)), $code);
}
+
+ /**
+ * Rendering as a fieldset is not supported for TJuiDialog.
+ * @param string the legend text. If this value is not empty, the panel will be rendered as a fieldset.
+ * @throws TNotSupportedException not supported for TJuiDialog.
+ */
+ public function setGroupingText($value)
+ {
+ throw new TNotSupportedException('Rendering as a fieldset is not supported for {0}.', get_class($this));
+ }
+
+ /**
+ * Overrides parent implementation to just render the inner contents and avoid replacing the element itself when
+ * updating clientside, because replacing/removing will cause jqueryui to fire destroy on the original dialog extension.
+ * @param THtmlWriter html writer
+ */
+ public function render($writer)
+ {
+ if($this->getHasPreRendered() && $this->getActiveControl()->canUpdateClientSide())
+ {
+ parent::renderContents($writer);
+ $this->getPage()->getCallbackClient()->replaceContent($this, $writer, false);
+ }
+ else
+ parent::render($writer);
+ }
}
/**