Commit 30ea8c74 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review

Merge "Bug 1832308: Group setting and isolated institutions"

parents 55b12065 53d7eb7a
......@@ -148,7 +148,7 @@ $elements['open'] = array(
'title' => get_string('Open', 'group'),
'description' => get_string('opendescription', 'group'),
'defaultvalue' => $group_data->open,
'disabled' => $group_data->controlled || $group_data->public,
'disabled' => !$cancreatecontrolled && $group_data->controlled,
);
if ($cancreatecontrolled || $group_data->controlled) {
$elements['controlled'] = array(
......@@ -207,22 +207,20 @@ else {
);
}
if (!get_config('friendsnotallowed')) {
$elements['invitefriends'] = array(
'type' => 'switchbox',
'title' => get_string('friendinvitations', 'group'),
'description' => get_string('invitefriendsdescription1', 'group'),
'defaultvalue' => $group_data->invitefriends,
);
$elements['invitefriends'] = array(
'type' => 'switchbox',
'title' => get_string('friendinvitations', 'group'),
'description' => get_string('invitefriendsdescription1', 'group'),
'defaultvalue' => $group_data->invitefriends,
);
$elements['suggestfriends'] = array(
'type' => 'switchbox',
'title' => get_string('Recommendations', 'group'),
'description' => get_string('suggestfriendsdescription1', 'group'),
'defaultvalue' => $group_data->suggestfriends && ($group_data->open || $group_data->request),
'disabled' => !$group_data->open && !$group_data->request,
);
}
$elements['suggestfriends'] = array(
'type' => 'switchbox',
'title' => get_string('Recommendations', 'group'),
'description' => get_string('suggestfriendsdescription1', 'group'),
'defaultvalue' => $group_data->suggestfriends && ($group_data->open || $group_data->request),
'disabled' => !$group_data->open && !$group_data->request,
);
$elements['pages'] = array(
'type' => 'html',
......@@ -609,22 +607,6 @@ jQuery(function($) {
}
}
});
$("#editgroup_public").on("click", function() {
if (this.checked) {
$("#editgroup_controlled").prop("checked", true);
$("#editgroup_request").prop("checked", true);
$("#editgroup_request").prop("disabled", false);
$("#editgroup_open").prop("checked", false);
$("#editgroup_open").prop("disabled", true);
}
else {
$("#editgroup_controlled").prop("checked", false);
$("#editgroup_request").prop("checked", false);
$("#editgroup_request").prop("disabled", true);
$("#editgroup_open").prop("checked", true);
$("#editgroup_open").prop("disabled", false);
}
});
$("#editgroup_request").on("click", function() {
if (this.checked) {
$("#editgroup_suggestfriends").prop("disabled", false);
......
......@@ -1716,8 +1716,11 @@ function group_prepare_usergroups_for_display($groups) {
else if ($group->membershiptype == 'invite') {
$group->invite = group_get_accept_form('invite' . $i++, $group->id);
}
// When 'isolatedinstitutions' is set, people cannot join public groups by themselves
else if ($group->jointype == 'open' && !(is_isolated() && $group->public == 1)) {
// Only admin can create public groups when isolatedinstitutions is set.
// It's up to the admin to correctly set the jointype. Public should not affect the open status.
// So for isolatedinstitutions and open groups, people can join that group if it's in their
// institution.
else if ($group->jointype == 'open') {
$group->groupjoin = group_get_join_form('joingroup' . $i++, $group->id);
}
......
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