%# -*-perl-*- $Id: show.html,v 1.7 2000/11/12 03:15:11 xi Exp $
<%doc>
###############################################################################
# Usenet Indexer - A nice and fast usenet indexer
# Copyright (C) 2000 Christian Laursen
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
###############################################################################
%doc>
<% $r->hostname %>
%if ($id =~ /^\d+$/) {
<%perl>
my $prefix = sprintf("../data/article/%08x", $id);
my $parent = undef;
open (FILE, "<$prefix.headers");
while () {
s/^Time: (\d+)$/'Date: '.localtime($1)/e;
if (m/^Parent: (\d+)$/) {
$parent = $1;
} else {
$m->out(encode_entities($_));
}
}
close FILE;
my @children = ();
if (open (FILE, "<$prefix.children")) {
my $buffer;
while (read (FILE, $buffer, 4)) {
push @children, unpack('I',$buffer);
}
close FILE;
}
%perl>
%if (defined $parent) {
Previous in thread
<%perl>
}
if (@children > 0) {
$m->out("Next in thread: ");
for (my $i = 0; $i < @children; ++$i) {
$m->out("".($i+1)." ");
}
}
%perl>
<%perl>
open (FILE, "<$prefix.body");
while () {
$m->out(encode_entities($_));
}
close FILE;
%perl>