[LON-CAPA-cvs] cvs: rat / lonpage.pm lonwrapper.pm loncom/homework structuretags.pm loncom/interface londocs.pm lonmenu.pm loncom/xml londefdef.pm lontex.pm lontexconvert.pm lonxml.pm

www lon-capa-cvs@mail.lon-capa.org
Fri, 14 Feb 2003 19:35:55 -0000


This is a MIME encoded message

--www1045251355
Content-Type: text/plain

www		Fri Feb 14 14:35:55 2003 EDT

  Modified files:              
    /loncom/homework	structuretags.pm 
    /loncom/interface	londocs.pm lonmenu.pm 
    /loncom/xml	londefdef.pm lontex.pm lontexconvert.pm lonxml.pm 
    /rat	lonpage.pm lonwrapper.pm 
  Log:
  A lot of things happened here:
  
  * everything menu-related was moved out of lonxml, and into lonmenu
  * thus, function calls to registerurl, loadevents and unloadevents modified
  * fixed lontex.pm, which actually did not call the right routines
  * put in calls to lonmenu::menubuttons, which is supposed to insert buttons
    after the body tag in "textual mode" - this function and registerurl will
    be unified (buttons either in Remote or on top of page)
  
  
  
--www1045251355
Content-Type: text/plain
Content-Disposition: attachment; filename="www-20030214143555.txt"

Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.146 loncom/homework/structuretags.pm:1.147
--- loncom/homework/structuretags.pm:1.146	Fri Feb  7 17:03:21 2003
+++ loncom/homework/structuretags.pm	Fri Feb 14 14:35:54 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.146 2003/02/07 22:03:21 albertel Exp $
+# $Id: structuretags.pm,v 1.147 2003/02/14 19:35:54 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -35,6 +35,7 @@
 use strict;
 use Apache::lonnet;
 use Apache::File();
+use Apache::lonmenu;
 
 BEGIN {
   &Apache::lonxml::register('Apache::structuretags',('block','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','startouttext','endouttext'));
@@ -81,12 +82,12 @@
   if (!defined($found{'html'})) {
     $result=&Apache::londefdef::start_html($target,$token,$tagstack,$parstack,
 					   $parser,$safeeval);
-    $head_tag_start='<head>'.&Apache::lonxml::registerurl(undef,$target);
+    $head_tag_start='<head>'.&Apache::lonmenu::registerurl(undef,$target);
   }
   my $body_tag_start;
   if (!defined($found{'body'})) {
-    $body_tag_start='<body onLoad="'.&Apache::lonxml::loadevents().'" '.
-      'onUnload="'.&Apache::lonxml::unloadevents().'" ';
+    $body_tag_start='<body onLoad="'.&Apache::lonmenu::loadevents().'" '.
+      'onUnload="'.&Apache::lonmenu::unloadevents().'" ';
     my $background=&Apache::lonxml::get_param('background',$parstack,$safeeval);
     if ($background) {
       $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.48 loncom/interface/londocs.pm:1.49
--- loncom/interface/londocs.pm:1.48	Fri Feb  7 10:05:37 2003
+++ loncom/interface/londocs.pm	Fri Feb 14 14:35:54 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.48 2003/02/07 15:05:37 www Exp $
+# $Id: londocs.pm,v 1.49 2003/02/14 19:35:54 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -472,6 +472,7 @@
     my $script='';
     my $allowed;
     my $events='';
+    my $buttons='';
     my $showdoc=0;
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
        ['folder','foldername']);
@@ -490,9 +491,10 @@
        }
     } else { # got called in sequence from course
        $allowed=0;
-       $script='</script>'.&Apache::lonxml::registerurl(1,undef).'<script>';
-       $events='onLoad="'.&Apache::lonxml::loadevents.
-           '" onUnload="'.&Apache::lonxml::unloadevents.'"';
+       $script='</script>'.&Apache::lonmenu::registerurl(1,undef).'<script>';
+       $events='onLoad="'.&Apache::lonmenu::loadevents.
+           '" onUnload="'.&Apache::lonmenu::unloadevents.'"';
+       $buttons=&Apache::lonmenu::menubuttons(1,undef);
     }
 
 # get course data
@@ -579,7 +581,8 @@
   }
 # -------------------------------------------------------------------- Body tag
   $r->print('</head>'.
-            &Apache::loncommon::bodytag('Course Documents','',$events));
+            &Apache::loncommon::bodytag('Course Documents','',$events).
+            $buttons);
   unless ($showdoc) {
     if ($allowed) {
        $r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc',
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.37 loncom/interface/lonmenu.pm:1.38
--- loncom/interface/lonmenu.pm:1.37	Fri Feb 14 10:14:37 2003
+++ loncom/interface/lonmenu.pm	Fri Feb 14 14:35:54 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.37 2003/02/14 15:14:37 www Exp $
+# $Id: lonmenu.pm,v 1.38 2003/02/14 19:35:54 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -40,6 +40,222 @@
 use Apache::loncommon;
 use Apache::File;
 use vars qw(@desklines $readdesk);
+
+# ======================================================= Make the menu buttons
+
+sub menubuttons {
+    my $forcereg=shift;
+    my $target  =shift;
+    unless ($ENV{'browser.interface'} eq 'textual') { return ''; }
+    return "Menu here<hr />";
+}
+
+# ============================================== Register a URL with the remote
+
+
+sub registerurl {
+    my $forcereg=shift;
+    my $target = shift;
+    my $result = '';
+    
+    if ($target eq 'edit') {
+        $result .="<script type=\"text/javascrtipt\">\n".
+            "if (typeof swmenu != 'undefined') {swmenu.currentURL=null;}\n".
+            &Apache::loncommon::browser_and_searcher_javascript().
+                "\n</script>\n";
+    }
+    if (($ENV{'browser.interface'} eq 'textual') ||
+        ((($ENV{'request.publicaccess'}) || 
+         (!&Apache::lonnet::is_on_map($ENV{'REQUEST_URI'}))) &&
+        (!$forcereg))) {
+	return $result.
+         '<script type="text/javascript">function LONCAPAreg(){;} function LONCAPAstale(){}</script>';
+    }
+    if ($Apache::lonxml::registered && !$forcereg) { return ''; }
+    $Apache::lonxml::registered=1;
+    my $reopen=&Apache::lonmenu::reopenmenu();
+    my $newmail='';
+    if (&Apache::lonmsg::newmail()) { 
+       $newmail='swmenu.setstatus("you have","messages");';
+    }
+    my $timesync='swmenu.syncclock(1000*'.time.');';
+    if (($ENV{'REQUEST_URI'}!~/^\/(res\/)*adm\//) || ($forcereg)) {
+        my $hwkadd='';
+        if ($ENV{'request.filename'}=~/\.(problem|exam|quiz|assess|survey|form)$/) {
+	    if (&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'})) {
+		$hwkadd.=(<<ENDSUBM);
+                     swmenu.switchbutton(7,1,'subm.gif','view sub','missions','gocmd("/adm/grades","submission")',
+                     'View user submissions for this assessment resource');
+ENDSUBM
+            }
+	    if (&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'})) {
+		$hwkadd.=(<<ENDGRDS);
+                     swmenu.switchbutton(7,2,'pgrd.gif','problem','grades','gocmd("/adm/grades","gradingmenu")',
+                     'Modify user grades for this assessment resource');
+ENDGRDS
+            }
+	    if (&Apache::lonnet::allowed('opa',$ENV{'request.course.id'})) {
+		$hwkadd.=(<<ENDPARM);
+                     swmenu.switchbutton(7,3,'pparm.gif','problem','parms','gocmd("/adm/parmset","set")',
+                     'Modify deadlines, etc, for this assessment resource');
+ENDPARM
+            }
+	}
+        ###
+        ### Determine whether or not to display the 'cstr' button for this
+        ### resource
+        ###
+        my $editbutton = '';
+        if ($ENV{'user.author'}) {
+            if ($ENV{'request.role'}=~/^(ca|au)/) {
+                # Set defaults for authors
+                my ($top,$bottom) = ('con-','struct');
+                my $action = "go('/priv/".$ENV{'user.name'}."');";
+                my $cadom  = $ENV{'request.role.domain'};
+                my $caname = $ENV{'user.name'};
+                my $desc = "Enter my resource construction space";
+                # Set defaults for co-authors
+                if ($ENV{'request.role'} =~ /^ca/) { 
+                    ($cadom,$caname)=($ENV{'request.role'}=~/(\w+)\/(\w+)$/);
+                    ($top,$bottom) = ('co con-','struct');
+                    $action = "go('/priv/".$caname."');";
+                    $desc = "Enter construction space as co-author";
+                }
+                # Check that we are on the correct machine
+                my $home = &Apache::lonnet::homeserver($caname,$cadom);
+                if ($home eq $Apache::lonnet::perlvar{'lonHostID'}) {
+                    $editbutton=&Apache::lonmenu::switch
+                        ('','',6,1,$top,,$bottom,$action,$desc);
+                }
+            }
+            ##
+            ## Determine if user can edit url.
+            ##
+            my $cfile='';
+            my $cfuname='';
+            my $cfudom='';
+            if ($ENV{'request.filename'}) {
+                my $file=&Apache::lonnet::declutter($ENV{'request.filename'});
+                $file=~s/^(\w+)\/(\w+)/\/priv\/$2/;
+                # Chech that the user has permission to edit this resource
+                ($cfuname,$cfudom)=&Apache::loncacc::constructaccess($file,$1);
+                if (defined($cfudom)) {
+                    if (&Apache::lonnet::homeserver($cfuname,$cfudom) 
+                        eq $Apache::lonnet::perlvar{'lonHostID'}) {
+                        $cfile=$file;
+                    }
+                }
+            }        
+            # Finally, turn the button on or off
+            if ($cfile) {
+                $editbutton=&Apache::lonmenu::switch
+                    ('','',6,1,'cstr.gif','edit','resource',
+                     "go('".$cfile."');","Edit this resource");
+            } elsif ($editbutton eq '') {
+                $editbutton = '    swmenu.clearbut(6,1);';
+            }
+        }
+        ###
+        ###
+	$result = (<<ENDREGTHIS);
+     
+<script language="JavaScript">
+// BEGIN LON-CAPA Internal
+
+    function LONCAPAreg() {
+	  swmenu=$reopen;
+          swmenu.clearTimeout(swmenu.menucltim);
+          $timesync
+          $newmail
+	  swmenu.currentURL=window.location.pathname;
+          swmenu.reloadURL=window.location.pathname;
+          swmenu.currentSymb="$ENV{'request.symb'}";
+          swmenu.reloadSymb="$ENV{'request.symb'}";
+          swmenu.currentStale=0;
+          swmenu.clearbut(3,1);
+          swmenu.switchbutton
+       (6,3,'catalog.gif','catalog','info','catalog_info()','Show catalog information');
+          swmenu.switchbutton
+       (8,1,'eval.gif','evaluate','this','gopost("/adm/evaluate",currentURL)','Provide my evaluation of this resource');
+          swmenu.switchbutton
+    (8,2,'fdbk.gif','feedback','discuss','gopost("/adm/feedback",currentURL)','Provide feedback messages or contribute to the course discussion about this resource');
+          swmenu.switchbutton
+     (8,3,'prt.gif','prepare','printout','gopost("/adm/printout",currentURL)','Prepare a printable document');
+          swmenu.switchbutton
+       (2,1,'back.gif','backward','','gopost("/adm/flip","back:"+currentURL)','Go to the previous resource in the course sequence');
+          swmenu.switchbutton
+     (2,3,'forw.gif','forward','','gopost("/adm/flip","forward:"+currentURL)','Go to the next resource in the course sequence');
+          swmenu.switchbutton
+                            (9,1,'sbkm.gif','set','bookmark','set_bookmark()','Set a bookmark for this resource');
+          swmenu.switchbutton
+                         (9,2,'vbkm.gif','view','bookmark','edit_bookmarks()','Use or edit my bookmark collection');
+          swmenu.switchbutton
+                               (9,3,'anot.gif','anno-','tations','annotate()','Make notes and annotations about this resource');
+          $hwkadd
+          $editbutton
+    }
+
+    function LONCAPAstale() {
+	  swmenu=$reopen
+          swmenu.currentStale=1;
+          if (swmenu.reloadURL!='' && swmenu.reloadURL!= null) { 
+             swmenu.switchbutton
+             (3,1,'reload.gif','return','location','go(reloadURL)','Return to the last known location in the course sequence');
+	  }
+          swmenu.clearbut(7,1);
+          swmenu.clearbut(7,2);
+          swmenu.clearbut(7,3);
+          swmenu.menucltim=swmenu.setTimeout(
+ 'clearbut(2,1);clearbut(2,3);clearbut(8,1);clearbut(8,2);clearbut(8,3);'+
+ 'clearbut(9,1);clearbut(9,2);clearbut(9,3);clearbut(6,3);clearbut(6,1)',
+			  2000);
+
+      }
+
+// END LON-CAPA Internal
+</script>
+ENDREGTHIS
+
+    } else {
+        $result = (<<ENDDONOTREGTHIS);
+
+<script language="JavaScript">
+// BEGIN LON-CAPA Internal
+
+    function LONCAPAreg() {
+	  swmenu=$reopen
+          $timesync
+          swmenu.currentStale=1;
+          swmenu.clearbut(2,1);
+          swmenu.clearbut(2,3);
+          swmenu.clearbut(8,1);
+          swmenu.clearbut(8,2);
+          swmenu.clearbut(8,3);
+          if (swmenu.currentURL) {
+             swmenu.switchbutton
+              (3,1,'reload.gif','return','location','go(currentURL)');
+ 	  } else {
+	      swmenu.clearbut(3,1);
+          }
+    }
+
+    function LONCAPAstale() {
+    }
+
+// END LON-CAPA Internal
+</script>
+ENDDONOTREGTHIS
+    }
+    return $result;
+}
+
+sub loadevents() {
+    return 'LONCAPAreg();';
+}
+
+sub unloadevents() {
+    return 'LONCAPAstale();';
+}
 
 # ============================================================= Start up remote
 
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.112 loncom/xml/londefdef.pm:1.113
--- loncom/xml/londefdef.pm:1.112	Fri Feb  7 17:03:21 2003
+++ loncom/xml/londefdef.pm	Fri Feb 14 14:35:55 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.112 2003/02/07 22:03:21 albertel Exp $
+# $Id: londefdef.pm,v 1.113 2003/02/14 19:35:55 www Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -49,6 +49,7 @@
 use Apache::lonxml;
 use Apache::File();
 use Image::Magick;
+use Apache::lonmenu;
 
 BEGIN {
 
@@ -183,7 +184,7 @@
 	    my ($target,$token) = @_;
             my $currentstring = '';
             if ($target eq 'web') {
-              $currentstring = &Apache::lonxml::registerurl(undef,$target).
+              $currentstring = &Apache::lonmenu::registerurl(undef,$target).
                                $token->[2];    
             } 
 	   return $currentstring;
@@ -365,7 +366,7 @@
             if ($target eq 'web') {
 	      if (!$Apache::lonxml::registered) {
 		$currentstring.='<head>'.
-		    &Apache::lonxml::registerurl(undef,$target).'</head>';
+		    &Apache::lonmenu::registerurl(undef,$target).'</head>';
 	      }
 	      my $onLoad='';
 	      foreach my $key (keys(%{$token->[2]})) {
@@ -374,7 +375,7 @@
 		  delete($token->[2]->{$key});
 		}
 	      }
-	      $token->[2]->{'onload'}=&Apache::lonxml::loadevents().
+	      $token->[2]->{'onload'}=&Apache::lonmenu::loadevents().
 		                       ';'.$onLoad;
 	      my $onUnload='';
 	      foreach my $key (keys(%{$token->[2]})) {
@@ -383,7 +384,7 @@
 		  delete($token->[2]->{$key});
 		}
 	      }
-	      $token->[2]->{'onunload'}=&Apache::lonxml::unloadevents().
+	      $token->[2]->{'onunload'}=&Apache::lonmenu::unloadevents().
 		                         ';'.$onUnload;
 
 	      $currentstring .= '<'.$token->[1];
@@ -397,7 +398,9 @@
 		<input type="submit" name="editmode" value="Edit" />
 		</form>
 EDITBUTTON
-	      }
+              } else {
+		$currentstring.=&Apache::lonmenu::menubuttons(undef,$target);
+              }
        	    } elsif ($target eq 'tex') {
               $currentstring = '\begin{document}';  
 	    } 
@@ -1789,7 +1792,7 @@
 	  if ($target eq 'web') { 
 	    if (!$Apache::lonxml::registered) {
 	      $currentstring.='<head>'.
-		  &Apache::lonxml::registerurl(undef,$target).'</head>';
+		  &Apache::lonmenu::registerurl(undef,$target).'</head>';
 	    }
 	    $currentstring .= $token->[4];
 	  }
Index: loncom/xml/lontex.pm
diff -u loncom/xml/lontex.pm:1.3 loncom/xml/lontex.pm:1.4
--- loncom/xml/lontex.pm:1.3	Thu Nov 29 14:03:58 2001
+++ loncom/xml/lontex.pm	Fri Feb 14 14:35:55 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # TeX Content Handler
 #
-# $Id: lontex.pm,v 1.3 2001/11/29 19:03:58 www Exp $
+# $Id: lontex.pm,v 1.4 2003/02/14 19:35:55 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -78,7 +78,13 @@
   
   $r->print(&Apache::lontexconvert::header());
   $r->print(
- '<body bgcolor="#FFFFFF" onLoad="LONCAPAreg();" onUnload="LONCAPAstale();">');
+    '<body bgcolor="#FFFFFF" onLoad="'.
+      &Apache::lonmenu::loadevents().
+    '" onUnload="'.
+      &Apache::lonmenu::unloadevents().
+    '">'.
+      &Apache::lonmenu::menubuttons(undef,'web')
+  );
   $r->print(&Apache::lontexconvert::converted(\$texstring));
   $r->print('</body>');
   $r->print(&Apache::lontexconvert::footer());
Index: loncom/xml/lontexconvert.pm
diff -u loncom/xml/lontexconvert.pm:1.15 loncom/xml/lontexconvert.pm:1.16
--- loncom/xml/lontexconvert.pm:1.15	Wed Feb  5 17:50:44 2003
+++ loncom/xml/lontexconvert.pm	Fri Feb 14 14:35:55 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # TeX Conversion Module
 #
-# $Id: lontexconvert.pm,v 1.15 2003/02/05 22:50:44 albertel Exp $
+# $Id: lontexconvert.pm,v 1.16 2003/02/14 19:35:55 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -46,6 +46,7 @@
 use vars qw($errorstring);
 use Apache::lonmsg;
 use Apache::lonxml;
+use Apache::lonmenu;
 
 # ====================================================================== Header
 
@@ -70,7 +71,7 @@
   return &Apache::lonxml::xmlbegin().
          &Apache::lonxml::fontsettings().
          "\n<head>\n".
-         &Apache::lonxml::registerurl(undef,'tex').
+         &Apache::lonmenu::registerurl(undef,'tex').
 	 "\n</head>\n";
 }
 
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.233 loncom/xml/lonxml.pm:1.234
--- loncom/xml/lonxml.pm:1.233	Fri Feb 14 10:14:37 2003
+++ loncom/xml/lonxml.pm	Fri Feb 14 14:35:55 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.233 2003/02/14 15:14:37 www Exp $
+# $Id: lonxml.pm,v 1.234 2003/02/14 19:35:55 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -374,210 +374,6 @@
              '<meta Content-Type="text/html; charset=x-mac-roman">';
     }
     return $headerstring;
-}
-
-sub registerurl {
-    my $forcereg=shift;
-    my $target = shift;
-    my $result = '';
-    
-    if ($target eq 'edit') {
-        $result .="<script type=\"text/javascrtipt\">\n".
-            "if (typeof swmenu != 'undefined') {swmenu.currentURL=null;}\n".
-            &Apache::loncommon::browser_and_searcher_javascript().
-                "\n</script>\n";
-    }
-    if (($ENV{'browser.interface'} eq 'textual') ||
-        ((($ENV{'request.publicaccess'}) || 
-         (!&Apache::lonnet::is_on_map($ENV{'REQUEST_URI'}))) &&
-        (!$forcereg))) {
-	return $result.
-         '<script type="text/javascript">function LONCAPAreg(){;} function LONCAPAstale(){}</script>';
-    }
-    if ($Apache::lonxml::registered && !$forcereg) { return ''; }
-    $Apache::lonxml::registered=1;
-    my $reopen=&Apache::lonmenu::reopenmenu();
-    my $newmail='';
-    if (&Apache::lonmsg::newmail()) { 
-       $newmail='swmenu.setstatus("you have","messages");';
-    }
-    my $timesync='swmenu.syncclock(1000*'.time.');';
-    if (($ENV{'REQUEST_URI'}!~/^\/(res\/)*adm\//) || ($forcereg)) {
-        my $hwkadd='';
-        if ($ENV{'request.filename'}=~/\.(problem|exam|quiz|assess|survey|form)$/) {
-	    if (&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'})) {
-		$hwkadd.=(<<ENDSUBM);
-                     swmenu.switchbutton(7,1,'subm.gif','view sub','missions','gocmd("/adm/grades","submission")',
-                     'View user submissions for this assessment resource');
-ENDSUBM
-            }
-	    if (&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'})) {
-		$hwkadd.=(<<ENDGRDS);
-                     swmenu.switchbutton(7,2,'pgrd.gif','problem','grades','gocmd("/adm/grades","gradingmenu")',
-                     'Modify user grades for this assessment resource');
-ENDGRDS
-            }
-	    if (&Apache::lonnet::allowed('opa',$ENV{'request.course.id'})) {
-		$hwkadd.=(<<ENDPARM);
-                     swmenu.switchbutton(7,3,'pparm.gif','problem','parms','gocmd("/adm/parmset","set")',
-                     'Modify deadlines, etc, for this assessment resource');
-ENDPARM
-            }
-	}
-        ###
-        ### Determine whether or not to display the 'cstr' button for this
-        ### resource
-        ###
-        my $editbutton = '';
-        if ($ENV{'user.author'}) {
-            if ($ENV{'request.role'}=~/^(ca|au)/) {
-                # Set defaults for authors
-                my ($top,$bottom) = ('con-','struct');
-                my $action = "go('/priv/".$ENV{'user.name'}."');";
-                my $cadom  = $ENV{'request.role.domain'};
-                my $caname = $ENV{'user.name'};
-                my $desc = "Enter my resource construction space";
-                # Set defaults for co-authors
-                if ($ENV{'request.role'} =~ /^ca/) { 
-                    ($cadom,$caname)=($ENV{'request.role'}=~/(\w+)\/(\w+)$/);
-                    ($top,$bottom) = ('co con-','struct');
-                    $action = "go('/priv/".$caname."');";
-                    $desc = "Enter construction space as co-author";
-                }
-                # Check that we are on the correct machine
-                my $home = &Apache::lonnet::homeserver($caname,$cadom);
-                if ($home eq $Apache::lonnet::perlvar{'lonHostID'}) {
-                    $editbutton=&Apache::lonmenu::switch
-                        ('','',6,1,$top,,$bottom,$action,$desc);
-                }
-            }
-            ##
-            ## Determine if user can edit url.
-            ##
-            my $cfile='';
-            my $cfuname='';
-            my $cfudom='';
-            if ($ENV{'request.filename'}) {
-                my $file=&Apache::lonnet::declutter($ENV{'request.filename'});
-                $file=~s/^(\w+)\/(\w+)/\/priv\/$2/;
-                # Chech that the user has permission to edit this resource
-                ($cfuname,$cfudom)=&Apache::loncacc::constructaccess($file,$1);
-                if (defined($cfudom)) {
-                    if (&Apache::lonnet::homeserver($cfuname,$cfudom) 
-                        eq $Apache::lonnet::perlvar{'lonHostID'}) {
-                        $cfile=$file;
-                    }
-                }
-            }        
-            # Finally, turn the button on or off
-            if ($cfile) {
-                $editbutton=&Apache::lonmenu::switch
-                    ('','',6,1,'cstr.gif','edit','resource',
-                     "go('".$cfile."');","Edit this resource");
-            } elsif ($editbutton eq '') {
-                $editbutton = '    swmenu.clearbut(6,1);';
-            }
-        }
-        ###
-        ###
-	$result = (<<ENDREGTHIS);
-     
-<script language="JavaScript">
-// BEGIN LON-CAPA Internal
-
-    function LONCAPAreg() {
-	  swmenu=$reopen;
-          swmenu.clearTimeout(swmenu.menucltim);
-          $timesync
-          $newmail
-	  swmenu.currentURL=window.location.pathname;
-          swmenu.reloadURL=window.location.pathname;
-          swmenu.currentSymb="$ENV{'request.symb'}";
-          swmenu.reloadSymb="$ENV{'request.symb'}";
-          swmenu.currentStale=0;
-          swmenu.clearbut(3,1);
-          swmenu.switchbutton
-       (6,3,'catalog.gif','catalog','info','catalog_info()','Show catalog information');
-          swmenu.switchbutton
-       (8,1,'eval.gif','evaluate','this','gopost("/adm/evaluate",currentURL)','Provide my evaluation of this resource');
-          swmenu.switchbutton
-    (8,2,'fdbk.gif','feedback','discuss','gopost("/adm/feedback",currentURL)','Provide feedback messages or contribute to the course discussion about this resource');
-          swmenu.switchbutton
-     (8,3,'prt.gif','prepare','printout','gopost("/adm/printout",currentURL)','Prepare a printable document');
-          swmenu.switchbutton
-       (2,1,'back.gif','backward','','gopost("/adm/flip","back:"+currentURL)','Go to the previous resource in the course sequence');
-          swmenu.switchbutton
-     (2,3,'forw.gif','forward','','gopost("/adm/flip","forward:"+currentURL)','Go to the next resource in the course sequence');
-          swmenu.switchbutton
-                            (9,1,'sbkm.gif','set','bookmark','set_bookmark()','Set a bookmark for this resource');
-          swmenu.switchbutton
-                         (9,2,'vbkm.gif','view','bookmark','edit_bookmarks()','Use or edit my bookmark collection');
-          swmenu.switchbutton
-                               (9,3,'anot.gif','anno-','tations','annotate()','Make notes and annotations about this resource');
-          $hwkadd
-          $editbutton
-    }
-
-    function LONCAPAstale() {
-	  swmenu=$reopen
-          swmenu.currentStale=1;
-          if (swmenu.reloadURL!='' && swmenu.reloadURL!= null) { 
-             swmenu.switchbutton
-             (3,1,'reload.gif','return','location','go(reloadURL)','Return to the last known location in the course sequence');
-	  }
-          swmenu.clearbut(7,1);
-          swmenu.clearbut(7,2);
-          swmenu.clearbut(7,3);
-          swmenu.menucltim=swmenu.setTimeout(
- 'clearbut(2,1);clearbut(2,3);clearbut(8,1);clearbut(8,2);clearbut(8,3);'+
- 'clearbut(9,1);clearbut(9,2);clearbut(9,3);clearbut(6,3);clearbut(6,1)',
-			  2000);
-
-      }
-
-// END LON-CAPA Internal
-</script>
-ENDREGTHIS
-
-    } else {
-        $result = (<<ENDDONOTREGTHIS);
-
-<script language="JavaScript">
-// BEGIN LON-CAPA Internal
-
-    function LONCAPAreg() {
-	  swmenu=$reopen
-          $timesync
-          swmenu.currentStale=1;
-          swmenu.clearbut(2,1);
-          swmenu.clearbut(2,3);
-          swmenu.clearbut(8,1);
-          swmenu.clearbut(8,2);
-          swmenu.clearbut(8,3);
-          if (swmenu.currentURL) {
-             swmenu.switchbutton
-              (3,1,'reload.gif','return','location','go(currentURL)');
- 	  } else {
-	      swmenu.clearbut(3,1);
-          }
-    }
-
-    function LONCAPAstale() {
-    }
-
-// END LON-CAPA Internal
-</script>
-ENDDONOTREGTHIS
-    }
-    return $result;
-}
-
-sub loadevents() {
-    return 'LONCAPAreg();';
-}
-
-sub unloadevents() {
-    return 'LONCAPAstale();';
 }
 
 sub printalltags {
Index: rat/lonpage.pm
diff -u rat/lonpage.pm:1.48 rat/lonpage.pm:1.49
--- rat/lonpage.pm:1.48	Mon Feb  3 13:03:53 2003
+++ rat/lonpage.pm	Fri Feb 14 14:35:55 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Page Handler
 #
-# $Id: lonpage.pm,v 1.48 2003/02/03 18:03:53 harris41 Exp $
+# $Id: lonpage.pm,v 1.49 2003/02/14 19:35:55 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -45,6 +45,7 @@
 use Apache::lonnet();
 use Apache::loncommon();
 use Apache::lonxml();
+use Apache::lonmenu;
 use HTML::TokeParser;
 use GDBM_File;
 use Apache::lonsequence;
@@ -353,13 +354,13 @@
 			      $r->print("\n<script language='JavaScript'>\n".
 					$allscript."\n</script>\n");
 			  }
-			  $r->print(&Apache::lonxml::registerurl(1,undef));
+			  $r->print(&Apache::lonmenu::registerurl(1,undef));
 			  $r->print("\n</head>\n");
 # ------------------------------------------------------------------ Start body
 			  if ($isxml) {
 			      $r->print($xmlbody);
 			  } else {
-			      $r->print('<body bgcolor="#FFFFFF" onLoad="'.&Apache::lonxml::loadevents.'" onUnload="'.&Apache::lonxml::unloadevents.'">');
+			      $r->print('<body bgcolor="#FFFFFF" onLoad="'.&Apache::lonmenu::loadevents.'" onUnload="'.&Apache::lonmenu::unloadevents.'">');
 			  }
 # ------------------------------------------------------------------ Start form
 			  if ($nforms) {
Index: rat/lonwrapper.pm
diff -u rat/lonwrapper.pm:1.7 rat/lonwrapper.pm:1.8
--- rat/lonwrapper.pm:1.7	Fri Feb  7 17:53:13 2003
+++ rat/lonwrapper.pm	Fri Feb 14 14:35:55 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Wrapper for external and binary files as standalone resources
 #
-# $Id: lonwrapper.pm,v 1.7 2003/02/07 22:53:13 albertel Exp $
+# $Id: lonwrapper.pm,v 1.8 2003/02/14 19:35:55 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -39,6 +39,7 @@
 use Apache::Constants qw(:common);
 use Apache::lonnet();
 use Apache::lonxml();
+use Apache::lonmenu;
 
 # ================================================================ Main Handler
 
@@ -56,9 +57,9 @@
       $url=&Apache::lonnet::tokenwrapper($url);
   }
   $url.='?'.$ENV{'QUERY_STRING'}; #reappend the query arguments
-  my $events='onLoad="'.&Apache::lonxml::loadevents.
-           '" onUnload="'.&Apache::lonxml::unloadevents.'"';
-  my $script=&Apache::lonxml::registerurl(1,undef);
+  my $events='onLoad="'.&Apache::lonmenu::loadevents.
+           '" onUnload="'.&Apache::lonmenu::unloadevents.'"';
+  my $script=&Apache::lonmenu::registerurl(1,undef);
   $r->print(<<ENDDOCUMENT);
 <html>
 <head>

--www1045251355--