Diff for /loncom/interface/lonmenu.pm between versions 1.188 and 1.219

version 1.188, 2006/06/29 18:43:33 version 1.219, 2007/07/10 23:38:09
Line 44  use Apache::lonhtmlcommon(); Line 44  use Apache::lonhtmlcommon();
 use Apache::loncommon();  use Apache::loncommon();
 use Apache::lonenc();  use Apache::lonenc();
 use Apache::lonlocal;  use Apache::lonlocal;
 use lib '/home/httpd/lib/perl/';  use LONCAPA qw(:DEFAULT :match);
 use LONCAPA;  
   
 use vars qw(@desklines $readdesk);  use vars qw(@desklines %category_names %category_members %category_positions $readdesk);
   
   
 my @inlineremote;  my @inlineremote;
   
   
   
 # ================================================================ Little texts  # ================================================================ Little texts
   
 sub initlittle {  sub initlittle {
Line 60  sub initlittle { Line 61  sub initlittle {
        'main' => 'Main Menu',         'main' => 'Main Menu',
                                        'roles' => ($env{'user.adv'}?                                         'roles' => ($env{'user.adv'}?
                                                     'Roles':'Courses'),                                                      'Roles':'Courses'),
                                        'docs' => 'Course Documents',                                         'docs' => 'Edit Course',
                                        'exit' => 'Exit',                                         'exit' => 'Exit',
                                          'login' => 'Log In',
        'launch' => 'Launch Remote Control',         'launch' => 'Launch Remote Control',
                                        'groups' => 'Groups',                                         'groups' => 'Groups',
                                        'gdoc' => 'Group Documents',                                         'gdoc' => 'Group Documents',
                                        'teams' => 'Teams',  
                                        );                                         );
 }  }
   
