[LON-CAPA-cvs] cvs: loncom /interface lonmanagekeys.pm /lonnet/perl lonnet.pm
www
lon-capa-cvs@mail.lon-capa.org
Fri, 02 May 2003 15:26:36 -0000
www Fri May 2 11:26:36 2003 EDT
Modified files:
/loncom/interface lonmanagekeys.pm
/loncom/lonnet/perl lonnet.pm
Log:
Key annotation feature works now.
Index: loncom/interface/lonmanagekeys.pm
diff -u loncom/interface/lonmanagekeys.pm:1.8 loncom/interface/lonmanagekeys.pm:1.9
--- loncom/interface/lonmanagekeys.pm:1.8 Fri May 2 09:00:19 2003
+++ loncom/interface/lonmanagekeys.pm Fri May 2 11:26:36 2003
@@ -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 @@
$comment=~s/\W/\./g;
my %accesskeys=&Apache::lonnet::dump
('accesskeys',$cenv{'domain'},$cenv{'num'});
- $r->print('<table border="2"><tr><th>Key</th><th>Checked Out</th><th>Comments/Remarks/Notes</th><th>Enter Additional Comments/Remarks/Notes</th></tr>');
+ $r->print('<h3>List of Keys/Enter New Comments</h3><table border="2"><tr><th>Key</th><th>Checked Out</th><th>Comments/Remarks/Notes</th><th>Enter Additional Comments/Remarks/Notes</th></tr>');
foreach (keys %accesskeys) {
if ($_=~/^error\:/) {
$r->print('<tr><td>No keys have been generated yet.</td></tr>');
@@ -72,12 +72,12 @@
$r->print("\n<tr><td><tt>".$_.'</tt></td><td>'.($checkout?
$checkout:'-').'</td><td>'.
join('<br />',split(/\s*\;\s*/,$com)).
- '</td><td><input type="text" size="30" name="com_'.$_.
+ '</td><td><input type="text" size="40" name="com_'.$_.
'" /></td></tr>');
}
}
$r->print('</table>');
- $r->print('<input type="submit" name="addcom" value="Add Above Comments to Keys" />');
+ $r->print('<input type="submit" name="addcom" value="Add Above Comments to Keys" /><hr />');
return '';
#
# Junk below
@@ -177,6 +177,25 @@
$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 {
@@ -231,6 +250,9 @@
if ($ENV{'form.listkeys'}) {
&show_key_list($r,$ENV{'form.listcom'},
$ENV{'form.newonly'},$ENV{'form.checkonly'},%cenv);
+ }
+ if ($ENV{'form.addcom'}) {
+ &addcom(%cenv);
}
# --- Menu
$r->print('<h3>Key Access</h3>');
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.366 loncom/lonnet/perl/lonnet.pm:1.367
--- loncom/lonnet/perl/lonnet.pm:1.366 Wed Apr 30 17:09:55 2003
+++ loncom/lonnet/perl/lonnet.pm Fri May 2 11:26:36 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.366 2003/04/30 21:09:55 albertel Exp $
+# $Id: lonnet.pm,v 1.367 2003/05/02 15:26:36 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -650,8 +650,7 @@
if ($existing{$ckey}) {
$existing{$ckey}.='; '.$logentry;
# ready to assign
- $logentry=$1.'; '.$logentry;
- if (&put('accesskey',{$ckey=>$existing{$ckey}},
+ if (&put('accesskeys',{$ckey=>$existing{$ckey}},
$cdom,$cnum) eq 'ok') {
return 'ok';
} else {