--- loncom/interface/portfolio.pm 2004/10/11 22:52:20 1.47
+++ loncom/interface/portfolio.pm 2004/10/12 00:44:05 1.48
@@ -38,7 +38,7 @@ sub make_anchor {
return $anchor;
}
my $dirptr=16384;
-sub display_directory {
+sub display_common {
my ($r,$current_path,$is_empty,$dir_list)=@_;
my $iconpath= $r->dir_config('lonIconsURL') . "/";
$r->print('
');
@@ -73,15 +73,20 @@ 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;
if ($is_empty && ($current_path ne '/')) {
- $displayOut = '';
- $r->print($displayOut);
+ $r->print($display_out);
return;
}
$r->print('
'.
@@ -135,53 +140,23 @@ sub display_directory {
sub display_file_select {
my ($r,$current_path,$is_empty,$dir_list)=@_;
my $iconpath= $r->dir_config('lonIconsURL') . "/";
- $r->print('
');
- $r->print('
');
- my $displayOut = '';
- $r->print($displayOut);
- $r->print('
');
- my @tree = split (/\//,$current_path);
- $r->print(''.&make_anchor('portfolio','/').'/');
- if (@tree > 1){
- my $newCurrentPath = '';
- for (my $i = 1; $i< @tree; $i++){
- $newCurrentPath .= $tree[$i].'/';
- $r->print(&make_anchor($tree[$i],'/'.$newCurrentPath).'/');
- }
- }
- $r->print('');
- &Apache::lonhtmlcommon::store_recent('portfolio',$current_path,$current_path);
- #Fixme -- remove from recent those paths that are deleted
- $r->print(' ");
+ my $display_out;
if ($is_empty && ($current_path ne '/')) {
- $displayOut = '';
- $r->print($displayOut);
+ $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('
');
+ $r->print('
+
+
+ ');
}
sub open_form {
@@ -346,6 +315,16 @@ sub rename_confirmed {
}
sub select_files {
my ($r)=@_;
+ my $java_script =(<
+ function finishSelect() {
+ opener.document.forms.lonhomework.selectedfiles.value='files were selected';
+
+ self.close();
+ }
+
+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'},
@@ -379,6 +358,7 @@ sub select_files {
}
# 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("