version 1.45, 2002/08/02 18:08:12
|
version 1.47, 2002/08/05 19:18:43
|
Line 167 ENDPART
|
Line 167 ENDPART
|
my $sequence_file=&Apache::lonnet::filelocation("",$primary_sequence); |
my $sequence_file=&Apache::lonnet::filelocation("",$primary_sequence); |
my $sequencefilecontents=&Apache::lonnet::getfile($sequence_file); |
my $sequencefilecontents=&Apache::lonnet::getfile($sequence_file); |
my @master_seq = &content_map($sequencefilecontents); |
my @master_seq = &content_map($sequencefilecontents); |
# |
|
# for (my $iu=0;$iu<=$#master_seq;$iu++) { |
|
# $result .= ' '.$master_seq[$iu].' '; |
|
# } |
|
# |
|
#-- 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 200 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 245 ENDPART
|
Line 261 ENDPART
|
} else { |
} else { |
$subdirtoprint =~ s/.*(\/res\/)/$1/; |
$subdirtoprint =~ s/.*(\/res\/)/$1/; |
} |
} |
|
my @content_directory = (); |
if ($ENV{'request.role'}=~m/^au\./) { |
if ($ENV{'request.role'}=~m/^au\./) { |
my @content_directory = &Apache::lonnet::dirlist($subdirtoprint,$ENV{'user.domain'}, $ENV{'user.name'},''); |
@content_directory = &Apache::lonnet::dirlist($subdirtoprint,$ENV{'user.domain'}, $ENV{'user.name'},''); |
for (my $iy=0;$iy<=$#content_directory;$iy++) { |
|
my @tempo_array = split(/&/,$content_directory[$iy]); |
|
if ($tempo_array[0] =~ m/^[^\.]+\.problem$/) { |
|
push(@list_of_files,$tempo_array[0]); |
|
} |
|
} |
|
} else { |
} else { |
my @content_directory = &Apache::lonnet::dirlist($subdirtoprint); |
@content_directory = &Apache::lonnet::dirlist($subdirtoprint); |
for (my $iy=0;$iy<=$#content_directory;$iy++) { |
} |
my @tempo_array = split(/&/,$content_directory[$iy]); |
for (my $iy=0;$iy<=$#content_directory;$iy++) { |
$content_directory[$iy] = $tempo_array[0]; |
my @tempo_array = split(/&/,$content_directory[$iy]); |
if ($content_directory[$iy] =~ m/^[^\.]+\.problem$/) { |
if ($tempo_array[0] =~ m/^[^\.]+\.(problem|exam|quiz|assess|survey|form|library)$/) { |
push @list_of_files,$content_directory[$iy]; |
push(@list_of_files,$tempo_array[0]); |
} |
|
} |
} |
} |
} |
$subdirtoprint =~ s/\/$//; |
$subdirtoprint =~ s/\/$//; |
Line 269 ENDPART
|
Line 279 ENDPART
|
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\./) { |
if ($ENV{'request.role'}=~m/^au\./) { $urlp =~ s/\/home\/([^\/]*)\/public_html/\/~$1/; } |
$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 315 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/([^\\])%/\$1\%/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; |