Commit b7a06a40 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review

Adding ability to hide the edit/delete buttons (Bug #1037531)

Currently we are only trying to get the artefact comment list to show
as a 'read only' situation. Any editing/adding/deleting to be done on
the artefact/artefact.php page

Change-Id: I366cc181d9c5c217173842258a02fa814c7279bd
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 535c66d4
......@@ -331,6 +331,7 @@ class ArtefactTypeComment extends ArtefactType {
$options->view = null;
$options->artefact = null;
$options->export = false;
$options->onview = false;
return $options;
}
......@@ -453,7 +454,7 @@ class ArtefactTypeComment extends ArtefactType {
}
}
self::build_html($result);
self::build_html($result, $onview);
return $result;
}
......@@ -504,7 +505,7 @@ class ArtefactTypeComment extends ArtefactType {
);
}
public static function build_html(&$data) {
public static function build_html(&$data, $onview) {
global $USER, $THEME;
$candelete = $data->canedit || $USER->get('admin');
$deletedmessage = array();
......@@ -640,6 +641,7 @@ class ArtefactTypeComment extends ArtefactType {
$smarty->assign('viewid', $data->view);
$smarty->assign('position', $data->position);
$smarty->assign('baseurl', $data->baseurl);
$smarty->assign('onview', $onview);
$data->tablerows = $smarty->fetch('artefact:comment:commentlist.tpl');
$pagination = build_pagination(array(
'id' => 'feedback_pagination',
......
{if $position == 'blockinstance'}
{if $position == 'blockinstance' && !$onview}
<tr>
<td>
{/if}
......@@ -14,17 +14,19 @@
{/if}
</div>
<div class="commentrightwrap">
<div class="fr">
{if $item->makepublicform}<div class="makepublicbtn">{$item->makepublicform|safe}</div>{/if}
{if $item->canedit}
<form name="edit_{$post->id}" action="{$WWWROOT}artefact/comment/edit.php">
<input type="hidden" name="id" value="{$item->id}">
<input type="hidden" name="view" value="{$viewid}">
<input type="image" src="{theme_url filename="images/btn_edit.png"}" title="{str tag=edit}">
</form>
{if !$onview}
<div class="fr">
{if $item->makepublicform}<div class="makepublicbtn">{$item->makepublicform|safe}</div>{/if}
{if $item->canedit}
<form name="edit_{$post->id}" action="{$WWWROOT}artefact/comment/edit.php">
<input type="hidden" name="id" value="{$item->id}">
<input type="hidden" name="view" value="{$viewid}">
<input type="image" src="{theme_url filename="images/btn_edit.png"}" title="{str tag=edit}">
</form>
{/if}
{if $item->deleteform}{$item->deleteform|safe}{/if}
</div>
{/if}
{if $item->deleteform}{$item->deleteform|safe}{/if}
</div>
{if $item->author}
<div class="author"><a href="{$item->author->profileurl}" class="username">{$item->author|display_name}</a><span class="postedon"> - {$item->date} {if $item->updated}[{str tag=Updated}: {$item->updated}]{/if}</span></div>
{else}
......@@ -63,7 +65,7 @@
<div class="cb"></div>
</div>
{/foreach}
{if $position == 'blockinstance'}
{if $position == 'blockinstance' && !$onview}
</td>
</tr>
{/if}
\ No newline at end of file
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