Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
forena
Commits
3381771a
Commit
3381771a
authored
Apr 12, 2013
by
metzlerd
Browse files
Changed FrxXMLSource to FrxXML.
Improved rendering of XML data.
parent
8762d811
Changes
5
Hide whitespace changes
Inline
Side-by-side
docformats/FrxXMLDoc.inc
0 → 100644
View file @
3381771a
<?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
forena.module
View file @
3381771a
...
...
@@ -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/FrxXML
Source
.inc'
,
'class'
=>
'FrxXML
Source
'
,
'file'
=>
'renderers/FrxXML.inc'
,
'class'
=>
'FrxXML'
,
);
$controls
[]
=
array
(
'file'
=>
'renderers/FrxInclude.inc'
,
'class'
=>
'FrxInclude'
,
...
...
renderers/FrxXML
Source
.inc
→
renderers/FrxXML.inc
View file @
3381771a
<?php
/**
* @file FrxXML
Source
* @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
FrxXML
Source
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
repos/drupal/FrxDrupalNode.inc
View file @
3381771a
<?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
);
...
...
repos/reports/help/design.frx
View file @
3381771a
...
...
@@ -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="FrxXML
Source
".
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=
"FrxXML
Source
"
>
FrxXML
Source
</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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment