manage roles: MDL-8313 face lift allow override/assign, add labels and tooltips to the checkboxes for usability and accessibility.

This commit is contained in:
tjhunt 2008-11-18 10:33:38 +00:00
parent ad5616a934
commit 587a1ea358
3 changed files with 16 additions and 2 deletions

View file

@ -99,13 +99,19 @@
/// Now the rest of the table.
foreach ($roles as $fromrole) {
$row = array($fromrole->localname);
$a = new stdClass;
$a->fromrole = $fromrole->localname;
foreach ($roles as $targetrole) {
if ($allowed[$fromrole->id][$targetrole->id]) {
$checked = ' checked="checked"';
} else {
$checked = '';
}
$row[] = '<input type="checkbox" name="s_' . $fromrole->id . '_' . $targetrole->id . '" value="1"' . $checked . ' />';
$a->targetrole = $targetrole->localname;
$name = 's_' . $fromrole->id . '_' . $targetrole->id;
$tooltip = get_string('allowroletoassign', 'role', $a);
$row[] = '<input type="checkbox" name="' . $name . '" id="' . $name . '" title="' . $tooltip . '" value="1"' . $checked . ' />' .
'<label for="' . $name . '" class="accesshide">' . $tooltip . '</label>';
}
$table->data[] = $row;
}

View file

@ -97,13 +97,19 @@
/// Now the rest of the table.
foreach ($roles as $fromrole) {
$row = array($fromrole->localname);
$a = new stdClass;
$a->fromrole = $fromrole->localname;
foreach ($roles as $targetrole) {
if ($allowed[$fromrole->id][$targetrole->id]) {
$checked = ' checked="checked"';
} else {
$checked = '';
}
$row[] = '<input type="checkbox" name="s_' . $fromrole->id . '_' . $targetrole->id . '" value="1"' . $checked . ' />';
$a->targetrole = $targetrole->localname;
$name = 's_' . $fromrole->id . '_' . $targetrole->id;
$tooltip = get_string('allowroletooverride', 'role', $a);
$row[] = '<input type="checkbox" name="' . $name . '" id="' . $name . '" title="' . $tooltip . '" value="1"' . $checked . ' />' .
'<label for="' . $name . '" class="accesshide">' . $tooltip . '</label>';
}
$table->data[] = $row;
}

View file

@ -9,6 +9,8 @@ $string['allow'] = 'Allow';
$string['allowassign'] = 'Allow role assignments';
$string['allowed'] = 'Allowed';
$string['allowoverride'] = 'Allow role overrides';
$string['allowroletoassign'] = 'Allow users with role $a->fromrole to assign the role $a->targetrole';
$string['allowroletooverride'] = 'Allow users with role $a->fromrole to override the role $a->targetrole';
$string['allsiteusers'] = 'All site users';
$string['assignanotherrole'] = 'Assign another role';
$string['assignerror'] = 'Error while assigning the role $a->role to user $a->user.';