Diff for /loncom/interface/lonuserutils.pm between versions 1.66 and 1.75

version 1.66, 2008/09/12 00:55:37 version 1.75, 2008/12/06 20:32:37
Line 329  sub print_upload_manager_header { Line 329  sub print_upload_manager_header {
                                 $env{'request.role.domain'},$context,                                  $env{'request.role.domain'},$context,
                                 $groupslist);                                  $groupslist);
     my $checked=(($env{'form.noFirstLine'})?' checked="checked" ':'');      my $checked=(($env{'form.noFirstLine'})?' checked="checked" ':'');
     $r->print(&mt('Total number of records found in file: <b>[_1]</b>.',$distotal).      $r->print(&mt('Total number of records found in file: [_1]','<b>'.$distotal.'</b>').
               "<br />\n");                "<br />\n");
     $r->print('<div class="LC_left_float"><h3>'.      $r->print('<div class="LC_left_float"><h3>'.
               &mt('Identify fields in uploaded list')."</h3>\n");                &mt('Identify fields in uploaded list')."</h3>\n");
Line 341  sub print_upload_manager_header { Line 341  sub print_upload_manager_header {
               &hidden_input('fileupload',$env{'form.fileupload'}).                &hidden_input('fileupload',$env{'form.fileupload'}).
               &hidden_input('upfiletype',$env{'form.upfiletype'}).                &hidden_input('upfiletype',$env{'form.upfiletype'}).
               &hidden_input('upfile_associate',$env{'form.upfile_associate'}));                &hidden_input('upfile_associate',$env{'form.upfile_associate'}));
       $r->print('<br /><label><input type="checkbox" name="noFirstLine"'.$checked.'/>'.
                 &mt('Ignore First Line').'</label><br />');
     $r->print('<br /><input type="button" value="'.&mt('Reverse Association').'" '.      $r->print('<br /><input type="button" value="'.&mt('Reverse Association').'" '.
               'name="Reverse Association" '.                'name="Reverse Association" '.
               'onClick="javascript:this.form.associate.value=\'Reverse Association\';submit(this.form);" />');                'onClick="javascript:this.form.associate.value=\'Reverse Association\';submit(this.form);" />');
     $r->print('<label><input type="checkbox" name="noFirstLine"'.$checked.'/>'.  
               &mt('Ignore First Line').'</label>');  
     $r->print("<br /><br />\n".      $r->print("<br /><br />\n".
               '<script type="text/javascript" language="Javascript">'."\n".                '<script type="text/javascript" language="Javascript">'."\n".
               $javascript."\n".$javascript_validations.'</script>');                $javascript."\n".$javascript_validations.'</script>');
