--- loncom/interface/lonuserutils.pm 2007/12/26 14:38:13 1.36 +++ loncom/interface/lonuserutils.pm 2008/07/12 23:56:13 1.60 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Utility functions for managing LON-CAPA user accounts # -# $Id: lonuserutils.pm,v 1.36 2007/12/26 14:38:13 raeburn Exp $ +# $Id: lonuserutils.pm,v 1.60 2008/07/12 23:56:13 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -42,7 +42,7 @@ use LONCAPA qw(:DEFAULT :match); ############################################################### # Drop student from all sections of a course, except optional $csec sub modifystudent { - my ($udom,$unam,$courseid,$csec,$desiredhost)=@_; + my ($udom,$unam,$courseid,$csec,$desiredhost,$context)=@_; # if $csec is undefined, drop the student from all the courses matching # this one. If $csec is defined, drop them from all other sections of # this course and add them to section $csec @@ -69,14 +69,14 @@ sub modifystudent { # dom name id mode pass f m l g ($udom,$unam,'', '', '',undef,undef,undef,undef, $section,time,undef,undef,$desiredhost,'','manual', - '',$courseid); + '',$courseid,'',$context); $result .= $reply.':'; } } } } if ($result eq '') { - $result = 'Unable to find section for this student'; + $result = &mt('Unable to find section for this student'); } else { $result =~ s/(ok:)+/ok/g; } @@ -129,7 +129,8 @@ sub modifyuserrole { if ($role ne '') { $role =~ s/_/\//g; $roleresult = &Apache::lonnet::assignrole($udom,$uname,$scope, - $role,$end,$start); + $role,$end,$start,'', + '',$context); } } return ($userresult,$authresult,$roleresult,$idresult); @@ -318,8 +319,8 @@ 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('
print('
'); $r->print(''); @@ -333,17 +334,12 @@ sub print_upload_manager_header { sub javascript_validations { my ($mode,$krbdefdom,$curr_authtype,$curr_authfield,$domain, $context,$groupslist)=@_; - my %param = ( kerb_def_dom => $krbdefdom, curr_authtype => $curr_authtype, ); - if ($mode eq 'createuser') { - $param{'formname'} = 'cu'; - } elsif ($mode eq 'upload') { + if ($mode eq 'upload') { $param{'formname'} = 'studentform'; - } elsif ($mode eq 'singlestudent') { - $param{'formname'} = 'cu'; } elsif ($mode eq 'createcourse') { $param{'formname'} = 'ccrs'; } elsif ($mode eq 'modifycourse') { @@ -367,7 +363,7 @@ sub javascript_validations { } } elsif ($context eq 'domain') { $setsection_call = 'setCourse()'; - $setsections_js = &dc_setcourse_js($param{'formname'},$mode); + $setsections_js = &dc_setcourse_js($param{'formname'},$mode,$context); } $finish = " var checkSec = $setsection_call\n". " if (checkSec == 'ok') {\n". @@ -387,13 +383,13 @@ sub javascript_validations { section => 'The optional section field was not specified.', email => 'The optional email 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?', ); - - my $function_name =(<\n"; if ($context eq 'domain') { - $Str .= '

'.&mt('Change authentication for existing users to these settings?').'   

'; + $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'). @@ -729,6 +736,8 @@ sub print_upload_manager_footer { } else { $Str .= $home_server_pick; } + $Str .= '

'.&mt('Default domain').'

'."\n". + &Apache::loncommon::select_dom_form($defdom,'defaultdomain',undef,1); $Str .= '

'.&mt('Starting and Ending Dates'). "

\n"; $Str .= "

\n".$date_table."

\n"; @@ -768,7 +777,7 @@ sub print_upload_manager_footer { } $Str .= '