chiark / gitweb /
extended @movable expansion; more template...
[disorder] / templates / macros.tmpl
CommitLineData
9faa7a88
RK
1@discard{
2
460b9539 3This file is part of DisOrder.
9faa7a88 4Copyright (C) 2004-2008 Richard Kettlewell
460b9539 5
6This program is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program; if not, write to the Free Software
18Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19USA
9faa7a88 20
a2c4ad5f
RK
21@# Expand to @yes for the Manage page and @no for the playing page
22@define {ifmanage} {yes no}
23 {@if {@eq {@arg{action}}{manage}}
24 {@yes}
25 {@no}}
9faa7a88 26
a2c4ad5f
RK
27@# Expand to &back=manage or to nothing
28@define {back} {}
29 {@ifmanage{&back=manage}{}}
30
31@# Expand to the time that @id will be played
32@define {mwhen} {what id}
33 {@when{@id}</td>}
34
35@# Expand to the 'who' field for @id
36@define {mwho} {what id}
37 {@if{@eq{@who{@id}}{}}
38 {@if{@eq{@state{@id}}{random}}
39 {@label{@what.randomtrack}}
40 {&nbsp;}}
41 {@who{@id}}}
42
43@# Expand to the artist for @track
44@define {martist} {what track}
45 {@right{play}
46 {<a class=directory
47 href="@url?action=choose&amp;directory=@urlquote{@dirname{@dirname{@track}}}"
48 title="@label{@what.artistverbose}">@part{@track}{short}{artist}</a>}
49 {<span class=directory
50 title="@part{@track}{artist}@">@part{@track}{short}{artist}</span>}}
51
52@# Expand to the album for @track
53@define {malbum} {what track}
54 {@right{play}
55 {<a class=directory
56 href="@url?action=choose&amp;directory=@urlquote{@dirname{@track}}"
57 title="@label{@what.albumverbose}">@part{@track}{short}{album}</a>}
58 {<span class=directory
59 title="@part{@track}{album}@">@part{@track}{short}{album}</span>}}
60
61@# Expand to the title for @track
62@define {mtitle} {what track}
63 {<span title="@part{@track}{title}">@part{@track}{short}{title}</span>}
64
65@# Expand to the remove/scratch entry for @id
66@define {mremove} {what id}
67 {@if{@removable{@id}}
68 {<a class=imgbutton
69 href="@url?action=remove&#38;id=@id@back">
70 <img class=button src="@image{remove}"
71 title="@label{@what.removeverbose}"
72 alt="@label{@what.scratch}">
73 </a>}
74 {<img class=button src="@image{noremove}"
75 title="@label{@what.removeverbose}"
76 alt="@label{@what.scratch}">}}
77
af106f2d
RK
78@# Expand to a move button
79@# @dir should be a direction: up, upall, down or downall
80@# @delta should be the distance, +ve for up and -ve for down
81@# This macro calls @movable to check that the move is possible.
82@define {mmove} {id dir delta}
83 {@if{@movable{@id}{@delta}}
84 {<a class=imgbutton
85 href="@url?action=move&#38;id=@id&#38;delta=@delta@back">
86 <img class=button src="@image{@dir}"
87 title="@label{playing.@q{@dir}verbose}"
88 alt="@label{playing.@dir}">
89 </a>}
90 {<img class=button src="@image{no@dir}"
91 title="@label{playing.@q{@dir}verbose}"
92 alt="@label{playing.@dir}">}}
a2c4ad5f 93}@#