--- loncom/interface/loncreateuser.pm 2005/01/11 21:46:52 1.96 +++ loncom/interface/loncreateuser.pm 2005/06/23 21:59:13 1.107 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.96 2005/01/11 21:46:52 albertel Exp $ +# $Id: loncreateuser.pm,v 1.107 2005/06/23 21:59:13 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -108,10 +108,8 @@ sub my_custom_roles { sub authorpriv { my ($auname,$audom)=@_; - if (($auname ne $ENV{'user.name'}) || - (($audom ne $ENV{'user.domain'}) && - ($audom ne $ENV{'request.role.domain'}))) { return ''; } - unless (&Apache::lonnet::allowed('cca',$audom)) { return ''; } + unless ((&Apache::lonnet::allowed('cca',$audom.'/'.$auname)) + || (&Apache::lonnet::allowed('caa',$audom.'/'.$auname))) { return ''; } return 1; } @@ -119,9 +117,10 @@ sub authorpriv { sub print_username_entry_form { my $r=shift; - my $defdom=$ENV{'request.role.domain'}; + my $defdom=$env{'request.role.domain'}; my @domains = &Apache::loncommon::get_domains(); my $domform = &Apache::loncommon::select_dom_form($defdom,'ccdomain'); + my $html=&Apache::lonxml::xmlbegin(); my $bodytag =&Apache::loncommon::bodytag('Create Users, Change User Privileges').&Apache::loncommon::help_open_menu('',undef,undef,'',282,'Instructor Interface'); my $selscript=&Apache::loncommon::studentbrowser_javascript(); my $sellink=&Apache::loncommon::selectstudent_link @@ -141,7 +140,7 @@ sub print_username_entry_form { my $helpsiur=&Apache::loncommon::help_open_topic('Course_Change_Privileges'); my $helpecpr=&Apache::loncommon::help_open_topic('Course_Editing_Custom_Roles'); $r->print(<<"ENDDOCUMENT"); - +$html The LearningOnline Network with CAPA $selscript @@ -157,31 +156,35 @@ $lt{'dom'}:$domform +ENDDOCUMENT + if (&Apache::lonnet::allowed('mcr','/')) { + $r->print(<

$lt{'ecrp'}$helpecpr

$lt{'nr'}: $choice
- - -ENDDOCUMENT + +ENDCUSTOM + } + $r->print(''); } # =================================================================== Phase two sub print_user_modification_page { my $r=shift; - my $ccuname=$ENV{'form.ccuname'}; - my $ccdomain=$ENV{'form.ccdomain'}; + my $ccuname=$env{'form.ccuname'}; + my $ccdomain=$env{'form.ccdomain'}; - $ccuname=~s/[\W|_]//gs; - $ccdomain=~s/[\W|_]//gs; + $ccuname=~s/\W//g; + $ccdomain=~s/\W//g; unless (($ccuname) && ($ccdomain)) { &print_username_entry_form($r); return; } - my $defdom=$ENV{'request.role.domain'}; + my $defdom=$env{'request.role.domain'}; my ($krbdef,$krbdefdom) = &Apache::loncommon::get_kerberos_defaults($defdom); @@ -198,7 +201,7 @@ sub print_user_modification_page { my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition(); my $dc_setcourse_code = ''; my $loaditem; - if ($ENV{'request.role'} =~ m-^dc\./(\w+)/$-) { + if ($env{'request.role'} =~ m-^dc\./(\w+)/$-) { my $dcdom = $1; $loaditem = qq|OnLoad="document.cu.coursedesc.value=''"|; $dc_setcourse_code = <<"ENDSCRIPT"; @@ -271,8 +274,9 @@ sub print_user_modification_page { } ENDSCRIPT } + my $html=&Apache::lonxml::xmlbegin(); my $dochead =<<"ENDDOCHEAD"; - +$html The LearningOnline Network with CAPA