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

version 1.273, 2009/07/09 19:28:36 version 1.274, 2009/07/11 19:58:29
Line 143  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
   # Probably should be in mydesk.tab
   
 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',
Line 163  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 179  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 187  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 194  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 453  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 481  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 539  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;
Line 548  sub innerregister { Line 575  sub innerregister {
                 $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 558  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 1005  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 1092  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{'environment.remote'} eq 'off') {      unless ($env{'environment.remote'} eq 'off') {
Line 1126  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 1498  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;

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


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