[LON-CAPA-cvs] cvs: loncom /homework bridgetask.pm inputtags.pm lonhomework.pm /interface lonnavmaps.pm /lonnet/perl lonnet.pm

raeburn raeburn at source.lon-capa.org
Sun May 29 22:45:44 EDT 2016


raeburn		Mon May 30 02:45:44 2016 EDT

  Modified files:              
    /loncom/homework	lonhomework.pm bridgetask.pm inputtags.pm 
    /loncom/interface	lonnavmaps.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - Bug 6763. "Done" button.
    String saved for the Time-Limit (interval) parameter will no longer be a
    pure integer if use of the "done" button has been enabled. 
  
  
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.361 loncom/homework/lonhomework.pm:1.362
--- loncom/homework/lonhomework.pm:1.361	Fri May 13 22:48:09 2016
+++ loncom/homework/lonhomework.pm	Mon May 30 02:45:32 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Homework handler
 #
-# $Id: lonhomework.pm,v 1.361 2016/05/13 22:48:09 raeburn Exp $
+# $Id: lonhomework.pm,v 1.362 2016/05/30 02:45:32 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -561,15 +561,16 @@
     if ($status eq 'CAN_ANSWER' || $status eq 'CANNOT_ANSWER') {
 	my @interval=&Apache::lonnet::EXT("resource.$id.interval",$symb);
 	&Apache::lonxml::debug("looking for interval @interval");
-	if ($interval[0]) {
+	if ($interval[0]=~ /^\d+/) {
 	    my $first_access=&Apache::lonnet::get_first_access($interval[1],$symb);
 	    &Apache::lonxml::debug("looking for accesstime $first_access");
 	    if (!$first_access) {
 		$status='NOT_YET_VIEWED';
 		my $due_date = &due_date($id,$symb);
 		my $seconds_left = $due_date - time;
-		if ($seconds_left > $interval[0] || $due_date eq '') {
-		    $seconds_left = $interval[0];
+		my ($timelimit) = ($interval[0] =~ /^(\d+)/);
+		if ($seconds_left > $timelimit || $due_date eq '') {
+		    $seconds_left = $timelimit;
 		}
 		$datemsg=&seconds_to_human_length($seconds_left);
 	    }
@@ -604,7 +605,8 @@
 	my $first_access=&Apache::lonnet::get_first_access($interval[1],$symb);
 	&Apache::lonxml::debug("looking for first_access $first_access ($interval[1])");
 	if (defined($first_access)) {
-	    my $interval = $first_access+$interval[0];
+	    my ($timelimit) = ($interval[0] =~ /^(\d+)/);
+	    my $interval = $first_access+$timelimit;
 	    $date = (!$due_date || $interval < $due_date) ? $interval
                                                           : $due_date;
 	} else {
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.265 loncom/homework/bridgetask.pm:1.266
--- loncom/homework/bridgetask.pm:1.265	Mon Oct  5 02:35:40 2015
+++ loncom/homework/bridgetask.pm	Mon May 30 02:45:32 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: bridgetask.pm,v 1.265 2015/10/05 02:35:40 raeburn Exp $
+# $Id: bridgetask.pm,v 1.266 2016/05/30 02:45:32 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -711,7 +711,8 @@
         $target eq 'tex') {
         if ($env{'form.markaccess'}) {
             my @interval=&Apache::lonnet::EXT("resource.0.interval");
-            &Apache::lonnet::set_first_access($interval[1],$interval[0]);
+            my ($timelimit) = ($interval[0] =~ /^(\d+)/);
+            &Apache::lonnet::set_first_access($interval[1],$timelimit);
         }
     }
 
@@ -1443,7 +1444,7 @@
             if ($canstore) {
 	        &Apache::structuretags::finalize_storage();
                 my @interval = &Apache::lonnet::EXT("resource.0.interval");
-                if ($interval[0] =~ /^\d+$/ && $interval[1] eq 'resource') {
+                if ($interval[0] =~ /^\d+/ && $interval[1] eq 'resource') {
                     my $key=$courseid."\0".$symb;
                     my %times=&Apache::lonnet::get('firstaccesstimes',
                                                    [$key],$domain,$name);
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.342 loncom/homework/inputtags.pm:1.343
--- loncom/homework/inputtags.pm:1.342	Wed Apr  6 00:34:12 2016
+++ loncom/homework/inputtags.pm	Mon May 30 02:45:32 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.342 2016/04/06 00:34:12 raeburn Exp $
+# $Id: inputtags.pm,v 1.343 2016/05/30 02:45:32 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1333,7 +1333,8 @@
             my $first_access=&Apache::lonnet::get_first_access($interval[1]);
             if (defined($first_access)) {
                 my $due_date= &Apache::lonnet::EXT("resource.$part.duedate");
-                unless (($due_date) && ($due_date < $first_access + $interval[0])) { 
+                my ($timelimit) = ($interval[0] =~ /^(\d+)/);
+                unless (($due_date) && ($due_date < $first_access + $timelimit)) { 
                     $message = &mt("Answer Submitted: Your final submission will be graded when the time limit is reached.");
                 }
             }
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.519 loncom/interface/lonnavmaps.pm:1.520
--- loncom/interface/lonnavmaps.pm:1.519	Mon Apr  4 00:34:37 2016
+++ loncom/interface/lonnavmaps.pm	Mon May 30 02:45:38 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.519 2016/04/04 00:34:37 raeburn Exp $
+# $Id: lonnavmaps.pm,v 1.520 2016/05/30 02:45:38 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4682,11 +4682,12 @@
     my $date;
     my @interval=$self->parmval("interval", $part);
     my $due_date=$self->parmval("duedate", $part);
-    if ($interval[0] =~ /\d+/) {
-       my $first_access=&Apache::lonnet::get_first_access($interval[1],
-                                                          $self->{SYMB});
+    if ($interval[0] =~ /^(\d+)/) {
+        my $timelimit = $1;
+        my $first_access=&Apache::lonnet::get_first_access($interval[1],
+                                                           $self->{SYMB});
 	if (defined($first_access)) {
-           my $interval = $first_access+$interval[0];
+            my $interval = $first_access+$timelimit;
 	    $date = (!$due_date || $interval < $due_date) ? $interval 
                                                           : $due_date;
 	} else {
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1307 loncom/lonnet/perl/lonnet.pm:1.1308
--- loncom/lonnet/perl/lonnet.pm:1.1307	Thu Apr 21 00:36:17 2016
+++ loncom/lonnet/perl/lonnet.pm	Mon May 30 02:45:43 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1307 2016/04/21 00:36:17 raeburn Exp $
+# $Id: lonnet.pm,v 1.1308 2016/05/30 02:45:43 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4646,9 +4646,10 @@
 my $cachedtime='';
 
 sub load_all_first_access {
-    my ($uname,$udom)=@_;
+    my ($uname,$udom,$ignorecache)=@_;
     if (($cachedkey eq $uname.':'.$udom) &&
-        (abs($cachedtime-time)<5) && (!$env{'form.markaccess'})) {
+        (abs($cachedtime-time)<5) && (!$env{'form.markaccess'}) &&
+        (!$ignorecache)) {
         return;
     }
     $cachedtime=time;
@@ -4657,7 +4658,7 @@
 }
 
 sub get_first_access {
-    my ($type,$argsymb,$argmap)=@_;
+    my ($type,$argsymb,$argmap,$ignorecache)=@_;
     my ($symb,$courseid,$udom,$uname)=&whichuser();
     if ($argsymb) { $symb=$argsymb; }
     my ($map,$id,$res)=&decode_symb($symb);
@@ -4669,7 +4670,7 @@
     } else {
 	$res=$symb;
     }
-    &load_all_first_access($uname,$udom);
+    &load_all_first_access($uname,$udom,$ignorecache);
     return $cachedtimes{"$courseid\0$res"};
 }
 
@@ -7518,8 +7519,8 @@
                             }
                         }
                     }
-                    if ($interval[0] =~ /^\d+/) {
-                        my ($timelimit) = split(/_/,$interval[0]);
+                    if ($interval[0] =~ /^(\d+/)) {
+                        my $timelimit = $1; 
                         my $first_access;
                         if ($type eq 'resource') {
                             $first_access=&get_first_access($interval[1],$item);




More information about the LON-CAPA-cvs mailing list