version 1.41, 2002/07/23 14:09:45
|
version 1.47, 2002/08/05 19:18:43
|
Line 79 ENDMENUOUT1
|
Line 79 ENDMENUOUT1
|
<input type="radio" name="choice" value="Standard LaTeX output for the top level sequence"> All problems from the top level sequence<br /> |
<input type="radio" name="choice" value="Standard LaTeX output for the top level sequence"> All problems from the top level sequence<br /> |
<br /> |
<br /> |
ENDMENUOUT2 |
ENDMENUOUT2 |
|
} |
my $subdirtoprint = &Apache::lonnet::filelocation("",$ENV{'form.url'}); |
my $subdirtoprint = &Apache::lonnet::filelocation("",$ENV{'form.url'}); |
$subdirtoprint =~ s/\/[^\/]+$//; |
$subdirtoprint =~ s/\/[^\/]+$//; |
if (&Apache::lonnet::allowed('bre',$subdirtoprint) eq 'F') { |
if (&Apache::lonnet::allowed('bre',$subdirtoprint) eq 'F') { |
Line 86 ENDMENUOUT2
|
Line 87 ENDMENUOUT2
|
<input type="radio" name="choice" value="Subdirectory print"> All problems from current subdirectory (where this particular problem is)<br /> |
<input type="radio" name="choice" value="Subdirectory print"> All problems from current subdirectory (where this particular problem is)<br /> |
ENDMENUOUT4 |
ENDMENUOUT4 |
} |
} |
} |
|
$r->print(<<ENDMENUOUT5); |
$r->print(<<ENDMENUOUT5); |
<br /><hr /><br /> |
<br /><hr /><br /> |
<h1>And what page format do you prefer?</h1> |
<h1>And what page format do you prefer?</h1> |
Line 98 ENDMENUOUT4
|
Line 98 ENDMENUOUT4
|
</td> |
</td> |
<td> </td> |
<td> </td> |
<td rawspan="2"> |
<td rawspan="2"> |
Number of columns: <input type="text" size="2" name="numberofcolumns" value="2"> |
Number of columns: <select name="numberofcolumns"> |
|
<option selected> 1 </option> |
|
<option> 2 </option> |
|
<option> 3 </option> |
|
<option> 4 </option> |
|
<option> 5 </option> |
|
<option> 6 </option> |
|
<option> 7 </option> |
|
<option> 8 </option> |
|
<option> 9 </option> |
|
</select> |
</td> |
</td> |
</tr> |
</tr> |
</table> |
</table> |
Line 185 ENDPART
|
Line 195 ENDPART
|
} elsif ($choice eq 'Standard LaTeX output for the top level sequence') { |
} elsif ($choice eq 'Standard LaTeX output for the top level sequence') { |
my @master_seq = (); |
my @master_seq = (); |
my @add_file_seq = (); |
my @add_file_seq = (); |
#-- where is the main sequence of the course? |
# where is the main sequence of the course? |
my $main_seq = '/res/'.$ENV{'request.course.uri'}; |
my $main_seq = '/res/'.$ENV{'request.course.uri'}; |
my $file=&Apache::lonnet::filelocation("",$main_seq); |
my $file=&Apache::lonnet::filelocation("",$main_seq); |
my $filecontents=&Apache::lonnet::getfile($file); |
my $filecontents=&Apache::lonnet::getfile($file); |
my @file_seq = &content_map($filecontents); |
my @file_seq = &content_map($filecontents); |
#-- do we have any other sequence inside? |
# do we have any other sequence inside? |
my $i=0; |
# $result.=$#file_seq.' '; |
|
my $i=1; |
while ($i<=$#file_seq) { |
while ($i<=$#file_seq) { |
$_ = $file_seq[$i]; |
# $result.=' '.$file_seq[$i].' '; |
if (/\.sequence$/) { |
$file_seq[$i]=~s/^"//; |
|
$file_seq[$i]=~s/"$//; |
|
if ($file_seq[$i]=~m/\.sequence\s*$/) { |
$file = &Apache::lonnet::filelocation("",$file_seq[$i]); |
$file = &Apache::lonnet::filelocation("",$file_seq[$i]); |
|
# $result.=' location '.$file.' '; |
|
# $result .= 'FFFFFFFFF'.$file.' '; |
$filecontents=&Apache::lonnet::getfile($file); |
$filecontents=&Apache::lonnet::getfile($file); |
@add_file_seq = &content_map($filecontents); |
@add_file_seq = &content_map($filecontents); |
|
|
|
# |
|
# for (my $iu=0;$iu<=$#add_file_seq;$iu++) { |
|
# $result .= ' SDSD '.$add_file_seq[$iu].' FDFD '; |
|
# } |
|
# |
|
|
|
|
splice(@file_seq,$i,1,@add_file_seq); |
splice(@file_seq,$i,1,@add_file_seq); |
@add_file_seq = (); |
@add_file_seq = (); |
$i = -1; |
$i = -1; |
} |
} |
$i++; |
$i++; |
|
last; #do not forget to remove |
} |
} |
@master_seq = @file_seq; |
@master_seq = @file_seq; |
|
|
|
# |
|
# for (my $iu=0;$iu<=$#file_seq;$iu++) { |
|
# $result .= ' SSS '.$file_seq[$iu].' FFF '; |
|
# } |
|
# |
|
|
#-- produce an output string |
#-- produce an output string |
for (my $i=0;$i<=$#master_seq;$i++) { |
for (my $i=0;$i<=$#master_seq;$i++) { |
$_ = $master_seq[$i]; |
$_ = $master_seq[$i]; |
Line 225 ENDPART
|
Line 256 ENDPART
|
my $subdirtoprint = &Apache::lonnet::filelocation("",$ENV{'form.url'}); |
my $subdirtoprint = &Apache::lonnet::filelocation("",$ENV{'form.url'}); |
$subdirtoprint =~ s/\/[^\/]+$//; |
$subdirtoprint =~ s/\/[^\/]+$//; |
my @list_of_files = (); |
my @list_of_files = (); |
my $localdirectory = $subdirtoprint; |
if ($ENV{'request.role'}=~m/^au\./) { |
$localdirectory =~ s/.*(\/res\/)/$1/; |
$subdirtoprint =~ s/^[^~]*~(\w+)\//\/home\/$1\/public_html\//; |
my @content_directory = &Apache::lonnet::dirlist($localdirectory); |
} else { |
|
$subdirtoprint =~ s/.*(\/res\/)/$1/; |
|
} |
|
my @content_directory = (); |
|
if ($ENV{'request.role'}=~m/^au\./) { |
|
@content_directory = &Apache::lonnet::dirlist($subdirtoprint,$ENV{'user.domain'}, $ENV{'user.name'},''); |
|
} else { |
|
@content_directory = &Apache::lonnet::dirlist($subdirtoprint); |
|
} |
for (my $iy=0;$iy<=$#content_directory;$iy++) { |
for (my $iy=0;$iy<=$#content_directory;$iy++) { |
my @tempo_array = split(/&/,$content_directory[$iy]); |
my @tempo_array = split(/&/,$content_directory[$iy]); |
$content_directory[$iy] = $tempo_array[0]; |
if ($tempo_array[0] =~ m/^[^\.]+\.(problem|exam|quiz|assess|survey|form|library)$/) { |
if ($content_directory[$iy] =~ m/^[^\.]+\.problem$/) { |
push(@list_of_files,$tempo_array[0]); |
push @list_of_files,$content_directory[$iy]; |
|
} |
} |
} |
} |
$localdirectory =~ s/\/$//; |
$subdirtoprint =~ s/\/$//; |
for (my $i=0;$i<=$#list_of_files;$i++) { |
for (my $i=0;$i<=$#list_of_files;$i++) { |
my $urlp = $localdirectory.'/'.$list_of_files[$i]; |
my $urlp = $subdirtoprint.'/'.$list_of_files[$i]; |
my %moreenv; |
my %moreenv; |
$moreenv{'form.grade_target'}='tex'; |
$moreenv{'form.grade_target'}='tex'; |
&Apache::lonnet::appenv(%moreenv); |
&Apache::lonnet::appenv(%moreenv); |
|
if ($ENV{'request.role'}=~m/^au\./) { $urlp =~ s/\/home\/([^\/]*)\/public_html/\/~$1/; } |
my $texversion=&Apache::lonnet::ssi($urlp); |
my $texversion=&Apache::lonnet::ssi($urlp); |
&Apache::lonnet::delenv('form.grade_target'); |
&Apache::lonnet::delenv('form.grade_target'); |
$texversion =~ s/(\\begin{document})/$1 {\\tiny\\begin{verbatim}$urlp\\end{verbatim}}/; |
$texversion =~ s/(\\begin{document})/$1 {\\tiny\\begin{verbatim}$urlp\\end{verbatim}}/; |
Line 284 ENDPART
|
Line 323 ENDPART
|
$first_comment = index($result,'<!--',$first_comment); |
$first_comment = index($result,'<!--',$first_comment); |
} |
} |
$result =~ s/^\s+$//gm; #remove empty lines |
$result =~ s/^\s+$//gm; #remove empty lines |
$result =~ s/%/\\%/g; #corrects % |
$result =~ s/\s%/\\%/g; #corrects % |
$result =~ s/(\s)+/$1/g; #removes more than one empty space |
$result =~ s/(\s)+/$1/g; #removes more than one empty space |
$result =~ s/\\\\\s*\\vskip/\\vskip/gm; |
$result =~ s/\\\\\s*\\vskip/\\vskip/gm; |
$result =~ s/ (<|>|) / \$$1\$ /g; #corrects < or > |
# $result =~ s/ (<|>|) / \$$1\$ /g; #corrects < or > |
$result =~ s/\\\\\s*\\noindent\s*(\\\\)+/\\\\\\noindent /g; |
$result =~ s/\\\\\s*\\noindent\s*(\\\\)+/\\\\\\noindent /g; |
$result =~ s/{\\par }\s*\\\\/\\\\/gm; |
$result =~ s/{\\par }\s*\\\\/\\\\/gm; |
$result =~ s/\\\\\s+\[/ \[/g; |
$result =~ s/\\\\\s+\[/ \[/g; |
Line 297 ENDPART
|
Line 336 ENDPART
|
if ($result =~ m/&(\w+|#\d+);/) { |
if ($result =~ m/&(\w+|#\d+);/) { |
$result = &character_chart($result); |
$result = &character_chart($result); |
} |
} |
|
$result =~ s/(\\end{tabular})\s*\\vskip 0 mm/$1/g; |
|
$result =~ s/(\\begin{enumerate})\s*\\noindent/$1/g; |
#-- writing .tex file in prtspool |
#-- writing .tex file in prtspool |
my $temp_file; |
my $temp_file; |
my $filename = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout_".time."_".rand(10000000).".tex"; |
my $filename = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout_".time."_".rand(10000000).".tex"; |
Line 473 sub character_chart {
|
Line 514 sub character_chart {
|
# $result =~ s/®//g; |
# $result =~ s/®//g; |
# $result =~ s/¯//g; |
# $result =~ s/¯//g; |
# $result =~ s/¯//g; |
# $result =~ s/¯//g; |
$result =~ s/°/\$^\\{\\circ\\}\$/g; |
$result =~ s/°/\$^{\\circ}\$/g; |
$result =~ s/°/\$^\\{\\circ\\}\$/g; |
$result =~ s/°/\$^{\\circ}\$/g; |
$result =~ s/±/\$\\pm\$/g; |
$result =~ s/±/\$\\pm\$/g; |
$result =~ s/±/\$\\pm\$/g; |
$result =~ s/±/\$\\pm\$/g; |
$result =~ s/²/\$^2\$/g; |
$result =~ s/²/\$^2\$/g; |
Line 685 sub content_map {
|
Line 726 sub content_map {
|
$_ = $chunk; |
$_ = $chunk; |
m/to=\"(\d+)\"/; |
m/to=\"(\d+)\"/; |
push @number_seq,$1; |
push @number_seq,$1; |
$startlink = index($map_string,'from="'.$1.'"',$startlink); |
$startlink = index($map_string,'from="'.$1.'"',0); |
$startlink = rindex($map_string,'<link ',$startlink); |
$startlink = rindex($map_string,'<link ',$startlink); |
} |
} |
my $stalink = index($map_string,' to="'.$number_seq[0].'"',$startlink); |
my $stalink = index($map_string,' to="'.$number_seq[0].'"',0); |
while ($stalink != -1) { |
while ($stalink != -1) { |
$startlink = rindex($map_string,'<link ',$stalink); |
$startlink = rindex($map_string,'<link ',$stalink); |
$endlink = index($map_string,'</link>',$startlink); |
$endlink = index($map_string,'</link>',$startlink); |