');
- $r->print('
-
- ');
+ $r->print(' print("CHECKED");
+ &Apache::lonnet::logthis("checked");
+ } else {
+ &Apache::lonnet::logthis("not checked $$checked_files{$filename} $filename");
+ }
+ $r->print('> ');
$r->print(' ');
$r->print(''.
$filename.' ');
@@ -204,6 +208,10 @@ sub display_file_select {
}
}
$r->print('
+
+
+
+
');
@@ -245,14 +253,22 @@ sub done {
return ('');
}
sub delete {
my ($r)=@_;
- &open_form($r);
- $r->print(''.&mt('Delete').' '.&display_file().'?
');
- &close_form($r);
+ my @check;
+ my $file_name = $ENV{'form.currentpath'}.$ENV{'form.selectfile'};
+ if (&Apache::lonnet::is_locked($file_name,$ENV{'user.domain'},$ENV{'user.name'} ) eq 'true') {
+ $r->print ("The file is locked and cannot be deleted. ");
+ $r->print(&done());
+ } else {
+ &open_form($r);
+ $r->print(''.&mt('Delete').' '.&display_file().'?
');
+ &close_form($r);
+ }
}
sub delete_confirmed {
@@ -305,10 +321,16 @@ sub delete_dir_confirmed {
sub rename {
my ($r)=@_;
- &open_form($r);
- $r->print(''.&mt('Rename').' '.&display_file().' to
- ?
');
- &close_form($r);
+ my $file_name = $ENV{'form.currentpath'}.$ENV{'form.selectfile'};
+ if (&Apache::lonnet::is_locked($file_name,$ENV{'user.domain'},$ENV{'user.name'}) eq 'true') {
+ $r->print ("The file is locked and cannot be renamed. ");
+ $r->print(&done());
+ } else {
+ &open_form($r);
+ $r->print(''.&mt('Rename').' '.&display_file().' to
+ ?
');
+ &close_form($r);
+ }
}
sub rename_confirmed {
@@ -324,7 +346,7 @@ sub rename_confirmed {
my $result=
&Apache::lonnet::renameuserfile($ENV{'user.name'},$ENV{'user.domain'},
'portfolio'.$ENV{'form.currentpath'}.$ENV{'form.selectfile'},
- 'portfolio'.$ENV{'form.currentpath'}.$ENV{'form.filenewname'});
+ 'portfolio'.$ENV{'form.currentpath'}.$filenewname);
if ($result ne 'ok') {
$r->print(' An errror occured ('.$result.
') while trying to rename '.&display_file().' to '.
@@ -334,13 +356,31 @@ sub rename_confirmed {
}
sub select_files {
my ($r)=@_;
+ if ($ENV{'form.continue'} eq 'true') {
+ # here we update the selections for the currentpath
+ # eventually, have to handle removing those not checked, but . . .
+ my @items=&Apache::loncommon::get_env_multiple('form.selectedfile');
+ &Apache::lonnet::save_selected_files($ENV{'user.name'}, $ENV{'form.currentpath'}, @items);
+ } else {
+ if ($ENV{'form.currentpath'} eq '/') {
+ #empty the file for a fresh start
+ # &Apache::lonnet::clear_selected_files($ENV{'user.name'});
+ }
+ }
+ my @files = &Apache::lonnet::files_not_in_path($ENV{'user.name'}, $ENV{'form.currentpath'});
+ my $java_files = join ",", @files;
+ if ($java_files) {
+ $java_files.=',';
+ }
my $java_script =(<
function finishSelect() {
- fileList = "";
+ENDSMP
+ $java_script .= 'fileList = "'.$java_files.'";';
+ $java_script .= (<print($java_script);
$r->print("Select portfolio files
Check as many as you wish in response to the essay problem. ");
+ $r->print("Files selected from other directories: ");
+ foreach (&Apache::lonnet::files_not_in_path($ENV{'user.name'}, $ENV{'form.currentpath'})) {
+ $r->print($_." ");
+ }
}
sub upload {
my ($r)=@_;