$lt{'resource'}
@@ -1861,6 +1911,7 @@ sub start_problem {
my $status;
my $accessmsg;
my $resource_due;
+ my $ipused;
my $name= &get_resource_name($parstack,$safeeval);
my ($result,$form_tag_start,$slot_name,$slot,$probpartlist,$firstaccres);
@@ -1869,7 +1920,7 @@ sub start_problem {
$target eq 'tex') {
if ($env{'form.markaccess'}) {
my @interval=&Apache::lonnet::EXT("resource.0.interval");
- my ($timelimit) = ($interval[0] =~ /^(\d+)/);
+ my ($timelimit) = split(/_/,$interval[0]);
my $is_set = &Apache::lonnet::set_first_access($interval[1],$timelimit);
unless (($is_set eq 'ok') || ($is_set eq 'already_set')) {
$firstaccres = $is_set;
@@ -1905,10 +1956,10 @@ sub start_problem {
$target eq 'tex') {
my ($symb)= &Apache::lonnet::whichuser();
- ($status,$accessmsg,$slot_name,$slot) =
+ ($status,$accessmsg,$slot_name,$slot,$ipused) =
&Apache::lonhomework::check_slot_access('0','problem',$symb,$probpartlist);
push (@Apache::inputtags::status,$status);
- }
+ }
if ($target eq 'tex' and $env{'request.symb'} =~ m/\.page_/) {$result='';}
@@ -1971,7 +2022,10 @@ sub start_problem {
}
if (($env{'request.state'} ne "construct") &&
($Apache::lonhomework::type eq 'randomizetry') &&
- ($status eq 'CAN_ANSWER')) {
+ ($status eq 'CAN_ANSWER') &&
+ ($env{'course.'.$env{'request.course.id'}.'.type'} ne 'Placement') &&
+ (!$env{'request.role.adv'})) {
+# "New Problem Variation Each Try" header suppressed for Placement Tests, unless course personnel.
my @parts;
if (ref($probpartlist) eq 'ARRAY') {
@parts = @{$probpartlist};
@@ -1997,14 +2051,15 @@ sub start_problem {
( $status eq 'NOTRESERVABLE') ||
( $status eq 'RESERVABLE') ||
( $status eq 'RESERVABLE_LATER') ||
- ( $status eq 'INVALID_ACCESS')) {
+ ( $status eq 'INVALID_ACCESS') ||
+ ( $status eq 'NEED_DIFFERENT_IP')) {
my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser,
$style);
if (($status eq 'NOT_YET_VIEWED') && ($firstaccres)) {
$result .= ''.
&mt('A problem occurred when trying to start the timer.').'
';
}
- $result .= &access_status_msg('problem',$status,$symb,$target,'',$accessmsg);
+ $result .= &access_status_msg('problem',$status,$symb,$target,$ipused,$accessmsg);
} elsif ($status eq 'NEEDS_CHECKIN') {
my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser,
$style);
@@ -2027,11 +2082,16 @@ sub start_problem {
'';
# create a page header and exit
if ($env{'request.state'} eq "construct") {
- $result.= &problem_web_to_edit_header($env{'form.rndseed'});
+ if ($env{'form.inhibitmenu'} eq 'yes') {
+ # error messages can be useful in any case
+ $result.= &Apache::lonxml::message_location();
+ } else {
+ $result.= &problem_web_to_edit_header($env{'form.rndseed'});
+ }
if ($Apache::lonhomework::type eq 'practice') {
$result.= ''.
- &practice_problem_header().'
';
+ 'value="new_problem_variation">'.&mt('New Problem Variation').''.
+ &practice_problem_header().'
';
} elsif ($Apache::lonhomework::type eq 'randomizetry') {
my $reqtries = &Apache::lonnet::EXT("resource.$Apache::inputtags::part.randomizeontries");
my $problemstatus = &get_problem_status($Apache::inputtags::part);
@@ -2221,7 +2281,39 @@ sub end_problem {
# Added separately at end of this routine, after added
# so document will be valid xhtml.
#
- $result.= &Apache::loncommon::end_page({'discussion' => 1,
+ my $showdisc = 1;
+ if (($env{'course.'.$env{'request.course.id'}.'.type'} eq 'Placement') &&
+ (!$env{'request.role.adv'})) {
+# For Placement Tests footer with "Post Discussion" and "Send Feedback" links is suppressed.
+ $showdisc = 0;
+ my ($symb)= &Apache::lonnet::whichuser();
+ if ($symb) {
+ my $navmap = Apache::lonnavmaps::navmap->new();
+ if (ref($navmap)) {
+ my $hastries = &Apache::lonplacementtest::has_tries($symb,$navmap);
+# For Placement Tests test status is displayed if this is the last resource in the course
+# and there are no tries left
+ unless ($hastries) {
+ if (&Apache::lonplacementtest::is_lastres($symb,$navmap)) {
+ my ($score,$incomplete) =
+ &Apache::lonplacementtest::check_completion(undef,undef,1);
+ if (!$incomplete) {
+ $result .= &Apache::lonplacementtest::showresult(1,1);
+ } elsif ($incomplete < 100) {
+ $result.= &Apache::lonplacementtest::showincomplete($incomplete,1);
+ }
+ } else {
+# For Placement Tests score is displayed if test has just been completed
+ my ($score,$incomplete) = &Apache::lonplacementtest::check_completion(undef,undef,1);
+ if (!$incomplete) {
+ $result.= &Apache::lonplacementtest::showresult(1,1);
+ }
+ }
+ }
+ }
+ }
+ }
+ $result.= &Apache::loncommon::end_page({'discussion' => $showdisc,
'notbody' => 1});
} elsif ($target eq 'tex') {
my $endminipage = '';
@@ -2275,7 +2367,7 @@ ENDJS
@Apache::inputtags::response=();
$result=&Apache::response::mandatory_part_meta;
}
- $result.=&Apache::response::meta_part_order();
+ $result.=&Apache::response::meta_part_order('problem');
$result.=&Apache::response::meta_response_order();
} elsif ($target eq 'edit') {
&Apache::lonxml::debug("in end_problem with $target, edit");
@@ -2337,8 +2429,8 @@ sub start_library {
$result.=&problem_web_to_edit_header($rndseed);
if ($Apache::lonhomework::type eq 'practice') {
$result.= ''.
- &practice_problem_header().'
';
+ 'value="new_problem_variation">'.&mt('New Problem Variation').''.
+ &practice_problem_header().'
';
}
}
return $result;
@@ -2354,6 +2446,7 @@ sub end_library {
&& $env{'request.state'} eq "construct") {
$result.=''.&Apache::loncommon::end_page({'discussion' => 1});
} elsif ($target eq 'meta') {
+ $result.=&Apache::response::meta_part_order('library');
$result.=&Apache::response::meta_response_order();
}
if ( $#$tagstack eq 0 && $$tagstack[0] eq 'library') {
@@ -2983,6 +3076,14 @@ sub start_part {
if (($target eq 'grade') && &Apache::response::submitted()) {
$Apache::lonhomework::results{"resource.$id.rndseed"}=$rndseed;
}
+ } elsif (@Apache::inputtags::partlist > 1) {
+ my $prevparttype = &Apache::lonnet::EXT("resource.$Apache::inputtags::partlist[-2].type");
+ if ($prevparttype eq 'randomizetry') {
+ my $rndseed=&setup_rndseed($safeeval,$target,'',$prevparttype);
+ if (($target eq 'grade') && &Apache::response::submitted()) {
+ $Apache::lonhomework::results{"resource.$id.rndseed"}=$rndseed;
+ }
+ }
} elsif (($target eq 'grade') && &Apache::response::submitted()) {
$Apache::lonhomework::results{"resource.$id.rndseed"}=$Apache::lonhomework::rawrndseed;
}
@@ -3059,8 +3160,8 @@ sub start_part {
if ($status eq 'CAN_ANSWER') {
my $problemstatus = &get_problem_status($Apache::inputtags::part);
my $num = scalar(@Apache::inputtags::partlist)-1;
- if ((($Apache::lonhomework::default_type eq 'randomizetry') ||
- ($Apache::lonhomework::randomizetrypart)) &&
+ if ((($Apache::lonhomework::default_type eq 'randomizetry') ||
+ ($Apache::lonhomework::randomizetrypart)) &&
($Apache::lonhomework::type ne 'randomizetry')) {
$result .= &randomizetry_part_header($problemstatus,'none',$num);
} elsif ($Apache::lonhomework::type eq 'randomizetry') {
@@ -3120,7 +3221,7 @@ sub end_part {
$gradestatus='';
}
$result.=$gradestatus;
- if ($$tagstack[-2] eq 'td' and $target eq 'tex') {
+ if ($$tagstack[-2] eq 'td' and $target eq 'tex') {
if (not $env{'form.problem_split'}=~/yes/) {
$result.='\end{minipage}';
}
@@ -3240,7 +3341,7 @@ sub start_problemtype {
['hide','Hide']]
,$token);
$result .=&Apache::edit::checked_arg('When used as type(s):','for',
- [ ['exam','Exam/Quiz Problem'],
+ [ ['exam','Bubblesheet Exam/Quiz Problem'],
['survey','Survey'],
['surveycred','Survey (with credit)'],
['anonsurvey','Anonymous Survey'],
@@ -3383,7 +3484,7 @@ sub end_simpleeditbutton {
}
sub practice_problem_header {
- return ''.&mt('Practice Problem').'
'.
+ return ''.&mt('Practice Problem').'
'.
''.&mt('Submissions are not permanently recorded').
'';
}
@@ -3445,7 +3546,7 @@ sub randomizetry_part_header {
if ($num > 1) {
$output .= '
';
}
- $output .= ''.$header.'
'.
+ $output .= ''.$header.'
'.
''.$text.'
';
return $output;
}