| 1 | ################################################################################ |
1 | ################################################################################ |
| 2 | # WeBWorK Online Homework Delivery System |
2 | # WeBWorK Online Homework Delivery System |
| 3 | # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ |
3 | # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ |
| 4 | # $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor/FileManager.pm,v 1.10 2004/09/05 01:03:13 dpvc Exp $ |
4 | # $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor/FileManager.pm,v 1.3 2004/10/11 23:13:53 sh002i Exp $ |
| 5 | # |
5 | # |
| 6 | # This program is free software; you can redistribute it and/or modify it under |
6 | # This program is free software; you can redistribute it and/or modify it under |
| 7 | # the terms of either: (a) the GNU General Public License as published by the |
7 | # the terms of either: (a) the GNU General Public License as published by the |
| 8 | # Free Software Foundation; either version 2, or (at your option) any later |
8 | # Free Software Foundation; either version 2, or (at your option) any later |
| 9 | # version, or (b) the "Artistic License" which comes with this package. |
9 | # version, or (b) the "Artistic License" which comes with this package. |
| … | |
… | |
| 709 | sub directoryListing { |
709 | sub directoryListing { |
| 710 | my $root = shift; my $pwd = shift; |
710 | my $root = shift; my $pwd = shift; |
| 711 | my $dir = $root.'/'.$pwd; |
711 | my $dir = $root.'/'.$pwd; |
| 712 | my (@values,%labels,$size,$data); |
712 | my (@values,%labels,$size,$data); |
| 713 | |
713 | |
| 714 | return unless -d $dir; |
714 | return unless -d $dir and not -l $dir; #FIXME -- don't follow links |
| 715 | my @names = sortByName(undef,grep(/^[^.]/,readDirectory($dir))); |
715 | my @names = sortByName(undef,grep(/^[^.]/,readDirectory($dir))); |
| 716 | foreach my $name(@names) { |
716 | foreach my $name(@names) { |
|
|
717 | unless ( $name eq 'DATA') { #FIXME don't view the DATA directory |
| 717 | push(@values,$name); $labels{$name} = $name; |
718 | push(@values,$name); $labels{$name} = $name; |
| 718 | $labels{$name} .= '/' if (-d $dir.'/'.$name); |
719 | $labels{$name} .= '/' if (-d $dir.'/'.$name); |
|
|
720 | } |
| 719 | } |
721 | } |
| 720 | return (\@values,\%labels); |
722 | return (\@values,\%labels); |
| 721 | } |
723 | } |
| 722 | |
724 | |
| 723 | ################################################## |
725 | ################################################## |