From 576539ce9dfb2a74bc786d86e0f5c9131f2a452f Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Mon, 4 Apr 2005 14:09:32 +0000 Subject: [PATCH 1/1] Sync with --pgweb. Patches applied: * sgunderson@bigfoot.com--2005-private/ccbs--pgweb--1.0--patch-20 Add a script for showing all players. --- html/players.pl | 18 ++++++++++++++++++ html/templates/index.tmpl | 1 + html/templates/players.tmpl | 28 ++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100755 html/players.pl create mode 100644 html/templates/players.tmpl diff --git a/html/players.pl b/html/players.pl new file mode 100755 index 0000000..8158d4d --- /dev/null +++ b/html/players.pl @@ -0,0 +1,18 @@ +#! /usr/bin/perl + +use ccbs; +use strict; +use warnings; + +my $cgi = new CGI; +my $id = $cgi->param('id'); + +my $dbh = ccbs::db_connect(); + +my $players = ccbs::db_fetch_all($dbh, 'SELECT player,nick,countryname,clubname,count(*) AS num_songs,COUNT(DISTINCT song) AS num_unique_songs,COUNT(DISTINCT tournament) AS num_tournaments,AVG(score)::integer AS avg_score,MAX(score) AS high_score FROM scores NATURAL JOIN players NATURAL JOIN countries NATURAL LEFT JOIN clubs GROUP BY player,nick,countryname,clubname ORDER BY LOWER(nick)'); + +ccbs::print_header(); +ccbs::process_template('players.tmpl', 'Players', { + players => $players, +}); +$dbh->disconnect; diff --git a/html/templates/index.tmpl b/html/templates/index.tmpl index 28ec269..466c76e 100644 --- a/html/templates/index.tmpl +++ b/html/templates/index.tmpl @@ -9,6 +9,7 @@