Diff for /loncom/interface/lonmenu.pm between versions 1.129 and 1.135

version 1.129, 2004/11/13 21:07:19 version 1.135, 2004/12/03 22:10:39
Line 69  sub menubuttons { Line 69  sub menubuttons {
     my $forcereg=shift;      my $forcereg=shift;
     my $target  =shift;      my $target  =shift;
     my $registration=shift;      my $registration=shift;
       my $titletable=shift;
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
     ['inhibitmenu']);      ['inhibitmenu']);
     if ($ENV{'form.inhibitmenu'} eq 'yes') { return ''; }      if ($ENV{'form.inhibitmenu'} eq 'yes') { return ''; }
Line 77  sub menubuttons { Line 78  sub menubuttons {
     my $reloadlink='';      my $reloadlink='';
     my $escurl=&Apache::lonnet::escape(&Apache::lonenc::check_encrypt($ENV{'request.noversionuri'}));      my $escurl=&Apache::lonnet::escape(&Apache::lonenc::check_encrypt($ENV{'request.noversionuri'}));
     my $escsymb=&Apache::lonnet::escape(&Apache::lonenc::check_encrypt($ENV{'request.symb'}));      my $escsymb=&Apache::lonnet::escape(&Apache::lonenc::check_encrypt($ENV{'request.symb'}));
       if ($ENV{'request.state'} eq 'construct') {
           if (($ENV{'request.noversionuri'} eq '') || (!defined($ENV{'request.noversionuri'}))) {
               my $returnurl = $ENV{'request.filename'};
               $returnurl =~ s:^/home/([^/]+)/public_html/(.*)$:/priv/$1/$2:;
               $escurl = &Apache::lonnet::escape($returnurl);
           }
       }
     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 104  ENDNAV
 ENDRELOAD  ENDRELOAD
             }              }
         }          }
           my $form=&serverform();
         my $utility=&utilityfunctions();          my $utility=&utilityfunctions();
  my $output=(<<ENDMAINMENU);   my $output=(<<ENDMAINMENU);
 <script type="text/javascript">  <script type="text/javascript">
Line 107  $reloadlink $navmaps<br /> Line 116  $reloadlink $navmaps<br />
 <script type="text/javascript">  <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 151  ENDRELOAD Line 161  ENDRELOAD
         }          }
         my $reg='';          my $reg='';
         if ($registration) {          if ($registration) {
            $reg=&innerregister($forcereg,$target);             $reg=&innerregister($forcereg,$target,$titletable);
         }          }
           my $form=&serverform();
  my $utility=&utilityfunctions();   my $utility=&utilityfunctions();
  return (<<ENDINLINEMENU);   return (<<ENDINLINEMENU);
 <script type="text/javascript">  <script type="text/javascript">
Line 172  $navmaps Line 183  $navmaps
 <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>
