Diff for /loncom/interface/portfolio.pm between versions 1.254.2.2.2.1 and 1.255

version 1.254.2.2.2.1, 2017/11/01 02:50:05 version 1.255, 2014/12/07 19:45:19
Line 199  sub display_portfolio_usage { Line 199  sub display_portfolio_usage {
                     .$helpitem                      .$helpitem
                     .'</div>'                      .'</div>'
                     .'<div>'                      .'<div>'
                     .&Apache::lonhtmlcommon::display_usage($current_disk_usage,                      .&Apache::lonhtmlcommon::display_usage($current_disk_usage,$disk_quota)
                                                            $disk_quota,'portfolio')  
                     .'</div>');                      .'</div>');
 }  }
   
Line 233  sub display_directory_line { Line 232  sub display_directory_line {
  if ($lock_info) {   if ($lock_info) {
     my %anchor_fields = ('lockinfo' => $fullpath);      my %anchor_fields = ('lockinfo' => $fullpath);
     if ($versions) { # hold the folder open      if ($versions) { # hold the folder open
         my ($fname,$version,$extension) = &Apache::grades::file_name_version_ext($fullpath);          my ($fname,$version,$extension) = &Apache::lonnet::file_name_version_ext($fullpath);
         $fname =~ s|^/||;          $fname =~ s|^/||;
         $anchor_fields{'showversions'} = $fname.'.'.$extension;          $anchor_fields{'showversions'} = $fname.'.'.$extension;
     }      }
Line 366  sub display_directory { Line 365  sub display_directory {
           } (@{$dir_list})) {            } (@{$dir_list})) {
        my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$dir_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::lonnet::file_name_version_ext($filename);
        if ($version) {         if ($version) {
         my $fullpath = &prepend_group($current_path.$fname.'.'.$extension);          my $fullpath = &prepend_group($current_path.$fname.'.'.$extension);
            push(@{ $versioned{$fullpath} },             push(@{ $versioned{$fullpath} },
Line 379  sub display_directory { Line 378  sub display_directory {
     my $zerobyte;      my $zerobyte;
     foreach my $dir_line (@dir_lines) {      foreach my $dir_line (@dir_lines) {
         my ($filename,$dom,$testdir,$size,$mtime,$obs) = @$dir_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::lonnet::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;
        my $show_versions;         my $show_versions;
Line 1069  sub build_access_summary { Line 1068  sub build_access_summary {
                     $r->print(&mt('Users: ').$curr_user_list);                      $r->print(&mt('Users: ').$curr_user_list);
                 } elsif ($scope eq 'ip') {                  } elsif ($scope eq 'ip') {
                     my $curr_ips_list = &sort_ips($content->{'ip'});                      my $curr_ips_list = &sort_ips($content->{'ip'});
                     $r->print(&mt('IP(s):').' '.$curr_ips_list);                      $r->print(&mt('IP(s): ').$curr_ips_list);
                 } else {                  } else {
                     $r->print('&nbsp;');                      $r->print('&nbsp;');
                 }                  }
Line 2568  sub get_quota { Line 2567  sub get_quota {
     } else {      } else {
         $disk_quota = &Apache::loncommon::get_user_quota($env{'user.name'},          $disk_quota = &Apache::loncommon::get_user_quota($env{'user.name'},
                                     $env{'user.domain'}); #expressed in MB                                      $env{'user.domain'}); #expressed in MB
         $disk_quota = 1024 * $disk_quota; # convert from MB to kB          $disk_quota = 1000 * $disk_quota; # convert from MB to kB
     }      }
     return $disk_quota;      return $disk_quota;
 }  }
Line 2598  STATE Line 2597  STATE
     return $state;      return $state;
 }  }
   
 sub valid_container {  
     my ($uname,$udom,$group) = @_;  
     my $container_prefix;  
     if ($group ne '') {  
         $container_prefix = "/uploaded/$udom/$uname/groups/$group/portfolio";  
     } else {  
         $container_prefix = "/uploaded/$udom/$uname/portfolio";  
     }  
     if ($env{'form.currentpath'}) {  
         $container_prefix .= $env{'form.currentpath'};  
     } else {  
         $container_prefix .= '/';  
     }  
     if ($env{'form.container'} =~ m{^\Q$container_prefix\E(.+)$}) {  
         my $filename = $1;  
         if ($filename eq &Apache::lonnet::clean_filename($filename)) {  
             return 1;  
         }  
     }  
     return;  
 }  
   
 sub invalid_parms {  
     my ($r,$url,$currentpath) = @_;  
     my $escpath = &HTML::Entities::encode($currentpath,'&<>"');  
     my $rtnlink = '<a href="'.$url;  
     if ($url =~ /\?/) {  
         $rtnlink .= '&';  
     } else {  
         $rtnlink .= '?';  
     }  
     $rtnlink .= 'currentpath='.$escpath;  
     $rtnlink .= '">'.&mt('Return to directory').'</a>';  
     $r->print('<h3>'.&mt('Action disallowed').'</h3>');  
     $r->print(&mt('Some of the data included with this request were invalid'));  
     $r->print('<br />'.$rtnlink);  
     return;  
 }  
   
 sub handler {  sub handler {
     # this handles file management      # this handles file management
     my $r = shift;      my $r = shift;
Line 2782  sub handler { Line 2742  sub handler {
             $r->print(&Apache::loncommon::end_page());              $r->print(&Apache::loncommon::end_page());
             return OK;              return OK;
         }          }
     }  
     if (($env{'form.currentpath'}) && ($env{'form.currentpath'} ne '/')) {  
         my $clean_currentpath = '/'.&Apache::loncommon::clean_path($env{'form.currentpath'}).'/';  
         unless ($env{'form.currentpath'} eq $clean_currentpath) {  
             &invalid_parms($r,$url);  
             $r->print(&Apache::loncommon::end_page());  
             return OK;  
         }  
     }  
     if ($env{'form.container'}) {  
         unless (&valid_container($uname,$udom,$group)) {  
             &invalid_parms($r,$url,$env{'form.currentpath'});  
             $r->print(&Apache::loncommon::end_page());  
             return OK;  
         }  
     }      }
     if (($env{'form.storeupl'}) & (!$env{'form.uploaddoc.filename'})){      if (($env{'form.storeupl'}) & (!$env{'form.uploaddoc.filename'})){
     $r->print(      $r->print(

Removed from v.1.254.2.2.2.1  
changed lines
  Added in v.1.255


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