--- loncom/interface/lonuserutils.pm 2008/09/26 08:38:11 1.70 +++ loncom/interface/lonuserutils.pm 2009/01/05 17:03:13 1.73.2.2 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Utility functions for managing LON-CAPA user accounts # -# $Id: lonuserutils.pm,v 1.70 2008/09/26 08:38:11 bisitz Exp $ +# $Id: lonuserutils.pm,v 1.73.2.2 2009/01/05 17:03:13 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -329,7 +329,7 @@ sub print_upload_manager_header { $env{'request.role.domain'},$context, $groupslist); 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"); $r->print('<div class="LC_left_float"><h3>'. &mt('Identify fields in uploaded list')."</h3>\n"); @@ -341,11 +341,11 @@ sub print_upload_manager_header { &hidden_input('fileupload',$env{'form.fileupload'}). &hidden_input('upfiletype',$env{'form.upfiletype'}). &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').'" '. 'name="Reverse Association" '. '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". '<script type="text/javascript" language="Javascript">'."\n". $javascript."\n".$javascript_validations.'</script>'); @@ -743,7 +743,7 @@ sub print_upload_manager_footer { $Str .= '<p>'.&mt('Change authentication for existing users in domain "[_1]" to these settings?',$defdom).' <span class="LC_nobreak"><label><input type="radio" name="changeauth" value="No" checked="checked" />'.&mt('No').'</label> <label><input type="radio" name="changeauth" value="Yes" />'.&mt('Yes').'</label></span></p>'; } else { $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'). "</p>\n"; } @@ -797,13 +797,17 @@ sub print_upload_manager_footer { if ($context eq 'course' || $context eq 'domain') { $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 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); return; } @@ -1312,6 +1316,12 @@ sub print_userlist { ($cnum,$cdom) = &get_course_identity(); $r->print(§ion_group_filter($cnum,$cdom)); } + if ($env{'form.phase'} eq '') { + $r->print('<br /><br />'.&list_submit_button(&mt('Display List of Users')). + "\n</p>\n". + '<input type="hidden" name="phase" value="" /></form>'); + return; + } if (!(($context eq 'domain') && ($env{'form.roletype'} eq 'course'))) { $r->print(' '.&list_submit_button(&mt('Update Display')). "\n</p>\n"); @@ -1477,7 +1487,10 @@ sub print_userlist { $permission,$env{'form.Status'},\%userlist,$keylist); } 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="'. @@ -1901,15 +1914,15 @@ sub aggregate_user_info { sub process_date_info { my ($userdata) = @_; my $now = time; - $userdata->{'status'} = 'Active'; + $userdata->{'status'} = &mt('Active'); if ($userdata->{'start'} > 0) { if ($now < $userdata->{'start'}) { - $userdata->{'status'} = 'Future'; + $userdata->{'status'} = &mt('Future'); } } if ($userdata->{'end'} > 0) { if ($now > $userdata->{'end'}) { - $userdata->{'status'} = 'Expired'; + $userdata->{'status'} = &mt('Expired'); } } return; @@ -3033,7 +3046,7 @@ sub results_header_row { } if ($context eq 'course') { 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') { $description .= &mt('Users in course with expired [_1] roles',$showfilter); @@ -3092,8 +3105,11 @@ sub results_header_row { } } elsif ($context eq 'author') { $description = - &mt('Author space for <span class="LC_cusr_emph">[_1]</span>', - &Apache::loncommon::plainname($env{'user.name'},$env{'user.domain'})).': '; + &mt('Author space for [_1]' + ,'<span class="LC_cusr_emph">' + .&Apache::loncommon::plainname($env{'user.name'},$env{'user.domain'}) + .'</span>') + .': '; if ($statusmode eq 'Expired') { $description .= &mt('Co-authors with expired [_1] roles',$showfilter); } elsif ($statusmode eq 'Future') { @@ -3109,7 +3125,7 @@ sub results_header_row { } } elsif ($context eq 'domain') { 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 ($statusmode eq 'Expired') { $description .= &mt('Users in domain with expired [_1] roles',$showfilter); @@ -3364,17 +3380,18 @@ sub print_first_users_upload_form { $str .= '<input type="hidden" name="state" value="got_file" />'; $str .= "<h3>".&mt('Upload a file containing information about users')."</h3>\n"; $str .= &Apache::loncommon::upfile_select_html(); - $str .= "<p>\n"; - $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 .= '<p>'; $str .= &Apache::loncommon::help_open_topic("Course_Create_Class_List", &mt("How do I create a users list from a spreadsheet")). "<br />\n"; $str .= &Apache::loncommon::help_open_topic("Course_Convert_To_CSV", - &mt("How do I create a CSV file from a spreadsheet")). - "<br />\n"; + &mt("How do I create a CSV file from a spreadsheet")); + $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(); $r->print($str); return; @@ -3626,14 +3643,13 @@ sub upfile_drop_add { ne &LONCAPA::clean_username($entries{$fields{'username'}})) { $r->print('<br />'. &mt('<b>[_1]</b>: Unacceptable username for user [_2] [_3] [_4] [_5]', - $entries{$fields{'username'}},$fname,$mname,$lname,$gen). - '</b>'); + $entries{$fields{'username'}},$fname,$mname,$lname,$gen)); next; } else { - if ($entries{$fields{'dom'}} + if ($entries{$fields{'domain'}} ne &LONCAPA::clean_domain($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)); next; } my $username = $entries{$fields{'username'}};