chiark / gitweb /
more templates plus support code changes
authorRichard Kettlewell <rjk@greenend.org.uk>
Sun, 11 May 2008 17:28:07 +0000 (18:28 +0100)
committerRichard Kettlewell <rjk@greenend.org.uk>
Sun, 11 May 2008 17:28:07 +0000 (18:28 +0100)
26 files changed:
lib/sink.c
lib/sink.h
scripts/htmlman
server/actions.c
server/disorder-cgi.h
server/login.c
server/macros-disorder.c
templates/Makefile.am
templates/about.tmpl
templates/choose.tmpl
templates/choosealpha.tmpl [deleted file]
templates/credits.tmpl [deleted file]
templates/error.tmpl
templates/help.tmpl
templates/login.tmpl
templates/macros.tmpl
templates/new.tmpl
templates/playing.tmpl
templates/prefs.tmpl
templates/recent.tmpl
templates/search.tmpl
templates/stdhead.tmpl [deleted file]
templates/stylesheet.tmpl [deleted file]
templates/topbar.tmpl [deleted file]
templates/topbarend.tmpl [deleted file]
templates/volume.tmpl [deleted file]

index a3e9257f86de2580e00ca8f47d17b7607bd48ebe..e904005d4c654bfb498ac9df850f29b9e4ed8fe5 100644 (file)
@@ -131,6 +131,22 @@ struct sink *sink_dynstr(struct dynstr *output) {
   return (struct sink *)s;
 }
 
+/* discard sink **************************************************************/
+
+static int sink_discard_write(struct sink attribute((unused)) *s,
+                             const void attribute((unused)) *buffer,
+                             int nbytes) {
+  return nbytes;
+}
+
+/** @brief Return a sink which discards all output */
+struct sink *sink_discard(void) {
+  struct sink *s = xmalloc(sizeof *s);
+
+  s->write = sink_discard_write;
+  return s;
+}
+
 /*
 Local Variables:
 c-basic-offset:2
index cde716135efce1734254d68738e4511ad8893083..15462ae6a7267794aab55c17f1499206bf4c98cc 100644 (file)
@@ -50,6 +50,9 @@ struct sink *sink_stdio(const char *name, FILE *fp);
 struct sink *sink_dynstr(struct dynstr *output);
 /* return a sink which appends to @output@. */
 
+struct sink *sink_discard(void);
+/* reutrn a sink which junks everything */
+
 int sink_vprintf(struct sink *s, const char *fmt, va_list ap);
 int sink_printf(struct sink *s, const char *fmt, ...)
   attribute((format (printf, 2, 3)));
index fa966dda477eddc870a0005e26a6261101ddc15b..17e53e4ef8e39f3ea5ef9dee5c6e48a386e9fb13 100755 (executable)
@@ -43,13 +43,13 @@ title=$(basename $1)
 echo "<html>"
 echo " <head>"
 if $stdhead; then
-  echo "@include{stdhead}@"
+  echo "@quiethead"
 fi
 echo "  <title>$title</title>"
 echo " </head>"
 echo " <body>"
 if $stdhead; then
-  echo "@include{topbar}@"
+  echo "@stdmenu{}"
 fi
 printf "   <pre class=manpage>"
 # this is kind of painful using only BREs
@@ -67,7 +67,7 @@ nroff -Tascii -man "$1" | ${GNUSED} \
                        s!</\([bi]\)><\1>!!g'
 echo "</pre>"
 if $stdhead; then
-  echo "@include{topbarend}@"
+  echo "@credits"
 fi
 echo " </body>"
 echo "</html>"
