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