Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
forena
Commits
a15caf28
Commit
a15caf28
authored
Apr 02, 2013
by
metzlerd
Browse files
Added the ability to set css styles within the report.
parent
6df3d912
Changes
2
Hide whitespace changes
Inline
Side-by-side
FrxEditor.inc
View file @
a15caf28
...
...
@@ -398,6 +398,26 @@ class FrxEditor {
}
}
/*
* Set CSS Style Data
* @param $menu_data array of key values for menu options.
*/
public
function
setStyle
(
$css
)
{
$dom
=
$this
->
dom
;
//$this->verifyHeaderElements(array('menu'));
$head
=
$dom
->
getElementsByTagName
(
'head'
)
->
item
(
0
);
$nodes
=
$dom
->
getElementsByTagName
(
'style'
);
$style
=
$dom
->
createElement
(
'style'
);
$style
->
appendChild
(
new
DOMText
(
$css
));
if
(
$nodes
->
length
==
0
)
{
$head
->
appendChild
(
$style
);
}
else
{
$head
->
replaceChild
(
$style
,
$nodes
->
item
(
0
));
}
}
public
function
removeParm
(
$id
)
{
$dom
=
$this
->
dom
;
$xpq
=
$this
->
xpq
;
...
...
forena.admin.inc
View file @
a15caf28
...
...
@@ -383,6 +383,7 @@ function forena_layout_form($form, $form_state, $report_name) {
$category
=
$r
->
getCategory
();
$menu
=
$r
->
getMenu
();
$body
=
$r
->
simplexml
->
body
->
asXML
();
$css
=
@
(
string
)
$r
->
simplexml
->
head
->
style
;
$form
=
array
();
...
...
@@ -414,7 +415,6 @@ function forena_layout_form($form, $form_state, $report_name) {
'#type'
=>
'text_format'
,
'#title'
=>
t
(
'Body'
),
'#default_value'
=>
$body
,
'#rows'
=>
25
,
'#format'
=>
variable_get
(
'forena_input_format'
,
filter_default_format
())
);
...
...
@@ -472,6 +472,21 @@ function forena_layout_form($form, $form_state, $report_name) {
'#options'
=>
$menu_options
,
);
$form
[
'style'
]
=
array
(
'#type'
=>
'fieldset'
,
'#title'
=>
t
(
'CSS Styles'
),
'#collapsible'
=>
TRUE
,
'#collapsed'
=>
TRUE
,
);
$form
[
'style'
][
'css'
]
=
array
(
'#type'
=>
'textarea'
,
'#default_value'
=>
$css
,
'#description'
=>
t
(
'Specify small css snipets that can be used in the reports.'
),
'#rows'
=>
10
,
'#cols'
=>
80
,
);
$form
[
'buttons'
][
'save'
]
=
array
(
'#type'
=>
'submit'
,
'#value'
=>
'Save'
,
...
...
@@ -545,6 +560,8 @@ function forena_layout_form_submit($form, &$form_state) {
// Body
$r
->
setBody
(
$values
[
'body'
][
'value'
]);
// CSS
$r
->
setStyle
(
$values
[
'css'
]);
// If there are no frx attributes in the body then replace them with the old values.
$frx_nodes
=
$r
->
simplexml
->
xpath
(
'body//*[@frx:*]'
);
if
(
!
$frx_nodes
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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