'.
&Apache::loncommon::help_open_topic('Problem_Editor_XML_Index',
'Problem Editing Help').' | '.
&Apache::loncommon::help_open_faq(5).
@@ -200,13 +201,23 @@ sub problem_edit_footer {
';
}
+sub option {
+ my ($value,$name) = @_;
+ my $result ="
+ ".&option('CAN_ANSWER' ,'problemstate').&mt("Answerable")."
+ ".&option('CANNOT_ANSWER_tries' ,'problemstate').&mt("Open with full tries")."
+ ".&option('CANNOT_ANSWER_correct','problemstate').&mt("Open and correct")."
+ ".&option('SHOW_ANSWER' ,'problemstate').&mt("Show Answer")."
+
+
+
+Problem Type:
+
+
+
+Feedback Mode:
+
+
+
+ ";
my $numtoanalyze=$ENV{'form.numtoanalyze'};
if (!$numtoanalyze) { $numtoanalyze=20; }
$result.= '';
my $msg=$body_tag_start;
if ($status eq 'UNAVAILABLE') {
- $result.=''.&mt('Unable to determine if this resource is open due to network problems. Please try again later.').'';
+ $msg.=''.&mt('Unable to determine if this resource is open due to network problems. Please try again later.').'';
} else {
- $result.=''.&mt('Not open to be viewed').'';
+ $msg.=''.&mt('Not open to be viewed').'';
}
if ($status eq 'CLOSED' || $status eq 'INVALID_ACCESS') {
$msg.='The problem '.$accessmsg;
@@ -523,7 +590,7 @@ sub end_problem {
if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ||
$target eq 'tex') {
if ( $target eq 'grade' && $Apache::inputtags::part eq '0' &&
- $status eq 'CAN_ANSWER' ) {
+ ($status eq 'CAN_ANSWER' || $Apache::lonhomework::scantronmode)) {
# if part is zero, no s existed, so we need to the grading
&Apache::inputtags::grade;
} elsif ( ($target eq 'web' || $target eq 'tex') &&
@@ -590,7 +657,10 @@ sub end_problem {
sub start_library {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
my ($result,$head_tag_start,$body_tag_start,$form_tag_start);
- if ($$tagstack[0] eq 'library') { &init_problem_globals('library') };
+ if ($$tagstack[0] eq 'library') {
+ &init_problem_globals('library');
+ $Apache::lonhomework::type='problem';
+ }
if ($target eq 'edit') {
($result,$head_tag_start,$body_tag_start,$form_tag_start)=
&page_start($target,$token,$tagstack,$parstack,$parser,$safeeval);
@@ -934,8 +1004,7 @@ sub start_part {
@Apache::inputtags::response=();
@Apache::inputtags::previous=();
@Apache::inputtags::previous_version=();
- $Apache::lonhomework::problemstatus=
- &Apache::lonnet::EXT("resource.$id.problemstatus");
+ $Apache::lonhomework::problemstatus=&get_problem_status($id);
my $hidden=&Apache::loncommon::check_if_partid_hidden($Apache::inputtags::part);
my $expression='$external::part=\''.$Apache::inputtags::part.'\';';
&Apache::run::run($expression,$safeeval);
@@ -954,6 +1023,9 @@ sub start_part {
my $expression='$external::datestatus="'.$status.'";';
$expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.$id.solved"}.'";';
&Apache::run::run($expression,$safeeval);
+ if ($ENV{'request.state'} eq 'construct') {
+ &set_problem_state($Apache::inputtags::part);
+ }
if (( $status eq 'CLOSED' ) ||
( $status eq 'UNCHECKEDOUT') ||
( $status eq 'BANNED') ||
@@ -984,6 +1056,8 @@ sub start_part {
}
}
if (($Apache::lonhomework::type eq 'exam') && ($allow_print_points)) { $result .= '\fbox{\textit{'.$weight.' pt}}';}
+ } elsif ($target eq 'web') {
+ $result.='';
}
}
}
@@ -1015,7 +1089,9 @@ sub end_part {
my $result='';
if ( $target eq 'meta' ) {
$result='';
- } elsif ( $target eq 'grade' && $status eq 'CAN_ANSWER' && !$hidden) {
+ } elsif ($target eq 'grade' &&
+ ($status eq 'CAN_ANSWER' || $Apache::lonhomework::scantronmode) &&
+ !$hidden) {
$result=&Apache::inputtags::grade;
} elsif (($target eq 'web' || $target eq 'tex') && !$hidden ) {
my $gradestatus=&Apache::inputtags::gradestatus($Apache::inputtags::part,
@@ -1035,9 +1111,10 @@ sub end_part {
sub start_preduedate {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex') {
+ &Apache::lonxml::debug("State in preduedate is ". $Apache::inputtags::status['-1']);
if ($Apache::inputtags::status['-1'] ne 'CAN_ANSWER' &&
- $Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER' &&
- $Apache::inputtags::status['-1'] ne 'SHOW_ANSWER') {
+ $Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER') {
+ &Apache::lonxml::debug("Wha? ". ($Apache::inputtags::status['-1'] ne 'SHOW_ANSWER'));
&Apache::lonxml::get_all_text("/preduedate",$parser);
}
}
@@ -1050,12 +1127,12 @@ sub end_preduedate {
sub start_postanswerdate {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
- if ($target eq 'web' || $target eq 'grade' || $target eq 'tex') {
+ if ($target eq 'web' || $target eq 'grade') {
if ($Apache::inputtags::status['-1'] ne 'SHOW_ANSWER') {
&Apache::lonxml::get_all_text("/postanswerdate",$parser);
}
} elsif ($target eq 'tex') {
- return '\vskip 0 mm \noindent';
+ &Apache::lonxml::get_all_text("/postanswerdate",$parser);
}
return '';
}
@@ -1070,7 +1147,8 @@ sub start_notsolved {
$target eq 'tex') {
my $gradestatus=$Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"};
&Apache::lonxml::debug("not solved has :$gradestatus:");
- if ($gradestatus =~ /^correct/) {
+ if ($gradestatus =~ /^correct/ &&
+ &Apache::response::show_answer()) {
&Apache::lonxml::debug("skipping");
&Apache::lonxml::get_all_text("/notsolved",$parser);
}
@@ -1087,7 +1165,8 @@ sub start_solved {
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
$target eq 'tex') {
my $gradestatus=$Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"};
- if ($gradestatus !~ /^correct/) {
+ if ($gradestatus !~ /^correct/ ||
+ !&Apache::response::show_answer()) {
&Apache::lonxml::get_all_text("/solved",$parser);
}
}
|