Skip to content

Commit

Permalink
Improvements to the tabs for assigning and overriding roles. MDL-12120
Browse files Browse the repository at this point in the history
Tabs are now all on the top row
Tabs have clearer titles
Other help texts improved
  • Loading branch information
moodler committed Nov 19, 2007
1 parent d0131db commit 17afefe
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 51 deletions.
6 changes: 2 additions & 4 deletions admin/roles/assign.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,10 @@
} else if ($context->contextlevel==CONTEXT_COURSE and $context->instanceid == SITEID) {
admin_externalpage_setup('frontpageroles');
admin_externalpage_print_header();
$currenttab = '';
$tabsmode = 'assign';
$currenttab = 'assign';
include_once('tabs.php');
} else {
$currenttab = '';
$tabsmode = 'assign';
$currenttab = 'assign';
include_once('tabs.php');
}

Expand Down
8 changes: 3 additions & 5 deletions admin/roles/override.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,10 @@
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('frontpageroles');
admin_externalpage_print_header();
$currenttab = '';
$tabsmode = 'override';
$currenttab = 'override';
include_once('tabs.php');
} else {
$currenttab = '';
$tabsmode = 'override';
$currenttab = 'override';
include_once('tabs.php');
}

Expand All @@ -168,7 +166,7 @@
}


print_heading_with_help(get_string('overriderolesin', 'role', print_context_name($context)), 'overrides');
print_heading_with_help(get_string('overridepermissionsin', 'role', print_context_name($context)), 'overrides');

if ($roleid) {
/// prints a form to swap roles
Expand Down
67 changes: 29 additions & 38 deletions admin/roles/tabs.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,48 +159,41 @@
}


$toprow = array();
$inactive = array();
$activetwo = array();


if ($context->contextlevel != CONTEXT_SYSTEM) { // Print tabs for anything except SYSTEM context

if ($context->contextlevel == CONTEXT_MODULE) { // only show update button if module?
if ($context->contextlevel == CONTEXT_MODULE) { // Only show update button if module

$toprow[] = new tabobject('update', $CFG->wwwroot.'/course/mod.php?update='.
$context->instanceid.'&return=true&sesskey='.sesskey(), get_string('update'));
$context->instanceid.'&return=true&sesskey='.sesskey(), get_string('settings'));

}

$toprow[] = new tabobject('roles', $CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.
$context->id, get_string('roles'));

if (!empty($tabsmode)) {

if (!empty($assignableroles)) {
$secondrow[] = new tabobject('assign',
$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$context->id,
get_string('assignroles', 'role'),
get_string('showallroles', 'role'),
true);
}

if (!empty($overridableroles)) {
$secondrow[] = new tabobject('override',
$CFG->wwwroot.'/'.$CFG->admin.'/roles/override.php?contextid='.$context->id,
get_string('overrideroles', 'role'),
get_string('showallroles', 'role'),
true);
}

$inactive[] = 'roles';
$activetwo = array('roles');
$currenttab = $tabsmode;
if (!empty($assignableroles)) {
$toprow[] = new tabobject('assign',
$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$context->id,
get_string('localroles', 'role'),
get_string('showallroles', 'role'),
true);
}

} else {
$inactive[] = '';
$activetwo = array();
if (!empty($overridableroles)) {
$toprow[] = new tabobject('override',
$CFG->wwwroot.'/'.$CFG->admin.'/roles/override.php?contextid='.$context->id,
get_string('overridepermissions', 'role'),
get_string('showallroles', 'role'),
true);
}

}

/// Here other core tabs should go (always calling tabs.php files)
/// All the logic to decide what to show must be self-cointained in the tabs file
/// ej.:
/// All the logic to decide what to show must be self-contained in the tabs file
/// eg:
/// include_once($CFG->dirroot . '/grades/tabs.php');

/// Finally, we support adding some 'on-the-fly' tabs here
Expand All @@ -209,21 +202,19 @@
if ($extratabs = explode(',', $CFG->extratabs)) {
asort($extratabs);
foreach($extratabs as $extratab) {
/// Each extra tab mus be one $CFG->dirroot relative file
/// Each extra tab must be one $CFG->dirroot relative file
if (file_exists($CFG->dirroot . '/' . $extratab)) {
include_once($CFG->dirroot . '/' . $extratab);
}
}
}
}

