');
+ $r->print('');
}
+ return '';
}
@@ -177,12 +151,31 @@ 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 {
my $r=shift;
if ($r->header_only) {
- $r->content_type('text/html');
+ &Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
return OK;
}
@@ -199,19 +192,23 @@ sub handler {
}
if ($ENV{'form.cid'}) {
my %cenv=&Apache::lonnet::coursedescription($ENV{'form.cid'});
- if (exists($ENV{'form.state'}) && ($ENV{'form.state'} eq 'csv')) {
+ if ($ENV{'form.listkeyscsv'}) {
#
# CSV Output
#
$r->content_type('text/csv');
+ $r->send_http_header;
#
# Do CSV
#
+ &show_key_list($r,1,$ENV{'form.listcom'},
+ $ENV{'form.newonly'},$ENV{'form.checkonly'},%cenv);
+
} else {
#
# Normal web stuff
#
- $r->content_type('text/html');
+ &Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
$r->print(&header());
@@ -229,15 +226,19 @@ sub handler {
$r->print($msg.' ');
}
if ($ENV{'form.listkeys'}) {
- &show_key_list($r,$ENV{'form.listcom'},
+ &show_key_list($r,0,$ENV{'form.listcom'},
$ENV{'form.newonly'},$ENV{'form.checkonly'},%cenv);
}
+ if ($ENV{'form.addcom'}) {
+ &addcom(%cenv);
+ }
# --- Menu
- $r->print('
Key Access
');
+ $r->print('
'.&mt('Key Access').'
');
if ($cenv{'keyaccess'} eq 'yes') {
- $r->print('Access to this course is key controlled. ')
+ $r->print(&mt('Access to this course is key controlled.').
+' ')
} else {
- $r->print('Access to this course is open, no access keys. ');
+ $r->print(&mt('Access to this course is open, no access keys').' ');
}
$r->print(<
Generate New Keys
@@ -245,26 +246,27 @@ Number of keys to be generated:
List Keys
-Comments/Remarks/Notes/User/Batch Number:
+Comments/Remarks/Notes/User/Batch Number Filter:
Unused keys only
Used keys only
-
+
+
ENDKEYMENU
$r->print('