Commit 3381771a authored by metzlerd's avatar metzlerd
Browse files

Changed FrxXMLSource to FrxXML.

Improved rendering of XML data. 
parent 8762d811
<?php
/**
* @file FrxHtmlDoc
* Straight XML document with no wrapping theme.
* @author davidmetzler
*
*/
class FrxXMLDoc extends FrxDocument {
public function __construct() {
$this->content_type = 'application/xml';
dpm($this->content_type);
}
public function render($r, $format, $options = array()) {
$body = $this->check_markup($r->html);
$output = '<?xml version="1.0"?>' . "\n";
$output .= '<div>' . $body . "</div>\n";
return $output;
}
public function output($output) {
header('Content-Type: ' . $this->content_type);
header('Cache-Control:');
header('Pragma:');
header('Cache-Control: must-revalidate');
print $output;
return TRUE;
}
}
\ No newline at end of file
......@@ -941,6 +941,7 @@ function forena_forena_document_types() {
require_once 'docformats/FrxSVGDoc.inc';
require_once 'docformats/FrxWordDoc.inc';
require_once 'docformats/FrxXLSDoc.inc';
require_once 'docformats/FrxXMLDoc.inc';
require_once 'docformats/FrxEmailMergeDoc.inc';
$items['web'] = array(
'class' => 'FrxWebDoc',
......@@ -976,6 +977,11 @@ function forena_forena_document_types() {
'class' => 'FrxXLSDoc',
'title' => t('Excel Document'),
);
$items['xml'] = array(
'class' => 'FrxXMLDoc',
'title' => t('XML Document'),
);
return $items;
}
......@@ -998,11 +1004,11 @@ function forena_forena_controls() {
'file' => 'renderers/FrxSource.inc',
'class' => 'FrxSource',
);
$controls[] = array(
'file' => 'renderers/FrxXMLSource.inc',
'class' => 'FrxXMLSource',
'file' => 'renderers/FrxXML.inc',
'class' => 'FrxXML',
);
$controls[] = array(
'file' => 'renderers/FrxInclude.inc',
'class' => 'FrxInclude',
......
<?php
/**
* @file FrxXMLSource
* @file FrxXML
* Just render the XML source data.
* Look at the FrxRender class to see a full list of
* properties that can be used here.
*/
class FrxXMLSource extends FrxRenderer {
class FrxXML extends FrxRenderer {
public function render() {
$output = '';
$node = $this->reportDocNode;
$xml = FrxData::instance()->currentContext();
if ($xml && is_callable(array($xml, 'asXML'))) $output = htmlspecialchars($xml->asXML());
if ($xml && is_callable(array($xml, 'asXML'))) {
$dom = dom_import_simplexml($xml);
$dom->ownerDocument->formatOutput = TRUE;
$dom->ownerDocument->preserveWhiteSpace = TRUE;
$output = $dom->ownerDocument->saveXML($dom->ownerDocument->documentElement);
}
if ($this->format != 'xml') $output = '<pre>' . htmlspecialchars($output) . '</pre>';
return $output;
}
}
\ No newline at end of file
<?php
/**
* Implementation of a drupal node load function
* @author baileys
*/
class FrxDrupalNode {
public $access = 'access content';
public $tokens = array('nid', 'vid');
public function load($parms = array()) {
$nid = isset($parms['nid']) ? $parms['nid'] : 1;
$vid = isset($parms['vid']) ? $parms['vid'] : NULL;
$node = node_load($nid, $vid);
$return = new SimpleXMLElement('<node/>');
$lang = isset($node->language) ? $node->language : 'unk';
if ($node) foreach ($node as $key => $val) {
if (strpos($key, 'field_') === 0) {
$fields = field_get_items('node', $node, $key);
......
......@@ -109,7 +109,7 @@
object. How the tag is rendered is defined by implementation of the
renderer. See the <a href="#renderers">Provided Renderers</a> section
for additional information. Typcial syntax looks something like
frx:renderer="FrxXMLSource".
frx:renderer="FrxXML".
</p>
<p>Other attributes are interpreted directly from the custom
renderers section below.</p>
......@@ -194,7 +194,7 @@
the page title and the tab title to be replaced by token replaced values
in the report.
</p>
<h3 id="FrxXMLSource">FrxXMLSource</h3>
<h3 id="FrxXML">FrxXML</h3>
<p>
Displays the XML of the current data context and is particularly useful
for debugging purposes. If you embed this in a report, it will show you
......
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