chiark / gitweb /
a405a25ec42cc1ce1399686e62864e572081303a
[disorder] / templates / choose.tmpl
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
2 <!--
3 This file is part of DisOrder.
4 Copyright (C) 2004-2008 Richard Kettlewell
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19 USA
20 -->
21 <html>
22  <head>
23 @stdhead{choose}
24  </head>
25  <body>
26 @stdmenu{choose}
27    <h1>@label{choose.title}</h1>
28   
29   @if{@eq{@label{menu.choosewhich}}{choosealpha}}
30      {
31    <p class=choosealpha>
32     <a title="Directories starting with 'a'"
33     href="@url?action=choose&#38;re=^(the )?a">A</a> |
34     <a title="Directories starting with 'b'"
35     href="@url?action=choose&#38;re=^(the )?b">B</a> |
36     <a title="Directories starting with 'c'"
37     href="@url?action=choose&#38;re=^(the )?c">C</a> |
38     <a title="Directories starting with 'd'"
39     href="@url?action=choose&#38;re=^(the )?d">D</a> |
40     <a title="Directories starting with 'e'"
41     href="@url?action=choose&#38;re=^(the )?e">E</a> |
42     <a title="Directories starting with 'f'"
43     href="@url?action=choose&#38;re=^(the )?f">F</a> |
44     <a title="Directories starting with 'g'"
45     href="@url?action=choose&#38;re=^(the )?g">G</a> |
46     <a title="Directories starting with 'h'"
47     href="@url?action=choose&#38;re=^(the )?h">H</a> |
48     <a title="Directories starting with 'i'"
49     href="@url?action=choose&#38;re=^(the )?i">I</a> |
50     <a title="Directories starting with 'j'"
51     href="@url?action=choose&#38;re=^(the )?j">J</a> |
52     <a title="Directories starting with 'k'"
53     href="@url?action=choose&#38;re=^(the )?k">K</a> |
54     <a title="Directories starting with 'l'"
55     href="@url?action=choose&#38;re=^(the )?l">L</a> |
56     <a title="Directories starting with 'm'"
57     href="@url?action=choose&#38;re=^(the )?m">M</a> |
58     <a title="Directories starting with 'n'"
59     href="@url?action=choose&#38;re=^(the )?n">N</a> |
60     <a title="Directories starting with 'o'"
61     href="@url?action=choose&#38;re=^(the )?o">O</a> |
62     <a title="Directories starting with 'p'"
63     href="@url?action=choose&#38;re=^(the )?p">P</a> |
64     <a title="Directories starting with 'q'"
65     href="@url?action=choose&#38;re=^(the )?q">Q</a> |
66     <a title="Directories starting with 'r'"
67     href="@url?action=choose&#38;re=^(the )?r">R</a> |
68     <a title="Directories starting with 's'"
69     href="@url?action=choose&#38;re=^(the )?s">S</a> |
70     <a title="Directories starting with 't'"
71     href="@url?action=choose&#38;re=^(?!the [^t])t">T</a> |
72     <a title="Directories starting with 'u'"
73     href="@url?action=choose&#38;re=^(the )?u">U</a> |
74     <a title="Directories starting with 'v'"
75     href="@url?action=choose&#38;re=^(the )?v">V</a> |
76     <a title="Directories starting with 'w'"
77     href="@url?action=choose&#38;re=^(the )?w">W</a> |
78     <a title="Directories starting with 'x'"
79     href="@url?action=choose&#38;re=^(the )?x">X</a> |
80     <a title="Directories starting with 'y'"
81     href="@url?action=choose&#38;re=^(the )?y">Y</a> |
82     <a title="Directories starting with 'z'"
83     href="@url?action=choose&#38;re=^(the )?z">Z</a> |
84     <a title="Directories starting with anything else"
85     href="@url?action=choose&#38;re=^[^a-z]">*</a>
86    </p>
87 }
88
89 @# Always have a search form
90    <form class=search
91          action="@url"
92          method=POST
93          enctype="multipart/form-data" accept-charset=utf-8>
94      <p class=search>Enter search terms:
95        <input class=query name=query type=text value="@argq{query}"
96               size=50>
97        @submit{@label{search.search}}
98        <input name=action type=hidden value=choose>
99        <a class=button
100           href="@url?action=choose">
101          @label{search.clear}
102        </a>
103      </p>
104    </form>
105
106    @if{@ne{@arg{query}}{}}
107       {@# There's a search query
108   <table class=search>
109     <tr class=headings>
110      <th class=artist>@label{heading.artist}</th>
111      <th class=album>@label{heading.album}</th>
112      <th class=title>@label{heading.title}</th>
113      <th class=length>@label{heading.length}</th>
114 @right{prefs}{
115      <th class=button>&nbsp;</th>}
116     </tr>
117     @search{@arg{query}}{
118     <tr class=@parity>
119      <td class=artist>@martist{search}{@track}</td>
120      <td class=album>@malbum{search}{@track}</td>
121      <td class=title>@mtitleplay{search}{@track}</td>
122      <td class=length>@length{@track}</td>
123      @right{prefs}{
124      <td class=imgbutton>
125       <a class=imgbutton
126          href="@url?action=prefs&#38;track=@urlquote{@track}">
127        <img class=button src="@image{edit}"
128             title="@label{choose.prefsverbose}"
129             alt="@label{choose.prefs}">
130       </a>
131      </td>
132     </tr>}
133     }
134   </table>}
135       {@# No search query
136
137 @# We have the following possible cases:
138 @#  choose.which  dir       re       result
139 @#  choose        ""        -        Ask for top level
140 @#  choose        ""        present  Ask for top level with re applied
141 @#  choose        present   -        Ask for dir
142 @#  choose        present   re       Ask for dir with re applied
143 @#  choosealpha   ""        -        Nothing
144 @#  choosealpha   ""        present  Ask for top level with re applied
145 @#  choosealpha   present   -        Ask for dir
146 @#  choosealpha   present   re       Ask for dir with re applied
147 @#
148 @# So in fact the only oddity is choosealpha + no dir + no re.
149 @#
150 @# NB we don't really bother distinguishing between re being empty or absent,
151 @# and the server deliberately cooperates in this.
152
153    @if{@ne{@arg{dir}}{}}{
154    <p class=directoryname>@#
155 @breadcrumbs{@arg{dir}} 
156             {/<a href="@url?action=choose&#38;dir=@urlquote{@dir}">@#
157 @basename{@dir}</a>}:</p>}
158
159 @#  <p>dir=[@arg{dir}]<br>re=[@arg{re}]<br>which=@label{choose.which}</p>
160
161   @if{@or{@ne{@label{menu.choosewhich}}{choosealpha}}
162          {@ne{@arg{dir}}{}}
163          {@ne{@arg{re}}{}}}
164      {@#
165    <div class=directories>
166     <div class=filesdirectories>
167      @dirs{@arg{dir}}{@arg{re}}{
168       <p class=entry>
169        <a href="@url?action=choose&#38;dir=@urlquote{@track}">
170         <img class=button src="@image{directory}" alt="">
171         @display
172        </a>
173       </p>}
174     </div>
175    </div>
176
177 @define{sometracks}{template}{}
178
179    <div class=files>
180     <div class=filesdirectories>
181      @tracks{@arg{dir}}{@arg{re}}{
182       <p class=entry>
183 @define{sometracks}{template}{@template}@#
184        @right{prefs}{
185         <a class=imgprefs
186            href="@url?action=prefs&#38;track=@urlquote{@resolve{@track}}">
187          <img class=button
188               src="@image{edit}"
189               title="@label{choose.prefsverbose}"
190               alt="@label{choose.prefs}">
191         </a>
192        }@#
193        <a href="@url?action=play&#38;track=@urlquote{@track}&#38;back=@urlquote{@thisurl}"
194           title="@label{choose.play}">
195         @display
196        </a>
197        @if{@eq{@trackstate{@track}}{playing}}
198           {[<b>playing</b>]}
199        @if{@eq{@trackstate{@track}}{queued}}
200           {[<b>queued</b>]}
201       </p>}
202       @sometracks{
203       <p class=all>
204         @right{prefs}{
205         <a class=imgprefs
206            href="@url?action=prefs&#38;dir=@urlquote{@arg{dir}}">
207          <img class=button
208               src="@image{edit}"
209               title="@label{choose.allprefsverbose}"
210               alt="@label{choose.allprefs}">
211         </a>}
212         <a class=button
213            href="@url?action=play&#38;dir=@urlquote{@arg{dir}}&#38;back=@urlquote{@thisurl}">
214          @label{choose.playall}
215         </a>
216       </p>}
217     </div>
218    </div>
219    }
220    }
221
222 @credits
223  </body>
224 </html>
225 @discard{
226 Local variables:
227 mode:sgml
228 sgml-always-quote-attributes:nil
229 sgml-indent-step:1
230 sgml-indent-data:t
231 indent-tabs-mode:nil
232 fill-column:79
233 End:
234 }@#