Diff for /loncom/interface/lonmenu.pm between versions 1.369.2.30 and 1.369.2.64

version 1.369.2.30, 2012/12/27 05:52:00 version 1.369.2.64, 2016/10/31 21:05:59
Line 106  secondary_menu(). Line 106  secondary_menu().
   
 =item primary_menu()  =item primary_menu()
   
 This routine evaluates @primary_menu and returns XHTML for the menu  This routine evaluates @primary_menu and returns a two item array, 
 that contains following links: About, Message, Roles, Help, Logout  with the array elements containing XHTML for the left and right sides of 
   the menu that contains the following links: About, Message, Roles, Help, Logout 
 @primary_menu is filled within the BEGIN block of this module with   @primary_menu is filled within the BEGIN block of this module with 
 entries from mydesk.tab   entries from mydesk.tab
   
 =item secondary_menu()  =item secondary_menu()
   
Line 123  dropdown list when mouse hovers over top Line 124  dropdown list when mouse hovers over top
 (no hover psuedo class) via LC_hoverable class for <li> tag for top-  (no hover psuedo class) via LC_hoverable class for <li> tag for top-
 level item, which employs jQuery to handle behavior on mouseover.  level item, which employs jQuery to handle behavior on mouseover.
   
 Inputs: 4 - (a) link and (b) target for anchor href in top level item,  Inputs: 6 - (a) link and (b) target for anchor href in top level item,
             (c) title for text wrapped by anchor tag in top level item.              (c) title for text wrapped by anchor tag in top level item.
             (d) reference to array of arrays of sub-menu items.              (d) reference to array of arrays of sub-menu items.
               (e) boolean to indicate whether to call &mt() to translate
                   name of menu item,
               (f) optional class for <li> element in primary menu, for which
                   sub menu is being generated.
   
   The underlying datastructure used in (d) contains data from mydesk.tab.
   It consists of an array which has an array for each item appearing in
   the menu (e.g. [["link", "title", "condition"]] for a single-item menu).
   create_submenu() supports also the creation of XHTML for nested dropdown
   menus represented by unordered lists. This is done by replacing the
   scalar used for the link with an arrayreference containing the menuitems
   for the nested menu. This can be done recursively so that the next menu
   may also contain nested submenus.
   
    Example:
    [                                                                                      # begin of datastructure
           ["/home/", "Home", "condition1"],               # 1st item of the 1st layer menu
           [                                                                               # 2nd item of the 1st layer menu
                   [                                                                       # anon. array for nested menu
                           ["/path1", "Path1", undef],     # 1st item of the 2nd layer menu
                           ["/path2", "Path2", undef],     # 2nd item of the 2nd layer menu
                           [                                                               # 3rd item of the 2nd layer menu
                                   [[...], [...], ..., [...]],     # containing another menu layer
                                   "Sub-Sub-Menu",                         # title for this container
                                   undef
                           ]
                   ],                                                                      # end of array/nested menu
                   "Sub-Menu",                                                     # title for the container item
                   undef
           ]                                                                               # end of 2nd item of the 1st layer menu
   ]
   
   
 =item innerregister()  =item innerregister()
   
