--- loncom/interface/portfolio.pm 2011/10/17 12:41:30 1.233
+++ loncom/interface/portfolio.pm 2013/07/02 19:04:37 1.246
@@ -1,7 +1,7 @@
# The LearningOnline Network
# portfolio browser
#
-# $Id: portfolio.pm,v 1.233 2011/10/17 12:41:30 raeburn Exp $
+# $Id: portfolio.pm,v 1.246 2013/07/02 19:04:37 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -63,7 +63,7 @@ sub group_form_data {
return $output;
}
-# receives a file name and path stub from username/userfiles/portfolio/
+# receives a filename and path stub from username/userfiles/portfolio/
# returns an anchor tag consisting encoding filename and currentpath
sub make_anchor {
my ($url, $anchor_fields, $inner_text) = @_;
@@ -98,7 +98,7 @@ sub display_common {
my $help_fileupload = &Apache::loncommon::help_open_topic('Portfolio AddFiles');
my $help_createdir = &Apache::loncommon::help_open_topic('Portfolio CreateDirectory');
my $help_portfolio = &Apache::loncommon::help_open_topic('Portfolio About', &mt('Help on the portfolio'));
- $r->print(&display_usage($group));
+ $r->print(&display_portfolio_usage($group));
my $parse_check;
if (!&suppress_embed_prompt()) {
$parse_check = <<"END";
@@ -122,6 +122,7 @@ END
.''
.''
.''
+ .''
.''
.''
.''
@@ -139,6 +140,7 @@ END
.''.$groupitem
.''
.''
+ .''
.''
.''
.''
@@ -155,6 +157,7 @@ END
'selectfile' => $port_path,
'currentpath' => '/',
'mode' => $env{"form.mode"},
+ 'symb' => $env{"form.symb"},
'fieldname' => $env{"form.fieldname"},
'continue' => $env{"form.continue"}
);
@@ -168,6 +171,7 @@ END
'selectfile' => $tree[$i],
'currentpath' => $newCurrentPath,
'mode' => $env{"form.mode"},
+ 'symb' => $env{"form.symb"},
'fieldname' => $env{"form.fieldname"},
'continue' => $env{"form.continue"}
);
@@ -177,14 +181,14 @@ END
$r->print('');
$r->print(&Apache::loncommon::help_open_topic('Portfolio ChangeDirectory'));
&Apache::lonhtmlcommon::store_recent($namespace,$current_path,$current_path);
- $r->print('
@@ -633,17 +609,19 @@ sub display_file {
}
sub done {
- my ($message,$url)=@_;
- unless (defined $message) {
- $message='Done';
+ my ($linktext,$url)=@_;
+ unless (defined($linktext)) {
+ $linktext='Return to directory';
}
my %anchor_fields = (
'showversions' => $env{'form.showversions'},
'currentpath' => $env{'form.currentpath'},
'fieldname' => $env{'form.fieldname'},
+ 'symb' => $env{'form.symb'},
'mode' => $env{'form.mode'}
);
- my $result = '
' + .&mt('The file is locked and cannot be deleted.') + .'
' + .&done(undef,$url) + ); } else { if (scalar(@files)) { &open_form($r,$url); $r->print(''.&mt('Delete [_1]?',&display_file(undef,\@files)).'
'); &close_form($r,$url); } else { - $r->print("No file was checked to delete.'.&mt('No file was checked to delete.').'
'); $r->print(&done(undef,$url)); } } @@ -677,18 +659,21 @@ sub delete_confirmed { my $port_path = &get_port_path(); my $current_permissions = &Apache::lonnet::get_portfile_permissions($udom, $uname); + my @msg; foreach my $delete_file (@files) { - $result=&Apache::lonnet::removeuserfile($uname,$udom,$port_path. - $env{'form.currentpath'}. - $delete_file); + $result = + &Apache::lonnet::removeuserfile( + $uname,$udom,$port_path. + $env{'form.currentpath'}. + $delete_file); if ($result ne 'ok') { - $r->print('' - .&mt('An error occurred ([_1]) while trying to delete [_2].' - ,$result,&display_file(undef, $delete_file)) - .'' + .&mt('The file is locked and cannot be renamed.') + .'
' + ); $r->print(&done(undef,$url)); } else { &open_form($r,$url); @@ -780,13 +777,32 @@ sub rename_confirmed { my $filenewname=&Apache::lonnet::clean_filename($env{'form.filenewname'}); my ($uname,$udom) = &get_name_dom($group); my $port_path = &get_port_path(); + + # Display warning in case of filename cleaning has changed the filename + if ($filenewname ne $env{'form.filenewname'}) { + $r->print( + ''
+ .&mt('Invalid characters')
+ .'
'
+ .&mt('The new filename was changed from [_1] to [_2].'
+ ,''.&display_file('',$env{'form.filenewname'}).''
+ ,''.&display_file('',$filenewname).'')
+ .'
$msg
-
'.&mt('Completed upload of the file.').'
'.
- &mt('No embedded items identified.').'
'.&mt('No embedded items identified.').'
'); } } } + $r->print( + &Apache::loncommon::confirmwrapper( + &Apache::lonhtmlcommon::confirm_success( + &mt('File successfully uploaded')))); $r->print(&done(undef,$url)); } return; @@ -2090,6 +2132,7 @@ sub hidden_elems { } return <'.&mt("Completed upload of the file. This file contained references to other files. You must upload the referenced files or else the uploaded file may not work properly.").'
'. + $r->print(''.&mt('Completed upload of the file.').' '. + &mt('This file contained references to other files.').' '. + &mt('You must upload the referenced files or else the uploaded file may not work properly.'). + '
'. ''.&mt("Please select the locations from which the referenced files are to be uploaded.").'
'. $embedded. ''.&mt('or').'
'.&done('Return to directory',$url)); @@ -2140,10 +2186,13 @@ sub overwrite { } } if ($fname eq '') { - my $msg = &mt('Invalid filename: [_1]; the name of the uploaded file did not contain any letters, '. + $r->print( + &Apache::loncommon::confirmwrapper( + &Apache::lonhtmlcommon::confirm_success( + &mt('Invalid filename: [_1]; the name of the uploaded file did not contain any letters, '. 'so after eliminating special characters there was nothing left.', - ''.$env{'form.filename'}.''); - $r->print($msg.&done('Back',$url)); + ''.$env{'form.filename'}.''),1))); + $r->print(&done(undef,$url)); return; } $env{'form.'.$formname.'.filename'} = $fname; @@ -2154,9 +2203,11 @@ sub overwrite { \%allfiles,\%codebase,undef,undef,undef, undef,undef,undef,\$mimetype); if ($result !~ m|^/uploaded/|) { - $r->print(''.&mt('An error occurred ([_1]) while trying to overwrite [_2].' - ,$result,&display_file(undef,$fname)).''.&mt('Overwriting completed.').'
'.
- &mt('No embedded items identified.').'
'
+ .&mt('Invalid characters')
+ .'
'
+ .&mt('The new directory name was changed from [_1] to [_2].'
+ ,''.$env{'form.newdir'}.''
+ ,''.$newdir.'')
+ .'
'
+ .&mt('No file was selected to upload.')
+ .'
'
+ .&mt('To upload a file, click [_1]Browse...[_2] and select a file, then click [_1]Upload[_2].'
+ ,'','')
+ .'