]> git.mjollnir.org Git - moodle.git/commitdiff
user selection: MDL-17072 Polishing the role assign page:
authortjhunt <tjhunt>
Mon, 3 Nov 2008 06:06:08 +0000 (06:06 +0000)
committertjhunt <tjhunt>
Mon, 3 Nov 2008 06:06:08 +0000 (06:06 +0000)
* 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
lang/en_utf8/langconfig.php
lang/en_utf8/moodle.php
lang/en_utf8/role.php
lib/javascript-static.js
lib/moodlelib.php
theme/standard/styles_layout.css

index a072fbf1ad64bd3f57c30231a221d6e4acce0d4b..b5692c5a08c501211f4228442d46e0073e729bb7 100755 (executable)
 
 /// 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) {
         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.
 
                 $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);
             }
         }
 
 
                 $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();
 ?>
           <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'); ?>">
               <?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">
 
     } 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);
 
index d5f3d9f5c12b509ff7476a0623cba757aa324d2b..eba87d6894bfdb4fcaec0befc650e9c42899e2fd 100644 (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';
index 7a5d54f6f9921002baa85ec6ea2e1f1655e1aaa3..935b117855488c1a1725a50178598e47c4ff8f1d 100644 (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';
index b6177efd22fc5b4b5036b058683133d723d3ce63..cbc3bb388c98b9c4cd204330f50e41322dc1e442 100644 (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';
index af83e023130662a3af0bfa7cd8b595103cbfe475..3b9f0840c5d744c5e74efb1b01f6c98e49620c84 100644 (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);});
 }
 
index 2c2f49f7f31bf68ea8e87bb22a18574a0d8e886d..cbc9f7a025c3baa16409d5c890e01306789a7c75 100644 (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');
index 5fb92317a1d0a85648911d097daccb54239a44a6..6660fa97ec79453d00ea73649ae2f6b7c4cb21f2 100644 (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 {