--- loncom/interface/lonmanagekeys.pm 2003/05/02 19:00:29 1.11 +++ loncom/interface/lonmanagekeys.pm 2004/05/09 00:45:01 1.15 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to manage course access keys # -# $Id: lonmanagekeys.pm,v 1.11 2003/05/02 19:00:29 www Exp $ +# $Id: lonmanagekeys.pm,v 1.15 2004/05/09 00:45:01 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -36,6 +36,7 @@ use Apache::loncommon(); use Apache::lonhtmlcommon(); use Apache::Constants qw(:common :http REDIRECT); use Spreadsheet::WriteExcel; +use Apache::lonlocal; ############################################################### ############################################################### @@ -174,7 +175,7 @@ sub addcom { 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; } @@ -190,8 +191,18 @@ sub handler { return HTTP_NOT_ACCEPTABLE; } if ($ENV{'form.cid'}) { - my %cenv=&Apache::lonnet::coursedescription($ENV{'form.cid'}); - if ($ENV{'form.listkeyscsv'}) { + my %cenv=&Apache::lonnet::coursedescription($ENV{'form.cid'}); + 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 # @@ -207,7 +218,7 @@ sub handler { # # Normal web stuff # - $r->content_type('text/html'); + &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; $r->print(&header()); @@ -232,11 +243,17 @@ sub handler { &addcom(%cenv); } # --- Menu - $r->print('

Key Access

'); - if ($cenv{'keyaccess'} eq 'yes') { - $r->print('Access to this course is key controlled.
') + if ($keytype eq 'course') { + $r->print('

'.&mt('Key Access').'

'); + if ($cenv{'keyaccess'} eq 'yes') { + $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').'
'); + } + } else { + $r->print('

'.&mt('Key Authority'). + ' '.$cenv{'num'}.'@'.$cenv{'domain'}.'

'); } $r->print(<

Generate New Keys

@@ -255,16 +272,16 @@ ENDKEYMENU } } else { # Start page no course id - $r->content_type('text/html'); + &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; $r->print(&header().&Apache::loncommon::coursebrowser_javascript()); $r->print( - 'Course ID: '); - $r->print('Domain: '.&Apache::loncommon::select_dom_form( + &mt('Course ID of Key Authority').': '); + $r->print(&mt('Domain').': '.&Apache::loncommon::select_dom_form( $ENV{'request.role.domain'},'domain')); $r->print(&Apache::loncommon::selectcourse_link( 'keyform','course','domain')); - $r->print('
'); + $r->print('
'); $r->print(''); } return OK;