[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm
banghart
lon-capa-cvs@mail.lon-capa.org
Sat, 04 Dec 2004 18:35:28 -0000
banghart Sat Dec 4 13:35:28 2004 EDT
Modified files:
/loncom/lonnet/perl lonnet.pm
Log:
Another step forward, still not finished.
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.572 loncom/lonnet/perl/lonnet.pm:1.573
--- loncom/lonnet/perl/lonnet.pm:1.572 Fri Dec 3 21:14:19 2004
+++ loncom/lonnet/perl/lonnet.pm Sat Dec 4 13:35:27 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.572 2004/12/04 02:14:19 banghart Exp $
+# $Id: lonnet.pm,v 1.573 2004/12/04 18:35:27 banghart Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3817,9 +3817,19 @@
sub save_selected_files {
my ($user, $path, @files) = @_;
my $filename = $user."savedfiles";
- open OUT, '>'.$Apache::lonnet::perlvar{'lonDaemons'}.'/tmp/'.$filename;
+ my @other_files = &files_not_in_path($user, $path);
+ foreach (@other_files) {
+ &logthis("other dir file $_");
+ }
foreach (@files) {
- print OUT $ENV{'form.currentpath'}.$_."\n";
+ &logthis("current dir file $_");
+ }
+ open OUT, '>'.$Apache::lonnet::perlvar{'lonDaemons'}.'/tmp/'.$filename;
+ foreach my $file (@files) {
+ print OUT $ENV{'form.currentpath'}.$file."\n";
+ }
+ foreach my $file (@other_files) {
+ print OUT $file."\n";
}
close OUT;
return 'ok';
@@ -3830,6 +3840,18 @@
my $filename = $user."savedfiles";
my %return_files;
open IN, '<'.$Apache::lonnet::perlvar{'lonDaemons'}.'/tmp/'.$filename;
+ while (my $line_in = <IN>) {
+ chomp $line_in;
+ my @paths_and_file = split m!/!, $line_in;
+ my $file_part = pop @paths_and_file;
+ my $path_part = join '/', @paths_and_file;
+ $path_part.='/';
+ my $path_and_file = $path_part.$file_part;
+ if ($path_part eq $path) {
+ $return_files{$file_part}= 'selected';
+ }
+ }
+ close IN;
return \%return_files;
}
@@ -3844,14 +3866,12 @@
#ok, I know it's clunky, but I want it to work
my @paths_and_file = split m!/!, $_;
my $file_part = pop @paths_and_file;
+ chomp $file_part;
my $path_part = join '/', @paths_and_file;
$path_part .= '/';
my $path_and_file = $path_part.$file_part;
if ($path_part ne $path) {
push @return_files, ($path_and_file);
- &logthis("path part is $path_part file is $file_part");
- } else {
- &logthis("path part is $path_part file is $file_part");
}
}
close OUT;