| 1 | @discard{ |
| 2 | |
| 3 | This file is part of DisOrder. |
| 4 | Copyright (C) 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 | @# Standard width and height of an image |
| 22 | @define {width} {} {16} |
| 23 | @define {height} {} {16} |
| 24 | |
| 25 | @# Expand to @yes for the Manage page and @no for the playing page |
| 26 | @define {ifmanage} {yes no} |
| 27 | {@if {@eq {@arg{action}}{manage}} |
| 28 | {@yes} |
| 29 | {@no}} |
| 30 | |
| 31 | @# Expand to &back=manage or to nothing |
| 32 | @define {back} {} |
| 33 | {@ifmanage{&back=manage}{}} |
| 34 | |
| 35 | @# Expand to the time that @id will be played |
| 36 | @# @what is the section |
| 37 | @# @id is the track ID |
| 38 | @define {mwhen} {what id} |
| 39 | {@when{@id}</td>} |
| 40 | |
| 41 | @# Expand to the 'who' field for @id |
| 42 | @# @what is the section |
| 43 | @# @id is the track ID |
| 44 | @define {mwho} {what id} |
| 45 | {@if{@eq{@who{@id}}{}} |
| 46 | {@if{@eq{@state{@id}}{random}} |
| 47 | {@label{@what.randomtrack}} |
| 48 | { }} |
| 49 | {@who{@id}}} |
| 50 | |
| 51 | @# Expand to the artist for @track |
| 52 | @# @what is the section |
| 53 | @# @track is the track name |
| 54 | @define {martist} {what track} |
| 55 | {@right{play} |
| 56 | {<a class=directory |
| 57 | href="@url?action=choose&directory=@urlquote{@dirname{@dirname{@track}}}" |
| 58 | title="@label{@what.artistverbose}">@part{@track}{short}{artist}</a>} |
| 59 | {<span class=directory |
| 60 | title="@part{@track}{artist}@">@part{@track}{short}{artist}</span>}} |
| 61 | |
| 62 | @# Expand to the album for @track |
| 63 | @# @what is the section |
| 64 | @# @track is the track name |
| 65 | @define {malbum} {what track} |
| 66 | {@right{play} |
| 67 | {<a class=directory |
| 68 | href="@url?action=choose&directory=@urlquote{@dirname{@track}}" |
| 69 | title="@label{@what.albumverbose}">@part{@track}{short}{album}</a>} |
| 70 | {<span class=directory |
| 71 | title="@part{@track}{album}@">@part{@track}{short}{album}</span>}} |
| 72 | |
| 73 | @# Expand to the title for @track |
| 74 | @# @what is the section |
| 75 | @# @track is the track name |
| 76 | @define {mtitle} {what track} |
| 77 | {<span title="@part{@track}{title}">@part{@track}{short}{title}</span>} |
| 78 | |
| 79 | @# Expand to the remove/scratch entry for @id |
| 80 | @# @what is the section |
| 81 | @# @id is the track ID |
| 82 | @define {mremove} {what id} |
| 83 | {@if{@removable{@id}} |
| 84 | {<a class=imgbutton |
| 85 | href="@url?action=remove&id=@id@back"> |
| 86 | <img class=button src="@image{remove}" |
| 87 | title="@label{@what.removeverbose}" |
| 88 | alt="@label{@what.scratch}"> |
| 89 | </a>} |
| 90 | {<img class=button src="@image{noremove}" |
| 91 | title="@label{@what.removeverbose}" |
| 92 | alt="@label{@what.scratch}">}} |
| 93 | |
| 94 | @# Expand to a move button |
| 95 | @# @id is the track ID |
| 96 | @# @dir should be a direction: up, upall, down or downall |
| 97 | @# @delta should be the distance, +ve for up and -ve for down |
| 98 | @# This macro calls @movable to check that the move is possible. |
| 99 | @define {mmove} {id dir delta} |
| 100 | {@if{@movable{@id}{@delta}} |
| 101 | {<a class=imgbutton |
| 102 | href="@url?action=move&id=@id&delta=@delta@back"> |
| 103 | <img class=button src="@image{@dir}" |
| 104 | title="@label{playing.@q{@dir}verbose}" |
| 105 | alt="@label{playing.@dir}"> |
| 106 | </a>} |
| 107 | {<img class=button src="@image{no@dir}" |
| 108 | title="@label{playing.@q{@dir}verbose}" |
| 109 | alt="@label{playing.@dir}">}} |
| 110 | }@# |