version 1.63, 2004/12/06 18:13:10
|
version 1.64, 2004/12/11 19:54:22
|
Line 83 sub display_directory {
|
Line 83 sub display_directory {
|
my ($r,$current_path,$is_empty,$dir_list)=@_; |
my ($r,$current_path,$is_empty,$dir_list)=@_; |
my $iconpath= $r->dir_config('lonIconsURL') . "/"; |
my $iconpath= $r->dir_config('lonIconsURL') . "/"; |
my $display_out; |
my $display_out; |
my %locked_files=&Apache::lonnet::dump('file_permissions', |
my %locked_files = &Apache::lonnet::get_marked_as_readonly_hash ($ENV{'user.domain'},$ENV{'user.name'}); |
$ENV{'user.domain'},$ENV{'user.name'}); |
|
my $locked_file; |
|
foreach my $key (keys %locked_files) { |
|
$locked_file .= $locked_files{$key}.':'; |
|
} |
|
if ($is_empty && ($current_path ne '/')) { |
if ($is_empty && ($current_path ne '/')) { |
$display_out = '<form method="post" action="/adm/portfolio">'. |
$display_out = '<form method="post" action="/adm/portfolio">'. |
'<input type="hidden" name="action" value="deletedir" />'. |
'<input type="hidden" name="action" value="deletedir" />'. |
Line 103 sub display_directory {
|
Line 98 sub display_directory {
|
$r->print('<table border="0" cellspacing="2" cellpadding="2">'. |
$r->print('<table border="0" cellspacing="2" cellpadding="2">'. |
'<tr><th>Actions</th><th> </th><th>Name</th><th>Size</th><th>Last Modified</th></tr>'); |
'<tr><th>Actions</th><th> </th><th>Name</th><th>Size</th><th>Last Modified</th></tr>'); |
my $href_location="/uploaded/$ENV{'user.domain'}/$ENV{'user.name'}/portfolio$current_path"; |
my $href_location="/uploaded/$ENV{'user.domain'}/$ENV{'user.name'}/portfolio$current_path"; |
|
$r->print('<form method="post" action="/adm/portfolio">'); |
foreach my $line (sort |
foreach my $line (sort |
{ |
{ |
my ($afile)=split('&',$a,2); |
my ($afile)=split('&',$a,2); |
Line 120 sub display_directory {
|
Line 116 sub display_directory {
|
$r->print('</tr>'); |
$r->print('</tr>'); |
} else { |
} else { |
$r->print('<tr bgcolor="#CCCCFF">'); |
$r->print('<tr bgcolor="#CCCCFF">'); |
$r->print('<td> |
if (exists $locked_files{$current_path.$filename}){ |
<form method="post" action="/adm/portfolio"> |
$r->print('<td>Locked</td>'); |
<select name="action"> |
} else { |
<option value=""></option> |
$r->print('<td>Delete<input type="checkbox" name="selectfile" value="'.$filename.'" /> |
<option value="delete">'.&mt("Delete").'</option> |
<a href="/adm/portfolio?rename='.$filename.'&currentpath='.$current_path.'">Rename</a> |
<option value="rename">'.&mt("Rename").'</option> |
</td>'); |
</select> |
} |
<input type="submit" name="doit" value="Go" /> |
|
<input type="hidden" name="selectfile" value="'.$filename.'" /> |
|
<input type="hidden" name="currentpath" value="'.$current_path.'" /> |
|
</form> |
|
</td>'); |
|
$r->print('<td><img src="'.$iconpath.'unknown.gif"></td>'); |
$r->print('<td><img src="'.$iconpath.'unknown.gif"></td>'); |
$r->print('<td><a href="'.$href_location.$filename.'">'. |
$r->print('<td><a href="'.$href_location.$filename.'">'. |
$filename.'</a></td>'); |
$filename.'</a></td>'); |
Line 146 sub display_directory {
|
Line 137 sub display_directory {
|
# $r->print(&display_directory($current_path, $currentFile, @dir_list)); |
# $r->print(&display_directory($current_path, $currentFile, @dir_list)); |
# $r->print('</td>><td>'); |
# $r->print('</td>><td>'); |
# $r->print(&display_actions($current_path, $currentFile, $isEmpty)); |
# $r->print(&display_actions($current_path, $currentFile, $isEmpty)); |
$r->print('</table></form>'); |
$r->print('</table> |
|
<input type="submit" name="doit" value="Delete Checked Files" /> |
|
<input type="hidden" name="action" value="delete" /> |
|
<input type="hidden" name="currentpath" value="'.$current_path.'" /> |
|
</form>'); |
} |
} |
sub display_file_select { |
sub display_file_select { |
my ($r,$current_path,$is_empty,$dir_list)=@_; |
my ($r,$current_path,$is_empty,$dir_list)=@_; |
Line 321 sub delete_dir_confirmed {
|
Line 316 sub delete_dir_confirmed {
|
|
|
sub rename { |
sub rename { |
my ($r)=@_; |
my ($r)=@_; |
my $file_name = $ENV{'form.currentpath'}.$ENV{'form.selectfile'}; |
my $file_name = $ENV{'form.currentpath'}.$ENV{'form.rename'}; |
if (&Apache::lonnet::is_locked($file_name,$ENV{'user.domain'},$ENV{'user.name'}) eq 'true') { |
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.<br />"); |
$r->print ("The file is locked and cannot be renamed.<br />"); |
$r->print(&done()); |
$r->print(&done()); |
Line 493 sub handler {
|
Line 488 sub handler {
|
$r->rflush(); |
$r->rflush(); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['selectfile','currentpath', |
['selectfile','currentpath', |
'currentfile','action','fieldname','mode']); |
'currentfile','action','fieldname','mode','rename']); |
if (($ENV{'form.storeupl'} eq 'Upload') & (!$ENV{'form.uploaddoc.filename'})){ |
if (($ENV{'form.storeupl'} eq 'Upload') & (!$ENV{'form.uploaddoc.filename'})){ |
$r->print('<font color="red"> No file was selected to upload.'. |
$r->print('<font color="red"> No file was selected to upload.'. |
'To upload a file, click <strong>Browse...</strong>'. |
'To upload a file, click <strong>Browse...</strong>'. |
Line 511 sub handler {
|
Line 506 sub handler {
|
&delete_dir($r); |
&delete_dir($r); |
} elsif ($ENV{'form.action'} eq 'rename' && $ENV{'form.confirmed'}) { |
} elsif ($ENV{'form.action'} eq 'rename' && $ENV{'form.confirmed'}) { |
&rename_confirmed($r); |
&rename_confirmed($r); |
} elsif ($ENV{'form.action'} eq 'rename') { |
} elsif ($ENV{'form.rename'}) { |
|
$ENV{'form.selectfile'} = $ENV{'form.rename'}; |
|
$ENV{'form.action'} = 'rename'; |
&rename($r); |
&rename($r); |
} elsif ($ENV{'form.createdir'}) { |
} elsif ($ENV{'form.createdir'}) { |
&createdir($r); |
&createdir($r); |