--- loncom/interface/lonuserutils.pm 2008/09/26 08:38:11 1.70 +++ loncom/interface/lonuserutils.pm 2009/01/27 15:59:30 1.79 @@ -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.79 2009/01/27 15:59:30 schafran 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: [_1].',$distotal). + $r->print(&mt('Total number of records found in file: [_1]',''.$distotal.''). "
\n"); $r->print('

'. &mt('Identify fields in uploaded list')."

\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('

'); $r->print('
'); - $r->print(''); $r->print("

\n". ''); @@ -403,7 +403,7 @@ sub javascript_validations { name => 'The optional name field was not specified.', snum => 'The optional ID number 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.', domain => 'The optional domain field was not specified.', continue => 'Continue adding users?', @@ -743,7 +743,7 @@ sub print_upload_manager_footer { $Str .= '

'.&mt('Change authentication for existing users in domain "[_1]" to these settings?',$defdom).'   

'; } else { $Str .= "

\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'). "

\n"; } @@ -797,13 +797,17 @@ sub print_upload_manager_footer { if ($context eq 'course' || $context eq 'domain') { $Str .= &forceid_change($context); } - $Str .= '
'; + $Str .= ''; $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('

'.&list_submit_button(&mt('Display List of Users')). + "\n

\n". + ''); + return; + } if (!(($context eq 'domain') && ($env{'form.roletype'} eq 'course'))) { $r->print(' '.&list_submit_button(&mt('Update Display')). "\n

\n"); @@ -1477,7 +1487,10 @@ sub print_userlist { $permission,$env{'form.Status'},\%userlist,$keylist); } if (!$usercount) { - $r->print('
'.&mt('There are no users matching the search criteria.')); + $r->print('
' + .&mt('There are no users matching the search criteria.') + .'' + ); } } $r->print(' "role", 'type' => "enroll type/action", - 'email' => "email address", + 'email' => "e-mail address", 'photo' => "photo", 'extent' => "extent", 'pr' => "Proceed", @@ -2450,7 +2463,7 @@ END $cellentry = ''.&mt('auto').' '; $autocount ++; } else { - $cellentry = '
'.&mt('manual').'
'; + $cellentry = '
'.&mt('manual').'
'; $manualcount ++; if ($in{'lockedtype'}) { $cellentry .= ''; @@ -2459,7 +2472,7 @@ END $cellentry .= ''; $lockcount ++; } - $cellentry .= '
'; + $cellentry .= '
'; } $r->print("$cellentry\n"); } else { @@ -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 [_1]', - &Apache::loncommon::plainname($env{'user.name'},$env{'user.domain'})).':  '; + &mt('Author space for [_1]' + ,'' + .&Apache::loncommon::plainname($env{'user.name'},$env{'user.domain'}) + .'') + .':  '; 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 .= ''; $str .= "

".&mt('Upload a file containing information about users')."

\n"; $str .= &Apache::loncommon::upfile_select_html(); - $str .= "

\n"; - $str .= ''."\n"; - $str .= '

\n"; + $str .= '

'; $str .= &Apache::loncommon::help_open_topic("Course_Create_Class_List", &mt("How do I create a users list from a spreadsheet")). "
\n"; $str .= &Apache::loncommon::help_open_topic("Course_Convert_To_CSV", - &mt("How do I create a CSV file from a spreadsheet")). - "
\n"; + &mt("How do I create a CSV file from a spreadsheet")); + $str .= "

\n"; + $str .= "

\n"; + $str .= '