Line 223  sub prep_menuitem { Line 256  sub prep_menuitem {
            . qq| href="$$menuitem[0]" target="_top">$link</a></li>|;             . qq| href="$$menuitem[0]" target="_top">$link</a></li>|;
 }  }
   
 # primary_menu() evaluates @primary_menu and returns XHTML for the menu  # primary_menu() evaluates @primary_menu and returns a two item array,
 # that contains following links:  # with the array elements containing XHTML for the left and right sides of 
 # About, Message, Personal, Roles, Help, Logout  # the menu that contains the following links:
   # Personal, About, Message, Roles, Help, Logout
 # @primary_menu is filled within the BEGIN block of this module with   # @primary_menu is filled within the BEGIN block of this module with 
 # entries from mydesk.tab  # entries from mydesk.tab
 sub primary_menu {  sub primary_menu {
     my $menu;      my %menu;
     # each element of @primary contains following array:      # each element of @primary contains following array:
     # (link url, icon path, alt text, link text, condition)      # (link url, icon path, alt text, link text, condition, position)
     my $public;      my $public;
     if ((($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public'))      if ((($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public'))
         || (($env{'user.name'} eq '') && ($env{'user.domain'} eq ''))) {          || (($env{'user.name'} eq '') && ($env{'user.domain'} eq ''))) {
Line 256  sub primary_menu { Line 290  sub primary_menu {
                 && !&Apache::loncommon::show_course(); ##                  && !&Apache::loncommon::show_course(); ##
                   
         my $title = $menuitem->[3];          my $title = $menuitem->[3];
           my $position = $menuitem->[5];
           if ($position eq '') {
               $position = 'right';
           }
         if (defined($primary_submenu{$title})) {          if (defined($primary_submenu{$title})) {
             my ($link,$target);              my ($link,$target);
             if ($menuitem->[0] ne '') {              if ($menuitem->[0] ne '') {
Line 268  sub primary_menu { Line 306  sub primary_menu {
             if (ref($primary_submenu{$title}) eq 'ARRAY') {              if (ref($primary_submenu{$title}) eq 'ARRAY') {
                 foreach my $item (@{$primary_submenu{$title}}) {                  foreach my $item (@{$primary_submenu{$title}}) {
                     next if (($item->[2] eq 'wishlist') && (!$env{'user.adv'}));                       next if (($item->[2] eq 'wishlist') && (!$env{'user.adv'})); 
                     next if (($item->[2] eq 'reqcrs') && (!&check_for_rcrs()));  
                     next if ((($item->[2] eq 'portfolio') ||                       next if ((($item->[2] eq 'portfolio') || 
                              ($item->[2] eq 'blog')) &&                                ($item->[2] eq 'blog')) && 
                              (!&Apache::lonnet::usertools_access('','',$item->[2],                               (!&Apache::lonnet::usertools_access('','',$item->[2],
Line 276  sub primary_menu { Line 313  sub primary_menu {
                     push(@primsub,$item);                      push(@primsub,$item);
                 }                  }
                 if (@primsub > 0) {                  if (@primsub > 0) {
                     $menu .= &create_submenu($link,$target,$title,\@primsub);                      if ($title eq 'Personal' && $env{'user.name'} && $env{'user.domain'} ) {
                           $title = &Apache::loncommon::plainname($env{'user.name'},$env{'user.domain'});
                       } else {
                           $title = &mt($title);
                       }
                       $menu{$position} .= &create_submenu($link,$target,$title,\@primsub,1);
                 } elsif ($link) {                  } elsif ($link) {
                     $menu .= '<li><a href="'.$link.'" target="'.$target.'">'.&mt($title).'</a></li>';                      $menu{$position} .= '<li><a href="'.$link.'" target="'.$target.'">'.&mt($title).'</a></li>';
                 }                  }
             }              }
         } elsif ($$menuitem[3] eq 'Help') { # special treatment for helplink          } elsif ($$menuitem[3] eq 'Help') { # special treatment for helplink
Line 289  sub primary_menu { Line 331  sub primary_menu {
                                                                   'helpdeskmail',                                                                    'helpdeskmail',
                                                                   $defdom,$origmail);                                                                    $defdom,$origmail);
                 if ($to ne '') {                  if ($to ne '') {
                     $menu .= &prep_menuitem($menuitem);                       $menu{$position} .= &prep_menuitem($menuitem); 
                 }                  }
             } else {              } else {
                 $menu .= '<li>'.&Apache::loncommon::top_nav_help('Help').'</li>';                  $menu{$position} .= '<li>'.&Apache::loncommon::top_nav_help('Help').'</li>';
             }              }
         } else {          } else {
             $menu .= prep_menuitem($menuitem);              $menu{$position} .= prep_menuitem($menuitem);
         }          }
     }      }
     $menu =~ s/\[domain\]/$env{'user.domain'}/g;      my @output = ('','');
     $menu =~ s/\[user\]/$env{'user.name'}/g;      if ($menu{'left'} ne '') {
           $output[0] = "<ol class=\"LC_primary_menu LC_floatleft\">$menu{'left'}</ol>";
     return "<ol class=\"LC_primary_menu LC_right\">$menu</ol>";      }
       if ($menu{'right'} ne '') {
           $output[1] = "<ol class=\"LC_primary_menu LC_floatright LC_right\">$menu{'right'}</ol>";
       }
       return @output;
 }  }
   
 #returns hashref {user=>'',dom=>''} containing:  #returns hashref {user=>'',dom=>''} containing:
Line 330  sub getauthor{ Line 376  sub getauthor{
 }  }
   
 sub secondary_menu {  sub secondary_menu {
       my ($httphost) = @_;
     my $menu;      my $menu;
   
     my $crstype = &Apache::loncommon::course_type();      my $crstype = &Apache::loncommon::course_type();
Line 338  sub secondary_menu { Line 385  sub secondary_menu {
                                                : '');                                                 : '');
     my $canedit       = &Apache::lonnet::allowed('mdc', $env{'request.course.id'});      my $canedit       = &Apache::lonnet::allowed('mdc', $env{'request.course.id'});
     my $canviewroster = $env{'course.'.$env{'request.course.id'}.'.student_classlist_view'};      my $canviewroster = $env{'course.'.$env{'request.course.id'}.'.student_classlist_view'};
       if ($canviewroster eq 'disabled') {
           undef($canviewroster);
       }
     my $canviewgrps   = &Apache::lonnet::allowed('vcg', $crs_sec);      my $canviewgrps   = &Apache::lonnet::allowed('vcg', $crs_sec);
     my $canmodifyuser = &Apache::lonnet::allowed('cst', $crs_sec);      my $canmodifyuser = &Apache::lonnet::allowed('cst', $crs_sec);
       my $canviewusers  = &Apache::lonnet::allowed('vcl', $crs_sec);
     my $canviewwnew   = &Apache::lonnet::allowed('whn', $crs_sec);      my $canviewwnew   = &Apache::lonnet::allowed('whn', $crs_sec);
       my $canviewpara   = &Apache::lonnet::allowed('vpa', $crs_sec);
     my $canmodpara    = &Apache::lonnet::allowed('opa', $crs_sec);      my $canmodpara    = &Apache::lonnet::allowed('opa', $crs_sec);
     my $canvgr        = &Apache::lonnet::allowed('vgr', $crs_sec);      my $canvgr        = &Apache::lonnet::allowed('vgr', $crs_sec);
     my $canmgr        = &Apache::lonnet::allowed('mgr', $crs_sec);      my $canmgr        = &Apache::lonnet::allowed('mgr', $crs_sec);
     my $author        = &getauthor();      my $author        = &getauthor();
   
       my ($cdom,$cnum,$showsyllabus,$showfeeds,$showresv);
       if ($env{'request.course.id'}) {
           $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
           $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
           unless ($canedit) {
               unless (&Apache::lonnet::is_on_map("public/$cdom/$cnum/syllabus")) {
                   if (($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'}) ||
                       ($env{'course.'.$env{'request.course.id'}.'.uploadedsyllabus'}) ||
                       ($env{'course.'.$env{'request.course.id'}.'.updatedsyllabus'}) ||
                       ($env{'request.course.syllabustime'})) {
                       $showsyllabus = 1;
                   }
               }
               if ($env{'request.course.feeds'}) {
                   $showfeeds = 1;
               }
           }
           unless (($canmgr) || ($canvgr)) {
               my %slots = &Apache::lonnet::get_course_slots($cnum,$cdom);
               if (keys(%slots) > 0) {
                   $showresv = 1;
               }
           }
       }
   
       my ($canmodifycoauthor);
       if ($env{'request.role'} eq "au./$env{'user.domain'}/") {
           my $extent = "$env{'user.domain'}/$env{'user.name'}";
           if ((&Apache::lonnet::allowed('cca',$extent)) ||
               (&Apache::lonnet::allowed('caa',$extent))) {
               $canmodifycoauthor = 1;
           }
       }
   
     my %groups = &Apache::lonnet::get_active_groups(      my %groups = &Apache::lonnet::get_active_groups(
                      $env{'user.domain'}, $env{'user.name'},                       $env{'user.domain'}, $env{'user.name'},
                      $env{'course.' . $env{'request.course.id'} . '.domain'},                       $env{'course.' . $env{'request.course.id'} . '.domain'},
Line 357  sub secondary_menu { Line 443  sub secondary_menu {
         # evaluate conditions           # evaluate conditions 
         next if    ref($menuitem)  ne 'ARRAY';          next if    ref($menuitem)  ne 'ARRAY';
         next if    $$menuitem[4]   ne 'always'          next if    $$menuitem[4]   ne 'always'
                 && $$menuitem[4]   ne 'author'                  && ($$menuitem[4]  ne 'author' && $$menuitem[4] ne 'cca')
                 && !$env{'request.course.id'};                  && !$env{'request.course.id'};
         next if    $$menuitem[4]   =~ /^mdc/          next if    $$menuitem[4]   =~ /^mdc/
                 && !$canedit;                  && !$canedit;
Line 369  sub secondary_menu { Line 455  sub secondary_menu {
                 && $canvgr;                  && $canvgr;
         next if    $$menuitem[4]  eq 'vgr'          next if    $$menuitem[4]  eq 'vgr'
                 && !$canvgr;                  && !$canvgr;
         next if    $$menuitem[4]   eq 'cst'          next if    $$menuitem[4]   eq 'viewusers'
                 && !$canmodifyuser;                  && !$canmodifyuser && !$canviewusers;
         next if    $$menuitem[4]   eq 'ncst'          next if    $$menuitem[4]   eq 'noviewusers'
                 && ($canmodifyuser || !$canviewroster);                  && ($canmodifyuser || $canviewusers || !$canviewroster);
         next if    $$menuitem[4]   eq 'mgr'          next if    $$menuitem[4]   eq 'mgr'
                 && !$canmgr;                  && !$canmgr;
         next if    $$menuitem[4]   eq 'nmgr'          next if    $$menuitem[4]   eq 'showresv'
                 && $canmgr;                  && !$showresv;
         next if    $$menuitem[4]   eq 'whn'          next if    $$menuitem[4]   eq 'whn'
                 && !$canviewwnew;                  && !$canviewwnew;
         next if    $$menuitem[4]   eq 'opa'          next if    $$menuitem[4]   eq 'params'
                 && !$canmodpara;                  && (!$canmodpara && !$canviewpara);
         next if    $$menuitem[4]   eq 'nvcg'          next if    $$menuitem[4]   eq 'nvcg'
                 && ($canviewgrps || !%groups);                  && ($canviewgrps || !%groups);
           next if    $$menuitem[4]   eq 'showsyllabus'
                   && !$showsyllabus;
           next if    $$menuitem[4]   eq 'showfeeds'
                   && !$showfeeds;
         next if    $$menuitem[4]    eq 'author'          next if    $$menuitem[4]    eq 'author'
                 && !$author;                  && !$author;
           next if    $$menuitem[4]    eq 'cca'
                   && !$canmodifycoauthor;
   
         my $title = $menuitem->[3];          my $title = $menuitem->[3];
         if (defined($secondary_submenu{$title})) {          if (defined($secondary_submenu{$title})) {
Line 395  sub secondary_menu { Line 487  sub secondary_menu {
             } else {              } else {
                 $link = '#';                  $link = '#';
             }              }
             my @scndsub;                 my @scndsub;
             if (ref($secondary_submenu{$title}) eq 'ARRAY') {              if (ref($secondary_submenu{$title}) eq 'ARRAY') {
                 foreach my $item (@{$secondary_submenu{$title}}) {                  foreach my $item (@{$secondary_submenu{$title}}) {
                     if (ref($item) eq 'ARRAY') {                      if (ref($item) eq 'ARRAY') {
                         next if ($item->[2] eq 'vgr' && !$canvgr);                          next if ($item->[2] eq 'vgr' && !$canvgr);
                         next if ($item->[2] eq 'opa' && !$canmodpara);                          next if ($item->[2] eq 'opa' && !$canmodpara);
                         next if ($item->[2] eq 'cst' && !$canmodifyuser);                          next if ($item->[2] eq 'vpa' && !$canviewpara);
                           next if ($item->[2] eq 'viewusers' && !($canmodifyuser || $canviewusers));
                         next if ($item->[2] eq 'mgr' && !$canmgr);                          next if ($item->[2] eq 'mgr' && !$canmgr);
                         next if ($item->[2] eq 'vcg' && !$canviewgrps);                          next if ($item->[2] eq 'vcg' && !$canviewgrps);
                           next if ($item->[2] eq 'mdc' && !$canedit);
                         push(@scndsub,$item);                           push(@scndsub,$item); 
                     }                      }
                 }                  }
                 if (@scndsub > 0) {                  if (@scndsub > 0) {
                     $menu .= &create_submenu($link,$target,$title,\@scndsub);                      $menu .= &create_submenu($link,$target,$title,\@scndsub,1);
                 } elsif ($link) {                  } elsif ($link ne '#') {
                     $menu .= '<li><a href="'.$link.'" target="'.$target.'">'.&mt($title).'</a></li>';                      $menu .= '<li><a href="'.$link.'" target="'.$target.'">'.&mt($title).'</a></li>';
                 }                  }
             }              }
Line 418  sub secondary_menu { Line 512  sub secondary_menu {
             ($roleswitcher_js,$roleswitcher_form,my $switcher) =              ($roleswitcher_js,$roleswitcher_form,my $switcher) =
                 &roles_selector(                  &roles_selector(
                         $env{'course.' . $env{'request.course.id'} . '.domain'},                          $env{'course.' . $env{'request.course.id'} . '.domain'},
                         $env{'course.' . $env{'request.course.id'} . '.num'}                          $env{'course.' . $env{'request.course.id'} . '.num'},
                           $httphost
                 );                  );
             $menu .= $switcher;              $menu .= $switcher;
         } else {          } else {
               if ($$menuitem[3] eq 'Syllabus' && $env{'request.course.id'}) {
                   my $url = $$menuitem[0];
                   $url =~ s{\[cdom\]/\[cnum\]}{$cdom/$cnum};
                   if (&Apache::lonnet::is_on_map($url)) {
                       unless ($$menuitem[0] =~ /\?register=1/) {
                           $$menuitem[0] .= '?register=1';
                       }
                   } else {
                       $$menuitem[0] =~ s{\?register=1}{};
                   }
               }
             $menu .= &prep_menuitem(\@$menuitem);              $menu .= &prep_menuitem(\@$menuitem);
         }          }
     }      }
Line 445  sub secondary_menu { Line 551  sub secondary_menu {
     }      }
     $menu =~ s/\[uname\]/$$author{user}/g;      $menu =~ s/\[uname\]/$$author{user}/g;
     $menu =~ s/\[udom\]/$$author{dom}/g;      $menu =~ s/\[udom\]/$$author{dom}/g;
       if ($env{'request.course.id'}) {  
           $menu =~ s/\[cnum\]/$cnum/g;
           $menu =~ s/\[cdom\]/$cdom/g;
       }
     if ($menu) {      if ($menu) {
         $menu = "<ul id=\"LC_secondary_menu\">$menu</ul>";          $menu = "<ul id=\"LC_secondary_menu\">$menu</ul>";
     }      }
Line 455  sub secondary_menu { Line 565  sub secondary_menu {
 }  }
   
 sub create_submenu {  sub create_submenu {
     my ($link,$target,$title,$submenu) = @_;      my ($link,$target,$title,$submenu,$translate,$addclass) = @_;
     return unless (ref($submenu) eq 'ARRAY');      return unless (ref($submenu) eq 'ARRAY');
     my $disptarget;      my $disptarget;
     if ($target ne '') {      if ($target ne '') {
         $disptarget = ' target="'.$target.'"';          $disptarget = ' target="'.$target.'"';
     }      }
     my $menu = '<li class="LC_hoverable">'.      my $menu = '<li class="LC_hoverable '.$addclass.'">'.
                '<a href="'.$link.'"'.$disptarget.'>'.                  '<a href="'.$link.'"'.$disptarget.'>'.
                '<span class="LC_nobreak">'.&mt($title).                 '<span class="LC_nobreak">'.$title.
                '<span class="LC_fontsize_small" style="font-weight:normal;">'.                 '<span class="LC_fontsize_small" style="font-weight:normal;">'.
                ' &#9660;</span></span></a>'.                 ' &#9660;</span></span></a>'.
                '<ul>';                 '<ul>';
   
       # $link and $title are only used in the initial string written in $menu
       # as seen above, not needed for nested submenus
       $menu .= &build_submenu($target, $submenu, $translate, '1');
       $menu .= '</ul></li>';
   
       return $menu;
   }
   
   # helper routine for create_submenu
   # build the dropdown (and nested submenus) recursively
   # see perldoc create_submenu documentation for further information
   sub build_submenu {
       my ($target, $submenu, $translate, $first_level) = @_;
       unless (@{$submenu}) {
           return '';
       }
   
       my $menu = '';
     my $count = 0;      my $count = 0;
     my $numsub = scalar(@{$submenu});      my $numsub = scalar(@{$submenu});
     foreach my $item (@{$submenu}) {      foreach my $item (@{$submenu}) {
         $count ++;          $count ++;
         if (ref($item) eq 'ARRAY') {          if (ref($item) eq 'ARRAY') {
               my $href = $item->[0];
               my $bordertop;
             my $borderbot;              my $borderbot;
               my $title;
   
               if ($translate) {
                    $title = &mt($item->[1]);
               } else {
                   $title = $item->[1];
               }
   
               if ($count == 1 && !$first_level) {
                   $bordertop = 'border-top: 1px solid black;';
               }
             if ($count == $numsub) {              if ($count == $numsub) {
                 $borderbot = 'border-bottom:1px solid black;';                  $borderbot = 'border-bottom: 1px solid black;';
               }
   
               # href is a reference to another submenu
               if (ref($href) eq 'ARRAY') {
                   $menu .= '<li style="margin:0;padding:0;'.$bordertop . $borderbot . '">';
                   $menu .= '<p><span class="LC_primary_menu_innertitle">'
                                           . $title . '</span><span class="LC_primary_menu_innerarrow">&#9654;</span></p>';
                   $menu .= '<ul>';
                   $menu .= &build_submenu($target, $href, $translate);
                   $menu .= '</ul>';
                   $menu .= '</li>';
               } else {    # href is the actual hyperlink and does not represent another submenu
                           # for the current menu title
                   if ($href =~ /(aboutme|rss\.html)$/) {
                       next unless (($env{'user.name'} ne '') && ($env{'user.domain'} ne ''));
                       $href =~ s/\[domain\]/$env{'user.domain'}/g;
                       $href =~ s/\[user\]/$env{'user.name'}/g;
                   }
                   unless (($href eq '') || ($href =~ /^\#/)) {
                       $target = ' target="_top"';
                   }
   
                   $menu .= '<li style="margin:0;padding:0;'. $bordertop . $borderbot .'">';
                   $menu .= '<a href="'.$href.'"'.$target.'>' .  $title . '</a>';
                   $menu .= '</li>';
             }              }
             $menu .= '<li style="margin:0;padding:0;'.  
                      $borderbot.'"><a href="'.$item->[0].'">'.  
                      &mt($item->[1]).'</a></li>';  
         }          }
     }      }
     $menu .= '</ul></li>';  
     return $menu;      return $menu;
 }  }
   
Line 514  sub registerurl { Line 677  sub registerurl {
 }  }
   
 sub innerregister {  sub innerregister {
     my ($forcereg,$bread_crumbs,$group) = @_;      my ($forcereg,$bread_crumbs,$group,$pagebuttonshide) = @_;
     my $const_space = ($env{'request.state'} eq 'construct');      my $const_space = ($env{'request.state'} eq 'construct');
     my $is_const_dir = 0;      my $is_const_dir = 0;
   
Line 566  sub innerregister { Line 729  sub innerregister {
                                                        && $maptitle ne 'default.sequence'                                                          && $maptitle ne 'default.sequence' 
                                                        && $maptitle ne $coursetitle);                                                         && $maptitle ne $coursetitle);
   
             push @crumbs, {text => $restitle, no_mt => 1} if $restitle;               push @crumbs, {text => $restitle, no_mt => 1} if $restitle;
               my @tools;
               if ($env{'request.filename'} =~ /\.page$/) {
                   my %breadcrumb_tools = &Apache::lonhtmlcommon::current_breadcrumb_tools();
                   if (ref($breadcrumb_tools{'tools'}) eq 'ARRAY') {
                       @tools = @{$breadcrumb_tools{'tools'}};
                   }
               }
             &Apache::lonhtmlcommon::clear_breadcrumbs();              &Apache::lonhtmlcommon::clear_breadcrumbs();
             &Apache::lonhtmlcommon::add_breadcrumb(@crumbs);              &Apache::lonhtmlcommon::add_breadcrumb(@crumbs);
               if (@tools) {
                   &Apache::lonhtmlcommon::add_breadcrumb_tool('tools',@tools);
               }
         } else {          } else {
             $resurl = $env{'request.noversionuri'};              $resurl = $env{'request.noversionuri'};
             my $courseurl = &Apache::lonnet::courseid_to_courseurl($env{'request.course.id'});              my $courseurl = &Apache::lonnet::courseid_to_courseurl($env{'request.course.id'});
Line 594  sub innerregister { Line 767  sub innerregister {
                         &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1);                          &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1);
                 }                  }
                 return $trail;                  return $trail;
               } elsif ($resurl =~ m{^\Q/uploaded$courseurl/portfolio/syllabus/}) {
                   &Apache::lonhtmlcommon::clear_breadcrumbs();
                   &prepare_functions('/public'.$courseurl."/syllabus",
                                      $forcereg,$group,undef,undef,1);
                   $title = &mt('Syllabus File');
                   my ($trail) =
                       &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1);
                   return $trail;
             }              }
             unless ($env{'request.state'} eq 'construct') {              unless ($env{'request.state'} eq 'construct') {
                 &Apache::lonhtmlcommon::clear_breadcrumbs();                  &Apache::lonhtmlcommon::clear_breadcrumbs();
Line 626  sub innerregister { Line 807  sub innerregister {
             $forceview,$editbutton);              $forceview,$editbutton);
         if (($resurl =~ m{^/adm/($match_domain)/($match_username)/aboutme$}) ||          if (($resurl =~ m{^/adm/($match_domain)/($match_username)/aboutme$}) ||
             ($env{'request.role'} !~/^(aa|ca|au)/)) {              ($env{'request.role'} !~/^(aa|ca|au)/)) {
               if (($env{'environment.remote'} eq 'on') && ($env{'request.symb'})) {
                   &Apache::lonhtmlcommon::clear_breadcrumbs();
               }
             $editbutton = &prepare_functions($resurl,$forcereg,$group);              $editbutton = &prepare_functions($resurl,$forcereg,$group);
         }          }
         if ($editbutton eq '') {          if ($editbutton eq '') {
Line 644  sub innerregister { Line 828  sub innerregister {
                 if ($env{'request.filename'}=~/$LONCAPA::assess_re/) {                  if ($env{'request.filename'}=~/$LONCAPA::assess_re/) {
                     push(@privs,('mgr','vgr'));                      push(@privs,('mgr','vgr'));
                 }                  }
                 push(@privs,'opa');                  push(@privs,('opa','vpa'));
             }              }
             foreach my $priv (@privs) {              foreach my $priv (@privs) {
                 $perms{$priv} = &Apache::lonnet::allowed($priv,$env{'request.course.id'});                  $perms{$priv} = &Apache::lonnet::allowed($priv,$env{'request.course.id'});
Line 670  sub innerregister { Line 854  sub innerregister {
                                        'Content Submissions');                                         'Content Submissions');
                 }                  }
             }              }
             if (($env{'request.symb'} ne '') && ($perms{'opa'})) {              if (($env{'request.symb'} ne '') && (($perms{'opa'}) || ($perms{'vpa'}))) {
                 $hwkadd .= &switch('','',7,3,'pparm.png','Content Settings',                  $hwkadd .= &switch('','',7,3,'pparm.png','Content Settings',
                                    'parms[_2]',"gocmd('/adm/parmset','set')",                                     'parms[_2]',"gocmd('/adm/parmset','set')",
                                    'Content Settings');                                     'Content Settings');
Line 708  sub innerregister { Line 892  sub innerregister {
             my $currdir = '/priv/'.$udom.'/'.$uname.'/'.$thisdisfn;              my $currdir = '/priv/'.$udom.'/'.$uname.'/'.$thisdisfn;
             if ($currdir =~ m-/$-) {              if ($currdir =~ m-/$-) {
                 $is_const_dir = 1;                  $is_const_dir = 1;
                   if ($thisdisfn eq '') {
                       $is_const_dir = 2;
                   }
             } else {              } else {
                 $currdir =~ s|[^/]+$||;                  $currdir =~ s|[^/]+$||;
  my $cleandisfn = &Apache::loncommon::escape_single($thisdisfn);   my $cleandisfn = &Apache::loncommon::escape_single($thisdisfn);
Line 755  ENDMENUITEMS Line 942  ENDMENUITEMS
                 # wishlist is only available for users with access to resource-pool                  # wishlist is only available for users with access to resource-pool
                 # and links can only be set for resources within the resource-pool                  # and links can only be set for resources within the resource-pool
                 $menuitems .= (<<ENDMENUITEMS);                  $menuitems .= (<<ENDMENUITEMS);
 s&9&1&alnk.png&$swtext{'alnk'}&linkstor[_1]&set_wishlistlink()&Save a link for this resource in your personal Stored Links repository&&1  s&9&1&alnk.png&$swtext{'alnk'}&linkstor[_1]&set_wishlistlink('',currentURL)&Save a link for this resource in my personal Stored Links repository&&1
 ENDMENUITEMS  ENDMENUITEMS
                 $got_wishlist = 1;                  $got_wishlist = 1;
             }              }
Line 771  if(length($annotation) > 0){ Line 958  if(length($annotation) > 0){
 }  }
 $menuitems.="&$swtext{'anot'}&tations[_1]&annotate()&";  $menuitems.="&$swtext{'anot'}&tations[_1]&annotate()&";
 $menuitems.="Make notes and annotations about this resource&&1\n";  $menuitems.="Make notes and annotations about this resource&&1\n";
   my $is_mobile;
   if ($env{'browser.mobile'}) {
       $is_mobile = 1;
   }
   
             unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme|viewclasslist|portfolio)(\?|$)/) {              unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme|viewclasslist|portfolio)(\?|$)/) {
  if ((!$env{'request.enc'}) && ($env{'request.noversionuri'} !~ m{^/adm/wrapper/ext/}) && ($env{'request.noversionuri'} !~ m{^/uploaded/$match_domain/$match_courseid/docs/})) {   if ((!$env{'request.enc'}) && ($env{'request.noversionuri'} !~ m{^/adm/wrapper/ext/}) && ($env{'request.noversionuri'} !~ m{^/uploaded/$match_domain/$match_courseid/docs/})) {
     $menuitems.=(<<ENDREALRES);      $menuitems.=(<<ENDREALRES);
 s&6&3&catalog.png&$swtext{'catalog'}&info[_1]&catalog_info()&Show Metadata  s&6&3&catalog.png&$swtext{'catalog'}&info[_1]&catalog_info('$is_mobile')&Show Metadata
 ENDREALRES  ENDREALRES
                 }                  }
                 unless ($env{'request.noversionuri'} =~ m{^/uploaded/$match_domain/$match_courseid/docs/}) {                  unless (($env{'request.noversionuri'} =~ m{^/uploaded/$match_domain/$match_courseid/docs/}) ||
                           ($env{'request.noversionuri'} =~ m{^\Q/adm/wrapper/\E(ext|uploaded)/})) { 
             $menuitems.=(<<ENDREALRES);              $menuitems.=(<<ENDREALRES);
 s&8&1&eval.png&$swtext{'eval'}&this[_1]&gopost('/adm/evaluate',currentURL,1)&Provide my evaluation of this resource  s&8&1&eval.png&$swtext{'eval'}&this[_1]&gopost('/adm/evaluate',currentURL,1)&Provide my evaluation of this resource
 ENDREALRES  ENDREALRES
                 }                  }
                 $menuitems.=(<<ENDREALRES);                  unless ($env{'request.noversionuri'} =~ m{^\Q/adm/wrapper/\E(ext|uploaded)/}) {
                       $menuitems.=(<<ENDREALRES);
 s&8&2&fdbk.png&$swtext{'fdbk'}&discuss[_1]&gopost('/adm/feedback',currentURL,1)&Provide feedback messages or contribute to the course discussion about this resource  s&8&2&fdbk.png&$swtext{'fdbk'}&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/) {   if ($env{'request.uri'} =~ /^\/res/) {
Line 799  ENDMENUITEMS Line 993  ENDMENUITEMS
                 if (($env{'user.adv'}) && (!$env{'request.enc'})) {                  if (($env{'user.adv'}) && (!$env{'request.enc'})) {
                     # wishlist is only available for users with access to resource-pool                      # wishlist is only available for users with access to resource-pool
                     $menuitems .= (<<ENDMENUITEMS);                      $menuitems .= (<<ENDMENUITEMS);
 s&9&1&alnk.png&$swtext{'alnk'}&linkstor[_1]&set_wishlistlink()&Save a link for this resource in your personal Stored Links repository&&1  s&9&1&alnk.png&$swtext{'alnk'}&linkstor[_1]&set_wishlistlink('',currentURL)&Save a link for this resource in your personal Stored Links repository&&1
 ENDMENUITEMS  ENDMENUITEMS
                     $got_wishlist = 1;                      $got_wishlist = 1;
                 }                  }
Line 837  ENDMENUITEMS Line 1031  ENDMENUITEMS
     my $addremote=0;      my $addremote=0;
     foreach (@inlineremote) { if ($_ ne '') { $addremote=1; last;} }      foreach (@inlineremote) { if ($_ ne '') { $addremote=1; last;} }
             if ($addremote) {              if ($addremote) {
                   my ($countdown,$buttonshide);
                   if ($env{'request.filename'} =~ /\.page$/) {
                       my %breadcrumb_tools = &Apache::lonhtmlcommon::current_breadcrumb_tools();
                       if (ref($breadcrumb_tools{'tools'}) eq 'ARRAY') {
                           $countdown = $breadcrumb_tools{'tools'}->[0];
                       }
                       $buttonshide = $pagebuttonshide;
                   } else {
                       $countdown = &countdown_timer();
                       $buttonshide = &hidden_button_check();
                   }
   
                 &Apache::lonhtmlcommon::clear_breadcrumb_tools();                  &Apache::lonhtmlcommon::clear_breadcrumb_tools();
   
                 &Apache::lonhtmlcommon::add_breadcrumb_tool(                  &Apache::lonhtmlcommon::add_breadcrumb_tool(
                     'navigation', @inlineremote[21,23]);                      'navigation', @inlineremote[21,23]);
   
                 my $countdown = &countdown_timer();                  if ($buttonshide eq 'yes') {
                 if (&hidden_button_check() eq 'yes') {  
                     if ($countdown) {                      if ($countdown) {
                         &Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$countdown);                          &Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$countdown);
                     }                      }
Line 867  ENDMENUITEMS Line 1071  ENDMENUITEMS
                     &advtools_crumbs(@inlineremote);                      &advtools_crumbs(@inlineremote);
                 }                  }
             }              }
               my ($topic_help,$topic_help_text);
               if ($is_const_dir == 2) {
                   if ((($ENV{'SERVER_PORT'} == 443) ||
                        ($Apache::lonnet::protocol{$Apache::lonnet::perlvar{'lonHostID'}} eq 'https')) &&
                        (&Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'},'webdav'))) {
                       $topic_help = 'Authoring_WebDAV,Authoring_WebDAV_Mac_10v6,Authoring_WebDAV_Mac_10v10,'.
                                    'Authoring_WebDAV_Windows_v7,Authoring_WebDAV_Linux_Centos';
                       $topic_help_text = 'About WebDAV access';
                   }
               }
             return   &Apache::lonhtmlcommon::scripttag('', 'start')              return   &Apache::lonhtmlcommon::scripttag('', 'start')
                    . &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0)                     . &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'','','','',$topic_help,$topic_help_text)
                    . &Apache::lonhtmlcommon::scripttag('', 'end');                     . &Apache::lonhtmlcommon::scripttag('', 'end');
   
         } else {          } else {
Line 1197  sub get_editbutton { Line 1411  sub get_editbutton {
         $folderpath = &escape(&HTML::Entities::encode(&escape($folderpath),'<>&"'));          $folderpath = &escape(&HTML::Entities::encode(&escape($folderpath),'<>&"'));
         $jscall = "go('/adm/coursedocs?folderpath=$folderpath$command')";          $jscall = "go('/adm/coursedocs?folderpath=$folderpath$command')";
     } else {      } else {
           my $suppanchor;
           if ($env{'form.folderpath'}) {
               $suppanchor = $env{'form.anchor'};
           }
         $jscall = &Apache::lonhtmlcommon::jump_to_editres($cfile,$home,$switchserver,          $jscall = &Apache::lonhtmlcommon::jump_to_editres($cfile,$home,$switchserver,
                                                 $forceedit,$forcereg,$env{'request.symb'},                                                  $forceedit,$forcereg,$env{'request.symb'},
                                                 &escape($env{'form.folderpath'}),                                                  &escape($env{'form.folderpath'}),
                                                 &escape($env{'form.title'}),$env{'form.idx'},                                                  &escape($env{'form.title'}),$env{'form.idx'},
                                                 &escape($env{'form.suppurl'},$env{'form.todocs'}));                                                  &escape($env{'form.suppurl'}),$env{'form.todocs'},
                                                   $suppanchor);
     }      }
     if ($jscall) {      if ($jscall) {
         my $icon = 'pcstr.png';          my $icon = 'pcstr.png';
Line 1210  sub get_editbutton { Line 1429  sub get_editbutton {
             $icon = 'tolastloc.png';              $icon = 'tolastloc.png';
             $label = 'Exit Editing';              $label = 'Exit Editing';
         }          }
         &switch('','',6,1,$icon,$label,'resource[_2]',          my $infunc = 1;
                 $jscall,"Edit this resource");          my $clearbutton;
         return 1;          if ($env{'environment.remote'} eq 'on') {
               if ($cfile =~ m{^/priv/}) {
                   undef($infunc);
                   $label = 'edit';
               } else {
                   $clearbutton = 1;
               }
           }
           my $editor = &switch('','',6,1,$icon,$label,'resource[_2]',
                                $jscall,"Edit this resource",'','',$infunc);
           if ($infunc) {
               return 1;
           } elsif ($clearbutton) {
               return &clear(6,1);
           } else {
               return $editor;
           }
     }      }
     return;      return;
 }  }
   
 sub prepare_functions {  sub prepare_functions {
     my ($resurl,$forcereg,$group,$bread_crumbs,$advtools,$docscrumbs) = @_;      my ($resurl,$forcereg,$group,$bread_crumbs,$advtools,$docscrumbs,$forbodytag) = @_;
     unless ($env{'request.registered'}) {      unless ($env{'request.registered'}) {
         undef(@inlineremote);          undef(@inlineremote);
     }      }
Line 1263  sub prepare_functions { Line 1498  sub prepare_functions {
 #  #
 # This applies in course context  # This applies in course context
 #  #
         if (($resurl eq "/public/$cdom/$cnum/syllabus") && ($perms{'mdc'})) {          if (($perms{'mdc'}) &&
             if ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ /\w/) {              (($resurl eq "/public/$cdom/$cnum/syllabus") ||
                 &switch('','',6,1,'pcstr.png','Edit',              ($resurl =~ m{^/uploaded/$cdom/$cnum/portfolio/syllabus/}))) {
                         'resource[_2]',              $cfile = $resurl;
                         "go('/adm/courseprefs?phase=display&actions=courseinfo')",              $home = &Apache::lonnet::homeserver($cnum,$cdom);
                         'Edit this resource');              if ($env{'form.forceedit'}) {
                 $editbutton = 1;                  $forceview = 1;
             } else {              } else {
                 $cfile = $resurl;                  $forceedit = 1;
                 $home = &Apache::lonnet::homeserver($cnum,$cdom);  
                 if ($env{'form.forceedit'}) {  
                     $forceview = 1;  
                 } else {  
                     $forceedit = 1;  
                 }  
                 $editbutton = &get_editbutton($cfile,$home,$switchserver,  
                                               $forceedit,$forceview,$forcereg);  
             }              }
               $editbutton = &get_editbutton($cfile,$home,$switchserver,
                                             $forceedit,$forceview,$forcereg);
         } elsif (($resurl eq '/adm/extresedit') &&          } elsif (($resurl eq '/adm/extresedit') &&
                  (($env{'form.symb'}) || ($env{'form.folderpath'}))) {                   (($env{'form.symb'}) || ($env{'form.folderpath'}))) {
             ($cfile,$home,$switchserver,$forceedit,$forceview) =              ($cfile,$home,$switchserver,$forceedit,$forceview) =
Line 1291  sub prepare_functions { Line 1520  sub prepare_functions {
                                               $forceedit,$forceview,$forcereg,                                                $forceedit,$forceview,$forcereg,
                                               $env{'form.title'},$env{'form.suppurl'});                                                $env{'form.title'},$env{'form.suppurl'});
             }              }
         } elsif ($resurl !~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) {          } elsif (($resurl =~ m{^/?adm/viewclasslist$}) &&
                    (&Apache::lonnet::allowed('opa',$env{'request.course.id'}))) {
               ($cfile,$home,$switchserver,$forceedit,$forceview) =
               &Apache::lonnet::can_edit_resource($resurl,$cnum,$cdom,$resurl,
                                                  $env{'form.symb'});
               $editbutton = &get_editbutton($cfile,$home,$switchserver,
                                             $forceedit,$forceview,$forcereg);
           } elsif (($resurl !~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) &&
                    ($resurl ne '/cgi-bin/printout.pl')) {
             if ($env{'request.filename'}) {              if ($env{'request.filename'}) {
                 my $file=&Apache::lonnet::declutter($env{'request.filename'});                  my $file=&Apache::lonnet::declutter($env{'request.filename'});
                 ($cfile,$home,$switchserver,$forceedit,$forceview) =                  ($cfile,$home,$switchserver,$forceedit,$forceview) =
Line 1313  sub prepare_functions { Line 1550  sub prepare_functions {
             unless (&Apache::lonnet::is_course($sdom,$sname)) {              unless (&Apache::lonnet::is_course($sdom,$sname)) {
                 &switch('','',6,4,'mail-message-new-22x22.png','Message to user',                  &switch('','',6,4,'mail-message-new-22x22.png','Message to user',
                         '',                          '',
                         "go('/adm/email?compose=individual&recname=$sname&recdom=$sdom')",                          "go('/adm/email?compose=individual&amp;recname=$sname&amp;recdom=$sdom')",
                             'Send message to specific user');                              'Send message to specific user','','',1);
             }              }
             my $hideprivileged = 1;              my $hideprivileged = 1;
             if (&Apache::lonnet::in_course($sdom,$sname,$cdom,$cnum,undef,              if (&Apache::lonnet::in_course($sdom,$sname,$cdom,$cnum,undef,
Line 1330  sub prepare_functions { Line 1567  sub prepare_functions {
                     &switch('','',6,5,'trck-22x22.png','Activity',                      &switch('','',6,5,'trck-22x22.png','Activity',
                             '',                              '',
                             "go('/adm/trackstudent?selected_student=$sname:$sdom')",                              "go('/adm/trackstudent?selected_student=$sname:$sdom')",
                             'View recent activity by this person');                              'View recent activity by this person','','',1);
                 }                  }
                 if ($perms{'vgr'}) {                  if ($perms{'vgr'}) {
                     &switch('','',6,6,'rsrv-22x22.png','Reservations',                      &switch('','',6,6,'rsrv-22x22.png','Reservations',
                             '',                              '',
                             "go('/adm/slotrequest?command=showresv&origin=aboutme&uname=$sname&udom=$sdom')",                              "go('/adm/slotrequest?command=showresv&amp;origin=aboutme&amp;uname=$sname&amp;udom=$sdom')",
                             'Slot reservation history');                              'Slot reservation history','','',1);
                 }                  }
                 if ($perms{'srm'}) {                  if ($perms{'srm'}) {
                     &switch('','',6,7,'contact-new-22x22.png','Records',                      &switch('','',6,7,'contact-new-22x22.png','Records',
                             '',                              '',
                             "go('/adm/email?recordftf=retrieve&recname=$sname&recdom=$sdom')",                              "go('/adm/email?recordftf=retrieve&amp;recname=$sname&amp;recdom=$sdom')",
                             'Add records');                              'Add records','','',1);
                 }                  }
             }              }
         } elsif ($resurl =~ m{^/?adm/viewclasslist}) {  
 # This applies to viewclasslist page for users in a course  
             if (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) {  
                 &switch('','',6,4,'pparm.png','Settings',  
                         '',  
                         "go('/adm/courseprefs?actions=classlists&phase=display')",  
                         'Student-viewable classlist options');  
             }  
         }          }
         if (($env{'form.folderpath'} =~ /^supplemental/) &&          if (($env{'form.folderpath'} =~ /^supplemental/) &&
             (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) &&              (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) &&
Line 1363  sub prepare_functions { Line 1592  sub prepare_functions {
              ($resurl =~ m{^/adm/$match_domain/$match_username/aboutme$}))) {               ($resurl =~ m{^/adm/$match_domain/$match_username/aboutme$}))) {
             my @folders=split('&',$env{'form.folderpath'});              my @folders=split('&',$env{'form.folderpath'});
             if ((@folders > 2) || ($resurl ne '/adm/supplemental')) {              if ((@folders > 2) || ($resurl ne '/adm/supplemental')) {
                   my $suppanchor;
                   if ($resurl =~ m{^/adm/wrapper/ext/}) {
                       $suppanchor = $env{'form.anchor'};
                   }
                 my $esc_path=&escape(&HTML::Entities::encode(&escape($env{'form.folderpath'}),'<>&"'));                  my $esc_path=&escape(&HTML::Entities::encode(&escape($env{'form.folderpath'}),'<>&"'));
                 &switch('','',7,4,'docs-22x22.png','Edit Folder','parms[_2]',                  &switch('','',7,4,'docs-22x22.png','Edit Folder','parms[_2]',
                         "location.href='/adm/coursedocs?command=direct&forcesupplement=1&supppath=$esc_path'",                          "location.href='/adm/coursedocs?command=direct&amp;forcesupplement=1&amp;supppath=$esc_path&amp;anchor=$suppanchor'",
                         'Folder/Page Content');                          'Folder/Page Content','','',1);
             }              }
         }          }
     }      }
Line 1376  sub prepare_functions { Line 1609  sub prepare_functions {
         &Apache::lonhtmlcommon::clear_breadcrumb_tools();          &Apache::lonhtmlcommon::clear_breadcrumb_tools();
         &advtools_crumbs(@inlineremote);          &advtools_crumbs(@inlineremote);
         return $editbutton;          return $editbutton;
     } elsif ($env{'request.registered'}) {      } elsif (($env{'request.registered'}) && (!ref($forbodytag))) {
         return $editbutton;          return $editbutton;
     } else {      } else {
         if (ref($bread_crumbs) eq 'ARRAY') {          if (ref($bread_crumbs) eq 'ARRAY') {
Line 1389  sub prepare_functions { Line 1622  sub prepare_functions {
         } elsif (@inlineremote > 0) {          } elsif (@inlineremote > 0) {
             &Apache::lonhtmlcommon::clear_breadcrumb_tools();              &Apache::lonhtmlcommon::clear_breadcrumb_tools();
             &advtools_crumbs(@inlineremote);              &advtools_crumbs(@inlineremote);
             return   &Apache::lonhtmlcommon::scripttag('', 'start')              if (ref($forbodytag)) {
                    . &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0)                  $$forbodytag =
                    . &Apache::lonhtmlcommon::scripttag('', 'end');                      &Apache::lonhtmlcommon::scripttag('', 'start')
                      .&Apache::lonhtmlcommon::breadcrumbs(undef,undef,0)
                      .&Apache::lonhtmlcommon::scripttag('', 'end');
               }
               return;
         }          }
     }      }
 }  }
Line 1406  sub advtools_crumbs { Line 1643  sub advtools_crumbs {
             'advtools', @funcs[61,71,72,73,74,92]);              'advtools', @funcs[61,71,72,73,74,92]);
     } elsif ($env{'request.noversionuri'} eq '/adm/viewclasslist') {      } elsif ($env{'request.noversionuri'} eq '/adm/viewclasslist') {
         &Apache::lonhtmlcommon::add_breadcrumb_tool(          &Apache::lonhtmlcommon::add_breadcrumb_tool(
             'advtools', @funcs[64]);              'advtools', $funcs[61]);
     }      }
 }  }
   
Line 1428  sub clear { Line 1665  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,$cat,$nobreak)=@_;      my ($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat,$nobreak,$infunc)=@_;
     $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 1437  sub switch { Line 1674  sub switch {
     my $idx=10*$row+$col;      my $idx=10*$row+$col;
     $category_members{$cat}.=':'.$idx;      $category_members{$cat}.=':'.$idx;
   
     if ($env{'environment.remote'} eq 'on') {      if (($env{'environment.remote'} eq 'on') && (!$infunc)) {
         if (($row<1) || ($row>13)) { return ''; }          if (($row<1) || ($row>13)) { return ''; }
         if ($env{'request.state'} eq 'construct') {          if ($env{'request.state'} eq 'construct') {
             my $text = $top.' '.$bot;              my $text = $top.' '.$bot;
Line 1590  sub rawconfig { Line 1827  sub rawconfig {
     my $pub=($env{'request.state'} eq 'published');      my $pub=($env{'request.state'} eq 'published');
     my $con=($env{'request.state'} eq 'construct');      my $con=($env{'request.state'} eq 'construct');
     my $rol=$env{'request.role'};      my $rol=$env{'request.role'};
     my $requested_domain = $env{'request.role.domain'};      my $requested_domain;
       if ($rol) {
          $requested_domain = $env{'request.role.domain'};
       }
     foreach my $line (@desklines) {      foreach my $line (@desklines) {
         my ($row,$col,$pro,$prt,$img,$top,$bot,$act,$desc,$cat)=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;
Line 1604  sub rawconfig { Line 1844  sub rawconfig {
             next if ($crstype ne 'Community');              next if ($crstype ne 'Community');
             $prt=~s/\$cmty/$crs/g;              $prt=~s/\$cmty/$crs/g;
         }          }
         $prt=~s/\$requested_domain/$requested_domain/g;          if ($prt =~ m/\$requested_domain/) {
               if ((!$requested_domain) && ($pro eq 'pbre') && ($env{'user.adv'})) {
                   $prt=~s/\$requested_domain/$env{'user.domain'}/g;
               } else {
                   $prt=~s/\$requested_domain/$requested_domain/g;
               }
           }
         if ($category_names{$cat}!~/\w/) { $cat='oth'; }          if ($category_names{$cat}!~/\w/) { $cat='oth'; }
         if ($pro eq 'clear') {          if ($pro eq 'clear') {
     $output.=&clear($row,$col);      $output.=&clear($row,$col);
Line 1640  sub rawconfig { Line 1886  sub rawconfig {
                     next;                      next;
                 }                  }
             }              }
     if (&Apache::lonnet::allowed($priv,$prt)) {              if ((($priv eq 'bre') && (&Apache::lonnet::allowed($priv,$prt) eq 'F')) ||
                $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);                  (($priv ne 'bre') && (&Apache::lonnet::allowed($priv,$prt)))) {
                   $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'}) && ($crstype ne 'Community')) {              if (($env{'request.course.fn'}) && ($crstype ne 'Community')) {
Line 1757  sub rawconfig { Line 2004  sub rawconfig {
   
 sub check_for_rcrs {  sub check_for_rcrs {
     my $showreqcrs = 0;      my $showreqcrs = 0;
     my @reqtypes = ('official','unofficial','community');      my @reqtypes = ('official','unofficial','community','textbook');
     foreach my $type (@reqtypes) {      foreach my $type (@reqtypes) {
         if (&Apache::lonnet::usertools_access($env{'user.name'},          if (&Apache::lonnet::usertools_access($env{'user.name'},
                                               $env{'user.domain'},                                                $env{'user.domain'},
Line 1846  END Line 2093  END
 }  }
   
 sub utilityfunctions {  sub utilityfunctions {
       my ($httphost) = @_;
     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]));
     if ($currenturl =~ m{^/adm/wrapper/ext/}      if ($currenturl =~ m{^/adm/wrapper/ext/}
         && $env{'request.external.querystring'} ) {          && $env{'request.external.querystring'} ) {
Line 1880  sub utilityfunctions { Line 2128  sub utilityfunctions {
   
     my $countdown = &countdown_toggle_js();      my $countdown = &countdown_toggle_js();
   
 return (<<ENDUTILITY)      my $hostvar = '
   function setLCHost() {
       var lcHostname="";
   ';
       if ($httphost =~ m{^https?\://}) {
           $hostvar .= '    var lcServer="'.$httphost.'";'."\n".
                       '    var hostReg = /^https?:\/\/([^\/]+)$/i;'."\n".
                       '    var match = hostReg.exec(lcServer);'."\n".
                       '    if (match.length) {'."\n".
                       '        if (match[1] == location.hostname) {'."\n".
                       '            lcHostname=lcServer;'."\n".
                       '        }'."\n".
                       '    }'."\n";
       }
   
       $hostvar .= '    return lcHostname;'."\n".
   '}'."\n";
   
   return (<<ENDUTILITY)
       $hostvar
     var currentURL=unescape("$esc_url");      var currentURL=unescape("$esc_url");
     var reloadURL=unescape("$esc_url");      var reloadURL=unescape("$esc_url");
     var currentSymb=unescape("$esc_symb");      var currentSymb=unescape("$esc_symb");
Line 1892  function go(url) { Line 2158  function go(url) {
    if (url!='' && url!= null) {     if (url!='' && url!= null) {
        currentURL = null;         currentURL = null;
        currentSymb= null;         currentSymb= null;
        window.location.href=url;         var lcHostname = setLCHost();
          window.location.href=lcHostname+url;
    }     }
 }  }
   
Line 1900  $jumptores Line 2167  $jumptores
   
 function gopost(url,postdata) {  function gopost(url,postdata) {
    if (url!='') {     if (url!='') {
       this.document.server.action=url;        var lcHostname = setLCHost();
         this.document.server.action=lcHostname+url;
       this.document.server.postdata.value=postdata;        this.document.server.postdata.value=postdata;
       this.document.server.command.value='';        this.document.server.command.value='';
       this.document.server.url.value='';        this.document.server.url.value='';
Line 1911  function gopost(url,postdata) { Line 2179  function gopost(url,postdata) {
   
 function gocmd(url,cmd) {  function gocmd(url,cmd) {
    if (url!='') {     if (url!='') {
       this.document.server.action=url;        var lcHostname = setLCHost();
         this.document.server.action=lcHostname+url;
       this.document.server.postdata.value='';        this.document.server.postdata.value='';
       this.document.server.command.value=cmd;        this.document.server.command.value=cmd;
       this.document.server.url.value=currentURL;        this.document.server.url.value=currentURL;
Line 1963  function golist(url) { Line 2232  function golist(url) {
    if (url!='' && url!= null) {     if (url!='' && url!= null) {
        currentURL = null;         currentURL = null;
        currentSymb= null;         currentSymb= null;
        top.location.href=url;         var lcHostname = setLCHost();
          top.location.href=lcHostname+url;
    }     }
 }  }
   
   
   
 function catalog_info() {  function catalog_info(isMobile) {
    openMyModal(window.location.pathname+'.meta',500,400,'yes');      if (isMobile == 1) {
           openMyModal(window.location.pathname+'.meta?modal=1',500,400,'yes');
       } else {
           loncatinfo=window.open(window.location.pathname+'.meta',"LONcatInfo",'height=500,width=400,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no');
       }
 }  }
   
 function chat_win() {  function chat_win() {
    lonchat=window.open('/res/adm/pages/chatroom.html',"LONchat",'height=320,width=480,resizable=yes,location=no,menubar=no,toolbar=no');     var lcHostname = setLCHost();
      lonchat=window.open(lcHostname+'/res/adm/pages/chatroom.html',"LONchat",'height=320,width=480,resizable=yes,location=no,menubar=no,toolbar=no');
 }  }
   
 function group_chat(group) {  function group_chat(group) {
    var url = '/adm/groupchat?group='+group;     var lcHostname = setLCHost();
      var url = lcHostname+'/adm/groupchat?group='+group;
    var winName = 'LONchat_'+group;     var winName = 'LONchat_'+group;
    grpchat=window.open(url,winName,'height=320,width=280,resizable=yes,location=no,menubar=no,toolbar=no');     grpchat=window.open(url,winName,'height=320,width=280,resizable=yes,location=no,menubar=no,toolbar=no');
 }  }
Line 1998  function annotate() { Line 2274  function annotate() {
   
 function open_StoredLinks_Import(rat) {  function open_StoredLinks_Import(rat) {
    var newWin;     var newWin;
      var lcHostname = setLCHost();
    if (rat) {     if (rat) {
        newWin = window.open('/adm/wishlist?inhibitmenu=yes&mode=import&rat='+rat,         newWin = window.open(lcHostname+'/adm/wishlist?inhibitmenu=yes&mode=import&rat='+rat,
                             'wishlistImport','scrollbars=1,resizable=1,menubar=0');                              'wishlistImport','scrollbars=1,resizable=1,menubar=0');
    }     }
    else {     else {
        newWin = window.open('/adm/wishlist?inhibitmenu=yes&mode=import',         newWin = window.open(lcHostname+'/adm/wishlist?inhibitmenu=yes&mode=import',
                             'wishlistImport','scrollbars=1,resizable=1,menubar=0');                              'wishlistImport','scrollbars=1,resizable=1,menubar=0');
    }     }
    newWin.focus();     newWin.focus();
Line 2078  sub hidden_button_check { Line 2355  sub hidden_button_check {
 }  }
   
 sub roles_selector {  sub roles_selector {
     my ($cdom,$cnum) = @_;      my ($cdom,$cnum,$httphost) = @_;
     my $crstype = &Apache::loncommon::course_type();      my $crstype = &Apache::loncommon::course_type();
     my $now = time;      my $now = time;
     my (%courseroles,%seccount,%courseprivs);      my (%courseroles,%seccount,%courseprivs);
     my $is_cc;      my $is_cc;
     my ($js,$form,$switcher,$switchtext);      my ($js,$form,$switcher);
     my $ccrole;      my $ccrole;
     if ($crstype eq 'Community') {      if ($crstype eq 'Community') {
         $ccrole = 'co';          $ccrole = 'co';
     } else {      } else {
         $ccrole = 'cc';          $ccrole = 'cc';
     }      }
     my ($priv,$gotsymb,$destsymb);      my ($privref,$gotsymb,$destsymb);
     my $destinationurl = $ENV{'REQUEST_URI'};      my $destinationurl = $ENV{'REQUEST_URI'};
     if ($destinationurl =~ /\?symb=/) {      if ($destinationurl =~ /\?symb=/) {
         $gotsymb = 1;          $gotsymb = 1;
Line 2111  sub roles_selector { Line 2388  sub roles_selector {
         my $destination = $destinationurl;          my $destination = $destinationurl;
         $destination =~ s/(\?.*)$//;          $destination =~ s/(\?.*)$//;
         if (exists($reqprivs->{$destination})) {          if (exists($reqprivs->{$destination})) {
             $priv = $reqprivs->{$destination};              if ($reqprivs->{$destination} =~ /,/) {
                   @{$privref} = split(/,/,$reqprivs->{$destination});
               } else {
                   $privref = [$reqprivs->{$destination}];
               }
         }          }
     }      }
     if ($env{'user.role.'.$ccrole.'./'.$cdom.'/'.$cnum}) {      if ($env{'user.role.'.$ccrole.'./'.$cdom.'/'.$cnum}) {
         my ($start,$end) = split(/\./,$env{'user.role.'.$ccrole.'./'.$cdom.'/'.$cnum});          my ($start,$end) = split(/\./,$env{'user.role.'.$ccrole.'./'.$cdom.'/'.$cnum});
           
         if ((($start) && ($start<0)) ||           if ((($start) && ($start<0)) || 
             (($end) && ($end<$now))  ||              (($end) && ($end<$now))  ||
             (($start) && ($now<$start))) {              (($start) && ($now<$start))) {
Line 2126  sub roles_selector { Line 2406  sub roles_selector {
         }          }
     }      }
     if ($is_cc) {      if ($is_cc) {
         &get_all_courseroles($cdom,$cnum,\%courseroles,\%seccount,\%courseprivs,$priv);          &get_all_courseroles($cdom,$cnum,\%courseroles,\%seccount,\%courseprivs);
       } elsif ($env{'request.role'} =~ m{^\Qcr/$cdom/$cdom-domainconfig/\E(\w+)\.\Q/$cdom/$cnum\E}) {
           &get_customadhoc_roles($cdom,$cnum,\%courseroles,\%seccount,\%courseprivs,$privref);
     } else {      } else {
         my %gotnosection;          my %gotnosection;
         foreach my $item (keys(%env)) {          foreach my $item (keys(%env)) {
Line 2142  sub roles_selector { Line 2424  sub roles_selector {
                         $gotnosection{$role} = 1;                          $gotnosection{$role} = 1;
                     }                      }
                 }                  }
                 if ($priv ne '') {                  if ((ref($privref) eq 'ARRAY') && (@{$privref} > 0)) {
                     my $cnumsec = $cnum;                      my $cnumsec = $cnum;
                     if ($sec ne '') {                      if ($sec ne '') {
                         $cnumsec .= "/$sec";                          $cnumsec .= "/$sec";
Line 2171  sub roles_selector { Line 2453  sub roles_selector {
             }              }
         }          }
     }      }
     my $switchtext;  
     if ($crstype eq 'Community') {  
         $switchtext = &mt('Switch community role')  
     } else {  
         $switchtext = &mt('Switch course role')  
     }  
     my @roles_order = ($ccrole,'in','ta','ep','ad','st');      my @roles_order = ($ccrole,'in','ta','ep','ad','st');
     my $numdiffsec;      my $numdiffsec;
     if (keys(%seccount) == 1) {      if (keys(%seccount) == 1) {
Line 2186  sub roles_selector { Line 2462  sub roles_selector {
     }      }
     if ((keys(%seccount) > 1) || ($numdiffsec > 1)) {      if ((keys(%seccount) > 1) || ($numdiffsec > 1)) {
         my @submenu;          my @submenu;
         $js = &jump_to_role($cdom,$cnum,\%seccount,\%courseroles,\%courseprivs,$priv);          $js = &jump_to_role($cdom,$cnum,\%seccount,\%courseroles,\%courseprivs,$privref);
         $form =           $form = 
             '<form name="rolechooser" method="post" action="/adm/roles">'."\n".              '<form name="rolechooser" method="post" action="'.$httphost.'/adm/roles">'."\n".
             '  <input type="hidden" name="destinationurl" value="'.              '  <input type="hidden" name="destinationurl" value="'.
             &HTML::Entities::encode($destinationurl).'" />'."\n".              &HTML::Entities::encode($destinationurl).'" />'."\n".
             '  <input type="hidden" name="gotorole" value="1" />'."\n".              '  <input type="hidden" name="gotorole" value="1" />'."\n".
Line 2232  sub roles_selector { Line 2508  sub roles_selector {
             }              }
         }          }
         if (@submenu > 0) {          if (@submenu > 0) {
             $switcher = &create_submenu('','',$switchtext,\@submenu);              $switcher = &create_submenu('','',&mt('Switch role'),\@submenu);
         }          }
     }      }
     return ($js,$form,$switcher);      return ($js,$form,$switcher);
Line 2298  sub get_all_courseroles { Line 2574  sub get_all_courseroles {
         push(@{$courseroles->{'st'}},keys(%sections_count));          push(@{$courseroles->{'st'}},keys(%sections_count));
         $seccount->{'st'} = scalar(keys(%sections_count));          $seccount->{'st'} = scalar(keys(%sections_count));
     }      }
       $seccount->{'st'} ++; # Increment for a section-less student role.
     my $rolehash = {      my $rolehash = {
                      'roles'    => $courseroles,                       'roles'    => $courseroles,
                      'seccount' => $seccount,                       'seccount' => $seccount,
Line 2307  sub get_all_courseroles { Line 2584  sub get_all_courseroles {
     return;      return;
 }  }
   
   sub get_customadhoc_roles {
       my ($cdom,$cnum,$courseroles,$seccount,$courseprivs,$privref) = @_;
       unless ((ref($courseroles) eq 'HASH') && (ref($seccount) eq 'HASH') &&
               (ref($courseprivs) eq 'HASH')) {
           return;
       }
       if ($env{'environment.adhocroles.'.$cdom} ne '') {
           my @customroles = split(/,/,$env{'environment.adhocroles.'.$cdom});
           if (@customroles > 1) {
               if ($env{"user.role.dh./$cdom/"}) {
                   my ($start,$end)=split(/\./,$env{"user.role.dh./$cdom/"});
                   my $now = time;
                   if (!($start && ($now<$start)) & !($end && ($now>$end))) {
                       my $numsec = 1;
                       my @sections;
                       my ($allseclist,$cached) =
                           &Apache::lonnet::is_cached_new('courseseclist',$cdom.'_'.$cnum);
                       if (defined($cached)) {
                           if ($allseclist ne '') {
                               @sections = split(/,/,$allseclist);
                               $numsec += scalar(@sections);
                           }
                       } else {
                           my %sections_count = &Apache::loncommon::get_sections($cdom,$cnum);
                           $numsec += scalar(keys(%sections_count));
                           $allseclist = join(',',sort(keys(%sections_count)));
                           &Apache::lonnet::do_cache_new('courseseclist',$cdom.'_'.$cnum,$allseclist);
                       }
                       my (%adhoc,$gotprivs);
                       my $prefix = "cr/$cdom/$cdom".'-domainconfig';
                       foreach my $role (@customroles) {
                           next if (($role eq '') || ($role =~ /\W/));
                           $seccount->{"$prefix/$role"} = $numsec;
                           $courseroles->{"$prefix/$role"} = \@sections;
                           if ((ref($privref) eq 'ARRAY') && (@{$privref} > 0)) {
                               if (exists($env{"user.priv.$prefix/$role./$cdom/$cnum./"})) {
                                   $courseprivs->{"$prefix/$role./$cdom/$cnum./"} =
                                       $env{"user.priv.$prefix/$role./$cdom/$cnum./"};
                                   $courseprivs->{"$prefix/$role./$cdom/$cnum./$cdom/"} =
                                       $env{"user.priv.$prefix/$role./$cdom/$cnum./$cdom/"};
                                   $courseprivs->{"$prefix/$role./$cdom/$cnum./$cdom/$cnum"} =
                                       $env{"user.priv.$prefix/$role./$cdom/$cnum./$cdom/$cnum"};
                               } else {
                                   unless ($gotprivs) {
                                       my ($adhocroles,$privscached) =
                                           &Apache::lonnet::is_cached_new('adhocroles',$cdom);
                                       if ((defined($privscached)) && (ref($adhocroles) eq 'HASH')) {
                                           %adhoc = %{$adhocroles};
                                       } else {
                                           my $confname = &Apache::lonnet::get_domainconfiguser($cdom);
                                           my %roledefs = &Apache::lonnet::dump('roles',$cdom,$confname,'rolesdef_');
                                           foreach my $key (keys(%roledefs)) {
                                               (undef,my $rolename) = split(/_/,$key);
                                               if ($rolename ne '') {
                                                   $adhoc{$rolename} = $roledefs{$key};
                                               }
                                           }
                                           &Apache::lonnet::do_cache_new('adhocroles',$cdom,\%adhoc);
                                       }
                                       $gotprivs = 1;
                                   }
                                   ($courseprivs->{"$prefix/$role./$cdom/$cnum./"},
                                    $courseprivs->{"$prefix/$role./$cdom/$cnum./$cdom/"},
                                    $courseprivs->{"$prefix/$role./$cdom/$cnum./$cdom/$cnum"}) =
                                        split(/\_/,$adhoc{$role});
                               }
                           }
                       }
                   }
               }
           }
       }
       return;
   }
   
 sub jump_to_role {  sub jump_to_role {
     my ($cdom,$cnum,$seccount,$courseroles,$courseprivs,$priv) = @_;      my ($cdom,$cnum,$seccount,$courseroles,$courseprivs,$privref) = @_;
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
                 this => 'This role has section(s) associated with it.',                  this => 'This role has section(s) associated with it.',
                 ente => 'Enter a specific section.',                  ente => 'Enter a specific section.',
Line 2341  sub jump_to_role { Line 2693  sub jump_to_role {
         }          }
     }      }
     my $checkroles = 0;      my $checkroles = 0;
     if ($priv && ref($courseprivs) eq 'HASH') {      if ((ref($privref) eq 'ARRAY') && (@{$privref} > 0) && (ref($courseprivs) eq 'HASH')) {
         my (%disallowed,%allowed,@disallow);          my %disallowed;
         foreach my $role (sort(keys(%{$courseprivs}))) {          foreach my $role (sort(keys(%{$courseprivs}))) {
             my $trole;              my $trole;
             if ($role =~ m{^(.+?)\Q./$cdom/$cnum\E}) {              if ($role =~ m{^(.+?)\Q./$cdom/$cnum\E}) {
                 $trole = $1;                  $trole = $1;
             }              }
             if (($trole ne '') && ($trole ne 'cm')) {              if (($trole ne '') && ($trole ne 'cm')) {
                 if ($courseprivs->{$role} =~ /\Q:$priv\E($|:|\&\w+)/) {                  $disallowed{$trole} = 1;
                     $allowed{$trole} = 1;                  foreach my $priv (@{$privref}) { 
                 } else {                      if ($courseprivs->{$role} =~ /\Q:$priv\E($|:|\&\w+)/) {
                     $disallowed{$trole} = 1;                          delete($disallowed{$trole});
                           last;
                       }
                 }                  }
             }              }
         }          }
         foreach my $trole (keys(%disallowed)) {          if (keys(%disallowed) > 0) {
             unless ($allowed{$trole}) {  
                 push(@disallow,$trole);  
             }  
         }  
         if (@disallow > 0) {  
             $checkroles = 1;              $checkroles = 1;
             $js .= "    var disallow = new Array('".join("','",@disallow)."');\n".              $js .= "    var disallow = new Array('".join("','",keys(%disallowed))."');\n".
                    "    var rolecheck = 1;\n";                     "    var rolecheck = 1;\n";
         }          }
     }      }
Line 2461  END Line 2810  END
   
 sub required_privs {  sub required_privs {
     my $privs =  {      my $privs =  {
              '/adm/parmset'      => 'opa',               '/adm/parmset'      => 'opa,vpa',
              '/adm/courseprefs'  => 'opa',               '/adm/courseprefs'  => 'opa,vpa',
              '/adm/whatsnew'     => 'whn',               '/adm/whatsnew'     => 'whn',
              '/adm/populate'     => 'cst',               '/adm/populate'     => 'cst',
              '/adm/trackstudent' => 'vsa',               '/adm/trackstudent' => 'vsa',
              '/adm/statistics'   => 'vgr',               '/adm/statistics'   => 'mgr,vgr',
              '/adm/setblock'     => 'dcm',               '/adm/setblock'     => 'dcm,vcb',
              '/adm/coursedocs'   => 'mdc',               '/adm/coursedocs'   => 'mdc',
            };             };
     unless ($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'spreadsheet') {      unless ($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'spreadsheet') {
Line 2503  sub countdown_timer { Line 2852  sub countdown_timer {
         }          }
         my $duedate = &Apache::lonnet::EXT("resource.0.duedate");          my $duedate = &Apache::lonnet::EXT("resource.0.duedate");
         my @interval=&Apache::lonnet::EXT("resource.0.interval");          my @interval=&Apache::lonnet::EXT("resource.0.interval");
         my $hastimeleft;  
         if (@interval > 1) {          if (@interval > 1) {
             my $first_access=&Apache::lonnet::get_first_access($interval[1]);              my $first_access=&Apache::lonnet::get_first_access($interval[1]);
             if ($first_access > 0) {              if ($first_access > 0) {
Line 2561  BEGIN { Line 2909  BEGIN {
                         $category_positions{$entries[2]}=$entries[1];                          $category_positions{$entries[2]}=$entries[1];
                         $category_names{$entries[2]}=$entries[3];                          $category_names{$entries[2]}=$entries[3];
                     } elsif ($configline=~/^prim\:/) {                      } elsif ($configline=~/^prim\:/) {
                         my @entries = (split(/\:/, $configline))[1..5];                          my @entries = (split(/\:/, $configline))[1..6];
                         push(@primary_menu,\@entries);                          push(@primary_menu,\@entries);
                     } elsif ($configline=~/^primsub\:/) {                      } elsif ($configline=~/^primsub\:/) {
                         my ($parent,@entries) = (split(/\:/, $configline))[1..4];                          my ($parent,@entries) = (split(/\:/, $configline))[1..4];

Removed from v.1.369.2.30  
changed lines
  Added in v.1.369.2.64


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