Registration now supports countries and clubs.
authorSteinar H. Gunderson <sesse@samfundet.no>
Tue, 5 Apr 2005 01:22:55 +0000 (01:22 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Tue, 5 Apr 2005 01:22:55 +0000 (01:22 +0000)
html/do-add-player.pl
html/registration.pl
html/templates/registration.tmpl

index 2ed4b6c..39b46f7 100755 (executable)
@@ -11,8 +11,12 @@ my $cgi = new CGI;
 
 my $tournament = $cgi->param('tournament');
 my $nick = $cgi->param('nick');
+my $country = $cgi->param('country');
+my $club = $cgi->param('club');
 
-$dbh->do('INSERT INTO players (nick) VALUES (?)', undef, $nick);
+$club = undef if ($club == -1);
+
+$dbh->do('INSERT INTO players (nick, country, club) VALUES (?, ?, ?)', undef, $nick, $country, $club);
 my $ref = $dbh->selectrow_hashref('SELECT player FROM players WHERE nick=?',
        undef, $nick);
 
index a2da719..84d19fc 100755 (executable)
@@ -13,12 +13,16 @@ my $dbh = ccbs::db_connect();
 my $tournament = $dbh->selectrow_hashref('SELECT * FROM tournaments NATURAL JOIN seasons NATURAL JOIN countries NATURAL JOIN machines NATURAL JOIN scoringsystems WHERE tournament=?', undef, $id);
 my $registered = ccbs::db_fetch_all($dbh, 'SELECT * FROM tournamentparticipation NATURAL JOIN players WHERE tournament=? ORDER BY LOWER(nick)', $id);
 my $available = ccbs::db_fetch_all($dbh, 'SELECT * FROM players WHERE player NOT IN ( SELECT player FROM tournamentparticipation WHERE tournament=? ) ORDER BY LOWER(nick)', $id);
+my $countries = ccbs::db_fetch_all($dbh, 'SELECT * FROM countries ORDER BY countrycode');
+my $clubs = ccbs::db_fetch_all($dbh, 'SELECT * FROM clubs ORDER BY clubcode');
 
 ccbs::print_header();
 ccbs::process_template('registration.tmpl', $tournament->{'tournamentname'}, {
        tournament => $tournament,
        registered => $registered,
        available => $available,
-       selected_player => $selected_player
+       selected_player => $selected_player,
+       countries => $countries,
+       clubs => $clubs
 });
 $dbh->disconnect;
index a51778f..dca65b0 100644 (file)
       <th>Nick</th>
       <td><input name="nick" /></td>
     </tr>
+    <tr>
+      <th>Land</th>
+      <td>
+        <select name="country">
+[% FOR c = countries %]
+[% IF c.countrycode == "NOR" %]
+          <option value="[% c.country %]" selected="selected">[% c.countrycode %] - [% c.countryname %]</option>
+[% ELSE %]
+          <option value="[% c.country %]">[% c.countrycode %] - [% c.countryname %]</option>
+[% END %]        
+[% END %]        
+       </select>
+      </td>
+    </tr>
+    <tr>
+      <th>Klubb</th>
+      <td>
+        <select name="club">
+         <option value="-1" selected="selected"></option>
+[% FOR c = clubs %]
+          <option value="[% c.club %]">[% c.clubcode %] - [% c.clubname %]</option>
+[% END %]        
+       </select>
+      </td>
+    </tr>
     <tr>
       <th colspan="2">
         <input type="hidden" name="tournament" value="[% tournament.tournament %]" />