--- loncom/publisher/londiff.pm 2001/05/02 21:01:47 1.1 +++ loncom/publisher/londiff.pm 2001/05/09 17:38:12 1.5 @@ -15,7 +15,7 @@ # # 03/31,04/03 Gerd Kortemeyer) # -# 05/02/01 Gerd Kortemeyer +# 05/02/01,05/09 Gerd Kortemeyer package Apache::londiff; @@ -24,7 +24,7 @@ use Apache::File; use File::Copy; use Algorithm::Diff qw(diff); use Apache::Constants qw(:common :http :methods); - +use Apache::loncacc; sub handler { @@ -46,11 +46,46 @@ sub handler { # Get the files + my $cuname=$ENV{'user.name'}; + my $cudom=$ENV{'user.domain'}; + + unless (($cuname,$cudom)= + &Apache::loncacc::constructaccess($ENV{'form.filename'}, + $r->dir_config('lonDefDomain'))) { + $r->log_reason($cuname.' at '.$cudom. + ' trying to get diffs file '.$ENV{'form.filename'}. + ' - not authorized', + $r->filename); + return HTTP_NOT_ACCEPTABLE; + } + + my $efn=$ENV{'form.filename'}; + + $efn=~s/\/\~(\w+)//g; + my @f1=(); my @f2=(); + $r->content_type('text/html'); + $r->send_http_header; + + $r->print('
Version '.$ENV{'form.versionone'}. - ' | Version '.$ENV{'form.versiontwo'}.' | '); + $r->print('
---|---|
'); - my $presign='-'; + foreach $line (@$chunk) { my ($sign, $lineno, $text) = @$line; - if ($sign ne $presign) { - $r->print(' | '); - $presign=$sign; - } $text=~s/\\<\;/g; $text=~s/\>/\>\;/g; - $lineno=substr($lineno.' ',0,8); - $r->print($lineno.' '.$text."\n"); + $lineno=substr($lineno.' ',0,7); + $r->print(''. + $sign.' '.$lineno.' '.$text."\n"); } + $r->print("'); - $r->print(' |