#!/usr/bin/perl
#------------------------------------------------------------------------------
# Copyright (C) 2001 Thomax Kaulmann
# 
# 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, 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., 675 Mass Ave, Cambridge, MA 02139, USA.

use DBI;
use CGI;
use OPA;

CGI::ReadParse();

#local $Hquery;
#$Hquery = new CGI();
#print $Hquery->header('text/html');
local $table, @row, $t;
#local %labels;

undef @row;
#undef %labels;


##   ##            ##            ######         ##   ##
### ###           ####             ##           ###  ##
#######          ##  ##            ##           #### ##
#######          ##  ##            ##           ## ####
## # ##          ######            ##           ##  ###
##   ##          ##  ##            ##           ##   ##
##   ##          ##  ##          ######         ##   ##


$db = OPA::opendb();

local $table, @row;

if(!defined(%labels)) {
$table = $db->prepare("
			SELECT label
			FROM opa_page
");
$table->execute();
while(@row = $table->fetchrow())
{
	$t = $row[0];
	$t =~ tr/[a-z]/[A-Z]/;
	$labels{$t} += 1;
}
$table->finish();
}

print "
<HTML>
<HEAD>

<TITLE>Radio Internationale Stadt - Music</TITLE>


</HEAD>
$OPA::OPA_BODY
<b>Label list</b>
<ul>
<IMG SRC=/OPA/balken.gif ALIGN=BOTTOM BORDER=0>
<multicol cols=3>
";


local $i;
foreach $key (sort(keys %labels))
{
	$xkey = $key;
	$xkey =~ s/\ /%20/g;
	print "<a href=$OPA::CGI_BINS/opa-search?querystring=$xkey&find_what=label><img src=/OPA/quadrat2.gif border=0></a> <a href=$OPA::CGI_BINS/opa-search?querystring=$xkey&find_what=label>$key</a><sup>$labels{$key}</sup><br>";
}

print "</multicol>";
print " <IMG SRC=/OPA/balken.gif ALIGN=BOTTOM BORDER=0> ";

print "</pre>";
OPA::copyright();
