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.
$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 @@
<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 />
<?php print_collapsible_region_start('', 'assignoptions', get_string('assignmentoptions', 'role'),
'assignoptionscollapse', true); ?>
<p><input type="checkbox" name="hidden" id="hidden" value="1" <?php
if ($hidden) { echo 'checked="checked" '; } ?>/>
<label for="hidden" title="<?php print_string('createhiddenassign', 'role'); ?>">
@ -290,7 +306,8 @@
<?php choose_from_menu($periodmenu, "extendperiod", $defaultperiod, $unlimitedperiod); ?></p>
<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 id="removecontrols">
@ -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);

View file

@ -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';

View file

@ -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';

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['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';

View file

@ -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);});
}

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
$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');

View file

@ -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 {