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

bowersj2 lon-capa-cvs@mail.lon-capa.org
Wed, 06 Aug 2003 14:30:01 -0000


bowersj2		Wed Aug  6 10:30:01 2003 EDT

  Modified files:              
    /loncom/xml	lonxml.pm 
  Log:
  Add help info to inserttab.
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.267 loncom/xml/lonxml.pm:1.268
--- loncom/xml/lonxml.pm:1.267	Mon Aug  4 10:30:34 2003
+++ loncom/xml/lonxml.pm	Wed Aug  6 10:30:01 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.267 2003/08/04 14:30:34 sakharuk Exp $
+# $Id: lonxml.pm,v 1.268 2003/08/06 14:30:01 bowersj2 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1393,7 +1393,7 @@
     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;
@@ -1401,6 +1401,8 @@
       $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++;
     }
@@ -1433,6 +1435,20 @@
   }
   if (!defined ($tagnum)) { $tagnum=$Apache::lonxml::insertlist{"$tag.num"}; }
   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