--- loncom/interface/lonuserutils.pm 2012/10/04 13:41:10 1.143 +++ loncom/interface/lonuserutils.pm 2013/02/05 16:22:27 1.148 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Utility functions for managing LON-CAPA user accounts # -# $Id: lonuserutils.pm,v 1.143 2012/10/04 13:41:10 bisitz Exp $ +# $Id: lonuserutils.pm,v 1.148 2013/02/05 16:22:27 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -335,13 +335,22 @@ sub print_upload_manager_header { $env{'request.role.domain'},$context, $groupslist,$crstype); my $checked=(($env{'form.noFirstLine'})?' checked="checked"':''); - $r->print('

' - .&mt('Total number of records found in file: [_1]' - ,''.$distotal.'') - ."

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

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

\n"); - $r->print(&mt('Enter as many fields as you can.
The system will inform you and bring you back to this page,
if the data selected are insufficient to add users.')."
\n"); + $r->print( + '

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

\n". + '

'. + &mt('Total number of records found in file: [_1]' + ,''.$distotal.''). + "

\n" + ); + if ($distotal == 0) { + $r->print('

'.&mt('None found').'

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

'. + &mt('Enter as many fields as you can.').'
'. + &mt('The system will inform you and bring you back to this page,[_1]if the data selected are insufficient to add users.','
'). + "

\n" + ); $r->print(&hidden_input('action','upload'). &hidden_input('state','got_file'). &hidden_input('associate',''). @@ -349,17 +358,23 @@ 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('
print( + '
'. + '
'.&mt('Functions').''. + ''. + ' '); - $r->print("

\n". - ''); + 'onclick="javascript:this.form.associate.value=\'Reverse Association\';submit(this.form);" />'. + '

' + ); + $r->print( + '' + ); } ############################################################### @@ -603,7 +618,7 @@ sub upload_manager_javascript_forward_as $numbuttons ++; } if (!$can_assign->{'int'}) { - my $warning = &mt('You may not specify an initial password for each user, as this is only available when new users use LON-CAPA internal authentication.\n'). + my $warning = &mt('You may not specify an initial password for each user, as this is only available when new users use LON-CAPA internal authentication.').'\n' &mt('Your current role does not have rights to create users with that authentication type.'); $auth_update = <<"END"; // Currently the initial password field is only supported for internal auth @@ -1082,7 +1097,6 @@ sub print_upload_manager_form { $keyfields=join(',',sort(keys(%sone))); } } - $r->print('
'); &print_upload_manager_footer($r,$i,$keyfields,$defdom,$today,$halfyear, $context,$permission,$crstype); } @@ -1553,12 +1567,10 @@ sub print_userlist { &Apache::lonhtmlcommon::course_selection($formname,$numcodes, $codetitles,$idlist,$idlist_titles,$crstype, \@standardnames); - $r->print('

'.&Apache::lonhtmlcommon::start_pick_box()."\n". - &Apache::lonhtmlcommon::start_pick_box()."\n". - &Apache::lonhtmlcommon::row_title($title,'LC_oddrow_value')."\n". + $r->print('

'. + '
'.$title.''."\n". $courseform."\n". - &Apache::lonhtmlcommon::row_closure(1). - &Apache::lonhtmlcommon::end_pick_box().'

'. + '

'. '

'. &list_submit_button(&mt('Update Display')). "\n".'

'.$warning.''."\n"); @@ -1568,10 +1580,10 @@ sub print_userlist { $clearcoursepick = 1; } if (($env{'form.coursepick'}) && (!$clearcoursepick)) { - $r->print('
'.&mt('Searching').' ...
 
'); + $r->print('
'.&mt('Searching ...').'
 
'); } } else { - $r->print('
'.&mt('Searching').' ...
'); + $r->print('
'.&mt('Searching ...').'
'); } $r->rflush(); if ($context eq 'course') { @@ -1707,7 +1719,7 @@ sub print_userlist { } elsif ($context eq 'course') { $r->print(&mt('There are no course users to display.')."\n"); } - $r->print('

'."\n") if $msg; + $r->print('

'.$msg.'

'."\n") if $msg; } else { # Print out the available choices my $usercount; @@ -1907,8 +1919,8 @@ sub column_checkboxes { if ($env{'form.Status'} ne 'Any') { $disabledchk{'status'} = 1; } - if ($env{'form.showrole'} ne 'Any') { - $disabledchk{'role'} = 1; + if (($env{'form.showrole'} ne 'Any') && ($env{'form.showrole'} ne 'cr')) { + $disabledchk{'role'} = 1; } } my $numposs = scalar(@cols); @@ -2579,7 +2591,11 @@ END if ($env{'form.userwin'}) { $checkwin = ' checked="checked"'; } - $output .= ''.$lt{'owin'}.''; + $output .= + '' + .''; } $output .= "\n".'
'."\n". &Apache::loncommon::start_data_table(). @@ -3818,16 +3834,17 @@ sub print_first_users_upload_form { $str .= ''; $str .= ''; + $str .= &Apache::grades::checkforfile_js(); + $str .= '

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

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

'."\n"; + ."
\n"; $str .= &Apache::lonhtmlcommon::start_pick_box() .&Apache::lonhtmlcommon::row_title(&mt('File')); if (&Apache::lonlocal::current_language() ne 'en') { @@ -3848,7 +3865,8 @@ sub print_first_users_upload_form { .&Apache::lonhtmlcommon::end_pick_box(); $str .= '

' - .'' + .'' .'

'; $r->print($str); @@ -4131,7 +4149,7 @@ sub upfile_drop_add { 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 [_1] [_2] [_3] [_4]',$fname,$mname,$lname,$gen)); next; } my $username = $entries{$fields{'username'}}; @@ -4926,7 +4944,7 @@ sub update_user_list { } } } - $r->print('

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

'); + $r->print('

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

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

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

'); @@ -4943,7 +4961,10 @@ sub update_user_list { if ($choice eq 'drop') { $linktext = &mt('Display current class roster'); } - $r->print(''.$linktext.''."\n"); + $r->print( + &Apache::lonhtmlcommon::actionbox( + [''.$linktext.'']) + .''."\n"); } sub dates_feedback { @@ -4951,7 +4972,7 @@ sub dates_feedback { my $dates; if ($start < $now) { if ($end == 0) { - $dates .= &mt('role(s) active now; no end date'); + $dates = &mt('role(s) active now; no end date'); } elsif ($end > $now) { $dates = &mt('role(s) active now; ends [_1].',&Apache::lonlocal::locallocaltime($end)); } else { @@ -5148,7 +5169,7 @@ sub setsections_javascript { acor => 'A coordinator role will be added with access to all sections', inea => 'In each course, each user may only have one student role at a time.', inco => 'In each community, each user may only have one member role at a time.', - youh => 'You had selected ', + youh => 'You had selected', secs => 'sections.', plmo => 'Please modify your selections so they include no more than one section.', mayn => 'may not be used as the name for a section, as it is a reserved word.',