--- loncom/interface/portfolio.pm 2006/03/15 19:41:26 1.95 +++ loncom/interface/portfolio.pm 2006/06/07 18:41:48 1.102 @@ -30,6 +30,9 @@ use Apache::lontexconvert; use Apache::lonfeedback; use Apache::lonlocal; use Apache::lonnet; +use Apache::longroup; +use lib '/home/httpd/lib/perl'; +use LONCAPA; # receives a file name and path stub from username/userfiles/portfolio/ # returns an anchor tag consisting encoding filename and currentpath @@ -123,12 +126,31 @@ sub display_directory { my $checked_files; my $port_path = &get_port_path($group); my ($uname,$udom) = &get_name_dom($group); - my $namespace = &get_namespace($group); if (defined($group)) { $groupitem = ''; $groupecho = '&group='.$group; } - my %locked_files = &Apache::lonnet::get_marked_as_readonly_hash ($namespace,$udom,$uname); + my $current_permissions = &Apache::lonnet::get_portfile_permissions($udom, + $uname); + my %locked_files = &Apache::lonnet::get_marked_as_readonly_hash( + $current_permissions,$group); + my %access_controls = &Apache::lonnet::get_access_controls($current_permissions,$group); + my $now = time; + my $curr_access; + my $pub_access = 0; + foreach my $key (sort(keys(%access_controls))) { + my ($scope,$end,$start) = ($key =~ /^\d+:(\w+)_(\d*)_?(\d*)$/); + if (($now > $start) && (!$end || $end > $now)) { + if ($scope eq 'public') { + $pub_access = 1; + } + } + } + if (!$pub_access) { + $curr_access = 'Private' + } elsif ($pub_access) { + $curr_access = 'Public'; + } if ($env{"form.mode"} eq 'selectfile'){ &select_files($r); $checked_files =&Apache::lonnet::files_in_path($uname,$env{'form.currentpath'}); @@ -151,7 +173,7 @@ sub display_directory { $r->print('