\n"; + $str .= ''."
\n"; $str .= &Apache::loncommon::end_page(); $r->print($str); return; @@ -3625,15 +3642,14 @@ sub upfile_drop_add { if ($entries{$fields{'username'}} ne &LONCAPA::clean_username($entries{$fields{'username'}})) { $r->print('
'. - &mt('[_1]: Unacceptable username for user [_2] [_3] [_4] [_5]', - $entries{$fields{'username'}},$fname,$mname,$lname,$gen). - ''); + &mt('[_1]: Unacceptable username for user [_2] [_3] [_4] [_5]', + ''.$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('
'. ''.$entries{$fields{'domain'}}. - ': '.&mt('Unacceptable domain for user [_2] [_3] [_4] [_5]',$fname,$mname,$lname,$gen).''); + ': '.&mt('Unacceptable domain for user [_2] [_3] [_4] [_5]',$fname,$mname,$lname,$gen)); next; } my $username = $entries{$fields{'username'}}; @@ -3646,10 +3662,10 @@ sub upfile_drop_add { $entries{$fields{'sec'}} =~ s/\W//g; my $item = $entries{$fields{'sec'}}; if ($item eq "none" || $item eq 'all') { - $r->print('
'.&mt('[_1]: 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('
'.&mt('[_1]: Unable to enroll user [_2] [_3] [_4] [_5] in a section named "[_6]" - this is a reserved word.',''.$username.'',$fname,$mname,$lname,$gen,$item)); next; } elsif (exists($curr_groups{$item})) { - $r->print('
'.&mt('[_1]: 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('
'.&mt('[_1]: 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.')); next; } else { push(@secs,$item); @@ -3661,7 +3677,7 @@ sub upfile_drop_add { if (ref($userlist{$username.':'.$userdomain}) eq 'ARRAY') { my $currsec = $userlist{$username.':'.$userdomain}[$secidx]; if ($currsec ne $env{'request.course.sec'}) { - $r->print('
'.&mt('[_1]: Unable to enroll user [_2] [_3] [_4] [_5] in a section named "[_6]".',$username,$fname,$mname,$lname,$gen,$secs[0]).'
'); + $r->print('
'.&mt('[_1]: Unable to enroll user [_2] [_3] [_4] [_5] in a section named "[_6]".',''.$username.'',$fname,$mname,$lname,$gen,$secs[0]).'
'); if ($currsec eq '') { $r->print(&mt('This user already has an active/future student role in the course, unaffiliated to any section.')); @@ -3711,8 +3727,13 @@ sub upfile_drop_add { } if ($role eq '') { my $rolestr = join(', ',@permitted_roles); - $r->print('
'. - &mt('[_1]: You do not have permission to add the requested role [_2] for the user.',$entries{$fields{'username'}},$entries{$fields{'role'}}).'
'.&mt('Allowable role(s) is/are: [_1].',$rolestr)."\n"); + $r->print('
' + .&mt('[_1]: You do not have permission to add the requested role [_2] for the user.' + ,''.$entries{$fields{'username'}}.'' + ,$entries{$fields{'role'}}) + .'
' + .&mt('Allowable role(s) is/are: [_1].',$rolestr)."\n" + ); next; } } @@ -3872,15 +3893,15 @@ sub upfile_drop_add { } else { if ($context eq 'course') { $r->print('
'. - &mt('[_1]: Unable to enroll. No password specified.',$username) + &mt('[_1]: Unable to enroll. No password specified.',''.$username.'') ); } elsif ($context eq 'author') { $r->print('
'. - &mt('[_1]: Unable to add co-author. No password specified.',$username) + &mt('[_1]: Unable to add co-author. No password specified.',''.$username.'') ); } else { $r->print('
'. - &mt('[_1]: Unable to add user. No password specified.',$username) + &mt('[_1]: Unable to add user. No password specified.',''.$username.'') ); } } @@ -3983,7 +4004,7 @@ sub user_change_result { if ($userresult =~ /^error:(.+)$/) { my $error = $1; $r->print('
'. - &mt('[_1]: Unable to add/modify: [_2]',$username.':'.$userdomain,$error)); + &mt('[_1]: Unable to add/modify: [_2]',''.$username.':'.$userdomain.'',$error)); } } else { $counts->{'user'} ++; @@ -3993,7 +4014,7 @@ sub user_change_result { if ($authresult =~ /^error:(.+)$/) { my $error = $1; $r->print('
'. - &mt('[_1]: Unable to modify authentication: [_2]',$username.':'.$userdomain,$error)); + &mt('[_1]: Unable to modify authentication: [_2]',''.$username.':'.$userdomain.'',$error)); } } else { $counts->{'auth'} ++; @@ -4003,7 +4024,7 @@ sub user_change_result { if ($roleresult =~ /^error:(.+)$/) { my $error = $1; $r->print('
'. - &mt('[_1]: Unable to add role: [_2]',$username.':'.$userdomain,$error)); + &mt('[_1]: Unable to add role: [_2]',''.$username.':'.$userdomain.'',$error)); } } else { $counts->{'role'} ++; @@ -4273,7 +4294,7 @@ sub update_user_list { $r->print('

'.&mt("$result_text{'ok'}{$choice} role(s) for [quant,_1,user,users,no users].",$count).'

'); if ($count > 0) { if ($choice eq 'revoke' || $choice eq 'drop') { - $r->print('

'.&mt('Re-enabling will re-activate data for the role.

')); + $r->print('

'.&mt('Re-enabling will re-activate data for the role.').'

'); } # Flush the course logs so reverse user roles immediately updated &Apache::lonnet::flushcourselogs();