version 1.8, 2003/05/02 13:00:19
|
version 1.10, 2003/05/02 16:58:56
|
Line 58 sub show_key_list {
|
Line 58 sub show_key_list {
|
$comment=~s/\W/\./g; |
$comment=~s/\W/\./g; |
my %accesskeys=&Apache::lonnet::dump |
my %accesskeys=&Apache::lonnet::dump |
('accesskeys',$cenv{'domain'},$cenv{'num'}); |
('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(<<ENDTABLEHEADER); |
|
<script> |
|
function copyallcom(tf) { |
|
for (i=0; i<tf.elements.length; i++) { |
|
if (tf.elements[i].name.indexOf('com_')==0) { |
|
tf.elements[i].value+=tf.copyall.value; |
|
} |
|
} |
|
|
|
} |
|
</script> |
|
<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<br /> |
|
<input type="text" size="40" name="copyall" /> |
|
<input type="button" value="Copy to All" onClick="copyallcom(this.form);" /> |
|
</th></tr> |
|
ENDTABLEHEADER |
foreach (keys %accesskeys) { |
foreach (keys %accesskeys) { |
if ($_=~/^error\:/) { |
if ($_=~/^error\:/) { |
$r->print('<tr><td>No keys have been generated yet.</td></tr>'); |
$r->print('<tr><td>No keys have been generated yet.</td></tr>'); |
Line 72 sub show_key_list {
|
Line 90 sub show_key_list {
|
$r->print("\n<tr><td><tt>".$_.'</tt></td><td>'.($checkout? |
$r->print("\n<tr><td><tt>".$_.'</tt></td><td>'.($checkout? |
$checkout:'-').'</td><td>'. |
$checkout:'-').'</td><td>'. |
join('<br />',split(/\s*\;\s*/,$com)). |
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>'); |
'" value="" /></td></tr>'); |
} |
} |
} |
} |
$r->print('</table>'); |
$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 ''; |
return ''; |
# |
# |
# Junk below |
# Junk below |
Line 177 sub genkeys {
|
Line 195 sub genkeys {
|
$num.' access keys (Batch Number: '.$batchnumber.')',$batchnumber; |
$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 { |
sub handler { |
Line 232 sub handler {
|
Line 269 sub handler {
|
&show_key_list($r,$ENV{'form.listcom'}, |
&show_key_list($r,$ENV{'form.listcom'}, |
$ENV{'form.newonly'},$ENV{'form.checkonly'},%cenv); |
$ENV{'form.newonly'},$ENV{'form.checkonly'},%cenv); |
} |
} |
|
if ($ENV{'form.addcom'}) { |
|
&addcom(%cenv); |
|
} |
# --- Menu |
# --- Menu |
$r->print('<h3>Key Access</h3>'); |
$r->print('<h3>Key Access</h3>'); |
if ($cenv{'keyaccess'} eq 'yes') { |
if ($cenv{'keyaccess'} eq 'yes') { |