[LON-CAPA-cvs] cvs: loncom /interface lonprintout.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 06 Dec 2005 16:23:27 -0000
albertel Tue Dec 6 11:23:27 2005 EDT
Modified files:
/loncom/interface lonprintout.pm
Log:
- fix the counter management in printout so that the counter will be correct during answer mode printing
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.402 loncom/interface/lonprintout.pm:1.403
--- loncom/interface/lonprintout.pm:1.402 Tue Dec 6 10:01:45 2005
+++ loncom/interface/lonprintout.pm Tue Dec 6 11:23:26 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.402 2005/12/06 15:01:45 albertel Exp $
+# $Id: lonprintout.pm,v 1.403 2005/12/06 16:23:26 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1100,6 +1100,7 @@
&Apache::lonnet::appenv(%moreenv);
&Apache::lonnet::delenv('form.counter');
&Apache::lonxml::init_counter();
+ &Apache::lonxml::store_counter();
$resources_printed .= $currentURL.':';
$texversion.=&Apache::lonnet::ssi($currentURL,%form);
&Apache::lonnet::delenv('form.counter');
@@ -1242,6 +1243,7 @@
my $prevassignment='';
&Apache::lonnet::delenv('form.counter');
&Apache::lonxml::init_counter();
+ &Apache::lonxml::store_counter();
for (my $i=0;$i<=$#master_seq;$i++) {
# Note due to document structure, not allowed to put \newpage
@@ -1262,6 +1264,7 @@
my $texversion='';
if ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) {
$resources_printed .= $urlp.':';
+ my $pre_counter=$env{'form.counter'};
$texversion.=&Apache::lonnet::ssi($urlp,%form);
if ($urlp=~/\.page$/) {
($texversion,my $number_of_columns_page) = &page_cleanup($texversion);
@@ -1269,11 +1272,9 @@
$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 ($envfile) = ($env{'user.environment'} =~m|/([^/]+)\.id$| );
+ &Apache::lonnet::transfer_profile_to_env($r->dir_config('lonIDsDir'),
+ $envfile);
my $current_counter=$env{'form.counter'};
if(($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') ||
($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) {
@@ -1282,6 +1283,7 @@
$answerform{'grade_target'}='answer';
$answerform{'answer_output_mode'}='tex';
$resources_printed .= $urlp.':';
+ &Apache::lonnet::appenv(('form.counter' => $pre_counter));
my $answer=&Apache::lonnet::ssi($urlp,%answerform);
&Apache::lonnet::appenv(('form.counter' => $current_counter));
if ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') {
@@ -1711,7 +1713,7 @@
#current student, and produces output
&Apache::lonnet::delenv('form.counter');
&Apache::lonxml::init_counter();
-
+ &Apache::lonxml::store_counter();
my %page_breaks = &get_page_breaks($helper);
foreach my $curresline (@{$master_seq}) {
@@ -1727,12 +1729,12 @@
if (&Apache::lonnet::allowed('bre',$res_url)) {
if ($res_url=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) {
$printed .= $curresline.':';
+ my $pre_counter=$env{'form.counter'};
my $rendered = &Apache::loncommon::get_student_view($curresline,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv);
- my $lonidsdir=$r->dir_config('lonIDsDir');
- my $envfile=$env{'user.environment'};
- $envfile=~/\/([^\/]+)\.id$/;
- $envfile=$1;
- &Apache::lonnet::transfer_profile_to_env($lonidsdir,$envfile);
+ my ($envfile) =
+ ( $env{'user.environment'} =~ m|/([^/]+)\.id$| );
+ &Apache::lonnet::transfer_profile_to_env($r->dir_config('lonIDsDir'),
+ $envfile);
my $current_counter=$env{'form.counter'};
if(($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') ||
($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) {
@@ -1740,6 +1742,7 @@
my %answerenv = %{$moreenv};
$answerenv{'answer_output_mode'}='tex';
$answerenv{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
+ &Apache::lonnet::appenv(('form.counter' => $pre_counter));
my $ansrendered = &Apache::loncommon::get_student_answers($curresline,$username,$userdomain,$env{'request.course.id'},%answerenv);
&Apache::lonnet::appenv(('form.counter' => $current_counter));
if ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') {
@@ -1760,11 +1763,10 @@
} elsif ($res_url=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) {
$printed .= $curresline.':';
my $rendered = &Apache::loncommon::get_student_view($curresline,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv);
- my $lonidsdir=$r->dir_config('lonIDsDir');
- my $envfile=$env{'user.environment'};
- $envfile=~/\/([^\/]+)\.id$/;
- $envfile=$1;
- &Apache::lonnet::transfer_profile_to_env($lonidsdir,$envfile);
+ my ($envfile) =
+ ( $env{'user.environment'} = ~m|/([^/]+)\.id$| );
+ &Apache::lonnet::transfer_profile_to_env($r->dir_config('lonIDsDir'),
+ $envfile);
my $current_counter=$env{'form.counter'};
if ($remove_latex_header eq 'YES') {
$rendered = &latex_header_footer_remove($rendered);