Commit 7a164a56 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Add notice & disable new secret urls when publicviews is off (bug #794385)



When the site or institution has disabled public views, there's a
notice on the view access page to that effect, but the user can
happily create new secret urls with no indication that they won't
work.  This patch removes the generate new secret url button, and adds
a notice to the secret url page to inform the user when they're not
allowed to create public pages.  Also adds a sentence to the site
setting to make it clearer that disabling public pages also disables
secret urls.

Change-Id: I93a36df425bf06c4748cfdbfaf62613017518872
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent b1db565a
<h3>Allow public pages</h3>
<p>If you wish to allow users to create pages that may be made accessible to the public, this option should be set to 'yes'. Public pages are still only editable by their owner.</p>
<p>If you disable this option, secret URL access will also be disabled.</p>
......@@ -107,6 +107,8 @@ $string['secreturlupdated'] = 'Secret URL updated';
$string['generatesecreturl'] = 'Generate a new secret URL for %s';
$string['secreturls'] = 'Secret URLs';
$string['publicaccessnotallowed'] = "Your institution or site administrator has disabled public pages and secret URLs. Any secret URLs you see listed here are currently inactive.";
// view user
$string['inviteusertojoingroup'] = 'Invite this user to join a group';
$string['addusertogroup'] = 'Add this user to a group';
......
{include file="header.tpl"}
{if !$allownew}
<div class="message info">{str tag=publicaccessnotallowed section=view}</div>
{/if}
{if $editurls}
<table class="secreturls">
<tbody>
......
......@@ -248,7 +248,8 @@ function newurl_submit(Pieform $form, $values) {
redirect('/view/urls.php?id=' . $viewid);
}
$newform = pieform($newform);
$allownew = !$view->get('owner') || (get_config('allowpublicviews') && $USER->institution_allows_public_views());
$newform = $allownew ? pieform($newform) : null;
$js = <<<EOF
\$j(function() {
......@@ -268,5 +269,6 @@ $smarty = smarty(
$smarty->assign('PAGEHEADING', TITLE);
$smarty->assign('INLINEJAVASCRIPT', $js);
$smarty->assign('editurls', $editurls);
$smarty->assign('allownew', $allownew);
$smarty->assign('newform', $newform);
$smarty->display('view/urls.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