--- loncom/interface/portfolio.pm 2004/11/09 21:51:14 1.55 +++ loncom/interface/portfolio.pm 2004/11/22 22:59:32 1.57 @@ -33,8 +33,8 @@ use Apache::lonlocal; # receives a file name and path stub from username/userfiles/portfolio/ # returns an anchor tag consisting encoding filename and currentpath sub make_anchor { - my ($filename, $current_path) = @_; - my $anchor = ''.$filename.''; + my ($filename, $current_path, $current_mode, $field_name) = @_; + my $anchor = ''.$filename.''; return $anchor; } my $dirptr=16384; @@ -48,6 +48,7 @@ sub display_common { ''. ''. ''. + ''. ''. ''; $r->print($displayOut); @@ -57,17 +58,18 @@ sub display_common { ''. ''. ''. + ''. ''. ''; $r->print($displayOut); $r->print(''); my @tree = split (/\//,$current_path); - $r->print(''.&make_anchor('portfolio','/').'/'); + $r->print(''.&make_anchor('portfolio','/',$ENV{"form.mode"},$ENV{"form.fieldname"}).'/'); if (@tree > 1){ my $newCurrentPath = ''; for (my $i = 1; $i< @tree; $i++){ $newCurrentPath .= $tree[$i].'/'; - $r->print(&make_anchor($tree[$i],'/'.$newCurrentPath).'/'); + $r->print(&make_anchor($tree[$i],'/'.$newCurrentPath, $ENV{"form.mode"},$ENV{"form.fieldname"}).'/'); } } $r->print(''); @@ -121,7 +123,7 @@ sub display_directory { if ($dirptr&$testdir) { $r->print(''); $r->print('Go to ...'); - $r->print(''.&make_anchor($filename.'/',$current_path.$filename.'/').''); + $r->print(''.&make_anchor($filename.'/',$current_path.$filename.'/',$ENV{'form.mode'},$ENV{"form.fieldname"}).''); $r->print(''); } else { $r->print(''); @@ -186,7 +188,7 @@ sub display_file_select { if ($dirptr&$testdir) { $r->print(''); $r->print('Go to ...'); - $r->print(''.&make_anchor($filename.'/',$current_path.$filename.'/').''); + $r->print(''.&make_anchor($filename.'/',$current_path.$filename.'/',$ENV{'form.mode'},$ENV{"form.fieldname"}).''); $r->print(''); } else { $r->print(''); @@ -244,6 +246,7 @@ sub done { return ('

'.&mt('Done').'

'); } @@ -251,10 +254,7 @@ sub delete { my ($r)=@_; my @check; my $file_name = $ENV{'form.currentpath'}.$ENV{'form.selectfile'}; - push @check, $file_name; - my %locked = &Apache::lonnet::get('file_permissions',\@check, - $ENV{'user.domain'},$ENV{'user.name'}); - if (ref($locked{$file_name}) eq 'ARRAY') { + if (&Apache::lonnet::is_locked($file_name,$ENV{'user.domain'},$ENV{'user.name'} ) eq 'true') { $r->print ("The file is locked and cannot be deleted.
"); $r->print(&done()); } else { @@ -314,12 +314,8 @@ sub delete_dir_confirmed { sub rename { my ($r)=@_; - my @check; my $file_name = $ENV{'form.currentpath'}.$ENV{'form.selectfile'}; - push @check, $file_name; - my %locked = &Apache::lonnet::get('file_permissions',\@check, - $ENV{'user.domain'},$ENV{'user.name'}); - if (ref($locked{$file_name}) eq 'ARRAY') { + if (&Apache::lonnet::is_locked($file_name,$ENV{'user.domain'},$ENV{'user.name'}) eq 'true') { $r->print ("The file is locked and cannot be renamed.
"); $r->print(&done()); } else {