Line 225  sub registerurl { Line 237  sub registerurl {
 sub innerregister {  sub innerregister {
     my $forcereg=shift;      my $forcereg=shift;
     my $target = shift;      my $target = shift;
       my $titletable = shift;
     my $result = '';      my $result = '';
     my ($uname,$thisdisfn);      my ($uname,$thisdisfn);
     my $const_space = ($ENV{'request.state'} eq 'construct');      my $const_space = ($ENV{'request.state'} eq 'construct');
       my $is_const_dir = 0;
   
     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 266  sub innerregister {
         $newmail.=$ENV{'course.'.$ENV{'request.course.id'}.'.description'};          $newmail.=$ENV{'course.'.$ENV{'request.course.id'}.'.description'};
         my $maptitle=&Apache::lonnet::gettitle($mapurl);          my $maptitle=&Apache::lonnet::gettitle($mapurl);
  my $restitle=&Apache::lonnet::gettitle($resurl);   my $restitle=&Apache::lonnet::gettitle($resurl);
         if ($maptitle) {          if ($maptitle && $maptitle ne 'default.sequence') {
     $newmail.=', '.$maptitle;      $newmail.=', '.$maptitle;
         }          }
         if ($restitle) {          if ($restitle) {
Line 265  sub innerregister { Line 279  sub innerregister {
  '<b><a href="/adm/communicate" target="_top">You have new messages</a></b><br />':   '<b><a href="/adm/communicate" target="_top">You have new messages</a></b><br />':
                           'swmenu.setstatus("you have","messages");');                            'swmenu.setstatus("you have","messages");');
     }      }
       if ($ENV{'request.state'} eq 'construct') {
           $newmail = $titletable;
       }
     if ($noremote) {      if ($noremote) {
  $newmail.='</td></tr></table></font>';   $newmail.='</td></tr></table></font>';
     }      }
Line 367  sub innerregister { Line 384  sub innerregister {
     my ($uname,$thisdisfn) =      my ($uname,$thisdisfn) =
  ($ENV{'request.filename'}=~m|^/home/([^/]+)/public_html/(.*)|);   ($ENV{'request.filename'}=~m|^/home/([^/]+)/public_html/(.*)|);
             my $currdir = '/priv/'.$uname.'/'.$thisdisfn;              my $currdir = '/priv/'.$uname.'/'.$thisdisfn;
             $currdir =~ s#[^/]+$##;              if ($currdir =~ m-/$-) {
             $menuitems=(<<ENDMENUITEMS);                  $is_const_dir = 1;
 s&6&1&list.gif&list[_1]&dir[_1]&go('$currdir')&List current directory              } else {
 s&6&2&rtrv.gif&retrieve[_1]&version[_1]&gocstr('/adm/retrieve','/~$uname/$thisdisfn')&Retreive old version                  $currdir =~ s#[^/]+$##;
                   $menuitems=(<<ENDMENUITEMS);
   s&6&1&list.gif&list[_1]&dir[_1]&golist('$currdir')&List current directory
   s&6&2&rtrv.gif&retrieve[_1]&version[_1]&gocstr('/adm/retrieve','/~$uname/$thisdisfn')&Retrieve old version
 s&6&3&pub.gif&publish[_1]&resource[_1]&gocstr('/adm/publish','/~$uname/$thisdisfn')&Publish this resource  s&6&3&pub.gif&publish[_1]&resource[_1]&gocstr('/adm/publish','/~$uname/$thisdisfn')&Publish this resource
 s&7&1&del.gif&delete[_1]&resource[_2]&gocstr('/adm/cfile?action=delete','/~$uname/$thisdisfn')&Delete this resource  s&7&1&del.gif&delete[_1]&resource[_2]&gocstr('/adm/cfile?action=delete','/~$uname/$thisdisfn')&Delete this resource
 s&7&2&prt.gif&prepare[_1]&printout[_1]&gopost('/adm/printout','/~$uname/$thisdisfn')&Prepare a printable document  s&7&2&prt.gif&prepare[_1]&printout[_1]&gopost('/adm/printout','/~$uname/$thisdisfn')&Prepare a printable document
 ENDMENUITEMS  ENDMENUITEMS
               }
         } else {          } else {
     $menuitems=(<<ENDMENUITEMS);      $menuitems=(<<ENDMENUITEMS);
 c&3&1  c&3&1
Line 406  ENDREALRES Line 427  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 421  ENDREALRES Line 441  ENDREALRES
 <tr><td>$inlineremote[91]</td><td>$inlineremote[92]</td><td>$inlineremote[93]</td></tr>  <tr><td>$inlineremote[91]</td><td>$inlineremote[92]</td><td>$inlineremote[93]</td></tr>
 ENDINLINE  ENDINLINE
     }      }
               if ($const_space && $is_const_dir) {
                   $inlinebuttons = '';
               }
     $result =(<<ENDREGTEXT);      $result =(<<ENDREGTEXT);
 <script type="text/javascript">  <script type="text/javascript">
 // BEGIN LON-CAPA Internal  // BEGIN LON-CAPA Internal
Line 430  $newmail Line 453  $newmail
 $tablestart  $tablestart
 $inlinebuttons  $inlinebuttons
 $tableend  $tableend
 $form  
 <script type="text/javascript">  <script type="text/javascript">
 // END LON-CAPA Internal  // END LON-CAPA Internal
 </script>  </script>
Line 529  ENDDONOTREGTHIS Line 551  ENDDONOTREGTHIS
 }  }
   
 sub loadevents() {  sub loadevents() {
     if ($ENV{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; }      if ($ENV{'request.state'} eq 'construct' ||
    $ENV{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; }
     return 'LONCAPAreg();';      return 'LONCAPAreg();';
 }  }
   
 sub unloadevents() {  sub unloadevents() {
     if ($ENV{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; }      if ($ENV{'request.state'} eq 'construct' ||
    $ENV{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; }
     return 'LONCAPAstale();';      return 'LONCAPAstale();';
 }  }
   
Line 945  NAVCONTROL Line 969  NAVCONTROL
 }  }
   
 sub utilityfunctions {  sub utilityfunctions {
       my $caller = shift;
     unless (($ENV{'browser.interface'} eq 'textual')  ||      unless (($ENV{'browser.interface'} eq 'textual')  ||
         ($ENV{'environment.remote'} eq 'off')) { return ''; }          ($ENV{'environment.remote'} eq 'off') || ($caller eq '/adm/menu')) { return ''; }
     my $currenturl=&Apache::lonenc::check_encrypt($ENV{'request.noversionuri'});      my $currenturl=&Apache::lonenc::check_encrypt($ENV{'request.noversionuri'});
           
     my $currentsymb=&Apache::lonenc::check_encrypt($ENV{'request.symb'});      my $currentsymb=&Apache::lonenc::check_encrypt($ENV{'request.symb'});
Line 1002  function gocstr(url,filename) { Line 1027  function gocstr(url,filename) {
     }      }
 }  }
   
   function golist(url) {
      if (url!='' && url!= null) {
          currentURL = null;
          currentSymb= null;
          top.location.href=url;
      }
   }
   
   
   
 function catalog_info() {  function catalog_info() {
    loncatinfo=window.open(window.location.pathname+'.meta',"LONcatInfo",'height=320,width=280,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no');     loncatinfo=window.open(window.location.pathname+'.meta',"LONcatInfo",'height=320,width=280,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no');
Line 1057  sub handler { Line 1091  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)/) {
Line 1074  sub handler { Line 1112  sub handler {
     $pgbg=&Apache::loncommon::designparm($function.'.pgbg',$domain);      $pgbg=&Apache::loncommon::designparm($function.'.pgbg',$domain);
     $tabbg=&Apache::loncommon::designparm($function.'.tabbg',$domain);      $tabbg=&Apache::loncommon::designparm($function.'.tabbg',$domain);
     $font=&Apache::loncommon::designparm($function.'.font',$domain);      $font=&Apache::loncommon::designparm($function.'.font',$domain);
 # ---- Print the screen, pretent to be in text mode to generate text-based menu      my $script_tag;
       if ($ENV{'environment.remote'} eq 'on') {
           my $utility=&utilityfunctions('/adm/menu');
           $script_tag=(<<ENDSCRIPT);
   <script type="text/javascript">
   $utility
   </script>
   ENDSCRIPT
       }
   # ---- Print the screen, pretend to be in text mode to generate text-based menu
     unless ($ENV{'browser.interface'} eq 'textual') {      unless ($ENV{'browser.interface'} eq 'textual') {
  $ENV{'browser.interface'}='faketextual';   $ENV{'browser.interface'}='faketextual';
  $ENV{'environment.remote'}='off';   $ENV{'environment.remote'}='off';
Line 1082  sub handler { Line 1129  sub handler {
     $r->print(<<ENDHEADER);      $r->print(<<ENDHEADER);
 <html><head>  <html><head>
 <title>LON-CAPA Main Menu</title>  <title>LON-CAPA Main Menu</title>
   $script_tag
 </head>  </head>
 $bodytag  $bodytag
 ENDHEADER  ENDHEADER

Removed from v.1.129  
changed lines
  Added in v.1.135


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