Diff for /loncom/interface/lonmenu.pm between versions 1.50 and 1.56

version 1.50, 2003/04/03 03:08:12 version 1.56, 2003/04/04 21:21:51
Line 45  use Apache::lonhtmlcommon(); Line 45  use Apache::lonhtmlcommon();
 use Apache::loncommon;  use Apache::loncommon;
 use Apache::File;  use Apache::File;
 use vars qw(@desklines $readdesk);  use vars qw(@desklines $readdesk);
   my @inlineremote;
   
 # ============================= This gets called at the top of the body section  # ============================= This gets called at the top of the body section
   
Line 52  sub menubuttons { Line 53  sub menubuttons {
     my $forcereg=shift;      my $forcereg=shift;
     my $target  =shift;      my $target  =shift;
     my $registration=shift;      my $registration=shift;
       my $navmaps='';
       my $escurl=&Apache::lonnet::escape($ENV{'REQUEST_URI'});
       my $escsymb=&Apache::lonnet::escape($ENV{'request.symb'});
     if ($ENV{'browser.interface'} eq 'textual') {      if ($ENV{'browser.interface'} eq 'textual') {
 # Textual display only  # Textual display only
           if ($ENV{'request.course.id'}) {
       $navmaps=(<<ENDNAV);
   <a href="/adm/navmaps?postdata=$escurl&postsymb=$escsymb" target="_top">Navigate Contents</a>
   ENDNAV
           }
  my $output=(<<ENDMAINMENU);   my $output=(<<ENDMAINMENU);
 <script>  <script>
 // BEGIN LON-CAPA Internal  // BEGIN LON-CAPA Internal
 </script>  </script>
 <a href="/adm/menu" target="_top">Main Menu</a><br />  <a href="/adm/menu" target="_top">Main Menu</a>
   $navmaps<br />
 <script>  <script>
 // END LON-CAPA Internal  // END LON-CAPA Internal
 </script>  </script>
Line 67  ENDMAINMENU Line 77  ENDMAINMENU
  return $output."<hr />";   return $output."<hr />";
     } elsif ($ENV{'environment.remote'} eq 'off') {      } elsif ($ENV{'environment.remote'} eq 'off') {
 # Remote Control is switched off  # Remote Control is switched off
           if ($ENV{'request.course.id'}) {
       $navmaps=(<<ENDNAVREM);
   <a href="/adm/navmaps?postdata=$escurl&postsymb=$escsymb" target="_top">Navigate Contents</a>
   ENDNAVREM
           }
  my $output=(<<ENDINLINEMENU);   my $output=(<<ENDINLINEMENU);
 <script>  <script>
 // BEGIN LON-CAPA Internal  // BEGIN LON-CAPA Internal
 </script>  </script>
   <table bgcolor="#AAAAAA" width="100%" border="2"><tr><td>
 <a href="/adm/menu" target="_top">Main Menu</a>  <a href="/adm/menu" target="_top">Main Menu</a>
 <a href="/adm/remote?action=launch" target="_top">Launch Remote Control</a>  $navmaps
   <a href="/adm/remote?action=launch&url=$escurl" target="_top">Launch Remote Control</a>
   <br />
 <script>  <script>
 // END LON-CAPA Internal  // END LON-CAPA Internal
 </script>  </script>
 ENDINLINEMENU  ENDINLINEMENU
         if ($registration) { $output.=&innerregister($forcereg,$target); }          if ($registration) { $output.=&innerregister($forcereg,$target); }
  return $output."<hr />";   return $output."</td></tr></table>";
     } else {      } else {
  return '';   return '';
     }      }
Line 98  sub registerurl { Line 116  sub registerurl {
                 "\n</script>\n";                  "\n</script>\n";
     }      }
     if (($ENV{'browser.interface'} eq 'textual') ||      if (($ENV{'browser.interface'} eq 'textual') ||
           ($ENV{'environment.remote'} eq 'off') ||
         ((($ENV{'request.publicaccess'}) ||           ((($ENV{'request.publicaccess'}) || 
          (!&Apache::lonnet::is_on_map($ENV{'REQUEST_URI'}))) &&           (!&Apache::lonnet::is_on_map($ENV{'REQUEST_URI'}))) &&
         (!$forcereg))) {          (!$forcereg))) {
Line 125  sub innerregister { Line 144  sub innerregister {
           
     my $textual=($textinter || $noremote);      my $textual=($textinter || $noremote);
   
       @inlineremote=();
       undef @inlineremote;
   
     my $reopen=&Apache::lonmenu::reopenmenu();      my $reopen=&Apache::lonmenu::reopenmenu();
   
     my $newmail='';      my $newmail='';
Line 240  ENDMENUITEMS Line 262  ENDMENUITEMS
 # Registered, textual output  # Registered, textual output
             my $utility=&utilityfunctions();              my $utility=&utilityfunctions();
             my $form=&serverform();              my $form=&serverform();
               my $inlinebuttons=
                           join('',map { (defined($_)?$_:'') } @inlineremote);
     $result =(<<ENDREGTEXT);      $result =(<<ENDREGTEXT);
 <script>  <script>
 // BEGIN LON-CAPA Internal  // BEGIN LON-CAPA Internal
Line 247  $utility Line 271  $utility
 </script>  </script>
 $timesync  $timesync
 $newmail  $newmail
 $buttons  $inlinebuttons
 $hwkadd  
 $editbutton  
 $form  $form
 <script>  <script>
 //END LON-CAPA Internal  //END LON-CAPA Internal
Line 364  sub startupremote { Line 386  sub startupremote {
 # The Remote actually gets launched!  # The Remote actually gets launched!
 #  #
     my $configmenu=&rawconfig();      my $configmenu=&rawconfig();
       my $esclowerurl=&Apache::lonnet::escape($lowerurl);
   
     return(<<ENDREMOTESTARTUP);      return(<<ENDREMOTESTARTUP);
 <script>  <script>
   
Line 393  function wait() { Line 417  function wait() {
          $configmenu           $configmenu
          window.location='$lowerurl';             window.location='$lowerurl';  
       } else {        } else {
          alert("Remote Control timed out. It is possible that it was blocked by pop-up window filters.");    window.location='/adm/remote?action=collapse&url=$esclowerurl';
       }        }
    } else {     } else {
       wheelswitch();        wheelswitch();
Line 402  function wait() { Line 426  function wait() {
 }  }
   
 function main() {  function main() {
    canceltim=setTimeout('tim=1;',60000);     canceltim=setTimeout('tim=1;',30000);
    window.status='-';     window.status='-';
    wait();     wait();
 }  }
Line 471  sub clear { Line 495  sub clear {
     unless (($ENV{'browser.interface'} eq 'textual') ||      unless (($ENV{'browser.interface'} eq 'textual') ||
             ($ENV{'environment.remote'} eq 'off')) {              ($ENV{'environment.remote'} eq 'off')) {
        return "\n".qq(window.status+='.';swmenu.clearbut($row,$col););         return "\n".qq(window.status+='.';swmenu.clearbut($row,$col););
    } else { return ''; }     } else { 
          $inlineremote[10*$row+$col]='';
          return ''; 
      }
 }  }
   
 # ============================================ Switch a button or create a link  # ============================================ Switch a button or create a link
Line 492  sub switch { Line 519  sub switch {
        if ($nobreak==2) { return ''; }         if ($nobreak==2) { return ''; }
        my $text=$top.' '.$bot;         my $text=$top.' '.$bot;
        $text=~s/\- //;         $text=~s/\- //;
        return "\n".($nobreak?' ':'<br />').         $inlineremote[10*$row+$col]="\n".($nobreak?' ':'<br />').
         '<a href="javascript:'.$act.';" target="_top">'.$text.'</a> '.          '<a href="javascript:'.$act.';" target="_top">'.$text.'</a> '.
         ($nobreak?'':$desc);          ($nobreak?'':$desc);
    } else {     } else {
Line 500  sub switch { Line 527  sub switch {
        if ($nobreak==2) { return ''; }         if ($nobreak==2) { return ''; }
        my $text=$top.' '.$bot;         my $text=$top.' '.$bot;
        $text=~s/\- //;         $text=~s/\- //;
        return "\n".($nobreak?' ':'<br />').         $inlineremote[10*$row+$col]="\n".($nobreak?' ':'<br />').
         '<a href="javascript:'.$act.';" target="_top">'.$text.'</a> '.          '<a href="javascript:'.$act.';" target="_top">'.$text.'</a> '.
         ($nobreak?'':$desc);          ($nobreak?'':$desc);
    }     }
       return '';
 }  }
   
 sub secondlevel {  sub secondlevel {
Line 528  sub openmenu { Line 556  sub openmenu {
     return "window.open(".$nothing.",'".$menuname."');";      return "window.open(".$nothing.",'".$menuname."');";
 }  }
   
   sub inlinemenu {
       @inlineremote=();
       undef @inlineremote;
       &rawconfig(1);
       return join('',map { (defined($_)?$_:'') } @inlineremote);
   }
   
 sub rawconfig {  sub rawconfig {
     my $textualoverride=shift;      my $textualoverride=shift;
     my $output='';      my $output='';
Line 640  sub footer { Line 675  sub footer {
 }  }
   
 sub utilityfunctions {  sub utilityfunctions {
     unless ($ENV{'browser.interface'} eq 'textual') { return ''; }      unless (($ENV{'browser.interface'} eq 'textual')  ||
           ($ENV{'environment.remote'} eq 'off')) { return ''; }
     my $currenturl=$ENV{'REQUEST_URI'};      my $currenturl=$ENV{'REQUEST_URI'};
     my $currentsymb=$ENV{'request.symb'};      my $currentsymb=$ENV{'request.symb'};
 return (<<ENDUTILITY)  return (<<ENDUTILITY)
Line 701  sub handler { Line 737  sub handler {
     $r->send_http_header;      $r->send_http_header;
     return OK if $r->header_only;      return OK if $r->header_only;
   
     my $utility=&utilityfunctions();  
     my $form=&serverform();      my $form=&serverform();
     my $bodytag=&Apache::loncommon::bodytag('Main Menu');      my $bodytag=&Apache::loncommon::bodytag('Main Menu');
 # ------------------------------------------------------------ Print the screen  # ---- Print the screen, pretent to be in text mode to generate text-based menu
       unless ($ENV{'brower.interface'} eq 'textual') {
    $ENV{'environment.remote'}='off';
       }
       my $utility=&utilityfunctions();
     $r->print(<<ENDHEADER);      $r->print(<<ENDHEADER);
 <html><head>  <html><head>
 <title>LON-CAPA Main Menu</title>  <title>LON-CAPA Main Menu</title>
Line 714  $utility Line 753  $utility
 </head>  </head>
 $bodytag  $bodytag
 ENDHEADER  ENDHEADER
     $r->print(&rawconfig(1).$form);      $r->print(&inlinemenu().$form);
     $r->print('</body></html>');      $r->print('</body></html>');
     return OK;      return OK;
 }  }

Removed from v.1.50  
changed lines
  Added in v.1.56


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>