chiark / gitweb /
More web appearance fiddling
[disorder] / templates / macros.tmpl
CommitLineData
460b9539 1This file is part of DisOrder.
1a3dba67 2Copyright (C) 2008 Richard Kettlewell
460b9539 3
4This program is free software; you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation; either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful, but
10WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program; if not, write to the Free Software
16Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
17USA
9faa7a88 18
0d0253c9
RK
19
20------------------------------------------------------------------------
21Standard macros
22
23
24This file is read before any other template. Its output is discarded
25but side effects (definitions of macros) are retained. To override it,
26create /etc/disorder/macros.tmpl that includes this file by absolute path
27and then redefines macros as desired.
28------------------------------------------------------------------------
29
30
1a3dba67
RK
31@# Standard width and height of an image
32@define {width} {} {16}
33@define {height} {} {16}
34
0d0253c9
RK
35@# Standard <head> text
36@# @name is the name of this page, for the <title> element
37@define {stdhead} {name}
38 {@quiethead
0d0253c9
RK
39<title>@label{@name.title}</title>}
40
41@# Non-displaying <head> text
42@define {quiethead} {}
99955407
RK
43 { <link rel=stylesheet
44 type="text/css"
45 href="@label{url.static}/disorder.css">}
0d0253c9
RK
46
47@# Standard menu
48@# @current is the name of the current page, e.g. choosealpha, login
49@define {stdmenu} {current}
5d30e04b
RK
50 { <div class=top>
51 <p class=menubar>
0d0253c9 52@menuitem{@current}{playing}{true}
99955407 53@menuitem{@current}{recent}{true}
0d0253c9 54@menuitem{@current}{choose}{@right{play}}
0d0253c9 55@menuitem{@current}{manage}{true}
be968860 56@menuitem{@current}{new}{true}
0d0253c9
RK
57@menuitem{@current}{login}{true}
58@menuitem{@current}{help}{true}
59@menuitem{@current}{about}{true}
99955407 60 </p>
5d30e04b
RK
61 <div class=logo>
62 <a href="http://www.greenend.org.uk/rjk/disorder/">
63 <img src="@image{logosmall}"
64 style="border-style:none"
65 alt="DisOrder"
66 title="Quack quack! Visit the DisOrder website">
67 </a>
68 </div>
69 <div style="clear:both"></div>
70 </div>
0d0253c9
RK
71}
72
73@# Menu entry
74@# Used by @stdmenu
75@# @current is the name of the current page (not necessarily the action that
76@# got there!)
77@# @name is the name of the menu item
78@# @available is true if the menu item is available, else false
79@#
80@define {menuitem} {current name available}
81 {@if{@available}
5d30e04b
RK
82 { <a @if{@eq{@current}{@name}}
83 {class=activemenu}
84 {class=inactivemenu}
99955407 85@if{@eq{name}{playing}}
5d30e04b
RK
86 { href="@url"}
87 { href="@url?action=@name"}
88 title="@label{menu.@q{@name}verbose}">@label{menu.@name}</a>}
89 { <span class=invalidmenu
90 title="@label{menu.@q{@name}verbose}">@label{menu.@name}</span>}}
0d0253c9 91
9faa7a88 92
0d0253c9
RK
93@# Standard footer text
94@define {credits} {}
95 {<p class=credits>
96 <a href="http://www.greenend.org.uk/rjk/disorder/"
97 title="DisOrder web site">DisOrder
98 version @version</a>
99 &copy; 2003-2008 Richard Kettlewell et al
100</p>}
a2c4ad5f
RK
101
102@# Expand to the time that @id will be played
1a3dba67
RK
103@# @what is the section
104@# @id is the track ID
a2c4ad5f
RK
105@define {mwhen} {what id}
106 {@when{@id}</td>}
107
108@# Expand to the 'who' field for @id
1a3dba67
RK
109@# @what is the section
110@# @id is the track ID
a2c4ad5f
RK
111@define {mwho} {what id}
112 {@if{@eq{@who{@id}}{}}
113 {@if{@eq{@state{@id}}{random}}
114 {@label{@what.randomtrack}}
115 {&nbsp;}}
116 {@who{@id}}}
117
118@# Expand to the artist for @track
1a3dba67
RK
119@# @what is the section
120@# @track is the track name
a2c4ad5f
RK
121@define {martist} {what track}
122 {@right{play}
123 {<a class=directory
e7ce7665
RK
124 href="@url?action=choose&amp;dir=@urlquote{@dirname{@dirname{@track}}}"
125 title="@label{playing.artistverbose}">@part{@track}{artist}{short}</a>}
a2c4ad5f 126 {<span class=directory
99955407 127 title="@part{@track}{artist}">@part{@track}{artist}{short}</span>}}
a2c4ad5f
RK
128
129@# Expand to the album for @track
1a3dba67
RK
130@# @what is the section
131@# @track is the track name
a2c4ad5f
RK
132@define {malbum} {what track}
133 {@right{play}
134 {<a class=directory
e7ce7665
RK
135 href="@url?action=choose&amp;dir=@urlquote{@dirname{@track}}"
136 title="@label{playing.albumverbose}">@part{@track}{album}{short}</a>}
a2c4ad5f 137 {<span class=directory
99955407 138 title="@part{@track}{album}">@part{@track}{album}{short}</span>}}
a2c4ad5f
RK
139
140@# Expand to the title for @track
1a3dba67
RK
141@# @what is the section
142@# @track is the track name
a2c4ad5f 143@define {mtitle} {what track}
99955407 144 {<span title="@part{@track}{title}">@part{@track}{title}{short}</span>}
a2c4ad5f 145
e7ce7665
RK
146@# As @mtitle but make a link to play the track
147@# @what is the section
148@# @track is the track name
149@define {mtitleplay} {what track}
02eaa49d 150 {<a title="@part{@track}{title}" href="@url?action=play&#38;track=@urlquote{@track}&#38;back=@urlquote{@thisurl}">@part{@track}{title}{short}</a>}
e7ce7665 151
a2c4ad5f 152@# Expand to the remove/scratch entry for @id
1a3dba67
RK
153@# @what is the section
154@# @id is the track ID
a2c4ad5f
RK
155@define {mremove} {what id}
156 {@if{@removable{@id}}
157 {<a class=imgbutton
158 href="@url?action=remove&#38;id=@id@back">
159 <img class=button src="@image{remove}"
30d85588 160 width=@width height=@height
a2c4ad5f
RK
161 title="@label{@what.removeverbose}"
162 alt="@label{@what.scratch}">
163 </a>}
164 {<img class=button src="@image{noremove}"
30d85588 165 width=@width height=@height
a2c4ad5f
RK
166 title="@label{@what.removeverbose}"
167 alt="@label{@what.scratch}">}}
168
af106f2d 169@# Expand to a move button
1a3dba67 170@# @id is the track ID
af106f2d
RK
171@# @dir should be a direction: up, upall, down or downall
172@# @delta should be the distance, +ve for up and -ve for down
173@# This macro calls @movable to check that the move is possible.
174@define {mmove} {id dir delta}
175 {@if{@movable{@id}{@delta}}
176 {<a class=imgbutton
177 href="@url?action=move&#38;id=@id&#38;delta=@delta@back">
178 <img class=button src="@image{@dir}"
30d85588 179 width=@width height=@height
af106f2d
RK
180 title="@label{playing.@q{@dir}verbose}"
181 alt="@label{playing.@dir}">
182 </a>}
183 {<img class=button src="@image{no@dir}"
30d85588
RK
184 width=@width height=@height
185 title="@label{playing.@q{@dir}verbose}"
186 alt="@label{playing.@dir}">}}
5fb0c1a0 187
02eaa49d
RK
188@# Size of input box for preferences forms
189@define{prefsize}{}{40}
190
191@# Expand to the weight of a track. This macro knows the default weight,
192@# and does two lookups, which is rather inelegant.
193@# @track is the track name.
194@define{weight}{track}{@if{@eq{@pref{@track}{weight}}{}}
195 {90000}
196 {@pref{@track}{weight}}}
197
198@# Expand to preference form section for a track
199@# @index is the track number
200@# @track is the track name
201@define {mprefs} {index track}
202 {
203 <p class="prefs_head">Preferences for <span class="prefs_track">@quote{@resolve{@track}}</span>:</p>
204 <input type=hidden name="@index@__track" value="@quote{@resolve{@track}}">
205 <table class=prefs>
206 <tr class=headings>
207 <th class="prefs_name">@label{prefs.name}</th>
208 <th class="prefs_value">@label{prefs.value}</th>
209 </tr>
210 <tr class=even>
211 <td class="prefs_name">@label{heading.title}</td>
212 <td class="prefs_value">
213 <input size=@prefsize type=text name="@index@__title"
214 value="@part{@track}{title}{display}">
215 </td>
216 </tr>
217 <tr class=odd>
218 <td class="prefs_name">@label{heading.album}</td>
219 <td class="prefs_value">
220 <input size=@prefsize type=text name="@index@__album"
221 value="@part{@track}{album}{display}">
222 </td>
223 </tr>
224 <tr class=even>
225 <td class="prefs_name">@label{heading.artist}</td>
226 <td class="prefs_value">
227 <input size=@prefsize type=text name="@index@__artist"
228 value="@part{@track}{artist}{display}">
229 </td>
230 </tr>
231 <tr class=odd>
232 <td class="prefs_name">@label{prefs.tags}</td>
233 <td class="prefs_value">
234 <input size=@prefsize type=text name="@index@__tags"
235 value="@pref{@track}{tags}">
236 </td>
237 </tr>
238 <tr class=even>
239 <td class="prefs_name">@label{prefs.weight}</td>
240 <td class="prefs_value">
241 <input size=@prefsize type=text name="@index@__weight"
242 value="@weight{@track}">
243 </td>
244 </tr>
245 <tr class=odd>
246 <td class="prefs_name">@label{prefs.random}</td>
247 <td class="prefs_value">
248 <input type=checkbox value=true
249 name="@index@__random"
250 @if{@ne{@pref{@track}{pick_at_random}}{0}}
251 {checked}>
252 </td>
253 </tr>
254 </table>
255}
256
5fb0c1a0
RK
257Local variables:
258mode:sgml
259sgml-always-quote-attributes:nil
260sgml-indent-step:1
261sgml-indent-data:t
262indent-tabs-mode:nil
263fill-column:79
264End: