--- loncom/publisher/loncfile.pm 2013/07/03 05:03:19 1.120 +++ loncom/publisher/loncfile.pm 2016/05/22 01:09:54 1.124 @@ -9,7 +9,7 @@ # and displays a page showing the results of the action. # # -# $Id: loncfile.pm,v 1.120 2013/07/03 05:03:19 raeburn Exp $ +# $Id: loncfile.pm,v 1.124 2016/05/22 01:09:54 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -279,28 +279,28 @@ sub exists { $published=~s{^\Q$londocroot/priv/\E}{$londocroot/res/}; my ($type,$result); if ( -d $construct ) { - return ('error','

'.&mt('Error: destination for operation is an existing directory.').'

'); + return ('error','

'.&mt('Error: destination for operation is an existing directory.').'

'); } if ( -e $published) { if ( -e $construct ) { $type = 'warning'; - $result.='

'.&mt('Warning: target file exists, and has been published!').'

'; + $result.='

'.&mt('Warning: target file exists, and has been published!').'

'; } else { my $published_type = (-d $published) ? 'directory' : 'file'; if ($published_type eq $creating) { $type = 'warning'; - $result.='

'.&mt("Warning: a published $published_type of this name exists.").'

'; + $result.='

'.&mt("Warning: a published $published_type of this name exists.").'

'; } else { $type = 'error'; - $result.='

'.&mt("Error: a published $published_type of this name exists.").'

'; + $result.='

'.&mt("Error: a published $published_type of this name exists.").'

'; } } } elsif ( -e $construct) { $type = 'warning'; - $result.='

'.&mt('Warning: target file exists!').'

'; + $result.='

'.&mt('Warning: target file exists!').'

'; } return ($type,$result); @@ -344,7 +344,7 @@ sub checksuffix { if ($old=~m:(.*)/+([^/]+)\.(\w+)$:) { $oldsuffix=$3; } if (lc($oldsuffix) ne lc($newsuffix)) { $result.= - '

'.&mt('Warning: change of MIME type!').'

'; + '

'.&mt('Warning: change of MIME type!').'>

'; } return $result; } @@ -367,27 +367,27 @@ sub cleanDest { my ($newpath)=($dest=~m|(.*)/|); ($newpath,$error)=&relativeDest($fn,$newpath,$uname,$udom); if (! -d "$newpath") { - $request->print('

' + $request->print('

' .&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)) - .'

'); + .'

'); $dest=~s|.*/||; } } if ($dest =~ /\.(\d+)\.(\w+)$/){ - $request->print('

' + $request->print('

' .&mt('Bad filename [_1]',&display($dest)) .'
' .&mt('[_1](name).(number).(extension)[_2] not allowed.','','') .'
' .&mt('Removing the [_1].number.[_2] from requested filename.','','') - .'

'); + .'

'); $dest =~ s/\.(\d+)(\.\w+)$/$2/; } if ($foundbad) { - $request->print('

' + $request->print('

' .&mt('Invalid characters in requested name have been removed.') - .'

' + .'

' ); } return ($dest,$error); @@ -708,9 +708,8 @@ sub Copy1 { my ($dir,$fname) = ($fn =~ m{^(.+/)([^/]+)$}); my $filesize = $fileinfo[7]; $filesize = int($filesize/1000); #expressed in kb - my $authorspace = $Apache::lonnet::perlvar{'lonDocRoot'}."/priv/$domain/$user"; - my $output = &Apache::loncommon::excess_filesize_authorspace($user,$domain,$authorspace, - $fname,$filesize,'copy'); + my $output = &Apache::loncommon::excess_filesize_warning($user,$domain,'author', + $fname,$filesize,'copy'); if ($output) { $request->print($output.'
'.&mt('Cancel').''); return; @@ -896,16 +895,21 @@ sub NewFile1 { '

'. '

'); - return; + } elsif ($type ne 'warning') { + my $query = ""; + $query .= "?mode=" . $env{'form.mode'} unless (!exists($env{'form.mode'}) || !length($env{'form.mode'})); + $request->print(' + '); + } else { + $request->print('

'.&mt('Make new file').' '.&display($newfilename).'?

'); + $request->print(''); + $request->print('

'); + $request->print('

'); } - - $request->print('

'.&mt('Make new file').' '.&display($newfilename).'?

'); - $request->print(''); - - $request->print('

'); - $request->print('

'); } return; } @@ -1422,7 +1426,7 @@ sub handler { $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, " filename: ".$env{'form.filename'});