--- loncom/interface/portfolio.pm 2005/02/20 20:39:30 1.76 +++ loncom/interface/portfolio.pm 2005/02/21 02:20:12 1.77 @@ -83,7 +83,14 @@ sub display_directory { my ($r,$current_path,$is_empty,$dir_list)=@_; my $iconpath= $r->dir_config('lonIconsURL') . "/"; my $display_out; + my $select_mode; + my $checked_files; my %locked_files = &Apache::lonnet::get_marked_as_readonly_hash ($ENV{'user.domain'},$ENV{'user.name'}); + if ($ENV{"form.mode"} eq 'selectfile'){ + &select_files($r); + $checked_files =&Apache::lonnet::files_in_path($ENV{'user.name'},$ENV{'form.currentpath'}); + $select_mode = 'true'; + } if ($is_empty && ($current_path ne '/')) { $display_out = '
'. ''. @@ -95,76 +102,16 @@ sub display_directory { $r->print($display_out); return; } - $r->print(''. + if ($select_mode eq 'true') { + $r->print('
'. + ''); + $r->print(''); + } else { + $r->print('
Select NameSizeLast Modified
'. ''); - my $href_location="/uploaded/$ENV{'user.domain'}/$ENV{'user.name'}/portfolio$current_path"; - $r->print(''); - foreach my $line (sort - { - my ($afile)=split('&',$a,2); - my ($bfile)=split('&',$b,2); - return (lc($afile) cmp lc($bfile)); - } (@$dir_list)) { - #$strip holds directory/file name - #$dom - my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$line,16); - if (($filename ne '.') && ($filename ne '..')) { - if ($dirptr&$testdir) { - $r->print(''); - $r->print(''); - $r->print(''); - $r->print(''); - } else { - $r->print(''); - if (exists $locked_files{$current_path.$filename}){ - $r->print(''); - } else { - $r->print(' - '); - } - $r->print(''); - $r->print(''); - $r->print(''); - $r->print(''); - $r->print(''); - } - } + $r->print(''); } -# pink bg -# blue bg -# $r->print(&display_directory($current_path, $currentFile, @dir_list)); -# $r->print('>
Actions NameSizeLast Modified
Go to ...'.&make_anchor($filename.'/',$current_path.$filename.'/',$ENV{'form.mode'},$ENV{"form.fieldname"}).'
Locked - RenameMeta - '. - $filename.''.$size.''.&Apache::lonlocal::locallocaltime($mtime).'
'); -# $r->print(&display_actions($current_path, $currentFile, $isEmpty)); - $r->print('
- - - -
'); -} -sub display_file_select { - my ($r,$current_path,$is_empty,$dir_list)=@_; - my $iconpath= $r->dir_config('lonIconsURL') . "/"; - my $display_out; - my $checked_files = &Apache::lonnet::files_in_path($ENV{'user.name'}, $ENV{'form.currentpath'}); - if ($is_empty && ($current_path ne '/')) { - $display_out = '
'. - ''. - ''. - ''. - ''. - - '
'; - - $r->print($display_out); - return; - } - $r->print(''. - ''); my $href_location="/uploaded/$ENV{'user.domain'}/$ENV{'user.name'}/portfolio$current_path"; - $r->print(''); foreach my $line (sort { my ($afile)=split('&',$a,2); @@ -177,17 +124,32 @@ sub display_file_select { $filename =~ s/\s+$//; if (($filename ne '.') && ($filename ne '..')) { if ($dirptr&$testdir) { - $r->print(''); + if ($select_mode eq 'true'){ + $r->print(''); + } else { + $r->print(''); + } $r->print(''); $r->print(''); $r->print(''); } else { $r->print(''); - $r->print(''); + } else { + if (exists $locked_files{$current_path.$filename}){ + $r->print(''); + } else { + $r->print(' + '); + } } - $r->print('>'); $r->print(''); $r->print(''); @@ -197,14 +159,22 @@ sub display_file_select { } } } - $r->print('
Select NameSizeLast Modified
Go to ...'.&make_anchor($filename.'/',$current_path.$filename.'/',$ENV{'form.mode'},$ENV{"form.fieldname"}).'
print("CHECKED"); + if ($select_mode eq 'true'){ + $r->print('print("CHECKED"); + } + $r->print('>Locked + RenameMeta + '. $filename.'
+ if ($select_mode eq 'true') { + $r->print('
- '); + '); + } else { + $r->print(' + + + + '); + } } sub open_form { @@ -599,12 +569,7 @@ sub handler { # need to know if directory is empty so it can be removed if desired my $is_empty=(@dir_list == 2); &display_common($r,$current_path,$is_empty,\@dir_list); - if ($ENV{"form.mode"} eq 'selectfile'){ - &select_files($r); - &display_file_select($r,$current_path,$is_empty,\@dir_list); - } else { - &display_directory($r,$current_path,$is_empty,\@dir_list); - } + &display_directory($r,$current_path,$is_empty,\@dir_list); $r->print("\n\n"); return OK; }