Added a front end for setting the active tournament.
authorSteinar H. Gunderson <sesse@samfundet.no>
Sat, 19 Feb 2005 01:31:19 +0000 (01:31 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Sat, 19 Feb 2005 01:31:19 +0000 (01:31 +0000)
html/set-active-tournament.pl [new file with mode: 0755]
html/templates/index.tmpl
html/templates/set-active-tournament.tmpl [new file with mode: 0644]

diff --git a/html/set-active-tournament.pl b/html/set-active-tournament.pl
new file mode 100755 (executable)
index 0000000..4a17ef2
--- /dev/null
@@ -0,0 +1,18 @@
+#! /usr/bin/perl
+
+use ccbs;
+use strict;
+use warnings;
+
+my $dbh = ccbs::db_connect();
+my $tournaments = ccbs::db_fetch_all($dbh, 'SELECT * FROM tournaments');
+my $ref = $dbh->selectrow_hashref('SELECT * FROM bigscreen.active_tournament');
+my $active_tournament = (defined($ref)) ? $ref->{'tournament'} : -1;
+
+ccbs::print_header();
+ccbs::process_template('set-active-tournament.tmpl', 'Sett aktiv turnering', {
+               tournaments => $tournaments,
+               active_tournament => $active_tournament
+       });
+
+$dbh->disconnect;
index 06f4e32..4b872ad 100644 (file)
     <li><a href="randomsongs.pl">Sangvelger</a></li>
   </ul>
 </div>
+
+<h2>Storskjerm</h2>
+
+<div>
+  <ul>
+    <li><a href="set-active-tournament.pl">Sett aktiv turnering</a></li>
+  </ul>
+</div>
diff --git a/html/templates/set-active-tournament.tmpl b/html/templates/set-active-tournament.tmpl
new file mode 100644 (file)
index 0000000..cce163a
--- /dev/null
@@ -0,0 +1,28 @@
+[%# vim:set filetype=html: %]
+<h2>Sett aktiv turnering</h2>
+
+<div>
+  <p>Denne funksjonen styrer hvilken turnering som er aktiv, dvs. hvilken storskjermen
+    skal vise informasjon fra.</p>
+
+<form method="post" action="do-set-active-tournament.pl">
+  <p>
+    <select name="tournament">
+[% IF active_tournament == -1 %]
+      <option value="-1" selected="selected"> </option>
+[% ELSE %]
+      <option value="-1"> </option>
+[% END %]
+[% FOR t = tournaments %]
+[% IF t.tournament == selected_tournament %]
+      <option value="[% t.tournament %]" selected="selected">[% t.tournamentname %]</option>
+[% ELSE %]
+      <option value="[% t.tournament %]">[% t.tournamentname %]</option>
+[% END %]
+[% END %]
+    </select>
+    <input type="submit" value="Velg" />
+  </p>
+</form>
+
+</div>