[LON-CAPA-cvs] cvs: loncom /interface lonprintout.pm
sakharuk
lon-capa-cvs@mail.lon-capa.org
Fri, 02 Aug 2002 18:08:12 -0000
sakharuk Fri Aug 2 14:08:12 2002 EDT
Modified files:
/loncom/interface lonprintout.pm
Log:
Can print subdirectories from the construction space. Changes were done to
restore work after Jason changed dirlist in lonnet.pm.
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.44 loncom/interface/lonprintout.pm:1.45
--- loncom/interface/lonprintout.pm:1.44 Thu Aug 1 15:48:18 2002
+++ loncom/interface/lonprintout.pm Fri Aug 2 14:08:12 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.44 2002/08/01 19:48:18 sakharuk Exp $
+# $Id: lonprintout.pm,v 1.45 2002/08/02 18:08:12 sakharuk Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -240,22 +240,38 @@
my $subdirtoprint = &Apache::lonnet::filelocation("",$ENV{'form.url'});
$subdirtoprint =~ s/\/[^\/]+$//;
my @list_of_files = ();
- my $localdirectory = $subdirtoprint;
- $localdirectory =~ s/.*(\/res\/)/$1/;
- my @content_directory = &Apache::lonnet::dirlist($localdirectory);
- for (my $iy=0;$iy<=$#content_directory;$iy++) {
- my @tempo_array = split(/&/,$content_directory[$iy]);
- $content_directory[$iy] = $tempo_array[0];
- if ($content_directory[$iy] =~ m/^[^\.]+\.problem$/) {
- push @list_of_files,$content_directory[$iy];
+ if ($ENV{'request.role'}=~m/^au\./) {
+ $subdirtoprint =~ s/^[^~]*~(\w+)\//\/home\/$1\/public_html\//;
+ } else {
+ $subdirtoprint =~ s/.*(\/res\/)/$1/;
+ }
+ if ($ENV{'request.role'}=~m/^au\./) {
+ my @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 {
+ my @content_directory = &Apache::lonnet::dirlist($subdirtoprint);
+ for (my $iy=0;$iy<=$#content_directory;$iy++) {
+ my @tempo_array = split(/&/,$content_directory[$iy]);
+ $content_directory[$iy] = $tempo_array[0];
+ if ($content_directory[$iy] =~ m/^[^\.]+\.problem$/) {
+ push @list_of_files,$content_directory[$iy];
+ }
}
}
- $localdirectory =~ s/\/$//;
+ $subdirtoprint =~ s/\/$//;
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;
$moreenv{'form.grade_target'}='tex';
&Apache::lonnet::appenv(%moreenv);
+ if ($ENV{'request.role'}=~m/^au\./) {
+ $urlp =~ s/\/home\/([^\/]*)\/public_html/\/~$1/;
+ }
my $texversion=&Apache::lonnet::ssi($urlp);
&Apache::lonnet::delenv('form.grade_target');
$texversion =~ s/(\\begin{document})/$1 {\\tiny\\begin{verbatim}$urlp\\end{verbatim}}/;
@@ -705,7 +721,7 @@
$startlink = index($map_string,'from="'.$1.'"',0);
$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) {
$startlink = rindex($map_string,'<link ',$stalink);
$endlink = index($map_string,'</link>',$startlink);