Commit d6afb35e authored by Aaron Wells's avatar Aaron Wells Committed by Robert Lyon
Browse files

Bug 1599373: Don't print the "share page" or "display page" links for site pages

Since we now have multiple places that check whether the view is a site template
page, I've consolidated the logic for it into View::is_site_template()

Change-Id: Ibf23fe14d7f5bba8e1dc5a1281a2534d32b9887a
behatnotneeded: Test to be provided later
parent 4aab2c06
......@@ -6367,6 +6367,17 @@ class View {
ArtefactType::update_locked($userid);
db_commit();
}
/**
* Indicates whether this view is a site template. (A site template is a special
* template page which is copied as the starting point whenever a new page is
* created.)
*
* @return boolean
*/
public function is_site_template() {
return ($this->get('template') == View::SITE_TEMPLATE);
}
}
class ViewSubmissionException extends UserException {
......
......@@ -44,7 +44,7 @@
<div id="view-wizard-controls" class="col-collapse-offset col-with-collapse">
{if !$template}
{if !$issitetemplate}
<a class="btn btn-default" href="{$displaylink}">
{str tag=displayview section=view}
<span class="icon icon-arrow-circle-right right" role="presentation" aria-hidden="true"></span>
......
......@@ -25,14 +25,14 @@
<a href="{$displaylink}">
{str tag=displayview section=view}
</a>
{if $edittitle || $viewtype == 'profile'}
<a href="{$WWWROOT}view/access.php?id={$viewid}{if $collectionid}&collection={$collectionid}{/if}{if $new}&new=1{/if}">
<span class="icon icon-unlock-alt" role="presentation" aria-hidden="true"></span>
{str tag=shareview section=view}
</a>
{/if}
{else}
&nbsp;
{/if}
{if $edittitle || $viewtype == 'profile'}
<a href="{$WWWROOT}view/access.php?id={$viewid}{if $collectionid}&collection={$collectionid}{/if}{if $new}&new=1{/if}">
<span class="icon icon-unlock-alt" role="presentation" aria-hidden="true"></span>
{str tag=shareview section=view}
</a>
{/if}
</div>
......@@ -292,6 +292,6 @@ else {
}
$smarty->assign('issiteview', isset($institution) && ($institution == 'mahara'));
$smarty->assign('issitetemplate', ($view->get('template') == View::SITE_TEMPLATE ? true : false));
$smarty->assign('issitetemplate', $view->is_site_template());
$smarty->assign('PAGEHEADING', $state);
$smarty->display('view/blocks.tpl');
......@@ -253,5 +253,6 @@ $smarty->assign('edittitle', $view->can_edit_title());
$smarty->assign('displaylink', $displaylink);
$smarty->assign('new', $new);
$smarty->assign('issiteview', isset($institution) && ($institution == 'mahara'));
$smarty->assign('issitetemplate', $view->is_site_template());
$smarty->assign('PAGEHEADING', $state);
$smarty->display('view/edit.tpl');
......@@ -189,7 +189,7 @@ $smarty->assign('edittitle', $view->can_edit_title());
$smarty->assign('displaylink', $view->get_url());
$smarty->assign('new', $new);
$smarty->assign('issiteview', $view->get('institution') == 'mahara');
$smarty->assign('issitetemplate', ($view->get('template') == View::SITE_TEMPLATE ? true : false));
$smarty->assign('issitetemplate', $view->is_site_template());
$smarty->assign('PAGEHEADING', $state);
$smarty->display('view/layout.tpl');
......
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