index aca4db0aeea173039b2459315a6ee3879c9e7e1f..c0a8cb4b0a169d3c5aa112058a3009e5b1eca5fe 100644 (file)
@@ -171,7 +171,9 @@ static const struct action {
  */
 void dcgi_expand(const char *name) {
   const char *p;
-  
+
+  /* Parse macros first */
+  mx_expand_file("macros.tmpl", sink_discard(), 0);
   /* For unknown actions check that they aren't evil */
   for(p = name; *p && isalnum((unsigned char)*p); ++p)
     ;
@@ -220,12 +222,8 @@ void dcgi_action(const char *action) {
 }
 
 /** @brief Generate an error page */
-void dcgi_error(const char *msg, ...) {
-  va_list ap;
-
-  va_start(ap, msg);
-  byte_xvasprintf(&dcgi_error_string, msg, ap);
-  va_end(ap);
+void dcgi_error(const char *key) {
+  dcgi_error_string = xstrdup(key);
   dcgi_expand("error");
 }
 
index 95b36c66053df516130ca03cd280042c0dd716cb..b3aa4aaebb180f2834ff5364f24d759e58416b07 100644 (file)
@@ -62,7 +62,7 @@ extern char *dcgi_error_string;
 
 void dcgi_expand(const char *name);
 void dcgi_action(const char *action);
-void dcgi_error(const char *msg, ...);
+void dcgi_error(const char *key);
 void dcgi_login(void);
 void dcgi_lookup(unsigned want);
 void dcgi_lookup_reset(void);
index 5144934d9583aed42863a686594a18e29c0f3656..891ebe14d24994fe8b2e8718132d9007035f5f78 100644 (file)
@@ -132,7 +132,7 @@ void dcgi_login(void) {
   dcgi_client = disorder_new(0);
   /* Reconnect */
   if(disorder_connect_cookie(dcgi_client, dcgi_cookie)) {
-    dcgi_error("Cannot connect to server");
+    dcgi_error("connect");
     exit(0);
   }
   /* If there was a cookie but it went bad, we forget it */
index b35ad246c25627b29a1cc1e184808edddb158a2a..13276e9026ba6f891d469bcf10706800b7965a54 100644 (file)
@@ -734,7 +734,7 @@ static int exp_error(int attribute((unused)) nargs,
                      char attribute((unused)) **args,
                      struct sink *output,
                      void attribute((unused)) *u) {
-  return sink_writes(output, cgi_sgmlquote(dcgi_error_string)) < 0 ? -1 : 0;
+  return sink_writes(output, dcgi_error_string) < 0 ? -1 : 0;
 }
 
 /* @image{NAME}
index 93f8692514ba29c212d62002e5de61666ff078bf..16bc70a8a7f9df1a7f2adfb896fe52c91c590fe5 100644 (file)
 # USA
 #
 
-pkgdata_DATA=about.tmpl choose.tmpl credits.tmpl playing.tmpl recent.tmpl \
-            stdhead.tmpl stylesheet.tmpl search.tmpl about.tmpl volume.tmpl \
-            prefs.tmpl help.tmpl choosealpha.tmpl topbar.tmpl \
-            topbarend.tmpl error.tmpl new.tmpl login.tmpl \
-            options options.labels \
+pkgdata_DATA=about.tmpl choose.tmpl playing.tmpl recent.tmpl           \
+            search.tmpl about.tmpl prefs.tmpl help.tmpl error.tmpl     \
+            new.tmpl login.tmpl macros.tmpl                            \
+            options options.labels                                     \
             options.columns
 static_DATA=disorder.css
 staticdir=${pkgdatadir}/static
index 93d0d112f21b4bc920ee13dcb14cdbf89279254a..d153bef1781d948f0a162b76361eaa8747b62d82 100644 (file)
@@ -20,60 +20,55 @@ USA
 -->
 <html>
  <head>
-@include:stdhead@
-  <title>@label:about.title@</title>
+@stdhead{about}
  </head>
  <body>
-@include{topbar}@
-   <p><a
-        title="Visit DisOrder web site"
-        href="http://www.greenend.org.uk/rjk/disorder/">
-       <img
-         src="@image:logo@"
-         alt="About DisOrder"
-         style="border-style:none"></a></p>
-   <h2>Copyright</h2>
+@stdmenu{about}
 
-   <p><a
-    title="DisOrder web site"
-   href="http://www.greenend.org.uk/rjk/disorder/">DisOrder
-   version @version@</a> - select and play digital
-   audio files</p>
+  <p><a title="Visit DisOrder web site"
+  href="http://www.greenend.org.uk/rjk/disorder/"> <img src="@image{logo}"
+  alt="About DisOrder" style="border-style:none"></a></p>
 
-   <p>Copyright &copy; 2003-2008 <a href="http://www.greenend.org.uk/rjk/">Richard Kettlewell</a><br>
-   Portions copyright &copy; 2007 <a href="http://www.chiark.greenend.org.uk/~ryounger/">Ross Younger</a><br>
-   Portions copyright &copy; 2007 Mark Wooding</p>
+  <h2>Copyright</h2>
 
-   <p>Portions extracted from
-   <a href="http://mpg321.sourceforge.net/">MPG321</a>,
-   Copyright &copy; 2001 Joe Drew,
-   Copyright &copy; 2000-2001 Robert Leslie</p>
+  <p><a title="DisOrder web site"
+  ref="http://www.greenend.org.uk/rjk/disorder/">DisOrder version @version</a>
+  - software Jukebox</p>
 
-   <p>This program is free software; you can redistribute it and/or
-   modify it under the terms of the <a
-   href="http://www.gnu.org/copyleft/gpl.html">GNU General Public License</a> as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.</p>
+  <p>Copyright &copy; 2003-2008 <a
+  href="http://www.greenend.org.uk/rjk/">Richard Kettlewell</a><br> Portions
+  copyright &copy; 2007 <a
+  href="http://www.chiark.greenend.org.uk/~ryounger/">Ross Younger</a><br>
+  Portions copyright &copy; 2007, 2008 Mark Wooding</p>
 
-   <p>This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.</p>
+  <p>Portions extracted from <a
+  href="http://mpg321.sourceforge.net/">MPG321</a>, Copyright &copy; 2001 Joe
+  Drew, Copyright &copy; 2000-2001 Robert Leslie</p>
 
-   <p>You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-   USA</p>
+  <p>This program is free software; you can redistribute it and/or modify it
+  under the terms of the <a href="http://www.gnu.org/copyleft/gpl.html">GNU
+  General Public License</a> as published by the Free Software Foundation;
+  either version 2 of the License, or (at your option) any later version.</p>
 
-@include{topbarend}@
+  <p>This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  General Public License for more details.</p>
+
+  <p>You should have received a copy of the GNU General Public License along
+  with this program; if not, write to the Free Software Foundation, Inc., 59
+  Temple Place, Suite 330, Boston, MA 02111-1307 USA</p>
+
+@credits
  </body>
 </html>
-@@
-<!--
+@discard{
 Local variables:
 mode:sgml
 sgml-always-quote-attributes:nil
 sgml-indent-step:1
 sgml-indent-data:t
+indent-tabs-mode:nil
+fill-column:79
 End:
--->
+}@#
index 844fe9a70cd181dcbdc99188a27ef88941d8c134..10ccf22808912ffda1de419bb41b03c5a88ea1e7 100644 (file)
@@ -20,11 +20,10 @@ USA
 -->
 <html>
  <head>
-@include:stdhead@
-  <title>@label:choose.title@</title>
+@stdhead{choose}
  </head>
  <body>
-@include{topbar}@
+@stdmenu{choose}
    <h1>@label:choose.title@</h1>
   
   @#{always have the first-letter bar, if choosealpha enabled}@
@@ -146,15 +145,16 @@ USA
    </div></div>
    }@
 
-@include{topbarend}@
+@credits
  </body>
 </html>
-@@
-<!--
+@discard{
 Local variables:
 mode:sgml
 sgml-always-quote-attributes:nil
 sgml-indent-step:1
 sgml-indent-data:t
+indent-tabs-mode:nil
+fill-column:79
 End:
--->
+}@#
diff --git a/templates/choosealpha.tmpl b/templates/choosealpha.tmpl
deleted file mode 100644 (file)
index 4027834..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
-<!--
-This file is part of DisOrder.
-Copyright (C) 2004-2008 Richard Kettlewell
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-USA
--->
-<html>
- <head>
-@include:stdhead@
-  <title>@label:choose.title@</title>
- </head>
- <body>
-@include{topbar}@
-   <h1>@label:choose.title@</h1>
-
-   <p class=choosealpha>
-    <a title="Directories starting with 'a'"
-    href="@url@?action=choose&#38;regexp=^(the )?a">A</a> |
-    <a title="Directories starting with 'b'"
-    href="@url@?action=choose&#38;regexp=^(the )?b">B</a> |
-    <a title="Directories starting with 'c'"
-    href="@url@?action=choose&#38;regexp=^(the )?c">C</a> |
-    <a title="Directories starting with 'd'"
-    href="@url@?action=choose&#38;regexp=^(the )?d">D</a> |
-    <a title="Directories starting with 'e'"
-    href="@url@?action=choose&#38;regexp=^(the )?e">E</a> |
-    <a title="Directories starting with 'f'"
-    href="@url@?action=choose&#38;regexp=^(the )?f">F</a> |
-    <a title="Directories starting with 'g'"
-    href="@url@?action=choose&#38;regexp=^(the )?g">G</a> |
-    <a title="Directories starting with 'h'"
-    href="@url@?action=choose&#38;regexp=^(the )?h">H</a> |
-    <a title="Directories starting with 'i'"
-    href="@url@?action=choose&#38;regexp=^(the )?i">I</a> |
-    <a title="Directories starting with 'j'"
-    href="@url@?action=choose&#38;regexp=^(the )?j">J</a> |
-    <a title="Directories starting with 'k'"
-    href="@url@?action=choose&#38;regexp=^(the )?k">K</a> |
-    <a title="Directories starting with 'l'"
-    href="@url@?action=choose&#38;regexp=^(the )?l">L</a> |
-    <a title="Directories starting with 'm'"
-    href="@url@?action=choose&#38;regexp=^(the )?m">M</a> |
-    <a title="Directories starting with 'n'"
-    href="@url@?action=choose&#38;regexp=^(the )?n">N</a> |
-    <a title="Directories starting with 'o'"
-    href="@url@?action=choose&#38;regexp=^(the )?o">O</a> |
-    <a title="Directories starting with 'p'"
-    href="@url@?action=choose&#38;regexp=^(the )?p">P</a> |
-    <a title="Directories starting with 'q'"
-    href="@url@?action=choose&#38;regexp=^(the )?q">Q</a> |
-    <a title="Directories starting with 'r'"
-    href="@url@?action=choose&#38;regexp=^(the )?r">R</a> |
-    <a title="Directories starting with 's'"
-    href="@url@?action=choose&#38;regexp=^(the )?s">S</a> |
-    <a title="Directories starting with 't'"
-    href="@url@?action=choose&#38;regexp=^(?!the [^t])t">T</a> |
-    <a title="Directories starting with 'u'"
-    href="@url@?action=choose&#38;regexp=^(the )?u">U</a> |
-    <a title="Directories starting with 'v'"
-    href="@url@?action=choose&#38;regexp=^(the )?v">V</a> |
-    <a title="Directories starting with 'w'"
-    href="@url@?action=choose&#38;regexp=^(the )?w">W</a> |
-    <a title="Directories starting with 'x'"
-    href="@url@?action=choose&#38;regexp=^(the )?x">X</a> |
-    <a title="Directories starting with 'y'"
-    href="@url@?action=choose&#38;regexp=^(the )?y">Y</a> |
-    <a title="Directories starting with 'z'"
-    href="@url@?action=choose&#38;regexp=^(the )?z">Z</a> |
-    <a title="Directories starting with anything else"
-    href="@url@?action=choose&#38;regexp=^[^a-z]">*</a>
-   </p>
-
-@include{topbarend}@
- </body>
-</html>
-@@
-<!--
-Local variables:
-mode:sgml
-sgml-always-quote-attributes:nil
-sgml-indent-step:1
-sgml-indent-data:t
-End:
--->
diff --git a/templates/credits.tmpl b/templates/credits.tmpl
deleted file mode 100644 (file)
index cb8d48f..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-@discard{
-This file is part of DisOrder.
-Copyright (C) 2004-2008 Richard Kettlewell
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-USA
--->
-}@#
-<p class=credits>
-  <a href="http://www.greenend.org.uk/rjk/disorder/"
-     title="DisOrder web site">DisOrder
-     version @version</a>
-  &copy; 2003-2008 Richard Kettlewell et al
-</p>
index 64ad6ff60e917e692b7c6f07cb27e5bad4064abc..715e61d30cee0bac6ef7281cf5f6e5a6f6687a2c 100644 (file)
@@ -20,28 +20,25 @@ USA
 -->
 <html>
  <head>
-@include:stdhead@
-  <title>@label:error.title@</title>
+@stdhead{error}
  </head>
  <body>
-@include{topbar}@
-   <h1>@label:error.title@</h1>
+@stdmenu{error}
+   <h1>@label{error.title}</h1>
     
   <div class=error>
-    <p class=error>@label{error.@label:error@}@</p>
-
-    <p class=error>@label:error.generic@</p>
+    <p class=error>@label{error.@error}</p>
+    <p class=error>@label{error.generic}</p>
   </div>
 
-@include{topbarend}@
+@credits
  </body>
 </html>
-@@
-<!--
+@discard{
 Local variables:
 mode:sgml
 sgml-always-quote-attributes:nil
 sgml-indent-step:1
 sgml-indent-data:t
 End:
--->
+}@#
index 8e298efbbd387dc019aa65115bc67ccb819ebb47..86abea22098af8c822c439ee6e73e831b7550b39 100644 (file)
@@ -20,11 +20,10 @@ USA
 -->
 <html>
  <head>
-@include{stdhead}@
-  <title>@label{help.title}@</title>
+@stdhead{help}
  </head>
  <body>
-@include{topbar}@
+@stdmenu{help}
    <h1>@label{help.title}@</h1>
 
    <h2 class=helptitle>Introduction</h2>
@@ -48,8 +47,8 @@ USA
     being listed first.)  Where possible, estimated start times are
     given.</p>
 
-    <p>Each track has a <img class=button src="@image:scratch@"
-    title="@label:playing.scratch@" alt="@label:playing.scratch@">
+    <p>Each track has a <img class=button src="@image{scratch}"
+    title="@label{playing.scratch}" alt="@label{playing.scratch}">
     button next to it.  For the currently playing track this can be
     used to stop playing the track before it has finished; this is
     called &ldquo;scratching&rdquo;.  For a track in the queue it
@@ -76,32 +75,32 @@ USA
 
    <ul>
     <li>Pause.  This button can be used to pause playing (provided the
-    player supports it).  <img width=16 height=16 class=imgbutton
-    src="@image:enabled@"> indicates that playing is paused,
-    <img width=16 height=16 class=imgbutton
-    src="@image:disabled@"> that it is not.</li>
+    player supports it).  <img width=@width height=@height class=imgbutton
+    src="@image{enabled}"> indicates that playing is paused,
+    <img width=@width height=@height class=imgbutton
+    src="@image{disabled}"> that it is not.</li>
 
     <li>Enable/disable random play.  If disabled then queued tracks
     will still be played but if the queue is empty nothing will be
-    picked at random.  <img width=16 height=16 class=imgbutton
-    src="@image:enabled@"> indicates that random play is
-    enabled, <img width=16 height=16 class=imgbutton
-    src="@image:disabled@"> that it is disabled.</li>
+    picked at random.  <img width=@width height=@height class=imgbutton
+    src="@image{enabled}"> indicates that random play is
+    enabled, <img width=@width height=@height class=imgbutton
+    src="@image{disabled}"> that it is disabled.</li>
 
     <li>Enable/disable play.  If disabled then tracks in the queue
     will not be played, but will remain in the queue instead.  <img
-    width=16 height=16 class=imgbutton src="@image:enabled@">
-    indicates that play is enabled, <img width=16 height=16
-    class=imgbutton src="@image:disabled@"> that it is
+    width=@width height=@height class=imgbutton src="@image{enabled}">
+    indicates that play is enabled, <img width=@width height=@height
+    class=imgbutton src="@image{disabled}"> that it is
     disabled.</li>
 
     <li>Volume control.  You can use the <img class=button
-       src="@image:up@"
-       title="@label:volume.increase@"
-       alt="@label:volume.increase@"> and <img
-       src="@image:down@"
-       title="@label:volume.reduce@"
-       alt="@label:volume.reduce@"> buttons to increase or
+       src="@image{up}"
+       title="@label{volume.up}"
+       alt="@label{volume.up}"> and <img
+       src="@image{down}"
+       title="@label{volume.down}"
+       alt="@label{volume.down}"> buttons to increase or
     decrease the volume, or enter new volume settings for the left
     and/or right speakers.</li>
 
@@ -110,15 +109,15 @@ USA
    <p>Below this is the same table of current and queued tracks as for
     the main playing screen, but with extra buttons for managing the
     queue.
-    The <img class=button src="@image:up@"
-     title="@label:playing.up@" alt="@label:playing.up@"> and <img
-     src="@image:down@" title="@label:playing.down@"
-     alt="@label:playing.down@"> buttons on each track move that
+    The <img class=button src="@image{up}"
+     title="@label{playing.up}" alt="@label{playing.up}"> and <img
+     src="@image{down}" title="@label{playing.down}"
+     alt="@label{playing.down}"> buttons on each track move that
     track around in the queue.  Similarly the <img class=button
-     src="@image:upall@" title="@label:playing.upall@"
-     alt="@label:playing.upall@"> and <img
-     src="@image:downall@" title="@label:playing.downall@"
-     alt="@label:playing.downall@"> buttons move each track to the head or
+     src="@image{upall}" title="@label{playing.upall}"
+     alt="@label{playing.upall}"> and <img
+     src="@image{downall}" title="@label{playing.downall}"
+     alt="@label{playing.downall}"> buttons move each track to the head or
     tail of the queue.</p>
 
     <p>If you are not logged in, or if your user has limited rights,
@@ -133,15 +132,15 @@ USA
    <div class=helpsection>
 
     <p>This screen displays recently played tracks, most recent first.
-    The <img class=button src="@image:edit@"
-    title="@label:choose.prefs@" alt="@label:choose.prefs@">
+    The <img class=button src="@image{edit}"
+    title="@label{choose.prefs}" alt="@label{choose.prefs}">
     button can be used to edit the details for a track; see <a
     href="#prefs">Editing Preferences</a> below.</p>
 
     <p>The number of tracks remembered is controlled by the server
     configuration.  See the <span class=configuration>history</span>
     option in <a
-    href="@url@?action=disorder_config.5">disorder_config(5)</a> for
+    href="@url?action=disorder_config.5">disorder_config(5)</a> for
     more details.</p>
 
    </div>
@@ -152,15 +151,15 @@ USA
 
     <p>This screen displays tracks recently added to the database,
     most recent first.  The <img class=button
-    src="@image:edit@" title="@label:choose.prefs@"
-    alt="@label:choose.prefs@"> button can be used to edit the details
+    src="@image{edit}" title="@label{choose.prefs}"
+    alt="@label{choose.prefs}"> button can be used to edit the details
     for a track; see <a href="#prefs">Editing Preferences</a> below,
     and clicking on the track title will add it to the queue.</p>
 
     <p>The time tracks are remembered for is controlled by the server
     configuration.  See the <span
     class=configuration>noticed_history</span> option in <a
-    href="@url@?action=disorder_config.5">disorder_config(5)</a> for
+    href="@url?action=disorder_config.5">disorder_config(5)</a> for
     more details.</p>
 
    </div>
@@ -177,9 +176,9 @@ USA
      <tbody>
       <tr>
        <td><img
-       class=button src="@image:edit@"
-       title="@label:choose.prefs@"
-       alt="@label:choose.prefs@"></td>
+       class=button src="@image{edit}"
+       title="@label{choose.prefs}"
+       alt="@label{choose.prefs}"></td>
        <td>This button can be used to edit the details for a
        track; see <a href="#prefs">Editing Preferences</a> below.</td>
       </tr>
@@ -192,9 +191,9 @@ USA
     </table>
 
     <p>This screen has two forms: <a
-    href="@url@?action=choose">choose</a>, which give
+    href="@url?action=choose">choose</a>, which give
     you all the top-level directories at once, and <a
-    href="@url@?action=choosealpha">choosealpha</a>,
+    href="@url?action=choosealpha">choosealpha</a>,
     which breaks them down by initial letter.</p>
 
     <p>This screen will may not be available if you are not logged in
@@ -244,7 +243,7 @@ USA
     <p>Some keywords, known as &ldquo;stopwords&rdquo;, are excluded
     from the search, and will never match.  See the <span
     class=configuration>stopword</span> option in <a
-    href="@url@?action=disorder_config.5">disorder_config(5)</a> for
+    href="@url?action=disorder_config.5">disorder_config(5)</a> for
     further details about this.</p>
 
     <p>This screen will may not be available if you are not logged in
@@ -312,37 +311,38 @@ USA
 
    <div class=helpsection>
 
-    <p><a href="@url@?action=disorder_config.5">disorder_config(5)</a> -
+    <p><a href="@url?action=disorder_config.5">disorder_config(5)</a> -
      configuration</p>
 
-    <p><a href="@url@?action=disorder.1">disorder(1)</a> - command line
+    <p><a href="@url?action=disorder.1">disorder(1)</a> - command line
      client</p>
 
-    <p><a href="@url@?action=disobedience.1">disobedience(1)</a> - GTK+
+    <p><a href="@url?action=disobedience.1">disobedience(1)</a> - GTK+
      client</p>
 
-    <p><a href="@url@?action=disorderd.8">disorderd(8)</a> - server</p>
+    <p><a href="@url?action=disorderd.8">disorderd(8)</a> - server</p>
 
-    <p><a href="@url@?action=disorder-dump.8">disorder-dump(8)</a> -
+    <p><a href="@url?action=disorder-dump.8">disorder-dump(8)</a> -
      dump/restore preferences database</p>
 
-    <p><a href="@url@?action=disorder.3">disorder(3)</a> - C API</p>
+    <p><a href="@url?action=disorder.3">disorder(3)</a> - C API</p>
 
-    <p><a href="@url@?action=disorder_protocol.5">disorder_protocol(5)</a> -
+    <p><a href="@url?action=disorder_protocol.5">disorder_protocol(5)</a> -
      DisOrder control protocol</p>
 
    </div>
 
-@include{topbarend}@
+@credits
   </div>
  </body>
 </html>
-@@
-<!--
+@discard{
 Local variables:
 mode:sgml
 sgml-always-quote-attributes:nil
 sgml-indent-step:1
 sgml-indent-data:t
+indent-tabs-mode:nil
+fill-column:79
 End:
--->
+}@#
index 723b6afcb513f147bd84f8a911c1e3958ca41691..7c45438d88b4365a740813763fa5b2c33ee02072 100644 (file)
@@ -20,11 +20,10 @@ USA
 -->
 <html>
  <head>
-@include:stdhead@
-  <title>@label:login.title@</title>
+@stdhead{login}
  </head>
  <body>
-@include{topbar}@
+@stdmenu{login}
    <h1>@label:login.title@</h1>
 
    @if{@ne{@label:error@}{error}@}{
@@ -212,15 +211,16 @@ USA
 
    }@
 
-@include{topbarend}@
+@credits
  </body>
 </html>
-@@
-<!--
+@discard{
 Local variables:
 mode:sgml
 sgml-always-quote-attributes:nil
 sgml-indent-step:1
 sgml-indent-data:t
+indent-tabs-mode:nil
+fill-column:79
 End:
--->
+}@#
index 432cbe383165180ba1c487f46f3c095458fa2757..1a6554dbf6da4cb769b59062bb52aa7bce309830 100644 (file)
@@ -1,5 +1,3 @@
-@discard{
-
 This file is part of DisOrder.
 Copyright (C) 2008 Richard Kettlewell
 
@@ -18,19 +16,81 @@ along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 USA
 
+
+------------------------------------------------------------------------
+Standard macros
+
+
+This file is read before any other template.  Its output is discarded
+but side effects (definitions of macros) are retained.  To override it,
+create /etc/disorder/macros.tmpl that includes this file by absolute path
+and then redefines macros as desired.
+------------------------------------------------------------------------
+
+
 @# Standard width and height of an image
 @define {width} {} {16}
 @define {height} {} {16}
 
-@# Expand to @yes for the Manage page and @no for the playing page
-@define {ifmanage} {yes no}
-         {@if {@eq {@arg{action}}{manage}}
-              {@yes}
-              {@no}}
+@# Standard <head> text
+@#  @name is the name of this page, for the <title> element
+@define {stdhead} {name}
+        {@quiethead
+<link rel=stylesheet
+      type="text/css"
+      href="@label{url.static}/disorder.css">
+<title>@label{@name.title}</title>}
+
+@# Non-displaying <head> text
+@define {quiethead} {}
+        {<link rel=stylesheet
+      type="text/css"
+      href="@label{url.static}/disorder.css">}
+
+@# Standard menu
+@#   @current is the name of the current page, e.g. choosealpha, login
+@define {stdmenu} {current}
+        {<p class=menubar>
+@menuitem{@current}{playing}{true}
+@menuitem{@current}{choose}{@right{play}}
+@menuitem{@current}{search}{@right{play}}
+@menuitem{@current}{manage}{true}
+@menuitem{@current}{login}{true}
+@menuitem{@current}{help}{true}
+@menuitem{@current}{about}{true}
+</p>
+<hr>
+}
+
+@# Menu entry
+@#  Used by @stdmenu
+@#  @current is the name of the current page (not necessarily the action that
+@#           got there!)
+@#  @name is the name of the menu item
+@#  @available is true if the menu item is available, else false
+@#  
+@define {menuitem} {current name available}  
+        {@if{@available}
+            {  <a @if{@eq{@current}{@name}}
+                     {class=activemenu}
+                     {class=inactivemenu}
+                  @if{@eq{name}{playing}}
+                     {href="@url"}
+                     {href="@url?action=@name"}
+                  title="@label{menu.@q{@name}verbose}"
+                 @label{menu.@name}</a>}
+            {  <span class=invaldmenu title="@label{menu.@q{@name}verbose}">
+    @label{menu.@name}</span>}}
+
 
-@# Expand to &back=manage or to nothing
-@define {back} {}
-        {@ifmanage{&amp;back=manage}{}}
+@# Standard footer text
+@define {credits} {}
+        {<p class=credits>
+  <a href="http://www.greenend.org.uk/rjk/disorder/"
+     title="DisOrder web site">DisOrder
+     version @version</a>
+  &copy; 2003-2008 Richard Kettlewell et al
+</p>}
 
 @# Expand to the time that @id will be played
 @#  @what is the section
@@ -111,4 +171,3 @@ USA
                   width=@width height=@height
                   title="@label{playing.@q{@dir}verbose}"
                   alt="@label{playing.@dir}">}}
-}@#
index 73eea2d4e3f144f7a88d9eb0ead927f5b09923a3..2185c4bb2fdf3fb5f3fb4d547d800533fd6131f4 100644 (file)
@@ -20,11 +20,10 @@ USA
 -->
 <html>
  <head>
-@include:stdhead@
-  <title>@label:new.title@</title>
+@stdhead{new}
  </head>
  <body>
-@include{topbar}@
+@stdmenu{new}
   <h1>@label:new.title@</h1>
 
 @#{only display the table if there is something to put in it}@
@@ -70,15 +69,16 @@ USA
   </table>
 }@
 
-@include{topbarend}@
+@credits
  </body>
 </html>
-@@
-<!--
+@discard{
 Local variables:
 mode:sgml
 sgml-always-quote-attributes:nil
 sgml-indent-step:1
 sgml-indent-data:t
+indent-tabs-mode:nil
+fill-column:79
 End:
--->
+}@#
index bd1f6353dc6b50984dd44beaf09c51cbdf7d66ea..5d369c0eeffbc2f93322eb2da69b595c2d82ba04 100644 (file)
@@ -48,17 +48,25 @@ USA
                  {<img class=button width=@width height=@height
                        src="@image{no@dir}">}}
 
-  @include{macros.tmpl}
+  @# Expand to @yes for the Manage page and @no for the playing page
+  @define {ifmanage} {yes no}
+           {@if {@eq {@arg{action}}{manage}}
+                {@yes}
+                {@no}}
+
+  @# Expand to &back=manage or to nothing
+  @define {back} {}
+         {@ifmanage{&amp;back=manage}{}}
 }@#
 <html>
  <head>
-@include{stdhead.tmpl}@#
+@quiethead
   <title>@if{@isplaying}
             {@playing{@part{@id}{title}}}
             {@label{playing.title}}</title>
  </head>
  <body>
-@include{topbar.tmpl}
+@stdmenu{@ifmanage{manage}{playing}}
    <h1>@label{playing.title}</h1>
 
 @# Extra control buttons for the management page
@@ -163,7 +171,7 @@ USA
    </table>
 }
 
-@include{topbarend.tmpl}@#
+@credits
  </body>
 </html>
 @discard{
@@ -172,5 +180,6 @@ mode:sgml
 sgml-always-quote-attributes:nil
 sgml-indent-step:1
 sgml-indent-data:t
+indent-tabs-mode:nil
 End:
-}@
+}@#
index 5e88890148c5f0d7b74e2b38fc29a8078cc6fbfc..e19d4acce1db20273a8a2ba776b6d73588c0bdd7 100644 (file)
@@ -20,11 +20,10 @@ USA
 -->
 <html>
  <head>
-@include:stdhead@
-  <title>@label:prefs.title@</title>
+@stdhead{prefs}
  </head>
  <body>
-@include{topbar}@
+@stdmenu{prefs}
    <h1>@label:prefs.title@</h1>
 
    <form class=prefs action="@url@" method=POST
@@ -75,15 +74,16 @@ USA
     </p>
    </form>
 
-@include{topbarend}@
+@credits
  </body>
 </html>
-@@
-<!--
+@discard{
 Local variables:
 mode:sgml
 sgml-always-quote-attributes:nil
 sgml-indent-step:1
 sgml-indent-data:t
+indent-tabs-mode:nil
+fill-column:79
 End:
--->
+}@#
index 787b514e552579f22cdcb0cf9b5f6ea2dc582496..e8590c7c9604b35d269a38fa0ff3802891cf1d03 100644 (file)
@@ -20,11 +20,10 @@ USA
 -->
 <html>
  <head>
-@include:stdhead@
-  <title>@label:recent.title@</title>
+@stdhead{recent}
  </head>
  <body>
-@include{topbar}@
+@stdmenu{recent}
   <h1>@label:recent.title@</h1>
 
 @#{only display the table if there is something to put in it}@
@@ -70,15 +69,16 @@ USA
   </table>
 }@
 
-@include{topbarend}@
+@credits
  </body>
 </html>
-@@
-<!--
+@discard{
 Local variables:
 mode:sgml
 sgml-always-quote-attributes:nil
 sgml-indent-step:1
 sgml-indent-data:t
+indent-tabs-mode:nil
+fill-column:79
 End:
--->
+}@#
index 1b0fa1ce282bb979502cc150eb11b087b2fea22d..8b836f6a624e79be9edbf092a326e9dd6672bf16 100644 (file)
@@ -20,11 +20,10 @@ USA
 -->
 <html>
  <head>
-@include:stdhead@
-  <title>@label:search.title@</title>
+@stdhead{search}
  </head>
  <body>
-@include{topbar}@
+@stdmenu{search}
    <h1>@label:search.title@</h1>
 
    <form class=search action="@url@" method=POST
@@ -63,15 +62,16 @@ USA
     }@
    </div>
 
-@include{topbarend}@
+@credits
  </body>
 </html>
-@@
-<!--
+@discard{
 Local variables:
 mode:sgml
 sgml-always-quote-attributes:nil
 sgml-indent-step:1
 sgml-indent-data:t
+indent-tabs-mode:nil
+fill-column:79
 End:
--->
+}@#
diff --git a/templates/stdhead.tmpl b/templates/stdhead.tmpl
deleted file mode 100644 (file)
index 9118ff1..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-@discard{
-This file is part of DisOrder.
-Copyright (C) 2004, 2008 Richard Kettlewell
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-USA
-
-Anything that goes in all html HEAD elements goes here.
-}@#
-@include{stylesheet.tmpl}@#
diff --git a/templates/stylesheet.tmpl b/templates/stylesheet.tmpl
deleted file mode 100644 (file)
index da41aff..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-@discard{
-This file is part of DisOrder.
-Copyright (C) 2005, 2007, 2008 Richard Kettlewell
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-USA
-
-This file is a standard place to put a link to a stylesheet,
-or an embedded stylesheet.
-}@#
-  <link rel=stylesheet
-        type="text/css"
-        href="@image{disorder.css}">
diff --git a/templates/topbar.tmpl b/templates/topbar.tmpl
deleted file mode 100644 (file)
index e350d91..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-<p class=menubar>
-  <a class=@if{@eq{@action@}{playing}@}{activemenu}{inactivemenu}@
- href="@url@"
- title="@label:sidebar.playingverbose@">@label:sidebar.playing@</a>
-  <a class=@if{@eq{@action@}{recent}@}{activemenu}{inactivemenu}@
- href="@url@?action=recent"
- title="@label:sidebar.recentverbose@">@label:sidebar.recent@</a>
-  <a class=@if{@eq{@action@}{new}@}{activemenu}{inactivemenu}@
- href="@url@?action=new"
- title="@label:sidebar.newverbose@">@label:sidebar.new@</a>
-@right{play}{
-  <a class=@if{@or{@eq{@action@}{choose}@}
-                  {@eq{@action@}{choosealpha}@}@}
-              {activemenu}
-              {inactivemenu}@
- href="@url@?action=@label:sidebar.choosewhich@"
- title="@label:sidebar.chooseverbose@">@label:sidebar.choose@</a>}{
-  <span class=invalidmenu
-   title="@label:sidebar.chooseverbose@">@label:sidebar.choose@</span>}@
-@right{play}{
-  <a class=@if{@eq{@action@}{search}@}{activemenu}{inactivemenu}@
- href="@url@?action=search"
- title="@label:sidebar.searchverbose@">@label:sidebar.search@</a>}{
-  <span class=invalidmenu
-   title="@label:sidebar.searchverbose@">@label:sidebar.search@</span>}@
-<!-- disabled by default since now available from 'manage'
-  <a class=@if{@eq{@action@}{volume}@}{activemenu}{inactivemenu}@
- href="@url@?action=volume"
- title="@label:sidebar.volumeverbose@">@label:sidebar.volume@</a>
--->
-  <a class=@if{@eq{@action@}{manage}@}{activemenu}{inactivemenu}@
- href="@url@?mgmt=true"
- title="@label:sidebar.manageverbose@">@label:sidebar.manage@</a>
-  <a class=@if{@or{@eq{@action@}{login}@}
-                  {@eq{@action@}{logout}@}
-                  {@eq{@action@}{register}@}
-                  {@eq{@action@}{reminder}@}
-                  {@eq{@action@}{edituser}@}@}{activemenu}{inactivemenu}@
- href="@url@?action=login"
- title="@label:sidebar.loginverbose@">@label:sidebar.login@</a>
-  <a class=@if{@eq{@action@}{help}@}{activemenu}{inactivemenu}@
- href="@url@?action=help"
- title="@label:sidebar.helpverbose@">@label:sidebar.help@</a>
-  <a class=@if{@eq{@action@}{about}@}{activemenu}{inactivemenu}@
- href="@url@?action=about"
- title="@label:sidebar.aboutverbose@">@label:sidebar.about@</a>
-</p>
-<hr>
-@@
-<!--
-This file is part of DisOrder.
-Copyright (C) 2005, 2007, 2008 Richard Kettlewell
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-USA
--->
diff --git a/templates/topbarend.tmpl b/templates/topbarend.tmpl
deleted file mode 100644 (file)
index 887dba2..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-@discard{
-This file is part of DisOrder.
-Copyright (C) 2005, 2008 Richard Kettlewell
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-USA
-}@#
-@include{credits.tmpl}@#
diff --git a/templates/volume.tmpl b/templates/volume.tmpl
deleted file mode 100644 (file)
index dcc69b1..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
-<!--
-This file is part of DisOrder.
-Copyright (C) 2004, 2005, 2008 Richard Kettlewell
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-USA
--->
-<html>
- <head>
-@include:stdhead@
-  <title>@label:volume.title@</title>
- </head>
- <body>
-@include{topbar}@
-   <h1>@label:volume.title@</h1>
-
-   <form class=volume action="@url@" method=POST>
-    <p class=volume>
-     <a class=imgbutton
-      href="@url@?action=volume&#38;delta=-@label:volume.resolution@">
-      <img class=button src="@image:down@"
-       alt="@label:volume.reduce@" title="@label:volume.reduceverbose@">
-     </a>
-     @label:volume.left@ <input size=3 name=left type=text value="@volume:left@">
-     @label:volume.right@ <input size=3 name=right type=text value="@volume:right@">
-     <button class=search name=action type=submit value=volume>
-      @label:volume.set@
-     </button>
-     <a class=imgbutton
-      href="@url@?action=volume&#38;delta=@label:volume.resolution@">
-      <img class=button src="@image:up@"
-       alt="@label:volume.increase@" title="@label:volume.increaseverbose@">
-     </a>
-    </p>
-   </form>
-
-@include{topbarend}@
- </body>
-</html>
-@@
-<!--
-Local variables:
-mode:sgml
-sgml-always-quote-attributes:nil
-sgml-indent-step:1
-sgml-indent-data:t
-End:
--->