--- loncom/interface/lonuserutils.pm 2008/01/02 08:01:22 1.40 +++ loncom/interface/lonuserutils.pm 2008/06/24 16:17:05 1.59 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Utility functions for managing LON-CAPA user accounts # -# $Id: lonuserutils.pm,v 1.40 2008/01/02 08:01:22 raeburn Exp $ +# $Id: lonuserutils.pm,v 1.59 2008/06/24 16:17:05 bisitz 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,7 +69,7 @@ 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.':'; } } @@ -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(''); @@ -382,12 +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 = <<"END"; $setsections_js -function verify_message (vf,founduname,foundpwd,foundname,foundid,foundsec,foundemail) { +function verify_message (vf,founduname,foundpwd,foundname,foundid,foundsec,foundemail,foundrole,founddomain) { END my ($authnum,%can_assign) = &Apache::loncommon::get_assignable_auth($domain); my $auth_checks; @@ -502,6 +504,18 @@ END } message+='$alert{'email'}'; } + if (foundrole==0) { + if (message!='') { + message+='\\n'; + } + message+='$alert{'role'}'; + } + if (founddomain==0) { + if (message!='') { + message+='\\n'; + } + message+='$alert{'domain'}'; + } if (message!='') { message+= '\\n$alert{'continue'}'; if (confirm(message)) { @@ -531,6 +545,7 @@ function verify(vf,sec_caller) { var foundsec=0; var foundemail=0; var foundrole=0; + var founddomain=0; var tw; for (i=0;i<=vf.nfields.value;i++) { tw=eval('vf.f'+i+'.selectedIndex'); @@ -541,8 +556,9 @@ function verify(vf,sec_caller) { if (tw==9) { foundpwd=1; } if (tw==10) { foundemail=1; } if (tw==11) { foundrole=1; } + if (tw==12) { founddomain=1; } } - verify_message(vf,founduname,foundpwd,foundname,foundid,foundsec,foundemail,foundrole); + verify_message(vf,founduname,foundpwd,foundname,foundid,foundsec,foundemail,foundrole,founddom); } // @@ -563,6 +579,7 @@ function verify(vf,sec_caller) { // 9 = ipwd (password) // 10 = email address // 11 = role +// 12 = domain function flip(vf,tf) { var nw=eval('vf.f'+tf+'.selectedIndex'); @@ -626,6 +643,7 @@ function verify(vf,sec_caller) { var foundid=0; var foundsec=0; var foundrole=0; + var founddomain=0; var tw; for (i=0;i<=vf.nfields.value;i++) { tw=eval('vf.f'+i+'.selectedIndex'); @@ -635,8 +653,9 @@ function verify(vf,sec_caller) { if (i==7 && tw!=0) { foundsec=1; } if (i==8 && tw!=0) { foundpwd=1; } if (i==9 && tw!=0) { foundrole=1; } + if (i==10 && tw!=0) { founddomain=1; } } - verify_message(vf,founduname,foundpwd,foundname,foundid,foundsec,foundrole); + verify_message(vf,founduname,foundpwd,foundname,foundid,foundsec,foundrole,founddomain); } function flip(vf,tf) { @@ -699,7 +718,7 @@ sub print_upload_manager_footer { $Str .= &hidden_input('keyfields',$keyfields); $Str .= "

".&mt('Login Type')."

\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'). @@ -717,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"; @@ -756,7 +777,7 @@ sub print_upload_manager_footer { } $Str .= '