version 1.226, 2003/11/21 20:21:20
|
version 1.245, 2004/03/09 20:37:58
|
Line 37 use Apache::lonnet;
|
Line 37 use Apache::lonnet;
|
use Apache::File(); |
use Apache::File(); |
use Apache::lonmenu; |
use Apache::lonmenu; |
use Apache::lonlocal; |
use Apache::lonlocal; |
|
use Apache::lonxml; |
|
|
BEGIN { |
BEGIN { |
&Apache::lonxml::register('Apache::structuretags',('block','languageblock','instructorcomment','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','startouttext','endouttext', |
&Apache::lonxml::register('Apache::structuretags',('block','languageblock','instructorcomment','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','startouttext','endouttext', |
Line 119 sub page_start {
|
Line 120 sub page_start {
|
$body_tag_start.=$help; |
$body_tag_start.=$help; |
} |
} |
} |
} |
|
$body_tag_start.=&Apache::lonxml::message_location(); |
} |
} |
my $form_tag_start; |
my $form_tag_start; |
if (!defined($found{'form'})) { |
if (!defined($found{'form'})) { |
Line 157 sub setup_rndseed {
|
Line 159 sub setup_rndseed {
|
$rndseed=$Apache::lonhomework::history{'rndseed'}; |
$rndseed=$Apache::lonhomework::history{'rndseed'}; |
if (!$rndseed) { |
if (!$rndseed) { |
$rndseed=time; |
$rndseed=time; |
$ENV{'form.rndseed'}=$rndseed; |
|
} |
} |
|
$ENV{'form.rndseed'}=$rndseed; |
} |
} |
if ($ENV{'form.resetdata'} eq &mt('New Problem Variation') || |
if ($ENV{'form.resetdata'} eq &mt('New Problem Variation') || |
$ENV{'form.newrandomization'} eq &mt('New Randomization')) { |
$ENV{'form.newrandomization'} eq &mt('New Randomization')) { |
Line 182 sub setup_rndseed {
|
Line 184 sub setup_rndseed {
|
sub problem_edit_header { |
sub problem_edit_header { |
return '<input type="hidden" name="submitted" value="edit" /> |
return '<input type="hidden" name="submitted" value="edit" /> |
<input type="hidden" name="problemmode" value="'.&mt('Edit').'" /> |
<input type="hidden" name="problemmode" value="'.&mt('Edit').'" /> |
<input type="submit" name="problemmode" value="'.&mt('Discard Edits and View').'" /> |
<input type="submit" name="problemmode" accesskey="d" value="'.&mt('Discard Edits and View').'" /> |
<input type="submit" name="problemmode" value="'.&mt('EditXML').'" /> |
<input type="submit" name="problemmode" accesskey="x" value="'.&mt('EditXML').'" /> |
<input type="submit" name="Undo" value="'.&mt('undo').'" /> <hr /> |
<input type="submit" name="Undo" accesskey="u" value="'.&mt('undo').'" /> <hr /> |
<input type="submit" name="submit" value="'.&mt('Submit Changes and Edit').'" /> |
<input type="submit" name="submit" accesskey="s" value="'.&mt('Submit Changes and Edit').'" /> |
<input type="submit" name="submit" value="'.&mt('Submit Changes and View').'" /><br /><p> </p><table border="0"><tr><td bgcolor="#DDDDDD"> |
<input type="submit" name="submit" accesskey="v" value="'.&mt('Submit Changes and View').'" /><table><tr><td>'. |
'; |
&Apache::loncommon::help_open_topic('Problem_Editor_XML_Index', |
|
'Problem Editing Help').'</td><td>'. |
|
&Apache::loncommon::help_open_faq(5). |
|
&Apache::loncommon::help_open_bug('Authoring').'</td></tr></table>'. |
|
'<table border="0"><tr><td bgcolor="#DDDDDD">'; |
} |
} |
|
|
sub problem_edit_footer { |
sub problem_edit_footer { |
Line 195 sub problem_edit_footer {
|
Line 201 sub problem_edit_footer {
|
<input type="submit" name="submit" value="'.&mt('Submit Changes and View').'" />'; |
<input type="submit" name="submit" value="'.&mt('Submit Changes and View').'" />'; |
} |
} |
|
|
|
sub option { |
|
my ($value,$name) = @_; |
|
my $result ="<option value='".$value."' "; |
|
if ($ENV{'form.'.$name} eq $value) { |
|
$result.=" selected='on' "; |
|
} |
|
$result.='>'; |
|
return $result; |
|
} |
|
|
sub problem_web_to_edit_header { |
sub problem_web_to_edit_header { |
my ($rndseed)=@_; |
my ($rndseed)=@_; |
my $result.='<input type="hidden" name="problemmode" value="'.&mt('View').'" /> |
my $result.='<input type="hidden" name="problemmode" value="'.&mt('View').'" /> |
<input type="submit" name="problemmode" value="'.&mt('Edit').'" /> |
<input type="submit" name="problemmode" accesskey="e" value="'.&mt('Edit').'" /> |
<input type="submit" name="problemmode" value="'.&mt('EditXML').'" /> |
<input type="submit" name="problemmode" accesskey="x" value="'.&mt('EditXML').'" /> |
<input type="submit" name="newrandomization" value="'.&mt('New Randomization').'" /> |
<input type="submit" name="newrandomization" accesskey="a" value="'.&mt('New Randomization').'" /> |
<input type="submit" name="resetdata" value="'.&mt('Reset Submissions').'" /> |
<input type="submit" name="resetdata" accesskey="r" value="'.&mt('Reset Submissions').'" /> |
<nobr><input type="submit" name="changerandseed" value="'.&mt('Change Random Seed To:').'" /> |
<nobr><input type="submit" name="changerandseed" value="'.&mt('Change Random Seed To:').'" /> |
<input type="text" name="rndseed" width="10" value="'. |
<input type="text" name="rndseed" width="10" value="'. |
$rndseed.'" |
$rndseed.'" |
onChange="javascript:document.lonhomework.changerandseed.click()" /></nobr> |
onChange="javascript:document.lonhomework.changerandseed.click()" /></nobr> |
<input type="checkbox" name="showallfoils" '; |
<input type="checkbox" name="showallfoils" '; |
if (defined($ENV{'form.showallfoils'})) { $result.='checked="on"'; } |
if (defined($ENV{'form.showallfoils'})) { $result.='checked="on"'; } |
$result.= ' />'.&mt(' Show All Foils').' |
$result.= ' />'.&mt(' Show All Foils'). |
<hr />'; |
&Apache::loncommon::help_open_topic('Problem_Editor_Testing_Area','Testing Problems'). |
|
'<hr />'; |
|
$result.=" |
|
<nobr> |
|
Problem Status: |
|
<select name='problemstate'> |
|
<option name=''></option> |
|
".&option('CLOSED' ,'problemstate').&mt("Closed")."</option> |
|
".&option('CAN_ANSWER' ,'problemstate').&mt("Answerable")."</option> |
|
".&option('CANNOT_ANSWER_tries' ,'problemstate').&mt("Open with full tries")."</option> |
|
".&option('CANNOT_ANSWER_correct','problemstate').&mt("Open and correct")."</option> |
|
".&option('SHOW_ANSWER' ,'problemstate').&mt("Show Answer")."</option> |
|
</select> |
|
</nobr> |
|
<nobr> |
|
Problem Type: |
|
<select name='problemtype'> |
|
<option name=''></option> |
|
".&option('exam' ,'problemtype').&mt("Exam Problem")."</option> |
|
".&option('problem','problemtype').&mt("Homework problem")."</option> |
|
".&option('survey' ,'problemtype').&mt("Survey Question")."</option> |
|
</select> |
|
</nobr> |
|
<nobr> |
|
Feedback Mode: |
|
<select name='problemstatus'> |
|
<option value=''></option> |
|
".&option('yes','problemstatus').&mt("Show Feedback")."</option> |
|
".&option('no', 'problemstatus').&mt("Don't Show Feedback")."</option> |
|
</select> |
|
</nobr> |
|
<input type='submit' name='changeproblemmode' value='".&mt("Change")."' /> |
|
<hr />"; |
my $numtoanalyze=$ENV{'form.numtoanalyze'}; |
my $numtoanalyze=$ENV{'form.numtoanalyze'}; |
if (!$numtoanalyze) { $numtoanalyze=20; } |
if (!$numtoanalyze) { $numtoanalyze=20; } |
$result.= '<input type="submit" name="problemmode" value='. |
$result.= '<input type="submit" name="problemmode" value='. |
Line 289 sub init_problem_globals {
|
Line 337 sub init_problem_globals {
|
if ($type eq 'problem') { |
if ($type eq 'problem') { |
$Apache::inputtags::part='0'; |
$Apache::inputtags::part='0'; |
@Apache::inputtags::partlist=('0'); |
@Apache::inputtags::partlist=('0'); |
$Apache::lonhomework::problemstatus= |
|
&Apache::lonnet::EXT('resource.0.problemstatus'); |
$Apache::lonhomework::problemstatus=&get_problem_status('0') |
} else { |
} else { |
$Apache::inputtags::part=''; |
$Apache::inputtags::part=''; |
@Apache::inputtags::partlist=(); |
@Apache::inputtags::partlist=(); |
Line 320 sub reset_problem_globals {
|
Line 368 sub reset_problem_globals {
|
undef($Apache::lonhomework::name); |
undef($Apache::lonhomework::name); |
} |
} |
|
|
|
sub set_problem_state { |
|
my ($part)=@_; |
|
if ($ENV{'form.problemstate'} eq 'CANNOT_ANSWER_correct') { |
|
$Apache::lonhomework::history{"resource.$part.solved"}= |
|
'correct_by_student'; |
|
} |
|
} |
|
|
|
sub get_problem_status { |
|
my ($part)=@_; |
|
my $problem_status=&Apache::lonnet::EXT("resource.$part.problemstatus"); |
|
&Apache::lonxml::debug("problem status for $part is $problem_status"); |
|
&Apache::lonxml::debug("env probstat is ".$ENV{'form.problemstatus'}); |
|
if ($ENV{'request.state'} eq 'construct' && |
|
defined($ENV{'form.problemstatus'})) { |
|
$problem_status=$ENV{'form.problemstatus'}; |
|
} |
|
return $problem_status; |
|
} |
|
|
sub start_problem { |
sub start_problem { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
|
|
Line 342 sub start_problem {
|
Line 410 sub start_problem {
|
if ($target eq 'web') { |
if ($target eq 'web') { |
&Apache::lonhomework::showhash(%Apache::lonhomework::history); |
&Apache::lonhomework::showhash(%Apache::lonhomework::history); |
} |
} |
|
if ($ENV{'request.state'} eq 'construct') { &set_problem_state('0'); } |
$Apache::lonhomework::type=&Apache::lonnet::EXT('resource.0.type'); |
$Apache::lonhomework::type=&Apache::lonnet::EXT('resource.0.type'); |
&Apache::lonxml::debug("Found this to be of type :$Apache::lonhomework::type:"); |
if (($ENV{'request.state'} eq 'construct') && |
|
defined($ENV{'form.problemtype'})) { |
|
$Apache::lonhomework::type=$ENV{'form.problemtype'}; |
|
} |
|
&Apache::lonxml::debug("Found this to be of type :$Apache::ltonhomework::type:"); |
} |
} |
if ($Apache::lonhomework::type eq '' ) { |
if ($Apache::lonhomework::type eq '' ) { |
my $uri=$ENV{'request.uri'}; |
my $uri=$ENV{'request.uri'}; |
Line 409 sub start_problem {
|
Line 482 sub start_problem {
|
$result.= $head_tag_start.'</head>'; |
$result.= $head_tag_start.'</head>'; |
my $msg=$body_tag_start; |
my $msg=$body_tag_start; |
if ($status eq 'UNAVAILABLE') { |
if ($status eq 'UNAVAILABLE') { |
$result.='<h1>'.&mt('Unable to determine if this resource is open due to network problems. Please try again later.').'</h1>'; |
$msg.='<h1>'.&mt('Unable to determine if this resource is open due to network problems. Please try again later.').'</h1>'; |
} else { |
} else { |
$result.='<h1>'.&mt('Not open to be viewed').'</h1>'; |
$msg.='<h1>'.&mt('Not open to be viewed').'</h1>'; |
} |
} |
if ($status eq 'CLOSED' || $status eq 'INVALID_ACCESS') { |
if ($status eq 'CLOSED' || $status eq 'INVALID_ACCESS') { |
$msg.='The problem '.$accessmsg; |
$msg.='The problem '.$accessmsg; |
Line 429 sub start_problem {
|
Line 502 sub start_problem {
|
} |
} |
} elsif ($target eq 'web') { |
} elsif ($target eq 'web') { |
my $name= &get_resource_name($parstack,$safeeval); |
my $name= &get_resource_name($parstack,$safeeval); |
if ($status eq 'CAN_ANSWER') { |
$result.="$head_tag_start<title>$name</title></head> |
# create a page header and exit |
|
$result.="$head_tag_start<title>$name</title></head> |
|
$body_tag_start \n $form_tag_start". |
$body_tag_start \n $form_tag_start". |
'<input type="hidden" name="submitted" value="yes" />'; |
'<input type="hidden" name="submitted" value="yes" />'; |
if ($ENV{'request.state'} eq "construct") { |
# create a page header and exit |
$result.= &problem_web_to_edit_header($ENV{'form.rndseed'}); |
if ($ENV{'request.state'} eq "construct") { |
} |
$result.= &problem_web_to_edit_header($ENV{'form.rndseed'}); |
# if we are viewing someone else preserve that info |
} |
if (defined $ENV{'form.grade_symb'}) { |
# if we are viewing someone else preserve that info |
foreach my $field ('symb','courseid','domain','username') { |
if (defined $ENV{'form.grade_symb'}) { |
$result .= '<input type="hidden" name="grade_'.$field. |
foreach my $field ('symb','courseid','domain','username') { |
'" value="'.$ENV{"form.grade_$field"}.'" />'."\n"; |
$result .= '<input type="hidden" name="grade_'.$field. |
} |
'" value="'.$ENV{"form.grade_$field"}.'" />'."\n"; |
} |
} |
} elsif ($status eq 'SHOW_ANSWER' || $status eq 'CANNOT_ANSWER' |
|
|| $status eq 'CLOSED' || $status eq 'UNAVALAILABLE' || |
|
$status eq 'INVALID_ACCESS') { |
|
$result.=$head_tag_start. |
|
"<title>$name</title></head>\n$body_tag_start\n"; |
|
} |
} |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
my $startminipage = ''; |
my $startminipage = ''; |
Line 461 sub start_problem {
|
Line 527 sub start_problem {
|
my @packages = split /,/,$packages; |
my @packages = split /,/,$packages; |
my $allow_print_points = 0; |
my $allow_print_points = 0; |
foreach my $partial_key (@packages) { |
foreach my $partial_key (@packages) { |
if ($partial_key=~m/part_0/) { |
if ($partial_key=~m/^part_0$/) { |
$allow_print_points=1; |
$allow_print_points=1; |
} |
} |
} |
} |
Line 477 sub start_problem {
|
Line 543 sub start_problem {
|
my @due_file_content = <$temp_file>; |
my @due_file_content = <$temp_file>; |
my $due_file_content = $due_file_content[$#due_file_content]; |
my $due_file_content = $due_file_content[$#due_file_content]; |
chomp $due_file_content; |
chomp $due_file_content; |
my $name_of_resourse= &get_resource_name($parstack,$safeeval); |
my $name_of_resourse= &Apache::lonxml::latex_special_symbols(&get_resource_name($parstack,$safeeval)); |
if ($due_file_content ne $duedate) { |
if ($due_file_content ne $duedate) { |
$temp_file = Apache::File->new('>'.$filename); |
$temp_file = Apache::File->new('>'.$filename); |
print $temp_file "$duedate\n"; |
print $temp_file "$duedate\n"; |
Line 524 sub end_problem {
|
Line 590 sub end_problem {
|
if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || |
if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || |
$target eq 'tex') { |
$target eq 'tex') { |
if ( $target eq 'grade' && $Apache::inputtags::part eq '0' && |
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 <part>s existed, so we need to the grading |
# if part is zero, no <part>s existed, so we need to the grading |
&Apache::inputtags::grade; |
&Apache::inputtags::grade; |
} elsif ( ($target eq 'web' || $target eq 'tex') && |
} elsif ( ($target eq 'web' || $target eq 'tex') && |
Line 539 sub end_problem {
|
Line 605 sub end_problem {
|
(($target eq 'web') && ($ENV{'request.state'} ne 'construct')) || |
(($target eq 'web') && ($ENV{'request.state'} ne 'construct')) || |
($target eq 'answer') || ($target eq 'tex') |
($target eq 'answer') || ($target eq 'tex') |
) { |
) { |
if ($status eq 'CAN_ANSWER') { |
if ($target ne 'tex' && |
if ($target ne 'tex' && |
$ENV{'form.answer_output_mode'} ne 'tex') { |
$ENV{'form.answer_output_mode'} ne 'tex') { |
$result.="</form></body>\n"; |
$result.="</form></body>\n"; |
|
} |
|
} elsif ($status eq 'SHOW_ANSWER' || $status eq 'CANNOT_ANSWER' || |
|
$status eq 'UNCHECKEDOUT' || $status eq 'INVALID_ACCESS') { |
|
if ($target ne 'tex' && |
|
$ENV{'form.answer_output_mode'} ne 'tex') { |
|
$result.="</body>\n"; |
|
} |
|
} |
} |
if ($target eq 'web') { |
if ($target eq 'web') { |
$result.=&Apache::lonxml::xmlend(); |
$result.=&Apache::lonxml::xmlend(); |
Line 599 sub end_problem {
|
Line 657 sub end_problem {
|
sub start_library { |
sub start_library { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($result,$head_tag_start,$body_tag_start,$form_tag_start); |
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') { |
if ($target eq 'edit') { |
($result,$head_tag_start,$body_tag_start,$form_tag_start)= |
($result,$head_tag_start,$body_tag_start,$form_tag_start)= |
&page_start($target,$token,$tagstack,$parstack,$parser,$safeeval); |
&page_start($target,$token,$tagstack,$parstack,$parser,$safeeval); |
Line 943 sub start_part {
|
Line 1004 sub start_part {
|
@Apache::inputtags::response=(); |
@Apache::inputtags::response=(); |
@Apache::inputtags::previous=(); |
@Apache::inputtags::previous=(); |
@Apache::inputtags::previous_version=(); |
@Apache::inputtags::previous_version=(); |
$Apache::lonhomework::problemstatus= |
$Apache::lonhomework::problemstatus=&get_problem_status($id); |
&Apache::lonnet::EXT("resource.$id.problemstatus"); |
|
my $hidden=&Apache::loncommon::check_if_partid_hidden($Apache::inputtags::part); |
my $hidden=&Apache::loncommon::check_if_partid_hidden($Apache::inputtags::part); |
my $expression='$external::part=\''.$Apache::inputtags::part.'\';'; |
my $expression='$external::part=\''.$Apache::inputtags::part.'\';'; |
&Apache::run::run($expression,$safeeval); |
&Apache::run::run($expression,$safeeval); |
Line 963 sub start_part {
|
Line 1023 sub start_part {
|
my $expression='$external::datestatus="'.$status.'";'; |
my $expression='$external::datestatus="'.$status.'";'; |
$expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.$id.solved"}.'";'; |
$expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.$id.solved"}.'";'; |
&Apache::run::run($expression,$safeeval); |
&Apache::run::run($expression,$safeeval); |
|
if ($ENV{'request.state'} eq 'construct') { |
|
&set_problem_state($Apache::inputtags::part); |
|
} |
if (( $status eq 'CLOSED' ) || |
if (( $status eq 'CLOSED' ) || |
( $status eq 'UNCHECKEDOUT') || |
( $status eq 'UNCHECKEDOUT') || |
( $status eq 'BANNED') || |
( $status eq 'BANNED') || |
Line 984 sub start_part {
|
Line 1047 sub start_part {
|
$result.='\noindent \end{minipage}\vskip 0 mm \noindent \begin{minipage}{\textwidth}\noindent'; |
$result.='\noindent \end{minipage}\vskip 0 mm \noindent \begin{minipage}{\textwidth}\noindent'; |
} |
} |
my $weight = &Apache::lonnet::EXT("resource.$id.weight"); |
my $weight = &Apache::lonnet::EXT("resource.$id.weight"); |
my $allkeys=&Apache::lonnet::metadata($ENV{'request.uri'},'keys'); |
my $allkeys=&Apache::lonnet::metadata($ENV{'request.uri'},'packages'); |
my @allkeys = split /,/,$allkeys; |
my @allkeys = split /,/,$allkeys; |
my $allow_print_points = 0; |
my $allow_print_points = 0; |
foreach my $partial_key (@allkeys) { |
foreach my $partial_key (@allkeys) { |
if ($partial_key=~m/\_(\d*)\_weight/) { |
if ($partial_key=~m/^part_(.*)$/) { |
if ($1 ne '0') {$allow_print_points=1;} |
if ($1 ne '0') {$allow_print_points=1;} |
} |
} |
} |
} |
if (($Apache::lonhomework::type eq 'exam') && ($allow_print_points)) { $result .= '\fbox{\textit{'.$weight.' pt}}';} |
if (($Apache::lonhomework::type eq 'exam') && ($allow_print_points)) { $result .= '\fbox{\textit{'.$weight.' pt}}';} |
|
} elsif ($target eq 'web') { |
|
$result.='<a name="'.&Apache::lonnet::escape($Apache::inputtags::part).'" />'; |
} |
} |
} |
} |
} |
} |
Line 1024 sub end_part {
|
Line 1089 sub end_part {
|
my $result=''; |
my $result=''; |
if ( $target eq 'meta' ) { |
if ( $target eq 'meta' ) { |
$result=''; |
$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; |
$result=&Apache::inputtags::grade; |
} elsif (($target eq 'web' || $target eq 'tex') && !$hidden ) { |
} elsif (($target eq 'web' || $target eq 'tex') && !$hidden ) { |
my $gradestatus=&Apache::inputtags::gradestatus($Apache::inputtags::part, |
my $gradestatus=&Apache::inputtags::gradestatus($Apache::inputtags::part, |
Line 1044 sub end_part {
|
Line 1111 sub end_part {
|
sub start_preduedate { |
sub start_preduedate { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex') { |
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' && |
if ($Apache::inputtags::status['-1'] ne 'CAN_ANSWER' && |
$Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER' && |
$Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER') { |
$Apache::inputtags::status['-1'] ne 'SHOW_ANSWER') { |
&Apache::lonxml::debug("Wha? ". ($Apache::inputtags::status['-1'] ne 'SHOW_ANSWER')); |
&Apache::lonxml::get_all_text("/preduedate",$parser); |
&Apache::lonxml::get_all_text("/preduedate",$parser); |
} |
} |
} |
} |
Line 1059 sub end_preduedate {
|
Line 1127 sub end_preduedate {
|
|
|
sub start_postanswerdate { |
sub start_postanswerdate { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
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') { |
if ($Apache::inputtags::status['-1'] ne 'SHOW_ANSWER') { |
&Apache::lonxml::get_all_text("/postanswerdate",$parser); |
&Apache::lonxml::get_all_text("/postanswerdate",$parser); |
} |
} |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
return '\vskip 0 mm \noindent'; |
&Apache::lonxml::get_all_text("/postanswerdate",$parser); |
} |
} |
return ''; |
return ''; |
} |
} |
Line 1079 sub start_notsolved {
|
Line 1147 sub start_notsolved {
|
$target eq 'tex') { |
$target eq 'tex') { |
my $gradestatus=$Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"}; |
my $gradestatus=$Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"}; |
&Apache::lonxml::debug("not solved has :$gradestatus:"); |
&Apache::lonxml::debug("not solved has :$gradestatus:"); |
if ($gradestatus =~ /^correct/) { |
if ($gradestatus =~ /^correct/ && |
|
&Apache::response::show_answer()) { |
&Apache::lonxml::debug("skipping"); |
&Apache::lonxml::debug("skipping"); |
&Apache::lonxml::get_all_text("/notsolved",$parser); |
&Apache::lonxml::get_all_text("/notsolved",$parser); |
} |
} |
Line 1096 sub start_solved {
|
Line 1165 sub start_solved {
|
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || |
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || |
$target eq 'tex') { |
$target eq 'tex') { |
my $gradestatus=$Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"}; |
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); |
&Apache::lonxml::get_all_text("/solved",$parser); |
} |
} |
} |
} |