[LON-CAPA-cvs] cvs: loncom /interface lonprintout.pm
foxr
lon-capa-cvs@mail.lon-capa.org
Mon, 02 May 2005 11:23:23 -0000
This is a MIME encoded message
--foxr1115033003
Content-Type: text/plain
foxr Mon May 2 07:23:23 2005 EDT
Modified files:
/loncom/interface lonprintout.pm
Log:
Add additional environment stuff so that printout.pl can send messages
to course coordinators on student print failures.
--foxr1115033003
Content-Type: text/plain
Content-Disposition: attachment; filename="foxr-20050502072323.txt"
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.374 loncom/interface/lonprintout.pm:1.375
--- loncom/interface/lonprintout.pm:1.374 Thu Apr 7 03:03:23 2005
+++ loncom/interface/lonprintout.pm Mon May 2 07:23:22 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.374 2005/04/07 07:03:23 albertel Exp $
+# $Id: lonprintout.pm,v 1.375 2005/05/02 11:23:22 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -42,6 +42,8 @@
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
@@ -893,6 +895,7 @@
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'};
@@ -929,6 +932,7 @@
&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 @@
$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 @@
$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') ||
@@ -996,6 +1002,7 @@
$form{'rndseed'}=$rndseed;
$form{'problem_split'}=$parmhash{'problem_stream_switch'};
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 @@
} 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 @@
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);
@@ -1097,6 +1106,7 @@
($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 @@
} 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);
@@ -1207,11 +1218,12 @@
}
$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);
@@ -1260,10 +1272,11 @@
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 @@
} 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 @@
$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/;
@@ -1416,19 +1431,27 @@
$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(<<FINALEND);
<br />
<meta http-equiv="Refresh" content="0; url=/cgi-bin/printout.pl?$identifier" />
@@ -1464,6 +1487,7 @@
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,6 +1515,7 @@
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)$/) {
+ $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'};
@@ -1520,6 +1545,7 @@
}
$current_output .= $rendered;
} 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'};
@@ -1558,7 +1584,7 @@
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);
}
--foxr1115033003--