From 681729b16e32f0b1d742bc61c3b975ae3047155b Mon Sep 17 00:00:00 2001 From: skodak Date: Tue, 19 Sep 2006 17:34:29 +0000 Subject: [PATCH] various minor Role UI fixes --- admin/roles/allowassign.php | 4 +-- admin/roles/allowoverride.php | 4 +-- admin/roles/assign.html | 6 ++--- admin/roles/assign.php | 2 +- admin/roles/manage.html | 47 +++++++++++++++++++++-------------- admin/roles/manage.php | 16 +++++++----- admin/roles/override.html | 14 +++++------ admin/roles/override.php | 4 +-- course/groups-edit.html | 2 +- lang/en_utf8/moodle.php | 1 - lang/en_utf8/role.php | 8 +++++- 11 files changed, 63 insertions(+), 45 deletions(-) diff --git a/admin/roles/allowassign.php b/admin/roles/allowassign.php index ebdeca7a7f..b2685a1348 100755 --- a/admin/roles/allowassign.php +++ b/admin/roles/allowassign.php @@ -67,7 +67,7 @@ /// get all the roles identifier foreach ($roles as $role) { - $rolesname[] = $role->name; + $rolesname[] = format_string($role->name); $roleids[] = $role->id; $table->align[] = 'center'; $table->wrap[] = 'nowrap'; @@ -77,7 +77,7 @@ foreach ($roles as $role) { $beta = get_box_list($role->id, $roleids); - $table->data[] = array_merge(array($role->name), $beta); + $table->data[] = array_merge(array(format_string($role->name)), $beta); } print_simple_box(get_string('configallowassign', 'admin'), 'center'); diff --git a/admin/roles/allowoverride.php b/admin/roles/allowoverride.php index 4dcce9dab7..7904208c62 100755 --- a/admin/roles/allowoverride.php +++ b/admin/roles/allowoverride.php @@ -65,7 +65,7 @@ /// get all the roles identifier foreach ($roles as $role) { - $rolesname[] = $role->name; + $rolesname[] = format_string($role->name); $roleids[] = $role->id; $table->align[] = 'center'; $table->wrap[] = 'nowrap'; @@ -75,7 +75,7 @@ foreach ($roles as $role) { $beta = get_box_list($role->id, $roleids); - $table->data[] = array_merge(array($role->name), $beta); + $table->data[] = array_merge(array(format_string($role->name)), $beta); } print_simple_box(get_string('configallowoverride', 'admin'), 'center'); diff --git a/admin/roles/assign.html b/admin/roles/assign.html index 362560e4de..3a7bb7facf 100755 --- a/admin/roles/assign.html +++ b/admin/roles/assign.html @@ -9,9 +9,9 @@ if ($courseid) { print (''); } ?> - - - + + +
diff --git a/admin/roles/assign.php b/admin/roles/assign.php index 6f95aa9d99..739c8af61c 100755 --- a/admin/roles/assign.php +++ b/admin/roles/assign.php @@ -166,7 +166,7 @@ echo ''; } echo ''.$strroletoassign.': '; - choose_from_menu ($assignableroles, 'roleid', $roleid, 'choose', $script='rolesform.submit()'); + choose_from_menu ($assignableroles, 'roleid', $roleid, get_string('listallroles', 'role'), $script='rolesform.submit()'); echo ''; print_simple_box_start("center"); diff --git a/admin/roles/manage.html b/admin/roles/manage.html index bd85713bef..bae0aca93c 100755 --- a/admin/roles/manage.html +++ b/admin/roles/manage.html @@ -1,15 +1,23 @@ -
- - - -
Role Name: -  -Role short name (ASCII): -
Role Description: +htmleditor, 10, 50, 50, 10, 'description', "$role->description"); ?> + switch ($action) { + case 'add': $submitlabel = get_string('addrole', 'role'); break; + case 'edit': + default: $submitlabel = get_string('savechanges'); + } +?> + + + + + - +
+:   +: +
+: +description); ?>

