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'.
This commit is contained in:
tjhunt 2008-11-03 06:06:08 +00:00
parent 5f1ae48d2c
commit c9f8e118c9
7 changed files with 75 additions and 32 deletions

View file

@ -79,32 +79,43 @@
/// Build the list of options for the enrolment period dropdown. /// Build the list of options for the enrolment period dropdown.
$unlimitedperiod = get_string('unlimited'); $unlimitedperiod = get_string('unlimited');
$defaultperiod = $course->enrolperiod;
for ($i=1; $i<=365; $i++) { for ($i=1; $i<=365; $i++) {
$seconds = $i * 86400; $seconds = $i * 86400;
$periodmenu[$seconds] = get_string('numdays', '', $i); $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. /// Build the list of options for the starting from dropdown.
$timeformat = get_string('strftimedate'); $timeformat = get_string('strftimedatefullshort');
$today = time(); $today = time();
$today = make_timestamp(date('Y', $today), date('m', $today), date('d', $today), 0, 0, 0); $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. // MDL-12420, preventing course start date showing up as an option at system context and front page roles.
if ($course->startdate > 0) { 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)) { if ($course->enrollable != 2 || ($course->enrolstartdate == 0 || $course->enrolstartdate <= $today) && ($course->enrolenddate == 0 || $course->enrolenddate > $today)) {
$basemenu[3] = get_string('today') . ' (' . userdate($today, $timeformat) . ')' ; $basemenu[3] = get_string('today') . ' (' . userdate($today, $timeformat) . ')' ;
} }
if($course->enrollable == 2) { if($course->enrollable == 2) {
if($course->enrolstartdate > 0) { 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) { 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 /// Print the header and tabs
if ($context->contextlevel == CONTEXT_USER) { if ($context->contextlevel == CONTEXT_USER) {
@ -150,18 +161,6 @@
include_once('tabs.php'); 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. if ($roleid) { /// UI for assigning a particular role.
/// Create the user selector objects. /// Create the user selector objects.
@ -232,6 +231,8 @@
$rolename = $DB->get_field('role', 'name', array('id'=>$roleid)); $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); 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)); $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); 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. /// Print the form.
check_theme_arrows(); check_theme_arrows();
?> ?>
@ -279,6 +293,8 @@
<div id="addcontrols"> <div id="addcontrols">
<input name="add" id="add" type="submit" value="<?php echo $THEME->larrow.'&nbsp;'.get_string('add'); ?>" title="<?php print_string('add'); ?>" /><br /> <input name="add" id="add" type="submit" value="<?php echo $THEME->larrow.'&nbsp;'.get_string('add'); ?>" title="<?php print_string('add'); ?>" /><br />
<?php print_collapsible_region_start('', 'assignoptions', get_string('assignmentoptions', 'role'),
'assignoptionscollapse', true); ?>
<p><input type="checkbox" name="hidden" id="hidden" value="1" <?php <p><input type="checkbox" name="hidden" id="hidden" value="1" <?php
if ($hidden) { echo 'checked="checked" '; } ?>/> if ($hidden) { echo 'checked="checked" '; } ?>/>
<label for="hidden" title="<?php print_string('createhiddenassign', 'role'); ?>"> <label for="hidden" title="<?php print_string('createhiddenassign', 'role'); ?>">
@ -290,7 +306,8 @@
<?php choose_from_menu($periodmenu, "extendperiod", $defaultperiod, $unlimitedperiod); ?></p> <?php choose_from_menu($periodmenu, "extendperiod", $defaultperiod, $unlimitedperiod); ?></p>
<p><label for="extendbase"><?php print_string('startingfrom') ?></label><br /> <p><label for="extendbase"><?php print_string('startingfrom') ?></label><br />
<?php choose_from_menu($basemenu, "extendbase", 3, ""); ?></p> <?php choose_from_menu($basemenu, "extendbase", $defaultbase, ""); ?></p>
<?php print_collapsible_region_end(); ?>
</div> </div>
<div id="removecontrols"> <div id="removecontrols">
@ -328,6 +345,17 @@
} else { // Print overview table } 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 instruction
print_heading(get_string('chooseroletoassign', 'role'), 'center', 3); print_heading(get_string('chooseroletoassign', 'role'), 'center', 3);

View file

@ -13,6 +13,7 @@ $string['localewincharset'] = '';
$string['oldcharset'] = 'ISO-8859-1'; $string['oldcharset'] = 'ISO-8859-1';
$string['strftimedate'] = '%%d %%B %%Y'; $string['strftimedate'] = '%%d %%B %%Y';
$string['strftimedateshort'] = '%%d %%B'; $string['strftimedateshort'] = '%%d %%B';
$string['strftimedatefullshort'] = '%%d/%%m/%%y';
$string['strftimedatetime'] = '%%d %%B %%Y, %%I:%%M %%p'; $string['strftimedatetime'] = '%%d %%B %%Y, %%I:%%M %%p';
$string['strftimedatetimeshort'] = '%%d/%%m/%%y, %%H:%%M'; $string['strftimedatetimeshort'] = '%%d/%%m/%%y, %%H:%%M';
$string['strftimedaydate'] = '%%A, %%d %%B %%Y'; $string['strftimedaydate'] = '%%A, %%d %%B %%Y';

View file

@ -302,9 +302,10 @@ $string['courserequestsuccess'] = 'Successfully saved your course request. Expec
$string['courserestore'] = 'Course restore'; $string['courserestore'] = 'Course restore';
$string['courses'] = 'Courses'; $string['courses'] = 'Courses';
$string['coursescategory'] = 'Courses in the same category'; $string['coursescategory'] = 'Courses in the same category';
$string['coursesmovedout'] = 'Courses moved out from $a';
$string['coursesettings'] = 'Course default settings'; $string['coursesettings'] = 'Course default settings';
$string['coursesmovedout'] = 'Courses moved out from $a';
$string['coursespending'] = 'Courses pending approval'; $string['coursespending'] = 'Courses pending approval';
$string['coursestart'] = 'Course start';
$string['coursestaught'] = 'Courses I have taught'; $string['coursestaught'] = 'Courses I have taught';
$string['courseupdates'] = 'Course updates'; $string['courseupdates'] = 'Course updates';
$string['courseuploadlimit'] = 'Course upload limit'; $string['courseuploadlimit'] = 'Course upload limit';
@ -625,7 +626,9 @@ $string['expirythreshold'] = 'Threshold';
$string['explanation'] = 'Explanation'; $string['explanation'] = 'Explanation';
$string['extendenrol'] = 'Extend enrolment (individual)'; $string['extendenrol'] = 'Extend enrolment (individual)';
$string['groupextendenrol'] = 'Extend enrolment (common)'; $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['courseenrolenddate'] = 'Course enrolment end date';
$string['startingfrom'] = 'Starting from'; $string['startingfrom'] = 'Starting from';
$string['extendperiod'] = 'Extended period'; $string['extendperiod'] = 'Extended period';

View file

@ -11,8 +11,10 @@ $string['assignanotherrole'] = 'Assign another role';
$string['assignerror'] = 'Error while assigning the role $a->role to user $a->user.'; $string['assignerror'] = 'Error while assigning the role $a->role to user $a->user.';
$string['assignroles'] = 'Assign roles'; $string['assignroles'] = 'Assign roles';
$string['assignrolesin'] = 'Assign roles in $a'; $string['assignrolesin'] = 'Assign roles in $a';
$string['assignrolenameincontext'] = 'Assign role \'$a->role\' in $a->context';
$string['assignglobalroles'] = 'Assign system roles'; $string['assignglobalroles'] = 'Assign system roles';
$string['assignmentcontext'] = 'Assignment context'; $string['assignmentcontext'] = 'Assignment context';
$string['assignmentoptions'] = 'Assignment options';
$string['backtoallroles'] = 'Back to the list of all roles'; $string['backtoallroles'] = 'Back to the list of all roles';
$string['blog:create'] = 'Create new blog entries'; $string['blog:create'] = 'Create new blog entries';
$string['blog:manageentries'] = 'Edit and manage entries'; $string['blog:manageentries'] = 'Edit and manage entries';

View file

@ -638,11 +638,10 @@ function collapsible_region(id, userpref, strtooltip) {
} else { } else {
this.icon.src = moodle_cfg.pixpath + '/t/expanded.png'; this.icon.src = moodle_cfg.pixpath + '/t/expanded.png';
} }
this.caption.appendChild(this.icon); a.appendChild(this.icon);
// Hook up the event handler. // Hook up the event handler.
self = this; 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);}); YAHOO.util.Event.addListener(a, 'click', function(e) {self.handle_click(e);});
} }

