From: Steinar H. Gunderson Date: Sat, 23 Apr 2005 14:50:21 +0000 (+0000) Subject: Pull in player editing code from --baby. X-Git-Url: https://git.sesse.net/?p=ccbs;a=commitdiff_plain;h=d4f2692e015be09f0018f645e32f867f62446d22;ds=sidebyside Pull in player editing code from --baby. Patches applied: * sgunderson@bigfoot.com--2005-baby/ccbs--baby--0.1--patch-14 Make a link from the "players registered in this tournament" list to the player pages. * sgunderson@bigfoot.com--2005-baby/ccbs--baby--0.1--patch-15 Add backend for editing players. Update TODO. * sgunderson@bigfoot.com--2005-baby/ccbs--baby--0.1--patch-16 Actually commit backend for editing players. --- diff --git a/TODO b/TODO index 1c799a6..3caf740 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,4 @@ - Proper functionality for editing groups (adding/deleting players and songs) -- Ability to edit players (in particular, fix country/group) - Multiple variations on short titles - Add DP/pass in addition to score - Auto-reset of the song selector on first elimination round? diff --git a/html/do-edit-player.pl b/html/do-edit-player.pl new file mode 100755 index 0000000..de85f45 --- /dev/null +++ b/html/do-edit-player.pl @@ -0,0 +1,22 @@ +#! /usr/bin/perl + +use ccbs; +use strict; +use warnings; + +ccbs::admin_only(); + +my $dbh = ccbs::db_connect(); +my $cgi = new CGI; + +my $player = $cgi->param('player'); +my $nick = $cgi->param('nick'); +my $country = $cgi->param('country'); +my $club = $cgi->param('club'); + +$club = undef if ($club == -1); + +$dbh->do('UPDATE players SET nick=?, country=?, club=? WHERE player=?', undef, $nick, $country, $club, $player); +ccbs::print_see_other('player.pl?id=' . $player); + +$dbh->disconnect; diff --git a/html/player.pl b/html/player.pl index 80011b0..93d9328 100755 --- a/html/player.pl +++ b/html/player.pl @@ -12,6 +12,12 @@ my $dbh = ccbs::db_connect(); my $player = $dbh->selectrow_hashref('SELECT * FROM players NATURAL JOIN countries NATURAL LEFT JOIN clubs WHERE player=?', undef, $id); my $bestsongs = ccbs::db_fetch_all($dbh, 'SELECT song,title,score,tournament,tournamentname FROM ( SELECT DISTINCT ON (song) song,score,tournament FROM scores WHERE player=? AND score IS NOT NULL ORDER BY song,score DESC ) t1 NATURAL JOIN songs NATURAL JOIN tournaments ORDER BY score DESC LIMIT 10', $id); +my ($countries, $clubs); +unless ($ccbs::ccbs_noadmin) { + $countries = ccbs::db_fetch_all($dbh, 'SELECT * FROM countries ORDER BY countrycode'); + $clubs = ccbs::db_fetch_all($dbh, 'SELECT * FROM clubs ORDER BY clubcode'); +} + # Fetch all scores and count a bit my $columns = 0; my @allsongs = (); @@ -38,6 +44,8 @@ ccbs::process_template('player.tmpl', $player->{'nick'}, { player => $player, bestsongs => $bestsongs, allsongs => \@allsongs, - columns => $columns + columns => $columns, + countries => $countries, + clubs => $clubs }); $dbh->disconnect; diff --git a/html/templates/player.tmpl b/html/templates/player.tmpl index 91a4d79..b41aeb7 100644 --- a/html/templates/player.tmpl +++ b/html/templates/player.tmpl @@ -11,6 +11,56 @@ +[% IF !public %] +

Rediger spiller

+ +
+
+ + + + + + + + + + + + + + + + + +
Nick
Land + +
Klubb + +
+ +
+
+
+[% END %] +

Beste sanger

diff --git a/html/templates/registration.tmpl b/html/templates/registration.tmpl index dca65b0..3278c8f 100644 --- a/html/templates/registration.tmpl +++ b/html/templates/registration.tmpl @@ -87,7 +87,7 @@ [% FOR r = registered %] - + [% IF r.paid %] [% ELSE %] @@ -117,6 +117,14 @@

+ [% END %]
[% r.nick %][% r.nick %]betalt +
+

+ + +

+
+