--- loncom/interface/portfolio.pm 2004/11/02 14:35:42 1.53 +++ loncom/interface/portfolio.pm 2004/11/09 21:51:14 1.55 @@ -72,7 +72,6 @@ sub display_common { } $r->print('</font>'); &Apache::lonhtmlcommon::store_recent('portfolio',$current_path,$current_path); - #Fixme -- remove from recent those paths that are deleted $r->print('<br /><form method=post action="/adm/portfolio">'. &Apache::lonhtmlcommon::select_recent('portfolio','currentpath', 'this.form.submit();')); @@ -250,9 +249,19 @@ sub done { sub delete { my ($r)=@_; - &open_form($r); - $r->print('<p>'.&mt('Delete').' '.&display_file().'?</p>'); - &close_form($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') { + $r->print ("The file is locked and cannot be deleted.<br />"); + $r->print(&done()); + } else { + &open_form($r); + $r->print('<p>'.&mt('Delete').' '.&display_file().'?</p>'); + &close_form($r); + } } sub delete_confirmed { @@ -305,10 +314,20 @@ sub delete_dir_confirmed { sub rename { my ($r)=@_; - &open_form($r); - $r->print('<p>'.&mt('Rename').' '.&display_file().' to - <input name="filenewname" type="input" size="50" />?</p>'); - &close_form($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') { + $r->print ("The file is locked and cannot be renamed.<br />"); + $r->print(&done()); + } else { + &open_form($r); + $r->print('<p>'.&mt('Rename').' '.&display_file().' to + <input name="filenewname" type="input" size="50" />?</p>'); + &close_form($r); + } } sub rename_confirmed { @@ -340,7 +359,7 @@ sub select_files { fileList = ""; for (i=0;i<document.forms.checkselect.length;i++) { if (document.forms.checkselect[i].checked){ - fileList = fileList + document.forms.checkselect[i].value + "," ; + fileList = fileList + document.forms.checkselect.currentpath.value + document.forms.checkselect[i].value + "," ; } } opener.document.forms.lonhomework.