Commit f7ec6571 authored by Dianne Tennent's avatar Dianne Tennent Committed by Doris Tam
Browse files

Bug 1957721: redirect after managing access permissions

Redirect to where you started from after saving new
access permissions, with confirmation message.

Change-Id: Ie7537e323b55f0ccac6db9e52d510320bafa5188
(cherry picked from commit 10d02038)
parent d8f349a2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -265,6 +265,7 @@ $string['blocknotinview'] = 'The block with ID "%d" is not in the page.';

$string['viewcreatedsuccessfully'] = 'Page created successfully';
$string['viewaccesseditedsuccessfully'] = 'Page access saved successfully';
$string['accesssavedsuccessfully'] = 'Access settings saved successfully';
$string['viewsavedsuccessfully'] = 'Page saved successfully';
$string['savedtotimeline'] = 'Saved to timeline';
$string['updatedaccessfornumviews1'] = array(
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@
        </a>
    {/if}
    {if !$accesssuspended && ($edittitle || $viewtype == 'share') && !$issitetemplate}
        <a class="btn btn-secondary editviews editshare {if $selected == 'share'}active{/if}" href="{$WWWROOT}view/accessurl.php?id={$viewid}{if $collectionid}&collection={$collectionid}{/if}"  title="{str tag=shareview1 section=view}">
        <a class="btn btn-secondary editviews editshare {if $selected == 'share'}active{/if}" href="{$WWWROOT}view/accessurl.php?return=edit&id={$viewid}{if $collectionid}&collection={$collectionid}{/if}"  title="{str tag=shareview1 section=view}">
            <span class="icon icon-unlock icon-lg" aria-hidden="true" role="presentation"></span>
            <span class="btn-title sr-only">{str tag=shareview1 section=view}</span>
        </a>
+1 −1
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@
                                        {foreach from=$view.manageaccess item=manageitem}
                                        <li class="dropdown-item">
                                            {if $manageitem->accesstype == 'managesharing'}
                                            <a class="seperator" href="{$WWWROOT}view/accessurl.php?id={$view.id}{if $view.collid}&collection={$view.collid}{/if}">
                                            <a class="seperator" href="{$WWWROOT}view/accessurl.php?return=index&id={$view.id}{if $view.collid}&collection={$view.collid}{/if}">
                                                <span class="icon {if $view.locked}icon-lock{else}icon-unlock{/if} left" role="presentation" aria-hidden="true"></span>
                                                <span class="link-text">{$manageitem->displayname}</span>
                                                <span class="sr-only">{$manageitem->accessibilityname}</span>
+16 −5
Original line number Diff line number Diff line
@@ -508,19 +508,30 @@ function accessurl_submit(Pieform $form, $values) {
        }
    }
    set_progress_done('copyviewexistingmembersprogress');

    if ($collectionid && $shareurl) {
        redirect($shareurl);
    }
    if ($view->get('owner')) {
    $return = param_alpha('return', 'view');
    if ($view->get('owner') && $return == 'edit') {
        $SESSION->add_ok_msg(get_string('accesssavedsuccessfully', 'view'));
        redirect(get_config('wwwroot') . 'view/blocks.php?id=' . $view->get('id'));
    }
    if ($view->get('owner') && $return == 'view') {
        $SESSION->add_ok_msg(get_string('accesssavedsuccessfully', 'view'));
        redirect(get_config('wwwroot') . 'view/view.php?id=' . $view->get('id'));
    }
    if ($view->get('owner') && $return == 'index') {
        $SESSION->add_ok_msg(get_string('accesssavedsuccessfully', 'view'));
        redirect(get_config('wwwroot') . 'view/index.php');
    }
    if ($view->get('group')) {
        $SESSION->add_ok_msg(get_string('accesssavedsuccessfully', 'view'));
        redirect(get_config('wwwroot') . 'group/shareviews.php?group=' . $view->get('group'));
    }
    if ($view->get('institution')) {
        $SESSION->add_ok_msg(get_string('accesssavedsuccessfully', 'view'));
        redirect(get_config('wwwroot') . 'view/institutionshare.php?institution=' . $view->get('institution'));
    }
    if ($collectionid && $shareurl) {
        redirect($shareurl);
    }
}

$form = pieform($form);
+1 −1
Original line number Diff line number Diff line
@@ -670,7 +670,7 @@ if ($view->is_anonymous()) {
$titletext = ($collection && $shownav) ? hsc($collection->get('name')) : $view->display_title(true, false, false);
$smarty->assign('lastupdatedstr', $view->lastchanged_message());
$smarty->assign('visitstring', $view->visit_message());
$smarty->assign('accessurl', get_config('wwwroot') . 'view/accessurl.php?id=' . $viewid . (!empty($collection) ? '&collection=' . $collection->get('id') : '' ));
$smarty->assign('accessurl', get_config('wwwroot') . 'view/accessurl.php?return=view&id=' . $viewid . (!empty($collection) ? '&collection=' . $collection->get('id') : '' ));
if ($can_edit) {
    $smarty->assign('editurl', get_config('wwwroot') . 'view/blocks.php?id=' . $viewid);
    $smarty->assign('usercaneditview', TRUE);