chiark / gitweb /
Bias up recently added tracks. See new_bias and new_bias_age in
[disorder] / templates / macros.tmpl
1 This file is part of DisOrder.
2 Copyright (C) 2008 Richard Kettlewell
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
18
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
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         {  <p class=menubar>
51 @menuitem{@current}{playing}{true}
52 @menuitem{@current}{recent}{true}
53 @menuitem{@current}{choose}{@right{play}}
54 @menuitem{@current}{manage}{true}
55 @menuitem{@current}{new}{true}
56 @menuitem{@current}{login}{true}
57 @menuitem{@current}{help}{true}
58 @menuitem{@current}{about}{true}
59    </p>
60    <hr>
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}
72             {   <a @if{@eq{@current}{@name}}
73                       {class=activemenu}
74                       {class=inactivemenu}
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>}}
81
82
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   &copy; 2003-2008 Richard Kettlewell et al
90 </p>}
91
92 @# Expand to the time that @id will be played
93 @#  @what is the section
94 @#  @id is the track ID
95 @define {mwhen} {what id}
96         {@when{@id}</td>}
97
98 @# Expand to the 'who' field for @id
99 @#  @what is the section
100 @#  @id is the track ID
101 @define {mwho} {what id}
102         {@if{@eq{@who{@id}}{}}
103             {@if{@eq{@state{@id}}{random}}
104                 {@label{@what.randomtrack}}
105                  {&nbsp;}}
106             {@who{@id}}}
107
108 @# Expand to the artist for @track
109 @#  @what is the section
110 @#  @track is the track name
111 @define {martist} {what track}
112         {@right{play}
113                {<a class=directory
114                    href="@url?action=choose&amp;dir=@urlquote{@dirname{@dirname{@track}}}"
115                    title="@label{playing.artistverbose}">@part{@track}{artist}{short}</a>}
116                {<span class=directory
117                       title="@part{@track}{artist}">@part{@track}{artist}{short}</span>}}
118
119 @# Expand to the album for @track
120 @#  @what is the section
121 @#  @track is the track name
122 @define {malbum} {what track}
123         {@right{play}
124                {<a class=directory
125                    href="@url?action=choose&amp;dir=@urlquote{@dirname{@track}}"
126                    title="@label{playing.albumverbose}">@part{@track}{album}{short}</a>}
127                {<span class=directory
128                       title="@part{@track}{album}">@part{@track}{album}{short}</span>}}
129
130 @# Expand to the title for @track
131 @#  @what is the section
132 @#  @track is the track name
133 @define {mtitle} {what track}
134         {<span title="@part{@track}{title}">@part{@track}{title}{short}</span>}
135
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}
140         {<a title="@part{@track}{title}" href="@url?action=play&#38;track=@urlquote{@track}&#38;back=@urlquote{@thisurl}">@part{@track}{title}{short}</a>}
141
142 @# Expand to the remove/scratch entry for @id
143 @#  @what is the section
144 @#  @id is the track ID
145 @define {mremove} {what id}
146         {@if{@removable{@id}}
147             {<a class=imgbutton
148                 href="@url?action=remove&#38;id=@id@back">
149                <img class=button src="@image{remove}"
150                     width=@width height=@height
151                     title="@label{@what.removeverbose}"
152                     alt="@label{@what.scratch}">
153              </a>}
154             {<img class=button src="@image{noremove}"
155                   width=@width height=@height
156                   title="@label{@what.removeverbose}"
157                   alt="@label{@what.scratch}">}}
158
159 @# Expand to a move button
160 @#  @id is the track ID
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&#38;id=@id&#38;delta=@delta@back">
168                <img class=button src="@image{@dir}"
169                     width=@width height=@height
170                     title="@label{playing.@q{@dir}verbose}"
171                     alt="@label{playing.@dir}">
172              </a>}
173             {<img class=button src="@image{no@dir}"
174                   width=@width height=@height
175                   title="@label{playing.@q{@dir}verbose}"
176                   alt="@label{playing.@dir}">}}
177
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
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: