Diff for /loncom/interface/loncommon.pm between versions 1.1020 and 1.1021

version 1.1020, 2011/09/09 20:13:18 version 1.1021, 2011/10/17 12:41:30
Line 8499  sub ask_for_embedded_content { Line 8499  sub ask_for_embedded_content {
     foreach my $path (keys(%subdependencies)) {      foreach my $path (keys(%subdependencies)) {
         my %currsubfile;          my %currsubfile;
         if (($actionurl eq '/adm/portfolio') || ($actionurl eq '/adm/coursegrp_portfolio')) {           if (($actionurl eq '/adm/portfolio') || ($actionurl eq '/adm/coursegrp_portfolio')) { 
             my @subdir_list = &Apache::lonnet::dirlist($url.$path,$udom,$uname,$getpropath);              my ($sublistref,$listerror) =
             foreach my $line (@subdir_list) {                  &Apache::lonnet::dirlist($url.$path,$udom,$uname,$getpropath);
                 my ($file_name,$rest) = split(/\&/,$line,2);              if (ref($sublistref) eq 'ARRAY') {
                 $currsubfile{$file_name} = 1;                  foreach my $line (@{$sublistref}) {
                       my ($file_name,$rest) = split(/\&/,$line,2);
                       $currsubfile{$file_name} = 1;
                   }
             }              }
         } elsif (($actionurl eq '/adm/upload') || ($actionurl eq '/adm/testbank')) {          } elsif (($actionurl eq '/adm/upload') || ($actionurl eq '/adm/testbank')) {
             if (opendir(my $dir,$url.'/'.$path)) {              if (opendir(my $dir,$url.'/'.$path)) {
Line 8525  sub ask_for_embedded_content { Line 8528  sub ask_for_embedded_content {
     }      }
     my %currfile;      my %currfile;
     if (($actionurl eq '/adm/portfolio') || ($actionurl eq '/adm/coursegrp_portfolio')) {      if (($actionurl eq '/adm/portfolio') || ($actionurl eq '/adm/coursegrp_portfolio')) {
         my @dir_list = &Apache::lonnet::dirlist($url,$udom,$uname,$getpropath);          my ($dirlistref,$listerror) =
         foreach my $line (@dir_list) {              &Apache::lonnet::dirlist($url,$udom,$uname,$getpropath);
             my ($file_name,$rest) = split(/\&/,$line,2);          if (ref($dirlistref) eq 'ARRAY') {
             $currfile{$file_name} = 1;              foreach my $line (@{$dirlistref}) {
                   my ($file_name,$rest) = split(/\&/,$line,2);
                   $currfile{$file_name} = 1;
               }
         }          }
     } elsif (($actionurl eq '/adm/upload') || ($actionurl eq '/adm/testbank')) {      } elsif (($actionurl eq '/adm/upload') || ($actionurl eq '/adm/testbank')) {
         if (opendir(my $dir,$url)) {          if (opendir(my $dir,$url)) {
Line 9048  sub check_for_upload { Line 9054  sub check_for_upload {
     }      }
     $filesize =  $filesize/1000; #express in k (1024?)      $filesize =  $filesize/1000; #express in k (1024?)
     my $getpropath = 1;      my $getpropath = 1;
     my @dir_list = &Apache::lonnet::dirlist($portfolio_root.$path,$udom,$uname,      my ($dirlistref,$listerror) =
                                             $getpropath);           &Apache::lonnet::dirlist($portfolio_root.$path,$udom,$uname,$getpropath);
     my $found_file = 0;      my $found_file = 0;
     my $locked_file = 0;      my $locked_file = 0;
     my @lockers;      my @lockers;
Line 9057  sub check_for_upload { Line 9063  sub check_for_upload {
     if ($env{'request.course.id'}) {      if ($env{'request.course.id'}) {
         $navmap = Apache::lonnavmaps::navmap->new();          $navmap = Apache::lonnavmaps::navmap->new();
     }      }
     foreach my $line (@dir_list) {      if (ref($dirlistref) eq 'ARRAY') {
         my ($file_name,$rest)=split(/\&/,$line,2);          foreach my $line (@{$dirlistref}) {
         if ($file_name eq $fname){              my ($file_name,$rest)=split(/\&/,$line,2);
             $file_name = $path.$file_name;              if ($file_name eq $fname){
             if ($group ne '') {                  $file_name = $path.$file_name;
                 $file_name = $group.$file_name;                  if ($group ne '') {
             }                      $file_name = $group.$file_name;
             $found_file = 1;                  }
             if (&Apache::lonnet::is_locked($file_name,$udom,$uname,\@lockers) eq 'true') {                  $found_file = 1;
                 foreach my $lock (@lockers) {                  if (&Apache::lonnet::is_locked($file_name,$udom,$uname,\@lockers) eq 'true') {
                     if (ref($lock) eq 'ARRAY') {                      foreach my $lock (@lockers) {
                         my ($symb,$crsid) = @{$lock};                          if (ref($lock) eq 'ARRAY') {
                         if ($crsid eq $env{'request.course.id'}) {                              my ($symb,$crsid) = @{$lock};
                             if (ref($navmap)) {                              if ($crsid eq $env{'request.course.id'}) {
                                 my $res = $navmap->getBySymb($symb);                                  if (ref($navmap)) {
                                 foreach my $part (@{$res->parts()}) {                                       my $res = $navmap->getBySymb($symb);
                                     my ($slot_status,$slot_time,$slot_name)=$res->check_for_slot($part);                                      foreach my $part (@{$res->parts()}) { 
                                     unless (($slot_status == $res->RESERVED) ||                                          my ($slot_status,$slot_time,$slot_name)=$res->check_for_slot($part);
                                             ($slot_status == $res->RESERVED_LOCATION)) {                                          unless (($slot_status == $res->RESERVED) ||
                                         $locked_file = 1;                                                  ($slot_status == $res->RESERVED_LOCATION)) {
                                               $locked_file = 1;
                                           }
                                     }                                      }
                                   } else {
                                       $locked_file = 1;
                                 }                                  }
                             } else {                              } else {
                                 $locked_file = 1;                                  $locked_file = 1;
                             }                              }
                         } else {  
                             $locked_file = 1;  
                         }                          }
                     }                     }
                 }                  } else {
             } else {                      my @info = split(/\&/,$rest);
                 my @info = split(/\&/,$rest);                      my $currsize = $info[6]/1000;
                 my $currsize = $info[6]/1000;                      if ($currsize < $filesize) {
                 if ($currsize < $filesize) {                          my $extra = $filesize - $currsize;
                     my $extra = $filesize - $currsize;                          if (($current_disk_usage + $extra) > $disk_quota) {
                     if (($current_disk_usage + $extra) > $disk_quota) {                              my $msg = '<span class="LC_error">'.
                         my $msg = '<span class="LC_error">'.                                        &mt('Unable to upload [_1]. (size = [_2] kilobytes). Disk quota will be exceeded if existing (smaller) file with same name (size = [_3] kilobytes) is replaced.',
                                   &mt('Unable to upload [_1]. (size = [_2] kilobytes). Disk quota will be exceeded if existing (smaller) file with same name (size = [_3] kilobytes) is replaced.',                                            '<span class="LC_filename">'.$fname.'</span>',$filesize,$currsize).'</span>'.
                                       '<span class="LC_filename">'.$fname.'</span>',$filesize,$currsize).'</span>'.                                        '<br />'.&mt('Disk quota is [_1] kilobytes. Your current disk usage is [_2] kilobytes.',
                                   '<br />'.&mt('Disk quota is [_1] kilobytes. Your current disk usage is [_2] kilobytes.',                                                     $disk_quota,$current_disk_usage);
                                                $disk_quota,$current_disk_usage);                              return ('will_exceed_quota',$msg);
                         return ('will_exceed_quota',$msg);                          }
                     }                      }
                 }                  }
             }              }

Removed from v.1.1020  
changed lines
  Added in v.1.1021


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