--- loncom/cgi/lonversions.pl 2003/09/06 17:23:29 1.4 +++ loncom/cgi/lonversions.pl 2008/11/28 20:50:25 1.5 @@ -1,7 +1,7 @@ #!/usr/bin/perl $|=1; # Prints ut the Id line from most files -# $Id: lonversions.pl,v 1.4 2003/09/06 17:23:29 albertel Exp $ +# $Id: lonversions.pl,v 1.5 2008/11/28 20:50:25 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -26,13 +26,44 @@ $|=1; # http://www.lon-capa.org/ # -print "Content-type: text/html\n\n". - "

Handler Versions

". - "
\n";
-open (DFH,
-"grep '\' /home/httpd/perl/* /home/httpd/lib/perl/Apache/*.pm /home/httpd/html/res/adm/includes/* /home/httpd/html/res/adm/pages/*|");
-while ($line=) { 
-   print "$line"; 
+use strict;
+
+use lib '/home/httpd/lib/perl/';
+use Apache::lonlocal;
+use LONCAPA::Configuration;
+use LONCAPA::loncgi;
+
+print("Content-type: text/html\n\n");
+
+&main();
+
+sub main {
+    if (!&LONCAPA::loncgi::check_ipbased_access('codeversions')) {
+        if (!&LONCAPA::loncgi::check_cookie_and_load_env()) {
+            &Apache::lonlocal::get_language_handle();
+            print(&LONCAPA::loncgi::missing_cookie_msg());
+            return;
+        }
+
+        if (!&LONCAPA::loncgi::can_view('codeversions')) {
+            &Apache::lonlocal::get_language_handle();
+            print(&LONCAPA::loncgi::unauthorized_msg('codeversions'));
+            return;
+        }
+    }
+
+    &Apache::lonlocal::get_language_handle();
+    &print_versions();
+    return;
+}
+
+sub print_versions {
+    print '

'.&Apache::lonlocal::mt('Handler Versions').'

'. + "
\n";
+    open (DFH, "grep '\' /home/httpd/perl/* /home/httpd/lib/perl/Apache/*.pm /home/httpd/html/res/adm/includes/* /home/httpd/html/res/adm/pages/*|");
+    while (my $line=) { 
+        print "$line"; 
+    }
+    close(DFH);
+    print '
'; } -close(DFH); -print "
";