Diff for /loncom/publisher/loncleanup.pm between versions 1.13 and 1.14

version 1.13, 2011/10/24 22:39:21 version 1.14, 2011/10/29 19:17:09
Line 278  sub phaseone { Line 278  sub phaseone {
 sub phasetwo {  sub phasetwo {
     # Check original file      # Check original file
     my ($r,$fn,$uname,$udom)=@_;      my ($r,$fn,$uname,$udom)=@_;
     open(IN,'/home/httpd/html/priv/'.$udom.'/'.$uname.'/'.$fn);  
     my $text='';      my $text='';
     while (my $line=<IN>) {      my $londocroot = $r->dir_config('lonDocRoot');
  $text.=$line;      if (open(IN,"<$londocroot/priv/$udom/$uname".$fn)) {
           while (my $line=<IN>) {
       $text.=$line;
           }
           close(IN);
     }      }
     close(IN);      my $uri="/priv/$udom/$uname".$fn;
     my $uri='/~'.$uname.$fn;  
     my $result=&Apache::lonnet::ssi_body($uri,      my $result=&Apache::lonnet::ssi_body($uri,
  ('grade_target'=>'web',   ('grade_target'=>'web',
   'return_only_error_and_warning_counts' => 1));    'return_only_error_and_warning_counts' => 1));
Line 310  sub phasetwo { Line 312  sub phasetwo {
                ($env{'form.symbol'} ne 'on'));                 ($env{'form.symbol'} ne 'on'));
     my ($main,$ext)=($fn=~/^(.*)\.(\w+)/);      my ($main,$ext)=($fn=~/^(.*)\.(\w+)/);
     my $newfn=$main.'_Auto_Cleaned_Up.'.$ext;      my $newfn=$main.'_Auto_Cleaned_Up.'.$ext;
     open(OUT,'>/home/httpd/html/priv/'.$udom.'/'.$uname.'/'.$newfn);      if (open(OUT,">$londocroot/priv/$udom/$uname".$newfn)) {
     print OUT $text;          print OUT $text;
     close(OUT);          close(OUT);
     my $newuri='/~'.$uname.$newfn;      }
       my $newuri="/priv/$udom/$uname".$newfn;
     $result=&Apache::lonnet::ssi_body($newuri,      $result=&Apache::lonnet::ssi_body($newuri,
                                          ('grade_target'=>'web',                                           ('grade_target'=>'web',
                                           'return_only_error_and_warning_counts' => 1));                                            'return_only_error_and_warning_counts' => 1));
Line 356  sub phasetwo { Line 359  sub phasetwo {
   
 sub phasethree {  sub phasethree {
     my ($r,$fn,$uname,$udom)=@_;      my ($r,$fn,$uname,$udom)=@_;
     my $old='/home/httpd/html/priv/'.$udom.'/'.$uname.'/'.$fn;      my $old=$r->dir_config('lonDocRoot')."/priv/$udom/$uname".$fn;
     my ($main,$ext)=($fn=~/^(.*)\.(\w+)/);      my ($main,$ext)=($fn=~/^(.*)\.(\w+)/);
     my $newfn=$main.'_Auto_Cleaned_Up.'.$ext;      my $newfn=$main.'_Auto_Cleaned_Up.'.$ext;
     my $new='/home/httpd/html/priv/'.$udom.'/'.$uname.'/'.$newfn;      my $new=$r->dir_config('lonDocRoot')."/priv/$udom/$uname".$newfn;
     if ($env{'form.accept'}) {      if ($env{'form.accept'}) {
  $r->print(   $r->print(
         '<p class="LC_info">'          '<p class="LC_info">'
Line 416  sub handler { Line 419  sub handler {
  return HTTP_NOT_ACCEPTABLE;   return HTTP_NOT_ACCEPTABLE;
     }      }
   
     $fn=~s{/~($LONCAPA::username_re)}{};      $fn=~s{^/priv/$LONCAPA::domain_re/$LONCAPA::username_re}{};
   
     &Apache::loncommon::content_type($r,'text/html');      &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;      $r->send_http_header;
Line 445  sub handler { Line 448  sub handler {
  }   }
     }      }
     my $dir=$fn;      my $dir=$fn;
     $dir=~s/\/[^\/]+$/\//;      $dir=~s{[^/]+$}{};
     $r->print(      $r->print(
         '</form>'          '</form>'
        .&Apache::lonhtmlcommon::start_funclist()         .&Apache::lonhtmlcommon::start_funclist()
        .&Apache::lonhtmlcommon::add_item_funclist(         .&Apache::lonhtmlcommon::add_item_funclist(
             '<a href="/priv/'.$udom.'/'.$uname.'/'.$fn.'">'.&mt('Back to Source File').'</a>')              '<a href="/priv/'.$udom.'/'.$uname.$fn.'">'.&mt('Back to Source File').'</a>')
        .&Apache::lonhtmlcommon::add_item_funclist(         .&Apache::lonhtmlcommon::add_item_funclist(
             '<a href="/priv/'.$udom.'/'.$uname.'/'.$dir.'">'.&mt('Back to Source Directory').'</a>')              '<a href="/priv/'.$udom.'/'.$uname.$dir.'">'.&mt('Back to Source Directory').'</a>')
        .&Apache::lonhtmlcommon::end_funclist()         .&Apache::lonhtmlcommon::end_funclist()
        .&Apache::loncommon::end_page()         .&Apache::loncommon::end_page()
     );      );

Removed from v.1.13  
changed lines
  Added in v.1.14


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