From: moodler Date: Mon, 19 Nov 2007 07:13:02 +0000 (+0000) Subject: Merged from 1.9 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=21090e447ae88a4215dad3cb69eadd60cf4ba13a;p=moodle.git Merged from 1.9 Improvements to the tabs for assigning and overriding roles. MDL-12120 Tabs are now all on the top row Tabs have clearer titles Other help texts improved --- diff --git a/admin/roles/assign.php b/admin/roles/assign.php index 859b9c2cbf..01a3d73fc4 100755 --- a/admin/roles/assign.php +++ b/admin/roles/assign.php @@ -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'); } diff --git a/admin/roles/override.php b/admin/roles/override.php index eba7516c8b..1566552a20 100755 --- a/admin/roles/override.php +++ b/admin/roles/override.php @@ -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'); } @@ -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 diff --git a/admin/roles/tabs.php b/admin/roles/tabs.php index e11c5b6671..5d753c2127 100755 --- a/admin/roles/tabs.php +++ b/admin/roles/tabs.php @@ -159,48 +159,41 @@ if ($currenttab != 'update') { } +$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 @@ -209,7 +202,7 @@ if ($context->contextlevel != CONTEXT_SYSTEM) { // Print tabs for anything ex 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); } @@ -217,13 +210,11 @@ if ($context->contextlevel != CONTEXT_SYSTEM) { // Print tabs for anything ex } } - if (!empty($secondrow)) { - $tabs = array($toprow, $secondrow); - } else { - $tabs = array($toprow); - } + $inactive = array($currenttab); + + $tabs = array($toprow); print_tabs($tabs, $currenttab, $inactive, $activetwo); -} + ?> diff --git a/course/modedit.php b/course/modedit.php index 3f9cee3fa8..4bfd7d2d93 100644 --- a/course/modedit.php +++ b/course/modedit.php @@ -172,6 +172,7 @@ } } else if ($fromform = $mform->get_data()) { if (empty($fromform->coursemodule)) { //add + $cm = null; if (! $course = get_record("course", "id", $fromform->course)) { error("This course doesn't exist"); } @@ -212,16 +213,16 @@ $fromform->groupmembersonly = 0; } - if (!isset($fromform->groupmode)) { - $fromform->groupmode = 0; - } - if (!isset($fromform->name)) { //label $fromform->name = $fromform->modulename; } if (!empty($fromform->update)) { + if (!empty($course->groupmodeforce) or !isset($fromform->groupmode)) { + $fromform->groupmode = $cm->groupmode; // keep original + } + $returnfromfunc = $updateinstancefunction($fromform); if (!$returnfromfunc) { error("Could not update the $fromform->modulename", "view.php?id=$course->id"); @@ -249,6 +250,10 @@ } else if (!empty($fromform->add)){ + if (!empty($course->groupmodeforce) or !isset($fromform->groupmode)) { + $fromform->groupmode = 0; // do not set groupmode + } + if (!course_allowed_module($course,$fromform->modulename)) { error("This module ($fromform->modulename) has been disabled for this particular course"); } @@ -425,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'); } diff --git a/lang/en_utf8/admin.php b/lang/en_utf8/admin.php index 2f0349bca1..2bd26f4e0e 100644 --- a/lang/en_utf8/admin.php +++ b/lang/en_utf8/admin.php @@ -45,12 +45,12 @@ $string['clamfailureonupload'] = 'On clam AV failure'; $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 ourcollege.edu.au .gov.au'; $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.'; @@ -677,4 +677,4 @@ $string['uuupdatetype'] = 'Existing user details'; $string['validateerror'] = 'This value was not valid:'; $string['xmlstrictheaders'] = 'XML strict headers'; -?> \ No newline at end of file +?> diff --git a/lang/en_utf8/role.php b/lang/en_utf8/role.php index 2c3ae634ae..3141c4458f 100644 --- a/lang/en_utf8/role.php +++ b/lang/en_utf8/role.php @@ -84,9 +84,12 @@ $string['legacy:teacher'] = 'LEGACY ROLE: Teacher (non-editing)'; $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'; diff --git a/theme/standard/styles_layout.css b/theme/standard/styles_layout.css index 2211a2b57c..cde924f662 100644 --- a/theme/standard/styles_layout.css +++ b/theme/standard/styles_layout.css @@ -2663,8 +2663,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%;