chiark / gitweb /
Build fixes for GCC 4.1
[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
d8b8f26c 27and then redefine macros as desired.
0d0253c9
RK
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}
99955407 59 </p>
5d30e04b 60 <div class=logo>
153115c0 61@menuicon{@current}{about}{true}{logosmall}
5d30e04b
RK
62 </div>
63 <div style="clear:both"></div>
64 </div>
0d0253c9
RK
65}
66
153115c0
RK
67@define {menuurl} {name}
68 {@if{@eq{name}{playing}}
69 {@url}
70 {@url?action=@name}}
71
0d0253c9
RK
72@# Menu entry
73@# Used by @stdmenu
74@# @current is the name of the current page (not necessarily the action that
75@# got there!)
76@# @name is the name of the menu item
77@# @available is true if the menu item is available, else false
78@#
79@define {menuitem} {current name available}
80 {@if{@available}
5d30e04b
RK
81 { <a @if{@eq{@current}{@name}}
82 {class=activemenu}
83 {class=inactivemenu}
153115c0 84 href="@menuurl{@name}"
5d30e04b
RK
85 title="@label{menu.@q{@name}verbose}">@label{menu.@name}</a>}
86 { <span class=invalidmenu
87 title="@label{menu.@q{@name}verbose}">@label{menu.@name}</span>}}
0d0253c9 88
153115c0
RK
89@# Icon-based menu entry (very similar to @menuitem)
90@# Used by @stdmenu
91@# @current is the name of the current page
92@# @name is the name of the menu item
93@# @available is true if the menu item is available, else false
94@# @icon is the name of the icon
95@#
96@define {menuicon} {current name available icon}
97 {@if{@available}
98 { <a class=menuicon
99 href="@menuurl{@name}">
100 <img @if{@eq{@current}{@name}}
101 {class=activemenu}
102 {class=inactivemenu}
103 title="@label{menu.@q{@name}verbose}"
104 alt="@label{menu.@name}"
105 src="@image{@icon}">
106 </a>}
107 { <span class=menuicon>
108 <img @if{@eq{@current}{@name}}
109 {class=activemenu}
110 {class=inactivemenu}
111 title="@label{menu.@q{@name}verbose}"
112 alt="@label{menu.@name}"
113 src="@image{@icon@_inactive}">
114 </a>}}
9faa7a88 115
0d0253c9
RK
116@# Standard footer text
117@define {credits} {}
118 {<p class=credits>
119 <a href="http://www.greenend.org.uk/rjk/disorder/"
120 title="DisOrder web site">DisOrder
121 version @version</a>
122 &copy; 2003-2008 Richard Kettlewell et al
123</p>}
a2c4ad5f
RK
124
125@# Expand to the time that @id will be played
1a3dba67
RK
126@# @what is the section
127@# @id is the track ID
a2c4ad5f
RK
128@define {mwhen} {what id}
129 {@when{@id}</td>}
130
131@# Expand to the 'who' field for @id
1a3dba67
RK
132@# @what is the section
133@# @id is the track ID
a2c4ad5f
RK
134@define {mwho} {what id}
135 {@if{@eq{@who{@id}}{}}
136 {@if{@eq{@state{@id}}{random}}
137 {@label{@what.randomtrack}}
138 {&nbsp;}}
139 {@who{@id}}}
140
141@# Expand to the artist for @track
1a3dba67
RK
142@# @what is the section
143@# @track is the track name
a2c4ad5f
RK
144@define {martist} {what track}
145 {@right{play}
146 {<a class=directory
e7ce7665
RK
147 href="@url?action=choose&amp;dir=@urlquote{@dirname{@dirname{@track}}}"
148 title="@label{playing.artistverbose}">@part{@track}{artist}{short}</a>}
a2c4ad5f 149 {<span class=directory
99955407 150 title="@part{@track}{artist}">@part{@track}{artist}{short}</span>}}
a2c4ad5f
RK
151
152@# Expand to the album for @track
1a3dba67
RK
153@# @what is the section
154@# @track is the track name
a2c4ad5f
RK
155@define {malbum} {what track}
156 {@right{play}
157 {<a class=directory
e7ce7665
RK
158 href="@url?action=choose&amp;dir=@urlquote{@dirname{@track}}"
159 title="@label{playing.albumverbose}">@part{@track}{album}{short}</a>}
a2c4ad5f 160 {<span class=directory
99955407 161 title="@part{@track}{album}">@part{@track}{album}{short}</span>}}
a2c4ad5f
RK
162
163@# Expand to the title for @track
1a3dba67
RK
164@# @what is the section
165@# @track is the track name
a2c4ad5f 166@define {mtitle} {what track}
99955407 167 {<span title="@part{@track}{title}">@part{@track}{title}{short}</span>}
a2c4ad5f 168
e7ce7665
RK
169@# As @mtitle but make a link to play the track
170@# @what is the section
171@# @track is the track name
172@define {mtitleplay} {what track}
02eaa49d 173 {<a title="@part{@track}{title}" href="@url?action=play&#38;track=@urlquote{@track}&#38;back=@urlquote{@thisurl}">@part{@track}{title}{short}</a>}
e7ce7665 174
a2c4ad5f 175@# Expand to the remove/scratch entry for @id
1a3dba67
RK
176@# @what is the section
177@# @id is the track ID
a2c4ad5f
RK
178@define {mremove} {what id}
179 {@if{@removable{@id}}
180 {<a class=imgbutton
181 href="@url?action=remove&#38;id=@id@back">
182 <img class=button src="@image{remove}"
30d85588 183 width=@width height=@height
a2c4ad5f
RK
184 title="@label{@what.removeverbose}"
185 alt="@label{@what.scratch}">
186 </a>}
187 {<img class=button src="@image{noremove}"
30d85588 188 width=@width height=@height
a2c4ad5f
RK
189 title="@label{@what.removeverbose}"
190 alt="@label{@what.scratch}">}}
191
af106f2d 192@# Expand to a move button
1a3dba67 193@# @id is the track ID
af106f2d
RK
194@# @dir should be a direction: up, upall, down or downall
195@# @delta should be the distance, +ve for up and -ve for down
196@# This macro calls @movable to check that the move is possible.
197@define {mmove} {id dir delta}
198 {@if{@movable{@id}{@delta}}
199 {<a class=imgbutton
200 href="@url?action=move&#38;id=@id&#38;delta=@delta@back">
201 <img class=button src="@image{@dir}"
30d85588 202 width=@width height=@height
af106f2d
RK
203 title="@label{playing.@q{@dir}verbose}"
204 alt="@label{playing.@dir}">
205 </a>}
206 {<img class=button src="@image{no@dir}"
30d85588
RK
207 width=@width height=@height
208 title="@label{playing.@q{@dir}verbose}"
209 alt="@label{playing.@dir}">}}
5fb0c1a0 210
02eaa49d
RK
211@# Size of input box for preferences forms
212@define{prefsize}{}{40}
213
214@# Expand to the weight of a track. This macro knows the default weight,
215@# and does two lookups, which is rather inelegant.
216@# @track is the track name.
217@define{weight}{track}{@if{@eq{@pref{@track}{weight}}{}}
218 {90000}
219 {@pref{@track}{weight}}}
220
221@# Expand to preference form section for a track
222@# @index is the track number
223@# @track is the track name
224@define {mprefs} {index track}
225 {
226 <p class="prefs_head">Preferences for <span class="prefs_track">@quote{@resolve{@track}}</span>:</p>
227 <input type=hidden name="@index@__track" value="@quote{@resolve{@track}}">
228 <table class=prefs>
229 <tr class=headings>
230 <th class="prefs_name">@label{prefs.name}</th>
231 <th class="prefs_value">@label{prefs.value}</th>
232 </tr>
233 <tr class=even>
234 <td class="prefs_name">@label{heading.title}</td>
235 <td class="prefs_value">
236 <input size=@prefsize type=text name="@index@__title"
237 value="@part{@track}{title}{display}">
238 </td>
239 </tr>
240 <tr class=odd>
241 <td class="prefs_name">@label{heading.album}</td>
242 <td class="prefs_value">
243 <input size=@prefsize type=text name="@index@__album"
244 value="@part{@track}{album}{display}">
245 </td>
246 </tr>
247 <tr class=even>
248 <td class="prefs_name">@label{heading.artist}</td>
249 <td class="prefs_value">
250 <input size=@prefsize type=text name="@index@__artist"
251 value="@part{@track}{artist}{display}">
252 </td>
253 </tr>
254 <tr class=odd>
255 <td class="prefs_name">@label{prefs.tags}</td>
256 <td class="prefs_value">
257 <input size=@prefsize type=text name="@index@__tags"
258 value="@pref{@track}{tags}">
259 </td>
260 </tr>
261 <tr class=even>
262 <td class="prefs_name">@label{prefs.weight}</td>
263 <td class="prefs_value">
264 <input size=@prefsize type=text name="@index@__weight"
265 value="@weight{@track}">
266 </td>
267 </tr>
268 <tr class=odd>
269 <td class="prefs_name">@label{prefs.random}</td>
270 <td class="prefs_value">
271 <input type=checkbox value=true
272 name="@index@__random"
273 @if{@ne{@pref{@track}{pick_at_random}}{0}}
274 {checked}>
275 </td>
276 </tr>
277 </table>
278}
279
8b15f02d
RK
280@# Expand to a submit button
281@# @text is the text to put inside the button
282@define {submit} {text}
57f55a15 283 {<button class=button name=submit type=submit>@text</button>}
8b15f02d 284
3b95af9c
RK
285@# Expand to an action button
286@# @text is the text to put inside the button
287@# @long is the text to put in the caption
288@# @action is the target action
289@define {actbutton} {text long action}
d8b8f26c 290 {<form method=POST class=button action="@url">
cf4ae3d5
RK
291 <input type=hidden name=action value="@action">
292 <input type=submit name=submit value="@text" title="@long">
293@formback@#
294 </form>}
3b95af9c 295
cf4ae3d5 296@# Used for inserting back= elements
3b95af9c 297@define {back} {} {}
cf4ae3d5 298@define {formback} {} {}
3b95af9c 299
5fb0c1a0
RK
300Local variables:
301mode:sgml
302sgml-always-quote-attributes:nil
303sgml-indent-step:1
304sgml-indent-data:t
305indent-tabs-mode:nil
306fill-column:79
307End: