Commit 1a3f016a authored by metzlerd's avatar metzlerd
Browse files

Working templater, working on a block preview page.

parent 10cfd983
......@@ -15,6 +15,7 @@ class FrxEditor {
public $report_name;
public $frx_attributes;
public $cache;
public $frxReport;
public $doc_prefix = '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY nbsp "&#160;">
......@@ -702,4 +703,13 @@ class FrxEditor {
return $this;
}
public function preview() {
$r = $this->frxReport;
//check for default parameters
$r->processParameters();
Frx::Skin()->load($r->skin);
Frx::Skin()->loadSkinFiles('');
return $r->render('web');
}
}
\ No newline at end of file
......@@ -1712,6 +1712,20 @@ function forena_add_cancel($form, &$form_state) {
$form_state['redirect'] = $form_state['values']['return'];
}
function forena_data_preview() {
$args = func_get_args();
$block_name = implode('/', $args);
$block_name = str_replace('.', '/', $block_name);
$r = Frx::Editor('__block_preview__');
$r->cancel();
$r->addBlock($block_name);
$output = 'hello';
$output .= $r->preview();
return $output;
}
/**
* submit handler for forena_data_block_form.
* This adds the datablock to an existing report.
......
......@@ -385,6 +385,7 @@ function _forena_render_form_template($fields, $template) {
return $build;
}
function _forena_set_inline_theme(&$elements) {
foreach ($elements as $key => $value) if (strpos($key, '#')===FALSE) {
$type = @$value['#type'];
......@@ -515,3 +516,4 @@ function theme_forena_data_table($variables) {
......@@ -264,6 +264,13 @@ function forena_menu() {
'type' => MENU_CALLBACK,
);
$items['forena/preview'] = array(
'page callback' => 'forena_data_preview',
'access arguments' => array('create any report'),
'file' => 'forena.admin.inc',
'type' => MENU_CALLBACK,
);
$items['forena/fields/format/autocomplete'] = array(
'page callback' => 'forena_fields_format_autocomplete',
'access callback' => TRUE,
......
......@@ -9,7 +9,8 @@ class FrxFieldTable extends FrxRenderer {
$config['class'] = 'FrxFieldTable';
$div = $this->blockDiv($config);
$columns = $this->columns($xml);
$table = $this->addNode($div, 4, 'table');
$table = $this->setFirstNode($div, 4, 'table');
$this->removeChildren($table);
$r=0;
if ($columns) foreach ($columns as $col => $label) {
$r++;
......
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