--- loncom/interface/lonmenu.pm 2022/03/25 21:25:37 1.369.2.83.4.1 +++ loncom/interface/lonmenu.pm 2024/07/02 18:35:28 1.369.2.84 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.369.2.83.4.1 2022/03/25 21:25:37 raeburn Exp $ +# $Id: lonmenu.pm,v 1.369.2.84 2024/07/02 18:35:28 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -789,12 +789,8 @@ sub innerregister { @mapcrumbs = $navmap->recursed_crumbs($mapurl,$restitle); } } - unless (($forcereg) && - ($env{'request.noversionuri'} eq '/adm/navmaps') && - ($mapurl eq $env{'course.'.$env{'request.course.id'}.'.url'})) { - @crumbs = ({text => $crstype.' Contents', - href => "Javascript:gopost('/adm/navmaps','')"}); - } + @crumbs = ({text => $crstype.' Contents', + href => "Javascript:gopost('/adm/navmaps','')"}); if ($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'}) { if (@mapcrumbs) { push(@crumbs,@mapcrumbs); @@ -989,13 +985,31 @@ s&6&1&list.png&Directory&dir[_1]&golist( s&6&2&rtrv.png&Retrieve&version[_1]&gocstr('/adm/retrieve','/priv/$udom/$uname/$cleandisfn')&Retrieve old version s&6&3&pub.png&Publish&resource[_3]&gocstr('/adm/publish','/priv/$udom/$uname/$cleandisfn')&Publish this resource s&7&1&del.png&Delete&resource[_2]&gocstr('/adm/cfile?action=delete','/priv/$udom/$uname/$cleandisfn')&Delete this resource +ENDMENUITEMS +# +# Print only makes sense for certain mime types +# + if ($thisdisfn=~/\.(xml|html|htm|xhtml|xhtm|tex)$/ || $thisdisfn=~/$LONCAPA::assess_re/) { + $menuitems .= (< 'WARNING!', - preamble => 'You are trying to end this timed event early.', - map => 'Confirming that you are done will cause the time to expire and prevent you from changing any answers in the current folder.', - resource => 'Confirming that you are done will cause the time to expire for this question, and prevent you from changing your answer(s).', - okdone => 'Click "OK" if you are completely finished.', - cancel => 'Click "Cancel" to continue working.', - proctor => 'Ask a proctor to enter the key, then click "OK" if you are completely finished.', - ok => 'OK', - exit => 'Cancel', - key => 'Key:', - nokey => 'A proctor key is required', - ); - my $shownsymb = &HTML::Entities::encode(&Apache::lonenc::check_encrypt($env{'request.symb'})); - my $navmap = Apache::lonnavmaps::navmap->new(); - my ($missing,$tried) = (0,0); - if (ref($navmap)) { - my @resources=(); - if ($type eq 'map') { - my ($mapurl,$rid,$resurl)=&Apache::lonnet::decode_symb($env{'request.symb'}); - if ($env{'request.symb'} =~ /\.page$/) { - @resources=$navmap->retrieveResources($resurl,sub { $_[0]->is_problem() }); - } else { - @resources=$navmap->retrieveResources($mapurl,sub { $_[0]->is_problem() }); - } - } else { - my $res = $navmap->getBySymb($env{'request.symb'}); - if (ref($res)) { - if ($res->is_problem()) { - push(@resources,$res); - } - } - } - foreach my $res (@resources) { - if (ref($res->parts()) eq 'ARRAY') { - foreach my $part (@{$res->parts()}) { - if (!$res->tries($part)) { - $missing++; - } else { - $tried++; - } - } - } - } - } - if ($missing) { - $lt{'miss'} .= '

'; - if ($type eq 'map') { - $lt{'miss'} .= &mt('Submissions are missing for [quant,_1,question part,question parts] in this folder.',$missing); - } else { - $lt{'miss'} .= &mt('Submissions are missing for [quant,_1,part] in this question.',$missing); - } - if ($missing > 1) { - $lt{'miss'} .= ' '.&mt('If you confirm you are done you will be unable to submit answers for them.').''; - } else { - $lt{'miss'} .= ' '.&mt('If you confirm you are done you will be unable to submit an answer for it.').'

'; - } - } - $donebuttontext = &HTML::Entities::encode($donebuttontext,'<>&"'); - if ($proctor) { - if ($height !~ /^\d+$/) { - $height = 400; - if ($missing) { - $height += 60; - } - } - if ($width !~ /^\d+$/) { - $width = 400; - if ($missing) { - $width += 60; - } - } - return < - - - - - - -
-

$lt{'preamble'} $lt{$type}

- $lt{'miss'} -

$lt{'proctor'}

-
- - -
-

$lt{'cancel'}

-
- - - -END - } else { - if ($height !~ /^\d+$/) { - $height = 320; - if ($missing) { - $height += 60; - } - } - if ($width !~ /^\d+$/) { - $width = 320; - if ($missing) { - $width += 60; - } - } - if ($missing) { - $lt{'miss'} = '

'.$lt{'miss'}.'

'; - } - return < - - - - - -

-

$lt{'preamble'} $lt{$type} $lt{'miss'} $lt{'okdone'} $lt{'cancel'}

-
- - - -END - } -} - sub utilityfunctions { my ($httphost) = @_; my $currenturl=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0])); @@ -2567,6 +2384,10 @@ function gocstr(url,filename) { this.document.cstrprint.submit(); return; } + if (url == '/adm/preferences?action=authorsettings') { + document.location.href=url+'&returnurl='+filename; + return; + } if (url !='') { this.document.constspace.filename.value = filename; this.document.constspace.action = url; @@ -3230,20 +3051,10 @@ sub countdown_timer { } my $duedate = &Apache::lonnet::EXT("resource.0.duedate"); my @interval=&Apache::lonnet::EXT("resource.0.interval"); - my ($timelimit,$usesdone,$donebuttontext,$proctor,$secret); if (@interval > 1) { - ($timelimit,my $donesuffix) = split(/_/,$interval[0],2); - if ($donesuffix =~ /^done\:([^\:]+)\:(.*)$/) { - $usesdone = 'done'; - $donebuttontext = $1; - (undef,$proctor,$secret) = split(/_/,$2); - } elsif ($donesuffix =~ /^done(|_.+)$/) { - $donebuttontext = &mt('Done'); - ($usesdone,$proctor,$secret) = split(/_/,$donesuffix); - } my $first_access=&Apache::lonnet::get_first_access($interval[1]); if ($first_access > 0) { - if ($first_access+$timelimit > time) { + if ($first_access+$interval[0] > time) { $hastimeleft = 1; } } @@ -3251,16 +3062,11 @@ sub countdown_timer { if (($duedate && $duedate > time) || (!$duedate && $hastimeleft) || ($slot_name ne '' && $slothastime)) { - my ($collapse,$expand,$alttxt,$title,$currdisp,$donebutton); + my ($collapse,$expand,$alttxt,$title,$currdisp); if ((@interval > 1 && $hastimeleft) || ($type eq 'Task' && $slothastime)) { $currdisp = 'inline'; $collapse = '► '; - if ((@interval > 1) && ($hastimeleft)) { - if ($usesdone eq 'done') { - $donebutton = &done_button_js($interval[1],'','',$proctor,$donebuttontext); - } - } } else { $currdisp = 'none'; $expand = '◄ '; @@ -3271,7 +3077,7 @@ sub countdown_timer { } my $desc = &mt('Countdown to due date/time'); return < $collapse