NOISSUE, trivial code change

This commit is contained in:
ngleader 2013-11-30 07:06:08 +09:00
parent ffcf599e68
commit 4c1ba64d25
4 changed files with 59 additions and 53 deletions

View file

@ -15,8 +15,11 @@ class JSCallbackDisplayHandler
$variables['error'] = $oModule->getError();
$variables['message'] = $oModule->getMessage();
$json = str_replace(array("\r\n", "\n", "\t"), array('\n', '\n', '\t'), json_encode2($variables));
$output = sprintf('<script>%s(%s);</script>', Context::getJSCallbackFunc(), $json);
return $output;
return sprintf('<script type="text/javascript">
//<![CDATA[
%s(%s);
//]]>
</script>', Context::getJSCallbackFunc(), $json);
}
}

View file

@ -44,19 +44,23 @@ class VirtualXMLDisplayHandler
}
}
$html = '<script>' . "\n";
$html = array();
$html[] = '<script type="text/javascript">';
$html[] = '//<![CDATA[';
if($output->message)
{
$html .= 'alert("' . $output->message . '");' . "\n";
$html[] = 'alert("' . $output->message . '");';
}
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[] = 'self.location.href = "' . $request_url . 'common/tpl/redirect.html?redirect_url=' . urlencode($url) . '";';
}
$html .= '</script>' . "\n";
return $html;
$html[] = '//]]>';
$html[] = '</script>';
return join(PHP_EOL, $html);
}
}