chiark / gitweb /
exp_search, fold search into choose, not really finished
[disorder] / templates / macros.tmpl
CommitLineData
460b9539 1This file is part of DisOrder.
1a3dba67 2Copyright (C) 2008 Richard Kettlewell
460b9539 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
9faa7a88 18
0d0253c9
RK
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
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
39<link rel=stylesheet
40 type="text/css"
41 href="@label{url.static}/disorder.css">
42<title>@label{@name.title}</title>}
43
44@# Non-displaying <head> text
45@define {quiethead} {}
46 {<link rel=stylesheet
47 type="text/css"
48 href="@label{url.static}/disorder.css">}
49
50@# Standard menu
51@# @current is the name of the current page, e.g. choosealpha, login
52@define {stdmenu} {current}
53 {<p class=menubar>
54@menuitem{@current}{playing}{true}
55@menuitem{@current}{choose}{@right{play}}
0d0253c9
RK
56@menuitem{@current}{manage}{true}
57@menuitem{@current}{login}{true}
58@menuitem{@current}{help}{true}
59@menuitem{@current}{about}{true}
60</p>
61<hr>
62}
63
64@# Menu entry
65@# Used by @stdmenu
66@# @current is the name of the current page (not necessarily the action that
67@# got there!)
68@# @name is the name of the menu item
69@# @available is true if the menu item is available, else false
70@#
71@define {menuitem} {current name available}
72 {@if{@available}
73 { <a @if{@eq{@current}{@name}}
74 {class=activemenu}
75 {class=inactivemenu}
76 @if{@eq{name}{playing}}
77 {href="@url"}
78 {href="@url?action=@name"}
79 title="@label{menu.@q{@name}verbose}"
80 @label{menu.@name}</a>}
81 { <span class=invaldmenu title="@label{menu.@q{@name}verbose}">
82 @label{menu.@name}</span>}}
83
9faa7a88 84
0d0253c9
RK
85@# Standard footer text
86@define {credits} {}
87 {<p class=credits>
88 <a href="http://www.greenend.org.uk/rjk/disorder/"
89 title="DisOrder web site">DisOrder
90 version @version</a>
91 &copy; 2003-2008 Richard Kettlewell et al
92</p>}
a2c4ad5f
RK
93
94@# Expand to the time that @id will be played
1a3dba67
RK
95@# @what is the section
96@# @id is the track ID
a2c4ad5f
RK
97@define {mwhen} {what id}
98 {@when{@id}</td>}
99
100@# Expand to the 'who' field for @id
1a3dba67
RK
101@# @what is the section
102@# @id is the track ID
a2c4ad5f
RK
103@define {mwho} {what id}
104 {@if{@eq{@who{@id}}{}}
105 {@if{@eq{@state{@id}}{random}}
106 {@label{@what.randomtrack}}
107 {&nbsp;}}
108 {@who{@id}}}
109
110@# Expand to the artist for @track
1a3dba67
RK
111@# @what is the section
112@# @track is the track name
a2c4ad5f
RK
113@define {martist} {what track}
114 {@right{play}
115 {<a class=directory
116 href="@url?action=choose&amp;directory=@urlquote{@dirname{@dirname{@track}}}"
117 title="@label{@what.artistverbose}">@part{@track}{short}{artist}</a>}
118 {<span class=directory
119 title="@part{@track}{artist}@">@part{@track}{short}{artist}</span>}}
120
121@# Expand to the album for @track
1a3dba67
RK
122@# @what is the section
123@# @track is the track name
a2c4ad5f
RK
124@define {malbum} {what track}
125 {@right{play}
126 {<a class=directory
127 href="@url?action=choose&amp;directory=@urlquote{@dirname{@track}}"
128 title="@label{@what.albumverbose}">@part{@track}{short}{album}</a>}
129 {<span class=directory
130 title="@part{@track}{album}@">@part{@track}{short}{album}</span>}}
131
132@# Expand to the title for @track
1a3dba67
RK
133@# @what is the section
134@# @track is the track name
a2c4ad5f
RK
135@define {mtitle} {what track}
136 {<span title="@part{@track}{title}">@part{@track}{short}{title}</span>}
137
138@# Expand to the remove/scratch entry for @id
1a3dba67
RK
139@# @what is the section
140@# @id is the track ID
a2c4ad5f
RK
141@define {mremove} {what id}
142 {@if{@removable{@id}}
143 {<a class=imgbutton
144 href="@url?action=remove&#38;id=@id@back">
145 <img class=button src="@image{remove}"
30d85588 146 width=@width height=@height
a2c4ad5f
RK
147 title="@label{@what.removeverbose}"
148 alt="@label{@what.scratch}">
149 </a>}
150 {<img class=button src="@image{noremove}"
30d85588 151 width=@width height=@height
a2c4ad5f
RK
152 title="@label{@what.removeverbose}"
153 alt="@label{@what.scratch}">}}
154
af106f2d 155@# Expand to a move button
1a3dba67 156@# @id is the track ID
af106f2d
RK
157@# @dir should be a direction: up, upall, down or downall
158@# @delta should be the distance, +ve for up and -ve for down
159@# This macro calls @movable to check that the move is possible.
160@define {mmove} {id dir delta}
161 {@if{@movable{@id}{@delta}}
162 {<a class=imgbutton
163 href="@url?action=move&#38;id=@id&#38;delta=@delta@back">
164 <img class=button src="@image{@dir}"
30d85588 165 width=@width height=@height
af106f2d
RK
166 title="@label{playing.@q{@dir}verbose}"
167 alt="@label{playing.@dir}">
168 </a>}
169 {<img class=button src="@image{no@dir}"
30d85588
RK
170 width=@width height=@height
171 title="@label{playing.@q{@dir}verbose}"
172 alt="@label{playing.@dir}">}}