Diff for /loncom/interface/lonmenu.pm between versions 1.121 and 1.130

version 1.121, 2004/11/01 04:31:03 version 1.130, 2004/11/14 07:32:20
Line 43  use Apache::lonnet(); Line 43  use Apache::lonnet();
 use Apache::Constants qw(:common);  use Apache::Constants qw(:common);
 use Apache::lonhtmlcommon();  use Apache::lonhtmlcommon();
 use Apache::loncommon();  use Apache::loncommon();
 use Apache::lonnavmaps();  use Apache::lonenc();
 use Apache::lonlocal;  use Apache::lonlocal;
   
 use vars qw(@desklines $readdesk);  use vars qw(@desklines $readdesk);
Line 75  sub menubuttons { Line 75  sub menubuttons {
   
     my $navmaps='';      my $navmaps='';
     my $reloadlink='';      my $reloadlink='';
     my $escurl=&Apache::lonnet::escape($ENV{'request.noversionuri'});      my $escurl=&Apache::lonnet::escape(&Apache::lonenc::check_encrypt($ENV{'request.noversionuri'}));
     my $escsymb=&Apache::lonnet::escape($ENV{'request.symb'});      my $escsymb=&Apache::lonnet::escape(&Apache::lonenc::check_encrypt($ENV{'request.symb'}));
     if ($ENV{'browser.interface'} eq 'textual') {      if ($ENV{'browser.interface'} eq 'textual') {
 # Textual display only  # Textual display only
  my %lt=&initlittle();   my %lt=&initlittle();
Line 96  ENDNAV Line 96  ENDNAV
 ENDRELOAD  ENDRELOAD
             }              }
         }          }
           my $form=&serverform();
         my $utility=&utilityfunctions();          my $utility=&utilityfunctions();
  my $output=(<<ENDMAINMENU);   my $output=(<<ENDMAINMENU);
 <script>  <script type="text/javascript">
 // BEGIN LON-CAPA Internal  // BEGIN LON-CAPA Internal
 $utility  $utility
 </script>  </script>
 <a href="/adm/menu" target="_top">$lt{'main'}</a>  <a href="/adm/menu" target="_top">$lt{'main'}</a>
 $reloadlink $navmaps<br />  $reloadlink $navmaps<br />
 <script>  <script type="text/javascript">
 // END LON-CAPA Internal  // END LON-CAPA Internal
 </script>  </script>
   $form
 ENDMAINMENU  ENDMAINMENU
         if ($registration) { $output.=&innerregister($forcereg,$target); }          if ($registration) { $output.=&innerregister($forcereg,$target); }
  return $output."<hr />";   return $output."<hr />";
