--- loncom/interface/portfolio.pm 2004/10/12 00:44:05 1.48 +++ loncom/interface/portfolio.pm 2004/11/03 21:02:49 1.54 @@ -44,8 +44,10 @@ sub display_common { $r->print(''); $r->print(''); @@ -226,7 +243,9 @@ sub display_file { sub done { return ('

'.&mt('Done').'

'); + $ENV{'form.currentpath'}. + '&fieldname='.$ENV{'form.fieldname'}. + '">'.&mt('Done').''); } sub delete { @@ -318,8 +337,17 @@ sub select_files { my $java_script =(< function finishSelect() { - opener.document.forms.lonhomework.selectedfiles.value='files were selected'; - + fileList = ""; + for (i=0;i @@ -327,41 +355,6 @@ ENDSMP $r->print($java_script); $r->print("

Select portfolio files

Check as many as you wish in response to the essay problem.
"); - my $portfolio_root = &Apache::loncommon::propath($ENV{'user.domain'}, - $ENV{'user.name'}). - '/userfiles/portfolio'; - my $current_path='/'; - if ($ENV{'form.currentpath'}) { - $current_path = $ENV{'form.currentpath'}; - } - my @dir_list=&Apache::lonnet::dirlist($current_path, - $ENV{'user.domain'}, - $ENV{'user.name'},$portfolio_root); - if ($dir_list[0] eq 'no_such_dir'){ - # two main reasons for this: - # 1) never been here, so directory structure not created - # 2) back-button navigation after deleting a directory - if ($current_path eq '/'){ - &Apache::lonnet::mkdiruserfile($ENV{'user.name'}, - $ENV{'user.domain'},'portfolio'); - } else { - # some directory that snuck in get rid of the directory - # from the recent pulldown, just in case - &Apache::lonhtmlcommon::remove_recent('portfolio', - [$current_path]); - $current_path = '/'; # force it back to the root - } - # now grab the directory list again, for the first time - @dir_list=&Apache::lonnet::dirlist($current_path, - $ENV{'user.domain'}, - $ENV{'user.name'},$portfolio_root); - } - # need to know if directory is empty so it can be removed if desired - my $is_empty=(@dir_list == 2); - &display_common($r,$current_path,$is_empty,\@dir_list); - &display_file_select($r,$current_path,$is_empty,\@dir_list); - $r->print("\n\n"); - return OK; } sub upload { my ($r)=@_; @@ -456,7 +449,7 @@ sub handler { $r->rflush(); &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['selectfile','currentpath', - 'currentfile','action']); + '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...'. @@ -464,8 +457,6 @@ sub handler { } if ($ENV{'form.uploaddoc.filename'}) { &upload($r); - } elsif ($ENV{'form.action'} eq 'selectfile') { - &select_files($r); } elsif ($ENV{'form.action'} eq 'delete' && $ENV{'form.confirmed'}) { &delete_confirmed($r); } elsif ($ENV{'form.action'} eq 'delete') { @@ -510,7 +501,12 @@ sub handler { # need to know if directory is empty so it can be removed if desired my $is_empty=(@dir_list == 2); &display_common($r,$current_path,$is_empty,\@dir_list); - &display_directory($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("\n\n"); return OK; }
'); my $displayOut = '
'; - $displayOut = $displayOut.''. + $displayOut .= ''. ''. + ''. + ''. ''. '
'; $r->print($displayOut); @@ -53,6 +55,8 @@ sub display_common { $displayOut = '
'; $displayOut .= ''. ''. + ''. + ''. ''. '
'; $r->print($displayOut); @@ -78,6 +82,12 @@ 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 '/')) { $display_out = '
'. ''. @@ -101,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('