[LON-CAPA-cvs] cvs: loncom /interface lonmenu.pm

www lon-capa-cvs@mail.lon-capa.org
Fri, 04 Apr 2003 21:21:51 -0000


www		Fri Apr  4 16:21:51 2003 EDT

  Modified files:              
    /loncom/interface	lonmenu.pm 
  Log:
  The real Remote actually overwrites buttons depending on privileges, need
  to model that for the inline remote.
  
  
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.55 loncom/interface/lonmenu.pm:1.56
--- loncom/interface/lonmenu.pm:1.55	Fri Apr  4 14:35:04 2003
+++ loncom/interface/lonmenu.pm	Fri Apr  4 16:21:51 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.55 2003/04/04 19:35:04 www Exp $
+# $Id: lonmenu.pm,v 1.56 2003/04/04 21:21:51 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -45,6 +45,7 @@
 use Apache::loncommon;
 use Apache::File;
 use vars qw(@desklines $readdesk);
+my @inlineremote;
 
 # ============================= This gets called at the top of the body section
 
@@ -143,6 +144,9 @@
     
     my $textual=($textinter || $noremote);
 
+    @inlineremote=();
+    undef @inlineremote;
+
     my $reopen=&Apache::lonmenu::reopenmenu();
 
     my $newmail='';
@@ -258,6 +262,8 @@
 # Registered, textual output
             my $utility=&utilityfunctions();
             my $form=&serverform();
+            my $inlinebuttons=
+                        join('',map { (defined($_)?$_:'') } @inlineremote);
 	    $result =(<<ENDREGTEXT);
 <script>
 // BEGIN LON-CAPA Internal
@@ -265,9 +271,7 @@
 </script>
 $timesync
 $newmail
-$buttons
-$hwkadd
-$editbutton
+$inlinebuttons
 $form
 <script>
 //END LON-CAPA Internal
@@ -491,7 +495,10 @@
     unless (($ENV{'browser.interface'} eq 'textual') ||
             ($ENV{'environment.remote'} eq 'off')) {
        return "\n".qq(window.status+='.';swmenu.clearbut($row,$col););
-   } else { return ''; }
+   } else { 
+       $inlineremote[10*$row+$col]='';
+       return ''; 
+   }
 }
 
 # ============================================ Switch a button or create a link
@@ -512,7 +519,7 @@
        if ($nobreak==2) { return ''; }
        my $text=$top.' '.$bot;
        $text=~s/\- //;
-       return "\n".($nobreak?' ':'<br />').
+       $inlineremote[10*$row+$col]="\n".($nobreak?' ':'<br />').
         '<a href="javascript:'.$act.';" target="_top">'.$text.'</a> '.
         ($nobreak?'':$desc);
    } else {
@@ -520,10 +527,11 @@
        if ($nobreak==2) { return ''; }
        my $text=$top.' '.$bot;
        $text=~s/\- //;
-       return "\n".($nobreak?' ':'<br />').
+       $inlineremote[10*$row+$col]="\n".($nobreak?' ':'<br />').
         '<a href="javascript:'.$act.';" target="_top">'.$text.'</a> '.
         ($nobreak?'':$desc);
    }
+    return '';
 }
 
 sub secondlevel {
@@ -548,6 +556,13 @@
     return "window.open(".$nothing.",'".$menuname."');";
 }
 
+sub inlinemenu {
+    @inlineremote=();
+    undef @inlineremote;
+    &rawconfig(1);
+    return join('',map { (defined($_)?$_:'') } @inlineremote);
+}
+
 sub rawconfig {
     my $textualoverride=shift;
     my $output='';
@@ -738,7 +753,7 @@
 </head>
 $bodytag
 ENDHEADER
-    $r->print(&rawconfig(1).$form);
+    $r->print(&inlinemenu().$form);
     $r->print('</body></html>');
     return OK;
 }