Commit 84c7cd5e authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Get role strings from the right place in group files

parent d560b902
......@@ -50,7 +50,11 @@ require_once(get_config('docroot') . 'interaction/lib.php');
require_once(get_config('docroot') . 'lib/grouptype/' . $group->grouptype . '.php');
$groupdata = json_encode($group);
$grouproles = json_encode(call_static_method('GroupType' . $group->grouptype, 'get_roles'));
$grouproles = array();
foreach (call_static_method('GroupType' . $group->grouptype, 'get_roles') as $role) {
$grouproles[] = array('name' => $role, 'display' => get_string($role, 'grouptype.'.$group->grouptype));
}
$grouproles = json_encode($grouproles);
$javascript .= <<<GROUPJS
var group = {$groupdata};
......
......@@ -41,16 +41,16 @@ function getpermissions(formid) {
var permissiontypes = ['view', 'edit', 'republish'];
function permissionform_inputs(permissions, role) {
var cells = [TD(null, get_string(role))];
var cells = [TD(null, role.display)];
for (var i = 0; i < permissiontypes.length; i++) {
var properties = {
'type':'checkbox',
'class':'permission',
'name':'permission:'+role+':'+permissiontypes[i],
'name':'permission:'+role.name+':'+permissiontypes[i],
};
if (role == 'admin' || permissions.all || permissions[role] && permissions[role][permissiontypes[i]] == 1) {
if (role.name == 'admin' || permissions.all || permissions[role.name] && permissions[role.name][permissiontypes[i]] == 1) {
properties.checked = true;
if (role == 'admin') {
if (role.name == 'admin') {
properties.disabled = true;
}
}
......
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