Diff for /loncom/interface/lonmenu.pm between versions 1.263 and 1.274

version 1.263, 2009/05/08 16:08:56 version 1.274, 2009/07/11 19:58:29
Line 26 Line 26
 # http://www.lon-capa.org/  # http://www.lon-capa.org/
 #  #
 #  #
 # There are two parameters controlling the action of this module:  # There is one parameter controlling the action of this module:
 #  
 # browser.interface - if this is 'textual', it overrides the second parameter  
 # and goes to screen reader PDA mode  
 #  #
 # environment.remote - if this is 'on', the routines controll the remote  # environment.remote - if this is 'on', the routines controll the remote
 # control, otherwise they render the main window controls; ignored it  # control, otherwise they render the main window controls; 
 # browser.interface is 'textual'  
 #  
   
 =head1 NAME  =head1 NAME
   
Line 51  described at http://www.lon-capa.org. Line 46  described at http://www.lon-capa.org.
   
 =over  =over
   
 =item show_course()  
   
 Little texts  Little texts
   
 =item initlittle()  =item initlittle()
Line 150  use vars qw(@desklines %category_names % Line 143  use vars qw(@desklines %category_names %
   
 my @inlineremote;  my @inlineremote;
   
   #
   # This routine returns a translated hash for the menu items in the top inline menu row
 sub show_course {  # Probably should be in mydesk.tab
     my $course = !$env{'user.adv'};  
     if (!$env{'user.adv'}) {  
  foreach my $env (keys(%env)) {  
     next if ($env !~ m/^user\.priv\./);  
     if ($env !~ m/^user\.priv\.(?:st|cm)/) {  
  $course = 0;  
  last;  
     }  
  }  
     }  
     return $course;  
 }  
   
 sub initlittle {  sub initlittle {
     return &Apache::lonlocal::texthash('ret' => 'Return to Last Location',      return &Apache::lonlocal::texthash('ret' => 'Return to Last Location',
        'nav' => 'Navigate Contents',         'nav' => 'Navigate Contents',
        'main' => 'Main Menu',         'main' => 'Main Menu',
                                        'roles' => (&show_course()?                                         'roles' => (&Apache::loncommon::show_course()?
                                                     'Courses':'Roles'),                                                      'Courses':'Roles'),
                                        'other' => 'Other Roles',                                         'other' => 'Other Roles',
                                        'docs' => 'Edit Course',                                         'docs' => 'Edit Course',
Line 186  sub menubuttons { Line 167  sub menubuttons {
     my $forcereg=shift;      my $forcereg=shift;
     my $registration=shift;      my $registration=shift;
     my $titletable=shift;      my $titletable=shift;
   #
   # Early-out for pages that should not have a menu, triggered by query string "inhibitmenu=yes"
   #
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
     ['inhibitmenu']);      ['inhibitmenu']);
     if (($env{'form.inhibitmenu'} eq 'yes') ||      if (($env{'form.inhibitmenu'} eq 'yes') ||
Line 202  sub menubuttons { Line 186  sub menubuttons {
     my $role_selector;      my $role_selector;
     my $showgroups=0;      my $showgroups=0;
     my ($cnum,$cdom);      my ($cnum,$cdom);
   #
   # if the URL is hidden, symbs and the non-versioned version of the URL would be encrypted
   #
     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'}));
   
Line 210  sub menubuttons { Line 197  sub menubuttons {
  $logo.'" alt="LON-CAPA Logo" class="LC_noBorder" /></a>';   $logo.'" alt="LON-CAPA Logo" class="LC_noBorder" /></a>';
   
     if ($env{'request.state'} eq 'construct') {      if ($env{'request.state'} eq 'construct') {
   #
   # We are in construction space
   #
         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'};
             $returnurl =~ s:^/home/([^/]+)/public_html/(.*)$:/priv/$1/$2:;              $returnurl =~ s:^/home/([^/]+)/public_html/(.*)$:/priv/$1/$2:;
Line 217  sub menubuttons { Line 207  sub menubuttons {
         }          }
     }      }
     if ($env{'request.course.id'}) {      if ($env{'request.course.id'}) {
   #
   # We are in a course
   #
         $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};          $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
         $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};          $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
         my %coursegroups;          my %coursegroups;
Line 234  sub menubuttons { Line 227  sub menubuttons {
         }          }
     }      }
   
     if ($env{'browser.interface'} eq 'textual') {      if ($env{'environment.remote'} eq 'off') {
 # Textual display only  
         if ($env{'request.course.id'}) {  
     $navmaps=(<<ENDNAV);  
 <a href="/adm/navmaps?postdata=$escurl&amp;postsymb=$escsymb" target="_top">$lt{'nav'}</a>  
 ENDNAV  
             if (&show_return_link()) {  
                 my $escreload=&escape('return:');  
                 $reloadlink=(<<ENDRELOAD);  
 <a href="/adm/flip?postdata=$escreload" target="_top">$lt{'ret'}</a>  
 ENDRELOAD  
             }  
     if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {  
                $docs=(<<ENDDOCS);  
 <a href="/adm/coursedocs" target="_top">$lt{'docs'}</a>  
 ENDDOCS  
             }  
             if ($showgroups) {  
                 $groups =(<<ENDGROUPS);  
 <a href="/adm/coursegroups" target="_top">$lt{'groups'}</a>  
 ENDGROUPS  
             }  
  }  
         my $form=&serverform();  
         my $utility=&utilityfunctions();  
  my $output=(<<ENDMAINMENU);  
 <script type="text/javascript">  
 // BEGIN LON-CAPA Internal  
 $utility  
 </script>  
 <div id="LC_top_nav">  
 <a href="/adm/menu" target="_top">$lt{'main'}</a>  
 $reloadlink $navmaps $docs $groups $roles  
 <a href="/adm/logout" target="_top">$lt{'exit'}</a>  
 </div>  
 <br />  
 <script type="text/javascript">  
 // END LON-CAPA Internal  
 </script>  
 $form  
 ENDMAINMENU  
         if ($registration) { $output.=&innerregister($forcereg); }  
  return $output."<hr />";  
     } elsif ($env{'environment.remote'} eq 'off') {  
 # Remote Control is switched off  # Remote Control is switched off
 # figure out colors  # figure out colors
  my %lt=&initlittle();          my %lt=&initlittle();
   
         my $domain=&Apache::loncommon::determinedomain();          my $domain=&Apache::loncommon::determinedomain();
  my $function =&Apache::loncommon::get_users_function();          my $function =&Apache::loncommon::get_users_function();
         my $link=&Apache::loncommon::designparm($function.'.link',$domain);          my $link=&Apache::loncommon::designparm($function.'.link',$domain);
         my $alink=&Apache::loncommon::designparm($function.'.alink',$domain);          my $alink=&Apache::loncommon::designparm($function.'.alink',$domain);
         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') {  
     return (<<ENDINLINEMENU);          if ($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public') {
    <table id="LC_top_nav">              return (<<ENDINLINEMENU);
     <tr>              <ol class="LC_smallMenu LC_right">
       <td>$logo</td>                  <li>$logo</li>
       <td></td>                  <li><a href="/adm/roles" target="_top">$lt{'login'}</a></li>
       <td class="LC_top_nav_login">              </ol>
         <a href="/adm/roles" target="_top">$lt{'login'}</a>              <hr />
      </td>  
     </tr>  
   </table>  
 ENDINLINEMENU  ENDINLINEMENU
         }          }
         $roles = '<a href="/adm/roles" target="_top">'.$lt{'roles'}.'</a>';          $roles = '<a href="/adm/roles" target="_top">'.$lt{'roles'}.'</a>';
Line 381  $form Line 328  $form
 <script type="text/javascript">  <script type="text/javascript">
 // END LON-CAPA Internal  // END LON-CAPA Internal
 </script>  </script>
 <br clear="all" />  
 $reg  $reg
 ENDINLINEMENU  ENDINLINEMENU
     } else {      } else {
Line 411  sub registerurl { Line 357  sub registerurl {
     if ($env{'request.state'} eq 'construct') {      if ($env{'request.state'} eq 'construct') {
  $force_title=&Apache::lonxml::display_title();   $force_title=&Apache::lonxml::display_title();
     }      }
     if (($env{'browser.interface'} eq 'textual') ||      if (($env{'environment.remote'} eq 'off') ||
         ($env{'environment.remote'} eq 'off') ||  
         ((($env{'request.publicaccess'}) ||           ((($env{'request.publicaccess'}) || 
          (!&Apache::lonnet::is_on_map(           (!&Apache::lonnet::is_on_map(
    &unescape($env{'request.noversionuri'})))) &&     &unescape($env{'request.noversionuri'})))) &&
Line 437  sub innerregister { Line 382  sub innerregister {
   
     $env{'request.registered'} = 1;      $env{'request.registered'} = 1;
   
     my $textinter=($env{'browser.interface'} eq 'textual');      my $noremote = ($env{'environment.remote'} eq 'off');
     my $noremote=($env{'environment.remote'} eq 'off');  
           
     my $textual=($textinter || $noremote);  
   
     undef(@inlineremote);      undef(@inlineremote);
   
     my $reopen=&Apache::lonmenu::reopenmenu();      my $reopen=&Apache::lonmenu::reopenmenu();
   
     my $newmail='';      my $newmail='';
     if ($noremote) {      my $breadcrumb;
  $newmail='<table id="LC_nav_location"><tr>';  
     }      if (&Apache::lonmsg::newmail() && !$noremote) { 
     if (&Apache::lonmsg::newmail()) {           # We have new mail and remote is up
  if ($textual) {          $newmail= 'swmenu.setstatus("you have","messages");';
     $newmail.= '<td class="LC_new_mail">  
                    <a href="/adm/communicate" target="_top">'.  
    &mt('You have new messages').'</a></td>';  
  } else {  
     $newmail= 'swmenu.setstatus("you have","messages");';  
  }  
     }       } 
     if (($textual)       if ($noremote
      && ($env{'request.symb'})        && ($env{'request.symb'}) 
      && ($env{'request.course.id'})) {       && ($env{'request.course.id'})) {
  $newmail.= '<td class="LC_current_location">';  
  my ($mapurl,$rid,$resurl)=          my ($mapurl,$rid,$resurl) = &Apache::lonnet::decode_symb(&Apache::lonnet::symbread());
     &Apache::lonnet::decode_symb(&Apache::lonnet::symbread());          my $coursetitle = $env{'course.'.$env{'request.course.id'}.'.description'};
         my $coursetitle=$env{'course.'.$env{'request.course.id'}.'.description'};  
         $newmail.=$coursetitle;          my $maptitle = &Apache::lonnet::gettitle($mapurl);
         my $maptitle=&Apache::lonnet::gettitle($mapurl);          my $restitle = &Apache::lonnet::gettitle(&Apache::lonnet::symbread());
  my $restitle=&Apache::lonnet::gettitle(&Apache::lonnet::symbread());          my @crumbs = ({text  => "Course Content", 
         if ($maptitle && ($maptitle ne 'default.sequence') && ($maptitle ne $coursetitle)) {                         href  => "Javascript:gonav('/adm/navmaps')"}, 
     $newmail.=', '.$maptitle;                        {text  => '...',
         }                         no_mt => 1});
         if ($restitle) {  
     $newmail.=': '.$restitle;          push @crumbs, {text => $maptitle, no_mt => 1} if ($maptitle 
         }                                                     && $maptitle ne 'default.sequence' 
         $newmail.='&nbsp;&nbsp;&nbsp;</td>';                                                     && $maptitle ne $coursetitle);
   
           push @crumbs, {text => $restitle, no_mt => 1} if $restitle; 
   
           Apache::lonhtmlcommon::clear_breadcrumbs();
           Apache::lonhtmlcommon::add_breadcrumb(@crumbs);
           $breadcrumb .= Apache::lonhtmlcommon::breadcrumbs(undef,undef,0);
           #
     }      }
     if ($env{'request.state'} eq 'construct') {      if ($env{'request.state'} eq 'construct') {
         $newmail = $titletable;          $newmail = $titletable;
     } else {      } 
  if ($noremote) {      my $timesync   = ( $noremote ? '' : 'swmenu.syncclock(1000*'.time.');' );
     $newmail.='</tr></table>';      my $tablestart = ( $noremote ? '<table id="LC_menubuttons">' : '');
  }      my $tableend   = ( $noremote ? '</table>' : '');
     }  
     my $timesync=($textual?'':'swmenu.syncclock(1000*'.time.');');  
     my $tablestart=($noremote?'<table id="LC_menubuttons">':'').  
  ($textinter?'<br /><a href="#content">'.&mt('Skip to Content').'</a><br />':'');  
     my $tableend=($noremote?'</table>':'').($textinter?'<a name="content" />':'');  
 # =============================================================================  # =============================================================================
 # ============================ This is for URLs that actually can be registered  # ============================ This is for URLs that actually can be registered
     if (($env{'request.noversionuri'}!~m|^/(res/)*adm/|) || ($forcereg)) {      if (($env{'request.noversionuri'}!~m|^/(res/)*adm/|) || ($forcereg)) {
Line 531  sub innerregister { Line 469  sub innerregister {
         }          }
         if ($env{'user.author'}) {          if ($env{'user.author'}) {
             if ($env{'request.role'}=~/^(aa|ca|au)/) {              if ($env{'request.role'}=~/^(aa|ca|au)/) {
   #
   # We have the role of an author
   #
                 # Set defaults for authors                  # Set defaults for authors
                 my ($top,$bottom) = ('con-','struct');                  my ($top,$bottom) = ('con-','struct');
                 my $action = "go('/priv/".$env{'user.name'}."');";                  my $action = "go('/priv/".$env{'user.name'}."');";
Line 559  sub innerregister { Line 500  sub innerregister {
                     $noeditbutton = 0;                      $noeditbutton = 0;
                 }                  }
             }              }
   #
   # We are an author for some stuff, but currently do not have the role of author.
   # Figure out if we have authoring privileges for the resource we are looking at.
   # This should maybe become a privilege check in lonnet
   #
             ##              ##
             ## Determine if user can edit url.              ## Determine if user can edit url.
             ##              ##
Line 617  sub innerregister { Line 563  sub innerregister {
 # Prepare the rest of the buttons  # Prepare the rest of the buttons
         my $menuitems;          my $menuitems;
         if ($const_space) {          if ($const_space) {
   #
   # We are in construction space
   #
     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;
             if ($currdir =~ m-/$-) {              if ($currdir =~ m-/$-) {
                 $is_const_dir = 1;                  $is_const_dir = 1;
             } else {              } else {
                 $currdir =~ s#[^/]+$##;                  $currdir =~ s|[^/]+$||;
  my $cleandisfn = &Apache::loncommon::escape_single($thisdisfn);   my $cleandisfn = &Apache::loncommon::escape_single($thisdisfn);
  my $esc_currdir = &Apache::loncommon::escape_single($currdir);   my $esc_currdir = &Apache::loncommon::escape_single($currdir);
   #
   # Probably should be in mydesk.tab
   #
                 $menuitems=(<<ENDMENUITEMS);                  $menuitems=(<<ENDMENUITEMS);
 s&6&1&list.gif&list[_1]&dir[_1]&golist('$esc_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/$cleandisfn')&Retrieve old version  s&6&2&rtrv.gif&retrieve[_1]&version[_1]&gocstr('/adm/retrieve','/~$uname/$cleandisfn')&Retrieve old version
Line 636  ENDMENUITEMS Line 588  ENDMENUITEMS
             }              }
         } elsif ( defined($env{'request.course.id'}) &&           } elsif ( defined($env{'request.course.id'}) && 
  $env{'request.symb'} ne '' ) {   $env{'request.symb'} ne '' ) {
   #
   # We are in a course and looking at a registred URL
   # Should probably be in mydesk.tab
   #
     $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
Line 695  ENDMENUITEMS Line 651  ENDMENUITEMS
             }              }
         }          }
   
         if ($textual) {          if ($noremote) {
     my $addremote=0;      my $addremote=0;
     foreach (@inlineremote) { if ($_ ne '') { $addremote=1; } }      foreach (@inlineremote) { if ($_ ne '') { $addremote=1; last;} }
     my $inlinebuttons='';      my $inlinebuttons='';
     if ($addremote) {      if ($addremote) {
 # Registered, textual output              # Registered, textual output
  if ($env{'browser.interface'} eq 'textual') {  
     $inlinebuttons=  
                         join('',map { (defined($_)?$_:'') } @inlineremote);  
  } else {  
                     if ($env{'environment.icons'} eq 'iconsonly') {                      if ($env{'environment.icons'} eq 'iconsonly') {
                         $inlinebuttons=(<<ENDARROWSINLINE);                          $inlinebuttons=(<<ENDARROWSINLINE);
 <tr><td>  <tr><td>
Line 736  ENDLINE Line 688  ENDLINE
     }      }
  }   }
     }      }
  }  
     }      }
     $result =(<<ENDREGTEXT);      $result =(<<ENDREGTEXT);
 <script type="text/javascript">  <script type="text/javascript">
 // BEGIN LON-CAPA Internal  // BEGIN LON-CAPA Internal
 </script>  </script>
 $timesync  $timesync
   $breadcrumb
 $tablestart  $tablestart
 $inlinebuttons  $inlinebuttons
 $tableend  $tableend
Line 805  ENDREGTHIS Line 757  ENDREGTHIS
 # =============================================================================  # =============================================================================
     } else {      } else {
 # ========================================== This can or will not be registered  # ========================================== This can or will not be registered
         if ($textual) {          if ($noremote) {
 # Not registered, textual  # Not registered
     $result= (<<ENDDONOTREGTEXT);              $result= (<<ENDDONOTREGTEXT);
 ENDDONOTREGTEXT  ENDDONOTREGTEXT
         } else {          } else {
 # Not registered, graphical  # Not registered, graphical
Line 897  sub unloadevents() { Line 849  sub unloadevents() {
   
 sub startupremote {  sub startupremote {
     my ($lowerurl)=@_;      my ($lowerurl)=@_;
     if (($env{'browser.interface'} eq 'textual') ||      if ($env{'environment.remote'} eq 'off') {
         ($env{'environment.remote'} eq 'off')) {  
      return ('<meta HTTP-EQUIV="Refresh" CONTENT="0.5; url='.$lowerurl.'" />');       return ('<meta HTTP-EQUIV="Refresh" CONTENT="0.5; url='.$lowerurl.'" />');
     }      }
 #  #
Line 973  ENDSETFLAGS Line 924  ENDSETFLAGS
 }  }
   
 sub maincall() {  sub maincall() {
     if (($env{'browser.interface'} eq 'textual') ||      if ($env{'environment.remote'} eq 'off') { return ''; }
         ($env{'environment.remote'} eq 'off')) { return ''; }  
     return(<<ENDMAINCALL);      return(<<ENDMAINCALL);
 <script type="text/javascript">  <script type="text/javascript">
     main();      main();
Line 985  ENDMAINCALL Line 935  ENDMAINCALL
 sub load_remote_msg {  sub load_remote_msg {
     my ($lowerurl)=@_;      my ($lowerurl)=@_;
   
     if (($env{'browser.interface'} eq 'textual') ||      if ($env{'environment.remote'} eq 'off') { return ''; }
         ($env{'environment.remote'} eq 'off')) { return ''; }  
   
     my $esclowerurl=&escape($lowerurl);      my $esclowerurl=&escape($lowerurl);
     my $link=&mt('[_1]Continue[_2] on in Inline Menu mode'      my $link=&mt('[_1]Continue[_2] on in Inline Menu mode'
Line 1010  sub get_menu_name { Line 959  sub get_menu_name {
   
   
 sub reopenmenu {  sub reopenmenu {
    if (($env{'browser.interface'} eq 'textual') ||     if ($env{'environment.remote'} eq 'off') { return ''; }
        ($env{'environment.remote'} eq 'off')) { return ''; }  
    my $menuname = &get_menu_name();     my $menuname = &get_menu_name();
    my $nothing = &Apache::lonhtmlcommon::javascript_nothing();     my $nothing = &Apache::lonhtmlcommon::javascript_nothing();
    return('window.open('.$nothing.',"'.$menuname.'","",false);');     return('window.open('.$nothing.',"'.$menuname.'","",false);');
Line 1020  sub reopenmenu { Line 968  sub reopenmenu {
   
 sub open {  sub open {
     my $returnval='';      my $returnval='';
     if (($env{'browser.interface'} eq 'textual') ||      if ($env{'environment.remote'} eq 'off') { 
         ($env{'environment.remote'} eq 'off')) {   
  return '<script type="text/javascript">self.name="loncapaclient";</script>';   return '<script type="text/javascript">self.name="loncapaclient";</script>';
     }      }
     my $menuname = &get_menu_name();      my $menuname = &get_menu_name();
Line 1037  sub open { Line 984  sub open {
 #    }  #    }
     $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?inhibitmenu=yes","$menuname",
 "height=375,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
Line 1049  ENDOPEN Line 996  ENDOPEN
   
 sub clear {  sub clear {
     my ($row,$col)=@_;      my ($row,$col)=@_;
     unless (($env{'browser.interface'} eq 'textual') ||      unless ($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 {      } else { 
        $inlineremote[10*$row+$col]='';         $inlineremote[10*$row+$col]='';
Line 1075  sub switch { Line 1021  sub switch {
     my $idx=10*$row+$col;      my $idx=10*$row+$col;
     $category_members{$cat}.=':'.$idx;      $category_members{$cat}.=':'.$idx;
   
     unless (($env{'browser.interface'} eq 'textual')  ||      unless ($env{'environment.remote'} eq 'off') {
             ($env{'environment.remote'} eq 'off')) {  
 # Remote  # Remote
        return "\n".         return "\n".
  qq(window.status+='.';swmenu.switchbutton($row,$col,"$img","$top","$bot","$act","$desc"););   qq(window.status+='.';swmenu.switchbutton($row,$col,"$img","$top","$bot","$act","$desc"););
    } elsif ($env{'browser.interface'} eq 'textual') {  
 # Accessibility  
        if ($nobreak==2) { return ''; }  
        my $text=$top.' '.$bot;  
        $text=~s/\s*\-\s*//gs;  
        if ($nobreak) {  
    $inlineremote[$idx]=  
        '<a href="javascript:'.$act.';">'.$text.'</a>';  
        } else {  
    $inlineremote[$idx]="\n<br />".  
        $desc.' <a href="javascript:'.$act.';">'.$text.'</a>';  
        }  
    } else {     } else {
 # Inline Remote  # Inline Remote
        if ($env{'environment.icons'} ne 'classic') {         if ($env{'environment.icons'} ne 'classic') {
Line 1106  sub switch { Line 1039  sub switch {
    &Apache::loncommon::lonhttpdurl('/res/adm/pages/'.$img).     &Apache::loncommon::lonhttpdurl('/res/adm/pages/'.$img).
    '" align="'.($nobreak==3?'right':'left').'" class="LC_noBorder" />';     '" align="'.($nobreak==3?'right':'left').'" class="LC_noBorder" />';
        if ($env{'browser.interface'} eq 'faketextual') {         if ($env{'browser.interface'} eq 'faketextual') {
 # Accessibility  # Main Menu
    if ($nobreak==3) {     if ($nobreak==3) {
        $inlineremote[$idx]="\n".         $inlineremote[$idx]="\n".
    '<td class="LC_menubuttons_text" align="right">'.$text.     '<td class="LC_menubuttons_text" align="right">'.$text.
Line 1154  sub secondlevel { Line 1087  sub secondlevel {
   
 sub openmenu {  sub openmenu {
     my $menuname = &get_menu_name();      my $menuname = &get_menu_name();
     if (($env{'browser.interface'} eq 'textual') ||      if ($env{'environment.remote'} eq 'off') { return ''; }
         ($env{'environment.remote'} eq 'off')) { return ''; }  
     my $nothing = &Apache::lonhtmlcommon::javascript_nothing();      my $nothing = &Apache::lonhtmlcommon::javascript_nothing();
     return "window.open(".$nothing.",'".$menuname."');";      return "window.open(".$nothing.",'".$menuname."');";
 }  }
Line 1171  sub inlinemenu { Line 1103  sub inlinemenu {
             foreach my $cat (keys(%category_members)) {              foreach my $cat (keys(%category_members)) {
                if ($category_positions{$cat} ne "$col,$row") { next; }                 if ($category_positions{$cat} ne "$col,$row") { next; }
                #$output.='<table><tr><td colspan="4" class="LC_menubuttons_category">'.&mt($category_names{$cat}).'</td></tr>';                 #$output.='<table><tr><td colspan="4" class="LC_menubuttons_category">'.&mt($category_names{$cat}).'</td></tr>';
                $output.='<div class="LC_ContentBoxSpecial">';                 $output.='<div class="LC_Box">';
        $output.='<h4 class="LC_hcell">'.&mt($category_names{$cat}).'</h4>';         $output.='<h4 class="LC_hcell">'.&mt($category_names{$cat}).'</h4>';
                $output.='<table>';                 $output.='<table>';
                my %active=();                 my %active=();
Line 1194  sub inlinemenu { Line 1126  sub inlinemenu {
 }  }
   
 sub rawconfig {  sub rawconfig {
   #
   # This evaluates mydesk.tab
   # Need to add more positions and more privileges to deal with all
   # menu items.
   #
     my $textualoverride=shift;      my $textualoverride=shift;
     my $output='';      my $output='';
     unless (($env{'browser.interface'} eq 'textual') ||      unless ($env{'environment.remote'} eq 'off') {
             ($env{'environment.remote'} eq 'off')) {  
        $output.=         $output.=
  "window.status='Opening Remote Control';var swmenu=".&openmenu().   "window.status='Opening Remote Control';var swmenu=".&openmenu().
 "\nwindow.status='Configuring Remote Control ';";  "\nwindow.status='Configuring Remote Control ';";
Line 1207  sub rawconfig { Line 1143  sub rawconfig {
     my $uname=$env{'user.name'};      my $uname=$env{'user.name'};
     my $udom=$env{'user.domain'};      my $udom=$env{'user.domain'};
     my $adv=$env{'user.adv'};      my $adv=$env{'user.adv'};
     my $show_course=&show_course();      my $show_course=&Apache::loncommon::show_course();
     my $author=$env{'user.author'};      my $author=$env{'user.author'};
     my $crs='';      my $crs='';
     if ($env{'request.course.id'}) {      if ($env{'request.course.id'}) {
Line 1229  sub rawconfig { Line 1165  sub rawconfig {
         $prt=~s/\$requested_domain/$requested_domain/g;          $prt=~s/\$requested_domain/$requested_domain/g;
         if ($category_names{$cat}!~/\w/) { $cat='oth'; }          if ($category_names{$cat}!~/\w/) { $cat='oth'; }
         my $type = &Apache::loncommon::course_type();          my $type = &Apache::loncommon::course_type();
         if ($type eq 'Group') {  #
             $desc = &convert_menu_function($desc,$type);  # I don't think we support this
         }  #
   #        if ($type eq 'Group') {
   #            $desc = &convert_menu_function($desc,$type);
   #        }
         if ($pro eq 'clear') {          if ($pro eq 'clear') {
     $output.=&clear($row,$col);      $output.=&clear($row,$col);
         } elsif ($pro eq 'any') {          } elsif ($pro eq 'any') {
Line 1330  sub rawconfig { Line 1269  sub rawconfig {
           $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);            $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
         }          }
     }      }
     unless (($env{'browser.interface'} eq 'textual') ||      unless ($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()) {          if (&Apache::lonmsg::newmail()) { 
    $output.='swmenu.setstatus("you have","messages");';     $output.='swmenu.setstatus("you have","messages");';
Line 1344  sub rawconfig { Line 1282  sub rawconfig {
 # ======================================================================= Close  # ======================================================================= Close
   
 sub close {  sub close {
     if (($env{'browser.interface'} eq 'textual') ||      if ($env{'environment.remote'} eq 'off') { return ''; }
         ($env{'environment.remote'} eq 'off')) { return ''; }  
     my $menuname = &get_menu_name();      my $menuname = &get_menu_name();
     return(<<ENDCLOSE);      return(<<ENDCLOSE);
 <script type="text/javascript">  <script type="text/javascript">
Line 1387  NAVCONTROL Line 1324  NAVCONTROL
   
 sub utilityfunctions {  sub utilityfunctions {
     my $caller = shift;      my $caller = shift;
     unless (($env{'browser.interface'} eq 'textual')  ||      unless ($env{'environment.remote'} eq 'off' || 
         ($env{'environment.remote'} eq 'off') || ($caller eq '/adm/menu')) { return ''; }              $caller eq '/adm/menu') { 
               return ''; }
               
     my $currenturl=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0]));      my $currenturl=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0]));
     $currenturl=&Apache::lonenc::check_encrypt(&unescape($currenturl));      $currenturl=&Apache::lonenc::check_encrypt(&unescape($currenturl));
           
Line 1601  sub get_nav_status { Line 1540  sub get_nav_status {
     return $navstatus;      return $navstatus;
 }  }
   
 #FIXME this needs to move into mydesktab and the other locations   #FIXME this needs to move into mydesk.tab and the other locations 
 # the text is generated  # the text is generated
 sub convert_menu_function {  #
     my ($rolename,$type) = @_;  # We currently do not support this anyway.
     if ($type eq 'Group') {  #
         $rolename =~ s/student/member/g;  #sub convert_menu_function {
         $rolename =~ s/group/team/g;  #    my ($rolename,$type) = @_;
         $rolename =~ s/course/group/g;  #    if ($type eq 'Group') {
         $rolename =~ s/Course/Group/g;  #        $rolename =~ s/student/member/g;
     }  #        $rolename =~ s/group/team/g;
     return $rolename;  #        $rolename =~ s/course/group/g;
 }  #        $rolename =~ s/Course/Group/g;
   #    }
   #    return $rolename;
   #}
   
 sub hidden_button_check {  sub hidden_button_check {
     my $hidden;      my $hidden;
Line 1644  sub roles_selector { Line 1586  sub roles_selector {
         }          }
     }      }
     if ($is_cc) {      if ($is_cc) {
         &get_all_courseroles($cdom,$cnum,\%courseroles,\%seccount);           &get_all_courseroles($cdom,$cnum,\%courseroles,\%seccount);
     } else {      } else {
         my %gotnosection;          my %gotnosection;
         foreach my $item (keys(%env)) {          foreach my $item (keys(%env)) {
Line 1662  sub roles_selector { Line 1604  sub roles_selector {
                 }                  }
                 if (ref($courseroles{$role}) eq 'ARRAY') {                  if (ref($courseroles{$role}) eq 'ARRAY') {
                     if ($sec ne '') {                      if ($sec ne '') {
                         if (!grep(/^Q$sec\E$/,@{$courseroles{$role}})) {                          if (!grep(/^\Q$sec\E$/,@{$courseroles{$role}})) {
                             push(@{$courseroles{$role}},$sec);                              push(@{$courseroles{$role}},$sec);
                             $seccount{$role} ++;                              $seccount{$role} ++;
                         }                          }
Line 1790  sub jump_to_role { Line 1732  sub jump_to_role {
                    '    numsec['.$i.'] = "'.$seccount->{$items[$i]}.'";'."\n";                     '    numsec['.$i.'] = "'.$seccount->{$items[$i]}.'";'."\n";
         }          }
     }      }
     my $output = <<"END";      return <<"END";
 <script type="text/javascript">  <script type="text/javascript">
   //<![CDATA[
 function adhocRole(roleitem) {  function adhocRole(roleitem) {
     $js      $js
     var newrole =  document.rolechooser.elements[roleitem].options[document.rolechooser.elements[roleitem].selectedIndex].value;      var newrole =  document.rolechooser.elements[roleitem].options[document.rolechooser.elements[roleitem].selectedIndex].value;
Line 1862  function retrieveIndex(item) { Line 1805  function retrieveIndex(item) {
     }      }
     return -1;      return -1;
 }  }
   // ]]>
   
 </script>  </script>
 END  END
     return $output;  
 }  }
   
   

Removed from v.1.263  
changed lines
  Added in v.1.274


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