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

raeburn raeburn@source.lon-capa.org
Fri, 20 Aug 2010 04:49:11 -0000


raeburn		Fri Aug 20 04:49:11 2010 EDT

  Modified files:              (Branch: version_2_9_X)
    /loncom/interface	lonfeedback.pm 
  Log:
  - Backport 1.294, 1.298.
  
  
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.273.4.8 loncom/interface/lonfeedback.pm:1.273.4.9
--- loncom/interface/lonfeedback.pm:1.273.4.8	Sun Feb 14 17:20:19 2010
+++ loncom/interface/lonfeedback.pm	Fri Aug 20 04:49:11 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.273.4.8 2010/02/14 17:20:19 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.273.4.9 2010/08/20 04:49:11 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -48,13 +48,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;
     }
@@ -741,13 +750,20 @@
     	        $env{'request.course.id'}.
 	        ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
 	    if ($outputtarget ne 'tex') {
-		$discussion.= &send_feedback_link($ressymb,$target);
+                $discussion.= &send_feedback_link($ressymb,$target);
+                if ($env{'request.role.adv'}) {
+                    my $close = &Apache::lonnet::EXT('resource.0.discussend',$ressymb);
+                    if (defined($close) && $close ne '' && $close < time) {
+                        $discussion .= '&nbsp;'.&mt('(Closed for [_1] roles)',
+                                                    &Apache::lonnet::plaintext('st',$crstype));
+                    }
+                }
             }
 	}
         if ($outputtarget ne 'tex') {
-	    $discussion.= &send_message_link($ressymb);
+	    $discussion.= '<span class="LC_feedback_link">'.&mt('This discussion is closed.').'</span>';
         }
-        $discussion.='</div>';
+        $discussion.=&send_message_link($ressymb).'</div>';
     }
     return $discussion;
 }