--- loncom/xml/lonxml.pm	2002/12/26 16:40:33	1.222
+++ loncom/xml/lonxml.pm	2003/01/15 23:59:27	1.225
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.222 2002/12/26 16:40:33 www Exp $
+# $Id: lonxml.pm,v 1.225 2003/01/15 23:59:27 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -408,8 +408,7 @@ sub registerurl {
     }
     if ($Apache::lonxml::registered && !$forcereg) { return ''; }
     $Apache::lonxml::registered=1;
-    my $nothing='';
-    if ($ENV{'browser.type'} eq 'explorer') { $nothing='javascript:void(0);'; }
+    my $reopen=&Apache::lonmenu::reopenmenu();
     my $newmail='';
     if (&Apache::lonmsg::newmail()) { 
        $newmail='menu.setstatus("you have","messages");';
@@ -499,7 +498,7 @@ ENDPARM
 // BEGIN LON-CAPA Internal
 
     function LONCAPAreg() {
-	  menu=window.open("$nothing","LONCAPAmenu","",false);
+	  menu=$reopen;
           menu.clearTimeout(menu.menucltim);
           $timesync
           $newmail
@@ -510,7 +509,7 @@ ENDPARM
           menu.currentStale=0;
           menu.clearbut(3,1);
           menu.switchbutton
-       (6,3,'catalog.gif','catalog','info','catalog_info()');
+       (6,3,'catalog.gif','catalog','info','catalog_info()','Show catalog information');
           menu.switchbutton
        (8,1,'eval.gif','evaluate','this','gopost("/adm/evaluate",currentURL)','Provide my evaluation of this resource');
           menu.switchbutton
@@ -532,7 +531,7 @@ ENDPARM
     }
 
     function LONCAPAstale() {
-	  menu=window.open("$nothing","LONCAPAmenu","",false);
+	  menu=$reopen
           menu.currentStale=1;
           if (menu.reloadURL!='' && menu.reloadURL!= null) { 
              menu.switchbutton
@@ -559,7 +558,7 @@ ENDREGTHIS
 // BEGIN LON-CAPA Internal
 
     function LONCAPAreg() {
-	  menu=window.open("$nothing","LONCAPAmenu","",false);
+	  menu=$reopen
           $timesync
           menu.currentStale=1;
           menu.clearbut(2,1);
@@ -774,7 +773,7 @@ sub inner_xmlparse {
       if ($token->[0] eq 'E') { 
 	&end_tag($stack,$parstack,$token);
       }
-    }
+    }	
     if ($#$pars > -1) {
 	pop @$pars;
 	pop @Apache::lonxml::pwd;
@@ -1116,7 +1115,9 @@ sub store_counter {
 sub get_all_text {
  my($tag,$pars)= @_;
  &Apache::lonxml::debug("Got a ".ref($pars));
+ my $gotfullstack=1;
  if (ref($pars) ne 'ARRAY') {
+     $gotfullstack=0;
      $pars=[$pars];
  }
  my $depth=0;
@@ -1125,7 +1126,8 @@ sub get_all_text {
  if ( $tag =~ m:^/: ) { 
    my $tag=substr($tag,1); 
    #&Apache::lonxml::debug("have:$tag:");
-   while (($depth >=0) && ($#$pars > -1)) {
+   my $top_empty=0;
+   while (($depth >=0) && ($#$pars > -1) && (!$top_empty)) {
      while (($depth >=0) && ($token = $$pars[-1]->get_token)) {
        #&Apache::lonxml::debug("e token:$token->[0]:$depth:$token->[1]:".$#$pars.":".$#Apache::lonxml::pwd);
        if (($token->[0] eq 'T')||($token->[0] eq 'C')||($token->[0] eq 'D')) {
@@ -1147,6 +1149,16 @@ sub get_all_text {
        pop(@$pars);
        pop(@Apache::lonxml::pwd);
      }
+     if (($depth >=0) && ($#$pars == 0) ) {        &debug("here4");$top_empty=1; }
+   }
+   if ($top_empty && $depth >= 0) {
+       #never found the end tag ran out of text, throw error send back blank
+       &error('Never found end tag for <'.$tag.'>');
+       if ($gotfullstack) {
+	   my $newstring='</'.$tag.'>'.$result;
+	   &Apache::lonxml::newparser($pars,\$newstring);
+       }
+       $result='';
    }
  } else {
      while ($#$pars > -1) {