Line 91  sub menubuttons { Line 92  sub menubuttons {
     my $escurl=&escape(&Apache::lonenc::check_encrypt($env{'request.noversionuri'}));      my $escurl=&escape(&Apache::lonenc::check_encrypt($env{'request.noversionuri'}));
     my $escsymb=&escape(&Apache::lonenc::check_encrypt($env{'request.symb'}));      my $escsymb=&escape(&Apache::lonenc::check_encrypt($env{'request.symb'}));
   
       my $logo=&Apache::loncommon::lonhttpdurl("/adm/lonIcons/minilogo.gif");
       $logo = '<td class="LC_top_nav_logo"><a href="/adm/about.html"><img src="'.
    $logo.'" alt="LON-CAPA Logo" /></a></td>';
   
     if ($env{'request.state'} eq 'construct') {      if ($env{'request.state'} eq 'construct') {
         if (($env{'request.noversionuri'} eq '') || (!defined($env{'request.noversionuri'}))) {          if (($env{'request.noversionuri'} eq '') || (!defined($env{'request.noversionuri'}))) {
             my $returnurl = $env{'request.filename'};              my $returnurl = $env{'request.filename'};
Line 101  sub menubuttons { Line 106  sub menubuttons {
     if ($env{'request.course.id'}) {      if ($env{'request.course.id'}) {
         my %coursegroups;          my %coursegroups;
         my $viewgrps_permission =          my $viewgrps_permission =
     &Apache::lonnet::allowed('vcg',$env{'request.course.id'});      &Apache::lonnet::allowed('vcg',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));
         if (!$viewgrps_permission) {          if (!$viewgrps_permission) {
             %coursegroups = &Apache::lonnet::get_active_groups($env{'user.domain'},$env{'user.name'},$env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'});              %coursegroups = &Apache::lonnet::get_active_groups($env{'user.domain'},$env{'user.name'},$env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'});
  }   }
Line 131  ENDDOCS Line 136  ENDDOCS
             }              }
             if ($showgroups) {              if ($showgroups) {
                 $groups =(<<ENDGROUPS);                  $groups =(<<ENDGROUPS);
 <a href="/adm/coursegroups" target="_top">$lt{'groups'}</a></td>  <a href="/adm/coursegroups" target="_top">$lt{'groups'}</a>
 ENDGROUPS  ENDGROUPS
             }              }
  }   }
Line 168  ENDMAINMENU Line 173  ENDMAINMENU
         my $vlink=&Apache::loncommon::designparm($function.'.vlink',$domain);          my $vlink=&Apache::loncommon::designparm($function.'.vlink',$domain);
         my $sidebg=&Apache::loncommon::designparm($function.'.sidebg',$domain);          my $sidebg=&Apache::loncommon::designparm($function.'.sidebg',$domain);
  if ($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public') {   if ($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public') {
     my $logo=&Apache::loncommon::lonhttpdurl("/adm/lonIcons/minilogo.gif");  
     return (<<ENDINLINEMENU);      return (<<ENDINLINEMENU);
    <table id="LC_top_nav">     <table id="LC_top_nav">
     <tr>      <tr>
       <td>        $logo
         <a href="/adm/logout" target="_top">$lt{'exit'}</a>        <td></td>
         <td class="LC_top_nav_login">
           <a href="/adm/roles" target="_top">$lt{'login'}</a>
      </td>       </td>
      <td "LC_top_nav_logo">LON-CAPA<img src="$logo" alt="Logo" /></td>      </tr>
    </tr>  
   </table>    </table>
 </font>  </font>
 ENDINLINEMENU  ENDINLINEMENU
Line 199  my $is_group = (&Apache::loncommon::cour Line 204  my $is_group = (&Apache::loncommon::cour
 ENDDOCS  ENDDOCS
             }              }
             if ($showgroups) {              if ($showgroups) {
                 my $text = ($is_group) ? $lt{'teams'} : $lt{'groups'};  
                 $groups =(<<ENDGROUPS);                  $groups =(<<ENDGROUPS);
 <td><a href="/adm/coursegroups" target="_top">$text</a></td>  <td><a href="/adm/coursegroups" target="_top">$lt{'groups'}</a></td>
 ENDGROUPS  ENDGROUPS
             }              }
     if (      if (
Line 232  ENDCRELOAD Line 236  ENDCRELOAD
         }          }
         my $form=&serverform();          my $form=&serverform();
  my $utility=&utilityfunctions();   my $utility=&utilityfunctions();
  my $logo=&Apache::loncommon::lonhttpdurl("/adm/lonIcons/minilogo.gif");  
  my $remote;   my $remote;
  if ($env{'user.adv'}) {   if ($env{'user.adv'}) {
     $remote = '<td><a href="/adm/remote?action=launch&amp;url='.$escurl.'" target="_top">'.$lt{'launch'}.'</a></td>'      $remote = '<td><a href="/adm/remote?action=launch&amp;url='.$escurl.'" target="_top">'.$lt{'launch'}.'</a></td>'
  }   }
   
           my $helplink=&Apache::loncommon::top_nav_help('Help');
  return (<<ENDINLINEMENU);   return (<<ENDINLINEMENU);
 <script type="text/javascript">  <script type="text/javascript">
 // BEGIN LON-CAPA Internal  // BEGIN LON-CAPA Internal
Line 246  $utility Line 251  $utility
 </script>  </script>
 <table id="LC_top_nav">  <table id="LC_top_nav">
 <tr>  <tr>
   $logo
 <td><a href="/adm/menu" target="_top">$lt{'main'}</a></td>  <td><a href="/adm/menu" target="_top">$lt{'main'}</a></td>
 $reloadlink  $reloadlink
 $navmaps  $navmaps
Line 253  $docs Line 259  $docs
 $groups  $groups
 $remote  $remote
 <td><a href="/adm/roles" target="_top">$lt{'roles'}</a></td>  <td><a href="/adm/roles" target="_top">$lt{'roles'}</a></td>
 <td><a href="/adm/logout" target="_top">$lt{'exit'}</a></td>  <td class="LC_top_nav_help">$helplink</td>
 <td class="LC_top_nav_logo">LON-CAPA<img src="$logo" alt="Logo" /></td>  <td class="LC_top_nav_exit"><a href="/adm/logout" target="_top">$lt{'exit'}</a></td>
 </tr>  </tr>
 </table>  </table>
 $form  $form
Line 383  sub innerregister { Line 389  sub innerregister {
     &Apache::lonnet::allowed('opa',$crs)) {      &Apache::lonnet::allowed('opa',$crs)) {
     $hwkadd.=&switch('','',7,3,'pparm.gif','problem[_2]','parms[_2]',      $hwkadd.=&switch('','',7,3,'pparm.gif','problem[_2]','parms[_2]',
      "gocmd('/adm/parmset','set')",       "gocmd('/adm/parmset','set')",
      'Modify deadlines, etc, for this resource');       'Modify parameter settings for this resource');
  }   }
 # -- End Homework  # -- End Homework
         ###          ###
Line 401  sub innerregister { Line 407  sub innerregister {
                 my $desc = "Enter my resource construction space";                  my $desc = "Enter my resource construction space";
                 # Set defaults for co-authors                  # Set defaults for co-authors
                 if ($env{'request.role'} =~ /^ca/) {                   if ($env{'request.role'} =~ /^ca/) { 
                     ($cadom,$caname)=($env{'request.role'}=~/(\w+)\/(\w+)$/);                      ($cadom,$caname)=($env{'request.role'}=~/($match_domain)\/($match_username)$/);
                     ($top,$bottom) = ('co con-','struct');                      ($top,$bottom) = ('co con-','struct');
                     $action = "go('/priv/".$caname."');";                      $action = "go('/priv/".$caname."');";
                     $desc = "Enter construction space as co-author";                      $desc = "Enter construction space as co-author";
Line 423  sub innerregister { Line 429  sub innerregister {
             my $cfudom='';              my $cfudom='';
             if ($env{'request.filename'}) {              if ($env{'request.filename'}) {
                 my $file=&Apache::lonnet::declutter($env{'request.filename'});                  my $file=&Apache::lonnet::declutter($env{'request.filename'});
                 $file=~s/^(\w+)\/(\w+)/\/priv\/$2/;                  $file=~s/^($match_domain)\/($match_username)/\/priv\/$2/;
                 # Check that the user has permission to edit this resource                  # Check that the user has permission to edit this resource
                 ($cfuname,$cfudom)=&Apache::loncacc::constructaccess($file,$1);                  ($cfuname,$cfudom)=&Apache::loncacc::constructaccess($file,$1);
                 if (defined($cfudom)) {                  if (defined($cfudom)) {
Line 439  sub innerregister { Line 445  sub innerregister {
             # Finally, turn the button on or off              # Finally, turn the button on or off
             if ($cfile && !$const_space) {              if ($cfile && !$const_space) {
                 $editbutton=&switch                  $editbutton=&switch
                     ('','',6,1,'cstr.gif','edit[_1]','resource[_2]',                      ('','',6,1,'pcstr.gif','edit[_1]','resource[_2]',
                      "go('".$cfile."');","Edit this resource");                       "go('".$cfile."');","Edit this resource");
             } elsif ($editbutton eq '') {              } elsif ($editbutton eq '') {
                 $editbutton=&switch('','',6,1,'port.gif',                  $editbutton=&clear(6,1);
     'port-[_1]','folio[_1]',  
     "go('/adm/portfolio');",  
     "Enter my portfolio space");  
             }              }
         }          }
         ###          ###
Line 460  sub innerregister { Line 463  sub innerregister {
                 $is_const_dir = 1;                  $is_const_dir = 1;
             } else {              } else {
                 $currdir =~ s#[^/]+$##;                  $currdir =~ s#[^/]+$##;
    my $cleandisfn = &Apache::loncommon::escape_single($thisdisfn);
    my $esc_currdir = &Apache::loncommon::escape_single($currdir);
                 $menuitems=(<<ENDMENUITEMS);                  $menuitems=(<<ENDMENUITEMS);
 s&6&1&list.gif&list[_1]&dir[_1]&golist('$currdir')&List current directory  s&6&1&list.gif&list[_1]&dir[_1]&golist('$esc_currdir')&List current directory
 s&6&2&rtrv.gif&retrieve[_1]&version[_1]&gocstr('/adm/retrieve','/~$uname/$thisdisfn')&Retrieve old version  s&6&2&rtrv.gif&retrieve[_1]&version[_1]&gocstr('/adm/retrieve','/~$uname/$cleandisfn')&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/$cleandisfn')&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/$cleandisfn')&Delete this resource
 s&7&2&prt.gif&prepare[_1]&printout[_1]&gocstr('/adm/printout','/~$uname/$thisdisfn')&Prepare a printable document  s&7&2&prt.gif&prepare[_1]&printout[_1]&gocstr('/adm/printout','/~$uname/$cleandisfn')&Prepare a printable document
 ENDMENUITEMS  ENDMENUITEMS
             }              }
         } elsif (defined($env{'request.course.id'}) &&           } elsif ( defined($env{'request.course.id'}) && 
  $env{'request.symb'} ne '') {   $env{'request.symb'} ne '' ) {
     $menuitems=(<<ENDMENUITEMS);      $menuitems=(<<ENDMENUITEMS);
 c&3&1  c&3&1
 s&2&1&back.gif&backward[_1]&&gopost('/adm/flip','back:'+currentURL)&Go to the previous resource in the course sequence&1  s&2&1&back.gif&backward[_1]&&gopost('/adm/flip','back:'+currentURL)&Go to the previous resource in the course sequence&&1
 s&2&3&forw.gif&forward[_1]&&gopost('/adm/flip','forward:'+currentURL)&Go to the next resource in the course sequence&3  s&2&3&forw.gif&forward[_1]&&gopost('/adm/flip','forward:'+currentURL)&Go to the next resource in the course sequence&&3
 c&6&3  c&6&3
 c&8&1  c&8&1
 c&8&2  c&8&2
 s&8&3&prt.gif&prepare[_1]&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document  s&8&3&prt.gif&prepare[_1]&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document
 s&9&1&sbkm.gif&set[_1]&bookmark[_2]&set_bookmark()&Set a bookmark for this resource&1  s&9&1&sbkm.gif&set[_1]&bookmark[_2]&set_bookmark()&Set a bookmark for this resource&&1
 s&9&3&anot.gif&anno-[_1]&tations[_1]&annotate()&Make notes and annotations about this resource&1  s&9&3&anot.gif&anno-[_1]&tations[_1]&annotate()&Make notes and annotations about this resource&&1
 ENDMENUITEMS  ENDMENUITEMS
   
             unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme)(\?|$)/) {              unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme)(\?|$)/) {
         $menuitems.=(<<ENDREALRES);   if (!$env{'request.enc'}) {
       $menuitems.=(<<ENDREALRES);
 s&6&3&catalog.gif&catalog[_1]&info[_1]&catalog_info()&Show catalog information  s&6&3&catalog.gif&catalog[_1]&info[_1]&catalog_info()&Show catalog information
   ENDREALRES
                   }
           $menuitems.=(<<ENDREALRES);
 s&8&1&eval.gif&evaluate[_1]&this[_1]&gopost('/adm/evaluate',currentURL,1)&Provide my evaluation of this resource  s&8&1&eval.gif&evaluate[_1]&this[_1]&gopost('/adm/evaluate',currentURL,1)&Provide my evaluation of this resource
 s&8&2&fdbk.gif&feedback[_1]&discuss[_1]&gopost('/adm/feedback',currentURL,1)&Provide feedback messages or contribute to the course discussion about this resource  s&8&2&fdbk.gif&feedback[_1]&discuss[_1]&gopost('/adm/feedback',currentURL,1)&Provide feedback messages or contribute to the course discussion about this resource
 ENDREALRES  ENDREALRES
     }      }
         }          }
    if ($env{'request.uri'} =~ /^\/res/) {
       $menuitems .= (<<ENDMENUITEMS);
   s&8&3&prt.gif&prepare[_1]&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document
   ENDMENUITEMS
    }
         my $buttons='';          my $buttons='';
         foreach (split(/\n/,$menuitems)) {          foreach (split(/\n/,$menuitems)) {
     my ($command,@rest)=split(/\&/,$_);      my ($command,@rest)=split(/\&/,$_);
Line 510  ENDREALRES Line 525  ENDREALRES
     $inlinebuttons=      $inlinebuttons=
                         join('',map { (defined($_)?$_:'') } @inlineremote);                          join('',map { (defined($_)?$_:'') } @inlineremote);
  } else {   } else {
     $inlinebuttons=(<<ENDINLINE);                      if ($env{'environment.icons'} eq 'iconsonly') {
                          $inlinebuttons=(<<ENDINLINEICONS);
   <tr><td>
   $inlineremote[21] $inlineremote[23]
   $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 {
          $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>
 <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
                       }
                 }                  }
     }      }
     $result =(<<ENDREGTEXT);      $result =(<<ENDREGTEXT);
Line 777  ENDRESIZE Line 803  ENDRESIZE
     $returnval.=(<<ENDOPEN);      $returnval.=(<<ENDOPEN);
 window.status='Opening LON-CAPA Remote Control';  window.status='Opening LON-CAPA Remote Control';
 var menu=window.open("/res/adm/pages/menu.html","$menuname",  var menu=window.open("/res/adm/pages/menu.html","$menuname",
 "height=350,width=150,scrollbars=no,menubar=no,top=5,left=5,screenX=5,screenY=5");  "height=375,width=150,scrollbars=no,menubar=no,top=5,left=5,screenX=5,screenY=5");
 self.name='loncapaclient';  self.name='loncapaclient';
 ENDOPEN  ENDOPEN
     return '<script type="text/javascript">'.$returnval.'</script>';      return '<script type="text/javascript">'.$returnval.'</script>';
Line 802  sub clear { Line 828  sub clear {
 # The javascript is usually similar to "go('/adm/roles')" or "cstrgo(..)".  # The javascript is usually similar to "go('/adm/roles')" or "cstrgo(..)".
   
 sub switch {  sub switch {
     my ($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$nobreak)=@_;      my ($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat,$nobreak)=@_;
     $act=~s/\$uname/$uname/g;      $act=~s/\$uname/$uname/g;
     $act=~s/\$udom/$udom/g;      $act=~s/\$udom/$udom/g;
     $top=&mt($top);      $top=&mt($top);
Line 810  sub switch { Line 836  sub switch {
     $desc=&mt($desc);      $desc=&mt($desc);
     $img=&mt($img);      $img=&mt($img);
   
       my $idx=10*$row+$col;
       $category_members{$cat}.=':'.$idx;
   
     unless (($env{'browser.interface'} eq 'textual')  ||      unless (($env{'browser.interface'} eq 'textual')  ||
             ($env{'environment.remote'} eq 'off')) {              ($env{'environment.remote'} eq 'off')) {
 # Remote  # Remote
Line 821  sub switch { Line 850  sub switch {
        my $text=$top.' '.$bot;         my $text=$top.' '.$bot;
        $text=~s/\s*\-\s*//gs;         $text=~s/\s*\-\s*//gs;
        if ($nobreak) {         if ($nobreak) {
    $inlineremote[10*$row+$col]=     $inlineremote[$idx]=
        '<a href="javascript:'.$act.';">'.$text.'</a>';         '<a href="javascript:'.$act.';">'.$text.'</a>';
        } else {         } else {
    $inlineremote[10*$row+$col]="\n<br />".     $inlineremote[$idx]="\n<br />".
        $desc.' <a href="javascript:'.$act.';">'.$text.'</a>';         $desc.' <a href="javascript:'.$act.';">'.$text.'</a>';
        }         }
    } else {     } else {
 # Inline Remote  # Inline Remote
          if ($env{'environment.icons'} ne 'classic') {
             $img=~s/\.gif$/\.png/;
          }
        if ($nobreak==2) { return ''; }         if ($nobreak==2) { return ''; }
        my $text=$top.' '.$bot;         my $text=$top.' '.$bot;
        $text=~s/\s*\-\s*//gs;         $text=~s/\s*\-\s*//gs;
Line 842  sub switch { Line 874  sub switch {
        if ($env{'browser.interface'} eq 'faketextual') {         if ($env{'browser.interface'} eq 'faketextual') {
 # Accessibility  # Accessibility
    if ($nobreak==3) {     if ($nobreak==3) {
        $inlineremote[10*$row+$col]="\n".         $inlineremote[$idx]="\n".
    '<td class="LC_menubuttons_text" align="right">'.$text.     '<td class="LC_menubuttons_text" align="right">'.$text.
    '</td><td class="LC_menubuttons_img" align="left">'.     '</td><td class="LC_menubuttons_img" align="left">'.
    '<a href="javascript:'.$act.';">'.$pic.'</a></td></tr>';     '<a href="javascript:'.$act.';">'.$pic.'</a></td></tr>';
    } elsif ($nobreak) {     } elsif ($nobreak) {
        $inlineremote[10*$row+$col]="\n<tr>".         $inlineremote[$idx]="\n<tr>".
    '<td class="LC_menubuttons_img" align="left">'.     '<td class="LC_menubuttons_img" align="left">'.
    '<a href="javascript:'.$act.';">'.$pic.'</a></td>     '<a href="javascript:'.$act.';">'.$pic.'</a></td>
                     <td class="LC_menubuttons_text" align="left">'.$text.'</td>';                      <td class="LC_menubuttons_text" align="left"><a class="LC_menubuttons_link" href="javascript:'.$act.';"><span class="LC_menubuttons_inline_text">'.$text.'</span></a></td>';
    } else {     } else {
        $inlineremote[10*$row+$col]="\n<tr>".         $inlineremote[$idx]="\n<tr>".
    '<td class="LC_menubuttons_img" align="left">'.     '<td class="LC_menubuttons_img" align="left">'.
    '<a href="javascript:'.$act.';">'.$pic.     '<a href="javascript:'.$act.';">'.$pic.
    '</a></td><td class="LC_menubuttons_text" colspan="3">'.     '</a></td><td class="LC_menubuttons_text" colspan="3">'.
    $desc.'</td></tr>';     '<a class="LC_menubuttons_link" href="javascript:'.$act.';"><span class="LC_menubuttons_inline_text">'.$desc.'</span></a></td></tr>';
    }     }
        } else {         } else {
 # Inline Menu  # Inline Menu
    $inlineremote[10*$row+$col]=             if ($env{'environment.icons'} eq 'iconsonly') {
    '<a href="javascript:'.$act.';">'.$pic.                $inlineremote[$idx]='<a title="'.$desc.'" href="javascript:'.$act.';">'.$pic.'</a>';
    '</a><span class="LC_menubuttons_inline_text">'.$desc.'</span>';             } else {
         $inlineremote[$idx]=
      '<a class="LC_menubuttons_link" href="javascript:'.$act.';">'.$pic.
      '<span class="LC_menubuttons_inline_text">'.$desc.'</span></a>';
              }
        }         }
    }     }
     return '';      return '';
Line 871  sub switch { Line 907  sub switch {
 sub secondlevel {  sub secondlevel {
     my $output='';      my $output='';
     my       my 
     ($uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc)=@_;      ($uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat)=@_;
     if ($prt eq 'any') {      if ($prt eq 'any') {
    $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);     $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
     } elsif ($prt=~/^r(\w+)/) {      } elsif ($prt=~/^r(\w+)/) {
         if ($rol eq $1) {          if ($rol eq $1) {
            $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);             $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
         }          }
     }      }
     return $output;      return $output;
Line 891  sub openmenu { Line 927  sub openmenu {
 }  }
   
 sub inlinemenu {  sub inlinemenu {
     @inlineremote=();      undef(@inlineremote);
     undef @inlineremote;      undef(%category_members);
     &rawconfig(1);      &rawconfig(1);
     return join('',map { (defined($_)?$_:'') } @inlineremote);      my $output='<table id="LC_mainmenu"><tr>';
       for (my $col=1; $col<=2; $col++) {
           $output.='<td class="LC_mainmenu_column">';
           for (my $row=1; $row<=8; $row++) {
               foreach my $cat (keys(%category_members)) {
                  if ($category_positions{$cat} ne "$col,$row") { next; }
                  $output.='<table id="LC_menubuttons_mainmenu"><tr><td colspan="4" class="LC_menubuttons_category">'.&mt($category_names{$cat}).'</td></tr>';
                  my %active=();
                  foreach my $menu_item (split(/\:/,$category_members{$cat})) {
                     if ($inlineremote[$menu_item]) {
                        $active{$menu_item}=1;
                     }
                  }  
                  foreach my $item (sort(keys(%active))) {
                     $output.=$inlineremote[$item];
                  }
                  $output.='</table>';
               }
            }
            $output.="</td>";
       }
       $output.="</tr></table>";
       return $output;
 }  }
   
 sub rawconfig {  sub rawconfig {
Line 925  sub rawconfig { Line 983  sub rawconfig {
     my $rol=$env{'request.role'};      my $rol=$env{'request.role'};
     my $requested_domain = $env{'request.role.domain'};      my $requested_domain = $env{'request.role.domain'};
     foreach my $line (@desklines) {      foreach my $line (@desklines) {
         my ($row,$col,$pro,$prt,$img,$top,$bot,$act,$desc)=split(/\:/,$line);          my ($row,$col,$pro,$prt,$img,$top,$bot,$act,$desc,$cat)=split(/\:/,$line);
         $prt=~s/\$uname/$uname/g;          $prt=~s/\$uname/$uname/g;
         $prt=~s/\$udom/$udom/g;          $prt=~s/\$udom/$udom/g;
         $prt=~s/\$crs/$crs/g;           $prt=~s/\$crs/$crs/g; 
         $prt=~s/\$requested_domain/$requested_domain/g;          $prt=~s/\$requested_domain/$requested_domain/g;
           if ($category_names{$cat}!~/\w/) { $cat='oth'; }
         my $type = &Apache::loncommon::course_type();          my $type = &Apache::loncommon::course_type();
         if ($type eq 'Group') {          if ($type eq 'Group') {
             $desc = &convert_menu_function($desc,$type);              $desc = &convert_menu_function($desc,$type);
Line 938  sub rawconfig { Line 997  sub rawconfig {
     $output.=&clear($row,$col);      $output.=&clear($row,$col);
         } elsif ($pro eq 'any') {          } elsif ($pro eq 'any') {
                $output.=&secondlevel(                 $output.=&secondlevel(
   $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc);    $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
  } elsif ($pro eq 'smp') {   } elsif ($pro eq 'smp') {
             unless ($adv) {              unless ($adv) {
                $output.=&secondlevel(                 $output.=&secondlevel(
           $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc);            $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
             }              }
         } elsif ($pro eq 'adv') {          } elsif ($pro eq 'adv') {
             if ($adv) {              if ($adv) {
                $output.=&secondlevel(                 $output.=&secondlevel(
   $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc);    $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
             }              }
         } elsif (($pro=~/^p(\w+)/) && ($prt)) {          } elsif (($pro=~/^p(\w+)/) && ($prt)) {
     if (&Apache::lonnet::allowed($1,$prt)) {      if (&Apache::lonnet::allowed($1,$prt)) {
                $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);                 $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
             }              }
         } elsif ($pro eq 'course') {          } elsif ($pro eq 'course') {
             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,$cat);
     }      }
         } elsif ($pro =~ /^courseenv_(.*)$/) {          } elsif ($pro =~ /^courseenv_(.*)$/) {
             my $key = $1;              my $key = $1;
             if ($env{'course.'.$env{'request.course.id'}.'.'.$key}) {              if ($env{'course.'.$env{'request.course.id'}.'.'.$key}) {
                 $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);                  $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
             }              }
         } elsif ($pro =~ /^course_(.*)$/) {          } elsif ($pro =~ /^course_(.*)$/) {
             # Check for permissions inside of a course              # Check for permissions inside of a course
Line 968  sub rawconfig { Line 1027  sub rawconfig {
                 (&Apache::lonnet::allowed($1,$env{'request.course.id'}.                  (&Apache::lonnet::allowed($1,$env{'request.course.id'}.
             ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))              ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))
                  )) {                   )) {
                 $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);                  $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
     }      }
         } elsif ($pro eq 'author') {          } elsif ($pro eq 'author') {
             if ($author) {              if ($author) {
Line 979  sub rawconfig { Line 1038  sub rawconfig {
                     my $caname=$env{'user.name'};                      my $caname=$env{'user.name'};
                     if ($prt eq 'rca') {                      if ($prt eq 'rca') {
        ($cadom,$caname)=         ($cadom,$caname)=
                                ($env{'request.role'}=~/(\w+)\/(\w+)$/);                                 ($env{'request.role'}=~/($match_domain)\/($match_username)$/);
                     }                                             }                       
                     $act =~ s/\$caname/$caname/g;                      $act =~ s/\$caname/$caname/g;
                     my $home = &Apache::lonnet::homeserver($caname,$cadom);                      my $home = &Apache::lonnet::homeserver($caname,$cadom);
Line 987  sub rawconfig { Line 1046  sub rawconfig {
     my @ids=&Apache::lonnet::current_machine_ids();      my @ids=&Apache::lonnet::current_machine_ids();
     foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }      foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }
     if ($allowed) {      if ($allowed) {
                         $output.=switch($caname,$cadom,                          $output.=&switch($caname,$cadom,
                                         $row,$col,$img,$top,$bot,$act,$desc);                                          $row,$col,$img,$top,$bot,$act,$desc,$cat);
                     }                      }
                 }                  }
             }              }
Line 1067  sub utilityfunctions { Line 1126  sub utilityfunctions {
  'add_entries' => {   'add_entries' => {
     'onload' => 'javascript:document.goannotate.submit();'}});      'onload' => 'javascript:document.goannotate.submit();'}});
   
       my $end_page_annotate = 
           &Apache::loncommon::end_page({'js_ready' => 1});
   
     my $start_page_bookmark =       my $start_page_bookmark = 
         &Apache::loncommon::start_page('Bookmarks',undef,          &Apache::loncommon::start_page('Bookmarks',undef,
        {'only_body' => 1,         {'only_body' => 1,
  'js_ready'  => 1,   'js_ready'  => 1,
  'bgcolor'   => '#BBBBBB',});   'bgcolor'   => '#BBBBBB',});
   
     my $end_page =       my $end_page_bookmark = 
         &Apache::loncommon::end_page({'js_ready' => 1});          &Apache::loncommon::end_page({'js_ready' => 1});
   
 return (<<ENDUTILITY)  return (<<ENDUTILITY)
Line 1191  function annotate() { Line 1253  function annotate() {
    '$start_page_annotate'     '$start_page_annotate'
   +"<form name='goannotate' target='Annotator' method='post' "    +"<form name='goannotate' target='Annotator' method='post' "
   +"action='/adm/annotations'>"    +"action='/adm/annotations'>"
   +"<input type='hidden' name='urlnew' value='"+currentURL+"' />"    +"<input type='hidden' name='symbnew' value='"+currentSymb+"' />"
   +"<\\/form>"    +"<\\/form>"
   +'$end_page');    +'$end_page_annotate');
    annotator.document.close();     annotator.document.close();
 }  }
   
Line 1215  function set_bookmark() { Line 1277  function set_bookmark() {
    +"value='Save' /> <input type='button' value='Close (no save)' "     +"value='Save' /> <input type='button' value='Close (no save)' "
    +"onclick='javascript:window.close();' /><\\/center><\\/td>"     +"onclick='javascript:window.close();' /><\\/center><\\/td>"
    +"<\\/tr><\\/table><\\/form><\\/center>"     +"<\\/tr><\\/table><\\/form><\\/center>"
    +'$end_page' );     +'$end_page_bookmark' );
    bmquery.document.close();     bmquery.document.close();
 }  }
   
Line 1287  BEGIN { Line 1349  BEGIN {
     $configline=(split(/\#/,$configline))[0];      $configline=(split(/\#/,$configline))[0];
     $configline=~s/^\s+//;      $configline=~s/^\s+//;
     chomp($configline);      chomp($configline);
     if ($configline) {                      if ($configline=~/^cat\:/) {
                          my @entries=split(/\:/,$configline);
                          $category_positions{$entries[2]}=$entries[1];
                          $category_names{$entries[2]}=$entries[3];
       } elsif ($configline) {
  push(@desklines,$configline);   push(@desklines,$configline);
     }      }
  }   }

Removed from v.1.188  
changed lines
  Added in v.1.219


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