[LON-CAPA-cvs] cvs: loncom /interface lonprintout.pm

sakharuk lon-capa-cvs@mail.lon-capa.org
Wed, 29 Oct 2003 18:30:07 -0000


sakharuk		Wed Oct 29 13:30:07 2003 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  Bug 2323 is fixed.
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.259 loncom/interface/lonprintout.pm:1.260
--- loncom/interface/lonprintout.pm:1.259	Mon Oct 27 14:01:31 2003
+++ loncom/interface/lonprintout.pm	Wed Oct 29 13:30:07 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.259 2003/10/27 19:01:31 sakharuk Exp $
+# $Id: lonprintout.pm,v 1.260 2003/10/29 18:30:07 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -865,7 +865,6 @@
 	    my $assignment=&Apache::lonxml::latex_special_symbols(&Apache::lonnet::gettitle($sequence),'header'); #tittle of the assignment which contains this problem
 	    if ($i==0) {$prevassignment=$assignment;}
 	    #&Apache::lonnet::logthis("Trying to get $urlp with symb $master_seq[$i]");
-	    $form{'freeze_counter'}='no';
 	    my $texversion.=&Apache::lonnet::ssi($urlp,%form);
 	    if ($urlp=~/\.page$/) {
 		($texversion,my $number_of_columns_page) = &page_cleanup($texversion);
@@ -873,13 +872,19 @@
 		$texversion =~ s/\\end{document}\d*/\\end{document}/;
 		$flag_page_in_sequence = 'YES';
 	    } 
+	    my $lonidsdir=$r->dir_config('lonIDsDir');
+	    my $envfile=$ENV{'user.environment'};
+	    $envfile=~/\/([^\/]+)\.id$/;
+            $envfile=$1;
+	    &Apache::lonnet::transfer_profile_to_env($lonidsdir,$envfile);
+	    my $current_counter=$ENV{'form.counter'};
 	    if(($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') ||
 	       ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) {
 		my %form;
 		$form{'grade_target'}='answer';
 		$form{'answer_output_mode'}='tex';
-		$form{'freeze_counter'}='yes';
 		my $answer=&Apache::lonnet::ssi($urlp,%form);
+                &Apache::lonnet::appenv(('form.counter' => $current_counter));
 		if ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') {
 		    $texversion=~s/(\\keephidden{ENDOFPROBLEM})/$answer$1/;
 		} else {
@@ -945,12 +950,19 @@
 		    if (&Apache::lonnet::allowed('bre',$res_url)) {
 			my $rendered = &Apache::loncommon::get_student_view($curresline,$username,$userdomain,
                                                                         $ENV{'request.course.id'},'tex');
+			my $lonidsdir=$r->dir_config('lonIDsDir');
+			my $envfile=$ENV{'user.environment'};
+			$envfile=~/\/([^\/]+)\.id$/;
+			$envfile=$1;
+			&Apache::lonnet::transfer_profile_to_env($lonidsdir,$envfile);
+			my $current_counter=$ENV{'form.counter'};
 			if(($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') ||
 			   ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) {
 			    my %form;
 			    $form{'answer_output_mode'}='tex';
 			    $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
 			    my $ansrendered = &Apache::loncommon::get_student_answers($curresline,$username,$userdomain,$ENV{'request.course.id'},%form);
+			    &Apache::lonnet::appenv(('form.counter' => $current_counter));
 			    if ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') {
 				$rendered=~s/(\\keephidden{ENDOFPROBLEM})/$ansrendered$1/;
 			    } else {