diff options
author | wei <> | 2006-06-15 00:56:57 +0000 |
---|---|---|
committer | wei <> | 2006-06-15 00:56:57 +0000 |
commit | 67e09d150afe55d7a956beb299dc0534f7da68eb (patch) | |
tree | 793669c130d7cb17b56b75fb42fe1fac07c5fccc /framework/Web/UI/ActiveControls/TCallbackResponseAdapter.php | |
parent | 469fe68e8a08330cb0ed8b56f758bee8d7c9445e (diff) |
Update active controls. Add comments. Add THttpResponseAdapter
Diffstat (limited to 'framework/Web/UI/ActiveControls/TCallbackResponseAdapter.php')
-rwxr-xr-x | framework/Web/UI/ActiveControls/TCallbackResponseAdapter.php | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/framework/Web/UI/ActiveControls/TCallbackResponseAdapter.php b/framework/Web/UI/ActiveControls/TCallbackResponseAdapter.php new file mode 100755 index 00000000..d1ec67ad --- /dev/null +++ b/framework/Web/UI/ActiveControls/TCallbackResponseAdapter.php @@ -0,0 +1,65 @@ +<?php + +/** + * + */ +class TCallbackResponseAdapter extends THttpResponseAdapter +{ + private $_writers=array(); + + private $_data; + + public function createNewHtmlWriter($type,$response) + { + $writer = new TCallbackResponseWriter(); + $this->_writers[] = $writer; + return parent::createNewHtmlWriter($type,$writer); + } + + public function flushContent() + { + foreach($this->_writers as $writer) + echo $writer->flush(); + parent::flushContent(); + } + + public function setResponseData($data) + { + $this->_data = $data; + } + + public function getResponseData() + { + return $this->_data; + } +} + +class TCallbackResponseWriter extends TTextWriter +{ + private $_boundary; + + public function __construct() + { + $this->_boundary = sprintf('%x',crc32((string)$this)); + } + + public function getBoundary() + { + return $this->_boundary; + } + + public function setBoundary($value) + { + $this->_boundary = $value; + } + + public function flush() + { + $content = '<!--'.$this->getBoundary().'-->'; + $content .= parent::flush(); + $content .= '<!--//'.$this->getBoundary().'-->'; + return $content; + } +} + +?>
\ No newline at end of file |