Diff for /loncom/publisher/londiff.pm between versions 1.13 and 1.15

version 1.13, 2003/12/10 15:42:49 version 1.15, 2004/03/11 22:44:01
Line 56  use Apache::lonnet(); Line 56  use Apache::lonnet();
 use Apache::loncommon();  use Apache::loncommon();
 use Apache::lonlocal;  use Apache::lonlocal;
   
   
   sub get_split_file {
       my ($fn,$style)=@_;
       my $f1;
       my @f1;
       if ($style='local') {
    if (-e $fn) {
       my $fh=Apache::File->new($fn);
       my $line;
       while($line=<$fh>) {
    $f1.=$line;
       }
    }
       } elsif ($style eq 'remote') {
    my $f1=&Apache::lonnet::getfile($fn);
       }
       if ($f1=~/\r/) {
    @f1=split(/\r/,&Apache::lonnet::getfile($fn));      
    foreach my $line (@f1) {
       $line=~s/\n//g;
    }
       } else {
    @f1=split(/\n/,&Apache::lonnet::getfile($fn));      
       }
       return @f1;
   }
   
 sub handler {  sub handler {
   
   my $r=shift;    my $r=shift;
Line 91  sub handler { Line 118  sub handler {
   my @f1=();    my @f1=();
   my @f2=();    my @f2=();
   
   $r->content_type('text/html');    &Apache::loncommon::content_type($r,'text/html');
   $r->send_http_header;    $r->send_http_header;
   
   $r->print('<html><head><title>LON-CAPA Construction Diffs</title></head>');    $r->print('<html><head><title>LON-CAPA Construction Diffs</title></head>');
   
   $r->print(&Apache::loncommon::bodytag(&mt('Resource Differences')));    $r->print(&Apache::loncommon::bodytag('Resource Differences'));
   
       
   $r->print('<h1>'.&mt('Compare versions of').' <tt>'.$efn.'</tt></h1>');    $r->print('<h1>'.&mt('Compare versions of').' <tt>'.$efn.'</tt></h1>');
Line 112  sub handler { Line 139  sub handler {
   $r->print('<p><font color="red">');    $r->print('<p><font color="red">');
   if ($ENV{'form.versionone'} eq 'priv') {    if ($ENV{'form.versionone'} eq 'priv') {
       my $fn='/home/'.$cuname.'/public_html/'.$efn;        my $fn='/home/'.$cuname.'/public_html/'.$efn;
       if (-e $fn) {        @f1=&get_split_file($fn,'local');
   my $fh=Apache::File->new($fn);  
           my $line;  
           while($line=<$fh>) {  
              chomp($line);  
              $f1[$#f1+1]=$line;  
  }  
       }  
       $r->print('<b>'.&mt('Construction Space Version').'</b>');        $r->print('<b>'.&mt('Construction Space Version').'</b>');
   } else {    } else {
       my $fn=        my $fn=
Line 132  sub handler { Line 152  sub handler {
          $fn.=$efn;           $fn.=$efn;
  $r->print('<b>'.&mt('Current Version').'</b>');   $r->print('<b>'.&mt('Current Version').'</b>');
       }        }
       @f1=split(/\n/,&Apache::lonnet::getfile($fn));              @f1=&get_split_file($fn,'remote');
   }    }
   
   $r->print('</font><br />'.&mt('versus').'<br /><font color="green">');    $r->print('</font><br />'.&mt('versus').'<br /><font color="green">');
   
   if ($ENV{'form.versiontwo'} eq 'priv') {    if ($ENV{'form.versiontwo'} eq 'priv') {
       my $fn='/home/'.$cuname.'/public_html/'.$efn;        my $fn='/home/'.$cuname.'/public_html/'.$efn;
       if (-e $fn) {        @f2=&get_split_file($fn,'local');
   my $fh=Apache::File->new($fn);  
           my $line;  
           while($line=<$fh>) {  
              chomp($line);  
              $f2[$#f2+1]=$line;  
  }  
       }  
       $r->print('<b>'.&mt('Construction Space Version').'</b>');        $r->print('<b>'.&mt('Construction Space Version').'</b>');
   } else {    } else {
       my $fn=        my $fn=
Line 159  sub handler { Line 172  sub handler {
          $fn.=$efn;           $fn.=$efn;
  $r->print('<b>'.&mt('Current Version').'</b>');   $r->print('<b>'.&mt('Current Version').'</b>');
       }        }
       @f2=split(/\n/,&Apache::lonnet::getfile($fn));              @f2=&get_split_file($fn,'remote');
   }    }
   $r->print('</font></p>');    $r->print('</font></p>');
 # Run diff  # Run diff

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


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