--- loncom/homework/lonhomework.pm 2007/11/03 00:52:06 1.282 +++ loncom/homework/lonhomework.pm 2007/11/17 02:51:29 1.285 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Homework handler # -# $Id: lonhomework.pm,v 1.282 2007/11/03 00:52:06 albertel Exp $ +# $Id: lonhomework.pm,v 1.285 2007/11/17 02:51:29 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -494,6 +494,10 @@ sub check_access { $Apache::lonhomework::history{"resource.$id.solved"}=~/^excused/) { $status = 'CANNOT_ANSWER'; } + if ($status eq 'CANNOT_ANSWER' + && &show_answer_problem_status()) { + $status = 'SHOW_ANSWER'; + } } if ($status eq 'CAN_ANSWER' || $status eq 'CANNOT_ANSWER') { my $interval=&Apache::lonnet::EXT("resource.$id.interval"); @@ -543,7 +547,8 @@ sub due_date { &Apache::lonxml::debug("looking for first_access $first_access"); if (defined($first_access)) { $interval = $first_access+$interval; - $date = ($interval < $due_date)? $interval : $due_date; + $date = (!$due_date || $interval < $due_date) ? $interval + : $due_date; } else { $date = $due_date; } @@ -683,9 +688,9 @@ sub handle_save_or_undo { my $error=0; if ($env{'form.Undo'} eq &mt('undo')) { my $error=0; - if (!copy($file,$filetmp)) { $error=1; } - if ((!$error) && (!copy($filebak,$file))) { $error=1; } - if ((!$error) && (!move($filetmp,$filebak))) { $error=1; } + if (!&File::Copy::copy($file,$filetmp)) { $error=1; } + if ((!$error) && (!&File::Copy::copy($filebak,$file))) { $error=1; } + if ((!$error) && (!&File::Copy::move($filetmp,$filebak))) { $error=1; } if (!$error) { &Apache::lonxml::info("

". &mt("Undid changes, Switched [_1] and [_2]", @@ -882,6 +887,7 @@ sub analyze { sub show_problem_status { return ($show_problem_status eq 'yes' + || $show_problem_status eq 'answer' || $show_problem_status eq ''); } @@ -892,6 +898,10 @@ sub analyze { sub show_no_problem_status { return ($show_problem_status eq 'no_feedback_ever'); } + + sub show_answer_problem_status { + return ($show_problem_status eq 'answer'); + } } sub editxmlmode {