Diff for /loncom/interface/portfolio.pm between versions 1.139 and 1.142

version 1.139, 2006/07/19 21:58:16 version 1.142, 2006/08/02 03:05:10
Line 149  TABLE Line 149  TABLE
 sub display_directory_line {  sub display_directory_line {
     my ($r,$select_mode,$fullpath, $filename, $mtime, $size, $css_class,      my ($r,$select_mode,$fullpath, $filename, $mtime, $size, $css_class,
  $line, $access_controls, $curr_access, $now, $version_flag,   $line, $access_controls, $curr_access, $now, $version_flag,
  $href_location, $url, $current_path, $access_admin_text)=@_;   $href_location, $url, $current_path, $access_admin_text, $versions)=@_;
     # my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$line,16);       # my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$line,16); 
     $r->print('<tr class="'.$css_class.'">');      $r->print('<tr class="'.$css_class.'">');
     $r->print($line);      $r->print($line);
Line 221  sub display_directory { Line 221  sub display_directory {
     my @dir_lines;      my @dir_lines;
     my @version_lines;      my @version_lines;
     my %versioned;      my %versioned;
     foreach my $line (sort       foreach my $dir_line (sort 
       {         { 
   my ($afile)=split('&',$a,2);    my ($afile)=split('&',$a,2);
   my ($bfile)=split('&',$b,2);    my ($bfile)=split('&',$b,2);
Line 229  sub display_directory { Line 229  sub display_directory {
       } (@$dir_list)) {        } (@$dir_list)) {
     #$strip holds directory/file name      #$strip holds directory/file name
     #$dom       #$dom 
     my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$line,16);       my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$dir_line,16); 
     $filename =~ s/\s+$//;      $filename =~ s/\s+$//;
     my ($fname,$version,$extension) = &Apache::grades::file_name_version_ext($filename);      my ($fname,$version,$extension) = &Apache::grades::file_name_version_ext($filename);
     if ($version) {      if ($version) {
Line 239  sub display_directory { Line 239  sub display_directory {
        push(@dir_lines, [$filename,$dom,$testdir,$size,$mtime,$obs]);         push(@dir_lines, [$filename,$dom,$testdir,$size,$mtime,$obs]);
     }      }
     }      }
     foreach my $line (@dir_lines) {      foreach my $dir_line (@dir_lines) {
         my ($filename,$dom,$testdir,$size,$mtime,$obs) = @$line;          my ($filename,$dom,$testdir,$size,$mtime,$obs) = @$dir_line;
         my ($fname,$version,$extension) = &Apache::grades::file_name_version_ext($filename);          my ($fname,$version,$extension) = &Apache::grades::file_name_version_ext($filename);
     if (($filename ne '.') && ($filename ne '..') && ($filename !~ /\.meta$/ ) && ($filename !~ /(.*)\.(\d+)\.([^\.]*)$/)) {      if (($filename ne '.') && ($filename ne '..') && ($filename !~ /\.meta$/ ) && ($filename !~ /(.*)\.(\d+)\.([^\.]*)$/)) {
        my %version_flag;         my %version_flag;
Line 332  sub display_directory { Line 332  sub display_directory {
  $curr_access = join('+ ',@allaccesses);   $curr_access = join('+ ',@allaccesses);
     }      }
  }   }
                 &display_directory_line($r,$select_mode,$fullpath, $filename, $mtime, $size, $css_class, $line, \%access_controls, $curr_access,                  &display_directory_line($r,$select_mode,$fullpath, $filename, $mtime, $size, $css_class, $line, 
                         $now, \%version_flag, $href_location, $url, $current_path, $access_admin_text);                                          \%access_controls, $curr_access,$now, \%version_flag, $href_location, 
 # $r->print('<tr class="'.$css_class.'">');                                          $url, $current_path, $access_admin_text);
 # $r->print($line);  
 # $r->print('<td><img alt="" src="'.&Apache::loncommon::icon($filename).'" /></td>');  
 # $r->print('<td>'.$version_flag{$filename}.'<a href="'.$href_location.$filename.'">'.  
 #  $filename.'</a></td>');   
 # $r->print('<td>'.$size.'</td>');  
 # $r->print('<td>'.&Apache::lonlocal::locallocaltime($mtime).'</td>');  
 # if ($select_mode ne 'true') {  
 #    $r->print('<td><span style="white-space: nowrap">'.  
 #      &mt($curr_access).'&nbsp;&nbsp;&nbsp;');  
 #    $r->print('<a href="'.$url.'?access='.$filename.  
 #      '&amp;currentpath='.$current_path.&group_args().  
 #      '">'.$access_admin_text.'</a></span></td>');  
 # }  
 # $r->print('</tr>'.$/);  
  if ($show_versions) {   if ($show_versions) {
     &display_directory_line($r,$select_mode,$fullpath, $css_class, $line, \%access_controls,       foreach my $dir_line (@version_lines) {
                         $now, \%version_flag, $href_location, $url, $current_path, $access_admin_text);          my ($v_filename,$dom,$testdir,$size,$mtime,$obs) = @$dir_line;
                           my ($v_fname,$version,$v_extension) = &Apache::grades::file_name_version_ext($v_filename);
                           if (($v_fname eq $fname)&&($v_extension eq $extension)) {
               &display_directory_line($r,$select_mode,$fullpath, $v_filename, $mtime, $size, 
                               $css_class, $line, \%access_controls, $curr_access, $now,
                                \%version_flag, $href_location, $url, $current_path, $access_admin_text, 1);
           }
       }
  }   }
             }              }
         }          }
Line 579  sub display_access { Line 571  sub display_access {
                                                                         $uname);                                                                          $uname);
     my %access_controls = &Apache::lonnet::get_access_controls($current_permissions,$group,$file_name);      my %access_controls = &Apache::lonnet::get_access_controls($current_permissions,$group,$file_name);
     my $aclcount = keys(%access_controls);      my $aclcount = keys(%access_controls);
     my $header = '<h3>'.&mt('Allowing others to retrieve portfolio file: [_1]',$port_path.$env{'form.currentpath'}.$env{'form.access'}).'</h3>';      my $header = '<h3>'.&mt('Allowing others to retrieve file: [_1]',$port_path.$env{'form.currentpath'}.$env{'form.access'}).'</h3>';
     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.').'<br /><ul><li>'.&mt('Public files are available to anyone without the need for login.').'</li><li>'.&mt('Passphrase-protected files do not require log-in, but will require the viewer to enter the passphrase you set.').'</li><li>'.&mt('Conditional files are accessible to logged-in users with accounts in the LON-CAPA network, who satisfy the conditions you set.').'<br />'.&mt('The conditions can include affiliation with a particular course or group, or a user account in a specific domain.').'<br />'.&mt('Alternatively access can be granted to people with specific LON-CAPA usernames and domains.').'</li></ul>';      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.').'<br /><ul><li>'.&mt('Public files are available to anyone without the need for login.').'</li><li>'.&mt('Passphrase-protected files do not require log-in, but will require the viewer to enter the passphrase you set.').'</li><li>'.&mt('Conditional files are accessible to logged-in users with accounts in the LON-CAPA network, who satisfy the conditions you set.').'<br />'.&mt('The conditions can include affiliation with a particular course or group, or a user account in a specific domain.').'<br />'.&mt('Alternatively access can be granted to people with specific LON-CAPA usernames and domains.').'</li></ul>';
   
       if ($group eq '') {
           $info .= (&mt("Direct others to the 'Display file listing' link (shown when there are viewable files) on your personal information page:<br /><a href='/adm/$udom/$uname/aboutme'>http://$ENV{'SERVER_NAME'}/adm/$udom/$uname/aboutme</a>"));
       }
       
     if ($can_setacl) {      if ($can_setacl) {
         &open_form($r,$url);          &open_form($r,$url);
         $r->print($header.$info);          $r->print($header.$info);
Line 755  sub update_access { Line 752  sub update_access {
         }          }
     }      }
     my $file_name = $env{'form.currentpath'}.$env{'form.selectfile'};      my $file_name = $env{'form.currentpath'}.$env{'form.selectfile'};
     $r->print('<h3>'.&mt('Allowing others to retrieve portfolio file: [_1]',      $r->print('<h3>'.&mt('Allowing others to retrieve file: [_1]',
               $port_path.$file_name).'</h3>'."\n");                $port_path.$file_name).'</h3>'."\n");
     $file_name = &prepend_group($file_name);      $file_name = &prepend_group($file_name);
     my ($uname,$udom) = &get_name_dom();      my ($uname,$udom) = &get_name_dom();
Line 1492  sub upload { Line 1489  sub upload {
             $file_name = $env{'form.currentpath'}.$file_name;              $file_name = $env{'form.currentpath'}.$file_name;
             $file_name = &prepend_group($file_name);              $file_name = &prepend_group($file_name);
             $found_file = 1;              $found_file = 1;
     # FIXME I think this is incorrect, prepend_group took care of this?  
             if (defined($group)) {  
                 $file_name = $group.'/'.$file_name;  
             }  
             if (&Apache::lonnet::is_locked($file_name,$udom,$uname) eq 'true') {              if (&Apache::lonnet::is_locked($file_name,$udom,$uname) eq 'true') {
                 $locked_file = 1;                  $locked_file = 1;
             }               } 

Removed from v.1.139  
changed lines
  Added in v.1.142


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>