--- loncom/interface/lonmanagekeys.pm 2005/02/17 08:29:42 1.16 +++ loncom/interface/lonmanagekeys.pm 2005/04/07 06:56:23 1.17 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to manage course access keys # -# $Id: lonmanagekeys.pm,v 1.16 2005/02/17 08:29:42 albertel Exp $ +# $Id: lonmanagekeys.pm,v 1.17 2005/04/07 06:56:23 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -31,7 +31,7 @@ package Apache::lonmanagekeys; use strict; -use Apache::lonnet(); +use Apache::lonnet; use Apache::loncommon(); use Apache::lonhtmlcommon(); use Apache::Constants qw(:common :http REDIRECT); @@ -158,10 +158,10 @@ sub addcom { my %cenv=@_; my %newcomment=(); undef %newcomment; - foreach (keys %ENV) { + foreach (keys %env) { if ($_=~/^form\.com\_(.+)$/) { my $key=$1; - my $comment=$ENV{$_}; + my $comment=$env{$_}; $comment=~s/^\s+//gs; if ($comment) { &Apache::lonnet::comment_access_key @@ -182,20 +182,20 @@ sub handler { } &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['state','cid']); - if (($ENV{'form.domain'}) && ($ENV{'form.course'})) { - $ENV{'form.cid'}=$ENV{'form.domain'}.'_'.$ENV{'form.course'}; + if (($env{'form.domain'}) && ($env{'form.course'})) { + $env{'form.cid'}=$env{'form.domain'}.'_'.$env{'form.course'}; } - unless (&Apache::lonnet::allowed('mky',$ENV{'request.role.domain'})) { - $ENV{'user.error.msg'}= + unless (&Apache::lonnet::allowed('mky',$env{'request.role.domain'})) { + $env{'user.error.msg'}= "/adm/managekeys:mky:0:0:Cannot manage access keys"; return HTTP_NOT_ACCEPTABLE; } - if ($ENV{'form.cid'}) { - my %cenv=&Apache::lonnet::coursedescription($ENV{'form.cid'}); + if ($env{'form.cid'}) { + my %cenv=&Apache::lonnet::coursedescription($env{'form.cid'}); my $keytype=''; if ($cenv{'url'} eq '/res/') { - ($cenv{'domain'},$cenv{'num'})=split(/\_/,$ENV{'form.cid'}); + ($cenv{'domain'},$cenv{'num'})=split(/\_/,$env{'form.cid'}); $keytype='auth'; } elsif ($cenv{'keyauth'}) { ($cenv{'num'},$cenv{'domain'})=split(/\W/,$cenv{'keyauth'}); @@ -203,7 +203,7 @@ sub handler { } else { $keytype='course'; } - if ($ENV{'form.listkeyscsv'}) { + if ($env{'form.listkeyscsv'}) { # # CSV Output # @@ -212,8 +212,8 @@ sub handler { # # Do CSV # - &show_key_list($r,1,$ENV{'form.listcom'}, - $ENV{'form.newonly'},$ENV{'form.checkonly'},%cenv); + &show_key_list($r,1,$env{'form.listcom'}, + $env{'form.newonly'},$env{'form.checkonly'},%cenv); } else { # @@ -224,23 +224,23 @@ sub handler { $r->print(&header()); $r->print( - ''); + ''); # --- Actions - if ($ENV{'form.toggle'}) { + if ($env{'form.toggle'}) { $r->print(&togglekeyaccess(%cenv).'
'); - %cenv=&Apache::lonnet::coursedescription($ENV{'form.cid'}); + %cenv=&Apache::lonnet::coursedescription($env{'form.cid'}); } my $batchnumber=''; - if ($ENV{'form.genkeys'}) { + if ($env{'form.genkeys'}) { (my $msg,$batchnumber)= - &genkeys($ENV{'form.num'},$ENV{'form.comments'},%cenv); + &genkeys($env{'form.num'},$env{'form.comments'},%cenv); $r->print($msg.'
'); } - if ($ENV{'form.listkeys'}) { - &show_key_list($r,0,$ENV{'form.listcom'}, - $ENV{'form.newonly'},$ENV{'form.checkonly'},%cenv); + if ($env{'form.listkeys'}) { + &show_key_list($r,0,$env{'form.listcom'}, + $env{'form.newonly'},$env{'form.checkonly'},%cenv); } - if ($ENV{'form.addcom'}) { + if ($env{'form.addcom'}) { &addcom(%cenv); } # --- Menu @@ -279,7 +279,7 @@ ENDKEYMENU $r->print( &mt('Course ID of Key Authority').': '); $r->print(&mt('Domain').': '.&Apache::loncommon::select_dom_form( - $ENV{'request.role.domain'},'domain')); + $env{'request.role.domain'},'domain')); $r->print(&Apache::loncommon::selectcourse_link( 'keyform','course','domain')); $r->print('
');