[LON-CAPA-cvs] cvs: loncom /homework lonhomework.pm

sakharuk lon-capa-cvs@mail.lon-capa.org
Tue, 24 Sep 2002 12:39:42 -0000


sakharuk		Tue Sep 24 08:39:42 2002 EDT

  Modified files:              
    /loncom/homework	lonhomework.pm 
  Log:
  Change to print closed resources was done.
  
  
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.89 loncom/homework/lonhomework.pm:1.90
--- loncom/homework/lonhomework.pm:1.89	Mon Sep 23 13:29:37 2002
+++ loncom/homework/lonhomework.pm	Tue Sep 24 08:39:42 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Homework handler
 #
-# $Id: lonhomework.pm,v 1.89 2002/09/23 17:29:37 albertel Exp $
+# $Id: lonhomework.pm,v 1.90 2002/09/24 12:39:42 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -59,10 +59,14 @@
 
 sub get_target {
   if ( $ENV{'request.state'} eq "published") {
-    if ( defined($ENV{'form.grade_target'}) 
+    if ( defined($ENV{'form.grade_target'}  ) 
+	 && ($ENV{'form.grade_target'} eq 'tex')) {
+      return ($ENV{'form.grade_target'});
+    } elsif ( defined($ENV{'form.grade_target'}  ) 
 	 && ($Apache::lonhomework::viewgrades == 'F' )) {
       return ($ENV{'form.grade_target'});
     }
+ 
     if ( defined($ENV{'form.submitted'})) {
       return ('grade', 'web');
     } else {
@@ -121,7 +125,7 @@
   my ($which,$request)=@_;
   if ($which eq 'grade') {
     $request->print('<script language="JavaScript"> 
-          hwkmenu=window.open("/res/adm/pages/homeworkmenu.html","homeworkremote",
+   hwkmenu=window.open("/res/adm/pages/homeworkmenu.html","homeworkremote",
                  "height=350,width=150,menubar=no");
           </script>');
   }
@@ -200,7 +204,7 @@
 
   &Apache::lonxml::debug("sending back :$status:$datemsg:");
   if (($Apache::lonhomework::browse eq 'F') && ($status eq 'CLOSED')) {
-    &Apache::lonxml::debug("should be allowed to browse a resource when closed");
+ &Apache::lonxml::debug("should be allowed to browse a resource when closed");
     $status='CAN_ANSWER';
     $datemsg='is closed but you are allowed to view it';
   }
@@ -389,9 +393,9 @@
     if ($target eq 'answer') { &showhash(%Apache::lonhomework::history); }
     if ($target eq 'web') {&Apache::lonhomework::showhashsubset(\%ENV,'^form');}
 
-    my $default=&Apache::lonnet::getfile('/home/httpd/html/res/adm/includes/default_homework.lcpm');
+my $default=&Apache::lonnet::getfile('/home/httpd/html/res/adm/includes/default_homework.lcpm');
     if ($default == -1) {
-      &Apache::lonxml::error("<b>Unable to find <i>default_homework.lcpm</i></b>");
+  &Apache::lonxml::error("<b>Unable to find <i>default_homework.lcpm</i></b>");
       $default='';
     }
     &Apache::lonxml::debug("Should be parsing now");
@@ -425,7 +429,8 @@
   my $result;
   my @allnames;
   &Apache::lonxml::debug("Looking for :$extension:");
-  foreach my $file (</home/httpd/html/res/adm/includes/templates/*.$extension>) {
+  foreach my $file (</home/httpd/html/res/adm/includes/templates/*.$extension>)
+ {
     my $name=&Apache::lonnet::metadata($file,'title');
     if ($namewanted && ($name eq $namewanted)) {
       $result=$file;
@@ -500,7 +505,7 @@
   #my $t0 = [&gettimeofday()];
   my $request=$_[0];
 
-  if ( $ENV{'user.name'} eq 'albertel' ) {$Apache::lonxml::debug=1;}
+#  if ( $ENV{'user.name'} eq 'physnet' ) {$Apache::lonxml::debug=1;}
 
   if (&setupheader($request)) { return OK; }
   $ENV{'request.uri'}=$request->uri;