View file

@ -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 /// originally these special strings were stored in moodle.php now we are only in langconfig.php
$langconfigstrs = array('alphabet', 'backupnameformat', 'decsep', 'firstdayofweek', 'listsep', 'locale', $langconfigstrs = array('alphabet', 'backupnameformat', 'decsep', 'firstdayofweek', 'listsep', 'locale',
'localewin', 'localewincharset', 'oldcharset', 'localewin', 'localewincharset', 'oldcharset', 'parentlanguage',
'parentlanguage', 'strftimedate', 'strftimedateshort', 'strftimedatetime', 'strftimedate', 'strftimedateshort', 'strftimedatefullshort', 'strftimedatetime',
'strftimedaydate', 'strftimedaydatetime', 'strftimedayshort', 'strftimedaytime', 'strftimedaydate', 'strftimedaydatetime', 'strftimedayshort', 'strftimedaytime',
'strftimemonthyear', 'strftimerecent', 'strftimerecentfull', 'strftimetime', 'strftimemonthyear', 'strftimerecent', 'strftimerecentfull', 'strftimetime',
'thischarset', 'thisdirection', 'thislanguage', 'strftimedatetimeshort'); 'thischarset', 'thisdirection', 'thislanguage', 'strftimedatetimeshort');

View file

@ -217,10 +217,14 @@ div.groupselector {
.collapsibleregion { .collapsibleregion {
overflow: hidden; overflow: hidden;
padding: 1px;
}
.collapsibleregioncaption img {
vertical-align: middle;
} }
div.collapsibleregion div.collapsibleregioncaption a { div.collapsibleregion div.collapsibleregioncaption a {
color: inherit; color: inherit;
text-decoration: none; text-decoration: none;
} }
.noticebox { .noticebox {
@ -1046,22 +1050,22 @@ body#admin-modules table.generaltable td.c0
} }
.roleassigntable td { .roleassigntable td {
vertical-align: middle; vertical-align: middle;
padding: 0 0.3em 1em; padding: 0.2em 0.3em;
} }
.roleassigntable p { .roleassigntable p {
text-align: left; text-align: left;
margin-bottom: 0.2em; margin: 0.2em 0;
} }
.roleassigntable #existingcell, .roleassigntable #existingcell,
.roleassigntable #potentialcell { .roleassigntable #potentialcell {
width: 38%; width: 42%;
} }
.roleassigntable #existingcell label, .roleassigntable #existingcell label,
.roleassigntable #potentialcell label { .roleassigntable #potentialcell label {
font-weight: bold; font-weight: bold;
} }
.roleassigntable #buttonscell { .roleassigntable #buttonscell {
width: 24%; width: 16%;
} }
.roleassigntable #buttonscell #add, .roleassigntable #buttonscell #add,
.roleassigntable #buttonscell #remove { .roleassigntable #buttonscell #remove {
@ -1072,8 +1076,14 @@ body#admin-modules table.generaltable td.c0
.roleassigntable #buttonscell p { .roleassigntable #buttonscell p {
margin: 0.3em 0; margin: 0.3em 0;
} }
.roleassigntable #buttonscell #remove { .roleassigntable #buttonscell #assignoptions {
margin-top: 5em; font-size: 0.75em;
}
.roleassigntable #buttonscell #assignoptions .collapsibleregioncaption {
font-weight: bold;
}
.roleassigntable #buttonscell #addcontrols {
height: 13em;
} }
.roleassigntable #removeselect_wrapper, .roleassigntable #removeselect_wrapper,
.roleassigntable #addselect_wrapper { .roleassigntable #addselect_wrapper {