chiark / gitweb /
Macro-ize (most) <A>-based buttons
[disorder] / templates / playing.tmpl
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
2 <!--
3 This file is part of DisOrder.
4 Copyright (C) 2004-2008 Richard Kettlewell
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19 USA
20 -->
21 @discard{
22
23   @# On/off button for pause etc
24   @#  @class should be the class: pause, random, playing
25   @#  @action should be the action to switch to the opposite state
26   @#  @state should be the current state
27   @define {onoff} {class action state}
28           {@actbutton{@label{playing.@class}}
29                      {@label{playing.@q{@action}verbose}}
30                      {@action}
31            <img width=@width height=@height class=imgbutton
32                 src="@image{@state}">}
33
34   @# Volume up/down buttons
35   @#  @dir is the direction: up or down
36   @#  @sign is the sign: + or -
37   @define {vbutton}{dir sign}
38           {@right{volume}
39                  {<a class=imgbutton
40                      href="@url?action=volume&#38;delta=@sign@label{volume.resolution}@back">
41                     <img class=button src="@image{@dir}"
42                          width=@width height=@height
43                          alt="@label{volume.@dir}"
44                          title="@label{volume.@q{@dir}verbose}">
45                   </a>}
46                  {<img class=button width=@width height=@height
47                        src="@image{no@dir}">}}
48
49   @# Expand to @yes for the Manage page and @no for the playing page
50   @define {ifmanage} {yes no}
51             {@if {@eq {@arg{action}}{manage}}
52                  {@yes}
53                  {@no}}
54
55   @# Expand to &back=manage or to nothing
56   @define {back} {}
57           {@ifmanage{&amp;back=manage}{}}
58 }@#
59 <html>
60  <head>
61 @quiethead
62   <title>@if{@isplaying}
63             {@playing{@part{@id}{title}}}
64             {@label{playing.title}}</title>
65  </head>
66  <body>
67 @stdmenu{@ifmanage{manage}{playing}}
68    <h1>@label{playing.title}</h1>
69
70 @# Extra control buttons for the management page
71    @ifmanage{
72    <div class=mgmt>
73      <p class=mgmt>
74        @if{@paused}
75           {@onoff{pause}{resume}{enabled}}
76           {@onoff{pause}{pause}{disabled}}
77        @if{@random-enabled}
78           {@onoff{random}{randomdisable}{enabled}}
79           {@onoff{random}{randomenable}{disabled}}
80        @if{@enabled}
81           {@onoff{playing}{disable}{enabled}}
82           {@onoff{playing}{enable}{disabled}}
83        <form class=volume method=POST
84              action="@url"
85              enctype="multipart/form-data" accept-charset=utf-8>
86          <span class=volume>
87            @label{playing.volume}
88            @vbutton{up}{+}
89            @label{volume.left}
90            <input size=3 name=left type=text value="@volume{left}">
91            @label{volume.right}
92            <input size=3 name=right type=text value="@volume{right}">
93            <input name=back type=hidden value="@quote{@thisurl}">
94            @right{volume}{
95              @submit{@label{volume.set}}
96              <input name=action type=hidden value=volume>
97            }
98            @vbutton{down}{-}
99          </span>
100        </form>
101       </p>
102     </div>
103    }{}
104
105 @# Only display the table if there is something to put in it
106 @if{@or{@isplaying}{@isqueue}}{
107    <table class=playing>
108      <tr class=headings>
109       <th class=when>@label{heading.when}</th>
110       <th class=who>@label{heading.who}</th>
111       <th class=artist>@label{heading.artist}</th>
112       <th class=album>@label{heading.album}</th>
113       <th class=title>@label{heading.title}</th>
114       <th class=length>@label{heading.length}</th>
115       <th class=button>&nbsp;</th>
116       @ifmanage{
117         <th class=imgbutton>&nbsp;</th>
118         <th class=imgbutton>&nbsp;</th>
119         <th class=imgbutton>&nbsp;</th>
120         <th class=imgbutton>&nbsp;</th>
121       }{}
122      </tr>
123      @if{@isplaying}{
124        <tr class=nowplaying>
125         <td colspan=@ifmanage{11}{7}>@label{playing.now}</td>
126        </tr>
127      }
128      @playing{
129        <tr class=playing>
130         <td class=when>@mwhen{playing}{@id}</td>
131         <td class=who>@mwho{playing}{@id}</td>
132         <td class=artist>@martist{playing}{@track}</td>
133         <td class=album>@malbum{playing}{@track}</td>
134         <td class=title>@mtitle{playing}{@track}</td>
135         <td class=length>@length{@id}</td>
136         <td class=imgbutton>@mremove{playing}{@id}</td>
137         @ifmanage{
138           <td class=imgbutton>&nbsp;</td>
139           <td class=imgbutton>&nbsp;</td>
140           <td class=imgbutton>&nbsp;</td>
141           <td class=imgbutton>&nbsp;</td>
142         }{}
143        </tr>
144      }
145      @if{@isqueue}{
146       <tr class=next>
147        <td colspan=@ifmanage{11}{7}>@label{playing.next}</td>
148       </tr>
149      }
150      @queue{
151       <tr class=@parity>
152        <td class=when>@mwhen{queue}{@id}</td>
153        <td class=who>@mwho{queue}{@id}</td>
154        <td class=artist>@martist{queue}{@track}</td>
155        <td class=album>@malbum{queue}{@track}</td>
156        <td class=title>@mtitle{queue}{@track}</td>
157        <td class=length>@length{@id}</td>
158        <td class=imgbutton>@mremove{queue}{@id}</td>
159        @ifmanage{
160          <td class=imgbutton>@mmove{@id}{upall}{2147483647}</td>
161          <td class=imgbutton>@mmove{@id}{up}{1}</td>
162          <td class=imgbutton>@mmove{@id}{down}{-1}</td>
163          <td class=imgbutton>@mmove{@id}{downall}{-2147483647}</td>
164        }{}
165       </tr>
166     }
167    </table>
168 }
169
170 @credits
171  </body>
172 </html>
173 @discard{
174 Local variables:
175 mode:sgml
176 sgml-always-quote-attributes:nil
177 sgml-indent-step:1
178 sgml-indent-data:t
179 indent-tabs-mode:nil
180 End:
181 }@#