Commit 47a9b799 authored by metzlerd's avatar metzlerd
Browse files

Some fixes for renderer editing.

parent 38d48ab2
......@@ -1197,6 +1197,11 @@ function forena_forena_controls() {
'class' => 'FrxTable',
);
$controls[] = array(
'file' => 'renderers/FrxMergeDocument.inc',
'class' => 'FrxMergeDocument',
);
$controls[] = array(
'file' => 'renderers/FrxSource.inc',
'class' => 'FrxSource',
......
......@@ -624,14 +624,13 @@ function forena_report_data_block_form($formid, &$form_state, $report_name, $act
);
$form['template']['config'] = array_merge($form['template']['config'], $r->templateConfigForm($template_class, $config));
$form['template']['config']['preview'] = array('#type' => 'button', '#value' => t('Preview'));
$form['preview'] = array('#type' => 'button', '#value' => t('Preview'));
// Generate a preview
$parms = $form_state['storage']['parms'];
$r = Frx::Editor('__report_block_preview__');
$r->setEditorParms($parms);
//$r->templateConfigFormValidate($template_class, $form_state['values']['config'], 'config][');
$r->addBlock($block_name, $template_class, $config);
$r->update();
$preview = $r->preview($parms);
......
<?php
class FrxMergeDocument extends FrxRenderer {
public $templateName = 'Generic Merge Document';
/**
* Returns the section
* Enter description here ...
*/
public function configForm($config, $xml='') {
$form_ctl = array();
$form_ctl['content'] = array(
'#type' => 'text_format',
'#title' => t('Document'),
'#rows' => 5,
'#default_value' => @$config['content'],
// '#ajax' => $this->configAjax('blur')
);
return $form_ctl;
}
public function configValidate(&$config) {
$this->validateTextFormats($config, array('content'));
}
public function scrapeConfig() {
$config = array();
$this->extractTemplateHTML($this->reportDocDomNode, $content);
}
public function generate($xml, $config) {
$div = $this->blockDiv($config);
// $config['foreach'] = '*';
$config['class'] = get_class($this);
$this->addFragment($div, $config['content']);
}
}
\ No newline at end of file
......@@ -473,7 +473,7 @@ class FrxRenderer {
$frag = $dom->createDocumentFragment();
$errors = array();
foreach ($elements as $element) if (isset($config[$element])) {
$config[$element] = $config[$element]['value'];
if (isset($config[$element]['value'])) $config[$element] = $config[$element]['value'];
if ($config[$element]) {
@$frag->appendXML($config[$element]);
if (!isset($frag->firstChild)) {
......@@ -520,7 +520,10 @@ class FrxRenderer {
function addFragment(DOMNode $node, $xml_string, $ctl_name = 'Header') {
if ($xml_string) {
if (is_array($xml_string) && isset($xml_string['value'])) {
$xml_string = $xml_string['value'];
}
if ($xml_string && !is_array($xml_string)) {
$frag = $this->dom->createDocumentFragment();
try {
@$frag->appendXML($xml_string);
......
......@@ -13,7 +13,7 @@ class FrxTable extends FrxRenderer {
}
public function generate($xml, $config) {
$config['class'] = get_class($this);
$block = @$config['block'];
$id = @$config['id'];
if ($block) {
......
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