');
$r->print('');
my $displayOut = '';
$r->print($displayOut);
@@ -54,6 +55,8 @@ sub display_directory {
$displayOut = '';
$r->print($displayOut);
@@ -74,15 +77,26 @@ sub display_directory {
&Apache::lonhtmlcommon::select_recent('portfolio','currentpath',
'this.form.submit();'));
$r->print("");
+}
+sub display_directory {
+ my ($r,$current_path,$is_empty,$dir_list)=@_;
+ my $iconpath= $r->dir_config('lonIconsURL') . "/";
+ my $display_out;
+ my %locked_files=&Apache::lonnet::dump('file_permissions',
+ $ENV{'user.domain'},$ENV{'user.name'});
+ my $locked_file;
+ foreach my $key (keys %locked_files) {
+ $locked_file .= $locked_files{$key}.':';
+ }
if ($is_empty && ($current_path ne '/')) {
- $displayOut = '';
- $r->print($displayOut);
+ $r->print($display_out);
return;
}
$r->print(''.
@@ -97,6 +111,13 @@ sub display_directory {
#$strip holds directory/file name
#$dom
my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$line,16);
+ if ($Apache::lonhomework::results{"resource.$ENV{'user.domain'}.$ENV{'user.name'}.$filename"}eq'true'){
+ &Apache::lonnet::logthis("found submitted file");
+ &Apache::lonnet::logthis("resource.$ENV{'user.domain'}.$ENV{'user.name'}.$filename");
+ } else {
+ &Apache::lonnet::logthis("$filename not found submitted file");
+ &Apache::lonnet::logthis("resource.$ENV{'user.domain'}.$ENV{'user.name'}.$filename");
+ }
if (($filename ne '.') && ($filename ne '..')) {
if ($dirptr&$testdir) {
$r->print(' | ');
@@ -133,6 +154,60 @@ sub display_directory {
# $r->print(&display_actions($current_path, $currentFile, $isEmpty));
$r->print(' ');
}
+sub display_file_select {
+ my ($r,$current_path,$is_empty,$dir_list)=@_;
+ my $iconpath= $r->dir_config('lonIconsURL') . "/";
+ my $display_out;
+ if ($is_empty && ($current_path ne '/')) {
+ $display_out = '';
+
+ $r->print($display_out);
+ return;
+ }
+ $r->print(''.
+ 'Select | | Name | Size | Last Modified | ');
+ my $href_location="/uploaded/$ENV{'user.domain'}/$ENV{'user.name'}/portfolio$current_path";
+ $r->print('
+
+
+ ');
+}
sub open_form {
my ($r)=@_;
@@ -168,7 +243,9 @@ sub display_file {
sub done {
return ('');
+ $ENV{'form.currentpath'}.
+ '&fieldname='.$ENV{'form.fieldname'}.
+ '">'.&mt('Done').'');
}
sub delete {
@@ -255,7 +332,30 @@ sub rename_confirmed {
}
$r->print(&done());
}
-
+sub select_files {
+ my ($r)=@_;
+ my $java_script =(<
+ function finishSelect() {
+ fileList = "";
+ for (i=0;i
+ENDSMP
+ $r->print($java_script);
+ $r->print("Select portfolio files
+ Check as many as you wish in response to the essay problem. ");
+}
sub upload {
my ($r)=@_;
my $fname=$ENV{'form.uploaddoc.filename'};
@@ -335,7 +435,7 @@ sub createdir {
sub handler {
# this handles file management
my $r = shift;
- my $portfolio_root = &Apache::loncommon::propath($ENV{'user.domain'},
+ my $portfolio_root = &Apache::loncommon::propath($ENV{'user.domain'},
$ENV{'user.name'}).
'/userfiles/portfolio';
&Apache::loncommon::no_cache($r);
@@ -349,7 +449,7 @@ sub handler {
$r->rflush();
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['selectfile','currentpath',
- 'currentfile']);
+ 'currentfile','action','fieldname','mode']);
if (($ENV{'form.storeupl'} eq 'Upload') & (!$ENV{'form.uploaddoc.filename'})){
$r->print(' No file was selected to upload.'.
'To upload a file, click Browse...'.
@@ -400,7 +500,13 @@ sub handler {
}
# need to know if directory is empty so it can be removed if desired
my $is_empty=(@dir_list == 2);
- &display_directory($r,$current_path,$is_empty,\@dir_list);
+ &display_common($r,$current_path,$is_empty,\@dir_list);
+ if ($ENV{"form.mode"} eq 'selectfile'){
+ &select_files($r);
+ &display_file_select($r,$current_path,$is_empty,\@dir_list);
+ } else {
+ &display_directory($r,$current_path,$is_empty,\@dir_list);
+ }
$r->print(" |