'.
@@ -560,7 +564,7 @@ sub create_submenu {
# see perldoc create_submenu documentation for further information
sub build_submenu {
my ($target, $submenu, $translate, $first_level) = @_;
- if (!defined(@{$submenu})) {
+ unless (@{$submenu}) {
return '';
}
@@ -947,9 +951,14 @@ ENDMENUITEMS
}
}
}
+ my $showprogress;
+ if (($crstype eq 'Placement') && (!$env{'request.role.adv'})) {
+ $showprogress = &placement_progress();
+ }
+
+ my $addremote=0;
+ foreach (@inlineremote) { if ($_ ne '') { $addremote=1; last;} }
- my $addremote=0;
- foreach (@inlineremote) { if ($_ ne '') { $addremote=1; last;} }
if ($addremote) {
my $countdown;
if ($env{'request.filename'} =~ /\.page$/) {
@@ -969,6 +978,9 @@ ENDMENUITEMS
if ($countdown) {
&Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$countdown);
}
+ if ($showprogress) {
+ &Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$showprogress);
+ }
} else {
my @tools = @inlineremote[93,91,81,82,83];
if ($countdown) {
@@ -987,6 +999,10 @@ ENDMENUITEMS
}
&advtools_crumbs(@inlineremote);
}
+ } else {
+ if ($showprogress) {
+ &Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$showprogress);
+ }
}
my ($topic_help,$topic_help_text);
if ($is_const_dir == 2) {
@@ -1618,11 +1634,10 @@ END
# LC_interval_done is true.
#
sub done_button_js {
- my ($type,$width,$height,$proctor) = @_;
+ my ($type,$width,$height,$proctor,$donebuttontext) = @_;
return unless (($type eq 'map') || ($type eq 'resource'));
my %lt = &Apache::lonlocal::texthash(
title => 'WARNING!',
- button => 'Done',
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).',
@@ -1699,7 +1714,7 @@ sub done_button_js {
@@ -2485,9 +2500,17 @@ sub countdown_timer {
}
my $duedate = &Apache::lonnet::EXT("resource.0.duedate");
my @interval=&Apache::lonnet::EXT("resource.0.interval");
- my ($timelimit,$usesdone,$proctor,$secret);
+ my ($timelimit,$usesdone,$donebuttontext,$proctor,$secret);
if (@interval > 1) {
- ($timelimit,$usesdone,$proctor,$secret) = split(/_/,$interval[0]);
+ ($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) {
@@ -2505,7 +2528,7 @@ sub countdown_timer {
$collapse = '► ';
if ((@interval > 1) && ($hastimeleft)) {
if ($usesdone eq 'done') {
- $donebutton = &done_button_js($interval[1],'','',$proctor);
+ $donebutton = &done_button_js($interval[1],'','',$proctor,$donebuttontext);
}
}
} else {
@@ -2534,6 +2557,13 @@ END
return;
}
+sub placement_progress {
+ my ($totalpoints,$incomplete) = &Apache::lonplacementtest::check_completion(undef,undef,1);
+ my $complete = 100 - $incomplete;
+ return ''.
+ &mt('Test is [_1]% complete',$complete).'';
+}
+
# ================================================================ Main Program
BEGIN {