[LON-CAPA-cvs] cvs: loncom /interface lonuserutils.pm

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Sat, 22 Dec 2007 04:23:06 -0000


raeburn		Fri Dec 21 23:23:06 2007 EDT

  Modified files:              
    /loncom/interface	lonuserutils.pm 
  Log:
  - Some wording changes for assignment of defaults on second user list upload screen.
  - &build_user_record() adding $context as first arg where it was missing.
  - in user list display in context=domain, roletype=course, only display user's record   if course has section status matching status filter.
  - add ? to message in pop-ups to confirm bulkaction on selected users. 
  
  
Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.24 loncom/interface/lonuserutils.pm:1.25
--- loncom/interface/lonuserutils.pm:1.24	Fri Dec 21 22:38:26 2007
+++ loncom/interface/lonuserutils.pm	Fri Dec 21 23:23:05 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utility functions for managing LON-CAPA user accounts
 #
-# $Id: lonuserutils.pm,v 1.24 2007/12/22 03:38:26 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.25 2007/12/22 04:23:05 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -738,13 +738,13 @@
     }
     if ($context eq 'author') {
         $Str .= '<h3>'.&mt('Default role')."</h3>\n".
-                &mt('Choose the role to assign to users without one specified in the uploaded file');
+                &mt('Choose the role to assign to users without a value specified in the uploaded file');
     } elsif ($context eq 'course') {
         $Str .= '<h3>'.&mt('Default role and section')."</h3>\n".
-                &mt('Choose the role and/or section to assign to users without one specified in the uploaded file');
+                &mt('Choose the role and/or section(s) to assign to users without values specified in the uploaded file');
     } else {
-        $Str .= '<br /><br /><b>'.&mt('Default role and/or section')."</b><br />\n".
-                &mt('Role and/or section for users without one in the uploaded file.');
+        $Str .= '<br /><br /><b>'.&mt('Default role and/or section(s)')."</b><br />\n".
+                &mt('Role and/or section(s) for users without values specified in the uploaded file.');
     }
     $Str .= '<br />';
     if (($context eq 'domain') || ($context eq 'author')) {
@@ -786,13 +786,14 @@
         "<p>\n".'<label><input type="checkbox" name="forceid" value="yes">'.
         &mt('Disable ID/Student Number Safeguard and Force Change '.
         'of Conflicting IDs').'</label><br />'."\n".
-        &mt('(only do if you know what you are doing.)')."</br><br />\n";
+        &mt('(only do if you know what you are doing.)')."\n";
     if ($context eq 'domain') {
-        $output .= '<label><input type="checkbox" name="recurseid"'.
+        $output .= '<br /><label><input type="checkbox" name="recurseid"'.
                    ' value="yes">'. 
   &mt('Update ID/Student Number in courses in which user is Active/Future student,<br />(if forcing change).').
-                   '</label></p>'."\n";
+                   '</label>'."\n";
     }
+    $output .= '</p>';
     return $output;
 }
 
@@ -962,7 +963,7 @@
             ($env{'form.action'} eq 'upload')) {
             if ($env{'request.course.sec'} eq '') {
                 $dateDefault = '<span class="LC_nobreak">'.
-                    '<label><input type="checkbox" name="makedatesdefault" /> '.
+                    '<label><input type="checkbox" name="makedatesdefault" value="1" /> '.
                     &mt('make these dates the default access dates for future student enrollment').
                     '</label></span>';
             }
@@ -1001,14 +1002,14 @@
                 {'default_enrollment_start_date'=>$startdate,
                  'default_enrollment_end_date'  =>$enddate},$cdom,$cnum);
         if ($put_result eq 'ok') {
-            $result .= &mt('Set default start and end dates for course').
+            $result .= &mt('Set default start and end access dates for course.').
                        '<br />'."\n";
             #
             # Refresh the course environment
             &Apache::lonnet::coursedescription($env{'request.course.id'},
                                                {'freshen_cache' => 1});
         } else {
-            $result .= &mt('Unable to set default dates for course').":".$put_result.
+            $result .= &mt('Unable to set default access dates for course.').":".$put_result.
                        '<br />';
         }
     }
