--- loncom/interface/lonprintout.pm 2010/03/30 10:40:35 1.568.2.3
+++ loncom/interface/lonprintout.pm 2010/12/05 17:25:10 1.568.4.3
@@ -2,7 +2,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.568.2.3 2010/03/30 10:40:35 foxr Exp $
+# $Id: lonprintout.pm,v 1.568.4.3 2010/12/05 17:25:10 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1309,7 +1309,7 @@ sub page_format_transformation {
$text =~ s/\\pagestyle{fancy}\\rhead{}\\chead{}\s*\\begin{document}/\\textheight = $textheight\\oddsidemargin = $evenoffset\n\\evensidemargin = $evenoffset $topmargintoinsert\\textwidth= $textwidth\\newlength{\\minipagewidth}\n\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\\renewcommand{\\ref}{\\keephidden\}\\pagestyle{fancy}\\rhead{}\\chead{}\\usepackage{booktabs}\\begin{document}\\voffset=-0\.8cm\n\\setcounter{page}{1} \\vskip 5 mm\n /;
}
if ($papersize eq 'a4') {
- $text =~ s/(\\begin{document})/$1\\\\special\{papersize=210mm,297mm\}/;
+ $text =~ s/(\\begin{document})/$1\\special{papersize=210mm,297mm}/;
}
}
if ($tableofcontents eq 'yes') {$text=~s/(\\setcounter\{page\}\{1\})/$1 \\tableofcontents\\newpage /;}
@@ -1581,7 +1581,7 @@ sub print_page_in_course {
$form{'grade_target'} = 'tex';
$form{'textwidth'} = &get_textwidth($helper, $LaTeXwidth);
- $form{'pdfFormFields'} = 'no';
+ $form{'pdfFormFiels'} = $pdfFormFields; #
$form{'showallfoils'} = $helper->{'VARS'}->{'showallfoils'};
$form{'problem_split'}=$parmhash{'problem_stream_switch'};
@@ -1890,7 +1890,7 @@ sub print_construction_sequence {
}
sub output_data {
- my ($r,$helper,$rparmhash) = @_;
+ my ($r,$helper,$rparmhash,$is_custom) = @_;
my %parmhash = %$rparmhash;
$ssi_error = 0; # This will be set nonzero by failing ssi's.
$resources_printed = '';
@@ -1931,6 +1931,11 @@ ENDPART
{'href' => '',
'text' => 'Preparing Printout'}];
+ if ($is_custom) {
+ $brcrum = [{'href' => '',
+ 'text' => 'Preparing Printout'}];
+ }
+
my $start_page = &Apache::loncommon::start_page('Preparing Printout',
$js,
{'bread_crumbs' => $brcrum,});
@@ -1972,7 +1977,7 @@ ENDPART
my %form;
$form{'grade_target'} = 'tex';
$form{'textwidth'} = &get_textwidth($helper, $LaTeXwidth);
- $form{'pdfFormFields'} = 'no';
+ $form{'pdfFormFields'} = $pdfFormFields;
# If form.showallfoils is set, then request all foils be shown:
# privilege will be enforced both by not allowing the
@@ -1992,7 +1997,6 @@ ENDPART
&Apache::lonnet::delenv('construct.style');
}
-
if ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'current_document') {
#-- single document - problem, page, html, xml, ...
my ($currentURL,$cleanURL);
@@ -2938,17 +2942,112 @@ sub handler {
&init_perm();
+ my ($helper,$is_custom);
+ if ((&Apache::loncommon::needs_gci_custom()) &&
+ ($env{'request.role.domain'} =~ /^\w+citest$/)) {
+ if ($r->header_only) {
+ if ($env{'browser.mathml'}) {
+ &Apache::loncommon::content_type($r,'text/xml');
+ } else {
+ &Apache::loncommon::content_type($r,'text/html');
+ }
+ $r->send_http_header;
+ return OK;
+ }
+ # Send header, nocache
+ if ($env{'browser.mathml'}) {
+ &Apache::loncommon::content_type($r,'text/xml');
+ } else {
+ &Apache::loncommon::content_type($r,'text/html');
+ }
+ &Apache::loncommon::no_cache($r);
+ $r->send_http_header;
+ $r->rflush();
-
- my $helper = printHelper($r);
- if (!ref($helper)) {
- return $helper;
+ my ($navmap_error,$resources,@master_seq);
+ my $navmap = Apache::lonnavmaps::navmap->new();
+ if (!defined($navmap)) {
+ my $brcrum = [{'href' => '',
+ 'text' => 'Preparing Printout'}];
+
+ my $start_page =
+ &Apache::loncommon::start_page('Preparing Printout','',
+ {'bread_crumbs' => $brcrum,});
+ my $endpage = &Apache::loncommon::end_page();
+
+ my $navmap_error = ''.&mt('An error occurred retrieving information about the course.').'
'.&mt('It is recommended that you re-select the concept test by clicking on the "Review Questions" tab and then clicking on the "Manage Tests" tab again.').'';
+ $r->print($start_page.$navmap_error.$endpage);
+ return OK;
+ } else {
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $sequence = &Apache::loncommon::get_citest_map($cdom);
+ my @allres;
+ if ($sequence) {
+ @allres=$navmap->retrieveResources('/uploaded/'.$cdom.'/'.$cnum.'/'.$sequence);
+ foreach my $resource (@allres) {
+ next if ($resource->is_map());
+ my $symb = $resource->symb();
+ push(@master_seq,$symb);
+ }
+ $resources = join('|||',@master_seq);
+ my ($sequence,$middle_thingy,$urlp) =
+ &Apache::lonnet::decode_symb($master_seq[0]);
+
+ my $assignment = &Apache::lonxml::latex_special_symbols(&Apache::lonnet::gettitle($sequence),'header');
+
+ $helper = {
+ VARS => {
+ ANON_CODE_STORAGE_NAME => '',
+ ANSWER_TYPE => 'yes',
+ CODE_OPTION => '',
+ EMPTY_PAGES => '',
+ FINISHPAGE => '',
+ FORMAT => 'P|1|letter|no',
+ LATEX_TYPE => 'batchmode',
+ NUMBER_TO_PRINT_TOTAL => '',
+ PRINT_ANNOTATIONS => 'no',
+ PRINT_DISCUSSIONS => 'no',
+ PRINT_TYPE => 'map_problems',
+ RESOURCES => $resources,
+ REUSE_OLD_CODES => '',
+ SEQUENCE => '',
+ SINGLE_CODE => '',
+ SPLIT_PDFS => '',
+ STUDENTS => '',
+ TABLE_CONTENTS => 'no',
+ TABLE_INDEX => 'no',
+ assignment => $assignment,
+ construction => '',
+ curseed => '',
+ filename => '',
+ fontsize => 'normalsize',
+ pagesize => '',
+ 'pagesize.height' => '9.8',
+ 'pagesize.heightunit' => 'in',
+ 'pagesize.lmargin' => '-0.57',
+ 'pagesize.lmarginunit' => 'in',
+ 'pagesize.width' => '7.1',
+ 'pagesize.widthunit' => 'in',
+ postdata => $urlp,
+ probstatus => '',
+ showallfoils => '',
+ student_sort => '',
+ style_file => '',
+ symb => $master_seq[0],
+ }
+ };
+ $env{'form.assignment'} = $assignment;
+ $is_custom = 1;
+ }
+ } else {
+ $helper = printHelper($r);
+ if (!ref($helper)) {
+ return $helper;
+ }
}
-
%parmhash=&Apache::lonnet::coursedescription($env{'request.course.id'});
-
-
# If a figure conversion queue file exists for this user.domain
@@ -2957,13 +3056,13 @@ sub handler {
my $conversion_queuefile = "/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.dat";
if(-e $conversion_queuefile) {
- unlink $conversion_queuefile;
+ unlink $conversion_queuefile;
}
-
- &output_data($r,$helper,\%parmhash);
+
+ &output_data($r,$helper,\%parmhash,$is_custom);
return OK;
-}
+}
use Apache::lonhelper;
@@ -4030,6 +4129,9 @@ sub render {
my $PaperType=&mt('Paper type');
my $landscape=&mt('Landscape');
my $portrait=&mt('Portrait');
+ my $pdfFormLabel=&mt('PDF-Formfields');
+ my $with=&mt('with Formfields');
+ my $without=&mt('without Formfields');
$result.='