[LON-CAPA-cvs] cvs: loncom /interface lonmanagekeys.pm

www lon-capa-cvs@mail.lon-capa.org
Sat, 08 May 2004 02:07:16 -0000


www		Fri May  7 22:07:16 2004 EDT

  Modified files:              
    /loncom/interface	lonmanagekeys.pm 
  Log:
  Continued work on key authorities
  
  
Index: loncom/interface/lonmanagekeys.pm
diff -u loncom/interface/lonmanagekeys.pm:1.13 loncom/interface/lonmanagekeys.pm:1.14
--- loncom/interface/lonmanagekeys.pm:1.13	Mon Sep 22 20:26:10 2003
+++ loncom/interface/lonmanagekeys.pm	Fri May  7 22:07:16 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to manage course access keys 
 #
-# $Id: lonmanagekeys.pm,v 1.13 2003/09/23 00:26:10 www Exp $
+# $Id: lonmanagekeys.pm,v 1.14 2004/05/08 02:07:16 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -191,8 +191,18 @@
         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{'num'},$cenv{'domain'})=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
 #
@@ -233,12 +243,17 @@
 		&addcom(%cenv);
             }
 # --- Menu
-	    $r->print('<h3>'.&mt('Key Access').'</h3>');
-	    if ($cenv{'keyaccess'} eq 'yes') {
-		$r->print(&mt('Access to this course is key controlled.').
+	    if ($keytype eq 'course') {
+		$r->print('<h3>'.&mt('Key Access').'</h3>');
+		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 {
 		    $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);
 <hr /><h3>Generate New Keys</h3>
@@ -261,7 +276,7 @@
 	$r->send_http_header;
 	$r->print(&header().&Apache::loncommon::coursebrowser_javascript());
         $r->print(
-   &mt('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(&mt('Domain').': '.&Apache::loncommon::select_dom_form(
                $ENV{'request.role.domain'},'domain'));
         $r->print(&Apache::loncommon::selectcourse_link(