--- loncom/publisher/londiff.pm 2005/05/29 01:46:16 1.17 +++ loncom/publisher/londiff.pm 2006/05/17 13:41:45 1.19 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to show differences between file versions # -# $Id: londiff.pm,v 1.17 2005/05/29 01:46:16 www Exp $ +# $Id: londiff.pm,v 1.19 2006/05/17 13:41:45 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -32,6 +32,7 @@ package Apache::londiff; use strict; use Apache::File; use File::Copy; +use File::Compare; use Algorithm::Diff qw(diff); use Apache::Constants qw(:common :http :methods); use Apache::loncacc; @@ -44,7 +45,7 @@ sub get_split_file { my ($fn,$style)=@_; my $f1; my @f1; - if ($style='local') { + if ($style eq 'local') { if (-e $fn) { my $fh=Apache::File->new($fn); my $line; @@ -66,6 +67,11 @@ sub get_split_file { return @f1; } +sub are_different_files { + my ($fileone,$filetwo)=@_; + return &compare($fileone,$filetwo); +} + sub handler { my $r=shift; @@ -104,9 +110,7 @@ sub handler { &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; - $r->print('LON-CAPA Construction Diffs'); - - $r->print(&Apache::loncommon::bodytag('Resource Differences')); + $r->print(&Apache::loncommon::start_page('Resource Differences')); $r->print('

'.($env{'form.filetwo'}?'':&mt('Compare versions of')). @@ -126,7 +130,7 @@ sub handler { $r->print(''.&mt('Construction Space Version').''); } else { my $fn= - '/home/httpd/html//res/'.$cudom.'/'.$cuname.'/'; + '/home/httpd/html/res/'.$cudom.'/'.$cuname.'/'; if ($env{'form.versionone'}) { my ($main,$suffix)=($efn=~/^(.+)\.(\w+)$/); $fn.=$main.'.'.$env{'form.versionone'}.'.'.$suffix; @@ -192,7 +196,8 @@ sub handler { } else { $r->print('

'.&mt('Binary File').'

'); } - $r->print('
'.&mt('Close This Window').'
'); + $r->print('
'.&mt('Close This Window').'
'); + $r->print(&Apache::loncommon::end_page()); return OK; }