[LON-CAPA-cvs] cvs: loncom /homework lonhomework.pm /publisher lonpublisher.pm /xml lonxml.pm run.pm

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 23 May 2002 21:12:44 -0000


albertel		Thu May 23 17:12:44 2002 EDT

  Modified files:              
    /loncom/publisher	lonpublisher.pm 
    /loncom/xml	lonxml.pm run.pm 
    /loncom/homework	lonhomework.pm 
  Log:
  - &Apache::lonxml::xmlparse now wants a request obect passed along
  
  - modified all known calls of xmlparse to take pass a request object
  
  - added code to timeout a <script> block that runs more that the configured timeout parameter of seconds. (LON-CAPA defaults to 300)
   
  
  
Index: loncom/publisher/lonpublisher.pm
diff -u loncom/publisher/lonpublisher.pm:1.81 loncom/publisher/lonpublisher.pm:1.82
--- loncom/publisher/lonpublisher.pm:1.81	Fri May 17 18:08:01 2002
+++ loncom/publisher/lonpublisher.pm	Thu May 23 17:12:44 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Publication Handler
 #
-# $Id: lonpublisher.pm,v 1.81 2002/05/17 22:08:01 albertel Exp $
+# $Id: lonpublisher.pm,v 1.82 2002/05/23 21:12:44 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -533,7 +533,7 @@
         my $oldenv=$ENV{'request.uri'};
 
         $ENV{'request.uri'}=$target;
-        $allmeta=Apache::lonxml::xmlparse('meta',$content);
+        $allmeta=Apache::lonxml::xmlparse(undef,'meta',$content);
         $ENV{'request.uri'}=$oldenv;
 
         &metaeval($allmeta);
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.171 loncom/xml/lonxml.pm:1.172
--- loncom/xml/lonxml.pm:1.171	Mon May 20 22:26:53 2002
+++ loncom/xml/lonxml.pm	Thu May 23 17:12:44 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.171 2002/05/21 02:26:53 albertel Exp $
+# $Id: lonxml.pm,v 1.172 2002/05/23 21:12:44 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -135,6 +135,9 @@
 # has the dynamic menu been updated to know about this resource
 $Apache::lonxml::registered=0;
 
+# a pointer the the Apache request object
+$Apache::lonxml::request='';
+
 sub xmlbegin {
   my $output='';
   if ($ENV{'browser.mathml'}) {
@@ -511,9 +514,9 @@
 }
 
 sub xmlparse {
- my ($target,$content_file_string,$safeinit,%style_for_target) = @_;
+ my ($request,$target,$content_file_string,$safeinit,%style_for_target) = @_;
 
- &setup_globals($target);
+ &setup_globals($request,$target);
  #&printalltags();
  my @pars = ();
  my $pwd=$ENV{'request.filename'};
@@ -798,7 +801,8 @@
 }
 
 sub setup_globals {
-  my ($target)=@_;
+  my ($request,$target)=@_;
+  $Apache::lonxml::request=$request;
   $Apache::lonxml::registered = 0;
   @Apache::lonxml::pwd=();
   @Apache::lonxml::extlinks=();
@@ -1219,7 +1223,8 @@
       }
     }
     if (!$ENV{'form.editmode'} || $ENV{'form.viewmode'}) {
-      $result = &Apache::lonxml::xmlparse($target,$filecontents,'',%mystyle);
+      $result = &Apache::lonxml::xmlparse($request,$target,$filecontents,
+					  '',%mystyle);
     }
   }
 
Index: loncom/xml/run.pm
diff -u loncom/xml/run.pm:1.27 loncom/xml/run.pm:1.28
--- loncom/xml/run.pm:1.27	Fri May  3 18:30:54 2002
+++ loncom/xml/run.pm	Thu May 23 17:12:44 2002
@@ -1,6 +1,6 @@
 package Apache::run;
 #
-# $Id: run.pm,v 1.27 2002/05/03 22:30:54 albertel Exp $
+# $Id: run.pm,v 1.28 2002/05/23 21:12:44 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -62,7 +62,9 @@
   my ($code,$safeeval,$hideerrors) = @_;
 #  print "inside run\n";
   $@='';
+  $Apache::lonxml::request->hard_timeout("Apache::run::run, evaluation $code");
   my (@result)=$safeeval->reval($code);
+  $Apache::lonxml::request->kill_timeout;
   my $error=$@;
   if ($error ne '' && !$hideerrors) {
     &Apache::lonxml::error('<pre>'.&HTML::Entities::encode($error).
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.77 loncom/homework/lonhomework.pm:1.78
--- loncom/homework/lonhomework.pm:1.77	Thu Apr 11 12:02:32 2002
+++ loncom/homework/lonhomework.pm	Thu May 23 17:12:44 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Homework handler
 #
-# $Id: lonhomework.pm,v 1.77 2002/04/11 16:02:32 albertel Exp $
+# $Id: lonhomework.pm,v 1.78 2002/05/23 21:12:44 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -351,7 +351,7 @@
       $default='';
     }
     &Apache::lonxml::debug("Should be parsing now");
-    $result = &Apache::lonxml::xmlparse($target, $problem,
+    $result = &Apache::lonxml::xmlparse($request, $target, $problem,
 			$default.&setup_vars($target),%mystyle);
 
     #$request->print("Result follows:");