--- loncom/xml/lonxml.pm	2003/06/16 21:32:43	1.264
+++ loncom/xml/lonxml.pm	2003/08/06 17:00:30	1.269
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.264 2003/06/16 21:32:43 www Exp $
+# $Id: lonxml.pm,v 1.269 2003/08/06 17:00:30 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -70,6 +70,7 @@ use Math::Cephes();
 use Math::Random();
 use Opcode();
 
+
 sub register {
   my ($space,@taglist) = @_;
   foreach my $temptag (@taglist) {
@@ -95,6 +96,8 @@ use Apache::run();
 use Apache::londefdef();
 use Apache::scripttag();
 use Apache::edit();
+use Apache::inputtags();
+use Apache::outputtags();
 use Apache::lonnet();
 use Apache::File();
 use Apache::loncommon();
@@ -489,6 +492,7 @@ sub latex_special_symbols {
 	$current_token=~s/(>|<)/\$$1\$/g; #more or less
 	if ($current_token=~m/\d%/) {$current_token =~ s/(\d)%/$1\\%/g;} #percent after digit
 	if ($current_token=~m/\s%/) {$current_token =~ s/(\s)%/$1\\%/g;} #persent after space
+	if ($current_token eq '%.') {$current_token = '\%.';} #persent at the end of statement
     }
     return $current_token;
 }
@@ -1046,7 +1050,7 @@ sub parstring {
       my $val=$token->[2]->{$_};
       $val =~ s/([\%\@\\\"\'])/\\$1/g;
       #if ($val =~ m/^[\%\@]/) { $val="\\".$val; }
-      $temp .= "my \$$_=\"$val\";"
+      $temp .= "my \$$_=\"$val\";";
     }
   }
   return $temp;
@@ -1139,13 +1143,7 @@ sub inserteditinfo {
       my ($result,$filecontents)=@_;
       $filecontents = &HTML::Entities::encode($filecontents);
 #      my $editheader='<a href="#editsection">Edit below</a><hr />';
-      my $xml_help = '<table><tr><td>'.
-	  &Apache::loncommon::help_open_topic("Greek_Symbols",'Greek Symbols',
-					      undef,undef,600)
-	      .'</td><td>'.
-          &Apache::loncommon::help_open_topic("Other_Symbols",'Other Symbols',
-					      undef,undef,600)
-	      .'</td></tr></table>';
+      my $xml_help = Apache::loncommon::helpLatexCheatsheet();
       my $titledisplay=&display_title();
       my $buttons=(<<BUTTONS);
 <input type="submit" name="attemptclean" 
@@ -1395,7 +1393,7 @@ sub register_insert {
     my $line = $data[$i];
     if ( $line =~ /^\#/ || $line =~ /^\s*\n/) { next; }
     if ( $line =~ /TABLE/ ) { last; }
-    my ($tag,$descrip,$color,$function,$show) = split(/,/, $line);
+    my ($tag,$descrip,$color,$function,$show,$helpfile,$helpdesc) = split(/,/, $line);
     if ($tag) {
       $insertlist{"$tagnum.tag"} = $tag;
       $insertlist{"$tagnum.description"} = $descrip;
@@ -1403,6 +1401,8 @@ sub register_insert {
       $insertlist{"$tagnum.function"} = $function;
       if (!defined($show)) { $show='yes'; }
       $insertlist{"$tagnum.show"}= $show;
+      $insertlist{"$tagnum.helpfile"} = $helpfile;
+      $insertlist{"$tagnum.helpdesc"} = $helpdesc;
       $insertlist{"$tag.num"}=$tagnum;
       $tagnum++;
     }
@@ -1437,6 +1437,20 @@ sub description {
   return $insertlist{$tagnum.'.description'};
 }
 
+# Returns a list containing the help file, and the description
+sub helpinfo {
+  my ($token)=@_;
+  my $tagnum;
+  my $tag=$token->[1];
+  foreach my $namespace (reverse @Apache::lonxml::namespace) {
+    my $testtag=$namespace.'::'.$tag;
+    $tagnum=$insertlist{"$testtag.num"};
+    if (defined($tagnum)) { last; }
+  }
+  if (!defined ($tagnum)) { $tagnum=$Apache::lonxml::insertlist{"$tag.num"}; }
+  return ($insertlist{$tagnum.'.helpfile'}, $insertlist{$tagnum.'.helpdesc'});
+}
+
 # ----------------------------------------------------------------- whichuser
 # returns a list of $symb, $courseid, $domain, $name that is correct for
 # calls to lonnet functions for this setup.
@@ -1446,7 +1460,7 @@ sub whichuser {
   my ($symb,$courseid,$domain,$name,$publicuser);
   if (defined($ENV{'form.grade_symb'})) {
     my $tmp_courseid=$ENV{'form.grade_courseid'};
-    my $allowed=&Apache::lonnet::allowed('mgr',$tmp_courseid);
+    my $allowed=&Apache::lonnet::allowed('vgr',$tmp_courseid);
     if ($allowed) {
       $symb=$ENV{'form.grade_symb'};
       $courseid=$ENV{'form.grade_courseid'};