[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface lonmenu.pm

raeburn raeburn at source.lon-capa.org
Tue Sep 25 20:39:32 EDT 2012


raeburn		Wed Sep 26 00:39:32 2012 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	lonmenu.pm 
  Log:
  - For 2.11.
    - Backport 1.387.
  
  
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.369.2.23 loncom/interface/lonmenu.pm:1.369.2.24
--- loncom/interface/lonmenu.pm:1.369.2.23	Tue Sep 25 23:01:00 2012
+++ loncom/interface/lonmenu.pm	Wed Sep 26 00:39:32 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.369.2.23 2012/09/25 23:01:00 raeburn Exp $
+# $Id: lonmenu.pm,v 1.369.2.24 2012/09/26 00:39:32 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2339,8 +2339,27 @@
 
 sub countdown_timer {
     if (($env{'request.course.id'}) && ($env{'request.symb'} ne '') &&
-        ($env{'request.filename'}=~/$LONCAPA::assess_re/) &&
-        ($Apache::inputtags::status[-1] eq 'CAN_ANSWER')) {
+        ($env{'request.filename'}=~/$LONCAPA::assess_re/)) {
+        my ($type,$hastimeleft,$slothastime);
+        my $now = time;
+        if ($env{'request.filename'} =~ /\.task$/) {
+            $type = 'Task';
+        } else {
+            $type = 'problem';
+        }
+        my ($status,$accessmsg,$slot_name,$slot) =
+            &Apache::lonhomework::check_slot_access('0',$type);
+        if ($slot_name ne '') {
+            if (ref($slot) eq 'HASH') {
+                if (($slot->{'starttime'} < $now) &&
+                    ($slot->{'endtime'} > $now)) {
+                    $slothastime = 1;
+                }
+            }
+        }
+        if ($status ne 'CAN_ANSWER') {
+            return;
+        }
         my $duedate = &Apache::lonnet::EXT("resource.0.duedate");
         my @interval=&Apache::lonnet::EXT("resource.0.interval");
         my $hastimeleft;
@@ -2353,9 +2372,11 @@
             }
         }
         if (($duedate && $duedate > time) ||
-            (!$duedate && $hastimeleft)) {
+            (!$duedate && $hastimeleft) ||
+            ($slot_name ne '' && $slothastime)) {
             my ($collapse,$expand,$alttxt,$title,$currdisp);
-            if (@interval > 1 && $hastimeleft) {
+            if ((@interval > 1 && $hastimeleft) ||
+                ($type eq 'Task' && $slothastime)) {
                 $currdisp = 'inline';
                 $collapse = '► ';
             } else {




More information about the LON-CAPA-cvs mailing list