1 This file is part of DisOrder.
2 Copyright (C) 2008, 2009, 2011 Richard Kettlewell
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 ------------------------------------------------------------------------
22 This file is read before any other template. Its output is discarded
23 but side effects (definitions of macros) are retained. To override it,
24 create /etc/disorder/macros.tmpl that includes this file by absolute path
25 and then redefine macros as desired.
26 ------------------------------------------------------------------------
29 @# Standard width and height of an image
30 @define {width} {} {16}
31 @define {height} {} {16}
33 @# Standard <head> text
34 @# @name is the name of this page, for the <title> element
35 @define {stdhead} {name}
37 <title>@label{@name.title}</title>}
39 @# Non-displaying <head> text
40 @define {quiethead} {}
41 { <link rel=stylesheet
43 href="@label{url.static}/disorder.css">}
46 @# @current is the name of the current page, e.g. choosealpha, login
47 @define {stdmenu} {current}
50 @menuitem{@current}{playing}{true}
51 @menuitem{@current}{recent}{true}
52 @menuitem{@current}{choose}{@right{play}}
53 @menuitem{@current}{manage}{true}
54 @menuitem{@current}{new}{true}
55 @menuitem{@current}{login}{true}
56 @menuitem{@current}{help}{true}
59 @menuicon{@current}{about}{true}{logosmall}
61 <div style="clear:both"></div>
65 @define {menuurl} {name}
66 {@if{@eq{name}{playing}}
72 @# @current is the name of the current page (not necessarily the action that
74 @# @name is the name of the menu item
75 @# @available is true if the menu item is available, else false
77 @define {menuitem} {current name available}
79 { <a @if{@eq{@current}{@name}}
82 href="@menuurl{@name}"
83 title="@label{menu.@q{@name}verbose}">@label{menu.@name}</a>}
84 { <span class=invalidmenu
85 title="@label{menu.@q{@name}verbose}">@label{menu.@name}</span>}}
87 @# Icon-based menu entry (very similar to @menuitem)
89 @# @current is the name of the current page
90 @# @name is the name of the menu item
91 @# @available is true if the menu item is available, else false
92 @# @icon is the name of the icon
94 @define {menuicon} {current name available icon}
97 href="@menuurl{@name}">
98 <img @if{@eq{@current}{@name}}
101 title="@label{menu.@q{@name}verbose}"
102 alt="@label{menu.@name}"
105 { <span class=menuicon>
106 <img @if{@eq{@current}{@name}}
109 title="@label{menu.@q{@name}verbose}"
110 alt="@label{menu.@name}"
111 src="@image{@icon@_inactive}">
114 @# Standard footer text
117 <a href="http://www.greenend.org.uk/rjk/disorder/"
118 title="DisOrder web site">DisOrder
120 © 2003-2011 Richard Kettlewell et al
123 @# Expand to the time that @id will be played
124 @# @what is the section
125 @# @id is the track ID
126 @define {mwhen} {what id}
129 @# Expand to the 'who' field for @id
130 @# @what is the section
131 @# @id is the track ID
132 @define {mwho} {what id}
133 {@if{@eq{@who{@id}}{}}
134 {@if{@eq{@state{@id}}{random}}
135 {@label{@what.randomtrack}}
139 @# Expand to the artist for @track
140 @# @what is the section
141 @# @track is the track name
142 @define {martist} {what track}
145 href="@url?action=choose&dir=@urlquote{@dirname{@dirname{@track}}}"
146 title="@label{playing.artistverbose}">@part{@track}{artist}{short}</a>}
147 {<span class=directory
148 title="@part{@track}{artist}">@part{@track}{artist}{short}</span>}}
150 @# Expand to the album for @track
151 @# @what is the section
152 @# @track is the track name
153 @define {malbum} {what track}
156 href="@url?action=choose&dir=@urlquote{@dirname{@track}}"
157 title="@label{playing.albumverbose}">@part{@track}{album}{short}</a>}
158 {<span class=directory
159 title="@part{@track}{album}">@part{@track}{album}{short}</span>}}
161 @# Expand to the title for @track
162 @# @what is the section
163 @# @track is the track name
164 @define {mtitle} {what track}
165 {<span title="@part{@track}{title}">@part{@track}{title}{short}</span>}
167 @# As @mtitle but make a link to play the track
168 @# @what is the section
169 @# @track is the track name
170 @define {mtitleplay} {what track}
171 {<a title="@part{@track}{title}" href="@url?action=play&track=@urlquote{@track}&back=@urlquote{@thisurl}">@part{@track}{title}{short}</a>}
173 @# Expand to the remove/scratch entry for @id
174 @# @what is the section
175 @# @id is the track ID
176 @define {mremove} {what id}
177 {@if{@removable{@id}}
179 href="@url?action=remove&id=@id@back">
180 <img class=button src="@image{remove}"
181 width=@width height=@height
182 title="@label{@what.removeverbose}"
183 alt="@label{@what.scratch}">
185 {<img class=button src="@image{noremove}"
186 width=@width height=@height
187 title="@label{@what.removeverbose}"
188 alt="@label{@what.scratch}">}}
190 @# Expand to a move button
191 @# @id is the track ID
192 @# @dir should be a direction: up, upall, down or downall
193 @# @delta should be the distance, +ve for up and -ve for down
194 @# This macro calls @movable to check that the move is possible.
195 @define {mmove} {id dir delta}
196 {@if{@movable{@id}{@delta}}
198 href="@url?action=move&id=@id&delta=@delta@back">
199 <img class=button src="@image{@dir}"
200 width=@width height=@height
201 title="@label{playing.@q{@dir}verbose}"
202 alt="@label{playing.@dir}">
204 {<img class=button src="@image{no@dir}"
205 width=@width height=@height
206 title="@label{playing.@q{@dir}verbose}"
207 alt="@label{playing.@dir}">}}
209 @# Size of input box for preferences forms
210 @define{prefsize}{}{40}
212 @# Expand to the weight of a track. This macro knows the default weight,
213 @# and does two lookups, which is rather inelegant.
214 @# @track is the track name.
215 @define{weight}{track}{@if{@eq{@pref{@track}{weight}}{}}
217 {@pref{@track}{weight}}}
219 @# Expand to preference form section for a track
220 @# @index is the track number
221 @# @track is the track name
222 @define {mprefs} {index track}
224 <p class="prefs_head">Preferences for <span class="prefs_track">@quote{@resolve{@track}}</span>:</p>
225 <input type=hidden name="@index@__track" value="@quote{@resolve{@track}}">
228 <th class="prefs_name">@label{prefs.name}</th>
229 <th class="prefs_value">@label{prefs.value}</th>
232 <td class="prefs_name">@label{heading.title}</td>
233 <td class="prefs_value">
234 <input size=@prefsize type=text name="@index@__title"
235 value="@part{@track}{title}{display}">
239 <td class="prefs_name">@label{heading.album}</td>
240 <td class="prefs_value">
241 <input size=@prefsize type=text name="@index@__album"
242 value="@part{@track}{album}{display}">
246 <td class="prefs_name">@label{heading.artist}</td>
247 <td class="prefs_value">
248 <input size=@prefsize type=text name="@index@__artist"
249 value="@part{@track}{artist}{display}">
253 <td class="prefs_name">@label{prefs.tags}</td>
254 <td class="prefs_value">
255 <input size=@prefsize type=text name="@index@__tags"
256 value="@pref{@track}{tags}">
260 <td class="prefs_name">@label{prefs.weight}</td>
261 <td class="prefs_value">
262 <input size=@prefsize type=text name="@index@__weight"
263 value="@weight{@track}">
267 <td class="prefs_name">@label{prefs.random}</td>
268 <td class="prefs_value">
269 <input type=checkbox value=true
270 name="@index@__random"
271 @if{@ne{@pref{@track}{pick_at_random}}{0}}
278 @# Expand to a submit button
279 @# @text is the text to put inside the button
280 @define {submit} {text}
281 {<button class=button name=submit type=submit>@text</button>}
283 @# Expand to an action button
284 @# @text is the text to put inside the button
285 @# @long is the text to put in the caption
286 @# @action is the target action
287 @define {actbutton} {text long action}
288 {<form method=POST class=button action="@url">
289 <input type=hidden name=action value="@action">
290 <input type=submit name=submit value="@text" title="@long">
294 @# Used for inserting back= elements
296 @define {formback} {} {}
300 sgml-always-quote-attributes:nil