[LON-CAPA-cvs] cvs: rat / lonwrapper.pm loncom lond loncom/interface lonexttool.pm

raeburn raeburn at source.lon-capa.org
Fri Dec 29 19:16:36 EST 2017


raeburn		Sat Dec 30 00:16:36 2017 EDT

  Modified files:              
    /loncom	lond 
    /loncom/interface	lonexttool.pm 
    /rat	lonwrapper.pm 
  Log:
  - Done button can be used with a gradable external tool to terminate 
    access.
  
  
Index: loncom/lond
diff -u loncom/lond:1.489.2.24 loncom/lond:1.489.2.25
--- loncom/lond:1.489.2.24	Sat Sep 24 19:44:15 2016
+++ loncom/lond	Tue Sep 27 16:30:24 2016
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.489.2.24 2016/09/24 19:44:15 raeburn Exp $
+# $Id: lond,v 1.489.2.25 2016/09/27 16:30:24 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -64,7 +64,7 @@
 my $status='';
 my $lastlog='';
 
-my $VERSION='$Revision: 1.489.2.24 $'; #' stupid emacs
+my $VERSION='$Revision: 1.489.2.25 $'; #' stupid emacs
 my $remoteVERSION;
 my $currenthostid="default";
 my $currentdomainid;
@@ -1429,7 +1429,7 @@
 #    If the requested path contains /../ or is:
 #
 #    1. for a directory, and the path does not begin with one of:
-#        (a) /home/httpd/html/res/<domain>/
+#        (a) /home/httpd/html/res/<domain>
 #        (b) /home/httpd/html/res/userfiles/
 #        (c) /home/httpd/lonUsers/<domain>/<1>/<2>/<3>/<username>/userfiles
 #    or is:
