version 1.11, 2003/05/02 19:00:29
|
version 1.16, 2005/02/17 08:29:42
|
Line 36 use Apache::loncommon();
|
Line 36 use Apache::loncommon();
|
use Apache::lonhtmlcommon(); |
use Apache::lonhtmlcommon(); |
use Apache::Constants qw(:common :http REDIRECT); |
use Apache::Constants qw(:common :http REDIRECT); |
use Spreadsheet::WriteExcel; |
use Spreadsheet::WriteExcel; |
|
use Apache::lonlocal; |
|
|
############################################################### |
############################################################### |
############################################################### |
############################################################### |
sub header { |
sub header { |
|
my $html=&Apache::lonxml::xmlbegin(); |
my $bodytag=&Apache::loncommon::bodytag('Access Key Management'); |
my $bodytag=&Apache::loncommon::bodytag('Access Key Management'); |
return(<<ENDHEAD); |
return(<<ENDHEAD); |
<html> |
$html |
<head> |
<head> |
<title>LON-CAPA Access Key Management</title> |
<title>LON-CAPA Access Key Management</title> |
</head> |
</head> |
Line 174 sub addcom {
|
Line 176 sub addcom {
|
sub handler { |
sub handler { |
my $r=shift; |
my $r=shift; |
if ($r->header_only) { |
if ($r->header_only) { |
$r->content_type('text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
return OK; |
return OK; |
} |
} |
Line 190 sub handler {
|
Line 192 sub handler {
|
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
if ($ENV{'form.cid'}) { |
if ($ENV{'form.cid'}) { |
my %cenv=&Apache::lonnet::coursedescription($ENV{'form.cid'}); |
my %cenv=&Apache::lonnet::coursedescription($ENV{'form.cid'}); |
if ($ENV{'form.listkeyscsv'}) { |
my $keytype=''; |
|
if ($cenv{'url'} eq '/res/') { |
|
($cenv{'domain'},$cenv{'num'})=split(/\_/,$ENV{'form.cid'}); |
|
$keytype='auth'; |
|
} elsif ($cenv{'keyauth'}) { |
|
($cenv{'num'},$cenv{'domain'})=split(/\W/,$cenv{'keyauth'}); |
|
$keytype='auth'; |
|
} else { |
|
$keytype='course'; |
|
} |
|
if ($ENV{'form.listkeyscsv'}) { |
# |
# |
# CSV Output |
# CSV Output |
# |
# |
Line 207 sub handler {
|
Line 219 sub handler {
|
# |
# |
# Normal web stuff |
# Normal web stuff |
# |
# |
$r->content_type('text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
$r->print(&header()); |
$r->print(&header()); |
|
|
Line 232 sub handler {
|
Line 244 sub handler {
|
&addcom(%cenv); |
&addcom(%cenv); |
} |
} |
# --- Menu |
# --- Menu |
$r->print('<h3>Key Access</h3>'); |
if ($keytype eq 'course') { |
if ($cenv{'keyaccess'} eq 'yes') { |
$r->print('<h3>'.&mt('Key Access').'</h3>'); |
$r->print('Access to this course is key controlled.<br /><input type="submit" name="toggle" value="Open Access" />') |
if ($cenv{'keyaccess'} eq 'yes') { |
|
$r->print(&mt('Access to this course is key controlled.'). |
|
'<br /><input type="submit" name="toggle" value="'.&mt('Open Access').'" />') |
} else { |
} else { |
$r->print('Access to this course is open, no access keys.<br /><input type="submit" name="toggle" value="Control Access" />'); |
$r->print(&mt('Access to this course is open, no access keys').'<br /><input type="submit" name="toggle" value="'.&mt('Control Access').'" />'); |
|
} |
|
} else { |
|
$r->print('<h3>'.&mt('Key Authority'). |
|
' <tt>'.$cenv{'num'}.'@'.$cenv{'domain'}.'</tt></h3>'); |
} |
} |
$r->print(<<ENDKEYMENU); |
$r->print(<<ENDKEYMENU); |
<hr /><h3>Generate New Keys</h3> |
<hr /><h3>Generate New Keys</h3> |
Line 255 ENDKEYMENU
|
Line 273 ENDKEYMENU
|
} |
} |
} else { |
} else { |
# Start page no course id |
# Start page no course id |
$r->content_type('text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
$r->print(&header().&Apache::loncommon::coursebrowser_javascript()); |
$r->print(&header().&Apache::loncommon::coursebrowser_javascript()); |
$r->print( |
$r->print( |
'Course ID: <input input type="text" size="25" name="course" value="" />'); |
&mt('Course ID of Key Authority').': <input input type="text" size="25" name="course" value="" />'); |
$r->print('Domain: '.&Apache::loncommon::select_dom_form( |
$r->print(&mt('Domain').': '.&Apache::loncommon::select_dom_form( |
$ENV{'request.role.domain'},'domain')); |
$ENV{'request.role.domain'},'domain')); |
$r->print(&Apache::loncommon::selectcourse_link( |
$r->print(&Apache::loncommon::selectcourse_link( |
'keyform','course','domain')); |
'keyform','course','domain')); |
$r->print('<br /><input type="submit" value="Manage Access Keys" />'); |
$r->print('<br /><input type="submit" value="'.&mt('Manage Access Keys').'" />'); |
$r->print('</form></body></html>'); |
$r->print('</form></body></html>'); |
} |
} |
return OK; |
return OK; |