version 1.297, 2004/04/30 17:50:29
|
version 1.304, 2004/05/27 17:30:48
|
Line 421 sub page_format {
|
Line 421 sub page_format {
|
} elsif($papersize eq '6') { |
} elsif($papersize eq '6') { |
if ($layout eq 'book') { |
if ($layout eq 'book') { |
if ($numberofcolumns == 1) { |
if ($numberofcolumns == 1) { |
$textwidth = '18 cm'; |
$textwidth = '176 mm'; |
$textheight = '28 cm'; |
$textheight = '254 mm'; |
$oddoffset = '-0.57 in'; |
$oddoffset = '-0.57 in'; |
$evenoffset = '-0.57 in'; |
$evenoffset = '-0.57 in'; |
} elsif ($numberofcolumns == 2) { |
} elsif ($numberofcolumns == 2) { |
$textwidth = '96 mm'; |
$textwidth = '91 mm'; |
$textheight = '2 cm'; |
$textheight = '254 mm'; |
$oddoffset = '-0.57 in'; |
$oddoffset = '-0.57 in'; |
$evenoffset = '-0.57 in'; |
$evenoffset = '-0.57 in'; |
} |
} |
Line 676 sub get_textwidth {
|
Line 676 sub get_textwidth {
|
sub unsupported { |
sub unsupported { |
my $currentURL=shift; |
my $currentURL=shift; |
my $result.='\documentclass[letterpaper]{article}\usepackage{calc}\begin{document}Printout of this type of document is currently not supported: '; |
my $result.='\documentclass[letterpaper]{article}\usepackage{calc}\begin{document}Printout of this type of document is currently not supported: '; |
if ($currentURL=~/\/(aboutme|syllabus|bulletinboard|smppg)$/) { |
if ($currentURL=~/\/ext\//) { |
$result.='\textbf{'.$1.'}'; |
|
} elsif ($currentURL=~/\/ext\//) { |
|
$result.=' \strut \\\\ THIS IS EXTERNAL RESOURCE WITH URL \strut \\\\ '.$currentURL.' '; |
$result.=' \strut \\\\ THIS IS EXTERNAL RESOURCE WITH URL \strut \\\\ '.$currentURL.' '; |
} else { |
} else { |
$result.=$currentURL; |
$result.=$currentURL; |
Line 876 ENDPART
|
Line 874 ENDPART
|
} |
} |
if ($helper->{VARS}->{'construction'} eq '1') {$result=~s/(\\begin{document})/$1 \\fbox\{RANDOM SEED IS $rndseed\} /;} |
if ($helper->{VARS}->{'construction'} eq '1') {$result=~s/(\\begin{document})/$1 \\fbox\{RANDOM SEED IS $rndseed\} /;} |
$result .= '\end{document}'; |
$result .= '\end{document}'; |
} elsif ($currentURL=~/\/smppg$/) { |
} elsif ($currentURL=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) { |
my %form; |
my %form; |
$form{'grade_target'}='tex'; |
$form{'grade_target'}='tex'; |
$form{'textwidth'}=&get_textwidth($helper,$LaTeXwidth); |
$form{'textwidth'}=&get_textwidth($helper,$LaTeXwidth); |
$form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'}; |
$form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'}; |
|
if ($currentURL=~/\/syllabus$/) {$currentURL=~s/\/res//;} |
my $texversion=&Apache::lonnet::ssi($currentURL,%form); |
my $texversion=&Apache::lonnet::ssi($currentURL,%form); |
$result .= $texversion; |
$result .= $texversion; |
} else { |
} else { |
Line 972 ENDPART
|
Line 971 ENDPART
|
} |
} |
$result .= $texversion; |
$result .= $texversion; |
$flag_latex_header_remove = 'YES'; |
$flag_latex_header_remove = 'YES'; |
|
} elsif ($urlp=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) { |
|
my %form; |
|
$form{'grade_target'}='tex'; |
|
$form{'textwidth'}=&get_textwidth($helper,$LaTeXwidth); |
|
$form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'}; |
|
if ($urlp=~/\/syllabus$/) {$urlp=~s/\/res//;} |
|
my $texversion=&Apache::lonnet::ssi($urlp,%form); |
|
if ($flag_latex_header_remove ne 'NO') { |
|
$texversion = &latex_header_footer_remove($texversion); |
|
} else { |
|
$texversion =~ s/\\end{document}/\\vskip 0\.5mm\\noindent\\makebox\[\\textwidth\/\$number_of_columns\]\[b\]\{\\hrulefill\}/; |
|
} |
|
$result .= $texversion; |
|
$flag_latex_header_remove = 'YES'; |
} else { |
} else { |
$texversion=&unsupported($urlp); |
$texversion=&unsupported($urlp); |
if ($flag_latex_header_remove ne 'NO') { |
if ($flag_latex_header_remove ne 'NO') { |
Line 1035 ENDPART
|
Line 1048 ENDPART
|
} |
} |
my $flag_latex_header_remove = 'NO'; |
my $flag_latex_header_remove = 'NO'; |
my %moreenv = ('textwidth' => &get_textwidth($helper,$LaTeXwidth)); |
my %moreenv = ('textwidth' => &get_textwidth($helper,$LaTeXwidth)); |
my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,'Print Status','Class Print Status',$num_todo,'inline'); |
my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,'Print Status','Class Print Status',$num_todo,'inline','75'); |
my $seed=time+($$<<16)+($$); |
my $seed=time+($$<<16)+($$); |
my @allcodes; |
my @allcodes; |
if ($old_name) { |
if ($old_name) { |
Line 1043 ENDPART
|
Line 1056 ENDPART
|
@allcodes=split(',',$result{$old_name}); |
@allcodes=split(',',$result{$old_name}); |
} else { |
} else { |
my %allcodes; |
my %allcodes; |
|
srand($seed); |
for (my $i=0;$i<$num_todo;$i++) { |
for (my $i=0;$i<$num_todo;$i++) { |
$moreenv{'CODE'}=&get_CODE(\%allcodes,$i,$seed,'6'); |
$moreenv{'CODE'}=&get_CODE(\%allcodes,$i,$seed,'6'); |
} |
} |
Line 1089 ENDPART
|
Line 1103 ENDPART
|
if ($urlp =~ m|/home/([^/]+)/public_html|) { |
if ($urlp =~ m|/home/([^/]+)/public_html|) { |
$urlp =~ s|/home/([^/]*)/public_html|/~$1|; |
$urlp =~ s|/home/([^/]*)/public_html|/~$1|; |
} else { |
} else { |
$urlp =~ s|^/home/httpd/html||; |
$urlp =~ s|^$Apache::lonnet::perlvar{'lonDocRoot'}||; |
} |
} |
my $texversion=&Apache::lonnet::ssi($urlp,%form); |
my $texversion=&Apache::lonnet::ssi($urlp,%form); |
if(($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') || |
if(($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') || |
Line 1217 ENDPART
|
Line 1231 ENDPART
|
&Apache::lonnet::appenv('cgi.'.$identifier.'.file' => $filename, |
&Apache::lonnet::appenv('cgi.'.$identifier.'.file' => $filename, |
'cgi.'.$identifier.'.layout' => $laystyle, |
'cgi.'.$identifier.'.layout' => $laystyle, |
'cgi.'.$identifier.'.numcol' => $numberofcolumns, |
'cgi.'.$identifier.'.numcol' => $numberofcolumns, |
|
'cgi.'.$identifier.'.paper' => $papersize, |
'cgi.'.$identifier.'.selection' => $selectionmade, |
'cgi.'.$identifier.'.selection' => $selectionmade, |
'cgi.'.$identifier.'tableofcontents' => $helper->{'VARS'}->{'TABLE_CONTENTS'}, |
'cgi.'.$identifier.'tableofcontents' => $helper->{'VARS'}->{'TABLE_CONTENTS'}, |
'cgi.'.$identifier.'tableofindex' => $helper->{'VARS'}->{'TABLE_INDEX'}, |
'cgi.'.$identifier.'tableofindex' => $helper->{'VARS'}->{'TABLE_INDEX'}, |
Line 1244 sub num_to_letters {
|
Line 1259 sub num_to_letters {
|
sub get_CODE { |
sub get_CODE { |
my ($all_codes,$num,$seed,$size)=@_; |
my ($all_codes,$num,$seed,$size)=@_; |
my $max='1'.'0'x$size; |
my $max='1'.'0'x$size; |
srand($seed); |
|
my $newcode; |
my $newcode; |
while(1) { |
while(1) { |
$newcode=sprintf("%06d",int(rand($max))); |
$newcode=sprintf("%06d",int(rand($max))); |
Line 1481 sub printHelper {
|
Line 1495 sub printHelper {
|
# "Delete everything after the last slash." |
# "Delete everything after the last slash." |
$subdir =~ s|/[^/]+$||; |
$subdir =~ s|/[^/]+$||; |
if (not $helper->{VARS}->{'construction'}) { |
if (not $helper->{VARS}->{'construction'}) { |
$subdir='/home/httpd/html/res/'.$subdir; |
$subdir=$Apache::lonnet::perlvar{'lonDocRoot'}.'/res/'.$subdir; |
} |
} |
# "Remove all duplicate slashes." |
# "Remove all duplicate slashes." |
$subdir =~ s|/+|/|g; |
$subdir =~ s|/+|/|g; |
Line 1680 CHOOSE_ANON2
|
Line 1694 CHOOSE_ANON2
|
} |
} |
|
|
# FIXME: That RE should come from a library somewhere. |
# 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 '/home/httpd/html/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}, ["<b>".&mt('Problems')."</b> ".&mt('from current subdirectory')." <b><i>$subdir</i></b>", 'problems_from_directory', 'CHOOSE_FROM_SUBDIR']; |
push @{$printChoices}, ["<b>".&mt('Problems')."</b> ".&mt('from current subdirectory')." <b><i>$subdir</i></b>", 'problems_from_directory', 'CHOOSE_FROM_SUBDIR']; |
|
|
my $f = '$filename'; |
my $f = '$filename'; |
Line 1953 STATEHTML
|
Line 1967 STATEHTML
|
$result .= "</select></td><td>\n"; |
$result .= "</select></td><td>\n"; |
$result .= "<select name='${var}.paper'>\n"; |
$result .= "<select name='${var}.paper'>\n"; |
|
|
|
my %parmhash=&Apache::lonnet::coursedescription($ENV{'request.course.id'}); |
|
my $DefaultPaperSize=$parmhash{'default_paper_size'}; |
|
if ($DefaultPaperSize eq '') {$DefaultPaperSize='letter';} |
$i = 0; |
$i = 0; |
foreach (@paperSize) { |
foreach (@paperSize) { |
if ($i == 0) { |
if ($paperSize[$i]=~/$DefaultPaperSize/) { |
$result .= "<option selected value='$i'>" . $paperSize[$i] . "</option>\n"; |
$result .= "<option selected value='$i'>" . $paperSize[$i] . "</option>\n"; |
} else { |
} else { |
$result .= "<option value='$i'>" . $paperSize[$i] . "</option>\n"; |
$result .= "<option value='$i'>" . $paperSize[$i] . "</option>\n"; |