%# -*-perl-*- $Id: bthread.html,v 1.3 2000/11/19 00:52:39 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>
%show_hier2(0,$top);
<%args>
$id => ''
%args>
<%init>
&deja_init;
if ($id !~ /^\d+$/) {
$m->out("You bastard!");
$m->abort(200);
}
# Find the top article
my $top = $id;
while (my $parent = parent($top)) {
$top = $parent;
}
%init>
<%once>
sub show_hier2 {
my $level = shift;
foreach my $id (@_) {
my ($from, $subject) = get_headers($id);
$m->out("Id: $id\n");
$m->out("From: $from\n");
$m->out("Subject: $subject\n");
$m->out("Level: $level\n");
my @children = children($id);
show_hier2($level + 1, @children) if (@children > 0);
}
}
%once>