--- loncom/interface/lonprintout.pm 2005/03/29 10:21:21 1.372
+++ loncom/interface/lonprintout.pm 2005/06/04 20:52:37 1.376
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.372 2005/03/29 10:21:21 foxr Exp $
+# $Id: lonprintout.pm,v 1.376 2005/06/04 20:52:37 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -42,6 +42,8 @@ use Apache::lonratedt;
use POSIX qw(strftime);
use Apache::lonlocal;
+my $resources_printed = '';
+
# Compare two students by name. The students are in the form
# returned by the helper:
# user:domain:section:last, first:status
@@ -443,8 +445,8 @@ my %page_formats=
'2' => ['3.16 in','13 in','-0.57 in','-0.57 in','-0.5 in']
},
'album' => {
- '1' => [],
- '2' => []
+ '1' => ['12 in','7.1 in',,'-0.57 in','-0.57 in','-0.5 in'],
+ '2' => ['6.0 in','7.1 in','-1 in','-1 in','5 in']
},
},
'tabloid' => {
@@ -453,8 +455,8 @@ my %page_formats=
'2' => ['4.9 in','16 in','-0.57 in','-0.57 in','-0.5 in']
},
'album' => {
- '1' => [],
- '2' => []
+ '1' => ['16 in','9.8 in','-0.57 in','-0.57 in','-0.5 in'],
+ '2' => ['16 in','4.9 in','-0.57 in','-0.57 in','-0.5 in']
},
},
'executive' => {
@@ -534,8 +536,8 @@ sub page_format {
sub get_name {
my ($uname,$udom)=@_;
- if (!defined($uname)) { $uname=$ENV{'user.name'}; }
- if (!defined($udom)) { $udom=$ENV{'user.domain'}; }
+ if (!defined($uname)) { $uname=$env{'user.name'}; }
+ if (!defined($udom)) { $udom=$env{'user.domain'}; }
my $plainname=&Apache::loncommon::plainname($uname,$udom);
if ($plainname=~/^\s*$/) { $plainname=$uname.'@'.$udom; }
$plainname=&Apache::lonxml::latex_special_symbols($plainname,'header');
@@ -544,8 +546,8 @@ sub get_name {
sub get_course {
my $courseidinfo;
- if (defined($ENV{'request.course.id'})) {
- $courseidinfo = &Apache::lonxml::latex_special_symbols(&Apache::lonnet::unescape($ENV{'course.'.$ENV{'request.course.id'}.'.description'}),'header');
+ if (defined($env{'request.course.id'})) {
+ $courseidinfo = &Apache::lonxml::latex_special_symbols(&Apache::lonnet::unescape($env{'course.'.$env{'request.course.id'}.'.description'}),'header');
}
return $courseidinfo;
}
@@ -607,7 +609,7 @@ sub page_cleanup {
sub details_for_menu {
my ($helper)=@_;
- my $postdata=$ENV{'form.postdata'};
+ my $postdata=$env{'form.postdata'};
if (!$postdata) { $postdata=$helper->{VARS}{'postdata'}; }
my $name_of_resource = &Apache::lonnet::gettitle($postdata);
my $symbolic = &Apache::lonnet::symbread($postdata);
@@ -618,9 +620,9 @@ sub details_for_menu {
$map =~ m|([^/]+)$|;
$name_of_sequence = $1;
}
- my $name_of_map = &Apache::lonnet::gettitle($ENV{'request.course.uri'});
+ my $name_of_map = &Apache::lonnet::gettitle($env{'request.course.uri'});
if ($name_of_map =~ /^\s*$/) {
- $ENV{'request.course.uri'} =~ m|([^/]+)$|;
+ $env{'request.course.uri'} =~ m|([^/]+)$|;
$name_of_map = $1;
}
return ($name_of_resource,$name_of_sequence,$name_of_map);
@@ -695,7 +697,7 @@ sub IndexCreation {
sub print_latex_header {
my $mode=shift;
my $output='\documentclass[letterpaper]{article}';
- if (($mode eq 'batchmode') || (!$ENV{'request.role.adv'})) {
+ if (($mode eq 'batchmode') || (!$env{'request.role.adv'})) {
$output.='\batchmode';
}
$output.='\newcommand{\keephidden}[1]{}\renewcommand{\deg}{$^{\circ}$}'."\n".
@@ -846,8 +848,8 @@ ENDPART
# The page breaks will be pulled into the hash %page_breaks which is
# indexed by symb and contains 1's for each break.
- $ENV{'form.pagebreaks'} = $helper->{'VARS'}->{'FINISHPAGE'};
- $ENV{'form.lastprinttype'} = $helper->{'VARS'}->{'PRINT_TYPE'};
+ $env{'form.pagebreaks'} = $helper->{'VARS'}->{'FINISHPAGE'};
+ $env{'form.lastprinttype'} = $helper->{'VARS'}->{'PRINT_TYPE'};
&Apache::loncommon::store_course_settings('print',
{'pagebreaks' => 'scalar',
'lastprinttype' => 'scalar'});
@@ -865,7 +867,7 @@ ENDPART
$laystyle='book';
}
my ($textwidth,$textheight,$oddoffset,$evenoffset) = &page_format($papersize,$laystyle,$numberofcolumns);
- my $assignment = $ENV{'form.assignment'};
+ my $assignment = $env{'form.assignment'};
my $LaTeXwidth=&recalcto_mm($textwidth);
my @print_array=();
my @student_names=();
@@ -893,6 +895,7 @@ ENDPART
if ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'current_document') {
#-- single document - problem, page, html, xml, ...
my ($currentURL,$cleanURL);
+
if ($helper->{'VARS'}->{'construction'} ne '1') {
#prints published resource
$currentURL=$helper->{'VARS'}->{'postdata'};
@@ -912,8 +915,8 @@ ENDPART
$moreenv{'request.filename'}=$cleanURL;
if ($helper->{'VARS'}->{'style_file'}=~/\w/) {
$moreenv{'construct.style'}=$helper->{'VARS'}->{'style_file'};
- my $dom = $ENV{'user.domain'};
- my $user = $ENV{'user.name'};
+ my $dom = $env{'user.domain'};
+ my $user = $env{'user.name'};
my $put_result = &Apache::lonnet::put('environment',{'construct.style'=>$helper->{'VARS'}->{'style_file'}},$dom,$user);
}
if ($helper->{'VARS'}->{'probstatus'} eq 'exam') {$form{'problemtype'}='exam';}
@@ -929,6 +932,7 @@ ENDPART
&Apache::lonnet::appenv(%moreenv);
&Apache::lonnet::delenv('form.counter');
&Apache::lonxml::init_counter();
+ $resources_printed .= $currentURL.':';
$texversion.=&Apache::lonnet::ssi($currentURL,%form);
&Apache::lonnet::delenv('form.counter');
&Apache::lonnet::delenv('request.filename');
@@ -939,6 +943,7 @@ ENDPART
$form{'grade_target'}='answer';
$form{'answer_output_mode'}='tex';
$form{'rndseed'}=$rndseed;
+ $resources_printed .= $currentURL.':';
my $answer=&Apache::lonnet::ssi($currentURL,%form);
if ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') {
$texversion=~s/(\\keephidden{ENDOFPROBLEM})/$answer$1/;
@@ -986,6 +991,7 @@ ENDPART
$form{'suppress_tries'}=$parmhash{'suppress_tries'};
$form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
$form{'rndseed'}=$rndseed;
+ $resources_printed .=$urlp.':';
$texversion=&Apache::lonnet::ssi($urlp,%form);
}
if((($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') ||
@@ -995,7 +1001,8 @@ ENDPART
$form{'answer_output_mode'}='tex';
$form{'rndseed'}=$rndseed;
$form{'problem_split'}=$parmhash{'problem_stream_switch'};
- if ($urlp=~/\/res\//) {$ENV{'request.state'}='published';}
+ if ($urlp=~/\/res\//) {$env{'request.state'}='published';}
+ $resources_printed .= $urlp.':';
my $answer=&Apache::lonnet::ssi($urlp,%form);
if ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') {
$texversion=~s/(\\keephidden{ENDOFPROBLEM})/$answer$1/;
@@ -1028,6 +1035,7 @@ ENDPART
} elsif ($cleanURL=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) {
$form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
if ($currentURL=~/\/syllabus$/) {$currentURL=~s/\/res//;}
+ $resources_printed .= $currentURL.':';
my $texversion=&Apache::lonnet::ssi($currentURL,%form);
$result .= $texversion;
} else {
@@ -1080,6 +1088,7 @@ ENDPART
if ($i==0) {$prevassignment=$assignment;}
my $texversion='';
if ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) {
+ $resources_printed .= $urlp.':';
$texversion.=&Apache::lonnet::ssi($urlp,%form);
if ($urlp=~/\.page$/) {
($texversion,my $number_of_columns_page) = &page_cleanup($texversion);
@@ -1088,15 +1097,16 @@ ENDPART
$flag_page_in_sequence = 'YES';
}
my $lonidsdir=$r->dir_config('lonIDsDir');
- my $envfile=$ENV{'user.environment'};
+ my $envfile=$env{'user.environment'};
$envfile=~/\/([^\/]+)\.id$/;
$envfile=$1;
&Apache::lonnet::transfer_profile_to_env($lonidsdir,$envfile);
- my $current_counter=$ENV{'form.counter'};
+ my $current_counter=$env{'form.counter'};
if(($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') ||
($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) {
$form{'grade_target'}='answer';
$form{'answer_output_mode'}='tex';
+ $resources_printed .= $urlp.':';
my $answer=&Apache::lonnet::ssi($urlp,%form);
&Apache::lonnet::appenv(('form.counter' => $current_counter));
if ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') {
@@ -1132,6 +1142,7 @@ ENDPART
} elsif ($urlp=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) {
$form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
if ($urlp=~/\/syllabus$/) {$urlp=~s/\/res//;}
+ $resources_printed .= $urlp.':';
my $texversion=&Apache::lonnet::ssi($urlp,%form);
if ($flag_latex_header_remove ne 'NO') {
$texversion = &latex_header_footer_remove($texversion);
@@ -1200,18 +1211,19 @@ ENDPART
my $student_counter=-1;
foreach my $person (@students) {
- my $duefile="/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout.due";
+ my $duefile="/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.due";
if (-e $duefile) {
my $temp_file = Apache::File->new('>>'.$duefile);
print $temp_file "1969\n";
}
$student_counter++;
my $i=int($student_counter/$helper->{'VARS'}{'NUMBER_TO_PRINT'});
- my ($output,$fullname)=&print_resources($r,$helper,
+ my ($output,$fullname, $printed)=&print_resources($r,$helper,
$person,$type,
\%moreenv,\@master_seq,
$flag_latex_header_remove,
$LaTeXwidth);
+ $resources_printed .= ":";
$print_array[$i].=$output;
$student_names[$i].=$person.':'.$fullname.'_END_';
&Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,&mt('last student').' '.$fullname);
@@ -1222,8 +1234,8 @@ ENDPART
$result .= $print_array[0].' \end{document}';
} elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_for_anon') ||
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'resources_for_anon') ) {
- my $cdom =$ENV{'course.'.$ENV{'request.course.id'}.'.domain'};
- my $cnum =$ENV{'course.'.$ENV{'request.course.id'}.'.num'};
+ my $cdom =$env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $cnum =$env{'course.'.$env{'request.course.id'}.'.num'};
my $num_todo=$helper->{'VARS'}->{'NUMBER_TO_PRINT_TOTAL'};
my $code_name=$helper->{'VARS'}->{'ANON_CODE_STORAGE_NAME'};
my $old_name=$helper->{'VARS'}->{'REUSE_OLD_CODES'};
@@ -1260,10 +1272,11 @@ ENDPART
foreach my $code (sort(@allcodes)) {
my $file_num=int($count/$number_per_page);
$moreenv{'CODE'}=&num_to_letters($code);
- my ($output,$fullname)=
+ my ($output,$fullname, $printed)=
&print_resources($r,$helper,'anonymous',$type,\%moreenv,
\@master_seq,$flag_latex_header_remove,
$LaTeXwidth);
+ $resources_printed .= ":";
$print_array[$file_num].=$output;
&Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,
&mt('last assignment').' '.$fullname);
@@ -1294,6 +1307,7 @@ ENDPART
} else {
$urlp =~ s|^$Apache::lonnet::perlvar{'lonDocRoot'}||;
}
+ $resources_printed .= $urlp.':';
my $texversion=&Apache::lonnet::ssi($urlp,%form);
if(($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') ||
($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) {
@@ -1301,6 +1315,7 @@ ENDPART
$form{'answer_output_mode'}='tex';
$form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
$form{'rndseed'}=$rndseed;
+ $resources_printed .= $urlp.':';
my $answer=&Apache::lonnet::ssi($urlp,%form);
if ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') {
$texversion=~s/(\\keephidden{ENDOFPROBLEM})/$answer$1/;
@@ -1357,7 +1372,7 @@ ENDPART
#-- writing .tex file in prtspool
my $temp_file;
my $identifier = &Apache::loncommon::get_cgi_id();
- my $filename = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout_".$identifier.".tex";
+ my $filename = "/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout_".$identifier.".tex";
if (!($#print_array>0)) {
unless ($temp_file = Apache::File->new('>'.$filename)) {
$r->log_error("Couldn't open $filename for output $!");
@@ -1397,9 +1412,9 @@ ENDPART
if ($#student_names>-1) {
$student_names=$student_names[0].'_ENDPERSON_';
} else {
- my $fullname = &get_name($ENV{'user.name'},$ENV{'user.domain'});
- $student_names=join(':',$ENV{'user.name'},$ENV{'user.domain'},
- $ENV{'request.course.sec'},$fullname).
+ my $fullname = &get_name($env{'user.name'},$env{'user.domain'});
+ $student_names=join(':',$env{'user.name'},$env{'user.domain'},
+ $env{'request.course.sec'},$fullname).
'_ENDPERSON_'.'_END_';
}
}
@@ -1416,19 +1431,27 @@ ENDPART
$URLback=~s|^/~|/priv/|;
}
}
-
+ # logic for now is too complex to trace if this has been defined
+ # yet.
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
&Apache::lonnet::appenv('cgi.'.$identifier.'.file' => $filename,
'cgi.'.$identifier.'.layout' => $laystyle,
'cgi.'.$identifier.'.numcol' => $numberofcolumns,
'cgi.'.$identifier.'.paper' => $papersize,
'cgi.'.$identifier.'.selection' => $selectionmade,
- 'cgi.'.$identifier.'tableofcontents' => $helper->{'VARS'}->{'TABLE_CONTENTS'},
- 'cgi.'.$identifier.'tableofindex' => $helper->{'VARS'}->{'TABLE_INDEX'},
- 'cgi.'.$identifier.'role' => $ENV{'request.role.adv'},
- 'cgi.'.$identifier.'numberoffiles' => $#print_array,
- 'cgi.'.$identifier.'studentnames' => $student_names,
- 'cgi.'.$identifier.'backref' => $URLback,);
-
+ 'cgi.'.$identifier.'.tableofcontents' => $helper->{'VARS'}->{'TABLE_CONTENTS'},
+ 'cgi.'.$identifier.'.tableofindex' => $helper->{'VARS'}->{'TABLE_INDEX'},
+ 'cgi.'.$identifier.'.role' => $env{'request.role.adv'},
+ 'cgi.'.$identifier.'.numberoffiles' => $#print_array,
+ 'cgi.'.$identifier.'.studentnames' => $student_names,
+ 'cgi.'.$identifier.'.backref' => $URLback,);
+ &Apache::lonnet::appenv("cgi.$identifier.user" => $env{'user.name'},
+ "cgi.$identifier.domain" => $env{'user.domain'},
+ "cgi.$identifier.courseid" => $cnum,
+ "cgi.$identifier.coursedom" => $cdom,
+ "cgi.$identifier.resources" => $resources_printed);
+
$r->print(<
@@ -1464,6 +1487,7 @@ sub print_resources {
my ($r,$helper,$person,$type,$moreenv,$master_seq,$remove_latex_header,
$LaTeXwidth)=@_;
my $current_output = '';
+ my $printed = '';
my ($username,$userdomain,$usersection) = split /:/,$person;
my $fullname = &get_name($username,$userdomain);
my $namepostfix;
@@ -1491,18 +1515,19 @@ sub print_resources {
my ($map,$id,$res_url) = &Apache::lonnet::decode_symb($curresline);
if (&Apache::lonnet::allowed('bre',$res_url)) {
if ($res_url=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) {
- my $rendered = &Apache::loncommon::get_student_view($curresline,$username,$userdomain,$ENV{'request.course.id'},'tex',$moreenv);
+ $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'};
+ my $envfile=$env{'user.environment'};
$envfile=~/\/([^\/]+)\.id$/;
$envfile=$1;
&Apache::lonnet::transfer_profile_to_env($lonidsdir,$envfile);
- my $current_counter=$ENV{'form.counter'};
+ my $current_counter=$env{'form.counter'};
if(($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') ||
($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) {
$moreenv->{'answer_output_mode'}='tex';
$moreenv->{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
- my $ansrendered = &Apache::loncommon::get_student_answers($curresline,$username,$userdomain,$ENV{'request.course.id'},%{$moreenv});
+ my $ansrendered = &Apache::loncommon::get_student_answers($curresline,$username,$userdomain,$env{'request.course.id'},%{$moreenv});
&Apache::lonnet::appenv(('form.counter' => $current_counter));
if ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') {
$rendered=~s/(\\keephidden{ENDOFPROBLEM})/$ansrendered$1/;
@@ -1520,13 +1545,14 @@ sub print_resources {
}
$current_output .= $rendered;
} elsif ($res_url=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) {
- my $rendered = &Apache::loncommon::get_student_view($curresline,$username,$userdomain,$ENV{'request.course.id'},'tex',$moreenv);
+ $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'};
+ my $envfile=$env{'user.environment'};
$envfile=~/\/([^\/]+)\.id$/;
$envfile=$1;
&Apache::lonnet::transfer_profile_to_env($lonidsdir,$envfile);
- my $current_counter=$ENV{'form.counter'};
+ my $current_counter=$env{'form.counter'};
if ($remove_latex_header eq 'YES') {
$rendered = &latex_header_footer_remove($rendered);
} else {
@@ -1558,7 +1584,7 @@ sub print_resources {
for (my $j=0;$j<$helper->{'VARS'}->{'EMPTY_PAGES'};$j++) {$blankpages.='\clearpage\strut\clearpage';}
$current_output = '\strut\vspace*{-6 mm}\\newline\\noindent\\makebox[\\textwidth/$number_of_columns][b]{\\hrulefill}\vspace*{-2 mm}\\newline\\noindent{\\tiny Printed from LON-CAPA\\copyright MSU{\\hfill} Licensed under GNU General Public License }\\newpage '.$blankpages.'\setcounter{page}{1}\noindent\parbox{\minipagewidth}{\noindent\\lhead{\\textit{\\textbf{'.$fullname.'}}'.$courseidinfo.' \\hfill \\thepage \\\\ \\textit{'.$currentassignment.'}'.$namepostfix.'}} \vskip 5 mm '.$current_output;
}
- return ($current_output,$fullname);
+ return ($current_output,$fullname, $printed);
}
@@ -1571,7 +1597,7 @@ sub handler {
# if ($loaderror) { return $loaderror; }
# $loaderror=
# &Apache::lonnet::overloaderror($r,
-# $ENV{'course.'.$ENV{'request.course.id'}.'.home'});
+# $env{'course.'.$env{'request.course.id'}.'.home'});
# if ($loaderror) { return $loaderror; }
my $result = printHelper($r);
@@ -1584,12 +1610,12 @@ sub handler {
# foreach $key (keys %{$helper->{'VARS'}}) {
# $r->print(' '.$key.'->'.$helper->{'VARS'}->{$key}.'<- ');
# }
-# foreach $key (keys %ENV) {
-# $r->print(' '.$key.'->'.$ENV{$key}.'<- ');
+# foreach $key (keys %env) {
+# $r->print(' '.$key.'->'.$env{$key}.'<- ');
# }
# return OK;
- my %parmhash=&Apache::lonnet::coursedescription($ENV{'request.course.id'});
+ my %parmhash=&Apache::lonnet::coursedescription($env{'request.course.id'});
# my $key;
# foreach $key (keys %parmhash) {
@@ -1602,7 +1628,7 @@ sub handler {
# we delete it since it can only be bad (if it were good, printout.pl
# would have deleted it the last time around.
- my $conversion_queuefile = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout.dat";
+ my $conversion_queuefile = "/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.dat";
if(-e $conversion_queuefile) {
unlink $conversion_queuefile;
}
@@ -1625,7 +1651,7 @@ sub printHelper {
my $r = shift;
if ($r->header_only) {
- if ($ENV{'browser.mathml'}) {
+ if ($env{'browser.mathml'}) {
&Apache::loncommon::content_type($r,'text/xml');
} else {
&Apache::loncommon::content_type($r,'text/html');
@@ -1635,7 +1661,7 @@ sub printHelper {
}
# Send header, nocache
- if ($ENV{'browser.mathml'}) {
+ if ($env{'browser.mathml'}) {
&Apache::loncommon::content_type($r,'text/xml');
} else {
&Apache::loncommon::content_type($r,'text/html');
@@ -1665,8 +1691,8 @@ sub printHelper {
# The page breaks can get loaded initially from the course environment:
- if((!defined($ENV{"form.CURRENT_STATE"})) ||
- ($ENV{'form.CURRENT_STATE'} == "START")) {
+ if((!defined($env{"form.CURRENT_STATE"})) ||
+ ($env{'form.CURRENT_STATE'} == "START")) {
$helper->{VARS}->{FINISHPAGE} = ""; # In case they did a back e.g.
}
@@ -1677,33 +1703,33 @@ sub printHelper {
'lastprinttype' => 'scalar'});
- if("$helper->{VARS}->{PRINT_TYPE}" eq "$ENV{'form.lastprinttype'}") {
- $helper->{VARS}->{FINISHPAGE} = $ENV{'form.pagebreaks'};
+ if("$helper->{VARS}->{PRINT_TYPE}" eq "$env{'form.lastprinttype'}") {
+ $helper->{VARS}->{FINISHPAGE} = $env{'form.pagebreaks'};
}
# This will persistently load in the data we want from the
# very first screen.
# Detect whether we're coming from construction space
- if ($ENV{'form.postdata'}=~/^(?:http:\/\/[^\/]+\/|\/|)\~([^\/]+)\/(.*)$/) {
+ if ($env{'form.postdata'}=~/^(?:http:\/\/[^\/]+\/|\/|)\~([^\/]+)\/(.*)$/) {
$helper->{VARS}->{'filename'} = "~$1/$2";
$helper->{VARS}->{'construction'} = 1;
} else {
- if ($ENV{'form.postdata'}) {
- $helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($ENV{'form.postdata'});
+ if ($env{'form.postdata'}) {
+ $helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($env{'form.postdata'});
}
- if ($ENV{'form.symb'}) {
- $helper->{VARS}->{'symb'} = $ENV{'form.symb'};
+ if ($env{'form.symb'}) {
+ $helper->{VARS}->{'symb'} = $env{'form.symb'};
}
- if ($ENV{'form.url'}) {
+ if ($env{'form.url'}) {
$helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($helper->{VARS}->{'postdata'});
}
}
- if ($ENV{'form.symb'}) {
- $helper->{VARS}->{'symb'} = $ENV{'form.symb'};
+ if ($env{'form.symb'}) {
+ $helper->{VARS}->{'symb'} = $env{'form.symb'};
}
- if ($ENV{'form.url'}) {
+ if ($env{'form.url'}) {
$helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($helper->{VARS}->{'postdata'});
}
@@ -1735,17 +1761,17 @@ sub printHelper {
}
$subdir = &Apache::lonnet::filelocation("", $url);
}
- if (!$helper->{VARS}->{'curseed'} && $ENV{'form.curseed'}) {
- $helper->{VARS}->{'curseed'}=$ENV{'form.curseed'};
+ if (!$helper->{VARS}->{'curseed'} && $env{'form.curseed'}) {
+ $helper->{VARS}->{'curseed'}=$env{'form.curseed'};
}
- if (!$helper->{VARS}->{'probstatus'} && $ENV{'form.problemtype'}) {
- $helper->{VARS}->{'probstatus'}=$ENV{'form.problemtype'};
+ if (!$helper->{VARS}->{'probstatus'} && $env{'form.problemtype'}) {
+ $helper->{VARS}->{'probstatus'}=$env{'form.problemtype'};
}
my $userCanSeeHidden = Apache::lonnavmaps::advancedUser();
- my $userPriviledged = ($ENV{'request.role'}=~m/^cc\./ or
- $ENV{'request.role'}=~m/^in\./ or
- $ENV{'request.role'}=~m/^ta\./);
+ my $userPriviledged = ($env{'request.role'}=~m/^cc\./ or
+ $env{'request.role'}=~m/^in\./ or
+ $env{'request.role'}=~m/^ta\./);
Apache::lonhelper::registerHelperTags();
@@ -1897,8 +1923,8 @@ RESOURCE_SELECTOR
CHOOSE_STUDENTS
- my $cdom = $ENV{'course.'.$ENV{'request.course.id'}.'.domain'};
- my $cnum = $ENV{'course.'.$ENV{'request.course.id'}.'.num'};
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
my @names=&Apache::lonnet::getkeys('CODEs',$cdom,$cnum);
my $namechoice='';
foreach my $name (sort {uc($a) cmp uc($b)} @names) {
@@ -2003,7 +2029,7 @@ CHOOSE_ANON2
}
# FIXME: That RE should come from a library somewhere.
- if ((((&Apache::lonnet::allowed('bre',$subdir) eq 'F') and ($helper->{VARS}->{'postdata'}=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)/)) or defined $helper->{'VARS'}->{'construction'}) and $ENV{'request.role.adv'} and $subdir ne $Apache::lonnet::perlvar{'lonDocRoot'}.'/res/') {
+ if ((((&Apache::lonnet::allowed('bre',$subdir) eq 'F') and ($helper->{VARS}->{'postdata'}=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)/)) or defined $helper->{'VARS'}->{'construction'}) and $env{'request.role.adv'} and $subdir ne $Apache::lonnet::perlvar{'lonDocRoot'}.'/res/') {
push @{$printChoices}, ["".&mt('Problems')." ".&mt('from current subdirectory')." $subdir", 'problems_from_directory', 'CHOOSE_FROM_SUBDIR'];
my $f = '$filename';
@@ -2073,7 +2099,7 @@ CHOOSE_FROM_ANY_SEQUENCE
my $startedTable = 0; # have we started an HTML table yet? (need
# to close it later)
- if (($ENV{'request.role.adv'} and &Apache::lonnet::allowed('vgr',$ENV{'request.course.id'})) or
+ if (($env{'request.role.adv'} and &Apache::lonnet::allowed('vgr',$env{'request.course.id'})) or
($helper->{VARS}->{'construction'} eq '1')) {
addMessage("
Print:
");
$paramHash = Apache::lonhelper::getParamHash();
@@ -2089,7 +2115,7 @@ CHOOSE_FROM_ANY_SEQUENCE
$startedTable = 1;
}
- if ($ENV{'request.role.adv'}) {
+ if ($env{'request.role.adv'}) {
if (!$startedTable) {
addMessage("
LaTeX mode:
");
$startedTable = 1;
@@ -2142,7 +2168,7 @@ CHOOSE_FROM_ANY_SEQUENCE
# If advanced roles, then allow to show all foils.
- if ($ENV{'request.role.adv'}) {
+ if ($env{'request.role.adv'}) {
addMessage("
");
$paramHash = Apache::lonhelper::getParamHash();
$paramHash->{'multichoice'} = "true";
@@ -2156,7 +2182,7 @@ CHOOSE_FROM_ANY_SEQUENCE
}
if ($helper->{'VARS'}->{'construction'}) {
- my $stylevalue=$ENV{'construct.style'};
+ my $stylevalue=$env{'construct.style'};
my $xmlfrag .= <<"RNDSEED";