--- loncom/interface/portfolio.pm 2007/06/11 20:56:38 1.181 +++ loncom/interface/portfolio.pm 2007/06/11 21:29:44 1.184 @@ -1,7 +1,7 @@ # The LearningOnline Network # portfolio browser # -# $Id: portfolio.pm,v 1.181 2007/06/11 20:56:38 albertel Exp $ +# $Id: portfolio.pm,v 1.184 2007/06/11 21:29:44 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -567,7 +567,7 @@ sub delete_confirmed { $delete_file); if ($result ne 'ok') { $r->print(''. - &mt('An error occured ([_1]) while trying to delete + &mt('An error occurred ([_1]) while trying to delete [_2].',$result,&display_file(undef, $delete_file)). '

'); } else { @@ -588,7 +588,7 @@ sub delete_confirmed { &Apache::lonnet::modify_access_controls($file_name,\%changes, $udom,$uname); if ($outcome ne 'ok') { - $r->print('
'.&mt("An error occured ([_1]) while ". + $r->print('
'.&mt("An error occurred ([_1]) while ". "trying to delete access controls for the file.",$outcome). '

'); } else { @@ -596,7 +596,7 @@ sub delete_confirmed { $r->print('
'.&mt('Access controls also deleted for the file.').'

'); } else { $r->print(''.'
'. - &mt("An error occured ([_1]) while ". + &mt("An error occurred ([_1]) while ". "trying to delete access controls for the file.",$deloutcome). '


'); } @@ -626,7 +626,7 @@ sub delete_dir_confirmed { $directory_name); if ($result ne 'ok') { - $r->print(' An error occured (dir) ('.$result. + $r->print(' An error occurred (dir) ('.$result. ') while trying to delete '.$directory_name.'
'); } else { # now remove from recent @@ -681,7 +681,7 @@ sub rename_confirmed { $chg_access = &access_for_renamed($filenewname,$group,$udom,$uname); } else { $r->print(''. - &mt('An error occured ([_1]) while trying to rename [_2]' + &mt('An error occurred ([_1]) while trying to rename [_2]' .' to [_3]',$result,&display_file(), &display_file('',$filenewname)).'
'); return; @@ -718,13 +718,13 @@ sub access_for_renamed { &Apache::lonnet::modify_access_controls($oldfile,\%change_old, $udom,$uname); if ($outcome ne 'ok') { - $chg_text ='

'.&mt("An error occured ([_1]) while ". + $chg_text ='

'.&mt("An error occurred ([_1]) while ". "trying to delete access control records for the old name.",$outcome). '

'; } else { if ($deloutcome ne 'ok') { $chg_text = '


'. - &mt("An error occured ([_1]) while ". + &mt("An error occurred ([_1]) while ". "trying to delete access control records for the old name.",$deloutcome). '

'; } @@ -734,7 +734,7 @@ sub access_for_renamed { $udom,$uname); if ($outcome ne 'ok') { $chg_text .= '

'. - &mt("An error occured ([_1]) while ". + &mt("An error occurred ([_1]) while ". "trying to update access control records for the new name.",$outcome). '
'; } @@ -1818,7 +1818,7 @@ sub upload { $port_path.$env{'form.currentpath'}, $mode,\%allfiles,\%codebase); if ($result !~ m|^/uploaded/|) { - $r->print(''.'An error occured ('.$result. + $r->print(''.'An error occurred ('.$result. ') while trying to upload '.&display_file().'
'); $r->print(&done('Back',$url)); } else { @@ -1829,7 +1829,9 @@ sub upload { STATE - $r->print("

Completed upload of the file. This file contained references to other files. You can upload these now:

"); + $r->print("

".&mt("Reference Warning")."

"); + $r->print("

".&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("Please select the locations from which the referenced files are to be uploaded.")."

"); $r->print(&Apache::londocs::ask_for_embedded_content('/adm/portfolio',$state,\%allfiles,\%codebase, {'error_on_invalid_names' => 1, 'ignore_remote_references' => 1,})); @@ -1844,11 +1846,16 @@ sub upload_embedded { my ($r,$url,$group)=@_; for (my $i=0; $i<$env{'form.number_embedded_items'}; $i++) { next if (!exists($env{'form.embedded_item_'.$i.'.filename'})); - + my $orig_uploaded_filename = + $env{'form.embedded_item_'.$i.'.filename'}; + $env{'form.embedded_orig_'.$i} = &unescape($env{'form.embedded_orig_'.$i}); my ($path,$fname) = ($env{'form.embedded_orig_'.$i} =~ m{(.*/)([^/]*)}); + # no path, whole string is fname + if (!$fname) { $fname = $env{'form.embedded_orig_'.$i} }; + $path = $env{'form.currentpath'}.$path; $fname = &Apache::lonnet::clean_filename($fname); @@ -1870,8 +1877,8 @@ sub upload_embedded { &Apache::lonnet::userfileupload('embedded_item_'.$i,'', $port_path.$path); if ($result !~ m|^/uploaded/|) { - $r->print(''.'An error occured ('.$result. - ') while trying to upload '.&display_file($path,$fname).'
'); + $r->print(''.'An error occurred ('.$result. + ') while trying to upload '.$orig_uploaded_filename.' for embedded element '.$env{'form.embedded_orig_'.$i}.'
'); next; } else { $r->print("

Uploaded ". @@ -1953,7 +1960,7 @@ sub createdir { my $result=&Apache::lonnet::mkdiruserfile($uname,$udom, $port_path.$env{'form.currentpath'}.$newdir); if ($result ne 'ok') { - $r->print(''.'An error occured ('.$result. + $r->print(''.'An error occurred ('.$result. ') while trying to create a new directory '.&display_file().'
'); } }