[LON-CAPA-cvs] cvs: loncom /interface lonprintout.pm
sakharuk
lon-capa-cvs@mail.lon-capa.org
Fri, 05 Sep 2003 18:43:43 -0000
sakharuk Fri Sep 5 14:43:43 2003 EDT
Modified files:
/loncom/interface lonprintout.pm
Log:
The first variant of module which allows you to print the content of sequence from the construction space. Currently 1. Only published resources are printed; 2.The content of sequences/pages which can be parts of primary sequence is not printed et all (according Gerd's desire) - instead you have the path to the sequence/page; 3. There are some unfinished small chunks for example I need to draw lines after all resources (not only after problems); 4. There is probably neccessity to change a little bit interface (starting menu) for printing to take into account some additional desires of author (of the sequence).
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.226 loncom/interface/lonprintout.pm:1.227
--- loncom/interface/lonprintout.pm:1.226 Thu Sep 4 22:25:30 2003
+++ loncom/interface/lonprintout.pm Fri Sep 5 14:43:43 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.226 2003/09/05 02:25:30 albertel Exp $
+# $Id: lonprintout.pm,v 1.227 2003/09/05 18:43:43 sakharuk Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -49,6 +49,7 @@
use Apache::edit;
use Apache::File();
use Apache::lonnavmaps;
+use Apache::lonratedt;
use POSIX qw(strftime);
use GDBM_File;
@@ -698,8 +699,51 @@
if ($currentURL=~m/\.page\s*$/) {
($result,$number_of_columns) = &page_cleanup($result);
}
+ } elsif ($currentURL=~/\.sequence$/ && $helper->{'VARS'}->{'construction'} eq '1') {
+ #printing content of sequence from the construction space
+ my $flag_latex_header_remove = 'NO';
+ my $rndseed=time;
+ $currentURL=~s|\/~([^\/]+)\/|\/home\/$1\/public_html\/|;
+ my $errtext=&Apache::lonratedt::mapread($currentURL);
+ for (my $member=0;$member<=$#Apache::lonratedt::order;$member++) {
+ $Apache::lonratedt::resources[$Apache::lonratedt::order[$member]]=~/^([^:]*):([^:]*):/;
+ my $urlp=$2;
+ if ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library|xml|html|htm|xhtml|xhtm)$/) {
+ my %form;
+ $form{'grade_target'}='tex';
+ $form{'textwidth'}=$LaTeXwidth;
+ $form{'rndseed'}=$rndseed;
+ my $texversion=&Apache::lonnet::ssi($urlp,%form);
+ if($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') {
+ my %form;
+ $form{'grade_target'}='answer';
+ $form{'answer_output_mode'}='tex';
+ $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
+ $form{'rndseed'}=$rndseed;
+ my $answer=&Apache::lonnet::ssi($urlp,%form);
+ $texversion=~s/(\\keephidden{ENDOFPROBLEM})/$answer$1/;
+ }
+ if ($flag_latex_header_remove ne 'NO') {
+ $texversion = &latex_header_footer_remove($texversion);
+ } else {
+ $texversion =~ s/\\end{document}//;
+ }
+ if ($helper->{'VARS'}->{'TABLE_INDEX'} eq 'yes') {
+ $texversion=&IndexCreation($texversion,$urlp);
+ }
+ if ($helper->{'VARS'}->{'CONSTR_RESOURSE_URL'} eq 'yes') {
+ $texversion=~s/(\\addcontentsline\{toc\}\{subsection\}\{[^\}]*\})/$1 URL: \\verb|$urlp| \\strut\\\\\\strut /;
+ }
+ $result.=$texversion;
+ $flag_latex_header_remove = 'YES';
+ } elsif ($urlp=~/\.(sequence|page)$/) {
+ $result.='\strut\\newline\\noindent\\makebox[\\textwidth/$number_of_columns][b]{\\hrulefill}\\newline\\noindent This is sequence/page '.$urlp.'\strut\\newline\\noindent\\makebox[\\textwidth/$number_of_columns][b]{\\hrulefill}\\newline\\noindent ';
+ }
+ }
+ if ($helper->{VARS}->{'construction'} eq '1') {$result=~s/(\\typeout)/ RANDOM SEED IS $rndseed $1/;}
+ $result .= '\end{document}';
} else {
- $result='\documentclass[letterpaper]{article}\usepackage{calc}\begin{document}Printout of this type of document is currently not supported: ';
+ $result.='\documentclass[letterpaper]{article}\usepackage{calc}\begin{document}Printout of this type of document is currently not supported: ';
if ($currentURL=~/\/(aboutme|syllabus|bulletinboard|smppg)$/) {
$result.=$1;
} elsif ($currentURL=~/\/ext\//) {