exp_search, fold search into choose, not really finished
[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 <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}}
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
84
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>}
93
94 @# Expand to the time that @id will be played
95 @# @what is the section
96 @# @id is the track ID
97 @define {mwhen} {what id}
98 {@when{@id}</td>}
99
100 @# Expand to the 'who' field for @id
101 @# @what is the section
102 @# @id is the track ID
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
111 @# @what is the section
112 @# @track is the track name
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
122 @# @what is the section
123 @# @track is the track name
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
133 @# @what is the section
134 @# @track is the track name
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
139 @# @what is the section
140 @# @id is the track ID
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}"
146 width=@width height=@height
147 title="@label{@what.removeverbose}"
148 alt="@label{@what.scratch}">
149 </a>}
150 {<img class=button src="@image{noremove}"
151 width=@width height=@height
152 title="@label{@what.removeverbose}"
153 alt="@label{@what.scratch}">}}
154
155 @# Expand to a move button
156 @# @id is the track ID
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}"
165 width=@width height=@height
166 title="@label{playing.@q{@dir}verbose}"
167 alt="@label{playing.@dir}">
168 </a>}
169 {<img class=button src="@image{no@dir}"
170 width=@width height=@height
171 title="@label{playing.@q{@dir}verbose}"
172 alt="@label{playing.@dir}">}}