--- loncom/interface/lonmanagekeys.pm 2003/05/02 13:00:19 1.8 +++ loncom/interface/lonmanagekeys.pm 2003/05/02 15:26:36 1.9 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to manage course access keys # -# $Id: lonmanagekeys.pm,v 1.8 2003/05/02 13:00:19 www Exp $ +# $Id: lonmanagekeys.pm,v 1.9 2003/05/02 15:26:36 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -58,7 +58,7 @@ sub show_key_list { $comment=~s/\W/\./g; my %accesskeys=&Apache::lonnet::dump ('accesskeys',$cenv{'domain'},$cenv{'num'}); - $r->print(''); + $r->print('

List of Keys/Enter New Comments

KeyChecked OutComments/Remarks/NotesEnter Additional Comments/Remarks/Notes
'); foreach (keys %accesskeys) { if ($_=~/^error\:/) { $r->print(''); @@ -72,12 +72,12 @@ sub show_key_list { $r->print("\n'); } } $r->print('
KeyChecked OutComments/Remarks/NotesEnter Additional Comments/Remarks/Notes
No keys have been generated yet.
".$_.''.($checkout? $checkout:'-').''. join('
',split(/\s*\;\s*/,$com)). - '
'); - $r->print(''); + $r->print('
'); return ''; # # Junk below @@ -177,6 +177,25 @@ sub genkeys { $num.' access keys (Batch Number: '.$batchnumber.')',$batchnumber; } +# ---------------------------------------------------------------- Add comments + +sub addcom { + my %cenv=@_; + my %newcomment=(); + undef %newcomment; + foreach (keys %ENV) { + if ($_=~/^form\.com\_(.+)$/) { + my $key=$1; + my $comment=$ENV{$_}; + $comment=~s/^\s+//gs; + if ($comment) { + &Apache::lonnet::comment_access_key + ($key,$cenv{'domain'},$cenv{'num'},$comment); + } + } + } + return ''; +} ################################################################### ################################################################### sub handler { @@ -232,6 +251,9 @@ sub handler { &show_key_list($r,$ENV{'form.listcom'}, $ENV{'form.newonly'},$ENV{'form.checkonly'},%cenv); } + if ($ENV{'form.addcom'}) { + &addcom(%cenv); + } # --- Menu $r->print('

Key Access

'); if ($cenv{'keyaccess'} eq 'yes') {