version 1.1, 2001/05/02 21:01:47
|
version 1.3, 2001/05/02 23:00:05
|
Line 49 sub handler {
|
Line 49 sub handler {
|
my @f1=(); |
my @f1=(); |
my @f2=(); |
my @f2=(); |
|
|
|
$r->content_type('text/html'); |
|
$r->send_http_header; |
|
|
|
$r->print('<html><head><title>LON-CAPA Construction Diffs</title></head>'); |
|
|
|
$r->print('<body bgcolor="#FFFFFF">'); |
|
|
|
|
|
$r->print('<h1>Compare versions of <tt>'.$ENV{'form.filename'}.'</tt></h1>'); |
|
|
|
if (&Apache::lonnet::fileembstyle(($ENV{'form.filename'}=~/\.(\w+)$/)) eq |
|
'ssi') { |
if ($ENV{'form.versionone'} eq 'priv') { |
if ($ENV{'form.versionone'} eq 'priv') { |
my $fn='/home/'.$ENV{'user.name'}.'/public_html/'.$ENV{'form.filename'}; |
my $fn='/home/'.$ENV{'user.name'}.'/public_html/'.$ENV{'form.filename'}; |
if (-e $fn) { |
if (-e $fn) { |
Line 100 sub handler {
|
Line 112 sub handler {
|
|
|
# Start page output |
# Start page output |
|
|
$r->content_type('text/html'); |
|
$r->send_http_header; |
|
|
|
$r->print('<html><head><title>LON-CAPA Construction Diffs</title></head>'); |
|
|
|
$r->print('<body bgcolor="#FFFFFF">'); |
|
|
|
|
|
$r->print('<h1>Compare versions of <tt>'.$ENV{'form.filename'}.'</tt></h1>'); |
|
|
|
my $chunk; |
my $chunk; |
my $line; |
my $line; |
|
|
$r->print('<table border=2><tr><th>Version '.$ENV{'form.versionone'}. |
$r->print('<pre>'); |
'</th><th>Version '.$ENV{'form.versiontwo'}.'</th>'); |
|
foreach $chunk (@$diffs) { |
foreach $chunk (@$diffs) { |
$r->print('</pre></tr><tr><td><pre>'); |
|
my $presign='-'; |
|
foreach $line (@$chunk) { |
foreach $line (@$chunk) { |
my ($sign, $lineno, $text) = @$line; |
my ($sign, $lineno, $text) = @$line; |
if ($sign ne $presign) { |
|
$r->print('</pre></td><td><pre>'); |
|
$presign=$sign; |
|
} |
|
$text=~s/\</\<\;/g; |
$text=~s/\</\<\;/g; |
$text=~s/\>/\>\;/g; |
$text=~s/\>/\>\;/g; |
$lineno=substr($lineno.' ',0,8); |
$lineno=substr($lineno.' ',0,7); |
$r->print($lineno.' '.$text."\n"); |
$r->print('<font color='.(($sign eq '+')?'green':'red').'>'. |
|
$sign.' '.$lineno.' '.$text."</font>\n"); |
} |
} |
|
$r->print("<hr>\n"); |
} |
} |
|
$r->print('</pre>'); |
|
|
$r->print('</tr></table>'); |
} else { |
|
$r->print('<h1><font color=red>Binary File</font></h1>'); |
|
} |
$r->print('</body></html>'); |
$r->print('</body></html>'); |
return OK; |
return OK; |
} |
} |
Line 143 __END__
|
Line 144 __END__
|
|
|
|
|
|
|
|
|