Commit ca3c2d92 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

Merge "Adding comment display to HTML artefact (Bug #1037531)"

parents d4e76db3 66a0a7ca
...@@ -30,17 +30,29 @@ class PluginBlocktypeHtml extends PluginBlocktype { ...@@ -30,17 +30,29 @@ class PluginBlocktypeHtml extends PluginBlocktype {
$configdata['viewid'] = $instance->get('view'); $configdata['viewid'] = $instance->get('view');
$result = ''; $result = '';
if (isset($configdata['artefactid'])) { $artefactid = isset($configdata['artefactid']) ? $configdata['artefactid'] : null;
$html = $instance->get_artefact_instance($configdata['artefactid']); if ($artefactid) {
$artefact = $instance->get_artefact_instance($artefactid);
if (!file_exists($html->get_path())) { if (!file_exists($artefact->get_path())) {
return; return;
} }
$result = clean_html(file_get_contents($html->get_path())); $result = clean_html(file_get_contents($artefact->get_path()));
}
require_once(get_config('docroot') . 'artefact/comment/lib.php');
require_once(get_config('docroot') . 'lib/view.php');
$view = new View($configdata['viewid']);
list($commentcount, $comments) = ArtefactTypeComment::get_artefact_comments_for_view($artefact, $view, $instance->get('id'));
}
return $result; $smarty = smarty_core();
if ($artefactid) {
$smarty->assign('commentcount', $commentcount);
$smarty->assign('comments', $comments);
}
$smarty->assign('html', $result);
return $smarty->fetch('blocktype:html:html.tpl');
} }
public static function has_instance_config() { public static function has_instance_config() {
......
{$html|safe}
{if $commentcount || $commentcount === 0}
{$comments|safe}
{/if}
Supports Markdown
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