--- loncom/interface/lonprintout.pm 2003/02/07 19:47:48 1.112
+++ loncom/interface/lonprintout.pm 2003/02/14 02:21:35 1.115
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.112 2003/02/07 19:47:48 sakharuk Exp $
+# $Id: lonprintout.pm,v 1.115 2003/02/14 02:21:35 bowersj2 Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1200,9 +1200,9 @@ sub page_format_transformation {
} else {
($textwidth,$textheight,$oddoffset,$evenoffset) = ($ENV{'form.width'},$ENV{'form.height'},$ENV{'form.leftmargin'},$ENV{'form.leftmargin'});
}
- my $firstname = &special_character_corrections(&Apache::lonnet::unescape($ENV{'environment.firstname'}));
- my $lastname = &special_character_corrections(&Apache::lonnet::unescape($ENV{'environment.lastname'}));
- my $courseidinfo = &special_character_corrections(&Apache::lonnet::unescape($ENV{'course.'.$ENV{'request.course.id'}.'.description'}));
+ my $firstname = &Apache::lonxml::latex_special_symbols(&Apache::lonnet::unescape($ENV{'environment.firstname'}),'','','header');
+ my $lastname = &Apache::lonxml::latex_special_symbols(&Apache::lonnet::unescape($ENV{'environment.lastname'}),'','','header');
+ my $courseidinfo = &Apache::lonxml::latex_special_symbols(&Apache::lonnet::unescape($ENV{'course.'.$ENV{'request.course.id'}.'.description'}),'','','header');
if ($layout eq 'CBI') {
$text =~ s/\\begin{document}/\\setlength{\\oddsidemargin}{$oddoffset}\\setlength{\\evensidemargin}{$evenoffset}\\setlength{\\topmargin}{200pt}\\setlength{\\textwidth}{$textwidth}\\setlength{\\textheight}{$textheight}\\setlength{\\parindent}{20pt}\\setlength{\\marginparwidth}{90pt}\\setlength{\\textfloatsep}{8pt plus 2\.0pt minus 4\.0pt}\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm} \\begin{document}\\setcounter{page}{1}\\noindent\\parbox{\\minipagewidth}{\\noindent\\fbox{\\textbf{$firstname $lastname}} \\hfill $courseidinfo} \\vskip 5 mm /;
} elsif ($layout eq 'CAPA') {
@@ -1255,15 +1255,6 @@ sub details_for_menu {
}
-sub special_character_corrections {
- my $argument = shift;
- $argument =~ s/_/ /g;
- $argument =~ s/\^/ /g;
- $argument =~ s/&/\\&/g;
- return $argument;
-}
-
-
sub latex_corrections {
my ($number_of_columns,$result) = @_;
@@ -1302,6 +1293,15 @@ sub handler {
my $r = shift;
+ # not sure where the form.* was getting processed.
+ Apache::loncommon::get_unprocessed_cgi($ENV{QUERY_STRING});
+
+ # A hook for me to work without disturbing Alex.
+ if ($ENV{'form.jeremy'}) {
+ printWizard($r);
+ return OK;
+ }
+
my $loaderror=&Apache::lonnet::overloaderror($r);
if ($loaderror) { return $loaderror; }
$loaderror=
@@ -1355,6 +1355,69 @@ sub handler {
}
+use Apache::lonwizard;
+
+sub printWizard {
+ my $r = shift;
+
+ if ($ENV{'request.course.id'}) {
+ my $fn=$ENV{'request.course.fn'};
+ tie(%hash,'GDBM_File',"$fn.db",&GDBM_READER(),0640);
+ }
+
+ if ($r->header_only) {
+ if ($ENV{'browser.mathml'}) {
+ $r->content_type('text/xml');
+ } else {
+ $r->content_type('text/html');
+ }
+ $r->send_http_header;
+ return OK;
+ }
+
+ # Send header, nocache
+ if ($ENV{'browser.mathml'}) {
+ $r->content_type('text/xml');
+ } else {
+ $r->content_type('text/html');
+ }
+ &Apache::loncommon::no_cache($r);
+ $r->send_http_header;
+ $r->rflush();
+
+ my ($resourceTitle,$sequenceTitle,$mapTitle) = &details_for_menu;
+
+ my $wizard = Apache::lonwizard->new("Printing Wizard");
+ # PRINT_TYPE: What the user wants to print (current docs,
+ # whole sequence, etc.
+ $wizard->declareVars(['PRINT_TYPE']);
+
+ my $subdir = $ENV{'form.postdata'};
+ $subdir =~ s|http://[^/]+||;
+ $subdir =~ m/\/([^\/]+)$/;
+ $subdir =~ s/\Q$1\E//;
+
+ # This code also shows up above... which is prefered? Is one
+ # right for this context?
+ #my $subdir = &Apache::lonnet::filelocation("",$ENV{'form.url'});
+ #$subdir =~ s/\/[^\/]+$//;
+
+ Apache::lonwizard::switch_state->new($wizard, "START", "Selecting Resources to Print", "PRINT_TYPE", [
+ ['current_document', "$resourceTitle (exactly what was on the screen)", 'CHOOSE_FORMAT'],
+ ['map_problems', "Problems from $sequenceTitle", 'CHOOSE_FORMAT'],
+ ['map_problems_pages', "All of $sequenceTitle", 'CHOOSE_FORMAT'],
+ ['problems_for_students', "Problems from $sequenceTitle for selected students", 'CHOOSE_FORMAT'],
+ ['problems_from_directory', "Problems from $subdir", 'CHOOSE_FORMAT'] ],
+ "What do you want to print?");
+
+ $r->print($wizard->display());
+
+ untie %hash;
+
+ return OK;
+
+}
+
1;
__END__