--- loncom/interface/lonuserutils.pm 2010/11/15 18:50:37 1.97.2.25 +++ loncom/interface/lonuserutils.pm 2010/11/01 18:19:01 1.129 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Utility functions for managing LON-CAPA user accounts # -# $Id: lonuserutils.pm,v 1.97.2.25 2010/11/15 18:50:37 raeburn Exp $ +# $Id: lonuserutils.pm,v 1.129 2010/11/01 18:19:01 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -534,7 +534,6 @@ END if (message!='') { message+='\\n'; } - message+='$alert{'section'}'; } if (foundemail==0) { if (message!='') { @@ -589,43 +588,28 @@ END ############################################################### sub upload_manager_javascript_forward_associate { my ($can_assign) = @_; - my ($auth_update,$numbuttons,$argreset); + my $auth_update; if (ref($can_assign) eq 'HASH') { - if ($can_assign->{'krb4'} || $can_assign->{'krb5'}) { - $argreset .= " vf.krbarg.value='';\n"; - $numbuttons ++ ; - } - if ($can_assign->{'int'}) { - $argreset .= " vf.intarg.value='';\n"; - $numbuttons ++; - } - if ($can_assign->{'loc'}) { - $argreset .= " vf.locarg.value='';\n"; - $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'). - &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 - // (see bug 6368). - if (nw==9) { - eval('vf.f'+tf+'.selectedIndex=0;') - alert('$warning'); - } -END - } elsif ($numbuttons > 1) { + if (keys(%{$can_assign}) > 1) { $auth_update = <<"END"; // If we set the password, make the password form below correspond to // the new value. if (nw==9) { changed_radio('int',document.studentform); set_auth_radio_buttons('int',document.studentform); -$argreset - } - END } + if ($can_assign->{'krb4'} || $can_assign->{'krb5'}) { + $auth_update .= " vf.krbarg.value='';\n"; + } + if ($can_assign->{'int'}) { + $auth_update .= " vf.intarg.value='';\n"; + } + if ($can_assign->{'loc'}) { + $auth_update .= " vf.locarg.value='';\n"; + } + $auth_update .= " + }\n"; } return(<{'krb4'} || $can_assign->{'krb5'}) { - $argreset .= " vf.krbarg.value='';\n"; - $numbuttons ++ ; - } - if ($can_assign->{'int'}) { - $argreset .= " vf.intarg.value='';\n"; - $numbuttons ++; - } - if ($can_assign->{'loc'}) { - $argreset .= " vf.locarg.value='';\n"; - $numbuttons ++; - } - if (!$can_assign->{'int'}) { - my $warning = &mt('You may not specify an initial password, 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 - // (see bug 6368). - if (tf==8 && nw!=0) { - eval('vf.f'+tf+'.selectedIndex=0;') - alert('$warning'); - } -END - } elsif ($numbuttons > 1) { + if (keys(%{$can_assign}) > 1) { $auth_update = <<"END"; // initial password specified, pick internal authentication if (tf==8 && nw!=0) { changed_radio('int',document.studentform); set_auth_radio_buttons('int',document.studentform); -$argreset - } - END } + if ($can_assign->{'krb'}) { + $auth_update .= " vf.krbarg.value='';\n"; + } + if ($can_assign->{'int'}) { + $auth_update .= " vf.intarg.value='';\n"; + } + if ($can_assign->{'loc'}) { + $auth_update .= " vf.locarg.value='';\n"; + } + $auth_update .= " + }\n"; } - return(<print( "\n

\n" .'

' @@ -1528,7 +1494,7 @@ sub print_userlist { my ($indexhash,$keylist) = &make_keylist_array(); my (%userlist,%userinfo,$clearcoursepick); if (($context eq 'domain') && - ($env{'form.roletype'} eq 'course') || + ($env{'form.roletype'} eq 'course') || ($env{'form.roletype'} eq 'community')) { my ($crstype,$numcodes,$title,$warning); if ($env{'form.roletype'} eq 'course') { @@ -1542,9 +1508,11 @@ sub print_userlist { $title = &mt('Select Communities'); $warning = &mt('Warning: data retrieval for multiple communities can take considerable time, as this operation is not currently optimized.'); } + my @standardnames = &Apache::loncommon::get_standard_codeitems(); my $courseform = &Apache::lonhtmlcommon::course_selection($formname,$numcodes, - $codetitles,$idlist,$idlist_titles,$crstype); + $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". @@ -1762,7 +1730,7 @@ sub role_filter { $role_select .= ''; $output = ''; + .' '; } return $output; } @@ -1993,7 +1961,7 @@ function setCourseCat(formname) { if (formname.Year.options[formname.Year.selectedIndex].value == -1) { return; } - courseSet('Year'); + courseSet('$codetitles[0]'); for (var j=0; jprint(''.$results_description.'

'); } my ($output,$actionselect,%canchange,%canchangesec); @@ -2401,7 +2368,7 @@ END END if ($actionselect) { $output .= <<"END"; -

$lt{'ac'} +
$lt{'ac'} $actionselect

 
@@ -2446,7 +2413,7 @@ END } } } - $output .= '
'.$lt{'link'}.''. + $output .= '
'.$lt{'link'}.''. ''; my @linkdests = ('aboutme'); if ($permission->{'cusr'}) { @@ -2457,6 +2424,7 @@ END $env{'request.course.sec'})) { push(@linkdests,'track'); } + $output .= '
'; my $usernamelink = $env{'form.usernamelink'}; if ($usernamelink eq '') { @@ -2473,7 +2441,7 @@ END if ($env{'form.userwin'}) { $checkwin = ' checked="checked"'; } - $output .= ''.$lt{'owin'}.'
'; + $output .= ''.$lt{'owin'}.'
'; } $output .= "\n".''."\n". &Apache::loncommon::start_data_table(). @@ -2726,7 +2694,7 @@ END if ($clickers!~/\w/) { $clickers='-'; } $in{'clicker'} = $clickers; my $role = $in{'role'}; - $in{'role'}=&Apache::lonnet::plaintext($sdata->[$index{'role'}],$crstype); + $in{'role'}=&Apache::lonnet::plaintext($sdata->[$index{'role'}],$crstype); if (! defined($in{'start'}) || $in{'start'} == 0) { $in{'start'} = &mt('none'); } else { @@ -3245,7 +3213,7 @@ ENDJS chse => 'Changes in section affiliation to apply to selected users', fors => 'For student roles, changing the section will result in a section switch as students may only be in one section of a course at a time.', forn => 'For a course role that is not "student", users may have roles in more than one section at a time.', - reta => "Retain each user's current section affiliations?", + reta => "Retain each user's current section affiliations?", dnap => '(Does not apply to student roles).', ); my ($date_items,$headertext); @@ -3478,7 +3446,6 @@ sub results_header_row { } } elsif (($env{'form.roletype'} eq 'course') || ($env{'form.roletype'} eq 'community')) { - my $coursefilter = $env{'form.coursepick'}; if ($env{'form.roletype'} eq 'course') { if ($coursefilter eq 'category') { @@ -3742,8 +3709,15 @@ sub print_first_users_upload_form { &mt("How do I create a CSV file from a spreadsheet")) .'

'."\n"; $str .= &Apache::lonhtmlcommon::start_pick_box() - .&Apache::lonhtmlcommon::row_title(&mt('File')) - .&Apache::loncommon::upfile_select_html() + .&Apache::lonhtmlcommon::row_title(&mt('File')); + if (&Apache::lonlocal::current_language() ne 'en') { + if ($context eq 'course') { + $str .= '

'."\n" + .&mt('Please upload an UTF8 encoded file to ensure a correct character encoding in your classlist.')."\n" + .'

'."\n"; + } + } + $str .= &Apache::loncommon::upfile_select_html() .&Apache::lonhtmlcommon::row_closure() .&Apache::lonhtmlcommon::row_title( '