chiark / gitweb /
Translate preferences page to the new order.
[disorder] / templates / choose.tmpl
index 844fe9a70cd181dcbdc99188a27ef88941d8c134..4300852218917d580bee136bab2c33a5b2012e30 100644 (file)
@@ -20,141 +20,213 @@ USA
 -->
 <html>
  <head>
-@include:stdhead@
-  <title>@label:choose.title@</title>
+@stdhead{choose}
  </head>
  <body>
-@include{topbar}@
-   <h1>@label:choose.title@</h1>
+@stdmenu{choose}
+   <h1>@label{choose.title}</h1>
   
-  @#{always have the first-letter bar, if choosealpha enabled}@
-  @if{@eq{@label:sidebar.choosewhich@}{choosealpha}@}{
-
+  @if{@eq{@label{menu.choosewhich}}{choosealpha}}
+     {
    <p class=choosealpha>
     <a title="Directories starting with 'a'"
-    href="@url@?action=choose&#38;regexp=^(the )?a">A</a> |
+    href="@url?action=choose&#38;re=^(the )?a">A</a> |
     <a title="Directories starting with 'b'"
-    href="@url@?action=choose&#38;regexp=^(the )?b">B</a> |
+    href="@url?action=choose&#38;re=^(the )?b">B</a> |
     <a title="Directories starting with 'c'"
-    href="@url@?action=choose&#38;regexp=^(the )?c">C</a> |
+    href="@url?action=choose&#38;re=^(the )?c">C</a> |
     <a title="Directories starting with 'd'"
-    href="@url@?action=choose&#38;regexp=^(the )?d">D</a> |
+    href="@url?action=choose&#38;re=^(the )?d">D</a> |
     <a title="Directories starting with 'e'"
-    href="@url@?action=choose&#38;regexp=^(the )?e">E</a> |
+    href="@url?action=choose&#38;re=^(the )?e">E</a> |
     <a title="Directories starting with 'f'"
-    href="@url@?action=choose&#38;regexp=^(the )?f">F</a> |
+    href="@url?action=choose&#38;re=^(the )?f">F</a> |
     <a title="Directories starting with 'g'"
-    href="@url@?action=choose&#38;regexp=^(the )?g">G</a> |
+    href="@url?action=choose&#38;re=^(the )?g">G</a> |
     <a title="Directories starting with 'h'"
-    href="@url@?action=choose&#38;regexp=^(the )?h">H</a> |
+    href="@url?action=choose&#38;re=^(the )?h">H</a> |
     <a title="Directories starting with 'i'"
-    href="@url@?action=choose&#38;regexp=^(the )?i">I</a> |
+    href="@url?action=choose&#38;re=^(the )?i">I</a> |
     <a title="Directories starting with 'j'"
-    href="@url@?action=choose&#38;regexp=^(the )?j">J</a> |
+    href="@url?action=choose&#38;re=^(the )?j">J</a> |
     <a title="Directories starting with 'k'"
-    href="@url@?action=choose&#38;regexp=^(the )?k">K</a> |
+    href="@url?action=choose&#38;re=^(the )?k">K</a> |
     <a title="Directories starting with 'l'"
-    href="@url@?action=choose&#38;regexp=^(the )?l">L</a> |
+    href="@url?action=choose&#38;re=^(the )?l">L</a> |
     <a title="Directories starting with 'm'"
-    href="@url@?action=choose&#38;regexp=^(the )?m">M</a> |
+    href="@url?action=choose&#38;re=^(the )?m">M</a> |
     <a title="Directories starting with 'n'"
-    href="@url@?action=choose&#38;regexp=^(the )?n">N</a> |
+    href="@url?action=choose&#38;re=^(the )?n">N</a> |
     <a title="Directories starting with 'o'"
-    href="@url@?action=choose&#38;regexp=^(the )?o">O</a> |
+    href="@url?action=choose&#38;re=^(the )?o">O</a> |
     <a title="Directories starting with 'p'"
-    href="@url@?action=choose&#38;regexp=^(the )?p">P</a> |
+    href="@url?action=choose&#38;re=^(the )?p">P</a> |
     <a title="Directories starting with 'q'"
-    href="@url@?action=choose&#38;regexp=^(the )?q">Q</a> |
+    href="@url?action=choose&#38;re=^(the )?q">Q</a> |
     <a title="Directories starting with 'r'"
-    href="@url@?action=choose&#38;regexp=^(the )?r">R</a> |
+    href="@url?action=choose&#38;re=^(the )?r">R</a> |
     <a title="Directories starting with 's'"
-    href="@url@?action=choose&#38;regexp=^(the )?s">S</a> |
+    href="@url?action=choose&#38;re=^(the )?s">S</a> |
     <a title="Directories starting with 't'"
-    href="@url@?action=choose&#38;regexp=^(?!the [^t])t">T</a> |
+    href="@url?action=choose&#38;re=^(?!the [^t])t">T</a> |
     <a title="Directories starting with 'u'"
-    href="@url@?action=choose&#38;regexp=^(the )?u">U</a> |
+    href="@url?action=choose&#38;re=^(the )?u">U</a> |
     <a title="Directories starting with 'v'"
-    href="@url@?action=choose&#38;regexp=^(the )?v">V</a> |
+    href="@url?action=choose&#38;re=^(the )?v">V</a> |
     <a title="Directories starting with 'w'"
-    href="@url@?action=choose&#38;regexp=^(the )?w">W</a> |
+    href="@url?action=choose&#38;re=^(the )?w">W</a> |
     <a title="Directories starting with 'x'"
-    href="@url@?action=choose&#38;regexp=^(the )?x">X</a> |
+    href="@url?action=choose&#38;re=^(the )?x">X</a> |
     <a title="Directories starting with 'y'"
-    href="@url@?action=choose&#38;regexp=^(the )?y">Y</a> |
+    href="@url?action=choose&#38;re=^(the )?y">Y</a> |
     <a title="Directories starting with 'z'"
-    href="@url@?action=choose&#38;regexp=^(the )?z">Z</a> |
+    href="@url?action=choose&#38;re=^(the )?z">Z</a> |
     <a title="Directories starting with anything else"
-    href="@url@?action=choose&#38;regexp=^[^a-z]">*</a>
+    href="@url?action=choose&#38;re=^[^a-z]">*</a>
    </p>
-  }@
+}
+
+@# Always have a search form
+   <form class=search
+         action="@url"
+         method=POST
+         enctype="multipart/form-data" accept-charset=utf-8>
+     <p class=search>Enter search terms:
+       <input class=query name=query type=text value="@argq{query}"
+              size=50>
+       <button class=search name=submit type=submit>
+         @label{search.search}
+       </button>
+       <input name=action type=hidden value=choose>
+       <a class=button
+          href="@url?action=choose">
+         @label{search.clear}
+       </a>
+     </p>
+   </form>
+
+   @if{@ne{@arg{query}}{}}
+      {@# There's a search query
+  <table class=search>
+    <tr class=headings>
+     <th class=artist>@label{heading.artist}</th>
+     <th class=album>@label{heading.album}</th>
+     <th class=title>@label{heading.title}</th>
+     <th class=length>@label{heading.length}</th>
+@right{prefs}{
+     <th class=button>&nbsp;</th>}
+    </tr>
+    @search{@arg{query}}{
+    <tr class=@parity>
+     <td class=artist>@martist{search}{@track}</td>
+     <td class=album>@malbum{search}{@track}</td>
+     <td class=title>@mtitleplay{search}{@track}</td>
+     <td class=length>@length{@track}</td>
+     @right{prefs}{
+     <td class=imgbutton>
+      <a class=imgbutton
+         href="@url?action=prefs&#38;track=@urlquote{@track}">
+       <img class=button src="@image{edit}"
+            title="@label{choose.prefsverbose}"
+            alt="@label{choose.prefs}">
+      </a>
+     </td>
+    </tr>}
+    }
+  </table>}
+      {@# No search query
+
+@# We have the following possible cases:
+@#  choose.which  dir       re       result
+@#  choose        ""        -        Ask for top level
+@#  choose        ""        present  Ask for top level with re applied
+@#  choose        present   -        Ask for dir
+@#  choose        present   re       Ask for dir with re applied
+@#  choosealpha   ""        -        Nothing
+@#  choosealpha   ""        present  Ask for top level with re applied
+@#  choosealpha   present   -        Ask for dir
+@#  choosealpha   present   re       Ask for dir with re applied
+@#
+@# So in fact the only oddity is choosealpha + no dir + no re.
+@#
+@# NB we don't really bother distinguishing between re being empty or absent,
+@# and the server deliberately cooperates in this.
+
+@# TODO navigation...
 
-   @if{@ne{@arg:directory@}{}@}{
-   <p class=directoryname>@navigate{@arg:directory@}{/<a
-   href="@url@?action=choose&#38;directory=@urlquote{@fullname@}@">@basename@</a>}@:</p>
-   }@
+@#  <p>dir=[@arg{dir}]<br>re=[@arg{re}]<br>which=@label{choose.which}</p>
 
-   @if{@isdirectories@}{
-   <div class=directories><div class=filesdirectories>
-    <p class=heading>
-     @label:choose.directories@
-    </p>
-    @choose{directories}{
-    <p class=entry>
-     <a
-     href="@url@?action=choose&#38;directory=@urlquote{@file@}@"
-     title="@label:choose.directory@">
-     <img class=button
-      src="@image:directory@"
-      alt="">
-      @transform{@file@}{dir}{display}@
-     </a>
-    </p>
-    }@
-   </div></div>
-   }@
-   @if{@isfiles@}{
-   <div class=files><div class=filesdirectories>
-    <p class=heading>
-     @label:choose.files@
-    </p>
-    @choose{files}{
-    <p class=entry>
-    @right{prefs}{<a class=imgprefs
-     href="@url@?action=prefs&#38;0_file=@urlquote{@resolve{@file@}@}@"
-     ><img class=button
-      src="@image:edit@"
-      title="@label:choose.prefsverbose@"
-      alt="@label:choose.prefs@"></a>}@
-     <a
-     href="@url@?action=play&#38;file=@urlquote{@file@}@&#38;back=@urlquote{@thisurl@}@"
-     title="@label:choose.play@">@transform{@file@}{track}{display}@</a>
-     @if{@eq{@trackstate{@file@}@}{playing}@}{[<b>playing</b>]}@
-     @if{@eq{@trackstate{@file@}@}{queued}@}{[<b>queued</b>]}@
-    </p>
-    }@
-    <p class=all>
-     @right{prefs}{<a class=imgprefs
-     href="@url@?action=prefs&#38;directory=@urlquote{@arg:directory@}@&#38;back=@urlquote{@thisurl@}@"
-     ><img class=button 
-      src="@image:edit@"
-      title="@label:choose.allprefsverbose@"
-      alt="@label:choose.allprefs@"></a>}@
-     <a class=button href="@url@?action=play&#38;directory=@urlquote{@arg:directory@}@&#38;back=@urlquote{@thisurl@}@">
-      @label:choose.playall@
-     </a>
-    </p>
-   </div></div>
-   }@
+  @if{@or{@ne{@label{menu.choosewhich}}{choosealpha}}
+         {@ne{@arg{dir}}{}}
+         {@ne{@arg{re}}{}}}
+     {@#
+   <div class=directories>
+    <div class=filesdirectories>
+     @dirs{@arg{dir}}{@arg{re}}{
+      <p class=entry>
+       <a href="@url?action=choose&#38;dir=@urlquote{@track}">
+        <img class=button src="@image{directory}" alt="">
+        @display
+       </a>
+      </p>}
+    </div>
+   </div>
 
-@include{topbarend}@
+@define{sometracks}{template}{}
+
+   <div class=files>
+    <div class=filesdirectories>
+     @tracks{@arg{dir}}{@arg{re}}{
+      <p class=entry>
+@define{sometracks}{template}{@template}@#
+       @right{prefs}{
+        <a class=imgprefs
+           href="@url?action=prefs&#38;track=@urlquote{@resolve{@track}}">
+         <img class=button
+              src="@image{edit}"
+              title="@label{choose.prefsverbose}"
+              alt="@label{choose.prefs}">
+        </a>
+       }@#
+       <a href="@url?action=play&#38;track=@urlquote{@track}&#38;back=@urlquote{@thisurl}"
+          title="@label{choose.play}">
+        @display
+       </a>
+       @if{@eq{@trackstate{@track}}{playing}}
+          {[<b>playing</b>]}
+       @if{@eq{@trackstate{@track}}{queued}}
+          {[<b>queued</b>]}
+      </p>}
+      @sometracks{
+      <p class=all>
+        @right{prefs}{
+        <a class=imgprefs
+           href="@url?action=prefs&#38;dir=@urlquote{@arg{dir}}">
+         <img class=button
+              src="@image{edit}"
+              title="@label{choose.allprefsverbose}"
+              alt="@label{choose.allprefs}">
+        </a>}
+        <a class=button
+           href="@url?action=play&#38;dir=@urlquote{@arg{dir}}&#38;back=@urlquote{@thisurl}">
+         @label{choose.playall}
+        </a>
+      </p>}
+    </div>
+   </div>
+   }
+   }
+
+@credits
  </body>
 </html>
-@@
-<!--
+@discard{
 Local variables:
 mode:sgml
 sgml-always-quote-attributes:nil
 sgml-indent-step:1
 sgml-indent-data:t
+indent-tabs-mode:nil
+fill-column:79
 End:
--->
+}@#