From c9f8e118c9b53f5a08b14f524290c907dd9ab285 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Mon, 3 Nov 2008 06:06:08 +0000 Subject: [PATCH] user selection: MDL-17072 Polishing the role assign page: * Make the role being assigned clear in the title * Make the options in the middle of the page be in a collapsable options section, collapsed by default. * Put them in a smaller font too. * Switch the date selectors here to use a shorter date format, and change 'Course start date' to 'Course start'. --- admin/roles/assign.php | 64 +++++++++++++++++++++++--------- lang/en_utf8/langconfig.php | 1 + lang/en_utf8/moodle.php | 7 +++- lang/en_utf8/role.php | 2 + lib/javascript-static.js | 3 +- lib/moodlelib.php | 4 +- theme/standard/styles_layout.css | 26 +++++++++---- 7 files changed, 75 insertions(+), 32 deletions(-) diff --git a/admin/roles/assign.php b/admin/roles/assign.php index a072fbf1ad..b5692c5a08 100755 --- a/admin/roles/assign.php +++ b/admin/roles/assign.php @@ -79,32 +79,43 @@ /// Build the list of options for the enrolment period dropdown. $unlimitedperiod = get_string('unlimited'); - $defaultperiod = $course->enrolperiod; for ($i=1; $i<=365; $i++) { $seconds = $i * 86400; $periodmenu[$seconds] = get_string('numdays', '', $i); } +/// Work out the apropriate default setting. + if ($extendperiod) { + $defaultperiod = $extendperiod; + } else { + $defaultperiod = $course->enrolperiod; + } /// Build the list of options for the starting from dropdown. - $timeformat = get_string('strftimedate'); + $timeformat = get_string('strftimedatefullshort'); $today = time(); $today = make_timestamp(date('Y', $today), date('m', $today), date('d', $today), 0, 0, 0); // MDL-12420, preventing course start date showing up as an option at system context and front page roles. if ($course->startdate > 0) { - $basemenu[0] = get_string('startdate') . ' (' . userdate($course->startdate, $timeformat) . ')'; + $basemenu[0] = get_string('coursestart') . ' (' . userdate($course->startdate, $timeformat) . ')'; } if ($course->enrollable != 2 || ($course->enrolstartdate == 0 || $course->enrolstartdate <= $today) && ($course->enrolenddate == 0 || $course->enrolenddate > $today)) { $basemenu[3] = get_string('today') . ' (' . userdate($today, $timeformat) . ')' ; } if($course->enrollable == 2) { if($course->enrolstartdate > 0) { - $basemenu[4] = get_string('courseenrolstartdate') . ' (' . userdate($course->enrolstartdate, $timeformat) . ')'; + $basemenu[4] = get_string('courseenrolstart') . ' (' . userdate($course->enrolstartdate, $timeformat) . ')'; } if($course->enrolenddate > 0) { - $basemenu[5] = get_string('courseenrolenddate') . ' (' . userdate($course->enrolenddate, $timeformat) . ')'; + $basemenu[5] = get_string('courseenrolend') . ' (' . userdate($course->enrolenddate, $timeformat) . ')'; } } +/// Work out the apropriate default setting. + if ($extendbase) { + $defaultbase = $extendbase; + } else { + $defaultbase = 3; + } /// Print the header and tabs if ($context->contextlevel == CONTEXT_USER) { @@ -150,18 +161,6 @@ include_once('tabs.php'); } -/// Print heading. - if ($isfrontpage) { - print_heading_with_help(get_string('frontpageroles', 'admin'), 'assignroles'); - } else { - print_heading_with_help(get_string('assignrolesin', 'role', $contextname), 'assignroles'); - } - -/// Print a warning if we are assigning system roles. - if ($context->contextlevel == CONTEXT_SYSTEM) { - print_box(get_string('globalroleswarning', 'role')); - } - if ($roleid) { /// UI for assigning a particular role. /// Create the user selector objects. @@ -232,6 +231,8 @@ $rolename = $DB->get_field('role', 'name', array('id'=>$roleid)); add_to_log($course->id, 'role', 'assign', 'admin/roles/assign.php?contextid='.$context->id.'&roleid='.$roleid, $rolename, '', $USER->id); + // Counts have changed, so reload. + list($assignableroles, $assigncounts, $nameswithcounts) = get_assignable_roles($context, ROLENAME_BOTH, true); } } @@ -260,9 +261,22 @@ $rolename = $DB->get_field('role', 'name', array('id'=>$roleid)); add_to_log($course->id, 'role', 'unassign', 'admin/roles/assign.php?contextid='.$context->id.'&roleid='.$roleid, $rolename, '', $USER->id); + // Counts have changed, so reload. + list($assignableroles, $assigncounts, $nameswithcounts) = get_assignable_roles($context, ROLENAME_BOTH, true); } } + /// Print heading. + $a = new stdClass; + $a->role = $assignableroles[$roleid]; + $a->context = $contextname; + print_heading_with_help(get_string('assignrolenameincontext', 'role', $a), 'assignroles'); + + /// Print a warning if we are assigning system roles. + if ($context->contextlevel == CONTEXT_SYSTEM) { + print_box(get_string('globalroleswarning', 'role')); + } + /// Print the form. check_theme_arrows(); ?> @@ -279,6 +293,8 @@

