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