--- loncom/publisher/loncfile.pm 2007/07/23 23:53:31 1.85
+++ loncom/publisher/loncfile.pm 2009/05/26 16:29:56 1.99
@@ -9,7 +9,7 @@
# and displays a page showing the results of the action.
#
#
-# $Id: loncfile.pm,v 1.85 2007/07/23 23:53:31 albertel Exp $
+# $Id: loncfile.pm,v 1.99 2009/05/26 16:29:56 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -109,6 +109,17 @@ sub Debug {
}
}
+sub done {
+ my ($url)=@_;
+ my $done=&mt("Done");
+ return(<$done
+
+ENDDONE
+}
+
=pod
=item URLToPath($url)
@@ -148,7 +159,7 @@ sub URLToPath {
my $Url = shift;
&Debug($r, "UrlToPath got: $Url");
$Url=~ s/\/+/\//g;
- $Url=~ s/^http\:\/\/[^\/]+//;
+ $Url=~ s/^https?\:\/\/[^\/]+//;
$Url=~ s/^\///;
$Url=~ s/(\~|priv\/)($match_username)\//\/home\/$2\/public_html\//;
&Debug($r, "Returning $Url \n");
@@ -165,7 +176,7 @@ sub url {
sub display {
my $fn=shift;
$fn=~s-^/home/($match_username)/public_html-/priv/$1-;
- return ''.$fn.'';
+ return ''.$fn.'';
}
@@ -341,6 +352,7 @@ sub cleanDest {
$foundbad=1;
$dest=~s/\.//g;
}
+ $dest =~ s/(\s+$|^\s+)//g;
if ($dest=~/[\#\?&%\":]/) {
$foundbad=1;
$dest=~s/[\#\?&%\":]//g;
@@ -349,13 +361,20 @@ sub cleanDest {
my ($newpath)=($dest=~m|(.*)/|);
$newpath=&relativeDest($fn,$newpath,$uname);
if (! -d "$newpath") {
- $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 file name.','"'.$newpath.'"')."
");
+ $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 file name."
+ ,'"'.&display($newpath).'"')
+ .'
');
$dest=~s|.*/||;
}
}
if ($dest =~ /\.(\d+)\.(\w+)$/){
$request->print(''
- .&mt('Bad filename [_1]. (name).(number).(extension) not allowed. Removing the .number. from requested filename.',$dest)
+ .&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/;
}
@@ -404,7 +423,7 @@ sub CloseForm1 {
my ($request, $fn) = @_;
$request->print('');
$request->print('');
+ '" method="post">');
}
@@ -434,7 +453,7 @@ Parameters:
sub CloseForm2 {
my ($request, $user, $fn) = @_;
- $request->print('
'.
+ &mt('The name of the new file needs to end with an appropriate file extension to indicate the type of file to create.').' '.
+ &mt('The following are valid extensions: [_1].',$validexts).
+ '
'.
+ '
'.
+ '');
+ return;
+ }
+
$request->print('
'.&mt('Make new file').' '.&display($newfilename).'?