@@ -30,8 +38,8 @@ $component = ''; foreach ($capabilities as $capability) { // prints a breaker if component or name or context level if ($capability->component != $component or $capability->contextlevel != $contextlevel) { - echo (''); + echo (''); } // these 2 are used to see to group same mod/core capabilities together @@ -47,10 +55,10 @@ foreach ($capabilities as $capability) { - - - - + + + + - -
'. - get_component_string($capability->component, $capability->contextlevel).'
'. + get_component_string($capability->component, $capability->contextlevel).'
name); ?>permission) || $localoverride->permission==0){ echo 'checked="checked"'; }?>>permission) && $localoverride->permission==1){ echo 'checked="checked"'; }?>>permission) && $localoverride->permission==-1){ echo 'checked="checked"'; }?>>permission) && $localoverride->permission==-1000){ echo 'checked="checked"'; }?>>permission) || $localoverride->permission==0){ echo 'checked="checked"'; }?> />permission) && $localoverride->permission==1){ echo 'checked="checked"'; }?> />permission) && $localoverride->permission==-1){ echo 'checked="checked"'; }?> />permission) && $localoverride->permission==-1000){ echo 'checked="checked"'; }?> /> riskbitmask) { echo "T"; @@ -70,8 +78,9 @@ foreach ($capabilities as $capability) { ?>
+ +

-
+
+ diff --git a/admin/roles/manage.php b/admin/roles/manage.php index 6679ee6f0b..7106bc4977 100755 --- a/admin/roles/manage.php +++ b/admin/roles/manage.php @@ -10,7 +10,7 @@ $roleid = optional_param('roleid', 0, PARAM_INT); // if set, we are editing a role $name = optional_param('name', '', PARAM_MULTILANG); // new role name $shortname = optional_param('shortname', '', PARAM_SAFEDIR); // new role shortname - $description = optional_param('description', '', PARAM_MULTILANG); // new role desc + $description = optional_param('description', '', PARAM_CLEAN); // new role desc $action = optional_param('action', '', PARAM_ALPHA); $confirm = optional_param('confirm', 0, PARAM_BOOL); @@ -148,13 +148,13 @@ } foreach ($roles as $rolex) { - $roleoptions[$rolex->id] = $rolex->name; + $roleoptions[$rolex->id] = format_string($rolex->name); } // prints a form to swap roles print ('
'); - print ('
'.get_string('selectrole').': '); - choose_from_menu ($roleoptions, 'roleid', $roleid, 'choose', $script='rolesform1.submit()'); + print ('
'.get_string('selectrole', 'role').': '); + choose_from_menu ($roleoptions, 'roleid', $roleid, get_string('listallroles', 'role'), $script='rolesform1.submit()'); print ('
'); // this is the array holding capabilities of this role sorted till this context @@ -163,10 +163,15 @@ // this is the available capabilities assignable in this context $capabilities = fetch_context_capabilities($sitecontext); + $usehtmleditor = can_use_html_editor(); print_simple_box_start(); include_once('manage.html'); print_simple_box_end(); + if ($usehtmleditor) { + use_html_editor('description'); + } + } else { $table = new object; @@ -188,7 +193,7 @@ foreach ($roles as $role) { - $table->data[] = array(''.$role->name.'', $role->description, ''.$strdelete.''); + $table->data[] = array(''.format_string($role->name).'', format_text($role->description, FORMAT_HTML), ''.$strdelete.''); } print_table($table); @@ -199,6 +204,5 @@ print_single_button('manage.php', $options, get_string('addrole', 'role'), 'POST'); } - use_html_editor('description'); admin_externalpage_print_footer($adminroot); ?> diff --git a/admin/roles/override.html b/admin/roles/override.html index a746627368..41f1b8aeee 100755 --- a/admin/roles/override.html +++ b/admin/roles/override.html @@ -1,6 +1,6 @@
- - + + '); @@ -61,28 +61,28 @@ if ($courseid) { > + if ($isdisabled) {echo 'disabled="disabled"';}?> /> > > + if ($isdisabled) {echo ' disabled="disabled"';}?> /> > > + if ($isdisabled) {echo ' disabled="disabled"';}?> /> > > + if ($isdisabled) {echo ' disabled="disabled"';}?> /> riskbitmask) { @@ -106,5 +106,5 @@ if ($courseid) {
-
+
diff --git a/admin/roles/override.php b/admin/roles/override.php index 1cf0816ff0..26e1bf6cdd 100755 --- a/admin/roles/override.php +++ b/admin/roles/override.php @@ -130,7 +130,7 @@ echo ''; } echo ''.$strroletooverride.': '; - choose_from_menu ($overridableroles, 'roleid', $roleid, 'choose', $script='rolesform.submit()'); + choose_from_menu ($overridableroles, 'roleid', $roleid, get_string('listallroles', 'role'), $script='rolesform.submit()'); echo '
'; $r_caps = role_context_capabilities($roleid, $context); @@ -145,7 +145,7 @@ print_simple_box_end(); } else { notice(get_string('nocapabilitiesincontext', 'role'), - $CFG->wwwroot.'/admin/roles/override.php?contextid='.$contextid); + $CFG->wwwroot.'/'.$CFG->admin.'/roles/override.php?contextid='.$contextid); } } else { // Print overview table diff --git a/course/groups-edit.html b/course/groups-edit.html index c335677467..9c0f3bef32 100755 --- a/course/groups-edit.html +++ b/course/groups-edit.html @@ -125,7 +125,7 @@ function groupWindow(selectgroup) {
-
: +
:
diff --git a/lang/en_utf8/moodle.php b/lang/en_utf8/moodle.php index fe5c49ed83..1c94d66241 100644 --- a/lang/en_utf8/moodle.php +++ b/lang/en_utf8/moodle.php @@ -1155,7 +1155,6 @@ $string['selectacountry'] = 'Select a country'; $string['selectamodule'] = 'Please select an activity module'; $string['selectednowmove'] = '$a files selected for moving. Now go to the destination and press \'Move files to here\''; $string['selectnos'] = 'Select all \'no\''; -$string['selectrole'] = 'Select a Role'; $string['senddetails'] = 'Send my details via email'; $string['separateandconnected'] = 'Separate and Connected ways of knowing'; $string['serverlocaltime'] = 'Server\'s local time'; diff --git a/lang/en_utf8/role.php b/lang/en_utf8/role.php index e96ba7580e..b9e90e7623 100644 --- a/lang/en_utf8/role.php +++ b/lang/en_utf8/role.php @@ -13,6 +13,7 @@ $string['currentcontext'] = 'Current context'; $string['defineroles'] = 'Define roles'; $string['existingusers'] = '$a existing users'; $string['inherit'] = 'Inherit'; +$string['listallroles'] = 'List all roles...'; $string['manageroles'] = 'Manage roles'; $string['nocapabilitiesincontext'] = 'No capabilities available in this context'; $string['overrideroles'] = 'Override roles'; @@ -21,9 +22,14 @@ $string['permissions'] = 'Permissions'; $string['potentialusers'] = '$a potential users'; $string['prevent'] = 'Prevent'; $string['prohibit'] = 'Prohibit'; +$string['risks'] = 'Risks'; +$string['roledescription'] = 'Role description'; +$string['rolename'] = 'Role name'; +$string['roleshortname'] = 'Role short name (ASCII)'; $string['roletoassign'] = 'Role to assign'; $string['roletooverride'] = 'Role to override'; $string['roles'] = 'Roles'; +$string['selectrole'] = 'Select a role'; $string['site:doanything'] = 'Allowed to do everything'; $string['legacy:guest'] = 'LEGACY ROLE: Guest'; @@ -39,7 +45,7 @@ $string['site:restore'] = 'Restore courses'; $string['site:manageblocks'] = 'Manage site-level blocks'; $string['site:accessallgroups'] = 'Access all groups'; $string['site:viewfullnames'] = 'Always see full names of users'; -$string['site:trustcontent'] = 'Trust content is safe'; +$string['site:trustcontent'] = 'Trust submitted content'; $string['site:doclinks'] = 'Show links to offsite docs'; $string['site:viewreports'] = 'View reports'; $string['user:create'] = 'Create users'; -- 2.39.5