1<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="iso-8859-1" %>
2<%@ include file="include.jsp" %>
3
4<%--
5PARAMETERS
6  albumId: ID of album.
7  playlistId: ID of playlist.
8  podcastChannelId: ID of podcast channel
9  auth: Authentication token
10  coverArtHQ: HD cover art.
11  coverArtSize: Height and width of cover art.
12  caption1: Caption line 1
13  caption2: Caption line 2
14  caption3: Caption line 3
15  captionCount: Number of caption lines to display (default 0)
16  showLink: Whether to make the cover art image link to the album page.
17  showZoom: Whether to display a link for zooming the cover art.
18  showChange: Whether to display a link for changing the cover art.
19  appearAfter: Fade in after this many milliseconds, or nil if no fading in should happen.
20--%>
21<c:choose>
22    <c:when test="${empty param.coverArtSize}">
23        <c:set var="size" value="auto"/>
24    </c:when>
25    <c:otherwise>
26        <c:set var="size" value="${param.coverArtSize}px"/>
27    </c:otherwise>
28</c:choose>
29<c:set var="captionCount" value="${empty param.captionCount ? 0 : param.captionCount}"/>
30<str:randomString count="5" type="alphabet" var="divId"/>
31<str:randomString count="5" type="alphabet" var="imgId"/>
32<str:randomString count="5" type="alphabet" var="playId"/>
33
34<div class="coverart">
35    <div style="width:${size};max-width:${size};height:${size};max-height:${size};cursor:pointer" title="${param.caption1}" id="${divId}">
36
37        <c:if test="${not empty param.albumId}">
38            <c:url value="main.view" var="targetUrl">
39                <c:param name="id" value="${param.albumId}"/>
40            </c:url>
41        </c:if>
42        <c:if test="${not empty param.playlistId}">
43            <c:url value="playlist.view" var="targetUrl">
44                <c:param name="id" value="${param.playlistId}"/>
45            </c:url>
46        </c:if>
47        <c:if test="${not empty param.podcastChannelId}">
48            <c:url value="podcastChannel.view" var="targetUrl">
49                <c:param name="id" value="${param.podcastChannelId}"/>
50            </c:url>
51        </c:if>
52        <c:url value="/coverArt.view" var="coverArtUrl">
53            <c:if test="${not empty param.coverArtSize}">
54                <c:choose>
55                    <c:when test="${param.coverArtHQ}">
56                        <madsonic:param name="size" value="${param.coverArtSize * 2}"/>
57                    </c:when>
58                    <c:otherwise>
59                        <madsonic:param name="size" value="${param.coverArtSize}"/>
60                    </c:otherwise>
61                </c:choose>
62            </c:if>
63            <c:if test="${not empty param.albumId}">
64                <c:param name="id" value="${param.albumId}"/>
65            </c:if>
66            <c:if test="${not empty param.podcastChannelId}">
67                <c:param name="id" value="pod-${param.podcastChannelId}"/>
68            </c:if>
69            <c:if test="${not empty param.playlistId}">
70                <c:param name="id" value="pl-${param.playlistId}"/>
71            </c:if>
72        <c:if test="${not empty param.auth}">
73            <c:param name="auth" value="${param.auth}"/>
74        </c:if>
75        </c:url>
76        <c:url value="/coverArt.view" var="zoomCoverArtUrl">
77            <c:param name="id" value="${param.albumId}"/>
78        </c:url>
79
80        <div style="position: relative; width: 0; height: 0">
81            <img src="<spring:theme code="playOverlayImage"/>" id="${playId}" style="position:relative;top:8px;left:8px;z-index:2;display:none" >
82        </div>
83        <c:choose>
84        <c:when test="${param.showLink}"><a href="${targetUrl}" title="${param.caption1}"></c:when>
85        <c:when test="${param.showZoom}"><a href="${zoomCoverArtUrl}" rel="zoom" title="${param.caption1}"></c:when>
86            </c:choose>
87            <img src="${coverArtUrl}" id="${imgId}" alt="${param.caption1}" class="dropshadow" style="display:none">
88            <c:if test="${param.showLink or param.showZoom}"></a></c:if>
89    </div>
90
91    <c:if test="${captionCount gt 0}">
92        <div class="caption1" style="width:${param.coverArtSize - 16}px"><a href="${targetUrl}" title="${param.caption1}">${param.caption1}</a></div>
93    </c:if>
94    <c:if test="${captionCount gt 1}">
95        <div class="caption2" style="width:${param.coverArtSize - 16}px">${param.caption2}&nbsp;</div>
96    </c:if>
97    <c:if test="${captionCount gt 2}">
98        <div class="caption3" style="width:${param.coverArtSize - 16}px">${param.caption3}&nbsp;</div>
99    </c:if>
100</div>
101
102<c:if test="${param.showChange or param.showZoom}">
103    <div style="padding-top:6px;text-align:right">
104        <c:if test="${param.showChange}">
105            <c:url value="/changeCoverArt.view" var="changeCoverArtUrl">
106                <c:param name="id" value="${param.albumId}"/>
107            </c:url>
108            <a class="detail" href="${changeCoverArtUrl}"><fmt:message key="coverart.change"/></a>
109        </c:if>
110
111        <c:if test="${param.showZoom and param.showChange}">
112            |
113        </c:if>
114
115        <c:if test="${param.showZoom}">
116            <a class="detail" rel="zoom" title="${param.caption1}" href="${zoomCoverArtUrl}"><fmt:message key="coverart.zoom"/></a>
117        </c:if>
118    </div>
119</c:if>
120
121<script type="text/javascript">
122    $(document).ready(function () {
123        setTimeout("$('#${imgId}').fadeIn(500)", ${empty param.appearAfter ? 0 : param.appearAfter});
124    });
125
126    $("#${divId}").mouseenter(function () {
127        $("#${playId}").show();
128        $("#${imgId}").stop();
129        $("#${imgId}").animate({opacity: 0.7}, 150);
130    });
131    $("#${divId}").mouseleave(function () {
132        $("#${playId}").hide();
133        $("#${imgId}").stop();
134        $("#${imgId}").animate({opacity: 1.0}, 150);
135    });
136    $("#${playId}").click(function () {
137        <c:if test="${not empty param.albumId}">
138        top.playQueue.onPlay(${param.albumId});
139        </c:if>
140        <c:if test="${not empty param.playlistId}">
141        top.playQueue.onPlayPlaylist(${param.playlistId});
142        </c:if>
143        <c:if test="${not empty param.podcastChannelId}">
144        top.playQueue.onPlayPodcastChannel(${param.podcastChannelId});
145        </c:if>
146    });
147
148</script>
149
150