class UploadResponse {
var $jsClassName;
var $callBackParams;
var $content;
function UploadResponse() {
$this->jsClassName = null;
$this->callBackParams = array();
$this->content = null;
}
function setJsClassName($jsClassName) {
$this->jsClassName = $jsClassName;
}
function getJsClassName() {
return $this->jsClassName;
}
function setCallBackParams($callBackParams) {
$this->callBackParams = $callBackParams;
}
function getCallBackParams() {
return $this->callBackParams;
}
function addCallBackParam($param, $isString = false) {
if ($isString) {
$param = "'" . $param . "'";
}
$this->callBackParams[] = $param;
}
function setContent($content) {
$this->content = $content;
}
function getContent() {
return $this->content;
}
function doResponse() {
header('Content-Type: text/html; charset=UTF-8');
$params = '';
if ($this->callBackParams) {
$params = ', ' . implode(', ', $this->callBackParams);
}
echo '<html>
<head><title></title></head>
<body>
<pre id="__content_container">' . $this->content . '</pre>
<script language="javascript">
var parentFrame = parent.window;
if (parentFrame) {
var content = document.getElementById("__content_container");
parentFrame.' . $this->jsClassName . '.uploadCallBack(content.innerHTML' . $params . ');
}
</script>
</body>
</html>';
}
}
?>
0 comments:
Post a Comment