chiark / gitweb /
More web appearance fiddling
[disorder] / templates / macros.tmpl
... / ...
CommitLineData
1This file is part of DisOrder.
2Copyright (C) 2008 Richard Kettlewell
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
18
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
31@# Standard width and height of an image
32@define {width} {} {16}
33@define {height} {} {16}
34
35@# Standard <head> text
36@# @name is the name of this page, for the <title> element
37@define {stdhead} {name}
38 {@quiethead
39<title>@label{@name.title}</title>}
40
41@# Non-displaying <head> text
42@define {quiethead} {}
43 { <link rel=stylesheet
44 type="text/css"
45 href="@label{url.static}/disorder.css">}
46
47@# Standard menu
48@# @current is the name of the current page, e.g. choosealpha, login
49@define {stdmenu} {current}
50 { <div class=top>
51 <p class=menubar>
52@menuitem{@current}{playing}{true}
53@menuitem{@current}{recent}{true}
54@menuitem{@current}{choose}{@right{play}}
55@menuitem{@current}{manage}{true}
56@menuitem{@current}{new}{true}
57@menuitem{@current}{login}{true}
58@menuitem{@current}{help}{true}
59@menuitem{@current}{about}{true}
60 </p>
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>
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}
82 { <a @if{@eq{@current}{@name}}
83 {class=activemenu}
84 {class=inactivemenu}
85@if{@eq{name}{playing}}
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>}}
91
92
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>}
101
102@# Expand to the time that @id will be played
103@# @what is the section
104@# @id is the track ID
105@define {mwhen} {what id}
106 {@when{@id}</td>}
107
108@# Expand to the 'who' field for @id
109@# @what is the section
110@# @id is the track ID
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
119@# @what is the section
120@# @track is the track name
121@define {martist} {what track}
122 {@right{play}
123 {<a class=directory
124 href="@url?action=choose&amp;dir=@urlquote{@dirname{@dirname{@track}}}"
125 title="@label{playing.artistverbose}">@part{@track}{artist}{short}</a>}
126 {<span class=directory
127 title="@part{@track}{artist}">@part{@track}{artist}{short}</span>}}
128
129@# Expand to the album for @track
130@# @what is the section
131@# @track is the track name
132@define {malbum} {what track}
133 {@right{play}
134 {<a class=directory
135 href="@url?action=choose&amp;dir=@urlquote{@dirname{@track}}"
136 title="@label{playing.albumverbose}">@part{@track}{album}{short}</a>}
137 {<span class=directory
138 title="@part{@track}{album}">@part{@track}{album}{short}</span>}}
139
140@# Expand to the title for @track
141@# @what is the section
142@# @track is the track name
143@define {mtitle} {what track}
144 {<span title="@part{@track}{title}">@part{@track}{title}{short}</span>}
145
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}
150 {<a title="@part{@track}{title}" href="@url?action=play&#38;track=@urlquote{@track}&#38;back=@urlquote{@thisurl}">@part{@track}{title}{short}</a>}
151
152@# Expand to the remove/scratch entry for @id
153@# @what is the section
154@# @id is the track ID
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}"
160 width=@width height=@height
161 title="@label{@what.removeverbose}"
162 alt="@label{@what.scratch}">
163 </a>}
164 {<img class=button src="@image{noremove}"
165 width=@width height=@height
166 title="@label{@what.removeverbose}"
167 alt="@label{@what.scratch}">}}
168
169@# Expand to a move button
170@# @id is the track ID
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}"
179 width=@width height=@height
180 title="@label{playing.@q{@dir}verbose}"
181 alt="@label{playing.@dir}">
182 </a>}
183 {<img class=button src="@image{no@dir}"
184 width=@width height=@height
185 title="@label{playing.@q{@dir}verbose}"
186 alt="@label{playing.@dir}">}}
187
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
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: