version 1.121, 2013/07/23 13:40:20
|
version 1.124, 2016/05/22 01:09:54
|
Line 279 sub exists {
|
Line 279 sub exists {
|
$published=~s{^\Q$londocroot/priv/\E}{$londocroot/res/}; |
$published=~s{^\Q$londocroot/priv/\E}{$londocroot/res/}; |
my ($type,$result); |
my ($type,$result); |
if ( -d $construct ) { |
if ( -d $construct ) { |
return ('error','<p><span class="LC_error">'.&mt('Error: destination for operation is an existing directory.').'</span></p>'); |
return ('error','<p class="LC_error">'.&mt('Error: destination for operation is an existing directory.').'</p>'); |
|
|
} |
} |
|
|
if ( -e $published) { |
if ( -e $published) { |
if ( -e $construct ) { |
if ( -e $construct ) { |
$type = 'warning'; |
$type = 'warning'; |
$result.='<p><span class="LC_warning">'.&mt('Warning: target file exists, and has been published!').'</span></p>'; |
$result.='<p class="LC_warning">'.&mt('Warning: target file exists, and has been published!').'</p>'; |
} else { |
} else { |
my $published_type = (-d $published) ? 'directory' : 'file'; |
my $published_type = (-d $published) ? 'directory' : 'file'; |
|
|
if ($published_type eq $creating) { |
if ($published_type eq $creating) { |
$type = 'warning'; |
$type = 'warning'; |
$result.='<p><span class="LC_warning">'.&mt("Warning: a published $published_type of this name exists.").'</span></p>'; |
$result.='<p class="LC_warning">'.&mt("Warning: a published $published_type of this name exists.").'</p>'; |
} else { |
} else { |
$type = 'error'; |
$type = 'error'; |
$result.='<p><span class="LC_error">'.&mt("Error: a published $published_type of this name exists.").'</span></p>'; |
$result.='<p class="LC_error">'.&mt("Error: a published $published_type of this name exists.").'</p>'; |
} |
} |
} |
} |
} elsif ( -e $construct) { |
} elsif ( -e $construct) { |
$type = 'warning'; |
$type = 'warning'; |
$result.='<p><span class="LC_warning">'.&mt('Warning: target file exists!').'</span></p>'; |
$result.='<p class="LC_warning">'.&mt('Warning: target file exists!').'</p>'; |
} |
} |
|
|
return ($type,$result); |
return ($type,$result); |
Line 344 sub checksuffix {
|
Line 344 sub checksuffix {
|
if ($old=~m:(.*)/+([^/]+)\.(\w+)$:) { $oldsuffix=$3; } |
if ($old=~m:(.*)/+([^/]+)\.(\w+)$:) { $oldsuffix=$3; } |
if (lc($oldsuffix) ne lc($newsuffix)) { |
if (lc($oldsuffix) ne lc($newsuffix)) { |
$result.= |
$result.= |
'<p><span class="LC_warning">'.&mt('Warning: change of MIME type!').'</span></p>'; |
'<p class="LC_warning">'.&mt('Warning: change of MIME type!').'></p>'; |
} |
} |
return $result; |
return $result; |
} |
} |
Line 367 sub cleanDest {
|
Line 367 sub cleanDest {
|
my ($newpath)=($dest=~m|(.*)/|); |
my ($newpath)=($dest=~m|(.*)/|); |
($newpath,$error)=&relativeDest($fn,$newpath,$uname,$udom); |
($newpath,$error)=&relativeDest($fn,$newpath,$uname,$udom); |
if (! -d "$newpath") { |
if (! -d "$newpath") { |
$request->print('<p><span class="LC_warning">' |
$request->print('<p class="LC_warning">' |
.&mt("You have requested to create file in directory [_1] which doesn't exist. The requested directory path has been removed from the requested filename." |
.&mt("You have requested to create file in directory [_1] which doesn't exist. The requested directory path has been removed from the requested filename." |
,&display($newpath)) |
,&display($newpath)) |
.'</span></p>'); |
.'</p>'); |
$dest=~s|.*/||; |
$dest=~s|.*/||; |
} |
} |
} |
} |
if ($dest =~ /\.(\d+)\.(\w+)$/){ |
if ($dest =~ /\.(\d+)\.(\w+)$/){ |
$request->print('<p><span class="LC_warning">' |
$request->print('<p class="LC_warning">' |
.&mt('Bad filename [_1]',&display($dest)) |
.&mt('Bad filename [_1]',&display($dest)) |
.'<br />' |
.'<br />' |
.&mt('[_1](name).(number).(extension)[_2] not allowed.','<tt>','</tt>') |
.&mt('[_1](name).(number).(extension)[_2] not allowed.','<tt>','</tt>') |
.'<br />' |
.'<br />' |
.&mt('Removing the [_1].number.[_2] from requested filename.','<tt>','</tt>') |
.&mt('Removing the [_1].number.[_2] from requested filename.','<tt>','</tt>') |
.'</span></p>'); |
.'</p>'); |
$dest =~ s/\.(\d+)(\.\w+)$/$2/; |
$dest =~ s/\.(\d+)(\.\w+)$/$2/; |
} |
} |
if ($foundbad) { |
if ($foundbad) { |
$request->print('<p><span class="LC_warning">' |
$request->print('<p class="LC_warning">' |
.&mt('Invalid characters in requested name have been removed.') |
.&mt('Invalid characters in requested name have been removed.') |
.'</span></p>' |
.'</p>' |
); |
); |
} |
} |
return ($dest,$error); |
return ($dest,$error); |
Line 708 sub Copy1 {
|
Line 708 sub Copy1 {
|
my ($dir,$fname) = ($fn =~ m{^(.+/)([^/]+)$}); |
my ($dir,$fname) = ($fn =~ m{^(.+/)([^/]+)$}); |
my $filesize = $fileinfo[7]; |
my $filesize = $fileinfo[7]; |
$filesize = int($filesize/1000); #expressed in kb |
$filesize = int($filesize/1000); #expressed in kb |
my $authorspace = $Apache::lonnet::perlvar{'lonDocRoot'}."/priv/$domain/$user"; |
my $output = &Apache::loncommon::excess_filesize_warning($user,$domain,'author', |
my $output = &Apache::loncommon::excess_filesize_warning($user,$domain,$authorspace, |
|
$fname,$filesize,'copy'); |
$fname,$filesize,'copy'); |
if ($output) { |
if ($output) { |
$request->print($output.'<br /><a href="'.&url($dir).'">'.&mt('Cancel').'</a></form>'); |
$request->print($output.'<br /><a href="'.&url($dir).'">'.&mt('Cancel').'</a></form>'); |
Line 896 sub NewFile1 {
|
Line 895 sub NewFile1 {
|
'</span></form></p>'. |
'</span></form></p>'. |
'<p><form action="'.&url($fn). |
'<p><form action="'.&url($fn). |
'" method="post"><p><input type="submit" value="'.&mt('Cancel').'" /></form></p>'); |
'" method="post"><p><input type="submit" value="'.&mt('Cancel').'" /></form></p>'); |
return; |
} elsif ($type ne 'warning') { |
|
my $query = ""; |
|
$query .= "?mode=" . $env{'form.mode'} unless (!exists($env{'form.mode'}) || !length($env{'form.mode'})); |
|
$request->print(' |
|
<script type="text/javascript"> |
|
window.location = "'.&url($newfilename). $query .'"; |
|
</script>'); |
|
} else { |
|
$request->print('<p>'.&mt('Make new file').' '.&display($newfilename).'?</p>'); |
|
$request->print('</form>'); |
|
$request->print('<form action="'.&url($newfilename). |
|
'" method="post"><p><input type="submit" value="'.&mt('Continue').'" /></p></form>'); |
|
$request->print('<form action="'.&url($fn). |
|
'" method="post"><p><input type="submit" value="'.&mt('Cancel').'" /></p></form>'); |
} |
} |
|
|
$request->print('<p>'.&mt('Make new file').' '.&display($newfilename).'?</p>'); |
|
$request->print('</form>'); |
|
|
|
$request->print('<form action="'.&url($newfilename). |
|
'" method="post"><p><input type="submit" value="'.&mt('Continue').'" /></p></form>'); |
|
$request->print('<form action="'.&url($fn). |
|
'" method="post"><p><input type="submit" value="'.&mt('Cancel').'" /></p></form>'); |
|
} |
} |
return; |
return; |
} |
} |
Line 1422 sub handler {
|
Line 1426 sub handler {
|
|
|
$r=shift; |
$r=shift; |
|
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['decompress','action','filename','newfilename']); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['decompress','action','filename','newfilename','mode']); |
|
|
&Debug($r, "loncfile.pm - handler entered"); |
&Debug($r, "loncfile.pm - handler entered"); |
&Debug($r, " filename: ".$env{'form.filename'}); |
&Debug($r, " filename: ".$env{'form.filename'}); |