]> git.sesse.net Git - ccbs/commitdiff
Add starting frontend code for deciding which rounds are shown on the big screen.
authorSteinar H. Gunderson <sesse@samfundet.no>
Sat, 19 Feb 2005 14:18:54 +0000 (14:18 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Sat, 19 Feb 2005 14:18:54 +0000 (14:18 +0000)
html/show-tournament.pl
html/templates/show-tournament.tmpl

index 3d0db3c945f38c8bb363b93362b30d20637e329e..602e5cb1696c1230f36fc457dbe3091666ea3c4e 100755 (executable)
@@ -24,6 +24,9 @@ if ($ref->{'num_incomplete'} == 0) {
        $closing_valid = 0;
 }
 
        $closing_valid = 0;
 }
 
+# Find all rounds currently shown on the bigscreen.
+my $active_rounds = $dbh->selectall_hashref('SELECT round FROM bigscreen.active_rounds WHERE tournament=?', 'round', undef, $id);
+
 # Swoop all the data in in a big join, then order it over to quasi-sane Perl objects.
 # (round -> parallel -> player -> songs -> title,chosen,score)
 my $scores = ccbs::db_fetch_all($dbh,
 # Swoop all the data in in a big join, then order it over to quasi-sane Perl objects.
 # (round -> parallel -> player -> songs -> title,chosen,score)
 my $scores = ccbs::db_fetch_all($dbh,
@@ -38,6 +41,12 @@ for my $score (@$scores) {
                $round = $score->{'round'};
                push @rounds, { round => $round, parallels => [], locked => 0 };
                $parallel = -1;
                $round = $score->{'round'};
                push @rounds, { round => $round, parallels => [], locked => 0 };
                $parallel = -1;
+
+               if (defined($active_rounds->{$round})) {
+                       $rounds[$#rounds]->{'bigscreen'} = 1;
+               } else {
+                       $rounds[$#rounds]->{'bigscreen'} = 0;
+               }
        }
        my $p = $rounds[$#rounds]->{'parallels'};
        if ($score->{'parallel'} != $parallel) {
        }
        my $p = $rounds[$#rounds]->{'parallels'};
        if ($score->{'parallel'} != $parallel) {
index ee2be73e69f0e8a4ff3e5a573296fcabd1bcecca..82a05d3464e70d15c2b385b624ae553a685e7db1 100644 (file)
 
   <div>
 
 
   <div>
 
+  <form method="post" action="do-set-active-round.pl">
+    <p>
+      <input type="hidden" name="tournament" value="[% tournament.tournament %]" />
+      <input type="hidden" name="round" value="[% r.round %]" />
+  [% IF p.bigscreen %]
+      <input type="hidden" name="show" value="false" />
+      <input type="submit" value="Fjern fra storskjerm" />
+  [% ELSE %]
+      <input type="hidden" name="show" value="true" />
+      <input type="submit" value="Vis på storskjerm" />
+  [% END %]
+    </p>
+  </form>
+  
   [% FOR p = r.parallels %]
   <form method="post" action="do-edit-scores.pl">
   <table class="scores">
   [% FOR p = r.parallels %]
   <form method="post" action="do-edit-scores.pl">
   <table class="scores">