mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-20 03:39:56 +09:00
#18951708 : refactor display handler, move default JS/CSS file to HTMLDisplayHandler from Context::init
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7520 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
1f41848b5e
commit
7a61317b2c
6 changed files with 316 additions and 273 deletions
49
classes/display/VirtualXMLDisplayHandler.php
Normal file
49
classes/display/VirtualXMLDisplayHandler.php
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
class VirtualXMLDisplayHandler {
|
||||
/**
|
||||
* @brief Produce virtualXML compliant content given a module object.\n
|
||||
* @param[in] $oModule the module object
|
||||
**/
|
||||
|
||||
function toDoc(&$oModule)
|
||||
{
|
||||
$error = $oModule->getError();
|
||||
$message = $oModule->getMessage();
|
||||
$redirect_url = $oModule->get('redirect_url');
|
||||
$request_uri = Context::get('xeRequestURI');
|
||||
$request_url = Context::get('xeVirtualRequestUrl');
|
||||
if(substr($request_url,-1)!='/') $request_url .= '/';
|
||||
|
||||
if($error === 0) {
|
||||
if($message != 'success') $output->message = $message;
|
||||
if($redirect_url) $output->url = $redirect_url;
|
||||
else $output->url = $request_uri;
|
||||
} else {
|
||||
if($message != 'fail') $output->message = $message;
|
||||
}
|
||||
|
||||
$html = '<script type="text/javascript">'."\n";
|
||||
if($output->message) $html .= 'alert("'.$output->message.'");'."\n";
|
||||
if($output->url) {
|
||||
$url = preg_replace('/#(.+)$/i','',$output->url);
|
||||
$html .= 'self.location.href = "'.$request_url.'common/tpl/redirect.html?redirect_url='.urlencode($url).'";'."\n";
|
||||
}
|
||||
$html .= '</script>'."\n";
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief print a HTTP HEADER for HTML, which is encoded in UTF-8
|
||||
**/
|
||||
function printHeader() {
|
||||
header("Content-Type: text/html; charset=UTF-8");
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue