Commit 84119067 authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic
Browse files

Bug 1668888: Use more core functionality to unify screens

Bring title, layout and skins into the same
"Settings" screen and display them in panels.

Still to do:
- Fix existing Behat tests where needed
- Remove code that is not needed anymore

behatnotneeded

Change-Id: I0da607187f1e2b7b03fc1ebbbbe205ca1d3e87c2
parent 49b6c74e
......@@ -2,8 +2,8 @@
(function( CustomLayoutManager, $, undefined ) {
// Public Methods
CustomLayoutManager.customlayout_add_row = function() {
var numrows = parseInt($('#viewlayout_customlayoutnumrows').val(), 10);
CustomLayoutManager.customlayout_add_row = function(pieformname) {
var numrows = parseInt($('#' + pieformname + '_customlayoutnumrows').val(), 10);
if ((numrows < get_max_custom_rows()) && (numrows >= 1)) {
var newid;
var newrow = $('#customrow_' + numrows).clone();
......@@ -28,23 +28,23 @@
}
else {
// wanring: classes are modified above for any subsequent button instances
newrow.append('<button name="removerow" class="pull-left btn btn-sm btn-default removecustomrow_' + (numrows + 1) + '" onclick="CustomLayoutManager.customlayout_remove_row(this)"><span class="icon icon-lg icon-trash text-danger"></span><span class="hidden-xs pls"> ' + get_string('removethisrow', 'view') + '</span></button>');
newrow.append('<button name="removerow" class="pull-left btn btn-sm btn-default removecustomrow_' + (numrows + 1) + '" onclick="CustomLayoutManager.customlayout_remove_row(\'' + pieformname + '\', this)"><span class="icon icon-lg icon-trash text-danger"></span><span class="hidden-xs pls"> ' + get_string('removethisrow', 'view') + '</span></button>');
}
$('#customrow_' + numrows).after(newrow);
$('#viewlayout_customlayoutnumrows').val(numrows + 1);
customlayout_change_layout();
$('#' + pieformname + '_customlayoutnumrows').val(numrows + 1);
customlayout_change_layout(pieformname);
newrow.find('select').first().focus();
}
if (parseInt($('#viewlayout_customlayoutnumrows').val(), 10) >= get_max_custom_rows()) {
if (parseInt($('#' + pieformname + '_customlayoutnumrows').val(), 10) >= get_max_custom_rows()) {
$('#addrow').attr('disabled', 'disabled');
}
};
CustomLayoutManager.customlayout_remove_row = function(row) {
var numrows = parseInt($('#viewlayout_customlayoutnumrows').val(), 10);
CustomLayoutManager.customlayout_remove_row = function(pieformname, row) {
var numrows = parseInt($('#' + pieformname + '_customlayoutnumrows').val(), 10);
$(row).closest('.customrow').remove();
$('#viewlayout_customlayoutnumrows').val(numrows - 1);
$('#' + pieformname + '_customlayoutnumrows').val(numrows - 1);
var inc = 1;
$('#customrows .customrow').each(function() {
$(this).find('.customrowtitle').html('<strong>' + get_string('rownr', 'view', inc) + '</strong>');
......@@ -53,14 +53,14 @@
$(this).find('input').attr('class', 'removecustomrow_' + inc);
$(this).find('.selectcollayout').attr('id', 'selectcollayoutrow_' + inc++);
});
customlayout_change_layout();
customlayout_change_layout(pieformname);
if (parseInt($('#viewlayout_customlayoutnumrows').val(), 10) < get_max_custom_rows()) {
if (parseInt($('#' + pieformname + '_customlayoutnumrows').val(), 10) < get_max_custom_rows()) {
$('#addrow').removeAttr('disabled');
}
};
CustomLayoutManager.customlayout_change_numcolumns = function(columnoptions) {
CustomLayoutManager.customlayout_change_numcolumns = function(pieformname, columnoptions) {
var currentrow = $(columnoptions).attr('id').substr($(columnoptions).attr('id').lastIndexOf('_') + 1);
var numcols = parseInt(columnoptions.options[columnoptions.selectedIndex].value, 10);
// reverse in order to select the first option
......@@ -74,26 +74,26 @@
$(this).prop('selected', true);
}
});
customlayout_change_layout();
customlayout_change_layout(pieformname);
};
CustomLayoutManager.customlayout_change_column_layout = function() {
customlayout_change_layout();
CustomLayoutManager.customlayout_change_column_layout = function(pieformname) {
customlayout_change_layout(pieformname);
};
CustomLayoutManager.customlayout_submit_layout = function() {
var numrows = parseInt($('#viewlayout_customlayoutnumrows').val(), 10);
CustomLayoutManager.customlayout_submit_layout = function(pieformname) {
var numrows = parseInt($('#' + pieformname + '_customlayoutnumrows').val(), 10);
var collayouts = '';
for (i=0; i<numrows; i++) {
collayouts += '_row' + [i+1] + '_' + $('#selectcollayoutrow_' + (i+1)).val();
}
if (typeof formchangemanager !== 'undefined') {
formchangemanager.setFormState($('#viewlayout'), FORM_CHANGED);
formchangemanager.setFormState($('#' + pieformname), FORM_CHANGED);
}
var pd = {
'id': $('#viewlayout_viewid').val(),
'id': $('#' + pieformname + '_id').val(),
'change': 1
}
pd['action_addcustomlayout_numrows_' + numrows + collayouts] = 1;
......@@ -105,13 +105,13 @@
// insert new layout
// clone and tweak
var clone = $('.advancedlayoutselect input[type=radio]:first').parent().parent().clone();
var id = 'viewlayout_advancedlayoutselect' + unique_timestamp();
var id = '' + pieformname + '_advancedlayoutselect' + unique_timestamp();
$('label', clone).attr('for', id).text(data.data.text);
$('input', clone).attr('id', id).val(layoutid);
$('svg', clone).replaceWith(data.data.layoutpreview);
//insert into appropriate row
var rowcontainer = $('#viewlayout_advancedlayoutselect_row'+numrows);
var rowcontainer = $('#' + pieformname + '_advancedlayoutselect_row'+numrows);
if (rowcontainer.length) {
$(rowcontainer).append(clone);
}
......@@ -120,25 +120,25 @@
var rowtitlediv = $('<h3>').attr('class', 'title');
rowtitlediv.html('<strong>' + get_string('nrrows', 'view', numrows) + '</strong>');
var rowcontainer = $('<div>').attr({
'id': 'viewlayout_advancedlayoutselect_row' + numrows,
'class': 'fr'
'id': '' + pieformname + '_advancedlayoutselect_row' + numrows,
'class': 'layoutoptions-container'
});
var hr = $('<hr>').attr('class', 'cb');
$(rowcontainer).append(clone);
$('#viewlayout_advancedlayoutselect_container').append(rowtitlediv);
$('#viewlayout_advancedlayoutselect_container').append(rowcontainer);
$('#viewlayout_advancedlayoutselect_container').append(hr);
$('#' + pieformname + '_advancedlayoutselect_container').append(rowtitlediv);
$('#' + pieformname + '_advancedlayoutselect_container').append(rowcontainer);
$('#' + pieformname + '_advancedlayoutselect_container').append(hr);
}
}
$('#viewlayout_advancedlayoutselect_container').collapse('show');
$('#' + pieformname + '_advancedlayoutselect_container').collapse('show');
// select and highlight layout
var radio = $('.advancedlayoutselect :radio[value=' + layoutid +']');
$(radio).attr("checked","checked");
$('#viewlayout_layoutselect').val(layoutid);
$('#' + pieformname + '_currentlayoutselect').val(layoutid);
highlight_layout($(radio).parent());
link_thumbs_to_radio_buttons();
......@@ -150,76 +150,6 @@
// Private Methods
////////////////////
function init() {
$('#viewlayout_basic_container legend a, #viewlayout_adv_container legend a').click(function(event) {
var containerclicked = $( $(this).context ).attr('aria-controls');
var basiccollapse = advancedcollapse = customcollapse = 'hide';
if (containerclicked == '#viewlayout_layoutselect_container') {
basiccollapse = 'toggle';
}
else if (containerclicked == '#viewlayout_advancedlayoutselect_container') {
advancedcollapse = 'toggle';
}
else if (containerclicked == '#viewlayout_createcustomlayout_container') {
customcollapse = 'toggle';
}
$('#viewlayout_layoutselect_container').collapse(basiccollapse);
$('#viewlayout_advancedlayoutselect_container').collapse(advancedcollapse);
$('#viewlayout_createcustomlayout_container').collapse(customcollapse);
var layoutselected = $('#viewlayout_layoutselect').val();
var layoutfallback = $('#viewlayout_layoutfallback').val();
if ($('.layoutselect :radio[value=' + layoutselected +']').length ) {
$('.layoutselect :radio[value=' + layoutselected +']').attr("checked","checked");
}
else {
$('.layoutselect :radio[value=' + layoutfallback + ']').attr("checked","checked");
$('#viewlayout_layoutselect').val(layoutfallback);
}
if ($('.advancedlayoutselect :radio[value=' + layoutselected +']').length ) {
$('.advancedlayoutselect :radio[value=' + layoutselected +']').attr("checked","checked");
}
else {
$('.advancedlayoutselect :radio[value=' + layoutfallback + ']').attr("checked","checked");
$('#viewlayout_layoutselect').val(layoutfallback);
}
});
$("input[name='layoutselect']").change(function(event) {
$('#viewlayout_layoutselect').val($(this).val());
});
$("input[name='advancedlayoutselect']").change(function(event) {
$('#viewlayout_layoutselect').val($(this).val());
});
link_thumbs_to_radio_buttons();
$('#basiclayouthelp').click(function(event) {
contextualHelp("viewlayout","layoutselect","core","view","","",this);
return false;
});
$('#customlayouthelp').click(function(event) {
contextualHelp("viewlayout","createcustomlayouttitle","core","view","","",this);
return false;
});
$('#togglecustomlayoutoptions').hide();
$('#createcustomlayouttitle').click(function(event) {
$('#viewlayout_createcustomlayout_container').toggleClass("collapsed");
$('#togglecustomlayoutoptions').toggle();
});
}
function link_thumbs_to_radio_buttons() {
$('.layoutoption > .thumbnail').each(function(event) {
$(this).click(function(e) {
$(this).find(':radio').prop('checked', true);
$('#viewlayout_layoutselect').val( $(this).find(':radio').val() );
});
});
}
function unique_timestamp() {
var time = new Date().getTime();
while (time == new Date().getTime());
......@@ -231,15 +161,15 @@
$(element).animate({backgroundColor:'#EEE'}, 3000);
}
function customlayout_change_layout() {
var numrows = parseInt($('#viewlayout_customlayoutnumrows').val(), 10);
function customlayout_change_layout(pieformname) {
var numrows = parseInt($('#' + pieformname + '_customlayoutnumrows').val(), 10);
var collayouts = '';
for (i=0; i<numrows; i++) {
collayouts += '_row' + [i+1] + '_' + $('#selectcollayoutrow_' + (i+1)).val();
}
var pd = {
'id': $('#viewlayout_viewid').val(),
'id': $('#' + pieformname + '_id').val(),
'change': 1
}
pd['action_updatecustomlayoutpreview_numrows_' + numrows + collayouts] = 1;
......@@ -248,12 +178,78 @@
});
if (typeof formchangemanager !== 'undefined') {
formchangemanager.setFormState($('#viewlayout'), FORM_CHANGED);
formchangemanager.setFormState($('#' + pieformname), FORM_CHANGED);
}
}
$(document).ready(function() {
init();
}( window.CustomLayoutManager = window.CustomLayoutManager || {}, jQuery ));
function init(pieformname) {
$('#' + pieformname + '_basic_container legend a, #' + pieformname + '_adv_container legend a').click(function(event) {
var containerclicked = $( $(this).context ).attr('aria-controls');
var basiccollapse = advancedcollapse = customcollapse = 'hide';
if (containerclicked == '#' + pieformname + '_layoutselect_container') {
basiccollapse = 'toggle';
}
else if (containerclicked == '#' + pieformname + '_advancedlayoutselect_container') {
advancedcollapse = 'toggle';
}
else if (containerclicked == '#' + pieformname + '_createcustomlayout_container') {
customcollapse = 'toggle';
}
$('#' + pieformname + '_layoutselect_container').collapse(basiccollapse);
$('#' + pieformname + '_advancedlayoutselect_container').collapse(advancedcollapse);
$('#' + pieformname + '_createcustomlayout_container').collapse(customcollapse);
var layoutselected = $('#' + pieformname + '_currentlayoutselect').val();
var layoutfallback = $('#' + pieformname + '_layoutfallback').val();
if ($('.layoutselect :radio[value=' + layoutselected +']').length ) {
$('.layoutselect :radio[value=' + layoutselected +']').attr("checked","checked");
}
else {
$('.layoutselect :radio[value=' + layoutfallback + ']').attr("checked","checked");
$('#' + pieformname + '_currentlayoutselect').val(layoutfallback);
}
if ($('.advancedlayoutselect :radio[value=' + layoutselected +']').length ) {
$('.advancedlayoutselect :radio[value=' + layoutselected +']').attr("checked","checked");
}
else {
$('.advancedlayoutselect :radio[value=' + layoutfallback + ']').attr("checked","checked");
$('#' + pieformname + '_currentlayoutselect').val(layoutfallback);
}
});
}( window.CustomLayoutManager = window.CustomLayoutManager || {}, jQuery ));
$("input[name='layoutselect']").change(function(event) {
$('#' + pieformname + '_currentlayoutselect').val($(this).val());
});
$("input[name='advancedlayoutselect']").change(function(event) {
$('#' + pieformname + '_currentlayoutselect').val($(this).val());
});
link_thumbs_to_radio_buttons(pieformname);
$('#basiclayouthelp').click(function(event) {
contextualHelp("viewlayout","layoutselect","core","view","","",this);
return false;
});
$('#customlayouthelp').click(function(event) {
contextualHelp("viewlayout","createcustomlayouttitle","core","view","","",this);
return false;
});
$('#togglecustomlayoutoptions').hide();
$('#createcustomlayouttitle').click(function(event) {
$('#' + pieformname + '_createcustomlayout_container').toggleClass("collapsed");
$('#togglecustomlayoutoptions').toggle();
});
}
function link_thumbs_to_radio_buttons(pieformname) {
$('.layoutoption > .thumbnail').each(function(event) {
$(this).click(function(e) {
$(this).find(':radio').prop('checked', true);
$('#' + pieformname + '_currentlayoutselect').val( $(this).find(':radio').val() );
});
});
}
......@@ -11,14 +11,16 @@
defined('INTERNAL') || die();
$string['basics'] = 'Basics';
$string['createview'] = 'Create page';
$string['edittitle'] = 'Edit title';
$string['edittitleanddescription'] = 'Edit title and description';
$string['editcontent'] = 'Edit content';
$string['editcontent1'] = 'Edit';
$string['editcontentandlayout'] = 'Edit content and layout';
$string['editlayout'] = 'Edit layout';
$string['editaccess'] = 'Edit access';
$string['editaccessfor'] = 'Edit access (ID %s)';
$string['layout'] = 'Layout';
$string['manageaccess'] = 'Manage access';
$string['manageaccessfor'] = 'Manage access for "%s"';
$string['managekeys'] = 'Manage secret URLs';
......@@ -32,9 +34,12 @@ $string['viewurl'] = 'Page URL';
$string['viewurldescription'] = 'A readable URL for your page. This field must be between 3 and 100 characters long.';
$string['userviewurltaken'] = 'This URL is already taken. Please choose another one.';
$string['description'] = 'Page description';
$string['settings'] = 'Settings';
$string['startdate'] = 'Access start date/time';
$string['stopdate'] = 'Access end date/time';
$string['skin'] = 'Skin';
$string['overrideconflict'] = 'One or more access permissions are in conflict with the overriding dates. These access permissions will not be valid outside the overriding dates.';
$string['pagepartofcollection'] = 'Your page is part of the collection \'%s\'. The permissions you set on this page will be applied to the entire collection.';
$string['stopdatecannotbeinpast1'] = '"To" date cannot be in the past';
$string['startdatemustbebeforestopdate'] = 'Start date must be before stop date';
$string['newstopdatecannotbeinpast'] = 'The end date for \'%s\' access cannot be in the past.';
......@@ -176,8 +181,8 @@ $string['defaultaccesslistmessage'] = 'Nobody besides you can view your selected
$string['sharewithmygroups'] = 'Share with my groups';
$string['sharewithmyinstitutions'] = 'Share with my institutions';
$string['sharewithusers'] = 'Share with users';
$string['shareview'] = 'Share page';
$string['otherusersandgroups'] = 'Share with other users and groups';
$string['shareview1'] = 'Share';
$string['sharedwithothers'] = 'Share with others';
$string['moreoptions'] = 'Advanced options';
$string['moreinstitutions'] = 'More institutions';
$string['allviews'] = 'All pages';
......@@ -318,7 +323,6 @@ $string['advancedoptions'] = 'Advanced options';
$string['viewcolumnspagedescription'] = 'First, select the number of columns in your page. In the next step, you will be able to change the widths of the columns.';
$string['viewlayoutpagedescription'] = 'Select how you would like your page to be laid out.';
$string['changeviewlayout'] = 'Change my page\'s column layout';
$string['viewlayoutchanged'] = 'Page layout changed';
$string['numberofcolumns'] = 'Number of columns';
$string['changecolumnlayoutfailed'] = 'Could not change the column layout. Someone else may have been editing the layout at the same time. Please try again later.';
$string['changerowlayoutfailed'] = 'Could not change the row layout. Someone else may have been editing the layout at the same time. Please try again later.';
......
<?php
/**
*
* @package mahara
* @subpackage form-element
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
/**
* Provides
* - radio button input field to select from all page layouts`
* - custom layout creation field
*
* @param Pieform $form The form to render the element for
* @param array $element The element to render
* @return string The HTML for the element
*/
function pieform_element_layout(Pieform $form, $element) {
$output = '<div id="' . $form->get_property('name') . '_advancedlayoutselect_container" class="advancedlayoutselect">';
for ($row = 0; $row < $element['maxrows']; $row++) {
$output .= '<h4 class="title">' . ($row + 1) . ' ';
$output .= get_string('row', 'view');
$output .= '</h4>';
$output .= '<div class="layoutoptions-container" id="' . $form->get_property('name') . '_advancedlayoutselect_row' . ($row + 1) . '">';
foreach ($element['options'] as $value => $data) {
if ($data['rows'] == $row+1) {
$description = (isset($data['description'])) ? $data['description'] : '';
$text = Pieform::hsc($data['columns']);
$output .= '<div class="layoutoption"><div class="thumbnail text-center">'
. '<label class="accessible-hidden sr-only" for="advancedlayout_' . Pieform::hsc($value) . '">' . $text . '</label>'
. ($description != '' ? '<div class="radio-description">' . $description . '</div>' : '')
. '<div class="layoutthumb">' . $data['layout'] . '</div>'
. '<input type="radio" name="advancedlayoutselect" id="advancedlayout_' . Pieform::hsc($value) . '"'
. ' value="' . Pieform::hsc($value) . '"'
. (($element['currentlayout'] == $value) ? ' checked="checked"' : '') . '>'
. '</div></div>';
}
}
$output .= '</div>';
}
$output .= '</div>';
//******** Custom layout
$output .= '<div id="' . $form->get_property('name') . '_createcustomlayout_container" class="createcustomlayout">';
// custom layout design options
if (!isset($element['clnumcolumnsoptions']) || !is_array($element['clnumcolumnsoptions']) || count($element['clnumcolumnsoptions']) < 1 || !isset($element['columnlayoutoptions']) || !is_array($element['columnlayoutoptions']) || count($element['columnlayoutoptions']) < 1) {
throw new PieformException('Custom layouts need a set of possible layout options.');
}
$output .= '<h4 class="title">';
$output .= get_string('createcustomlayout', 'view');
$output .= '</h4>';
$output .= '<div id="createcustomlayoutpane" class="row col-static">'
. '<div class="col-xs-12 col-sm-2">'
. '<div class="user-icon layoutthumb preview"><div id="custompreview">' . $element['customlayout'] . '</div><p class="metadata text-center">' . get_string('layoutpreview', 'view') .'</p></div>'
. '</div>'
. '<div id="customrows" class="col-xs-12 col-sm-10">'
. '<div id="customrow_1" class="customrow form-group five-across multi-label clearfix" style="border-bottom: 0px !important;">'
. '<div class="customrowtitle pull-left field"><strong>' . get_string('Row', 'view') . ' 1</strong></div>'
. '<div class="pull-left field field-selectnumcols">'
. '<label for="selectnumcolsrow_1">' . get_string('numberofcolumns', 'view') . '</label>'
. '<select name="selectnumcols" id="selectnumcolsrow_1" class="selectnumcols input-sm" onchange="CustomLayoutManager.customlayout_change_numcolumns(\'' . $form->get_property('name') . '\', this)">';
foreach ($element['clnumcolumnsoptions'] as $value => $data) {
$output .= '<option value="' . $value . '" ' . (($element['clnumcolumnsdefault'] == $value)? 'selected="selected"' : '') . '>' . $data . '</option>';
}
$output .= '</select></div>'
. '<div class="pull-left field">'
. '<label for="selectcollayoutrow_1">' . get_string('columnlayout', 'view') . '</label>'
. '<select name="selectcollayout" id="selectcollayoutrow_1" class="selectcollayout input-sm" onchange="CustomLayoutManager.customlayout_change_column_layout(\'' . $form->get_property('name') . '\')">';
foreach ($element['columnlayoutoptions'] as $value => $data) {
$numcols = count(explode('-', $data));
$selectionstring = 'disabled';
if ($value == $element['customlayoutid']) {
$selectionstring = 'selected="selected"';
}
else if ($numcols == $element['clnumcolumnsdefault']) {
$selectionstring = '';
}
$output .= '<option value="' . $value . '" ' . $selectionstring . '>' . $data . '</option>';
}
$output .= '</select>'
. '</div>'
. '</div>'; //closing customrow_1
// 'Add row' button
$output .='<button type="button" name="addrow" class="btn btn-sm btn-default" id="addrow" onclick="CustomLayoutManager.customlayout_add_row(\'' . $form->get_property('name') . '\')">'
.'<span class="icon icon-lg icon-plus-circle left" role="presentation" aria-hidden="true"></span>'
. get_string('addarow', 'view')
.'</button>'
. '</div>';// closing customrows
// close 'createcustomlayoutpane'
$output .= '</div>';
// preview pane
$output .= '<div id="previewcustomlayoutpane">'
. '<button type="button" name="submitlayout" id="addlayout" class="btn btn-default" onclick="CustomLayoutManager.customlayout_submit_layout(\'' . $form->get_property('name') . '\')">'
. '<span class="icon icon-lg icon-check left" role="presentation" aria-hidden="true"></span>'
. get_string('createnewlayout', 'view')
. '</button>'
. '</div>';
// close 'createcustomlayout_container' container
$output .= '</div>';
$output .= '<script type="application/javascript">
$( window ).on( "load", function() {
init(\'' . $form->get_property('name') . '\');
});</script>';
return $output;
}
function pieform_element_layout_get_headdata($element) {
$result = '<script src="' . get_config('wwwroot') . 'js/customlayout.js?v=' . get_config('cacheversion', 0) . '" type="application/javascript">';
return array($result);
}
......@@ -62,17 +62,19 @@ function pieform_element_calendar(Pieform $form, $element) {
$result = '<span class="hasDatepickerwrapper"><input type="text"'
. $form->element_attributes($element)
. ' value="' . $value . '"></span>';
$result .= '<script type="application/javascript">
var input = jQuery("input#' . $id . '");';
$result .= '
<script type="application/javascript">
var input_' . $id . ' = jQuery("input#' . $id . '");
';
if (!empty($options['showsTime'])) {
$result .= 'input.datetimepicker({';
$result .= 'input_' . $id . '.datetimepicker({';
}
else {
$result .= 'input.datepicker({';
$result .= 'input_' . $id . '.datepicker({';
}
$result .= ' onSelect: function(date) {
if (typeof formchangemanager !== \'undefined\') {
var form = input.closest(\'form\')[0];
var form = input_' . $id . '.closest(\'form\')[0];
formchangemanager.setFormState(form, FORM_CHANGED);
}
},';
......
......@@ -312,8 +312,9 @@ class Skin {
/**
* Returns data about available skins. Tightly coupled with view/skin.php, which uses it to
* display the skins picker
* Returns data about available skins.
* Tightly coupled with get_skin_elements() function in view/editlayout.php,
* which uses it to display the skins picker
* @param int $limit
* @param int $offset
* @param string $filter Should be: all, public, user, or site
......
......@@ -2690,7 +2690,7 @@ class View {
if ($dbcolumns != 0) {
db_rollback();
$SESSION->add_error_msg(get_string('changecolumnlayoutfailed', 'view'));
redirect(get_config('wwwroot') . 'view/layout.php?id=' . $this->get('id') . ($new ? '&new=1' : ''));
redirect(get_config('wwwroot') . 'view/editlayout.php?id=' . $this->get('id') . ($new ? '&new=1' : ''));
}
$this->set('numrows', $this->get('numrows') - 1);
......@@ -3892,11 +3892,7 @@ class View {
$ua->accessibilityname = get_string('manageaccessfor', 'view', $data['vtitle']);
$ua->accesstype = 'managesharing';
$uk = new stdClass();
$uk->displayname = get_string('managekeys', 'view');
$uk->accessibilityname = get_string('managekeysfor', 'view', $data['vtitle']);
$uk->accesstype = 'managekeys';
$data['manageaccess'] = array($ua, $uk);
$data['manageaccess'] = array($ua);
if ($accesslist = get_records_sql_array('
SELECT va.*, g.name AS groupname, g.grouptype, i.displayname AS institutionname
......