Line 403  sub javascript_validations { Line 403  sub javascript_validations {
          name     => 'The optional name field was not specified.',           name     => 'The optional name field was not specified.',
          snum     => 'The optional ID number field was not specified.',           snum     => 'The optional ID number field was not specified.',
          section  => 'The optional section field was not specified.',           section  => 'The optional section field was not specified.',
          email    => 'The optional email address field was not specified.',           email    => 'The optional e-mail address field was not specified.',
          role     => 'The optional role field was not specified.',           role     => 'The optional role field was not specified.',
          domain   => 'The optional domain field was not specified.',           domain   => 'The optional domain field was not specified.',
          continue => 'Continue adding users?',           continue => 'Continue adding users?',
Line 743  sub print_upload_manager_footer { Line 743  sub print_upload_manager_footer {
         $Str .= '<p>'.&mt('Change authentication for existing users in domain "[_1]" to these settings?',$defdom).'&nbsp;<span class="LC_nobreak"><label><input type="radio" name="changeauth" value="No" checked="checked" />'.&mt('No').'</label>&nbsp;&nbsp;<label><input type="radio" name="changeauth" value="Yes" />'.&mt('Yes').'</label></span></p>';           $Str .= '<p>'.&mt('Change authentication for existing users in domain "[_1]" to these settings?',$defdom).'&nbsp;<span class="LC_nobreak"><label><input type="radio" name="changeauth" value="No" checked="checked" />'.&mt('No').'</label>&nbsp;&nbsp;<label><input type="radio" name="changeauth" value="Yes" />'.&mt('Yes').'</label></span></p>'; 
     } else {      } else {
         $Str .= "<p>\n".          $Str .= "<p>\n".
             &mt('Note: this will not take effect if the user already exists').              &mt('Note: This will not take effect if the user already exists.').
             &Apache::loncommon::help_open_topic('Auth_Options').              &Apache::loncommon::help_open_topic('Auth_Options').
             "</p>\n";              "</p>\n";
     }      }
Line 797  sub print_upload_manager_footer { Line 797  sub print_upload_manager_footer {
     if ($context eq 'course' || $context eq 'domain') {      if ($context eq 'course' || $context eq 'domain') {
         $Str .= &forceid_change($context);          $Str .= &forceid_change($context);
     }      }
     $Str .= '</div><div class="LC_clear_float_footer"><br /><input type="button"'.  
               'onClick="javascript:verify(this.form,this.form.csec)" '.  
         'value="'.&mt('Update Users').'" />'."<br />\n";  
     if ($context eq 'course') {  
         $Str .= &mt('Note: for large courses, this operation may be time consuming');  
     }  
     $Str .= '</div>';      $Str .= '</div>';
       $Str .= '<div class="LC_clear_float_footer">';
       if ($context eq 'course') {
           $Str .= '<div class="LC_info">'
                  .&mt('Note: For large courses, this operation may be time consuming.')
                  .'</div>';
       }
       $Str .= '<input type="button"'
              .'onClick="javascript:verify(this.form,this.form.csec)" '
              .'value="'.&mt('Update Users').'" />'."\n"
              .'</div>';
     $r->print($Str);      $r->print($Str);
     return;      return;
 }  }
Line 1009  sub date_setting_table { Line 1013  sub date_setting_table {
     }      }
     my $perpetual = '<span class="LC_nobreak"><label><input type="checkbox" name="no_end_date"';      my $perpetual = '<span class="LC_nobreak"><label><input type="checkbox" name="no_end_date"';
     if (defined($endtime) && $endtime == 0) {      if (defined($endtime) && $endtime == 0) {
         $perpetual .= ' checked';          $perpetual .= ' checked="checked"';
     }      }
     $perpetual.= ' /> '.&mt('no ending date').'</label></span>';      $perpetual.= ' /> '.&mt('no ending date').'</label></span>';
     if ($mode eq 'create_enrolldates') {      if ($mode eq 'create_enrolldates') {
Line 1295  sub print_userlist { Line 1299  sub print_userlist {
             $output_selector .= "\n".$option;              $output_selector .= "\n".$option;
         }          }
         $output_selector .= '</select>';          $output_selector .= '</select>';
         $r->print('<label>'.&mt('Output Format: [_1]',$output_selector).'</label>'.('&nbsp;'x3));          $r->print('<label><span class="LC_nobreak">'
     }                   .&mt('Output Format: [_1]',$output_selector)
     $r->print('<label>'.&mt('User Status: [_1]',$status_select).'</label>'.('&nbsp;'x3)."\n");                   .'</span></label>'.('&nbsp;'x3));
       }
       $r->print('<label><span class="LC_nobreak">'
                .&mt('User Status: [_1]',$status_select)
                .'</span></label>'.('&nbsp;'x3)."\n");
     my $roleselected = '';      my $roleselected = '';
     if ($env{'form.showrole'} eq 'Any') {      if ($env{'form.showrole'} eq 'Any') {
        $roleselected = ' selected="selected" ';          $roleselected = ' selected="selected" '; 
Line 1473  sub print_userlist { Line 1481  sub print_userlist {
                                $permission,$env{'form.Status'},\%userlist,$keylist);                                 $permission,$env{'form.Status'},\%userlist,$keylist);
         }          }
         if (!$usercount) {          if (!$usercount) {
             $r->print('<br />'.&mt('There are no users matching the search criteria.'));               $r->print('<br /><span class="LC_warning">'
                        .&mt('There are no users matching the search criteria.')
                        .'</span>'
               ); 
         }          }
     }      }
     $r->print('<input type="hidden" name="phase" value="'.      $r->print('<input type="hidden" name="phase" value="'.
Line 1490  sub role_filter { Line 1501  sub role_filter {
     my ($role_select);      my ($role_select);
     if ($context eq 'domain') {      if ($context eq 'domain') {
         $role_select = &domain_roles_select();          $role_select = &domain_roles_select();
         $output = '<label>'.&mt('Role Type: [_1]',$role_select).'</label>';          $output = '<label><span class="LC_nobreak">'
                    .&mt('Role Type: [_1]',$role_select)
                    .'</span></label>';
     } else {      } else {
         $role_select = '<select name="showrole">'."\n".          $role_select = '<select name="showrole">'."\n".
                        '<option value="Any" '.$roleselected.'>'.                         '<option value="Any" '.$roleselected.'>'.
Line 1510  sub role_filter { Line 1523  sub role_filter {
             $role_select .= '<option value="'.$role.'"'.$roleselected.'>'.$plrole.'</option>';              $role_select .= '<option value="'.$role.'"'.$roleselected.'>'.$plrole.'</option>';
         }          }
         $role_select .= '</select>';          $role_select .= '</select>';
         $output = '<label>'.&mt('Role: [_1]',$role_select).'</label>';          $output = '<label><span class="LC_nobreak">'
                    .&mt('Role: [_1]',$role_select)
                    .'</span></label>';
     }      }
     return $output;      return $output;
 }  }
Line 1893  sub aggregate_user_info { Line 1908  sub aggregate_user_info {
 sub process_date_info {  sub process_date_info {
     my ($userdata) = @_;      my ($userdata) = @_;
     my $now = time;      my $now = time;
     $userdata->{'status'} = 'Active';      $userdata->{'status'} = &mt('Active');
     if ($userdata->{'start'} > 0) {      if ($userdata->{'start'} > 0) {
         if ($now < $userdata->{'start'}) {          if ($now < $userdata->{'start'}) {
             $userdata->{'status'} = 'Future';              $userdata->{'status'} = &mt('Future');
         }          }
     }      }
     if ($userdata->{'end'} > 0) {      if ($userdata->{'end'} > 0) {
         if ($now > $userdata->{'end'}) {          if ($now > $userdata->{'end'}) {
             $userdata->{'status'} = 'Expired';              $userdata->{'status'} = &mt('Expired');
         }          }
     }      }
     return;      return;
Line 2046  END Line 2061  END
                        'aboutme'    => "Display a user's personal page",                         'aboutme'    => "Display a user's personal page",
                        'owin'       => "Open in a new window",                         'owin'       => "Open in a new window",
                        'modify'     => "Modify a user's information",                         'modify'     => "Modify a user's information",
                          'clicker'    => "Clicker-ID",
                       );                        );
     if ($context eq 'domain' && $env{'form.roletype'} eq 'course') {      if ($context eq 'domain' && $env{'form.roletype'} eq 'course') {
         $lt{'extent'} = &mt('Course(s): description, section(s), status');          $lt{'extent'} = &mt('Course(s): description, section(s), status');
Line 2243  END Line 2259  END
                        time.'_'.rand(1000000000).'.csv';                         time.'_'.rand(1000000000).'.csv';
         unless ($CSVfile = Apache::File->new('>/home/httpd'.$CSVfilename)) {          unless ($CSVfile = Apache::File->new('>/home/httpd'.$CSVfilename)) {
             $r->log_error("Couldn't open $CSVfilename for output $!");              $r->log_error("Couldn't open $CSVfilename for output $!");
             $r->print(&mt('Problems occurred in writing the csv file. '              $r->print(&mt('Problems occurred in writing the CSV file. '
                          .'This error has been logged. '                           .'This error has been logged. '
                          .'Please alert your LON-CAPA administrator.'));                           .'Please alert your LON-CAPA administrator.'));
             $CSVfile = undef;              $CSVfile = undef;
         }          }
         #          #
           push @cols,'clicker';
         # Write headers and data to file          # Write headers and data to file
         print $CSVfile '"'.$results_description.'"'."\n";           print $CSVfile '"'.$results_description.'"'."\n"; 
         print $CSVfile '"'.join('","',map {          print $CSVfile '"'.join('","',map {
             &Apache::loncommon::csv_translate($lt{$_})              &Apache::loncommon::csv_translate($lt{$_})
             } (@cols)).'"'."\n";              } (@cols))."\"\n";
     } elsif ($mode eq 'excel') {      } elsif ($mode eq 'excel') {
           push @cols,'clicker';
         # Create the excel spreadsheet          # Create the excel spreadsheet
         ($excel_workbook,$excel_filename,$format) =          ($excel_workbook,$excel_filename,$format) =
             &Apache::loncommon::create_workbook($r);              &Apache::loncommon::create_workbook($r);
Line 2263  END Line 2281  END
         $excel_sheet->write($row++,0,$results_description,$format->{'h2'});          $excel_sheet->write($row++,0,$results_description,$format->{'h2'});
         #          #
         my @colnames = map {$lt{$_}} (@cols);          my @colnames = map {$lt{$_}} (@cols);
   
         $excel_sheet->write($row++,0,\@colnames,$format->{'bold'});          $excel_sheet->write($row++,0,\@colnames,$format->{'bold'});
     }      }
   
Line 2414  END Line 2433  END
         foreach my $item (@{$keylist}) {          foreach my $item (@{$keylist}) {
             $in{$item} = $sdata->[$index{$item}];              $in{$item} = $sdata->[$index{$item}];
         }          }
         my $role = $in{'role'};          my $clickers = (&Apache::lonnet::userenvironment($in{'domain'},$in{'username'},'clickers'))[1];
           if ($clickers!~/\w/) { $clickers='-'; }
           $in{'clicker'} = $clickers; 
    my $role = $in{'role'};
         $in{'role'}=&Apache::lonnet::plaintext($sdata->[$index{'role'}]);           $in{'role'}=&Apache::lonnet::plaintext($sdata->[$index{'role'}]); 
         if (! defined($in{'start'}) || $in{'start'} == 0) {          if (! defined($in{'start'}) || $in{'start'} == 0) {
             $in{'start'} = &mt('none');              $in{'start'} = &mt('none');
Line 2534  END Line 2556  END
             foreach my $item (@cols) {              foreach my $item (@cols) {
                 push @line,&Apache::loncommon::csv_translate($in{$item});                  push @line,&Apache::loncommon::csv_translate($in{$item});
             }              }
             print $CSVfile '"'.join('","',@line).'"'."\n";              print $CSVfile '"'.join('","',@line)."\"\n";
         } elsif ($mode eq 'excel') {          } elsif ($mode eq 'excel') {
             my $col = 0;              my $col = 0;
             foreach my $item (@cols) {              foreach my $item (@cols) {
Line 2557  END Line 2579  END
             $r->print(&Apache::loncommon::end_data_table().'<br />');              $r->print(&Apache::loncommon::end_data_table().'<br />');
     } elsif ($mode eq 'excel') {      } elsif ($mode eq 'excel') {
         $excel_workbook->close();          $excel_workbook->close();
         $r->print('<p><a href="'.$excel_filename.'">'.   $r->print(&mt('[_1]Your Excel spreadsheet[_2] is ready for download.', '<p><a href="'.$excel_filename.'">','</a>')."</p>\n");
                   &mt('Your Excel spreadsheet').'</a> '.&mt('is ready for download').'.</p>'."\n");  
     } elsif ($mode eq 'csv') {      } elsif ($mode eq 'csv') {
         close($CSVfile);          close($CSVfile);
         $r->print('<p><a href="'.$CSVfilename.'">'.   $r->print(&mt('[_1]Your CSV file[_2] is ready for download.', '<p><a href="'.$CSVfilename.'">','</a>')."</p>\n");
                   &mt('Your CSV file').'</a> '.&mt('is ready for download').'.</p>'."\n");  
         $r->rflush();          $r->rflush();
     }      }
     if ($mode eq 'autoenroll') {      if ($mode eq 'autoenroll') {
Line 3020  sub results_header_row { Line 3040  sub results_header_row {
     }      }
     if ($context eq 'course') {      if ($context eq 'course') {
         if ($mode eq 'csv' || $mode eq 'excel') {          if ($mode eq 'csv' || $mode eq 'excel') {
             $description = &mt('Course - ').$env{'course.'.$env{'request.course.id'}.'.description'}.': ';              $description = &mt('Course - [_1]:',$env{'course.'.$env{'request.course.id'}.'.description'}).' ';
         }          }
         if ($statusmode eq 'Expired') {          if ($statusmode eq 'Expired') {
             $description .= &mt('Users in course with expired [_1] roles',$showfilter);              $description .= &mt('Users in course with expired [_1] roles',$showfilter);
Line 3079  sub results_header_row { Line 3099  sub results_header_row {
         }           } 
     } elsif ($context eq 'author') {      } elsif ($context eq 'author') {
         $description =           $description = 
             &mt('Author space for <span class="LC_cusr_emph">[_1]</span>',              &mt('Author space for [_1]'
         &Apache::loncommon::plainname($env{'user.name'},$env{'user.domain'})).':&nbsp;&nbsp;';                  ,'<span class="LC_cusr_emph">'
                   .&Apache::loncommon::plainname($env{'user.name'},$env{'user.domain'})
                   .'</span>')
               .':&nbsp;&nbsp;';
         if ($statusmode eq 'Expired') {          if ($statusmode eq 'Expired') {
             $description .= &mt('Co-authors with expired [_1] roles',$showfilter);              $description .= &mt('Co-authors with expired [_1] roles',$showfilter);
         } elsif ($statusmode eq 'Future') {          } elsif ($statusmode eq 'Future') {
Line 3096  sub results_header_row { Line 3119  sub results_header_row {
         }          }
     } elsif ($context eq 'domain') {      } elsif ($context eq 'domain') {
         my $domdesc = &Apache::lonnet::domain($env{'request.role.domain'},'description');          my $domdesc = &Apache::lonnet::domain($env{'request.role.domain'},'description');
         $description = &mt('Domain - ').$domdesc.': ';          $description = &mt('Domain - [_1]:',$domdesc).' ';
         if ($env{'form.roletype'} eq 'domain') {          if ($env{'form.roletype'} eq 'domain') {
             if ($statusmode eq 'Expired') {              if ($statusmode eq 'Expired') {
                 $description .= &mt('Users in domain with expired [_1] roles',$showfilter);                  $description .= &mt('Users in domain with expired [_1] roles',$showfilter);
Line 3351  sub print_first_users_upload_form { Line 3374  sub print_first_users_upload_form {
     $str .= '<input type="hidden"   name="state"  value="got_file" />';      $str .= '<input type="hidden"   name="state"  value="got_file" />';
     $str .= "<h3>".&mt('Upload a file containing information about users')."</h3>\n";      $str .= "<h3>".&mt('Upload a file containing information about users')."</h3>\n";
     $str .= &Apache::loncommon::upfile_select_html();      $str .= &Apache::loncommon::upfile_select_html();
     $str .= "<p>\n";      $str .= '<p>';
     $str .= '<input type="submit" name="fileupload" value="'.  
         &mt('Upload file of users').'">'."\n";  
     $str .= '<label><input type="checkbox" name="noFirstLine" /> '.  
         &mt('Ignore First Line')."</label></p>\n";  
     $str .= &Apache::loncommon::help_open_topic("Course_Create_Class_List",      $str .= &Apache::loncommon::help_open_topic("Course_Create_Class_List",
                          &mt("How do I create a users list from a spreadsheet")).                           &mt("How do I create a users list from a spreadsheet")).
                              "<br />\n";                               "<br />\n";
     $str .= &Apache::loncommon::help_open_topic("Course_Convert_To_CSV",      $str .= &Apache::loncommon::help_open_topic("Course_Convert_To_CSV",
                            &mt("How do I create a CSV file from a spreadsheet")).                             &mt("How do I create a CSV file from a spreadsheet"));
                                "<br />\n";      $str .= "</p>\n";
       $str .= "<p>\n";
       $str .= '<label><input type="checkbox" name="noFirstLine" /> '.
           &mt('Ignore First Line')."</label></p>\n";
       $str .= '<input type="submit" name="fileupload" value="'.
           &mt('Go to next step').'">'."<br />\n";
     $str .= &Apache::loncommon::end_page();      $str .= &Apache::loncommon::end_page();
     $r->print($str);      $r->print($str);
     return;      return;
Line 3612  sub upfile_drop_add { Line 3636  sub upfile_drop_add {
                 if ($entries{$fields{'username'}}                  if ($entries{$fields{'username'}}
                     ne &LONCAPA::clean_username($entries{$fields{'username'}})) {                      ne &LONCAPA::clean_username($entries{$fields{'username'}})) {
                     $r->print('<br />'.                      $r->print('<br />'.
       &mt('<b>[_1]</b>: Unacceptable username for user [_2] [_3] [_4] [_5]',        &mt('[_1]: Unacceptable username for user [_2] [_3] [_4] [_5]',
           $entries{$fields{'username'}},$fname,$mname,$lname,$gen).            '<b>'.$entries{$fields{'username'}}.'</b>',$fname,$mname,$lname,$gen).
                               '</b>');                                '</b>');
                     next;                      next;
                 } else {                  } else {
                     if ($entries{$fields{'dom'}}                       if ($entries{$fields{'domain'}} 
                         ne &LONCAPA::clean_domain($entries{$fields{'domain'}})) {                          ne &LONCAPA::clean_domain($entries{$fields{'domain'}})) {
                         $r->print('<br />'. '<b>'.$entries{$fields{'domain'}}.                          $r->print('<br />'. '<b>'.$entries{$fields{'domain'}}.
                                   '</b>: '.&mt('Unacceptable domain for user [_2] [_3] [_4] [_5]',$fname,$mname,$lname,$gen).'</b>');                                    '</b>: '.&mt('Unacceptable domain for user [_2] [_3] [_4] [_5]',$fname,$mname,$lname,$gen).'</b>');
Line 3633  sub upfile_drop_add { Line 3657  sub upfile_drop_add {
                             $entries{$fields{'sec'}} =~ s/\W//g;                              $entries{$fields{'sec'}} =~ s/\W//g;
                             my $item = $entries{$fields{'sec'}};                              my $item = $entries{$fields{'sec'}};
                             if ($item eq "none" || $item eq 'all') {                              if ($item eq "none" || $item eq 'all') {
                                 $r->print('<br />'.&mt('<b>[_1]</b>: Unable to enroll user [_2] [_3] [_4] [_5] in a section named "[_6]" - this is a reserved word.',$username,$fname,$mname,$lname,$gen,$item));                                  $r->print('<br />'.&mt('[_1]: Unable to enroll user [_2] [_3] [_4] [_5] in a section named "[_6]" - this is a reserved word.','<b>'.$username.'</b>',$fname,$mname,$lname,$gen,$item));
                                 next;                                  next;
                             } elsif (exists($curr_groups{$item})) {                              } elsif (exists($curr_groups{$item})) {
                                 $r->print('<br />'.&mt('<b>[_1]</b>: Unable to enroll user [_2] [_3] [_4] [_5] in a section named "[_6]" - this is a course group.',$username,$fname,$mname,$lname,$gen,$item).' '.&mt('Section names and group names must be distinct.'));                                  $r->print('<br />'.&mt('[_1]: Unable to enroll user [_2] [_3] [_4] [_5] in a section named "[_6]" - this is a course group.','<b>'.$username.'</b>',$fname,$mname,$lname,$gen,$item).' '.&mt('Section names and group names must be distinct.'));
                                 next;                                  next;
                             } else {                              } else {
                                 push(@secs,$item);                                  push(@secs,$item);
Line 3648  sub upfile_drop_add { Line 3672  sub upfile_drop_add {
                         if (ref($userlist{$username.':'.$userdomain}) eq 'ARRAY') {                          if (ref($userlist{$username.':'.$userdomain}) eq 'ARRAY') {
                             my $currsec = $userlist{$username.':'.$userdomain}[$secidx];                              my $currsec = $userlist{$username.':'.$userdomain}[$secidx];
                             if ($currsec ne $env{'request.course.sec'}) {                              if ($currsec ne $env{'request.course.sec'}) {
                                 $r->print('<br />'.&mt('<b>[_1]</b>: Unable to enroll user [_2] [_3] [_4] [_5] in a section named "[_6]".',$username,$fname,$mname,$lname,$gen,$secs[0]).'<br />');                                  $r->print('<br />'.&mt('[_1]: Unable to enroll user [_2] [_3] [_4] [_5] in a section named "[_6]".','<b>'.$username.'</b>',$fname,$mname,$lname,$gen,$secs[0]).'<br />');
                                 if ($currsec eq '') {                                  if ($currsec eq '') {
                                     $r->print(&mt('This user already has an active/future student role in the course, unaffiliated to any section.'));                                      $r->print(&mt('This user already has an active/future student role in the course, unaffiliated to any section.'));
   
Line 3698  sub upfile_drop_add { Line 3722  sub upfile_drop_add {
                             }                              }
                             if ($role eq '') {                              if ($role eq '') {
                                 my $rolestr = join(', ',@permitted_roles);                                  my $rolestr = join(', ',@permitted_roles);
                                 $r->print('<br />'.                                  $r->print('<br />'
       &mt('<b>[_1]</b>: You do not have permission to add the requested role [_2] for the user.',$entries{$fields{'username'}},$entries{$fields{'role'}}).'<br />'.&mt('Allowable role(s) is/are: [_1].',$rolestr)."\n");                                           .&mt('[_1]: You do not have permission to add the requested role [_2] for the user.'
                                                ,'<b>'.$entries{$fields{'username'}}.'</b>'
                                                ,$entries{$fields{'role'}})
                                            .'<br />'
                                            .&mt('Allowable role(s) is/are: [_1].',$rolestr)."\n"
                                   );
                                 next;                                  next;
                             }                              }
                         }                          }
Line 3859  sub upfile_drop_add { Line 3888  sub upfile_drop_add {
                     } else {                      } else {
                         if ($context eq 'course') {                          if ($context eq 'course') {
                             $r->print('<br />'.                               $r->print('<br />'. 
       &mt('<b>[_1]</b>: Unable to enroll.  No password specified.',$username)        &mt('[_1]: Unable to enroll. No password specified.','<b>'.$username.'</b>')
                                      );                                       );
                         } elsif ($context eq 'author') {                          } elsif ($context eq 'author') {
                             $r->print('<br />'.                              $r->print('<br />'.
       &mt('<b>[_1]</b>: Unable to add co-author.  No password specified.',$username)        &mt('[_1]: Unable to add co-author. No password specified.','<b>'.$username.'</b>')
                                      );                                       );
                         } else {                          } else {
                             $r->print('<br />'.                              $r->print('<br />'.
       &mt('<b>[_1]</b>: Unable to add user.  No password specified.',$username)        &mt('[_1]: Unable to add user. No password specified.','<b>'.$username.'</b>')
                                      );                                       );
                         }                          }
                     }                      }
Line 3970  sub user_change_result { Line 3999  sub user_change_result {
         if ($userresult =~ /^error:(.+)$/) {          if ($userresult =~ /^error:(.+)$/) {
             my $error = $1;              my $error = $1;
             $r->print('<br />'.              $r->print('<br />'.
                   &mt('<b>[_1]</b>:  Unable to add/modify: [_2]',$username.':'.$userdomain,$error));                    &mt('[_1]: Unable to add/modify: [_2]','<b>'.$username.':'.$userdomain.'</b>',$error));
         }          }
     } else {      } else {
         $counts->{'user'} ++;          $counts->{'user'} ++;
Line 3980  sub user_change_result { Line 4009  sub user_change_result {
         if ($authresult =~ /^error:(.+)$/) {          if ($authresult =~ /^error:(.+)$/) {
             my $error = $1;              my $error = $1;
             $r->print('<br />'.              $r->print('<br />'.
                   &mt('<b>[_1]</b>:  Unable to modify authentication: [_2]',$username.':'.$userdomain,$error));                    &mt('[_1]: Unable to modify authentication: [_2]','<b>'.$username.':'.$userdomain.'</b>',$error));
         }           } 
     } else {      } else {
         $counts->{'auth'} ++;          $counts->{'auth'} ++;
Line 3990  sub user_change_result { Line 4019  sub user_change_result {
         if ($roleresult =~ /^error:(.+)$/) {          if ($roleresult =~ /^error:(.+)$/) {
             my $error = $1;              my $error = $1;
             $r->print('<br />'.              $r->print('<br />'.
                   &mt('<b>[_1]</b>:  Unable to add role: [_2]',$username.':'.$userdomain,$error));                    &mt('[_1]: Unable to add role: [_2]','<b>'.$username.':'.$userdomain.'</b>',$error));
         }          }
     } else {      } else {
         $counts->{'role'} ++;          $counts->{'role'} ++;
Line 4260  sub update_user_list { Line 4289  sub update_user_list {
     $r->print('<p><b>'.&mt("$result_text{'ok'}{$choice} role(s) for [quant,_1,user,users,no users].",$count).'</b></p>');      $r->print('<p><b>'.&mt("$result_text{'ok'}{$choice} role(s) for [quant,_1,user,users,no users].",$count).'</b></p>');
     if ($count > 0) {      if ($count > 0) {
         if ($choice eq 'revoke' || $choice eq 'drop') {          if ($choice eq 'revoke' || $choice eq 'drop') {
             $r->print('<p>'.&mt('Re-enabling will re-activate data for the role.</p>'));              $r->print('<p>'.&mt('Re-enabling will re-activate data for the role.').'</p>');
         }          }
         # Flush the course logs so reverse user roles immediately updated          # Flush the course logs so reverse user roles immediately updated
         &Apache::lonnet::flushcourselogs();          &Apache::lonnet::flushcourselogs();

Removed from v.1.66  
changed lines
  Added in v.1.75


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>