]> git.sesse.net Git - ccbs/commitdiff
Add a simple web interface for adding/updating short titles. (No backend yet.)
authorSteinar H. Gunderson <sesse@samfundet.no>
Sat, 23 Apr 2005 01:34:32 +0000 (01:34 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Sat, 23 Apr 2005 01:34:32 +0000 (01:34 +0000)
html/shorttitles.pl [new file with mode: 0755]
html/templates/index.tmpl
html/templates/shorttitles.tmpl [new file with mode: 0644]

diff --git a/html/shorttitles.pl b/html/shorttitles.pl
new file mode 100755 (executable)
index 0000000..c6b93c8
--- /dev/null
@@ -0,0 +1,19 @@
+#! /usr/bin/perl
+
+use ccbs;
+use strict;
+use warnings;
+
+my $cgi = new CGI;
+my $id = $cgi->param('id');
+
+my $dbh = ccbs::db_connect();
+
+# FIXME: This will fail with multiple short titles.
+my $songs = ccbs::db_fetch_all($dbh, 'SELECT song,title,shorttitle FROM songs NATURAL LEFT JOIN songshorttitles ORDER BY LOWER(title)');
+
+ccbs::print_header();
+ccbs::process_template('shorttitles.tmpl', 'Korte titler', {
+       songs => $songs,
+});
+$dbh->disconnect;
index 289249f6ec74b1e8a006a11c551a9cc7112d6d40..9080821e866e57f4aacc1758db1d1f1734b7dd9b 100644 (file)
@@ -14,6 +14,7 @@
 [% IF !public %]
     <li><a href="add-tournament.pl">Legg til turnering</a></li>
     <li><a href="randomsongs.pl">Sangvelger</a></li>
+    <li><a href="shorttitles.pl">Korte titler</a></li>
 [% END %]
   </ul>
 </div>
diff --git a/html/templates/shorttitles.tmpl b/html/templates/shorttitles.tmpl
new file mode 100644 (file)
index 0000000..e721666
--- /dev/null
@@ -0,0 +1,24 @@
+[%# vim:set filetype=html: %]
+
+  <div>
+    <form method="post" action="do-update-shorttitles.pl">
+      <table class="scores">
+        <tr>
+          <th>Sang</th>
+          <th>Kort tittel</th>
+        </tr>
+
+[% FOR s = songs %]
+        <tr>
+          <td>[% s.title %]</td>
+          <td><input name="st[% s.song %]" value="[% s.shorttitle %]" /></td>
+        </tr>
+[% END %]
+        <tr>
+         <td colspan="2">
+           <input type="submit" value="Oppdater" />
+         </td>
+       </tr>
+      </table>
+    </form>
+  </div>