Commit 6d9677a3 authored by David Metzler's avatar David Metzler
Browse files

#2276807 XML document declaration missing in XML Reports

parent 5513d902
......@@ -11,6 +11,17 @@ class FrxDocument {
public $charset = 'UTF-8';
public $allowDirectOutput = FALSE;
public function header($r, $print = TRUE) {
$r->html = '';
if ($this->content_type) {
header('Content-Type: ' . $this->content_type . ' ;charset=' . $this->charset);
header('Cache-Control:');
header('Pragma:');
$file_name = basename($_GET['q']);
header('Content-Disposition: attachment; filename="' . $file_name . '"');
header('Cache-Control: must-revalidate');
}
}
public function loadCSSFiles($format) {
// Add css files
......@@ -64,19 +75,8 @@ class FrxDocument {
}
public function output(&$output) {
if ($this->content_type) {
header('Content-Type: ' . $this->content_type . ' ;charset=' . $this->charset);
header('Cache-Control:');
header('Pragma:');
$file_name = basename($_GET['q']);
header('Content-Disposition: attachment; filename="' . $file_name . '"');
header('Cache-Control: must-revalidate');
print $output;
return TRUE;
}
else {
return FALSE;
}
}
/**
......
......@@ -911,6 +911,7 @@ class FrxEditor {
$cache = array();
$o = Frx::Document($format);
$o->header($this->frxReport, $print);
$this->frxReport->allowDirectWrite = $o->allowDirectOutput;
if ($this->frxReport->allowDirectWrite && $filename) {
$this->frxReport->file = fopen($filename, 'w');
......
......@@ -204,7 +204,6 @@ class FrxReport {
$body = $dom->getElementsByTagName('body')->item(0);
// Render the rport.
$this->html = '';
$c = Frx::Controls('FrxRenderer');
$c->initReportNode($body, $this);
if (!$this->missing_parms) $c->renderChildren($body, $this->html);
......
......@@ -24,9 +24,4 @@ class FrxHtmlDoc extends FrxDocument {
$output .= '<title>' . $r->title . '</title></head><body class="forena-report"><h1>' . $r->title . '</h1>' . $r->html . '</body></html>';
return $output;
}
public function output(&$output) {
print $output;
return TRUE;
}
}
\ No newline at end of file
......@@ -17,6 +17,10 @@ class FrxMPDF extends FrxDocument {
}
public function header($r, $print = TRUE) {
$r->html = '';
}
public function render($r, $format, $options = array()) {
// To Do
......
......@@ -77,14 +77,13 @@ class FrxPrincePDF extends FrxDocument {
}
}
public function output(&$output) {
if ($output) {
public function header($r, $print = FALSE) {
$r->html = '';
if ($print) {
header('Content-Type: ' . $this->content_type);
header('Cache-Control:');
header('Pragma:');
header('Cache-Control: must-revalidate');
print $output;
return TRUE;
}
}
}
......@@ -11,6 +11,16 @@ class FrxSVGDoc extends FrxDocument {
$this->content_type = 'image/svg+xml';
}
public function header($r, $print = TRUE) {
$r->html = '';
if ($print && $$this->content_type) {
header('Content-Type: ' . $this->content_type);
header('Cache-Control:');
header('Pragma:');
header('Cache-Control: must-revalidate');
}
}
public function render($r, $format, $options = array()) {
$output = '';
$doc = new DomDocument();
......@@ -38,11 +48,6 @@ class FrxSVGDoc extends FrxDocument {
*/
public function output(&$output) {
if ($this->content_type) {
header('Content-Type: ' . $this->content_type);
header('Cache-Control:');
header('Pragma:');
header('Cache-Control: must-revalidate');
print $output;
return TRUE;
}
......
......@@ -24,6 +24,16 @@ class FrxXMLDoc extends FrxDocument {
}
}
public function header($r, $print = TRUE) {
if ($print) {
header('Content-Type: ' . $this->content_type);
header('Cache-Control:');
header('Pragma:');
header('Cache-Control: must-revalidate');
}
$r->html = '<?xml version="1.0"?>' . "\n";
}
public function render($r, $format, $options = array()) {
$output = '';
......@@ -39,16 +49,6 @@ class FrxXMLDoc extends FrxDocument {
}
public function output(&$output) {
header('Content-Type: ' . $this->content_type);
header('Cache-Control:');
header('Pragma:');
header('Cache-Control: must-revalidate');
print '<?xml version="1.0"?>' . "\n";
print $output;
return TRUE;
}
private function _build_opening_root_tag_contents() {
$tag_contents = $this->root_tag;
if (isset($this->root_attributes) && is_array($this->root_attributes)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment