--- loncom/interface/loncommon.pm	2009/10/01 17:25:17	1.893
+++ loncom/interface/loncommon.pm	2009/10/16 00:17:25	1.898
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.893 2009/10/01 17:25:17 raeburn Exp $
+# $Id: loncommon.pm,v 1.898 2009/10/16 00:17:25 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -493,6 +493,7 @@ sub coursebrowser_javascript {
     $output .= <<"ENDSTDBRW";
     function opencrsbrowser(formname,uname,udom,desc,extra_element,multflag,crstype) {
         var url = '/adm/pickcourse?';
+        var formid = getFormIdByName(formname);
         var domainfilter = getDomainFromSelectbox(formname,udom);
         if (domainfilter != null) {
            if (domainfilter != '') {
@@ -2954,7 +2955,7 @@ sub messagewrapper {
 sub noteswrapper {
     my ($link,$un,$do)=@_;
     return 
-"<a href='/adm/email?recordftf=retrieve&recname=$un&recdom=$do'>$link</a>";
+"<a href='/adm/email?recordftf=retrieve&amp;recname=$un&amp;recdom=$do'>$link</a>";
 }
 
 # ------------------------------------------------------------- Aboutme Wrapper
@@ -4396,6 +4397,9 @@ sub bodytag {
         if ($env{'request.role'} !~ /^cr/) {
             $role = &Apache::lonnet::plaintext($role,&course_type());
         }
+        if ($env{'request.course.sec'}) {
+            $role .= ('&nbsp;'x2).'-&nbsp;'.&mt('section:').'&nbsp;'.$env{'request.course.sec'};
+        }   
 	$realm = $env{'course.'.$env{'request.course.id'}.'.description'};
     } else {
         $role = &Apache::lonnet::plaintext($role);
@@ -4435,34 +4439,52 @@ sub bodytag {
         $dc_info = '('.$dc_info.')';
     }
 
-    $role = "($role)" if $role;
+    $role = '<span class="LC_nobreak">('.$role.')</span>' if $role;
     &get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['inhibitmenu']);
 
     if ($env{'environment.remote'} eq 'off') {
         # No Remote
-	if ($env{'request.state'} eq 'construct') {
-	    $forcereg=1;
-	}
+        if ($env{'request.state'} eq 'construct') {
+            $forcereg=1;
+        }
 
-#    if ($env{'request.state'} eq 'construct') {
-#        $titleinfo = &CSTR_pageheader(); #FIXME: Will be removed once all scripts have their own calls
-#    }
+    #    if ($env{'request.state'} eq 'construct') {
+    #        $titleinfo = &CSTR_pageheader(); #FIXME: Will be removed once all scripts have their own calls
+    #    }
 
         my $titletable = '<table id="LC_title_bar">'
-                        ."<tr><td> $titleinfo $dc_info</td>"
-                        .'</tr></table>';
+                            ."<tr><td> $titleinfo $dc_info</td>"
+                            .'</tr></table>';
 
-	if ($no_nav_bar) {
-	    $bodytag .= $titletable;
-	} else {
-        $bodytag .= qq|<div id="LC_nav_bar">$name $role<br />
-            <em>$realm</em> $dc_info</div>| unless $env{'form.inhibitmenu'};
+        if ($no_nav_bar) {
+            $bodytag .= $titletable;
+        } else {
+            $bodytag .= qq|<div id="LC_nav_bar">$name $role<br />
+                <em>$realm</em> $dc_info</div>| unless $env{'form.inhibitmenu'};
 
-	    if ($env{'request.state'} eq 'construct') {
-                $bodytag .= &Apache::lonmenu::menubuttons($forcereg,$titletable);
-            } else {
-                $bodytag .= &Apache::lonmenu::menubuttons($forcereg).$titletable;
-            }
+#SD $titletable is obsolete
+#SD            if ($env{'request.state'} eq 'construct') {
+#SD                $bodytag .= &Apache::lonmenu::menubuttons($forcereg,$titletable);
+#SD            } else {
+#SD                $bodytag .= &Apache::lonmenu::menubuttons($forcereg).$titletable;
+#SD            }
+               if (   $env{'form.inhibitmenu'} eq 'yes' 
+                   || $ENV{'REQUEST_URI'} eq '/adm/logout'
+                   || $env{'request.noversionuri'} =~ m{^/res/adm/pages/}) {
+                   
+                   return $bodytag;
+               }
+
+               $bodytag .= Apache::lonhtmlcommon::scripttag(
+                                Apache::lonmenu::utilityfunctions(),
+                                'start');
+               $bodytag .= Apache::lonmenu::primary_menu();
+               $bodytag .= Apache::lonmenu::secondary_menu();
+               #SD remove next line
+               #$bodytag .= Apache::lonmenu::menubuttons($forcereg);
+               $bodytag .= Apache::lonmenu::serverform();
+               $bodytag .= Apache::lonhtmlcommon::scripttag('', 'end'); 
+               $bodytag .= Apache::lonmenu::innerregister($forcereg) if $forcereg;
         }
         return $bodytag;
     }
@@ -4482,7 +4504,7 @@ sub bodytag {
 	       :'<a href="/adm/remote?action=collapse" target="_top">'.&mt('Switch to Inline Menu Mode').'</a>');
     $bodytag .= qq|<div id="LC_nav_bar">$name $role
             <em>$realm</em> $dc_info </div>
-            <ol class="LC_smallMenu LC_right">
+            <ol class="LC_primary_menu LC_right">
                 <li>$menu</li>
             </ol>| unless $env{'form.inhibitmenu'};
     #
@@ -5811,10 +5833,10 @@ div.LC_createcourse {
 # --------------------------*/
 
 a:hover,
-ol.LC_smallMenu a:hover,
+ol.LC_primary_menu a:hover,
 ol#LC_MenuBreadcrumbs a:hover,
 ol#LC_PathBreadcrumbs a:hover,
-ul#LC_TabMainMenuContent a:hover,
+ul#LC_secondary_menu a:hover,
 .LC_FormSectionClearButton input:hover
 ul.LC_TabContent   li:hover a {
 	color:#BF2317;
@@ -5891,7 +5913,7 @@ fieldset > legend {
     font-style: normal;
 }
 
-ol.LC_smallMenu {
+ol.LC_primary_menu {
     float: right;
     margin: 0.2em 0 0 0;
 }
@@ -5900,23 +5922,23 @@ ol#LC_PathBreadcrumbs {
 	margin: 0;
 }
 
-ol.LC_smallMenu li {
+ol.LC_primary_menu li {
 	display: inline;
 	padding: 5px 5px 0 10px;
 	vertical-align: top;
 }
 
-ol.LC_smallMenu li img {
+ol.LC_primary_menu li img {
 	vertical-align: bottom;
 }
 
-ol.LC_smallMenu a {
+ol.LC_primary_menu a {
 	font-size: 90%;
 	color: RGB(80, 80, 80);
 	text-decoration: none;
 }
 
-ul#LC_TabMainMenuContent {
+ul#LC_secondary_menu {
     clear: both;
     color: $fontmenu;
     background: $tabbg;
@@ -5926,7 +5948,7 @@ ul#LC_TabMainMenuContent {
     width: 100%;
 }
 
-ul#LC_TabMainMenuContent li {
+ul#LC_secondary_menu li {
     font-weight: bold;
     line-height: 1.8em;
     padding: 0 0.8em; 
@@ -5949,7 +5971,7 @@ ul.LC_TabContentBigger li {
 	float:left;
 }
 
-ul#LC_TabMainMenuContent li a {
+ul#LC_secondary_menu li a {
     color: $fontmenu;
 	text-decoration: none;
 }