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

www www@source.lon-capa.org
Wed, 02 Jun 2010 14:11:15 -0000


www		Wed Jun  2 14:11:15 2010 EDT

  Modified files:              
    /loncom/interface	lonfeedback.pm 
  Log:
  Bug #5435: discussend overrides problem open status.
  
  
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.293 loncom/interface/lonfeedback.pm:1.294
--- loncom/interface/lonfeedback.pm:1.293	Mon May 17 14:22:37 2010
+++ loncom/interface/lonfeedback.pm	Wed Jun  2 14:11:15 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.293 2010/05/17 14:22:37 wenzelju Exp $
+# $Id: lonfeedback.pm,v 1.294 2010/06/02 14:11:15 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -49,13 +49,22 @@
 
 sub discussion_open {
     my ($status,$symb)=@_;
+# Advanced roles can always discuss
     if ($env{'request.role.adv'}) { return 1; }
+# Get discussion closing date
+    my $close=&Apache::lonnet::EXT('resource.0.discussend',$symb);
+# If it is defined and in the future, the instructor wants this discussion to be open
+    if (defined($close) && $close ne '' && $close > time) {
+        return 1;
+    }
+# It was not explicitly open, check if the problem is available.
+# If the problem is not available, close the discussion 
     if (defined($status) &&
 	!($status eq 'CAN_ANSWER' || $status eq 'CANNOT_ANSWER'
 	  || $status eq 'OPEN')) {
 	return 0;
     }
-    my $close=&Apache::lonnet::EXT('resource.0.discussend',$symb);
+# The problem is available, but check if the instructor explictly closed discussion
     if (defined($close) && $close ne '' && $close < time) {
 	return 0;
     }
@@ -739,7 +748,11 @@
 	    if ($outputtarget ne 'tex') {
 		$discussion.= &send_feedback_link($ressymb,$target);
             }
-	}
+	} else {
+            if ($outputtarget ne 'tex') {
+                $discussion.= &mt('This discussion is closed.');
+            }
+        }
         if ($outputtarget ne 'tex') {
 	    $discussion.= &send_message_link($ressymb);
         }