--- loncom/xml/lonxml.pm	2002/07/01 15:29:23	1.179
+++ loncom/xml/lonxml.pm	2002/07/24 21:18:36	1.185
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.179 2002/07/01 15:29:23 matthew Exp $
+# $Id: lonxml.pm,v 1.185 2002/07/24 21:18:36 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -176,6 +176,9 @@ sub xmlend {
 		unless (($hidden) && (!$seeid)) {
                  my $message=$contrib{$idx.':message'};
                  $message=~s/\n/\<br \/\>/g;
+                 if (($message=~/\$.+\$/) || ($message=~/\\\[.+\\\]/)) {
+		     $message=&Apache::lontexconvert::converted(\$message);
+                 }
                  if ($message) {
                   if ($hidden) {
 		      $message='<font color="#888888">'.$message.'</font>';
@@ -346,7 +349,7 @@ sub registerurl {
     $Apache::lonxml::registered=1;
     my $nothing='';
     if ($ENV{'browser.type'} eq 'explorer') { $nothing='javascript:void(0);'; }
-    my $timesync='menu.clock.setTime(1000*'.time.');';
+    my $timesync='menu.syncclock(1000*'.time.');';
     if (($ENV{'REQUEST_URI'}!~/^\/(res\/)*adm\//) || ($forcereg)) {
         my $hwkadd='';
         if ($ENV{'request.filename'}=~/\.(problem|exam|quiz|assess|survey|form)$/) {
@@ -384,7 +387,7 @@ ENDPARM
           menu.switchbutton
        (8,1,'eval.gif','evaluate','this','gopost("/adm/evaluate",currentURL)');
           menu.switchbutton
-    (8,2,'fdbk.gif','feedback','on this','gopost("/adm/feedback",currentURL)');
+    (8,2,'fdbk.gif','feedback','discuss','gopost("/adm/feedback",currentURL)');
           menu.switchbutton
      (8,3,'prt.gif','prepare','printout','gopost("/adm/printout",currentURL)');
           menu.switchbutton
@@ -546,7 +549,19 @@ sub inner_xmlparse {
     while ($token = $$pars['-1']->get_token) {
       if (($token->[0] eq 'T') || ($token->[0] eq 'C') || ($token->[0] eq 'D') ) {
 	if ($metamode<1) {
-	  $result=$token->[1];
+	    if ($target eq 'tex') {
+		my @temp_array = @$stack;
+		if ($temp_array[-1] ne 'm') {
+		    if ($temp_array[-1] ne 'tt') {
+			if ($token->[1]=~m/\^/) {$token->[1]=~s/\^/\\verb|\^|/g;}
+		    } else {
+			if ($token->[1]=~m/\^/) {$token->[1]=~s/\^/}\\verb|\^|{/g;}
+		    }
+		    if ($token->[1]=~m/>/) {$token->[1]=~s/>/\$>\$/g;}
+		    if ($token->[1]=~m/</) {$token->[1]=~s/</\$<\$/g;}
+		}
+	    }
+	  $result.=$token->[1];
 	}
       } elsif ($token->[0] eq 'PI') {
 	if ($metamode<1) {
@@ -933,8 +948,34 @@ sub decreasedepth {
 #print "<br />e $Apache::lonxml::depth : $Apache::lonxml::olddepth : $token->[1] : $curdepth\n";
 }
 
-sub get_all_text {
+sub get_all_text_unbalanced {
+ my($tag,$pars)= @_;
+ my $token;
+ my $result='';
+ $tag='<'.$tag.'>';
+ while ($token = $$pars[-1]->get_token) {
+   if (($token->[0] eq 'T')||($token->[0] eq 'C')||($token->[0] eq 'D')) {
+     $result.=$token->[1];
+   } elsif ($token->[0] eq 'PI') {
+     $result.=$token->[2];
+   } elsif ($token->[0] eq 'S') {
+     $result.=$token->[4];
+   } elsif ($token->[0] eq 'E')  {
+     $result.=$token->[2];
+   }
+   if ($result =~ /(.*)$tag(.*)/) {
+     &Apache::lonxml::debug('Got a winner with leftovers ::'.$2);
+     &Apache::lonxml::debug('Result is :'.$1);
+     $result=$1;
+     my $redo=$tag.$2;
+     &Apache::lonxml::newparser($pars,\$redo);
+     last;
+   }
+ }
+ return $result
+}
 
+sub get_all_text {
  my($tag,$pars)= @_;
  my $depth=0;
  my $token;
@@ -1225,7 +1266,7 @@ ENDNOTFOUND
 sub debug {
   if ($Apache::lonxml::debug eq 1) {
     $|=1;
-    print("DEBUG:".join('<br />',@_)."<br />\n");
+    print("DEBUG:".&HTML::Entities::encode($_[0])."<br />\n");
   }
 }