--- loncom/interface/lonuserutils.pm 2008/09/12 04:44:13 1.67 +++ loncom/interface/lonuserutils.pm 2008/12/12 16:53:37 1.73.2.1 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Utility functions for managing LON-CAPA user accounts # -# $Id: lonuserutils.pm,v 1.67 2008/09/12 04:44:13 droeschl Exp $ +# $Id: lonuserutils.pm,v 1.73.2.1 2008/12/12 16:53:37 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; } @@ -1009,7 +1013,7 @@ sub date_setting_table { } my $perpetual = '<span class="LC_nobreak"><label><input type="checkbox" name="no_end_date"'; if (defined($endtime) && $endtime == 0) { - $perpetual .= ' checked'; + $perpetual .= ' checked="checked"'; } $perpetual.= ' /> '.&mt('no ending date').'</label></span>'; if ($mode eq 'create_enrolldates') { @@ -1295,9 +1299,13 @@ sub print_userlist { $output_selector .= "\n".$option; } $output_selector .= '</select>'; - $r->print('<label>'.&mt('Output Format: [_1]',$output_selector).'</label>'.(' 'x3)); - } - $r->print('<label>'.&mt('User Status: [_1]',$status_select).'</label>'.(' 'x3)."\n"); + $r->print('<label><span class="LC_nobreak">' + .&mt('Output Format: [_1]',$output_selector) + .'</span></label>'.(' 'x3)); + } + $r->print('<label><span class="LC_nobreak">' + .&mt('User Status: [_1]',$status_select) + .'</span></label>'.(' 'x3)."\n"); my $roleselected = ''; if ($env{'form.showrole'} eq 'Any') { $roleselected = ' selected="selected" '; @@ -1473,7 +1481,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="'. @@ -1490,7 +1501,9 @@ sub role_filter { my ($role_select); if ($context eq 'domain') { $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 { $role_select = '<select name="showrole">'."\n". '<option value="Any" '.$roleselected.'>'. @@ -1510,7 +1523,9 @@ sub role_filter { $role_select .= '<option value="'.$role.'"'.$roleselected.'>'.$plrole.'</option>'; } $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; } @@ -1893,15 +1908,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; @@ -2244,7 +2259,7 @@ END time.'_'.rand(1000000000).'.csv'; unless ($CSVfile = Apache::File->new('>/home/httpd'.$CSVfilename)) { $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. ' .'Please alert your LON-CAPA administrator.')); $CSVfile = undef; @@ -2564,12 +2579,10 @@ END $r->print(&Apache::loncommon::end_data_table().'<br />'); } elsif ($mode eq 'excel') { $excel_workbook->close(); - $r->print('<p><a href="'.$excel_filename.'">'. - &mt('Your Excel spreadsheet').'</a> '.&mt('is ready for download').'.</p>'."\n"); + $r->print(&mt('[_1]Your Excel spreadsheet[_2] is ready for download.', '<p><a href="'.$excel_filename.'">','</a>')."</p>\n"); } elsif ($mode eq 'csv') { close($CSVfile); - $r->print('<p><a href="'.$CSVfilename.'">'. - &mt('Your CSV file').'</a> '.&mt('is ready for download').'.</p>'."\n"); + $r->print(&mt('[_1]Your CSV file[_2] is ready for download.', '<p><a href="'.$CSVfilename.'">','</a>')."</p>\n"); $r->rflush(); } if ($mode eq 'autoenroll') { @@ -3027,7 +3040,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); @@ -3086,8 +3099,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') { @@ -3103,7 +3119,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); @@ -3358,17 +3374,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; @@ -3620,14 +3637,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'}};