Commit 235596e8 authored by Martyn Smith's avatar Martyn Smith Committed by Martyn Smith
Browse files

Fix bugs and code formatting in the template render (and the view renderer)

parent 8f853116
......@@ -327,7 +327,9 @@ function template_render($template, $mode, $data=array()) {
$block .= template_render_label_editmode($t, $data);
}
else {
$block .= $data[$t['id']]['value'];
if (isset($data[$t['id']])) {
$block .= $data[$t['id']]['value'];
}
}
break;
case 'title';
......@@ -336,7 +338,12 @@ function template_render($template, $mode, $data=array()) {
}
break;
case 'author';
$block .= template_render_author($data['ownerformat']);
if (isset($data['ownerformat'])) {
$block .= template_render_author($data['ownerformat']);
}
else {
$block .= $data['author'];
}
break;
case 'description';
if (isset($data['description'])) {
......@@ -376,11 +383,8 @@ function template_render($template, $mode, $data=array()) {
}
if ($artefact === null) {
if ($mode == TEMPLATE_RENDER_EDITMODE) {
$block .= template_render_empty_artefact_block();
}
else {
$block .= '';
if ($mode == TEMPLATE_RENDER_EDITMODE) {
$block .= template_render_empty_artefact_block();
}
}
else {
......@@ -388,21 +392,15 @@ function template_render($template, $mode, $data=array()) {
}
}
else {
if ($mode == TEMPLATE_RENDER_EDITMODE) {
if ($mode == TEMPLATE_RENDER_EDITMODE) {
$block .= template_render_empty_artefact_block();
}
else {
$block .= '';
}
}
break;
}
if (empty($block) && $mode == TEMPLATE_RENDER_READONLY) {
$html .= '';
}
else{
if ($mode != TEMPLATE_RENDER_READONLY || !empty($block)) {
// span or div?
if (isset($t['tagtype']) && $t['tagtype'] == 'span') {
$html .= '<span';
......
......@@ -280,7 +280,7 @@ class View {
);
}
foreach ($contents as $content) {
$data[$content->id] = array(
$data[$content->block] = array(
'value' => $content->content,
);
}
......
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