+

/>


-

+

+
@@ -328,6 +345,17 @@ } else { // Print overview table + if ($isfrontpage) { + print_heading_with_help(get_string('frontpageroles', 'admin'), 'assignroles'); + } else { + print_heading_with_help(get_string('assignrolesin', 'role', $contextname), 'assignroles'); + } + + // Print a warning if we are assigning system roles. + if ($context->contextlevel == CONTEXT_SYSTEM) { + print_box(get_string('globalroleswarning', 'role')); + } + // Print instruction print_heading(get_string('chooseroletoassign', 'role'), 'center', 3); diff --git a/lang/en_utf8/langconfig.php b/lang/en_utf8/langconfig.php index d5f3d9f5c1..eba87d6894 100644 --- a/lang/en_utf8/langconfig.php +++ b/lang/en_utf8/langconfig.php @@ -13,6 +13,7 @@ $string['localewincharset'] = ''; $string['oldcharset'] = 'ISO-8859-1'; $string['strftimedate'] = '%%d %%B %%Y'; $string['strftimedateshort'] = '%%d %%B'; +$string['strftimedatefullshort'] = '%%d/%%m/%%y'; $string['strftimedatetime'] = '%%d %%B %%Y, %%I:%%M %%p'; $string['strftimedatetimeshort'] = '%%d/%%m/%%y, %%H:%%M'; $string['strftimedaydate'] = '%%A, %%d %%B %%Y'; diff --git a/lang/en_utf8/moodle.php b/lang/en_utf8/moodle.php index 7a5d54f6f9..935b117855 100644 --- a/lang/en_utf8/moodle.php +++ b/lang/en_utf8/moodle.php @@ -302,9 +302,10 @@ $string['courserequestsuccess'] = 'Successfully saved your course request. Expec $string['courserestore'] = 'Course restore'; $string['courses'] = 'Courses'; $string['coursescategory'] = 'Courses in the same category'; -$string['coursesmovedout'] = 'Courses moved out from $a'; $string['coursesettings'] = 'Course default settings'; +$string['coursesmovedout'] = 'Courses moved out from $a'; $string['coursespending'] = 'Courses pending approval'; +$string['coursestart'] = 'Course start'; $string['coursestaught'] = 'Courses I have taught'; $string['courseupdates'] = 'Course updates'; $string['courseuploadlimit'] = 'Course upload limit'; @@ -625,7 +626,9 @@ $string['expirythreshold'] = 'Threshold'; $string['explanation'] = 'Explanation'; $string['extendenrol'] = 'Extend enrolment (individual)'; $string['groupextendenrol'] = 'Extend enrolment (common)'; -$string['courseenrolstartdate'] = 'Course enrolment start date'; +$string['courseenrolstart'] = 'Course enrolment start'; +$string['courseenrolstartdate'] = 'Course enrolment start'; +$string['courseenrolend'] = 'Course enrolment end'; $string['courseenrolenddate'] = 'Course enrolment end date'; $string['startingfrom'] = 'Starting from'; $string['extendperiod'] = 'Extended period'; diff --git a/lang/en_utf8/role.php b/lang/en_utf8/role.php index b6177efd22..cbc3bb388c 100644 --- a/lang/en_utf8/role.php +++ b/lang/en_utf8/role.php @@ -11,8 +11,10 @@ $string['assignanotherrole'] = 'Assign another role'; $string['assignerror'] = 'Error while assigning the role $a->role to user $a->user.'; $string['assignroles'] = 'Assign roles'; $string['assignrolesin'] = 'Assign roles in $a'; +$string['assignrolenameincontext'] = 'Assign role \'$a->role\' in $a->context'; $string['assignglobalroles'] = 'Assign system roles'; $string['assignmentcontext'] = 'Assignment context'; +$string['assignmentoptions'] = 'Assignment options'; $string['backtoallroles'] = 'Back to the list of all roles'; $string['blog:create'] = 'Create new blog entries'; $string['blog:manageentries'] = 'Edit and manage entries'; diff --git a/lib/javascript-static.js b/lib/javascript-static.js index af83e02313..3b9f0840c5 100644 --- a/lib/javascript-static.js +++ b/lib/javascript-static.js @@ -638,11 +638,10 @@ function collapsible_region(id, userpref, strtooltip) { } else { this.icon.src = moodle_cfg.pixpath + '/t/expanded.png'; } - this.caption.appendChild(this.icon); + a.appendChild(this.icon); // Hook up the event handler. self = this; - YAHOO.util.Event.addListener(this.caption, 'click', function(e) {self.handle_click(e);}); YAHOO.util.Event.addListener(a, 'click', function(e) {self.handle_click(e);}); } diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 2c2f49f7f3..cbc9f7a025 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -5282,8 +5282,8 @@ function get_string($identifier, $module='', $a=NULL, $extralocations=NULL) { /// originally these special strings were stored in moodle.php now we are only in langconfig.php $langconfigstrs = array('alphabet', 'backupnameformat', 'decsep', 'firstdayofweek', 'listsep', 'locale', - 'localewin', 'localewincharset', 'oldcharset', - 'parentlanguage', 'strftimedate', 'strftimedateshort', 'strftimedatetime', + 'localewin', 'localewincharset', 'oldcharset', 'parentlanguage', + 'strftimedate', 'strftimedateshort', 'strftimedatefullshort', 'strftimedatetime', 'strftimedaydate', 'strftimedaydatetime', 'strftimedayshort', 'strftimedaytime', 'strftimemonthyear', 'strftimerecent', 'strftimerecentfull', 'strftimetime', 'thischarset', 'thisdirection', 'thislanguage', 'strftimedatetimeshort'); diff --git a/theme/standard/styles_layout.css b/theme/standard/styles_layout.css index 5fb92317a1..6660fa97ec 100644 --- a/theme/standard/styles_layout.css +++ b/theme/standard/styles_layout.css @@ -217,10 +217,14 @@ div.groupselector { .collapsibleregion { overflow: hidden; + padding: 1px; +} +.collapsibleregioncaption img { + vertical-align: middle; } div.collapsibleregion div.collapsibleregioncaption a { - color: inherit; - text-decoration: none; + color: inherit; + text-decoration: none; } .noticebox { @@ -1046,22 +1050,22 @@ body#admin-modules table.generaltable td.c0 } .roleassigntable td { vertical-align: middle; - padding: 0 0.3em 1em; + padding: 0.2em 0.3em; } .roleassigntable p { text-align: left; - margin-bottom: 0.2em; + margin: 0.2em 0; } .roleassigntable #existingcell, .roleassigntable #potentialcell { - width: 38%; + width: 42%; } .roleassigntable #existingcell label, .roleassigntable #potentialcell label { font-weight: bold; } .roleassigntable #buttonscell { - width: 24%; + width: 16%; } .roleassigntable #buttonscell #add, .roleassigntable #buttonscell #remove { @@ -1072,8 +1076,14 @@ body#admin-modules table.generaltable td.c0 .roleassigntable #buttonscell p { margin: 0.3em 0; } -.roleassigntable #buttonscell #remove { - margin-top: 5em; +.roleassigntable #buttonscell #assignoptions { + font-size: 0.75em; +} +.roleassigntable #buttonscell #assignoptions .collapsibleregioncaption { + font-weight: bold; +} +.roleassigntable #buttonscell #addcontrols { + height: 13em; } .roleassigntable #removeselect_wrapper, .roleassigntable #addselect_wrapper { -- 2.39.5