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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 12 Jul 2005 21:50:07 -0000


albertel		Tue Jul 12 17:50:07 2005 EDT

  Modified files:              
    /loncom/homework	lonhomework.pm 
  Log:
  - make problems work correctly when browsed (answer field goes away once correct) and for CC viewing closed problems BUG#4221
  
  
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.211 loncom/homework/lonhomework.pm:1.212
--- loncom/homework/lonhomework.pm:1.211	Sun Jun  5 21:21:53 2005
+++ loncom/homework/lonhomework.pm	Tue Jul 12 17:50:05 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Homework handler
 #
-# $Id: lonhomework.pm,v 1.211 2005/06/06 01:21:53 albertel Exp $
+# $Id: lonhomework.pm,v 1.212 2005/07/12 21:50:05 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -320,6 +320,9 @@
     &Apache::lonxml::debug("checking for part :$id:");
     &Apache::lonxml::debug("time:".time);
 
+    my ($symb)=&Apache::lonxml::whichuser();
+    &Apache::lonxml::debug("symb:".$symb);
+    #if ($env{'request.state'} ne "construct" && $symb ne '') {
     if ($env{'request.state'} ne "construct") {
 	my $allowed=&check_ip_acc(&Apache::lonnet::EXT("resource.$id.acc"));
 	if (!$allowed && ($Apache::lonhomework::browse ne 'F')) {
@@ -372,7 +375,8 @@
 	    $datemsg = &mt("was due on")." $lastdate".&mt(", and answers will be available on")." $date";
 	}
     }
-    if ($status eq 'CAN_ANSWER') {
+    if ($status eq 'CAN_ANSWER' ||
+	(($Apache::lonhomework::browse eq 'F') && ($status eq 'CLOSED'))) {
 	#check #tries, and if correct.
 	my $tries = $Apache::lonhomework::history{"resource.$id.tries"};
 	my $maxtries = &Apache::lonnet::EXT("resource.$id.maxtries");