Line 137  ENDMAINMENU Line 139  ENDMAINMENU
         if ($ENV{'request.course.id'}) {          if ($ENV{'request.course.id'}) {
            $navmaps=(<<ENDNAV);             $navmaps=(<<ENDNAV);
 <td bgcolor="$tabbg">  <td bgcolor="$tabbg">
 <a href="javascript:gonav('/adm/navmaps?postdata=$escurl&postsymb=$escsymb')"><font color="$font">$lt{'nav'}</font></a></td>  <a href="javascript:gonav('/adm/navmaps?postdata=$escurl&amp;postsymb=$escsymb')"><font color="$font">$lt{'nav'}</font></a></td>
 ENDNAV  ENDNAV
     if (($ENV{'request.noversionuri'}=~/^\/adm\//) &&      if (($ENV{'request.noversionuri'}=~/^\/adm\//) &&
                 ($ENV{'request.noversionuri'}!~/^\/adm\/wrapper\//) &&                  ($ENV{'request.noversionuri'}!~/^\/adm\/wrapper\//) &&
Line 153  ENDRELOAD Line 155  ENDRELOAD
         if ($registration) {          if ($registration) {
            $reg=&innerregister($forcereg,$target);             $reg=&innerregister($forcereg,$target);
         }          }
           my $form=&serverform();
  my $utility=&utilityfunctions();   my $utility=&utilityfunctions();
  return (<<ENDINLINEMENU);   return (<<ENDINLINEMENU);
 <script>  <script type="text/javascript">
 // BEGIN LON-CAPA Internal  // BEGIN LON-CAPA Internal
 $utility  $utility
 </script>  </script>
Line 167  $utility Line 170  $utility
 $reloadlink  $reloadlink
 $navmaps  $navmaps
 <td bgcolor="$tabbg">  <td bgcolor="$tabbg">
 <a href="/adm/remote?action=launch&url=$escurl" target="_top">  <a href="/adm/remote?action=launch&amp;url=$escurl" target="_top">
 <font color="$font">$lt{'launch'}</font></a></td>  <font color="$font">$lt{'launch'}</font></a></td>
 <td bgcolor="$tabbg">  <td bgcolor="$tabbg">
 <img align="right" src="/adm/lonIcons/minilogo.gif" />  <img align="right" src="/adm/lonIcons/minilogo.gif" />
 <b>LON-CAPA</b></td>  <b>LON-CAPA</b></td>
   $form
 </tr>  </tr>
 </table>  </table>
 </font>  </font>
 <script>  <script type="text/javascript">
 // END LON-CAPA Internal  // END LON-CAPA Internal
 </script>  </script>
 $reg  $reg
Line 227  sub innerregister { Line 231  sub innerregister {
     my $target = shift;      my $target = shift;
     my $result = '';      my $result = '';
     my ($uname,$thisdisfn);      my ($uname,$thisdisfn);
     my $const_space = 0;      my $const_space = ($ENV{'request.state'} eq 'construct');
     if ($ENV{'request.filename'} =~ /^\/home\/([^\/]+)\/public_html\/(.*)/) {  
         $const_space = 1;  
         $uname = $1;  
         $thisdisfn = $2;  
     }  
   
     if ($ENV{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; }      if ($ENV{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; }
   
Line 252  sub innerregister { Line 251  sub innerregister {
     if ($noremote) {      if ($noremote) {
  $newmail='<font face="Arial,Helvetica,sans-serif"><table bgcolor="'.$pgbg.'" border="0" cellspacing="1" cellpadding="1" width="100%"><tr><td bgcolor="'.$tabbg.'">';   $newmail='<font face="Arial,Helvetica,sans-serif"><table bgcolor="'.$pgbg.'" border="0" cellspacing="1" cellpadding="1" width="100%"><tr><td bgcolor="'.$tabbg.'">';
     }      }
     if ($textual && $const_space) {  
         my $formaction='/priv/'.$uname.'/'.$thisdisfn;  
         $formaction=~s/\/+/\//g;  
         my $titleinfo = '<form name="dirs" method="post" action="'.$formaction  
               .'" target="_top">'.  
         &Apache::lonhtmlcommon::crumbs($uname.'/'.$thisdisfn,'_top','/priv','','-1').  
         &Apache::lonhtmlcommon::select_recent('construct','recent',  
                  'this.form.action=this.form.recent.value;this.form.submit()').  
               '</form>';  
         &Apache::lonhtmlcommon::store_recent('construct',$formaction,$formaction);  
         $newmail .= &constspaceform();  
 # role and realm  
         my ($role,$realm) = &Apache::lonnet::plaintext((split(/\./,$ENV{'request.role'}))[0]);  
         unless ($realm) { $realm='&nbsp;'; }  
         $newmail .= <<END;  
 <table width="100%" cellspacing="0" border="0" cellpadding="0">  
 <tr>  
 <td>  
 $titleinfo  
 </td>  
 <td align="right">  
 <font size="2" face="Arial, Helvetica, sans-serif">  
     $ENV{'environment.firstname'}  
     $ENV{'environment.middlename'}  
     $ENV{'environment.lastname'}  
     $ENV{'environment.generation'}  
     </font>&nbsp;<br />  
     <font size="2" face="Arial, Helvetica, sans-serif">$role</font>&nbsp;  
 </td></tr>  
 </table>  
 END  
     }  
     if (($textual) && ($ENV{'request.symb'}) && ($ENV{'request.course.id'})) {      if (($textual) && ($ENV{'request.symb'}) && ($ENV{'request.course.id'})) {
  my ($mapurl,$rid,$resurl)=&Apache::lonnet::decode_symb($ENV{'request.symb'});   my ($mapurl,$rid,$resurl)=&Apache::lonnet::decode_symb($ENV{'request.symb'});
         $newmail.=$ENV{'course.'.$ENV{'request.course.id'}.'.description'};          $newmail.=$ENV{'course.'.$ENV{'request.course.id'}.'.description'};
Line 401  END Line 368  END
 # Prepare the rest of the buttons  # Prepare the rest of the buttons
         my $menuitems;          my $menuitems;
         if ($const_space) {          if ($const_space) {
       my ($uname,$thisdisfn) =
    ($ENV{'request.filename'}=~m|^/home/([^/]+)/public_html/(.*)|);
             my $currdir = '/priv/'.$uname.'/'.$thisdisfn;              my $currdir = '/priv/'.$uname.'/'.$thisdisfn;
             $currdir =~ s#[^/]+$##;              $currdir =~ s#[^/]+$##;
             $menuitems=(<<ENDMENUITEMS);              $menuitems=(<<ENDMENUITEMS);
Line 441  ENDREALRES Line 410  ENDREALRES
         }          }
         if ($textual) {          if ($textual) {
 # Registered, textual output  # Registered, textual output
             my $form=&serverform();  
     my $inlinebuttons='';      my $inlinebuttons='';
   
     if ($ENV{'browser.interface'} eq 'textual') {      if ($ENV{'browser.interface'} eq 'textual') {
Line 449  ENDREALRES Line 417  ENDREALRES
                         join('',map { (defined($_)?$_:'') } @inlineremote);                          join('',map { (defined($_)?$_:'') } @inlineremote);
     } else {      } else {
  $inlinebuttons=(<<ENDINLINE);   $inlinebuttons=(<<ENDINLINE);
 <tr><td>$inlineremote[21]</td><td>&nbsp</td><td>$inlineremote[23]</td></tr>  <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[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[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[81]</td><td>$inlineremote[82]</td><td>$inlineremote[83]</td></tr>
Line 457  ENDREALRES Line 425  ENDREALRES
 ENDINLINE  ENDINLINE
     }      }
     $result =(<<ENDREGTEXT);      $result =(<<ENDREGTEXT);
 <script>  <script type="text/javascript">
 // BEGIN LON-CAPA Internal  // BEGIN LON-CAPA Internal
 </script>  </script>
 $timesync  $timesync
Line 465  $newmail Line 433  $newmail
 $tablestart  $tablestart
 $inlinebuttons  $inlinebuttons
 $tableend  $tableend
 $form  <script type="text/javascript">
 <script>  
 // END LON-CAPA Internal  // END LON-CAPA Internal
 </script>  </script>
   
Line 474  ENDREGTEXT Line 441  ENDREGTEXT
 # Registered, graphical output  # Registered, graphical output
         } else {          } else {
     my $requri=(split(/\?/,$ENV{'request.noversionuri'}))[0];      my $requri=(split(/\?/,$ENV{'request.noversionuri'}))[0];
     $requri=&Apache::lonnet::unescape($requri);      $requri=&Apache::lonenc::check_encrypt(&Apache::lonnet::unescape($requri));
       my $cursymb=&Apache::lonenc::check_encrypt($ENV{'request.symb'});
     my $navstatus=&get_nav_status();      my $navstatus=&get_nav_status();
     $result = (<<ENDREGTHIS);      $result = (<<ENDREGTHIS);
             
 <script language="JavaScript">  <script type="text/javascript">
 // BEGIN LON-CAPA Internal  // BEGIN LON-CAPA Internal
 var swmenu=null;  var swmenu=null;
   
Line 490  var swmenu=null; Line 458  var swmenu=null;
           $buttons            $buttons
   swmenu.currentURL="$requri";    swmenu.currentURL="$requri";
           swmenu.reloadURL=swmenu.currentURL+window.location.search;            swmenu.reloadURL=swmenu.currentURL+window.location.search;
           swmenu.currentSymb="$ENV{'request.symb'}";            swmenu.currentSymb="$cursymb";
           swmenu.reloadSymb="$ENV{'request.symb'}";            swmenu.reloadSymb="$cursymb";
           swmenu.currentStale=0;            swmenu.currentStale=0;
   $navstatus    $navstatus
           $hwkadd            $hwkadd
Line 529  ENDDONOTREGTEXT Line 497  ENDDONOTREGTEXT
 # Not registered, graphical  # Not registered, graphical
            $result = (<<ENDDONOTREGTHIS);             $result = (<<ENDDONOTREGTHIS);
   
 <script language="JavaScript">  <script type="text/javascript">
 // BEGIN LON-CAPA Internal  // BEGIN LON-CAPA Internal
 var swmenu=null;  var swmenu=null;
   
Line 587  sub startupremote { Line 555  sub startupremote {
     my $esclowerurl=&Apache::lonnet::escape($lowerurl);      my $esclowerurl=&Apache::lonnet::escape($lowerurl);
     my $message=&mt('"Waiting for Remote Control window to load: "+[_1]','waited');      my $message=&mt('"Waiting for Remote Control window to load: "+[_1]','waited');
     return(<<ENDREMOTESTARTUP);      return(<<ENDREMOTESTARTUP);
 <script>  <script type="text/javascript">
 var timestart;  var timestart;
 function wheelswitch() {  function wheelswitch() {
     if (typeof(document.wheel) != 'undefined') {      if (typeof(document.wheel) != 'undefined') {
Line 644  ENDREMOTESTARTUP Line 612  ENDREMOTESTARTUP
   
 sub setflags() {  sub setflags() {
     return(<<ENDSETFLAGS);      return(<<ENDSETFLAGS);
 <script>  <script type="text/javascript">
     menuloaded=0;      menuloaded=0;
     tim=0;      tim=0;
 </script>  </script>
Line 655  sub maincall() { Line 623  sub maincall() {
     if (($ENV{'browser.interface'} eq 'textual') ||      if (($ENV{'browser.interface'} eq 'textual') ||
         ($ENV{'environment.remote'} eq 'off')) { return ''; }          ($ENV{'environment.remote'} eq 'off')) { return ''; }
     return(<<ENDMAINCALL);      return(<<ENDMAINCALL);
 <script>  <script type="text/javascript">
     main();      main();
 </script>  </script>
 ENDMAINCALL  ENDMAINCALL
Line 713  var menu=window.open("/res/adm/pages/men Line 681  var menu=window.open("/res/adm/pages/men
 "height=350,width=150,scrollbars=no,menubar=no,top=5,left=5,screenX=5,screenY=5");  "height=350,width=150,scrollbars=no,menubar=no,top=5,left=5,screenX=5,screenY=5");
 self.name='loncapaclient';  self.name='loncapaclient';
 ENDOPEN  ENDOPEN
     return '<script>'.$returnval.'</script>';      return '<script type="text/javascript">'.$returnval.'</script>';
 }  }
   
   
Line 886  sub rawconfig { Line 854  sub rawconfig {
             if ($ENV{'request.course.fn'}) {              if ($ENV{'request.course.fn'}) {
                $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);                 $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
     }      }
           } elsif ($pro =~ /^courseenv_(.*)$/) {
               my $key = $1;
               if ($ENV{'course.'.$ENV{'request.course.id'}.'.'.$key}) {
                   $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
               }
         } elsif ($pro =~ /^course_(.*)$/) {          } elsif ($pro =~ /^course_(.*)$/) {
             # Check for permissions inside of a course              # Check for permissions inside of a course
             if (($ENV{'request.course.id'}) &&              if (($ENV{'request.course.id'}) &&
Line 921  sub rawconfig { Line 894  sub rawconfig {
     unless (($ENV{'browser.interface'} eq 'textual') ||      unless (($ENV{'browser.interface'} eq 'textual') ||
             ($ENV{'environment.remote'} eq 'off')) {              ($ENV{'environment.remote'} eq 'off')) {
        $output.="\nwindow.status='Synchronizing Time';swmenu.syncclock(1000*".time.");\nwindow.status='Remote Control Configured.';";         $output.="\nwindow.status='Synchronizing Time';swmenu.syncclock(1000*".time.");\nwindow.status='Remote Control Configured.';";
          if (&Apache::lonmsg::newmail()) { 
      $output.='swmenu.setstatus("you have","messages");';
          }
     }      }
   
     return $output;      return $output;
 }  }
   
Line 932  sub close { Line 909  sub close {
         ($ENV{'environment.remote'} eq 'off')) { return ''; }          ($ENV{'environment.remote'} eq 'off')) { return ''; }
     my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};      my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
     return(<<ENDCLOSE);      return(<<ENDCLOSE);
 <script>  <script type="text/javascript">
 window.status='Accessing Remote Control';  window.status='Accessing Remote Control';
 menu=window.open("/adm/rat/empty.html","$menuname",  menu=window.open("/adm/rat/empty.html","$menuname",
                  "height=350,width=150,scrollbars=no,menubar=no");                   "height=350,width=150,scrollbars=no,menubar=no");
Line 952  sub footer { Line 929  sub footer {
   
 }  }
   
   sub nav_control_js {
       my $nav=($ENV{'environment.remotenavmap'} eq 'on');
       return (<<NAVCONTROL);
       var w_loncapanav_flag="$nav";
   
   
   function gonav(url) {
      if (w_loncapanav_flag != 1) {
         gopost(url,'');
      }  else {
         navwindow=window.open(url,
                     "loncapanav","height=600,width=400,scrollbars=1"); 
      }
   }
   NAVCONTROL
   }
   
 sub utilityfunctions {  sub utilityfunctions {
     unless (($ENV{'browser.interface'} eq 'textual')  ||      unless (($ENV{'browser.interface'} eq 'textual')  ||
         ($ENV{'environment.remote'} eq 'off')) { return ''; }          ($ENV{'environment.remote'} eq 'off')) { return ''; }
     my $currenturl=$ENV{'request.noversionuri'};      my $currenturl=&Apache::lonenc::check_encrypt($ENV{'request.noversionuri'});
     my $currentsymb=$ENV{'request.symb'};      
     my $nav_control=&Apache::lonnavmaps::nav_control_js();      my $currentsymb=&Apache::lonenc::check_encrypt($ENV{'request.symb'});
       my $nav_control=&nav_control_js();
 return (<<ENDUTILITY)  return (<<ENDUTILITY)
   
     var currentURL="$currenturl";      var currentURL="$currenturl";
Line 1064  sub handler { Line 1059  sub handler {
     $r->send_http_header;      $r->send_http_header;
     return OK if $r->header_only;      return OK if $r->header_only;
   
     my $form=&serverform();      my $form;
       if ($ENV{'environment.remote'} ne 'off' &&
    $ENV{'browser.interface'} ne 'textual') {
    $form=&serverform();
       }
     my $bodytag=&Apache::loncommon::bodytag('Main Menu');      my $bodytag=&Apache::loncommon::bodytag('Main Menu');
     my $function='student';      my $function='student';
     if ($ENV{'request.role'}=~/^(cc|in|ta|ep)/) {      if ($ENV{'request.role'}=~/^(cc|in|ta|ep)/) {

Removed from v.1.121  
changed lines
  Added in v.1.130


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