if (!empty($secondrow)) {
$tabs = array($toprow, $secondrow);
} else {
$tabs = array($toprow);
}
$inactive = array($currenttab);

$tabs = array($toprow);

print_tabs($tabs, $currenttab, $inactive, $activetwo);
}


?>
2 changes: 2 additions & 0 deletions course/modedit.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,8 @@

if (!empty($cm->id)) {
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
$overridableroles = get_overridable_roles($context);
$assignableroles = get_assignable_roles($context);
$currenttab = 'update';
include_once($CFG->dirroot.'/'.$CFG->admin.'/roles/tabs.php');
}
Expand Down
6 changes: 3 additions & 3 deletions lang/en_utf8/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@
$string['cleanup'] = 'Cleanup';
$string['componentinstalled'] = 'Component Installed';
$string['confeditorhidebuttons'] = 'Select the buttons that should be hidden in the HTML editor.';
$string['configallowassign'] = 'Allow the roles on the left side to assign the roles in each column';
$string['configallowassign'] = 'You can allow people who have the roles on the left side to assign some of the column roles to other people';
$string['configallowcategorythemes'] = 'If you enable this, then themes can be set at the category level. This will affect all child categories and courses unless they have specifically set their own theme. WARNING: Enabling category themes may affect performance.';
$string['configallowcoursethemes'] = 'If you enable this, then courses will be allowed to set their own themes. Course themes override all other theme choices (site, user, or session themes)';
$string['configallowemailaddresses'] = 'If you want to restrict all new email addresses to particular domains, then list them here separated by spaces. All other domains will be rejected. eg <strong>ourcollege.edu.au .gov.au</strong>';
$string['configallowobjectembed'] = 'As a default security measure, normal users are not allowed to embed multimedia (like Flash) within texts using explicit EMBED and OBJECT tags in their HTML (although it can still be done safely using the mediaplugins filter). If you wish to allow these tags then enable this option.';
$string['configallowoverride'] = 'Allow the roles on the left side to override the roles in each column';
$string['configallowoverride'] = 'You can allow people with the roles on the left side to override some of the column roles';
$string['configallowunenroll'] = 'If this is set \'Yes\', then students are allowed to unenroll themselves from courses whenever they like. Otherwise they are not allowed, and this process will be solely controlled by the teachers and administrators.';
$string['configallowuserblockhiding'] = 'Do you want to allow users to hide/show side blocks throughout this site? This feature uses Javascript and cookies to remember the state of each collapsible block, and only affects the user\'s own view.';
$string['configallowusermailcharset'] = 'Enabling this, every user in the site will be able to specify his own charset for email.';
Expand Down Expand Up @@ -677,4 +677,4 @@
$string['validateerror'] = 'This value was not valid:';
$string['xmlstrictheaders'] = 'XML strict headers';

?>
?>
3 changes: 3 additions & 0 deletions lang/en_utf8/role.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,12 @@
$string['legacy:user'] = 'LEGACY ROLE: Authenticated user';
$string['legacytype'] = 'Legacy role type';
$string['listallroles'] = 'List all roles';
$string['localroles'] = 'Locally assigned roles';
$string['manageroles'] = 'Manage roles';
$string['metaassignerror'] = 'Can not assign this role to user \"$a\" because Manage metacourse capability is needed.';
$string['metaunassignerror'] = 'Role of user \"$a\" was automatically reassigned, please unassign the role in child courses instead.';
$string['overridepermissions'] = 'Override permissions';
$string['overridepermissionsin'] = 'Override permissions in $a';
$string['morethan'] = 'More than $a';
$string['my:manageblocks'] = 'Manage myMoodle page blocks';
$string['nocapabilitiesincontext'] = 'No capabilities available in this context';
Expand Down
3 changes: 2 additions & 1 deletion theme/standard/styles_layout.css
Original file line number Diff line number Diff line change
Expand Up @@ -2640,8 +2640,9 @@ body.notes .notesgroup {
.tabrow0 {
text-align: center;
width:100%;
padding:0 0 1.75em 0;
margin:0;
margin-top: 10px;
padding:0 0 1.75em 0;
list-style:none;
line-height:1.8em;
font-size: 84%;
Expand Down

0 comments on commit 17afefe

Please sign in to comment.