chiark / gitweb /
Macro-ize (most) <A>-based buttons
[disorder] / templates / playing.tmpl
CommitLineData
460b9539 1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
2<!--
3This file is part of DisOrder.
8f9616f1 4Copyright (C) 2004-2008 Richard Kettlewell
460b9539 5
6This program is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program; if not, write to the Free Software
18Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19USA
20-->
2257512d 21@discard{
1a3dba67
RK
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}
3b95af9c
RK
28 {@actbutton{@label{playing.@class}}
29 {@label{playing.@q{@action}verbose}}
30 {@action}
1a3dba67
RK
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}"
30d85588 42 width=@width height=@height
1a3dba67
RK
43 alt="@label{volume.@dir}"
44 title="@label{volume.@q{@dir}verbose}">
45 </a>}
30d85588
RK
46 {<img class=button width=@width height=@height
47 src="@image{no@dir}">}}
1a3dba67 48
0d0253c9
RK
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}{}}
2257512d 58}@#
460b9539 59<html>
60 <head>
0d0253c9 61@quiethead
04024c2c 62 <title>@if{@isplaying}
2257512d
RK
63 {@playing{@part{@id}{title}}}
64 {@label{playing.title}}</title>
460b9539 65 </head>
66 <body>
0d0253c9 67@stdmenu{@ifmanage{manage}{playing}}
04024c2c 68 <h1>@label{playing.title}</h1>
460b9539 69
04024c2c 70@# Extra control buttons for the management page
2257512d 71 @ifmanage{
328248ba 72 <div class=mgmt>
1a3dba67
RK
73 <p class=mgmt>
74 @if{@paused}
d77d85a6
RK
75 {@onoff{pause}{resume}{enabled}}
76 {@onoff{pause}{pause}{disabled}}
1a3dba67
RK
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}">
858805c3 93 <input name=back type=hidden value="@quote{@thisurl}">
1a3dba67 94 @right{volume}{
8b15f02d 95 @submit{@label{volume.set}}
1a3dba67
RK
96 <input name=action type=hidden value=volume>
97 }
98 @vbutton{down}{-}
99 </span>
100 </form>
101 </p>
328248ba 102 </div>
2257512d 103 }{}
460b9539 104
04024c2c
RK
105@# Only display the table if there is something to put in it
106@if{@or{@isplaying}{@isqueue}}{
460b9539 107 <table class=playing>
108 <tr class=headings>
04024c2c
RK
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>
460b9539 115 <th class=button>&nbsp;</th>
2257512d 116 @ifmanage{
1a3dba67
RK
117 <th class=imgbutton>&nbsp;</th>
118 <th class=imgbutton>&nbsp;</th>
119 <th class=imgbutton>&nbsp;</th>
120 <th class=imgbutton>&nbsp;</th>
2257512d 121 }{}
460b9539 122 </tr>
af106f2d
RK
123 @if{@isplaying}{
124 <tr class=nowplaying>
1a3dba67 125 <td colspan=@ifmanage{11}{7}>@label{playing.now}</td>
af106f2d
RK
126 </tr>
127 }
2257512d 128 @playing{
af106f2d 129 <tr class=playing>
1a3dba67
RK
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 }{}
af106f2d 143 </tr>
2257512d 144 }
99955407
RK
145 @if{@isqueue}{
146 <tr class=next>
147 <td colspan=@ifmanage{11}{7}>@label{playing.next}</td>
148 </tr>
2257512d 149 }
460b9539 150 @queue{
99955407
RK
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 }
460b9539 167 </table>
2257512d 168}
460b9539 169
0d0253c9 170@credits
460b9539 171 </body>
172</html>
2257512d 173@discard{
460b9539 174Local variables:
175mode:sgml
176sgml-always-quote-attributes:nil
177sgml-indent-step:1
178sgml-indent-data:t
0d0253c9 179indent-tabs-mode:nil
460b9539 180End:
0d0253c9 181}@#