--- loncom/interface/portfolio.pm 2006/07/08 01:20:40 1.132 +++ loncom/interface/portfolio.pm 2006/07/18 01:25:43 1.134 @@ -1,7 +1,7 @@ # The LearningOnline Network # portfolio browser # -# $Id: portfolio.pm,v 1.132 2006/07/08 01:20:40 raeburn Exp $ +# $Id: portfolio.pm,v 1.134 2006/07/18 01:25:43 banghart Exp $ # # Copyright Michigan State University Board of Trustees # @@ -128,6 +128,59 @@ TABLE 'this.form.submit();')); $r->print(""); } +sub display_directory_line { + my ($r,$select_mode,$fullpath, $css_class, $line, $access_controls, + $now, $version_flag, $href_location, $url, $current_path, $groupecho, $access_admin_text)=@_; + my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$line,16); + $r->print(''); + $r->print($line); + my $curr_access; + if ($select_mode ne 'true') { + my $pub_access = 0; + my $guest_access = 0; + my $cond_access = 0; + foreach my $key (sort(keys(%{$$access_controls{$fullpath}}))) { + my ($num,$scope,$end,$start) = &unpack_acc_key($key); + if (($now > $start) && (!$end || $end > $now)) { + if ($scope eq 'public') { + $pub_access = 1; + } elsif ($scope eq 'guest') { + $guest_access = 1; + } else { + $cond_access = 1; + } + } + } + if (!$pub_access && !$guest_access && !$cond_access) { + $curr_access = &mt('Private'); + } else { + my @allaccesses; + if ($pub_access) { + push(@allaccesses,&mt('Public')); + } + if ($guest_access) { + push(@allaccesses,&mt('Passphrase-protected')); + } + if ($cond_access) { + push(@allaccesses,&mt('Conditional')); + } + $curr_access = join('+ ',@allaccesses); + } + } + $r->print(''); + $r->print(''.$$version_flag{$filename}.''. + $filename.''); + $r->print(''.$size.''); + $r->print(''.&Apache::lonlocal::locallocaltime($mtime).''); + if ($select_mode ne 'true') { + $r->print(''. + &mt($curr_access).'   '); + $r->print(''.$access_admin_text.''); + } + $r->print(''.$/); +} sub display_directory { my ($r,$url,$current_path,$is_empty,$dir_list,$group,$can_upload, $can_modify,$can_delete,$can_setacl)=@_; @@ -214,7 +267,11 @@ sub display_directory { $show_versions = 'true'; } if (exists($versioned{$filename})) { - $version_flag{$filename} = ''.&mt('closed folder').''; + if ($show_versions) { + $version_flag{$filename} = ''.&mt('opened folder').''; + } else { + $version_flag{$filename} = ''.&mt('closed folder').''; + } } else { $version_flag{$filename} = ''; } @@ -260,6 +317,8 @@ sub display_directory { $line .= ''; } } +# &display_directory_line($r,$select_mode,$fullpath, $css_class, $line, \%access_controls, +# $now, \%version_flag, $href_location, $url, $current_path, $groupecho, $access_admin_text); $r->print(''); $r->print($line); my $curr_access; @@ -308,6 +367,9 @@ sub display_directory { '">'.$access_admin_text.''); } $r->print(''.$/); + if ($show_versions) { + + } } } } @@ -534,7 +596,7 @@ sub rename_confirmed { } sub display_access { - my ($r,$url,$group,$can_setacl) = @_; + my ($r,$url,$group,$can_setacl,$port_path) = @_; my ($uname,$udom) = &get_name_dom($group); my $file_name = $env{'form.currentpath'}.$env{'form.access'}; $file_name = &prepend_group($file_name,$group); @@ -542,7 +604,7 @@ sub display_access { $uname); my %access_controls = &Apache::lonnet::get_access_controls($current_permissions,$group,$file_name); my $aclcount = keys(%access_controls); - my $header = '

'.&mt('Allowing others to retrieve portfolio file: [_1]',$env{'form.currentpath'}.$env{'form.access'}).'

'; + my $header = '

'.&mt('Allowing others to retrieve portfolio file: [_1]',$port_path.$env{'form.currentpath'}.$env{'form.access'}).'

'; my $info .= &mt('Access to this file by others can be set to be one or more of the following types: public, passphrase-protected or conditional.').'
'; if ($can_setacl) { &open_form($r,$url); @@ -698,7 +760,7 @@ sub build_access_summary { sub update_access { - my ($r,$url,$group) = @_; + my ($r,$url,$group,$port_path) = @_; my $totalprocessed = 0; my %processing; my %title = ( @@ -724,7 +786,7 @@ sub update_access { } my $file_name = $env{'form.currentpath'}.$env{'form.selectfile'}; $r->print('

'.&mt('Allowing others to retrieve portfolio file: [_1]', - $file_name).'

'."\n"); + $port_path.$file_name).''."\n"); $file_name = &prepend_group($file_name,$group); my ($uname,$udom) = &get_name_dom($group); my ($errors,$outcome,$deloutcome,$new_values,$translation); @@ -820,7 +882,10 @@ sub update_access { } $r->print('
'. - &mt('Display all access settings for this file').''); + &mt('Display all access settings for this file').''. + '     '. + ''.&mt('Return to directory listing').''); } return; } @@ -1774,6 +1839,7 @@ sub handler { $can_setacl = 1; } + my $port_path = &get_port_path($group); &Apache::loncommon::no_cache($r); &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; @@ -1851,10 +1917,10 @@ sub handler { } elsif ($env{'form.access'}) { $env{'form.selectfile'} = $env{'form.access'}; $env{'form.action'} = 'chgaccess'; - &display_access($r,$url,$group,$can_setacl); + &display_access($r,$url,$group,$can_setacl,$port_path); } elsif ($env{'form.action'} eq 'chgaccess') { if ($can_setacl) { - &update_access($r,$url,$group); + &update_access($r,$url,$group,$port_path); } else { &missing_priv($r,$url,'setacl',$group); }