--- loncom/interface/lonmenu.pm 2012/08/06 03:38:08 1.369.2.19 +++ loncom/interface/lonmenu.pm 2012/10/09 12:07:18 1.369.2.25 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.369.2.19 2012/08/06 03:38:08 raeburn Exp $ +# $Id: lonmenu.pm,v 1.369.2.25 2012/10/09 12:07:18 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -443,8 +443,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 { @@ -486,7 +488,7 @@ sub registerurl { if ($env{'request.state'} eq 'construct') { $force_title=&Apache::lonxml::display_title(); } - if (($env{'environment.remote'} eq 'off') || + if (($env{'environment.remote'} ne 'on') || ((($env{'request.publicaccess'}) || (!&Apache::lonnet::is_on_map( &unescape($env{'request.noversionuri'})))) && @@ -515,7 +517,7 @@ sub innerregister { $env{'request.registered'} = 1; - my $noremote = ($env{'environment.remote'} eq 'off'); + my $noremote = ($env{'environment.remote'} ne 'on'); undef(@inlineremote); @@ -758,7 +760,7 @@ sub innerregister { ### ### # Prepare the rest of the buttons - my ($menuitems,$got_prt,$got_wishlist); + my ($menuitems,$got_prt,$got_wishlist,$cstritems); if ($const_space) { # # We are in construction space @@ -778,12 +780,16 @@ sub innerregister { # Probably should be in mydesk.tab # $menuitems=(< + +$cstrcrumbs ENDREGTHIS } } else { @@ -992,6 +1024,7 @@ var swmenu=null; swmenu.clearbut(8,1); swmenu.clearbut(8,2); swmenu.clearbut(8,3); + swmenu.clearbut(9,1); if (swmenu.currentURL) { swmenu.switchbutton (3,1,'reload.gif','return','location','go(currentURL)'); @@ -1020,10 +1053,6 @@ sub get_inline_text { pparm => 'Content Settings', docs => 'Folder/Page Content', pcstr => 'Edit', - list => 'Directory', - rtrv => 'Retrieve', - pub => 'Publish', - del => 'Delete', prt => 'Print', alnk => 'Stored Links', anot => 'Notes', @@ -1040,10 +1069,6 @@ sub get_rc_text { subm => 'view sub-[_1]', pparm => 'problem[_2]', pcstr => 'edit[_1]', - list => 'list[_1]', - rtrv => 'retrieve[_1]', - pub => 'publish[_1]', - del => 'delete[_1]', prt => 'prepare[_1]', back => 'backward[_1]', forw => 'forward[_1]', @@ -1291,6 +1316,16 @@ sub switch { if ($env{'environment.remote'} eq 'on') { if (($row<1) || ($row>13)) { return ''; } + if ($env{'request.state'} eq 'construct') { + my $text = $top.' '.$bot; + $text=~s/\s*\-\s*//gs; + my $pic = ''.$text.''; + $inlineremote[$idx] = + ''. + $pic.''.$top.' '; + } # Remote $img=~s/\.png$/\.gif/; return "\n". @@ -1940,8 +1975,22 @@ sub roles_selector { } else { $ccrole = 'cc'; } - my $priv; + my ($priv,$gotsymb,$destsymb); my $destinationurl = $ENV{'REQUEST_URI'}; + if ($destinationurl =~ /\?symb=/) { + $gotsymb = 1; + } elsif ($destinationurl =~ m{^/enc/}) { + my $plainurl = &Apache::lonenc::unencrypted($destinationurl); + if ($plainurl =~ /\?symb=/) { + $gotsymb = 1; + } + } + unless ($gotsymb) { + $destsymb = &Apache::lonnet::symbread(); + if ($destsymb ne '') { + $destsymb = &Apache::lonenc::check_encrypt($destsymb); + } + } my $reqprivs = &required_privs(); if (ref($reqprivs) eq 'HASH') { my $destination = $destinationurl; @@ -2029,7 +2078,12 @@ sub roles_selector { $role_selector .= "\n".''; } } - $role_selector .= ''."\n". + $role_selector .= ''."\n"; + if ($destsymb ne '') { + $role_selector .= ''."\n"; + } + $role_selector .= ''."\n". ''."\n". @@ -2285,8 +2339,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; @@ -2299,9 +2372,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 {