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

raeburn raeburn at source.lon-capa.org
Fri Oct 19 18:04:07 EDT 2018


raeburn		Fri Oct 19 22:04:07 2018 EDT

  Modified files:              
    /loncom/homework	structuretags.pm 
  Log:
  - Display warning when storage of firstaccess time fails after pushing 
    "Show Resource" button.
  
  
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.560 loncom/homework/structuretags.pm:1.561
--- loncom/homework/structuretags.pm:1.560	Tue May 15 04:59:14 2018
+++ loncom/homework/structuretags.pm	Fri Oct 19 22:04:07 2018
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.560 2018/05/15 04:59:14 raeburn Exp $
+# $Id: structuretags.pm,v 1.561 2018/10/19 22:04:07 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1765,14 +1765,17 @@
     my $ipused;
 
     my $name= &get_resource_name($parstack,$safeeval);
-    my ($result,$form_tag_start,$slot_name,$slot,$probpartlist);
+    my ($result,$form_tag_start,$slot_name,$slot,$probpartlist,$firstaccres);
 
     if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
         $target eq 'tex') {
         if ($env{'form.markaccess'}) {
             my @interval=&Apache::lonnet::EXT("resource.0.interval");
             my ($timelimit) = split(/_/,$interval[0]);
-            &Apache::lonnet::set_first_access($interval[1],$timelimit);
+            my $is_set = &Apache::lonnet::set_first_access($interval[1],$timelimit);
+            unless (($is_set eq 'ok') || ($is_set eq 'already_set')) {
+                $firstaccres = $is_set;
+            }
         }
     }
 
@@ -1879,6 +1882,10 @@
             ( $status eq 'NEED_DIFFERENT_IP')) {
 	    my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser,
 						       $style);
+            if (($status eq 'NOT_YET_VIEWED') && ($firstaccres)) {
+                $result .= '<p class="LC_error">'.
+                           &mt('A problem occurred when trying to start the timer.').'</p>';
+            }
             $result .= &access_status_msg('problem',$status,$symb,$target,$ipused,$accessmsg);
 	} elsif ($status eq 'NEEDS_CHECKIN') {
 	    my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser,




More information about the LON-CAPA-cvs mailing list