chiark / gitweb /
more template work
authorRichard Kettlewell <rjk@greenend.org.uk>
Sun, 11 May 2008 14:37:57 +0000 (15:37 +0100)
committerRichard Kettlewell <rjk@greenend.org.uk>
Sun, 11 May 2008 14:37:57 +0000 (15:37 +0100)
server/actions.c
templates/macros.tmpl
templates/options.labels
templates/playing.tmpl

index 8e975e447451731d91455ad9ed0b0711e474dab9..aca4db0aeea173039b2459315a6ee3879c9e7e1f 100644 (file)
@@ -161,8 +161,8 @@ static const struct action {
   { "enable", act_enable },
   { "manage", act_playing },
   { "playing", act_playing },
   { "enable", act_enable },
   { "manage", act_playing },
   { "playing", act_playing },
-  { "random-disable", act_random_disable },
-  { "random-enable", act_random_enable },
+  { "randomdisable", act_random_disable },
+  { "randomenable", act_random_enable },
   { "remove", act_remove },
 };
 
   { "remove", act_remove },
 };
 
index 7c1093866cd5b464388cc438d44ac72d9c871bce..af62b4c1b6613e6edbf2974956e336528b676a3d 100644 (file)
@@ -1,7 +1,7 @@
 @discard{
 
 This file is part of DisOrder.
 @discard{
 
 This file is part of DisOrder.
-Copyright (C) 2004-2008 Richard Kettlewell
+Copyright (C) 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
 
 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
@@ -18,6 +18,10 @@ along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 USA
 
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 USA
 
+@# 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}}
 @# Expand to @yes for the Manage page and @no for the playing page
 @define {ifmanage} {yes no}
          {@if {@eq {@arg{action}}{manage}}
@@ -29,10 +33,14 @@ USA
         {@ifmanage{&amp;back=manage}{}}
 
 @# Expand to the time that @id will be played
         {@ifmanage{&amp;back=manage}{}}
 
 @# Expand to the time that @id will be played
+@#  @what is the section
+@#  @id is the track ID
 @define {mwhen} {what id}
         {@when{@id}</td>}
 
 @# Expand to the 'who' field for @id
 @define {mwhen} {what id}
         {@when{@id}</td>}
 
 @# Expand to the 'who' field for @id
+@#  @what is the section
+@#  @id is the track ID
 @define {mwho} {what id}
         {@if{@eq{@who{@id}}{}}
             {@if{@eq{@state{@id}}{random}}
 @define {mwho} {what id}
         {@if{@eq{@who{@id}}{}}
             {@if{@eq{@state{@id}}{random}}
@@ -41,6 +49,8 @@ USA
             {@who{@id}}}
 
 @# Expand to the artist for @track
             {@who{@id}}}
 
 @# Expand to the artist for @track
+@#  @what is the section
+@#  @track is the track name
 @define {martist} {what track}
         {@right{play}
                {<a class=directory
 @define {martist} {what track}
         {@right{play}
                {<a class=directory
@@ -50,6 +60,8 @@ USA
                       title="@part{@track}{artist}@">@part{@track}{short}{artist}</span>}}
 
 @# Expand to the album for @track
                       title="@part{@track}{artist}@">@part{@track}{short}{artist}</span>}}
 
 @# Expand to the album for @track
+@#  @what is the section
+@#  @track is the track name
 @define {malbum} {what track}
         {@right{play}
                {<a class=directory
 @define {malbum} {what track}
         {@right{play}
                {<a class=directory
@@ -59,10 +71,14 @@ USA
                       title="@part{@track}{album}@">@part{@track}{short}{album}</span>}}
 
 @# Expand to the title for @track
                       title="@part{@track}{album}@">@part{@track}{short}{album}</span>}}
 
 @# Expand to the title for @track
+@#  @what is the section
+@#  @track is the track name
 @define {mtitle} {what track}
         {<span title="@part{@track}{title}">@part{@track}{short}{title}</span>}
 
 @# Expand to the remove/scratch entry for @id
 @define {mtitle} {what track}
         {<span title="@part{@track}{title}">@part{@track}{short}{title}</span>}
 
 @# Expand to the remove/scratch entry for @id
+@#  @what is the section
+@#  @id is the track ID
 @define {mremove} {what id}
         {@if{@removable{@id}}
             {<a class=imgbutton
 @define {mremove} {what id}
         {@if{@removable{@id}}
             {<a class=imgbutton
@@ -76,6 +92,7 @@ USA
                   alt="@label{@what.scratch}">}}
 
 @# Expand to a move button
                   alt="@label{@what.scratch}">}}
 
 @# Expand to a move button
+@#  @id is the track ID
 @#  @dir should be a direction: up, upall, down or downall
 @#  @delta should be the distance, +ve for up and -ve for down
 @# This macro calls @movable to check that the move is possible.
 @#  @dir should be a direction: up, upall, down or downall
 @#  @delta should be the distance, +ve for up and -ve for down
 @# This macro calls @movable to check that the move is possible.
index ef6272d6424831ddc971e660e8f793f1cedd5f16..85e0377216b90f150d52f1e0bdb1c94addd7437d 100644 (file)
@@ -16,11 +16,11 @@ label       queue.randomtrack       random
 
 # Short and long text for scratch (remove playing track) button
 label  playing.remove          Scratch
 
 # Short and long text for scratch (remove playing track) button
 label  playing.remove          Scratch
-label  playing.removeverbose   "stop playing this track"
+label  playing.removeverbose   "Stop playing this track"
 
 # Short and long text for remove queued track button
 label  queue.remove            Remove
 
 # Short and long text for remove queued track button
 label  queue.remove            Remove
-label  queue.removeverbose     "remove track from queue"
+label  queue.removeverbose     "Remove track from queue"
 
 # Text for banner above currently playing track
 label  playing.now             "Now playing"
 
 # Text for banner above currently playing track
 label  playing.now             "Now playing"
@@ -33,19 +33,19 @@ label       playing.up              Up
 label  playing.down            Down
 label  playing.upall           Head
 label  playing.downall         Tail
 label  playing.down            Down
 label  playing.upall           Head
 label  playing.downall         Tail
-label  playing.upverbose       "move track earlier in queue"
-label  playing.downverbose     "move track later in queue"
-label  playing.upallverbose    "move track to head of queue"
-label  playing.downallverbose  "move track to end of queue"
+label  playing.upverbose       "Move track earlier in queue"
+label  playing.downverbose     "Move track later in queue"
+label  playing.upallverbose    "Move track to head of queue"
+label  playing.downallverbose  "Move track to end of queue"
 
 # Short and long text for play control buttons
 label  playing.random          "Random play"
 label  playing.playing         "Playing"
 label  playing.pause           Pause
 
 # Short and long text for play control buttons
 label  playing.random          "Random play"
 label  playing.playing         "Playing"
 label  playing.pause           Pause
-label  playing.randomdisableverbose    "disable random play"
-label  playing.randomenableverbose     "enable random play"
-label  playing.playingdisableverbose   "disable playing"
-label  playing.playingenableverbose    "enable playing"
+label  playing.randomdisableverbose    "Disable random play"
+label  playing.randomenableverbose     "Enable random play"
+label  playing.playingdisableverbose   "Disable playing"
+label  playing.playingenableverbose    "Enable playing"
 label  playing.pauseverbose    "Pause the current track"
 label  playing.resumeverbose   "Resume play"
 
 label  playing.pauseverbose    "Pause the current track"
 label  playing.resumeverbose   "Resume play"
 
@@ -63,17 +63,17 @@ label       volume.left             ""
 label  volume.right            ""
 
 # Short and long text for volume down/up buttons
 label  volume.right            ""
 
 # Short and long text for volume down/up buttons
-label  volume.reduce           Down
-label  volume.increase         Up
-label  volume.reduceverbose    "reduce volume"
-label  volume.increaseverbose  "increase volume"
+label  volume.down             Down
+label  volume.up               Up
+label  volume.downverbose      "Reduce volume"
+label  volume.upverbose        "Increase volume"
 
 # Amount to increase/reduce volume by
 label  volume.resolution       4
 
 # Long text for linsk to album/artist
 
 # Amount to increase/reduce volume by
 label  volume.resolution       4
 
 # Long text for linsk to album/artist
-label  playing.artistverbose   "more tracks by this artist"
-label  playing.albumverbose    "more tracks from this album"
+label  playing.artistverbose   "More tracks by this artist"
+label  playing.albumverbose    "More tracks from this album"
 
 # <TITLE> for recently played page
 label  recent.title            "Recently Played"
 
 # <TITLE> for recently played page
 label  recent.title            "Recently Played"
@@ -212,16 +212,16 @@ label     sidebar.help            Help
 label  sidebar.manage          Manage
 
 # Long (i.e. TITLE=) text for sidebar links
 label  sidebar.manage          Manage
 
 # Long (i.e. TITLE=) text for sidebar links
-label  sidebar.playingverbose  "current and queued tracks"
-label  sidebar.chooseverbose   "choose tracks"
-label  sidebar.searchverbose   "word search among track names"
-label  sidebar.recentverbose   "recently played tracks"
-label  sidebar.newverbose      "newly added tracks"
-label  sidebar.aboutverbose    "about DisOrder"
-label  sidebar.volumeverbose   "volume control"
-label  sidebar.loginverbose    "log in to DisOrder"
-label  sidebar.helpverbose     "basic user guide"
-label  sidebar.manageverbose   "queue management and volume control"
+label  sidebar.playingverbose  "Current and queued tracks"
+label  sidebar.chooseverbose   "Choose tracks"
+label  sidebar.searchverbose   "Word search among track names"
+label  sidebar.recentverbose   "Recently played tracks"
+label  sidebar.newverbose      "Newly added tracks"
+label  sidebar.aboutverbose    "About DisOrder"
+label  sidebar.volumeverbose   "Volume control"
+label  sidebar.loginverbose    "Log in to DisOrder"
+label  sidebar.helpverbose     "Basic user guide"
+label  sidebar.manageverbose   "Queue management and volume control"
 
 # This should be 'choose' or 'choosealpha'.  If 'choose' then all artists
 # appear on the same page, otherwise they are broken up by initial letter
 
 # This should be 'choose' or 'choosealpha'.  If 'choose' then all artists
 # appear on the same page, otherwise they are broken up by initial letter
index c910120bdefec9a7ed8d4e12445628249f20c1ab..ba8af01e2e0621fdacf18016b2af7452ea544fc2 100644 (file)
@@ -19,6 +19,33 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 USA
 -->
 @discard{
 USA
 -->
 @discard{
+
+  @# On/off button for pause etc
+  @#  @class should be the class: pause, random, playing
+  @#  @action should be the action to switch to the opposite state
+  @#  @state should be the current state
+  @define {onoff} {class action state}
+          {<a class=button
+              href="@url?action=@action@back"@class}@q{@state
+              title="@label{playing.@q{action}verbose}">
+             @label{playing.@class}
+           </a>
+           <img width=@width height=@height class=imgbutton
+                src="@image{@state}">}
+
+  @# Volume up/down buttons
+  @#  @dir is the direction: up or down
+  @#  @sign is the sign: + or -
+  @define {vbutton}{dir sign}
+          {@right{volume}
+                 {<a class=imgbutton
+                    href="@url?action=volume&#38;delta=@sign@label{volume.resolution}@back">
+                   <img class=button src="@image{@dir}"
+                        alt="@label{volume.@dir}"
+                        title="@label{volume.@q{@dir}verbose}">
+                 </a>}
+                 {<img class=button src="@image{no@dir}">}}
+
   @include{macros.tmpl}
 }@#
 <html>
   @include{macros.tmpl}
 }@#
 <html>
@@ -35,97 +62,37 @@ USA
 @# Extra control buttons for the management page
    @ifmanage{
    <div class=mgmt>
 @# Extra control buttons for the management page
    @ifmanage{
    <div class=mgmt>
-   <p class=mgmt>
-   @if{@paused}{
-@# Paused
-    <a class=button
-       href="@url?action=resume@back"
-       title="@label{playing.resumeverbose}">@label{playing.pause}</a>
-    </a>
-    <img width=16 height=16 class=imgbutton src="@image{enabled}">
-   }{
-@# Not paused
-     <a class=button
-        href="@url?action=pause@back"
-        title="@label{playing.pauseverbose}">@label{playing.pause}</a>
-     </a>
-     <img width=16 height=16 class=imgbutton src="@image{disabled}">
-   }
-   @if{@random-enabled}{
-@# Random play enabled
-     <a class=button
-        href="@url?action=random-disable@back"
-        title="@label{playing.randomdisableverbose}">@label{playing.random}</a>
-     </a>
-     <img width=16 height=16 class=imgbutton src="@image{enabled}">
-   }{
-@# Random play disabled
-    <a class=button
-       href="@url?action=random-enable@back"
-       title="@label{playing.randomenableverbose}">@label{playing.random}</a>
-    </a>
-    <img width=16 height=16 class=imgbutton src="@image{disabled}">
-   }
-   @if{@enabled}{
-@# Play enabled
-     <a class=button
-        href="@url?action=disable@back"
-        title="@label{playing.disableverbose}">@label{playing.playing}</a>
-     </a>
-     <img width=16 height=16 class=imgbutton src="@image{enabled}">
-   }{
-@# Play disabled
-     <a class=button
-        href="@url?action=enable@back"
-        title="@label{playing.enableverbose}">@label{playing.playing}</a>
-     </a>
-     <img width=16 height=16 class=imgbutton src="@image{disabled}">
-   }
-@# Volume form
-   <form class=volume method=POST
-         action="@url"
-         enctype="multipart/form-data" accept-charset=utf-8>
-   <span class=volume>
-     @label{playing.volume}
-@# Volume up button
-     @right{volume}{
-       <a class=imgbutton
-          href="@url?action=volume&#38;delta=-@label{volume.resolution}@back">
-         <img class=button src="@image{down}"
-              alt="@label{volume.reduce}"
-              title="@label{volume.reduceverbose}">
-       </a>
-     }{
-       <img class=button src="@image{nodown}">
-     }
-@# Volume value widgets
-     @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@">
-     <input name=back type=hidden value="@thisurl@?back=manage">
-@# Volume set button
-     @right{volume}{
-       <button class=search name=submit type=submit>
-          @label{volume.set}
-       </button>
-       <input name=action type=hidden value=volume>
-     }
-@# Volume down button
-     @right{volume}{
-       <a class=imgbutton
-          href="@url?action=volume&#38;delta=@label{volume.resolution}@back">
-          <img class=button
-               src="@image{up}"
-               alt="@label{volume.increase}"
-               title="@label{volume.increaseverbose}">
-       </a>
-     }{
-       <img class=button src="@image{noup}">
-     }
-    </form>
-    </span>
-    </p>
+     <p class=mgmt>
+       @if{@paused}
+         {@onoff{class}{resume}{enabled}}
+         {@onoff{class}{pause}{disabled}}
+       @if{@random-enabled}
+         {@onoff{random}{randomdisable}{enabled}}
+         {@onoff{random}{randomenable}{disabled}}
+       @if{@enabled}
+         {@onoff{playing}{disable}{enabled}}
+         {@onoff{playing}{enable}{disabled}}
+       <form class=volume method=POST
+            action="@url"
+            enctype="multipart/form-data" accept-charset=utf-8>
+        <span class=volume>
+          @label{playing.volume}
+          @vbutton{up}{+}
+          @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}">
+          <input name=back type=hidden value="@thisurl@?back=manage">
+          @right{volume}{
+            <button class=search name=submit type=submit>
+               @label{volume.set}
+            </button>
+            <input name=action type=hidden value=volume>
+          }
+          @vbutton{down}{-}
+        </span>
+       </form>
+      </p>
     </div>
    }{}
 
     </div>
    }{}
 
@@ -141,54 +108,54 @@ USA
       <th class=length>@label{heading.length}</th>
       <th class=button>&nbsp;</th>
       @ifmanage{
       <th class=length>@label{heading.length}</th>
       <th class=button>&nbsp;</th>
       @ifmanage{
-       <th class=imgbutton>&nbsp;</th>
-       <th class=imgbutton>&nbsp;</th>
-       <th class=imgbutton>&nbsp;</th>
-       <th class=imgbutton>&nbsp;</th>
+        <th class=imgbutton>&nbsp;</th>
+        <th class=imgbutton>&nbsp;</th>
+        <th class=imgbutton>&nbsp;</th>
+        <th class=imgbutton>&nbsp;</th>
       }{}
      </tr>
      @if{@isplaying}{
        <tr class=nowplaying>
       }{}
      </tr>
      @if{@isplaying}{
        <tr class=nowplaying>
-       <td colspan=@ifmanage{11}{7}>@label{playing.now}</td>
+        <td colspan=@ifmanage{11}{7}>@label{playing.now}</td>
        </tr>
      }
      @playing{
        <tr class=playing>
        </tr>
      }
      @playing{
        <tr class=playing>
-       <td class=when>@mwhen{playing}{@id}</td>
-       <td class=who>@mwho{playing}{@id}</td>
-       <td class=artist>@martist{playing}{@track}</td>
-       <td class=album>@malbum{playing}{@track}</td>
-       <td class=title>@mtitle{playing}{@track}</td>
-       <td class=length>@length{@id}</td>
-       <td class=imgbutton>@mremove{playing}{@id}</td>
-       @ifmanage{
-         <td class=imgbutton>&nbsp;</td>
-         <td class=imgbutton>&nbsp;</td>
-         <td class=imgbutton>&nbsp;</td>
-         <td class=imgbutton>&nbsp;</td>
-       }{}
+        <td class=when>@mwhen{playing}{@id}</td>
+        <td class=who>@mwho{playing}{@id}</td>
+        <td class=artist>@martist{playing}{@track}</td>
+        <td class=album>@malbum{playing}{@track}</td>
+        <td class=title>@mtitle{playing}{@track}</td>
+        <td class=length>@length{@id}</td>
+        <td class=imgbutton>@mremove{playing}{@id}</td>
+        @ifmanage{
+          <td class=imgbutton>&nbsp;</td>
+          <td class=imgbutton>&nbsp;</td>
+          <td class=imgbutton>&nbsp;</td>
+          <td class=imgbutton>&nbsp;</td>
+        }{}
        </tr>
      }
      @if{@isqueue@}{
        <tr class=next>
        </tr>
      }
      @if{@isqueue@}{
        <tr class=next>
-       <td colspan=@ifmanage{11}{7}@>@label{playing.next}</td>
+        <td colspan=@ifmanage{11}{7}@>@label{playing.next}</td>
        </tr>
      }
      @queue{
        <tr class=@parity@>
        </tr>
      }
      @queue{
        <tr class=@parity@>
-       <td class=when>@mwhen{queue}{@id}</td>
-       <td class=who>@mwho{queue}{@id}</td>
-       <td class=artist>@martist{queue}{@track}</td>
-       <td class=album>@malbum{queue}{@track}</td>
-       <td class=title>@mtitle{queue}{@track}</td>
-       <td class=length>@length</td>
-       <td class=imgbutton>@mremove{queue}{@id}</td>
-       @ifmanage{
-         <td class=imgbutton>@mmove{@id}{upall}{2147483647}</td>
-         <td class=imgbutton>@mmove{@id}{up}{1}</td>
-         <td class=imgbutton>@mmove{@id}{down}{-1}</td>
-         <td class=imgbutton>@mmove{@id}{downall}{-2147483647}</td>
-       }
+        <td class=when>@mwhen{queue}{@id}</td>
+        <td class=who>@mwho{queue}{@id}</td>
+        <td class=artist>@martist{queue}{@track}</td>
+        <td class=album>@malbum{queue}{@track}</td>
+        <td class=title>@mtitle{queue}{@track}</td>
+        <td class=length>@length</td>
+        <td class=imgbutton>@mremove{queue}{@id}</td>
+        @ifmanage{
+          <td class=imgbutton>@mmove{@id}{upall}{2147483647}</td>
+          <td class=imgbutton>@mmove{@id}{up}{1}</td>
+          <td class=imgbutton>@mmove{@id}{down}{-1}</td>
+          <td class=imgbutton>@mmove{@id}{downall}{-2147483647}</td>
+        }
        </tr>
      }
    </table>
        </tr>
      }
    </table>