'.&mt('Access requires reservation to work at specific time/place.').'
';
- } elsif ($status ne 'NOT_YET_VIEWED') {
- $msg.='
'.&mt('Not open to be viewed').'
';
- }
- if ($status eq 'CLOSED' || $status eq 'INVALID_ACCESS') {
- $msg.=&mt('The problem ').$accessmsg;
- } elsif ($status eq 'UNCHECKEDOUT') {
- $msg.=&checkout_msg();
- } elsif ($status eq 'NOT_YET_VIEWED') {
- $msg.=&firstaccess_msg($accessmsg,$symb);
- } elsif ($status eq 'NOT_IN_A_SLOT') {
- $msg.=&Apache::bridgetask::add_request_another_attempt_button("Sign up for time to work");
- } elsif ($status eq 'RESERVABLE') {
- $msg.=&mt('Available to make a reservation.').' '.&mt('Reservation window closes [_1].',
- &Apache::lonnavmaps::timeToHumanString($accessmsg,'end')).
- ' '.
- &Apache::bridgetask::add_request_another_attempt_button("Sign up for time to work");
- } elsif ($status eq 'RESERVABLE_LATER') {
- $msg.=&mt('Window to make a reservation will open [_1].',
- &Apache::lonnavmaps::timeToHumanString($accessmsg,'start'));
- } elsif ($status eq 'NOTRESERVABLE') {
- $msg.=&mt('Not available to make a reservation.');
- } elsif ($status eq 'NEED_DIFFERENT_IP') {
- if ($ipused) {
- $msg.=&mt('You must use the same computer ([_1]) you used when you first accessed this resource using your time/place-based reservation.',"IP: $ipused");
- } else {
- $msg.=&mt('Each student must use a different computer to access this resource at this time and/or place.').' '.
- &mt('Somebody else has already used this particular computer for that purpose.');
- }
- }
- $result.=$msg.' ';
- } elsif ($target eq 'tex') {
- my $startminipage = ($env{'form.problem_split'}=~/yes/i)? ''
- : '\begin{minipage}{\textwidth}';
- $result.='\noindent \vskip 1 mm '.
- $startminipage.'\vskip 0 mm';
- if ($status eq 'UNAVAILABLE') {
- $result.=&mt('Unable to determine if this resource is open due to network problems. Please try again later.').'\vskip 0 mm ';
- } else {
- $result.=&mt('Problem is not open to be viewed. It')." $accessmsg \\vskip 0 mm ";
- }
- }
+ 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,$ipused,$accessmsg);
} elsif ($status eq 'NEEDS_CHECKIN') {
my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser,
$style);
- if ($target eq 'web') {
- $result .=
- &Apache::bridgetask::proctor_validation_screen($slot);
- } elsif ($target eq 'grade') {
- my $checkinresult = &Apache::bridgetask::proctor_check_auth($slot_name,$slot,
- 'problem');
- if ($checkinresult = /^error:/) {
- $result .= 'error';
- }
- }
+ $result .= &checkin_prompt($target,$slot_name,$slot,'problem');
} elsif ($target eq 'web') {
if ($status eq 'CAN_ANSWER') {
$resource_due = &Apache::lonhomework::due_date(0, $env{'request.symb'});
if ($slot_name ne '') {
- my $checked_in =
- $Apache::lonhomework::history{'resource.0.checkedin'};
- if ($checked_in eq '') {
- # unproctored slot access, self checkin
- my $needsiptied;
- if (ref($slot)) {
- $needsiptied = $slot->{'iptied'};
- }
- my $check = &Apache::bridgetask::check_in('problem',undef,undef,
- $slot_name,$needsiptied);
- if ($check =~ /^error: /) {
- &Apache::lonnet::logthis("Error during self-checkin of problem (symb: $env{'request.symb'}) using slot: $slot_name");
- } else {
- $checked_in =
- $Apache::lonhomework::results{"resource.0.checkedin"};
- }
- }
- if ((ref($slot) eq 'HASH') && ($checked_in ne '')) {
- if ($slot->{'starttime'} < time()) {
- if (!$resource_due) {
- $resource_due = $slot->{'endtime'};
- } elsif ($slot->{'endtime'} < $resource_due) {
- $resource_due = $slot->{'endtime'};
- }
- }
- }
+ $resource_due = &selfcheckin_resource($resource_due,$slot_name,$slot,
+ $env{'request.symb'});
}
if ($resource_due) {
my $time_left = $resource_due - time();
@@ -1749,9 +1939,13 @@ sub start_problem {
$result.= &problem_web_to_edit_header($env{'form.rndseed'});
}
if ($Apache::lonhomework::type eq 'practice') {
- $result.= ''.
- &practice_problem_header().'';
+ $result.= ''.
+ &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);
+ $result.=&randomizetry_problem_header($problemstatus,$reqtries);
}
}
# if we are viewing someone else preserve that info
@@ -1773,8 +1967,6 @@ sub start_problem {
} elsif ($target eq 'tex') {
$result .= 'INSERTTEXFRONTMATTERHERE';
$result .= &select_metadata_hyphenation();
-
-
}
} elsif ($target eq 'edit') {
$result .= $form_tag_start.&problem_edit_header();
@@ -2002,7 +2194,7 @@ sub end_problem {
@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");
@@ -2062,9 +2254,9 @@ sub start_library {
'';
$result.=&problem_web_to_edit_header($rndseed);
if ($Apache::lonhomework::type eq 'practice') {
- $result.= ''.
- &practice_problem_header().'';
+ $result.= ''.
+ &practice_problem_header().'';
}
}
return $result;
@@ -2079,6 +2271,9 @@ sub end_library {
&& ($#$tagstack eq 0 && $$tagstack[0] eq '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') {
&reset_problem_globals('library');
@@ -2561,7 +2756,12 @@ sub start_randomlist {
}
if (@randomlist) {
my @idx_arr = (0 .. $#randomlist);
- &Apache::structuretags::shuffle(\@idx_arr);
+ if ($env{'form.code_for_randomlist'}) {
+ &Apache::structuretags::shuffle(\@idx_arr,$target);
+ undef($env{'form.code_for_randomlist'});
+ } else {
+ &Apache::structuretags::shuffle(\@idx_arr);
+ }
my $bodytext = '';
my $show=$#randomlist;
my $showarg=&Apache::lonxml::get_param('show',$parstack,$safeeval);
@@ -2600,10 +2800,10 @@ sub start_randomlist {
}
sub shuffle {
- my $a=shift;
+ my ($a,$target) = @_;
my $i;
if (ref($a) eq 'ARRAY' && @$a) {
- &Apache::response::pushrandomnumber();
+ &Apache::response::pushrandomnumber(undef,$target);
for($i=@$a;--$i;) {
my $j=int(&Math::Random::random_uniform() * ($i+1));
next if $i == $j;
@@ -3104,7 +3304,7 @@ sub end_simpleeditbutton {
}
sub practice_problem_header {
- return '
'.&mt('Practice Problem').'
'.
+ return '
'.&mt('Practice Problem').'
'.
''.&mt('Submissions are not permanently recorded').
'';
}
@@ -3130,7 +3330,7 @@ sub randomizetry_problem_header {
$text = &mt('A new variation will be generated after each try until correct or tries limit is reached.');
}
}
- return '