');
+ return '';
+#
+# Junk below
+#
+ my ($mode,$linkto,$action,$statusmode,$classlist,$keylist);
#
# Just junk so that this compiles
#
@@ -136,12 +161,17 @@ sub togglekeyaccess {
sub genkeys {
my ($num,$comments,%cenv)=@_;
+ unless ($comments) { $comments=''; }
+ $comments=~s/\#/ /g;
+ $comments=~s/\;/ /g;
unless ($num) { return 'No number of keys given.'; }
unless (($num=~/^\d+$/) && ($num>0)) {
return 'Invalid number of keys given.';
}
+ my $batchnumber='BATCH_'.time().'_'.$$;
return 'Generated '.&Apache::lonnet::generate_access_keys
- ($num,$cenv{'domain'},$cenv{'number'},$comments).' access keys.';
+ ($num,$cenv{'domain'},$cenv{'num'},$batchnumber.'; '.$comments).' of '.
+ $num.' access keys (Batch Number: '.$batchnumber.')',$batchnumber;
}
###################################################################
@@ -189,23 +219,35 @@ sub handler {
$r->print(&togglekeyaccess(%cenv).' ');
%cenv=&Apache::lonnet::coursedescription($ENV{'form.cid'});
}
+ my $batchnumber='';
if ($ENV{'form.genkeys'}) {
- $r->print(
- &genkeys($ENV{'form.num'},$ENV{'form.comments'},%cenv).' ');
+ (my $msg,$batchnumber)=
+ &genkeys($ENV{'form.num'},$ENV{'form.comments'},%cenv);
+ $r->print($msg.' ');
}
+ if ($ENV{'form.listkeys'}) {
+ &show_key_list($r,$ENV{'form.listcom'},
+ $ENV{'form.newonly'},$ENV{'form.checkonly'},%cenv);
+ }
# --- Menu
$r->print('
Key Access
');
if ($cenv{'keyaccess'} eq 'yes') {
- $r->print('Access to this course is key controlled. ')
+ $r->print('Access to this course is key controlled. ')
} else {
- $r->print('Access to this course is open, no access keys. ');
+ $r->print('Access to this course is open, no access keys. ');
}
- $r->print(<print(<
Generate New Keys
Number of keys to be generated:
Comments/Remarks/Notes:
-ENDKEYGEN
+
List Keys
+Comments/Remarks/Notes/User/Batch Number:
+
+ Unused keys only
+Used keys only
+
+ENDKEYMENU
$r->print('