--- loncom/xml/lonxml.pm	2001/06/02 19:55:46	1.85
+++ loncom/xml/lonxml.pm	2001/06/08 20:01:45	1.88
@@ -9,7 +9,7 @@
 # 5/10 Scott Harrison
 # 5/26 Gerd Kortemeyer
 # 5/27 H. K. Ng
-# 6/2 Gerd Kortemeyer
+# 6/2,6/3,6/8 Gerd Kortemeyer
 
 package Apache::lonxml; 
 use vars 
@@ -99,12 +99,39 @@ sub fontsettings() {
 }
 
 sub registerurl {
-  return (<<ENDSCRIPT);
+    if ($ENV{'REQUEST_URI'}!~/^\/(res\/)*adm\//) {
+        my $hwkadd='';
+        if ($ENV{'REQUEST_URI'}=~/\.(problem|exam|quiz|assess|survey|form)$/) {
+	    if (&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'})) {
+		$hwkadd.=(<<ENDSUBM);
+                     menu.switchbutton
+           (7,1,'subm.gif','view sub','missions',
+                'gocmd("/adm/grades","submission")');
+ENDSUBM
+            }
+	    if (&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'})) {
+		$hwkadd.=(<<ENDGRDS);
+                     menu.switchbutton
+           (7,2,'pgrd.gif','problem','grades',
+                'gocmd("/adm/grades","viewgrades")');
+ENDGRDS
+            }
+	    if (&Apache::lonnet::allowed('opa',$ENV{'request.course.id'})) {
+		$hwkadd.=(<<ENDPARM);
+                     menu.switchbutton
+           (7,3,'pparm.gif','problem','parms',
+                'gocmd("/adm/parmset","set")');
+ENDPARM
+            }
+	}
+	return (<<ENDREGTHIS);
+     
 <script language="JavaScript">
 // BEGIN LON-CAPA Internal
+
     function LONCAPAreg() {
-       if (window.location.pathname!="/res/adm/pages/menu.html") {
 	  menu=window.open("","LONCAPAmenu");
+          menu.clearTimeout(menu.menucltim);
 	  menu.currentURL=window.location.pathname;
           menu.currentStale=0;
           menu.clearbut(3,1);
@@ -118,11 +145,31 @@ sub registerurl {
        (2,1,'back.gif','backward','','gopost("/adm/flip","back:"+currentURL)');
           menu.switchbutton
      (2,3,'forw.gif','forward','','gopost("/adm/flip","forward:"+currentURL)');
-       }
+          $hwkadd
     }
-  
+
     function LONCAPAstale() {
-       if (window.location.pathname!="/res/adm/pages/menu.html") {
+	  menu=window.open("","LONCAPAmenu");
+          menu.currentStale=1;
+          menu.switchbutton
+            (3,1,'reload.gif','return','location','go(currentURL)');
+          menu.menucltim=menu.setTimeout(
+ 'clearbut(2,1);clearbut(2,3);clearbut(8,1);clearbut(8,2);clearbut(8,3);',
+			  2000);
+
+      }
+
+// END LON-CAPA Internal
+</script>
+ENDREGTHIS
+
+    } else {
+        return (<<ENDDONOTREGTHIS);
+
+<script language="JavaScript">
+// BEGIN LON-CAPA Internal
+
+    function LONCAPAreg() {
 	  menu=window.open("","LONCAPAmenu");
           menu.currentStale=1;
           menu.clearbut(2,1);
@@ -130,13 +177,22 @@ sub registerurl {
           menu.clearbut(8,1);
           menu.clearbut(8,2);
           menu.clearbut(8,3);
-          menu.switchbutton
-            (3,1,'reload.gif','return','location','go(currentURL)');
-       }
+          if (menu.currentURL) {
+             menu.switchbutton
+              (3,1,'reload.gif','return','location','go(currentURL)');
+ 	  } else {
+	      menu.clearbut(3,1);
+          }
     }
+
+    function LONCAPAstale() {
+    }
+
 // END LON-CAPA Internal
 </script>
-ENDSCRIPT
+ENDDONOTREGTHIS
+
+    }
 }
 
 sub loadevents() {