--- loncom/interface/lonmenu.pm 2012/07/05 19:22:47 1.382 +++ loncom/interface/lonmenu.pm 2012/10/29 17:38:56 1.388 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.382 2012/07/05 19:22:47 raeburn Exp $ +# $Id: lonmenu.pm,v 1.388 2012/10/29 17:38:56 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -247,9 +247,7 @@ sub primary_menu { my @primsub; if (ref($primary_submenu{$title}) eq 'ARRAY') { foreach my $item (@{$primary_submenu{$title}}) { - next if (($item->[2] eq 'wishlist') && - ((!&Apache::lonnet::allowed('bre',"/res/$env{'user.domain'}/")) && - (!&Apache::lonnet::allowed('bro',"/res/$env{'user.domain'}/")))); + next if (($item->[2] eq 'wishlist') && (!$env{'user.adv'})); next if (($item->[2] eq 'reqcrs') && (!&check_for_rcrs())); next if ((($item->[2] eq 'portfolio') || ($item->[2] eq 'blog')) && @@ -395,8 +393,10 @@ sub secondary_menu { } $menu =~ s/\[uname\]/$$author{user}/g; $menu =~ s/\[udom\]/$$author{dom}/g; - - return ""; + if ($menu) { + $menu = ""; + } + return $menu; } sub create_submenu { @@ -587,7 +587,7 @@ sub innerregister { # Check that the user has permission to edit this resource my $setpriv = 1; - ($cfuname,$cfudom)=&Apache::loncacc::constructaccess($file,$setpriv); + ($cfuname,$cfudom)=&Apache::lonnet::constructaccess($file,$setpriv); if (defined($cfudom)) { $home=&Apache::lonnet::homeserver($cfuname,$cfudom); my $allowed=0; @@ -663,7 +663,7 @@ sub innerregister { ### ### # Prepare the rest of the buttons - my $menuitems; + my ($menuitems,$got_prt,$got_wishlist); if ($const_space) { # # We are in construction space @@ -699,7 +699,7 @@ ENDMENUITEMS } elsif ( defined($env{'request.course.id'}) && $env{'request.symb'} ne '' ) { # -# We are in a course and looking at a registred URL +# We are in a course and looking at a registered URL # Should probably be in mydesk.tab # $menuitems=(<'.&Apache::lonnet::plaintext($role).''; } } - $role_selector .= ''."\n". + $role_selector .= ''."\n"; + if ($destsymb ne '') { + $role_selector .= ''."\n"; + } + $role_selector .= ''."\n". ''."\n". @@ -1815,8 +1843,27 @@ sub required_privs { sub countdown_timer { if (($env{'request.course.id'}) && ($env{'request.symb'} ne '') && - ($env{'request.filename'}=~/$LONCAPA::assess_re/) && - ($Apache::inputtags::status[-1] eq 'CAN_ANSWER')) { + ($env{'request.filename'}=~/$LONCAPA::assess_re/)) { + my ($type,$hastimeleft,$slothastime); + my $now = time; + if ($env{'request.filename'} =~ /\.task$/) { + $type = 'Task'; + } else { + $type = 'problem'; + } + my ($status,$accessmsg,$slot_name,$slot) = + &Apache::lonhomework::check_slot_access('0',$type); + if ($slot_name ne '') { + if (ref($slot) eq 'HASH') { + if (($slot->{'starttime'} < $now) && + ($slot->{'endtime'} > $now)) { + $slothastime = 1; + } + } + } + if ($status ne 'CAN_ANSWER') { + return; + } my $duedate = &Apache::lonnet::EXT("resource.0.duedate"); my @interval=&Apache::lonnet::EXT("resource.0.interval"); my $hastimeleft; @@ -1829,9 +1876,11 @@ sub countdown_timer { } } if (($duedate && $duedate > time) || - (!$duedate && $hastimeleft)) { + (!$duedate && $hastimeleft) || + ($slot_name ne '' && $slothastime)) { my ($collapse,$expand,$alttxt,$title,$currdisp); - if (@interval > 1 && $hastimeleft) { + if ((@interval > 1 && $hastimeleft) || + ($type eq 'Task' && $slothastime)) { $currdisp = 'inline'; $collapse = '► '; } else {