Diff for /loncom/publisher/lonupload.pm between versions 1.63 and 1.67

version 1.63, 2013/07/02 19:04:49 version 1.67, 2015/09/11 20:12:30
Line 201  sub phaseone { Line 201  sub phaseone {
         return;          return;
     }      }
     $filesize = int($filesize/1000); #expressed in kb      $filesize = int($filesize/1000); #expressed in kb
     my $disk_quota = &Apache::loncommon::get_user_quota($uname,$udom,'author'); #expressed in Mb      my $output = &Apache::loncommon::excess_filesize_warning($uname,$udom,'author',
     $disk_quota = int($disk_quota * 1000);                                                               $env{'form.upfile.filename'},$filesize,'upload');
     my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'};      if ($output) {
     my $current_disk_usage = &Apache::lonnet::diskusage($udom,$uname,"$londocroot/priv/$udom/$uname");          $r->print($output.&earlyout($fn,$uname,$udom));
     if (($current_disk_usage + $filesize) > $disk_quota){  
         $r->print('<span class="LC_warning">'.  
                   &mt('Unable to upload [_1]. (size = [_2] kilobytes). Disk quota will be exceeded.','<span class="LC_filename">'.$env{'form.upfile.filename'}.'</span>',$filesize).'</span>'.  
                   '<br />'.&mt('Disk quota is [_1] kilobytes. Your current disk usage is [_2] kilobytes.',$disk_quota,$current_disk_usage).  
                   '</p>'.  
                   &earlyout($fn,$uname,$udom));  
         return;          return;
     }      }
       
 # Split part that I can change from the part that I cannot change  # Split part that I can change from the part that I cannot change
     my ($fn1,$fn2)=($fn=~/^(\/priv\/[^\/]+\/[^\/]+\/)(.*)$/);      my ($fn1,$fn2)=($fn=~/^(\/priv\/[^\/]+\/[^\/]+\/)(.*)$/);
     # Display additional options for upload      # Display additional options for upload
Line 399  sub check_extension { Line 393  sub check_extension {
                         if ($pathchg) {                          if ($pathchg) {
                             if ($mode eq 'testbank') {                              if ($mode eq 'testbank') {
                                 $returnflag = 'embedded';                                  $returnflag = 'embedded';
                                 $result .=  '<p>'.&mt('Or [_1]continue[_2] the testbank import without modifying the references(s).','<a href="javascript:document.testbankForm.submit();">','</a>').'</p>';                                  $result .=  '<p>'.&mt('Or [_1]continue[_2] the testbank import without modifying the reference(s).','<a href="javascript:document.testbankForm.submit();">','</a>').'</p>';
                             }                              }
                         }                          }
                     }                      }
Line 433  sub phasethree { Line 427  sub phasethree {
     my $dir_root = $r->dir_config('lonDocRoot').$url_root;      my $dir_root = $r->dir_config('lonDocRoot').$url_root;
     my $path = &File::Basename::dirname($fn);      my $path = &File::Basename::dirname($fn);
     $path =~ s{^\Q$url_root\E}{};      $path =~ s{^\Q$url_root\E}{};
       my $dirpath = $url_root.$path.'/';
       $dirpath=~s{/+}{/}g;
     my $filename = &HTML::Entities::encode($env{'form.filename'},'<>&"');      my $filename = &HTML::Entities::encode($env{'form.filename'},'<>&"');
     my $state = &embedded_form_elems('modify_orightml',$filename,$mode).      my $state = &embedded_form_elems('modify_orightml',$filename,$mode).
                 '<input type="hidden" name="phase" value="four" />';                  '<input type="hidden" name="phase" value="four" />';
Line 443  sub phasethree { Line 439  sub phasethree {
     if ($mode ne 'imsimport' && $mode ne 'testbank') {      if ($mode ne 'imsimport' && $mode ne 'testbank') {
         $result .= '<br /><h3><a href="'.$fn.'">'.          $result .= '<br /><h3><a href="'.$fn.'">'.
                   &mt('View main file').'</a></h3>'.                    &mt('View main file').'</a></h3>'.
                   '<h3><a href="'.$url_root.$path.'">'.                    '<h3><a href="'.$dirpath.'">'.
                   &mt('Back to Directory').'</a></h3><br />';                    &mt('Back to Directory').'</a></h3><br />';
     }      }
     return ($result,$returnflag);      return ($result,$returnflag);
Line 472  sub phasefour { Line 468  sub phasefour {
     my $dir_root = $r->dir_config('lonDocRoot').$url_root;      my $dir_root = $r->dir_config('lonDocRoot').$url_root;
     my $path = &File::Basename::dirname($fn);      my $path = &File::Basename::dirname($fn);
     $path =~ s{^\Q$url_root\E}{};      $path =~ s{^\Q$url_root\E}{};
       my $dirpath = $url_root.$path.'/';
       $dirpath=~s{/+}{/}g;
     my $outcome =       my $outcome = 
         &Apache::loncommon::modify_html_refs($mode,$path,$uname,$udom,$dir_root);          &Apache::loncommon::modify_html_refs($mode,$path,$uname,$udom,$dir_root);
     $result .= $outcome;      $result .= $outcome;
     if ($mode ne 'imsimport' && $mode ne 'testbank') {      if ($mode ne 'imsimport' && $mode ne 'testbank') {
         $result .= '<br /><h3><a href="'.$fn.'">'.          $result .= '<br /><h3><a href="'.$fn.'">'.
                   &mt('View main file').'</a></h3>'.                    &mt('View main file').'</a></h3>'.
                   '<h3><a href="'.$url_root.$path.'">'.                    '<h3><a href="'.$dirpath.'">'.
                   &mt('Back to Directory').'</a></h3><br />';                    &mt('Back to Directory').'</a></h3><br />';
     }      }
     return $result;      return $result;

Removed from v.1.63  
changed lines
  Added in v.1.67


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