Commit 7bb299e5 authored by Son Nguyen's avatar Son Nguyen Committed by Gerrit Code Review
Browse files

Merge "Bug 1623699: Making the matrix page have error template"

parents 0307f8bc 1793e63e
......@@ -27,7 +27,13 @@ $string['invalidjson'] = 'This is not a valid .matrix file: Unable to parse the
$string['jsonmissingvars'] = 'This is not a valid .matrix file: Missing "framework" and / or "framework name".';
$string['manuallyremovematrices'] = 'Unable to remove install directory "%s". Please remove it manually.';
$string['changeframeworkproblems'] = 'You cannot change the framework. The following pages have evidence connected to this framework:';
$string['accessdeniednoframework'] = 'This collection cannot show the SmartEvidence page. This can be due to any of the following reasons: The SmartEvidence plugin is not installed / active; the institution you belong to disallowed SmartEvidence; this collection does not have a SmartEvidence framework set; there aren\'t any pages in this collection.';
$string['accessdeniednoframework'] = 'This collection cannot show the SmartEvidence page. This can be due to any of the following reasons:
<ul><li>The SmartEvidence plugin is not installed / active</li>
<li>The institution you belong to disallowed SmartEvidence</li>
<li>This collection does not have a SmartEvidence framework set</li>
<li>There aren\'t any pages in this collection</li>
</ul>';
$string['firstviewlink'] = 'Please navigate to the <a href="%s">first page</a> of the collection.';
$string['noframeworkselected'] = 'None';
$string['matrixpointupdated'] = "SmartEvidence updated";
$string['matrixpointinserted'] = "SmartEvidence added";
......@@ -45,3 +51,4 @@ $string['usedincollections'] = 'Used in collections';
$string['selfassess'] = 'Self-assess';
$string['uploadframeworkdesc'] = 'Upload a JSON encoded .matrix file. See <a href="https://git.mahara.org/mahara/mahara/blob/master/test/behat/upload_files/example.matrix">Mahara git repository</a> for an example of the markup.';
$string['savematrix'] = 'Upload matrix';
$string['frameworkmissing'] = 'Framework not found';
......@@ -32,8 +32,23 @@ pieform_setup_headdata();
$collectionid = param_integer('id');
$collection = new Collection($collectionid);
if (!$collection->has_framework()) {
// We can't show the matrix page so show them an error with a link
// to the first page of the collection instead.
if ($collection->get('framework') > 0) {
// The collection does have a framework associated but we are not allowed
// to see the matrix page so show an error page with link to first page of collection.
$smarty = smarty();
$smarty->assign('maintitle', $collection->get('name'));
$smarty->assign('owner', $collection->get('owner'));
$smarty->assign('PAGEHEADING', null);
$smarty->assign('name', get_string('frameworkmissing', 'module.framework'));
$smarty->assign('error', get_string('accessdeniednoframework', 'module.framework'));
if ($collection->get('navigation')) {
$views = $collection->get('views');
$smarty->assign('firstviewlink', get_string('firstviewlink', 'module.framework', $views['views'][0]->fullurl));
}
$smarty->display('module:framework:noviewmatrix.tpl');
exit;
}
// No framework involved.
throw new AccessDeniedException(get_string('accessdeniednoframework', 'module.framework'));
}
$owner = $collection->get('owner');
......
{include file="header.tpl"}
<h1 id="viewh1" class="page-header">
<span class="section-heading">{$name}</span>
</h1>
<div class="with-heading text-small">
{include file=author.tpl}
</div>
<div>
{$error|safe}
{if $firstviewlink}
{$firstviewlink|safe}
{/if}
</div>
{include file="footer.tpl"}
\ 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