Diff for /loncom/publisher/londiff.pm between versions 1.17 and 1.20

version 1.17, 2005/05/29 01:46:16 version 1.20, 2006/09/13 21:43:26
Line 32  package Apache::londiff; Line 32  package Apache::londiff;
 use strict;  use strict;
 use Apache::File;  use Apache::File;
 use File::Copy;  use File::Copy;
   use File::Compare;
 use Algorithm::Diff qw(diff);  use Algorithm::Diff qw(diff);
 use Apache::Constants qw(:common :http :methods);  use Apache::Constants qw(:common :http :methods);
 use Apache::loncacc;  use Apache::loncacc();
 use Apache::lonnet;  use Apache::lonnet;
 use Apache::loncommon();  use Apache::loncommon();
   use Apache::lonretrieve();
 use Apache::lonlocal;  use Apache::lonlocal;
   
   
Line 44  sub get_split_file { Line 46  sub get_split_file {
     my ($fn,$style)=@_;      my ($fn,$style)=@_;
     my $f1;      my $f1;
     my @f1;      my @f1;
     if ($style='local') {      if ($style eq 'local') {
  if (-e $fn) {   if (-e $fn) {
     my $fh=Apache::File->new($fn);      my $fh=Apache::File->new($fn);
     my $line;      my $line;
Line 66  sub get_split_file { Line 68  sub get_split_file {
     return @f1;      return @f1;
 }  }
   
   sub are_different_files {
       my ($fileone,$filetwo)=@_;
       return &compare($fileone,$filetwo);
   }
   
 sub handler {  sub handler {
   
   my $r=shift;    my $r=shift;
   
 # Get query string for limited number of parameters  # Get query string for limited number of parameters
   
    &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
Line 104  sub handler { Line 110  sub handler {
   &Apache::loncommon::content_type($r,'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(&Apache::loncommon::start_page('Resource Differences'));
   
   $r->print(&Apache::loncommon::bodytag('Resource Differences'));  
   
       
   $r->print('<h1>'.($env{'form.filetwo'}?'':&mt('Compare versions of')).    $r->print('<h1>'.($env{'form.filetwo'}?'':&mt('Compare versions of')).
Line 118  sub handler { Line 122  sub handler {
       }        }
   
   
  if (&Apache::loncommon::fileembstyle(($efn=~/\.(\w+)$/)) eq 'ssi') {   if (&Apache::loncommon::fileembstyle(($efn=~/\.(\w+)$/)) eq 'ssi'
        || $efn =~ /\.meta$/) {
      $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;
Line 126  sub handler { Line 131  sub handler {
  $r->print('<b>'.&mt('Construction Space Version').'</b>');   $r->print('<b>'.&mt('Construction Space Version').'</b>');
      } else {       } else {
  my $fn=   my $fn=
      '/home/httpd/html//res/'.$cudom.'/'.$cuname.'/';       '/home/httpd/html/res/'.$cudom.'/'.$cuname.'/';
  if ($env{'form.versionone'}) {   if ($env{'form.versionone'}) {
      my ($main,$suffix)=($efn=~/^(.+)\.(\w+)$/);       my ($main,$suffix,$is_meta)=
    &Apache::lonretrieve::get_file_info($efn);
   
        $fn.=($efn =~m|(.*/)[^/]+|)[0];
        # add on to $fn the path information in $efn
      $fn.=$main.'.'.$env{'form.versionone'}.'.'.$suffix;       $fn.=$main.'.'.$env{'form.versionone'}.'.'.$suffix;
      $r->print('<b>'.&mt('Version').' '.$env{'form.versionone'}.'</b>');       $r->print('<b>'.&mt('Version').' '.$env{'form.versionone'}.'</b>');
  } else {   } else {
Line 154  sub handler { Line 163  sub handler {
  my $fn=   my $fn=
      '/home/httpd/html/res/'.$cudom.'/'.$cuname.'/';       '/home/httpd/html/res/'.$cudom.'/'.$cuname.'/';
  if ($env{'form.versiontwo'}) {   if ($env{'form.versiontwo'}) {
      my ($main,$suffix)=($efn=~/^(.+)\.(\w+)$/);       my ($main,$suffix,$is_meta)=
    &Apache::lonretrieve::get_file_info($efn);
        # add on to $fn the path information in $efn
        $fn.=($efn =~m|(.*/)[^/]+|)[0];
      $fn.=$main.'.'.$env{'form.versiontwo'}.'.'.$suffix;       $fn.=$main.'.'.$env{'form.versiontwo'}.'.'.$suffix;
      $r->print('<b>'.&mt('Version').' '.$env{'form.versiontwo'}.'</b>');       $r->print('<b>'.&mt('Version').' '.$env{'form.versiontwo'}.'</b>');
  } else {   } else {
Line 192  sub handler { Line 204  sub handler {
  } else {   } else {
      $r->print('<h1><font color=red>'.&mt('Binary File').'</font></h1>');       $r->print('<h1><font color=red>'.&mt('Binary File').'</font></h1>');
  }   }
   $r->print('<center><a href="javascript:window.close();">'.&mt('Close This Window').'</a></center></body></html>');     $r->print('<center><a href="javascript:window.close();">'.&mt('Close This Window').'</a></center>');
     $r->print(&Apache::loncommon::end_page()); 
   return OK;      return OK;  
 }  }
   

Removed from v.1.17  
changed lines
  Added in v.1.20


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