[LON-CAPA-cvs] cvs: loncom / LWPReq.pm /homework lonhomework.pm /lonnet/perl lonnet.pm

raeburn raeburn at source.lon-capa.org
Thu Sep 20 10:17:11 EDT 2018


raeburn		Thu Sep 20 14:17:11 2018 EDT

  Modified files:              
    /loncom/homework	lonhomework.pm 
    /loncom	LWPReq.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - Slot status ignored when rendering content in grading interface for
    "View of the problem for user" and "Correct answer for user" boxes.
  
  
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.373 loncom/homework/lonhomework.pm:1.374
--- loncom/homework/lonhomework.pm:1.373	Tue Sep 18 14:30:19 2018
+++ loncom/homework/lonhomework.pm	Thu Sep 20 14:16:51 2018
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Homework handler
 #
-# $Id: lonhomework.pm,v 1.373 2018/09/18 14:30:19 raeburn Exp $
+# $Id: lonhomework.pm,v 1.374 2018/09/20 14:16:51 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -242,7 +242,8 @@
         $consumed_uniq = $slot{'uniqueperiod'};
         if ($slot{'iptied'}) {
             $ipused = $Apache::lonhomework::history{"$checkin.ip"};
-            unless (($ip ne '') && ($ipused eq $ip)) {
+            unless (($ip ne '') && 
+                    (($ipused eq $ip) || ($ENV{'REMOTE_ADDR'} eq '127.0.0.1'))) {
                 $blockip = $slot{'iptied'};
                 $slot_name = $checkinslot;
                 $returned_slot = \%slot;
@@ -276,6 +277,12 @@
 	        return ('SHOW_ANSWER');
             }
         }
+    } elsif (($type eq 'problem') &&
+             ($Apache::lonhomework::browse eq 'F') &&
+             ($ENV{'REMOTE_ADDR'} eq '127.0.0.1') &&
+             ($env{'form.grade_courseid'} eq $env{'request.course.id'}) &&
+             (&Apache::lonnet::allowed('mgr',$env{'request.course.id'}))) {
+        return ($status,$datemsg);
     }
 
     my $availablestudent = &Apache::lonnet::EXT("resource.0.availablestudent",$symb);
@@ -369,7 +376,7 @@
                         $earlyout = 1;
                     }
                 }
-                if (($currtries == $maxtries) || ($is_correct)) {
+                if ($currtries == $maxtries) {
                     $earlyout = 1;
                 } else { 
                     $numgraded ++;
Index: loncom/LWPReq.pm
diff -u loncom/LWPReq.pm:1.2 loncom/LWPReq.pm:1.3
--- loncom/LWPReq.pm:1.2	Mon Jul 25 19:49:45 2016
+++ loncom/LWPReq.pm	Thu Sep 20 14:17:01 2018
@@ -2,7 +2,7 @@
 # LON-CAPA wrapper for LWP UserAgent to accommodate certification
 # verification for SSL.
 #
-# $Id: LWPReq.pm,v 1.2 2016/07/25 19:49:45 raeburn Exp $
+# $Id: LWPReq.pm,v 1.3 2018/09/20 14:17:01 raeburn Exp $
 #
 # The LearningOnline Network with CAPA
 #
@@ -40,7 +40,7 @@
 use Apache::lonnet;
 
 sub makerequest {
-    my ($remotehostid,$request,$content,$perlvar,$timeout,$verifycert,$use_lc_ca,$debug) = @_;
+    my ($remotehostid,$request,$content,$perlvar,$timeout,$verifycert,$use_lc_ca,$islocal,$debug) = @_;
     unless (ref($perlvar) eq' HASH') {
         $perlvar = LONCAPA::Configuration::read_conf('loncapa.conf');
     }
@@ -115,6 +115,9 @@
         if ($use_lc_ca && $remotehostname && $fn) {
             $ua->requests_redirectable(undef);
         }
+        if ($islocal) {
+            $ua->local_address('127.0.0.1');
+        }
         if ($content ne '') {
             $response = $ua->request($request,$content);
         } else {
@@ -168,6 +171,14 @@
             if ($use_lc_ca && $remotehostname && $fn) {
                 $ua->requests_redirectable(undef);
             }
+            if ($islocal) {
+                if (LWP::UserAgent->VERSION >= 5.834) {
+                    $ua->local_address('127.0.0.1');
+                } else {
+                    local @LWP::Protocol::http::EXTRA_SOCK_OPTS =
+                          (LocalAddr => '127.0.0.1');
+                }
+            }
             if ($content ne '') {
                 $response = $ua->request($request,$content);
             } else {
@@ -187,6 +198,9 @@
                     $response = $ua->request($request);
                 }
             }
+            if (($islocal) && (LWP::UserAgent->VERSION < 5.834)) {
+                local @LWP::Protocol::http::EXTRA_SOCK_OPTS = ();
+            }
         }
    }
    if ($dns_set) {
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1383 loncom/lonnet/perl/lonnet.pm:1.1384
--- loncom/lonnet/perl/lonnet.pm:1.1383	Sat Aug 18 22:07:59 2018
+++ loncom/lonnet/perl/lonnet.pm	Thu Sep 20 14:17:11 2018
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1383 2018/08/18 22:07:59 raeburn Exp $
+# $Id: lonnet.pm,v 1.1384 2018/09/20 14:17:11 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3197,7 +3197,8 @@
 
     $request->header(Cookie => $ENV{'HTTP_COOKIE'});
     my $lonhost = $perlvar{'lonHostID'};
-    my $response= &LONCAPA::LWPReq::makerequest($lonhost,$request,'',\%perlvar);
+    my $response= &LONCAPA::LWPReq::makerequest($lonhost,$request,'',\%perlvar,
+                                                '','','',1);
 
     if (wantarray) {
 	return ($response->content, $response);




More information about the LON-CAPA-cvs mailing list