@@ -1466,7 +1466,7 @@
     }
     if (-e $ulsdir) {
 	if(-d $ulsdir) {
-            unless (($ulsdir =~ m{/home/httpd/html/(res/$LONCAPA::match_domain|userfiles)/}) ||
+            unless (($ulsdir =~ m{/home/httpd/html/(res/$LONCAPA::match_domain|userfiles/)}) ||
                     ($ulsdir =~ m{/home/httpd/lonUsers/$LONCAPA::match_domain(?:/[\w\-.@]){3}/$LONCAPA::match_username/userfiles/})) {
                 &Failure($client,"refused\n",$userinput);
                 return 1;
@@ -1526,7 +1526,7 @@
 #    If the requested path contains /../ or is:
 #
 #    1. for a directory, and the path does not begin with one of:
-#        (a) /home/httpd/html/res/<domain>/
+#        (a) /home/httpd/html/res/<domain>
 #        (b) /home/httpd/html/res/userfiles/
 #        (c) /home/httpd/lonUsers/<domain>/<1>/<2>/<3>/<username>/userfiles
 #    or is:
@@ -1562,7 +1562,7 @@
     }
     if (-e $ulsdir) {
         if(-d $ulsdir) {
-            unless (($ulsdir =~ m{/home/httpd/html/(res/$LONCAPA::match_domain|userfiles)/}) ||
+            unless (($ulsdir =~ m{/home/httpd/html/(res/$LONCAPA::match_domain|userfiles/)}) ||
                     ($ulsdir =~ m{/home/httpd/lonUsers/$LONCAPA::match_domain(?:/[\w\-.@]){3}/$LONCAPA::match_username/userfiles/})) {
                 &Failure($client,"refused\n","$userinput");
                 return 1;
@@ -1615,7 +1615,7 @@
 #    If the requested path (after prepending) contains /../ or is:
 #
 #    1. for a directory, and the path does not begin with one of:
-#        (a) /home/httpd/html/res/<domain>/
+#        (a) /home/httpd/html/res/<domain>
 #        (b) /home/httpd/html/res/userfiles/
 #        (c) /home/httpd/lonUsers/<domain>/<1>/<2>/<3>/<username>/userfiles
 #        (d) /home/httpd/html/priv/<domain>/ and client is the homeserver
@@ -1700,7 +1700,7 @@
     if (-e $ulsdir) {
         if(-d $ulsdir) {
             unless (($getpropath) || ($getuserdir) ||
-                    ($ulsdir =~ m{/home/httpd/html/(res/$LONCAPA::match_domain|userfiles)/}) ||
+                    ($ulsdir =~ m{/home/httpd/html/(res/$LONCAPA::match_domain|userfiles/)}) ||
                     ($ulsdir =~ m{/home/httpd/lonUsers/$LONCAPA::match_domain(?:/[\w\-.@]){3}/$LONCAPA::match_username/userfiles/}) ||
                     (($ulsdir =~ m{/home/httpd/html/priv/$LONCAPA::match_domain/}) && ($islocal))) {
                 &Failure($client,"refused\n",$userinput);
Index: loncom/interface/lonexttool.pm
diff -u loncom/interface/lonexttool.pm:1.12 loncom/interface/lonexttool.pm:1.13
--- loncom/interface/lonexttool.pm:1.12	Fri Dec 22 02:00:46 2017
+++ loncom/interface/lonexttool.pm	Sat Dec 30 00:16:29 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Launch External Tool Provider (LTI)
 #
-# $Id: lonexttool.pm,v 1.12 2017/12/22 02:00:46 raeburn Exp $
+# $Id: lonexttool.pm,v 1.13 2017/12/30 00:16:29 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -127,13 +127,20 @@
         return OK;
     }
 
-    my ($status,$open,$close,$msg);
+    my ($status,$open,$close,$msg,$donebuttonresult,$donemsg);
     if ($toolhash{'gradable'}) {
         $Apache::lonhomework::browse = &Apache::lonnet::allowed('bre',$r->uri);
+        my ($symb) = &Apache::lonnet::whichuser();
         if ($env{'form.markaccess'}) {
-            my @interval=&Apache::lonnet::EXT("resource.0.interval");
+            my @interval=&Apache::lonnet::EXT('resource.0.interval',$symb);
             my ($timelimit) = split(/_/,$interval[0]);
             &Apache::lonnet::set_first_access($interval[1],$timelimit);
+        } elsif ($symb && $env{'form.LC_interval_done'} eq 'true') {
+            # Set the event timer to zero if the "done button" was clicked.  The button is
+            # part of the doneButton form created in lonmenu.pm
+            ($donebuttonresult,$donemsg) = &Apache::lonhomework::zero_timer($symb);
+            undef($env{'form.LC_interval_done'});
+            undef($env{'form.LC_interval_done_proctorpass'});
         }
         ($status,$msg) = &gradabletool_access_check();
         undef($Apache::lonhomework::browse);
Index: rat/lonwrapper.pm
diff -u rat/lonwrapper.pm:1.67 rat/lonwrapper.pm:1.68
--- rat/lonwrapper.pm:1.67	Fri Dec 22 02:01:01 2017
+++ rat/lonwrapper.pm	Sat Dec 30 00:16:36 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Wrapper for external and binary files as standalone resources
 #
-# $Id: lonwrapper.pm,v 1.67 2017/12/22 02:01:01 raeburn Exp $
+# $Id: lonwrapper.pm,v 1.68 2017/12/30 00:16:36 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -38,6 +38,7 @@
 use Apache::lonhtmlcommon();
 use Apache::lonextresedit();
 use Apache::lonexttool();
+use Apache::lonhomework();
 use LONCAPA qw(:DEFAULT :match);
 use HTML::Entities();
 
@@ -82,14 +83,24 @@
         $args->{'only_body'} = $env{'form.only_body'};
     }
 
-    my $countdown;
+    my ($countdown,$donemsg);
     if (($exttool) && (&Apache::lonnet::EXT('resource.0.gradable') =~ /^yes$/i)) {
         $Apache::lonhomework::browse = &Apache::lonnet::allowed('bre',$url);
         if ($env{'form.markaccess'}) {
-            my @interval=&Apache::lonnet::EXT("resource.0.interval");
+            my $symb=&Apache::lonnet::symbread($url);
+            my @interval=&Apache::lonnet::EXT('resource.0.interval',$symb);
             my ($timelimit) = split(/_/,$interval[0]);
-            &Apache::lonnet::set_first_access($interval[1],$timelimit);
-            delete($env{'form.markaccess'});
+            my $setres = &Apache::lonnet::set_first_access($interval[1],$timelimit);
+            if ($setres eq 'ok') {
+                delete($env{'form.markaccess'});
+            }
+        } elsif ($env{'form.LC_interval_done'} eq 'true') {
+            my $symb=&Apache::lonnet::symbread($url);
+            if ($symb) {
+                (my $donebuttonresult,$donemsg) = &Apache::lonhomework::zero_timer($symb);
+                undef($env{'form.LC_interval_done'});
+                undef($env{'form.LC_interval_done_proctorpass'});
+            }
         }
         my ($status,$result,$resource_due) =
             &Apache::lonexttool::gradabletool_access_check();
@@ -118,7 +129,7 @@
         }
     }
 
-    my $startpage = &Apache::loncommon::start_page('Menu',undef,$args).$countdown;
+    my $startpage = &Apache::loncommon::start_page('Menu',undef,$args).$countdown.$donemsg;
     my $endpage = &Apache::loncommon::end_page();
 
     if (($env{'browser.mobile'}) || ($exttool eq 'window') || ($exttool eq 'tab')) {




More information about the LON-CAPA-cvs mailing list