--- loncom/interface/portfolio.pm 2007/06/11 17:13:30 1.180
+++ loncom/interface/portfolio.pm 2007/07/10 20:51:46 1.186
@@ -1,7 +1,7 @@
# The LearningOnline Network
# portfolio browser
#
-# $Id: portfolio.pm,v 1.180 2007/06/11 17:13:30 albertel Exp $
+# $Id: portfolio.pm,v 1.186 2007/07/10 20:51:46 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -289,8 +289,6 @@ sub display_directory {
my ($bfile)=split('&',$b,2);
return (lc($afile) cmp lc($bfile));
} (@$dir_list)) {
- #$strip holds directory/file name
- #$dom
my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$dir_line,16);
$filename =~ s/\s+$//;
my ($fname,$version,$extension) = &Apache::grades::file_name_version_ext($filename);
@@ -567,7 +565,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 +586,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 +594,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,15 +624,12 @@ 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
-# $r->print('
removing '.$directory_name.'
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 +713,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 +729,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).
'
';
}
@@ -1733,17 +1728,18 @@ ENDSMP
fileList = fileList + document.forms.checkselect.currentpath.value + document.forms.checkselect[i].value + "," ;
}
}
- opener.document.forms.lonhomework.$env{'form.fieldname'}.value=fileList;
+ var hwfield = opener.document.getElementsByName('$env{'form.fieldname'}');
+ hwfield[0].value = fileList;
self.close();
}
ENDSMP
$r->print($javascript);
- $r->print("
Completed upload of the file. This file contained references to other files. You can upload these now:
"); + $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 +1848,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 +1879,8 @@ sub upload_embedded { &Apache::lonnet::userfileupload('embedded_item_'.$i,'', $port_path.$path); if ($result !~ m|^/uploaded/|) { - $r->print(''.'An errror occured ('.$result. - ') while trying to upload '.&display_file($path,$fname).' Uploaded ".
@@ -1921,7 +1930,7 @@ sub lock_info {
}
}
}
- $r->print(&done('Back',$url));
+ $r->print(&done(&mt('Back'),$url));
return 'ok';
}
@@ -1945,20 +1954,20 @@ sub createdir {
}
}
if ($found_file){
- $r->print(''.'Unable to create a directory named '.$newdir.
- ' a file or directory by that name already exists.
');
+ $r->print(''.&mt('Unable to create a directory named').' '.$newdir.
+ ' '.&mt('a file or directory by that name already exists.').'
');
} else {
my ($uname,$udom) = &get_name_dom();
my $port_path = &get_port_path();
my $result=&Apache::lonnet::mkdiruserfile($uname,$udom,
$port_path.$env{'form.currentpath'}.$newdir);
if ($result ne 'ok') {
- $r->print(''.'An errror occured ('.$result.
+ $r->print(''.'An error occurred ('.$result.
') while trying to create a new directory '.&display_file().'
');
}
}
if ($newdir ne $env{'form.newdir'}) {
- $r->print("The new directory name was changed from:
".$env{'form.newdir'}." to $newdir ");
+ $r->print(&mt("The new directory name was changed from:
").$env{'form.newdir'}." ".&mt('to')." $newdir ");
}
$r->print(&done(undef,$url));
}
@@ -2153,16 +2162,16 @@ sub handler {
$env{'request.course.id'}.'/'.$group))) {
$portfolio_root = &get_portfolio_root();
} else {
- $r->print('You do not have the privileges required to access the shared files space for this group.');
+ $r->print(&mt('You do not have the privileges required to access the shared files space for this group.'));
$earlyout = 1;
}
} else {
- $r->print('Not a valid group for this course');
+ $r->print(&mt('Not a valid group for this course'));
$earlyout = 1;
}
$title = &mt('Group files').' for '.$group;
} else {
- $r->print('Invalid group');
+ $r->print(&mt('Invalid group'));
$earlyout = 1;
}
if ($earlyout) { return OK; }
@@ -2218,16 +2227,14 @@ sub handler {
return OK;
}
if (($env{'form.storeupl'}) & (!$env{'form.uploaddoc.filename'})){
- $r->print(''.
- 'No file was selected to upload.'.
- 'To upload a file, click Browse...'.
- ', select a file, then click Upload.'.
- '');
+ $r->print('');
+ $r->print(&mt('No file was selected to upload. '));
+ $r->print(&mt('To upload a file, click Browse... select a file, then click Upload.'));
+ $r->print('');
}
if ($env{'form.meta'}) {
&open_form($r,$url);
-# $r->print(&edit_meta_data($r, $env{'form.currentpath'}.$env{'form.selectfile'}));
- $r->print('Edit the meta data
');
+ $r->print(&mt('Edit the meta data').'
');
&close_form($r,$url);
}
if ($env{'form.store'}) {