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

sakharuk lon-capa-cvs@mail.lon-capa.org
Tue, 01 Oct 2002 21:05:45 -0000


sakharuk		Tue Oct  1 17:05:45 2002 EDT

  Modified files:              
    /loncom/homework	inputtags.pm 
  Log:
  Gradestatus was changed - target was added.
  
  
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.62 loncom/homework/inputtags.pm:1.63
--- loncom/homework/inputtags.pm:1.62	Mon Sep 23 13:25:24 2002
+++ loncom/homework/inputtags.pm	Tue Oct  1 17:05:45 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.62 2002/09/23 17:25:24 albertel Exp $
+# $Id: inputtags.pm,v 1.63 2002/10/01 21:05:45 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -382,7 +382,7 @@
       foreach my $key (keys(%Apache::lonhomework::results)) {
 	if (($key =~ /^resource\.$id\./) && ($key !~ /\.collaborators$/)) {
 	  &Apache::lonxml::debug("Removing $key");
-	  delete($Apache::lonhomework::results{$key});
+  delete($Apache::lonhomework::results{$key});
 	}
       }
       #and since they didn't do anything we were never here
@@ -424,7 +424,7 @@
 }
 
 sub gradestatus {
-  my ($id) = @_;
+  my ($id,$target) = @_;
   my $showbutton = 1;
   my $message = '';
   my $latemessage = '';
@@ -443,9 +443,13 @@
       &Apache::lonxml::debug('Getting message');
       ($showbutton,$message,$previousmsg) =
 	&decideoutput($award,$solved,$previous);
-      $message="<td bgcolor=\"#aaffaa\">$message</td>";
-      if ($previousmsg) {
-	$previousmsg="<td bgcolor=\"#ffaaaa\">$previousmsg</td>";
+      if ($target eq 'tex') {
+	$message=' '.$message.' ';
+      } else {
+	$message="<td bgcolor=\"#aaffaa\">$message</td>";
+	if ($previousmsg) {
+	  $previousmsg="<td bgcolor=\"#ffaaaa\">$previousmsg</td>";
+	}
       }
     }
     my $tries = $Apache::lonhomework::history{"resource.$id.tries"};
@@ -455,22 +459,36 @@
     if ( $maxtries eq '' ) { $maxtries = '2'; } 
     if ( $maxtries eq 'con_lost' ) { $maxtries = '0'; } 
     if ( $showbutton ) {
-      $trystr = "<td>Tries $tries/$maxtries</td>";
+      if ($target eq 'tex') {
+	 $trystr = ' '.$tries.'/'.$maxtries.' ';
+      } else {
+         $trystr = "<td>Tries $tries/$maxtries</td>";
+      }
     }
     if ( $status eq 'SHOW_ANSWER' || $status eq 'CANNOT_ANSWER') {$showbutton = 0;}
     if ( $showbutton ) { 
-      $button = '<br /><input type="submit" name="submit" value="Submit Answer" />';
+      if ($target ne 'tex') {
+        $button = '<br /><input type="submit" name="submit" value="Submit Answer" />';
+      }
     }
     if ($Apache::lonhomework::history{"resource.$id.afterduedate"}) {
       #last submissions was after due date
-      $latemessage="<td bgcolor=\"#ffaaaa\">The last submission was after the Due Date</td>";
+      if ($target eq 'tex') {
+	  $latemessage=' The last submission was after the Due Date ';
+      } else {
+        $latemessage="<td bgcolor=\"#ffaaaa\">The last submission was after the Due Date</td>";
+      }
     }
   }
   my $output= $previousmsg.$latemessage.$message.$trystr;
   if ($output =~ /^\s*$/) {
     return $button;
   } else {
-    return $button.'<table><tr>'.$output.'</tr></table>';
+    if ($target eq 'tex') {
+      return $button.' \vskip 0 mm '.$output.' ';
+    } else {
+      return $button.'<table><tr>'.$output.'</tr></table>';
+    }
   }
 }
 1;