summaryrefslogtreecommitdiff
path: root/framework/Web/UI/ActiveControls
diff options
context:
space:
mode:
authorwei <>2006-05-05 00:45:35 +0000
committerwei <>2006-05-05 00:45:35 +0000
commitf21d3433721308f5d0693f44bbfed56f7b2ecc2d (patch)
tree96f10eb302f0a156ebc237d9ab0949986c4f469e /framework/Web/UI/ActiveControls
parent42df6f47862c2f1495ded49f758dbc46f9d9e930 (diff)
Adding TActiveLabel
Diffstat (limited to 'framework/Web/UI/ActiveControls')
-rw-r--r--framework/Web/UI/ActiveControls/TActiveLabel.php70
-rw-r--r--framework/Web/UI/ActiveControls/TActivePageAdapter.php2
-rw-r--r--framework/Web/UI/ActiveControls/TCallback.php19
-rw-r--r--framework/Web/UI/ActiveControls/TCallbackClientScript.php14
-rw-r--r--framework/Web/UI/ActiveControls/TCallbackClientSideOptions.php16
5 files changed, 94 insertions, 27 deletions
diff --git a/framework/Web/UI/ActiveControls/TActiveLabel.php b/framework/Web/UI/ActiveControls/TActiveLabel.php
new file mode 100644
index 00000000..d71d8b7a
--- /dev/null
+++ b/framework/Web/UI/ActiveControls/TActiveLabel.php
@@ -0,0 +1,70 @@
+<?php
+/**
+ * TActiveLabel class file.
+ *
+ * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.ActiveControls
+ */
+
+/**
+ * TActiveLabel class
+ *
+ * The active control counterpart of TLabel component. During a callback
+ * request, setting {@link setText Text} property will also set the text of the
+ * label on the client upon callback completion. Similarly, setting {@link
+ * setForControl ForControl} will set the client-side for attribute on the
+ * label.
+ *
+ * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.ActiveControls
+ * @since 3.0
+ */
+class TActiveLabel extends TLabel
+{
+ /**
+ * Creates a new callback control, sets the adapter to
+ * TActiveControlAdapter. If you override this class, be sure to set the
+ * adapter appropriately by, for example, call this constructor.
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->setAdapter(new TActiveControlAdapter($this));
+ }
+
+ /**
+ * On callback response, the inner HTMl of the label is updated.
+ * @param string the text value of the label
+ */
+ public function setText($value)
+ {
+ parent::setText($value);
+ if($this->getPage()->getAllowCallbackUpdate())
+ {
+ $this->getPage()->getCallbackClient()->update($this, $value);
+ }
+ }
+
+ /**
+ * Sets the ID of the control that the label is associated with.
+ * The control must be locatable via {@link TControl::findControl} using the ID.
+ * On callback response, the For attribute of the label is updated.
+ * @param string the associated control ID
+ */
+ public function setForControl($value)
+ {
+ parent::setForControl($value);
+ if($this->getPage()->getAllowCallbackUpdate())
+ {
+ $id=$this->findControl($value)->getClientID();
+ $this->getPage()->getCallbackClient()->setAttribute($this, 'for', $id);
+ }
+ }
+}
+
+?>
diff --git a/framework/Web/UI/ActiveControls/TActivePageAdapter.php b/framework/Web/UI/ActiveControls/TActivePageAdapter.php
index 4cb785dd..db783a12 100644
--- a/framework/Web/UI/ActiveControls/TActivePageAdapter.php
+++ b/framework/Web/UI/ActiveControls/TActivePageAdapter.php
@@ -285,7 +285,7 @@ class TCallbackErrorHandler extends TErrorHandler
{
$response = $this->getApplication()->getResponse();
$data = TJavascript::jsonEncode($this->getExceptionData($exception));
- $response->appendHeader('HTTP/1.0 505 Internal Error');
+ $response->appendHeader('HTTP/1.0 500 Internal Error');
$response->appendHeader(TActivePageAdapter::CALLBACK_ERROR_HEADER.': '.$data);
}
else
diff --git a/framework/Web/UI/ActiveControls/TCallback.php b/framework/Web/UI/ActiveControls/TCallback.php
index d3b1f54d..9c3234fd 100644
--- a/framework/Web/UI/ActiveControls/TCallback.php
+++ b/framework/Web/UI/ActiveControls/TCallback.php
@@ -4,7 +4,7 @@
* Created on 25/04/2006
*/
-class TCallback extends TWebControl implements ICallbackEventHandler
+class TCallback extends TControl implements ICallbackEventHandler
{
/**
* @var TCallbackClientSideOptions client-side options.
@@ -21,15 +21,7 @@ class TCallback extends TWebControl implements ICallbackEventHandler
parent::__construct();
$this->setAdapter(new TActiveControlAdapter($this));
}
-
- /**
- * @return string tag name of the panel
- */
- protected function getTagName()
- {
- return 'div';
- }
-
+
/**
* @return boolean whether callback event trigger by this button will cause
* input validation, default is true
@@ -153,13 +145,6 @@ class TCallback extends TWebControl implements ICallbackEventHandler
$client = $this->getPage()->getClientScript();
return $client->getCallbackReference($this, $this->getCallbackOptions());
}
-
- public function render($writer)
- {
- parent::render($writer);
- if($this->getPage()->getIsCallback())
- $this->getPage()->getCallbackClient()->replace($this, $writer);
- }
}
?>
diff --git a/framework/Web/UI/ActiveControls/TCallbackClientScript.php b/framework/Web/UI/ActiveControls/TCallbackClientScript.php
index aaf81380..5f8851db 100644
--- a/framework/Web/UI/ActiveControls/TCallbackClientScript.php
+++ b/framework/Web/UI/ActiveControls/TCallbackClientScript.php
@@ -318,20 +318,16 @@ class TCallbackClientScript extends TApplicationComponent
if($content instanceof TControl)
{
$boundary = $this->getRenderedContentBoundary($content);
- $this->callClientFunction('Prado.Element.replaceContent',
- array($element, $method, null, $boundary));
+ $content = null;
}
else if($content instanceof THtmlWriter)
{
$boundary = $this->getResponseContentBoundary($content);
- $this->callClientFunction('Prado.Element.replaceContent',
- array($element, $method, null, $boundary));
- }
- else
- {
- $this->callClientFunction('Prado.Element.replaceContent',
- array($element, $method, $content, $boundary));
+ $content = null;
}
+
+ $this->callClientFunction('Prado.Element.replace',
+ array($element, $method, $content, $boundary));
}
/**
diff --git a/framework/Web/UI/ActiveControls/TCallbackClientSideOptions.php b/framework/Web/UI/ActiveControls/TCallbackClientSideOptions.php
index 1e1bd52f..6a4731f7 100644
--- a/framework/Web/UI/ActiveControls/TCallbackClientSideOptions.php
+++ b/framework/Web/UI/ActiveControls/TCallbackClientSideOptions.php
@@ -216,6 +216,22 @@ class TCallbackClientSideOptions extends TClientSideOptions
{
$this->getOptions()->add('PostState', TPropertyValue::ensureBoolean($value));
}
+
+ /**
+ * @return integer callback request timeout.
+ */
+ public function getRequestTimeOut()
+ {
+ return $this->getOption('TimeOut');
+ }
+
+ /**
+ * @param integer callback request timeout
+ */
+ public function setRequestTimeOut($value)
+ {
+ $this->getOptions()->add('TimeOut', TPropertyValue::ensureInteger($value));
+ }
}
?>