[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /homework essayresponse.pm

raeburn raeburn at source.lon-capa.org
Tue Feb 19 09:24:38 EST 2019


raeburn		Tue Feb 19 14:24:38 2019 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/homework	essayresponse.pm 
  Log:
  - For 2.11
    Backport 1.125, 1.126
  
  
Index: loncom/homework/essayresponse.pm
diff -u loncom/homework/essayresponse.pm:1.118 loncom/homework/essayresponse.pm:1.118.2.1
--- loncom/homework/essayresponse.pm:1.118	Tue Jan 21 14:38:55 2014
+++ loncom/homework/essayresponse.pm	Tue Feb 19 14:24:38 2019
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # essay (ungraded) style responses
 #
-# $Id: essayresponse.pm,v 1.118 2014/01/21 14:38:55 kruse Exp $
+# $Id: essayresponse.pm,v 1.118.2.1 2019/02/19 14:24:38 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -210,16 +210,30 @@
 				      &escape($crsid));
 			my $essayurl=
 			    &Apache::lonnet::declutter($ENV{'REQUEST_URI'});
-			my ($adom,$aname,$apath)=
-			    ($essayurl=~/^($LONCAPA::domain_re)\/($LONCAPA::username_re)\/(.*)$/);
-                        $apath=&escape($apath);
-			$apath=~s/\W/\_/gs;
-			&Apache::lonnet::put('nohist_essay_'.$apath,
-					 { $akey => $response },$adom,$aname);
-		    }
+                        if ($essayurl eq 'lib/templates/simpleproblem.problem') {
+                            my %crsinfo = &Apache::lonnet::coursedescription($crsid);
+                            my $cdom = $crsinfo{'domain'};
+                            my $cnum = $crsinfo{'num'};
+                            my ($map,$id,$res) = &Apache::lonnet::decode_symb($symb);
+                            if ($map =~ m{^\Quploaded/$cdom/$cnum/\E(default(?:|_\d+)\.(?:sequence|page))$}) {
+                                my $apath = $1.'_'.$id;
+                                $apath=~s/\W/\_/gs;
+                                my $akey = join('.',&escape($name),&escape($domain));
+                                &Apache::lonnet::put('nohist_essay_'.$apath,
+                                                     { $akey => $response },$cdom,$cnum);
+                            }
+                        } else {
+			    my ($adom,$aname,$apath)=
+			        ($essayurl=~/^($LONCAPA::domain_re)\/($LONCAPA::username_re)\/(.*)$/);
+                            $apath=&escape($apath);
+			    $apath=~s/\W/\_/gs;
+			    &Apache::lonnet::put('nohist_essay_'.$apath,
+                                                 { $akey => $response },$adom,$aname);
+                        }
+                    }
                 }
             }
-	} 
+        }
     } elsif ($target eq 'edit') {
 	$result.=&Apache::edit::end_table();
 




More information about the LON-CAPA-cvs mailing list