Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
project
forena
Commits
40e00453
Commit
40e00453
authored
Apr 21, 2016
by
David Metzler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2706359
: Ajax Command Support - Working Ajax render element.
parent
f32d6fd5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
3 deletions
+46
-3
AjaxCommand/Invoke.php
AjaxCommand/Invoke.php
+4
-0
FrxReport.inc
FrxReport.inc
+3
-3
forena.module
forena.module
+5
-0
renderers/FrxAjax.inc
renderers/FrxAjax.inc
+33
-0
renderers/FrxRenderer.inc
renderers/FrxRenderer.inc
+1
-0
No files found.
AjaxCommand/Invoke.php
View file @
40e00453
...
...
@@ -21,15 +21,19 @@ class Invoke implements AjaxCommandInterface{
* {@inheritdoc}
*/
public
function
commandFromSettings
(
array
$settings
)
{
dpm
(
$settings
);
$selector
=
$settings
[
'selector'
];
$method
=
$settings
[
'method'
];
$arguments
=
[];
if
(
isset
(
$settings
[
'arguments'
]))
{
$arguments
=
$settings
[
'arguments'
];
if
(
!
is_array
(
$arguments
))
$arguments
=
json_decode
(
$arguments
);
}
elseif
(
isset
(
$settings
[
'text'
]))
{
$arguments
=
json_decode
(
$settings
[
'text'
]);
}
if
(
!
$arguments
)
$arguments
=
array
();
dpm
(
$arguments
,
'args'
);
$command
=
ajax_command_invoke
(
$selector
,
$method
,
$arguments
);
return
$command
;
}
...
...
FrxReport.inc
View file @
40e00453
...
...
@@ -257,6 +257,8 @@ class FrxReport {
* @return unknown_type
*/
public
function
render
(
$format
,
$render_form
=
TRUE
,
$cache_data
=
array
())
{
$events
=
$this
->
commands
;
$this
->
commands
=
array
();
if
(
!
$format
)
$format
=
'web'
;
// Only push the parameter conte
Frx
::
Data
()
->
push
(
$this
->
parms
,
'parm'
);
...
...
@@ -294,9 +296,7 @@ class FrxReport {
}
// Process the commands after the replacement
if
(
$this
->
commands
)
{
$events
=
$this
->
commands
;
$this
->
commands
=
array
();
if
(
$events
)
{
foreach
(
$events
as
$event
=>
$commands
)
{
foreach
(
$commands
as
$command
)
{
$this
->
addAjaxCommand
(
$command
,
$event
);
...
...
forena.module
View file @
40e00453
...
...
@@ -1341,6 +1341,11 @@ function forena_forena_controls() {
'class'
=>
'FrxDrupalControls'
,
);
$controls
[]
=
array
(
'file'
=>
'renderers/FrxAjax.inc'
,
'class'
=>
'FrxAjax'
,
);
$controls
[]
=
array
(
'file'
=>
'renderers/FrxSection.inc'
,
'class'
=>
'FrxSection'
,
...
...
renderers/FrxAjax.inc
0 → 100644
View file @
40e00453
<?php
/**
* Created by PhpStorm.
* User: metzlerd
* Date: 4/21/16
* Time: 8:32 PM
*/
/**
* Crosstab Renderer
*
* @FrxRenderer(id = "FrxAjax")
*
*/
class
FrxAjax
extends
FrxRenderer
{
public
function
render
()
{
$text
=
forena_inner_xml
(
$this
->
reportDocNode
,
$this
->
reportDocNode
->
getName
());
$command
=
$this
->
replacedAttributes
();
$command
[
'text'
]
=
$text
;
unset
(
$command
[
'renderer'
]);
$event
=
$this
->
extract
(
'event'
,
$command
);
if
(
strpos
(
$event
,
'pre'
)
===
0
)
{
$event
=
'pre'
;
}
else
{
$event
=
'post'
;
}
$this
->
frxReport
->
addAjaxCommand
(
$command
,
$event
);
return
''
;
}
}
\ No newline at end of file
renderers/FrxRenderer.inc
View file @
40e00453
...
...
@@ -17,6 +17,7 @@ class FrxRenderer {
public
$name
;
public
$id
;
public
$format
;
/** @var FrxReport */
public
$frxReport
;
// The report object being used.
public
$columns
;
public
$numeric_columns
;
...
...
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