--- loncom/interface/lonmenu.pm	2007/04/24 23:26:02	1.217
+++ loncom/interface/lonmenu.pm	2007/08/30 22:35:41	1.225
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.217 2007/04/24 23:26:02 albertel Exp $
+# $Id: lonmenu.pm,v 1.225 2007/08/30 22:35:41 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -61,7 +61,7 @@ sub initlittle {
 				       'main' => 'Main Menu',
                                        'roles' => ($env{'user.adv'}?
                                                     'Roles':'Courses'),
-                                       'docs' => 'Course Documents',
+                                       'docs' => 'Edit Course',
                                        'exit' => 'Exit',
                                        'login' => 'Log In',
 				       'launch' => 'Launch Remote Control',
@@ -507,10 +507,19 @@ ENDMENUITEMS
         my $buttons='';
         foreach (split(/\n/,$menuitems)) {
 	    my ($command,@rest)=split(/\&/,$_);
-            if ($command eq 's') {
-		$buttons.=&switch('','',@rest);
-            } else {
-                $buttons.=&clear(@rest);
+            my $idx=10*$rest[0]+$rest[1];
+            if (&hidden_button_check() eq 'yes') {
+                if ($idx == 21 ||$idx == 23) {
+                    $buttons.=&switch('','',@rest);
+                } else {
+                    $buttons.=&clear(@rest);
+                }
+            } else {  
+                if ($command eq 's') {
+	            $buttons.=&switch('','',@rest);
+                } else {
+                    $buttons.=&clear(@rest);
+                }
             }
         }
 
@@ -520,28 +529,51 @@ ENDMENUITEMS
 	    my $inlinebuttons='';
 	    if ($addremote) {
 # Registered, textual output
-
 		if ($env{'browser.interface'} eq 'textual') {
 		    $inlinebuttons=
                         join('',map { (defined($_)?$_:'') } @inlineremote);
 		} else {
-		    $inlinebuttons=(<<ENDINLINE);
+                    if ($env{'environment.icons'} eq 'iconsonly') {
+                        $inlinebuttons=(<<ENDARROWSINLINE);
+<tr><td>
+$inlineremote[21] $inlineremote[23]
+ENDARROWSINLINE
+                        if (&hidden_button_check() ne 'yes') {
+                            $inlinebuttons .= (<<ENDINLINEICONS);
+$inlineremote[61] $inlineremote[63]
+$inlineremote[71] $inlineremote[72] $inlineremote[73]
+$inlineremote[81] $inlineremote[82] $inlineremote[83]
+$inlineremote[91] $inlineremote[92] $inlineremote[93]</td></tr>
+ENDINLINEICONS
+                        }
+                    } else {
+			if ($inlineremote[21] ne '' || $inlineremote[23] ne '') {
+			    $inlinebuttons=(<<ENDFIRSTLINE);
 <tr><td>$inlineremote[21]</td><td>&nbsp;</td><td>$inlineremote[23]</td></tr>
-<tr><td>$inlineremote[61]</td><td>$inlineremote[62]</td><td>$inlineremote[63]</td></tr>
-<tr><td>$inlineremote[71]</td><td>$inlineremote[72]</td><td>$inlineremote[73]</td></tr>
-<tr><td>$inlineremote[81]</td><td>$inlineremote[82]</td><td>$inlineremote[83]</td></tr>
-<tr><td>$inlineremote[91]</td><td>$inlineremote[92]</td><td>$inlineremote[93]</td></tr>
-ENDINLINE
-                }
+ENDFIRSTLINE
+                        }
+                        if (&hidden_button_check() ne 'yes') { 
+			    foreach my $row (6..9) {
+				if ($inlineremote[${row}.'1'] ne ''
+				    || $inlineremote[$row.'2'] ne ''
+				    || $inlineremote[$row.'3'] ne '') {
+				    $inlinebuttons .= <<"ENDLINE";
+<tr><td>$inlineremote["${row}1"]</td><td>$inlineremote["${row}2"]</td><td>$inlineremote["${row}3"]</td></tr>
+ENDLINE
+				}
+			    }
+			}
+		    }
+		}
 	    }
 	    $result =(<<ENDREGTEXT);
 <script type="text/javascript">
 // BEGIN LON-CAPA Internal
 </script>
 $timesync
-$newmail
 $tablestart
 $inlinebuttons
+$newmail
 $tableend
 <script type="text/javascript">
 // END LON-CAPA Internal
@@ -780,15 +812,16 @@ sub open {
 	return '<script type="text/javascript">self.name="loncapaclient";</script>';
     }
     my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
-    unless (shift eq 'unix') {
+    
+#    unless (shift eq 'unix') {
 # resizing does not work on linux because of virtual desktop sizes
-       $returnval.=(<<ENDRESIZE);
-if (window.screen) {
-    self.resizeTo(screen.availWidth-215,screen.availHeight-55);
-    self.moveTo(190,15);
-}
-ENDRESIZE
-    }
+#       $returnval.=(<<ENDRESIZE);
+#if (window.screen) {
+#    self.resizeTo(screen.availWidth-215,screen.availHeight-55);
+#    self.moveTo(190,15);
+#}
+#ENDRESIZE
+#    }
     $returnval.=(<<ENDOPEN);
 window.status='Opening LON-CAPA Remote Control';
 var menu=window.open("/res/adm/pages/menu.html","$menuname",
@@ -857,9 +890,9 @@ sub switch {
        my $lonhttpdPort=$Apache::lonnet::perlvar{'lonhttpdPort'};
        if (!defined($lonhttpdPort)) { $lonhttpdPort='8080'; }
        my $pic=
-	   '<img alt="'.$text.'" src="http://'.$ENV{'HTTP_HOST'}.
-	   ':'.$lonhttpdPort.'/res/adm/pages/'.$img.'" align="'.
-	   ($nobreak==3?'right':'left').'" />';
+	   '<img alt="'.$text.'" src="'.
+	   &Apache::loncommon::lonhttpdurl('/res/adm/pages/'.$img).
+	   '" align="'.($nobreak==3?'right':'left').'" />';
        if ($env{'browser.interface'} eq 'faketextual') {
 # Accessibility
 	   if ($nobreak==3) {
@@ -881,9 +914,13 @@ sub switch {
 	   }
        } else {
 # Inline Menu
-	   $inlineremote[$idx]=
+           if ($env{'environment.icons'} eq 'iconsonly') {
+              $inlineremote[$idx]='<a title="'.$desc.'" href="javascript:'.$act.';">'.$pic.'</a>';
+           } else {
+	      $inlineremote[$idx]=
 		   '<a class="LC_menubuttons_link" href="javascript:'.$act.';">'.$pic.
 		   '<span class="LC_menubuttons_inline_text">'.$desc.'</span></a>';
+           }
        }
    }
     return '';
@@ -1322,6 +1359,16 @@ sub convert_menu_function {
     return $rolename;
 }
 
+sub hidden_button_check {
+    my $hidden;
+    if ($env{'request.course.id'} eq '') {
+        return;
+    }
+    if ($env{'request.role.adv'}) {
+        return;
+    }
+    return &Apache::lonnet::EXT('resource.0.buttonshide'); 
+}
 
 # ================================================================ Main Program