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