--- loncom/xml/lonxml.pm	2002/05/16 00:56:46	1.169
+++ loncom/xml/lonxml.pm	2002/05/24 20:51:55	1.174
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.169 2002/05/16 00:56:46 albertel Exp $
+# $Id: lonxml.pm,v 1.174 2002/05/24 20:51:55 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -135,6 +135,9 @@ $prevent_entity_encode=0;
 # has the dynamic menu been updated to know about this resource
 $Apache::lonxml::registered=0;
 
+# a pointer the the Apache request object
+$Apache::lonxml::request='';
+
 sub xmlbegin {
   my $output='';
   if ($ENV{'browser.mathml'}) {
@@ -329,7 +332,7 @@ sub registerurl {
     my $target = shift;
     my $result = '';
     if (($ENV{'request.publicaccess'}) || 
-       ($ENV{'REQUEST_URI'} eq '/res/adm/pages/menu.html')) {
+       (!&Apache::lonnet::is_on_map($ENV{'REQUEST_URI'}))) {
 	return 
          '<script>function LONCAPAreg(){} function LONCAPAstale(){}</script>';
     }
@@ -337,6 +340,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.');';
     if (($ENV{'REQUEST_URI'}!~/^\/(res\/)*adm\//) || ($forcereg)) {
         my $hwkadd='';
         if ($ENV{'request.filename'}=~/\.(problem|exam|quiz|assess|survey|form)$/) {
@@ -347,7 +351,7 @@ ENDSUBM
             }
 	    if (&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'})) {
 		$hwkadd.=(<<ENDGRDS);
-                     menu.switchbutton(7,2,'pgrd.gif','problem','grades','gocmd("/adm/grades","viewgrades")');
+                     menu.switchbutton(7,2,'pgrd.gif','problem','grades','gocmd("/adm/grades","gradingmenu")');
 ENDGRDS
             }
 	    if (&Apache::lonnet::allowed('opa',$ENV{'request.course.id'})) {
@@ -364,6 +368,7 @@ ENDPARM
     function LONCAPAreg() {
 	  menu=window.open("$nothing","LONCAPAmenu","",false);
           menu.clearTimeout(menu.menucltim);
+          $timesync
 	  menu.currentURL=window.location.pathname;
           menu.currentStale=0;
           menu.clearbut(3,1);
@@ -415,6 +420,7 @@ ENDREGTHIS
 
     function LONCAPAreg() {
 	  menu=window.open("$nothing","LONCAPAmenu","",false);
+          $timesync
           menu.currentStale=1;
           menu.clearbut(2,1);
           menu.clearbut(2,3);
@@ -511,9 +517,9 @@ sub printalltags {
 }
 
 sub xmlparse {
- my ($target,$content_file_string,$safeinit,%style_for_target) = @_;
+ my ($request,$target,$content_file_string,$safeinit,%style_for_target) = @_;
 
- &setup_globals($target);
+ &setup_globals($request,$target);
  #&printalltags();
  my @pars = ();
  my $pwd=$ENV{'request.filename'};
@@ -798,7 +804,8 @@ sub callsub {
 }
 
 sub setup_globals {
-  my ($target)=@_;
+  my ($request,$target)=@_;
+  $Apache::lonxml::request=$request;
   $Apache::lonxml::registered = 0;
   @Apache::lonxml::pwd=();
   @Apache::lonxml::extlinks=();
@@ -1128,9 +1135,9 @@ BUTTONS
 <a name="editsection" />
 <form method="post">
 <input type="hidden" name="editmode" value="Edit" />
-$buttons
+$buttons<br />
 <textarea cols="80" rows="40" name="filecont">$filecontents</textarea>
-$buttons
+<br />$buttons
 <br />
 </form>
 ENDFOOTER
@@ -1219,7 +1226,8 @@ ENDNOTFOUND
       }
     }
     if (!$ENV{'form.editmode'} || $ENV{'form.viewmode'}) {
-      $result = &Apache::lonxml::xmlparse($target,$filecontents,'',%mystyle);
+      $result = &Apache::lonxml::xmlparse($request,$target,$filecontents,
+					  '',%mystyle);
     }
   }