[LON-CAPA-cvs] cvs: loncom /xml lonxml.pm

sakharuk lon-capa-cvs@mail.lon-capa.org
Thu, 17 Oct 2002 14:42:07 -0000


sakharuk		Thu Oct 17 10:42:07 2002 EDT

  Modified files:              
    /loncom/xml	lonxml.pm 
  Log:
  Changes were done to make a uniform counter (for the exam in this case, but it can be used for other purposes).
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.202 loncom/xml/lonxml.pm:1.203
--- loncom/xml/lonxml.pm:1.202	Mon Oct 14 16:44:16 2002
+++ loncom/xml/lonxml.pm	Thu Oct 17 10:42:07 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.202 2002/10/14 20:44:16 albertel Exp $
+# $Id: lonxml.pm,v 1.203 2002/10/17 14:42:07 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -585,11 +585,7 @@
     $current_token=~s/\^/\\char94 /g;
     $current_token=~s/\~/\\char126 /g;
     $current_token=~s/(&[^a-z\#])/\\$1/g;
-    if ($current_token=~/ \#\w/) {
-	$current_token=~s/ \#(\w)/ \\#$1/;
-    } else {
-	$current_token=~s/([^&])(\#)/$1\\$2/g;
-    }
+    $current_token=~s/([^&])\#/$1\\#/g;
     $current_token=~s/(\$|_|{|})/\\$1/g;
     $current_token=~s/\\char92 /\\texttt{\\char92}/g;
     $current_token=~s/>/\$>\$/g; #more
@@ -851,6 +847,14 @@
   my ($request,$target)=@_;
   $Apache::lonxml::request=$request;
   $Apache::lonxml::registered = 0;
+  if ($ENV{'form.counter'}) {
+      $Apache::lonxml::counter=$ENV{'form.counter'}
+  } elsif (not defined $Apache::lonxml::counter) {
+      $Apache::lonxml::counter=1;
+      my %moreenv;
+      $moreenv{'form.counter'}=$Apache::lonxml::counter;
+      &Apache::lonnet::appenv(%moreenv);
+  } 
   @Apache::lonxml::pwd=();
   @Apache::lonxml::extlinks=();
   if ($target eq 'meta') {