@@ -1289,7 +1290,8 @@
         $r->print('<label>'.&mt('Role: [_1]',$role_select).'</label>');
     }
     if (!(($context eq 'domain') && ($env{'form.roletype'} eq 'course'))) {
-        $r->print(&list_submit_button(&mt('Update Display'))."\n</p>\n");
+        $r->print('&nbsp;'.&list_submit_button(&mt('Update Display')).
+                  "\n</p>\n");
     }
     my ($indexhash,$keylist) = &make_keylist_array();
     my (%userlist,%userinfo);
@@ -1506,8 +1508,8 @@
                         ($userdata{'start'},$userdata{'end'}) = 
                             split(/:/,$rolehash->{$item}{$key});
                         my $uniqid = $key.':'.$item;
-                        &build_user_record($context,\%userdata,$userinfo,$indexhash,
-                                           $uniqid,$userlist);
+                        &build_user_record($context,\%userdata,$userinfo,
+                                           $indexhash,$uniqid,$userlist);
                     }
                 }
             } elsif ($env{'form.roletype'} eq 'course') {
@@ -1525,9 +1527,9 @@
                                 # FIXME: actions on courses disabled for now
 #                                if ($permission->{'cusr'}) {
 #                                    if ($numcids > 1) {
-#                                        $spanstart .= '<input type="radio" name="'.$item.'" value="'.$cid.'" &nbsp; />';
+#                                        $spanstart .= '<input type="radio" name="'.$item.'" value="'.$cid.'" />&nbsp;';
 #                                    } else {
-#                                        $spanstart .= '<input type="hidden" name="'.$item.'" value="'.$cid.'" &nbsp; />';
+#                                        $spanstart .= '<input type="hidden" name="'.$item.'" value="'.$cid.'" />&nbsp;';
 #                                    }
 #                                }
                                 $spanend = '</span><br />';
@@ -1537,14 +1539,20 @@
                                     $rolehash->{$item}{$cid}{'desc'}.$space;
                             if (ref($rolehash->{$item}{$cid}{'secs'}) eq 'HASH') { 
                                 foreach my $sec (sort(keys(%{$rolehash->{$item}{$cid}{'secs'}}))) {
-                                    $userdata{'extent'} .= $sec.$space.$rolehash->{$item}{$cid}{'secs'}{$sec}.$spanend;
+                                    if (($env{'form.Status'} eq 'Any') ||
+                                        ($env{'form.Status'} eq $rolehash->{$item}{$cid}{'secs'}{$sec})) {
+                                        $userdata{'extent'} .= $sec.$space.$rolehash->{$item}{$cid}{'secs'}{$sec}.$spanend;
+                                        $userdata{'status'} = $rolehash->{$item}{$cid}{'secs'}{$sec};
+                                    }
                                 }
                             }
                         }
                     }
                 }
-                &build_user_record($context,\%userdata,$userinfo,$indexhash,
-                                   $item,$userlist);
+                if ($userdata{'status'} ne '') {
+                    &build_user_record($context,\%userdata,$userinfo,
+                                       $indexhash,$item,$userlist);
+                }
             }
         }
     }
@@ -1850,8 +1858,8 @@
     if ($mode ne 'autoenroll') {
         my $check_uncheck_js = &Apache::loncommon::check_uncheck_jscript();
         my $alert = &mt("You must select at least one user by checking a user's 'Select' checkbox");
-        my $singconfirm = &mt(' for a single user');
-        my $multconfirm = &mt(' for multiple users');
+        my $singconfirm = &mt(' for a single user?');
+        my $multconfirm = &mt(' for multiple users?');
         my $date_sec_selector = &date_section_javascript($context,$setting,$statusmode); 
         $r->print(<<END);