--- loncom/homework/structuretags.pm 2003/05/13 20:38:55 1.171 +++ loncom/homework/structuretags.pm 2003/05/23 16:26:28 1.177 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.171 2003/05/13 20:38:55 sakharuk Exp $ +# $Id: structuretags.pm,v 1.177 2003/05/23 16:26:28 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -146,8 +146,13 @@ sub setup_rndseed { $ENV{'form.rndseed'}=$rndseed; } } - if ($ENV{'form.resetdata'} eq 'New Problem Variation') { + if ($ENV{'form.resetdata'} eq 'New Problem Variation' || + $ENV{'form.newrandomization'} eq 'New Randomization') { $rndseed=time; + if ($rndseed eq $ENV{'form.rndseed'}) { + srand($rndseed); + $rndseed=int(rand(1000000000)); + } $ENV{'form.rndseed'}=$rndseed; } &Apache::lonxml::debug("Setting rndseed to $rndseed"); @@ -177,19 +182,24 @@ sub problem_web_to_edit_header { my $result.=' - Random Seed: - + + + for
'; + $numtoanalyze.'" size="5" /> versions of this problem.'. + &Apache::loncommon::help_open_topic("Analyze_Problem", + '',undef,undef,300). + '
'; return $result; } @@ -264,7 +274,9 @@ sub start_problem { } #initialize globals $Apache::inputtags::part='0'; + @Apache::inputtags::partlist=('0'); @Apache::inputtags::responselist = (); + @Apache::inputtags::importlist = (); @Apache::inputtags::previous=(); @Apache::inputtags::previous_version=(); $Apache::structuretags::printanswer='No'; @@ -480,8 +492,9 @@ sub end_problem { ($target eq 'answer') || ($target eq 'tex') ) { if ($status eq 'CAN_ANSWER') { - if ($target ne 'tex') { - if ($ENV{'form.print_answer'} ne 'yes') {$result.="\n";} + if ($target ne 'tex' && + $ENV{'form.answer_output_mode'} ne 'tex') { + $result.="\n"; } } elsif ($status eq 'SHOW_ANSWER' || $status eq 'CANNOT_ANSWER' || $status eq 'UNCHECKEDOUT' ) { @@ -492,7 +505,7 @@ sub end_problem { if ($target eq 'web') { $result.=&Apache::lonxml::xmlend(); } elsif ($target eq 'tex') { - $result .= '\vskip 0.5mm\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}'; + $result .= '\keephidden{ENDOFPROBLEM}\vskip 0.5mm\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}'; if (not $ENV{'request.symb'} =~ m/\.page_/) { $result .= '\end{minipage}\end{document} '; } else { @@ -504,11 +517,10 @@ sub end_problem { &Apache::lonhomework::showhash(%Apache::lonhomework::results); &finalize_storage(); } - if ($target eq 'answer' && ($ENV{'request.state'} eq 'construct') ) { - if ($ENV{'form.print_answer'} ne 'yes') { - $result.=''; #normally we get it from xmlend, but in CSTR - # we always show answer mode too. - } + if ($target eq 'answer' && ($ENV{'request.state'} eq 'construct') + && $ENV{'form.answer_output_mode'} ne 'tex') { + $result.=''; # normally we get it from xmlend, but in CSTR + # we always show answer mode too. } } elsif ($target eq 'meta') { if ($Apache::inputtags::part eq '0') { @@ -519,6 +531,9 @@ sub end_problem { $result = &problem_edit_footer(); } + if ($ENV{'request.state'} eq 'construct' && $target eq 'web') { + &Apache::inputtags::check_for_duplicate_ids(); + } undef(%Apache::lonhomework::history); undef(%Apache::lonhomework::results); undef($Apache::inputtags::part); @@ -844,7 +859,8 @@ sub start_part { my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval); if ($id eq '') { $id = $Apache::lonxml::curdepth; } $Apache::inputtags::part=$id; - @Apache::inputtags::responselist = (); + push(@Apache::inputtags::partlist,$id); + @Apache::inputtags::response=(); @Apache::inputtags::previous=(); @Apache::inputtags::previous_version=(); $Apache::lonhomework::problemstatus=