]> git.sesse.net Git - ccbs/commitdiff
Added a simple flag in ccbs.pm to make the system suitable for public viewing (ie...
authorSteinar H. Gunderson <sesse@samfundet.no>
Sat, 5 Mar 2005 02:17:23 +0000 (02:17 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Sat, 5 Mar 2005 02:17:23 +0000 (02:17 +0000)
16 files changed:
html/ccbs.pm
html/do-add-player.pl
html/do-add-tournament.pl
html/do-edit-scores.pl
html/do-finish-tournament.pl
html/do-registration.pl
html/do-reset-randomsongs.pl
html/do-set-active-round.pl
html/do-set-active-tournament.pl
html/do-set-paid.pl
html/do-start-round.pl
html/do-unregister.pl
html/templates/index.tmpl
html/templates/main.tmpl
html/templates/show-tournament.tmpl
html/templates/tournaments.tmpl

index 21a19a80216fd4a5246d5975db7ccacdf292961b..81955433fc50001a4e28aad4a0a5b4e4ef8127ae 100755 (executable)
@@ -7,6 +7,9 @@ use strict;
 use warnings;
 
 our $ccbs_dbdebug = 0;
+
+# Set this flag to disable any admin tasks -- it's quite crude, but hey :-)
+our $ccbs_noadmin = 0;
        
 sub print_header {
        print CGI::header(-type=>'text/html; charset=utf-8');
@@ -60,6 +63,7 @@ sub process_template {
        my ($page, $title, $vars) = @_;
        $vars->{'page'} = $page;
        $vars->{'title'} = $title;
+       $vars->{'public'} = $ccbs_noadmin;
        
        my $config = {
                INCLUDE_PATH => 'templates/',
@@ -85,6 +89,9 @@ sub user_error {
 
        exit;
 }
+sub admin_only {
+       user_error("Beklager, databasen står i no-admin-mode.") if ($ccbs_noadmin);
+}
 
 $SIG{__DIE__} = sub {
        # Gosh! Net::Resolver::DNS is brain-damaged.
index 7817b14349b00207edc629e61ea6cd6b3e51f75b..2ed4b6c18b78aab0eab9872041cf2f7f09290574 100755 (executable)
@@ -4,6 +4,8 @@ use ccbs;
 use strict;
 use warnings;
 
+ccbs::admin_only();
+
 my $dbh = ccbs::db_connect();
 my $cgi = new CGI;
 
index 0ef54efd359acaed9a77894f4e62c46d5f0d919f..50efd381a64dc90342aaa5ef83e03d3dcbcba8f0 100755 (executable)
@@ -4,6 +4,8 @@ use ccbs;
 use strict;
 use warnings;
 
+ccbs::admin_only();
+
 my $dbh = ccbs::db_connect();
 my $cgi = new CGI;
 
index 95006e090af36204f39a8a5ac9481f2b282787d0..898d5dbc4f9c0bacadae2db46cfc5d75f9aa2e84 100755 (executable)
@@ -4,6 +4,8 @@ use ccbs;
 use strict;
 use warnings;
 
+ccbs::admin_only();
+
 my $dbh = ccbs::db_connect();
 my $cgi = new CGI;
 
index b493968e3fa8ea07b97c5ae57b4ebe20683e8b35..a22da1769fd4f594b2d94a0fd4151fac3226aa47 100755 (executable)
@@ -4,6 +4,8 @@ use ccbs;
 use strict;
 use warnings;
 
+ccbs::admin_only();
+
 my $dbh = ccbs::db_connect();
 my $cgi = new CGI;
 
index 36c5e2fa66f020dd92c769ee36b9bff918947dc7..6f7b9e3e0fb278472283a8490f581767581dbe69 100755 (executable)
@@ -4,6 +4,8 @@ use ccbs;
 use strict;
 use warnings;
 
+ccbs::admin_only();
+
 my $dbh = ccbs::db_connect();
 my $cgi = new CGI;
 
index e470b73e34dc37e44d4a6d0eb62ad472f93ee796..6c79994088adcd5becf8a82d3cffb9b70dd9e051 100755 (executable)
@@ -4,6 +4,8 @@ use ccbs;
 use strict;
 use warnings;
 
+ccbs::admin_only();
+
 my $dbh = ccbs::db_connect();
 my $cgi = new CGI;
 
index db32ecea50e3e75f43c453cc9b4a50a8c89b5765..5b0376e6b44ea0d908c7bff4b0a3b503e3380df0 100755 (executable)
@@ -4,6 +4,8 @@ use ccbs;
 use strict;
 use warnings;
 
+ccbs::admin_only();
+
 my $dbh = ccbs::db_connect();
 my $cgi = new CGI;
 
index c27ebf5b18599445eab4c20d1f5d8bcdf32c52df..3a15a939be00fe3a748287b0867546045d7524b9 100755 (executable)
@@ -4,6 +4,8 @@ use ccbs;
 use strict;
 use warnings;
 
+ccbs::admin_only();
+
 my $dbh = ccbs::db_connect();
 my $cgi = new CGI;
 
index 7ac795d55c68c45af01cdccf605e129833bbe871..5622bb7723191dcfe823fb2e467d769f567be8af 100755 (executable)
@@ -4,6 +4,8 @@ use ccbs;
 use strict;
 use warnings;
 
+ccbs::admin_only();
+
 my $dbh = ccbs::db_connect();
 my $cgi = new CGI;
 
index f7a86cea23d3ff653bef652984800dcd2a444433..d843be2fb6e882374ca602535e3bf57e97d867ce 100755 (executable)
@@ -4,6 +4,8 @@ use ccbs;
 use strict;
 use warnings;
 
+ccbs::admin_only();
+
 my $dbh = ccbs::db_connect();
 my $cgi = new CGI;
 
index 3751e30325da2071dd5994bd94aa6b5399546836..4a1101e1cc2efce55ae7a5be7ca5ed90a0f21172 100755 (executable)
@@ -4,6 +4,8 @@ use ccbs;
 use strict;
 use warnings;
 
+ccbs::admin_only();
+
 my $dbh = ccbs::db_connect();
 my $cgi = new CGI;
 
index 4b872adc5df6f12a625d024f128560ab7e520f9f..28ec2699080dc4656389516bf90cc844bf78d16b 100644 (file)
@@ -9,11 +9,14 @@
 <div>
   <ul>
     <li><a href="tournaments.pl">Turneringer</a></li>
+[% IF !public %]
     <li><a href="add-tournament.pl">Legg til turnering</a></li>
     <li><a href="randomsongs.pl">Sangvelger</a></li>
+[% END %]
   </ul>
 </div>
 
+[% IF !public %]
 <h2>Storskjerm</h2>
 
 <div>
@@ -21,3 +24,4 @@
     <li><a href="set-active-tournament.pl">Sett aktiv turnering</a></li>
   </ul>
 </div>
+[% END %]
index 286cac7bfc032c2f8f0978f05d31944b7b3bc5be..46b0e5d31dba48a6e19554402e08292aeb34bd11 100644 (file)
     <h1>[% title %]</h1>
 
     <p>
-      <a href="index.pl">Forside</a> | 
-      <a href="tournaments.pl">Turneringer</a> | 
-      <a href="randomsongs.pl">Sangvelger</a>
+      <a href="index.pl">Forside</a>
+      | <a href="tournaments.pl">Turneringer</a>
+[% IF !public %]
+      | <a href="randomsongs.pl">Sangvelger</a>
+[% END %]
     </p>
 
     <div class="main">
index 3a6c34fb85ae81eb64b0b16ce0ae85798f7f3673..8619ca96c88a11bc98661cb2020ae704d5017690 100644 (file)
@@ -12,7 +12,7 @@
     </ul>
   </div>
 
-[% IF closing_valid %]
+[% IF closing_valid && !public %]
   <h2>Start ny runde</h2>
 
   <div>
@@ -54,7 +54,7 @@
   </div>
 [% END %]
   
-[% IF finishing_valid %]
+[% IF finishing_valid && !public %]
   <h2>Avslutt turnering</h2>
 
   <div>
@@ -89,6 +89,7 @@
 [% END %]
 
 [% FOR r = rounds %]
+[% IF r.locked || !public %]
   <h2><a name="round[% r.round %]">Runde [% r.round %]</a></h2>
 
   <div>
 
   </div>
 [% END %]
+[% END %]
index 7d0d6bfc5ae11843c509d650351bdff19a76d62e..0665786903a4928d84389b09fb6df9f30e72d3dc 100644 (file)
@@ -1,8 +1,10 @@
 [%# vim:set filetype=html: %]
 
+[% IF !public %]
   <div>
     <p><a href="add-tournament.pl">Legg til turnering</a></p>
   </div>
+[% END %]
   
 [% SET last_season = 0 %]
 [% FOR t = tournaments %]
@@ -21,7 +23,9 @@
 [% END %]
       <li>
         <a href="show-tournament.pl?id=[% t.tournament %]">[% t.tournamentname %]</a>
+[% IF !public %]
        (<a href="registration.pl?id=[% t.tournament %]">registrering</a>)
+[% END %]
       </li>
 [% END %]
     </ul>