1<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="iso-8859-1"%>
2<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
3
4<html><head>
5    <%@ include file="head.jsp" %>
6    <%@ include file="jquery.jsp" %>
7
8    <c:choose>
9        <c:when test="${model.customScrollbar}">
10            <link href="<c:url value="/style/customScrollbar.css"/>" rel="stylesheet">
11            <script type="text/javascript" src="<c:url value="/script/jquery.mousewheel.min.js"/>"></script>
12            <script type="text/javascript" src="<c:url value="/script/jquery.mCustomScrollbar.concat.min.js"/>"></script>
13        </c:when>
14        <c:otherwise>
15            <link href="<c:url value="/style/customScrollbarAuto.css"/>" rel="stylesheet">
16        </c:otherwise>
17    </c:choose>
18
19    <script type="text/javascript" src="<c:url value="/dwr/util.js"/>"></script>
20    <script type="text/javascript" src="<c:url value="/dwr/engine.js"/>"></script>
21    <script type="text/javascript" src="<c:url value="/dwr/interface/starService.js"/>"></script>
22    <script type="text/javascript" src="<c:url value="/dwr/interface/lovedTrackService.js"/>"></script>
23    <script type="text/javascript" language="javascript">
24
25    function toggleStar(mediaFileId, element) {
26        starService.star(mediaFileId, !$(element).hasClass("fa-star"));
27        $(element).toggleClass("fa-star fa-star-o starred");
28    }
29
30    function toggleLoved(mediaFileId, element) {
31        lovedTrackService.love(mediaFileId, !$(element).hasClass("fa-heart"));
32        $(element).toggleClass("fa-heart fa-heart-o loved");
33    }
34    </script>
35</head>
36<body class="mainframe bgcolor1">
37
38<!-- content block -->
39
40<div id="content_main" class="content_main">
41<!-- CONTENT -->
42
43<h1>
44    <img src="<spring:theme code="chartImage"/>" width="32" alt="">
45    <fmt:message key="statistics.title"/>
46</h1>
47
48<h2>
49    <c:if test="${model.current.isAdminRole()}">
50    <select name="username"  onchange="location='statistics.view?user=' + this.options[this.selectedIndex].value;">
51        <c:forEach items="${model.users}" var="userx">
52        <option ${userx.username eq model.user.username ? "selected" : ""} value="${userx.username}">${userx.username}</option>
53        </c:forEach>
54    </select>
55    </c:if>
56
57    <c:if test="${not model.current.isAdminRole()}">
58    <fmt:message key="statistics.yours"/>
59    </c:if>
60
61    <span style="margin: 0 10px 0 0;"></span>
62
63    <c:forTokens items="lastplayed topplayed" delims=" " var="cat" varStatus="loopStatus">
64        <c:if test="${loopStatus.count > 1}">&nbsp;<img src="<spring:theme code="sepImage"/>">&nbsp;</c:if>
65        <madsonic:url var="url" value="statistics.view">
66            <madsonic:param name="listType" value="${cat}"/>
67            <madsonic:param name="user" value="${model.user.username}"/>
68        </madsonic:url>
69        <c:choose>
70            <c:when test="${model.listType eq cat}">
71                <span class="headerSelected"><fmt:message key="statistics.${cat}.title"/></span>
72            </c:when>
73            <c:otherwise>
74                <a href="${url}"><fmt:message key="statistics.${cat}.title"/></a>
75            </c:otherwise>
76        </c:choose>
77    </c:forTokens>
78    <span style="margin: 0 10px 0 10px;"> <fmt:message key="statistics.others"/> </span>
79    <c:forTokens items="otheruser overall users" delims=" " var="cat" varStatus="loopStatus">
80        <c:if test="${loopStatus.count > 1}">&nbsp;<img src="<spring:theme code="sepImage"/>">&nbsp;</c:if>
81        <madsonic:url var="url" value="statistics.view">
82            <madsonic:param name="listType" value="${cat}"/>
83        </madsonic:url>
84        <c:choose>
85            <c:when test="${model.listType eq cat}">
86                <span class="headerSelected"><fmt:message key="statistics.${cat}.title"/></span>
87            </c:when>
88            <c:otherwise>
89                <a href="${url}"><fmt:message key="statistics.${cat}.title"/></a>
90            </c:otherwise>
91        </c:choose>
92    </c:forTokens>
93
94</h2>
95<br>
96<c:choose>
97	<c:when test="${model.listType eq 'lastplayed'}">
98	<!-- lastplayed -->
99	</c:when>
100</c:choose>
101<c:choose>
102	<c:when test="${model.listType eq 'topplayed'}">
103	<!-- topplayed -->
104	</c:when>
105</c:choose>
106<c:choose>
107	<c:when test="${model.listType eq 'otheruser'}">
108	<!-- otheruser -->
109	</c:when>
110</c:choose>
111<c:choose>
112	<c:when test="${model.listType eq 'overall'}">
113	<!-- overall -->
114	</c:when>
115</c:choose>
116
117<c:choose>
118	<c:when test="${model.listType eq 'users'}">
119	<!-- user Stats -->
120	<br>
121			<table>
122			<tr>
123				<th><fmt:message key="home.chart.total"/></th>
124				<th><fmt:message key="home.chart.stream"/></th>
125			</tr>
126			<tr>
127				<td><img src="<c:url value="/userChart.view"><c:param name="type" value="total"/></c:url>" width="90%" alt=""></td>
128				<td><img src="<c:url value="/userChart.view"><c:param name="type" value="stream"/></c:url>"  width="90%" alt=""></td>
129			</tr>
130			<tr>
131			<td>
132				<br>
133			</td>
134			</tr>
135			<tr>
136				<th><fmt:message key="home.chart.download"/></th>
137				<th><fmt:message key="home.chart.upload"/></th>
138			</tr>
139			<tr>
140				<td><img src="<c:url value="/userChart.view"><c:param name="type" value="download"/></c:url>"  width="90%" alt=""></td>
141				<td><img src="<c:url value="/userChart.view"><c:param name="type" value="upload"/></c:url>"  width="90%" alt=""></td>
142			</tr>
143	</table>
144	</c:when>
145        <c:otherwise>
146			<c:if test="${not empty model.songs}">
147				<table>
148					<tr style="padding-top:2.5em">
149					</tr>
150					<tr>
151						<madsonic:url value="statistics.view" var="previousUrl">
152							<madsonic:param name="listOffset" value="${model.listOffset - model.listSize}"/>
153							<madsonic:param name="listType" value="${model.listType}"/>
154							</madsonic:url>
155						<madsonic:url value="statistics.view" var="nextUrl">
156							<madsonic:param name="listOffset" value="${model.listOffset + model.listSize}"/>
157							<madsonic:param name="listType" value="${model.listType}"/>
158							</madsonic:url>
159
160                    <c:if test="${model.listOffset gt 0}">
161                        <td style="padding-right:1.5em"><i class="fa fa-chevron-left icon control"></i>&nbsp;<a href="${previousUrl}"><fmt:message key="common.previous"/></a></td>
162                    </c:if>
163						<td style="padding-right:1.5em"><fmt:message key="statistics.title"><fmt:param value="${model.listOffset + 1}"/><fmt:param value="${model.listOffset + model.listSize}"/></fmt:message></td>
164                    <c:if test="${fn:length(model.songs) eq model.listSize}">
165						<td><i class="fa fa-chevron-right icon control"></i>&nbsp;<a href="${nextUrl}"><fmt:message key="common.next"/></a></td>
166                    </c:if>
167
168					</tr>
169				</table>
170				<br>
171				<table class="music" style="border-collapse:collapse">
172					<c:forEach items="${model.songs}" var="song" varStatus="loopStatus">
173
174						<madsonic:url value="/main.view" var="mainUrl">
175							<madsonic:param name="path" value="${song.parentPath}"/>
176						</madsonic:url>
177
178						<tr>
179                            <td ${loopStatus.count % 2 == 1 ? "class='fit bgcolor2'" : "class='fit'"} style="padding-left:0.5em">
180                            <c:import url="coverArtThumb.jsp">
181                                        <c:param name="albumId" value="${song.id}"/>
182                                        <c:param name="auth" value="${song.hash}"/>
183                                        <c:param name="artistName" value="${song.name}"/>
184                                        <c:param name="coverArtSize" value="50"/>
185                                        <c:param name="scale" value="0.5"/>
186                                        <c:param name="showLink" value="true"/>
187                                        <c:param name="showZoom" value="false"/>
188                                        <c:param name="showChange" value="false"/>
189                                        <c:param name="showArtist" value="false"/>
190                                        <c:param name="typArtist" value="true"/>
191                                        <c:param name="appearAfter" value="${loopStatus.count * 15}"/>
192                            </c:import>
193                            </td>
194
195                            <td ${loopStatus.count % 2 == 1 ? "class='fit bgcolor2'" : "class='fit'"} style="padding-left:0.5em;padding-right:0.5em">
196							<c:import url="playAddDownload.jsp">
197								<c:param name="id" value="${song.id}"/>
198								<c:param name="video" value="${song.video and model.player.web}"/>
199								<c:param name="playEnabled" value="${model.user.streamRole and not model.partyMode and model.buttonVisibility.playVisible}"/>
200								<c:param name="playAddEnabled" value="${model.user.streamRole and not model.partyMode and model.buttonVisibility.playAddVisible}"/>
201								<c:param name="playMoreEnabled" value="${model.user.streamRole and not model.partyMode and model.buttonVisibility.playMoreVisible}"/>
202								<c:param name="addEnabled" value="${model.user.streamRole and (not model.partyMode or not song.directory) and model.buttonVisibility.addContextVisible}"/>
203								<c:param name="addNextEnabled" value="${model.user.streamRole and (not model.partyMode or not song.directory) and model.buttonVisibility.addNextVisible}"/>
204								<c:param name="addLastEnabled" value="${model.user.streamRole and (not model.partyMode or not song.directory) and model.buttonVisibility.addLastVisible}"/>
205								<c:param name="downloadEnabled" value="${model.user.downloadRole and not model.partyMode and model.buttonVisibility.downloadVisible}"/>
206								<c:param name="artist" value="${fn:escapeXml(song.artist)}"/>
207								<c:param name="title" value="${song.title}"/>
208								<c:param name="starEnabled" value="${model.buttonVisibility.starredVisible}"/>
209								<c:param name="starred" value="${not empty song.starredDate}"/>
210                                <c:param name="loveEnabled" value="${model.buttonVisibility.lovedVisible}"/>
211                                <c:param name="loved" value="${not empty song.lovedDate}"/>
212								<c:param name="asTable" value="false"/>
213								<c:param name="YoutubeEnabled" value="${model.buttonVisibility.youtubeVisible}"/>
214							</c:import>
215                            </td>
216
217							<td ${loopStatus.count % 2 == 1 ? "class='bgcolor2'" : ""} style="padding-left:0.25em;padding-right:1.25em">
218								<str:truncateNicely upper="40">${song.title}</str:truncateNicely>
219							</td>
220
221							<td ${loopStatus.count % 2 == 1 ? "class='bgcolor2'" : ""} style="padding-right:1.25em">
222								<a href="${mainUrl}"><span class="detail"><str:truncateNicely upper="40">${song.albumName}</str:truncateNicely></span></a>
223
224							</td>
225
226							<td ${loopStatus.count % 2 == 1 ? "class='bgcolor2'" : ""} style="padding-right:1.50em">
227								<span class="detail"><str:truncateNicely upper="40">${song.artist}</str:truncateNicely></span>
228
229							</td>
230							<c:choose>
231								<c:when test="${model.listType eq 'topplayed'}">
232									<td ${loopStatus.count % 2 == 1 ? "class='bgcolor2'" : ""} style="padding-right:1.50em">
233										<span class="detailcolor">(${song.playCount}x)</span>
234									</td>
235								</c:when>
236							</c:choose>
237							<c:choose>
238								<c:when test="${model.listType eq 'overall'}">
239									<td ${loopStatus.count % 2 == 1 ? "class='bgcolor2'" : ""} style="padding-right:1.50em">
240										<span class="detailcolor">(${song.playCount}x)</span>
241									</td>
242								</c:when>
243							</c:choose>
244							<td ${loopStatus.count % 2 == 1 ? "class='bgcolor2'" : ""} style="padding-right:0.75em">
245								<span class="detail">${fn:substring(song.lastPlayed, 0, 16)}</span>
246							</td>
247							</tr>
248
249					</c:forEach>
250				</table>
251			</c:if>
252</c:otherwise>
253</c:choose>
254
255<!-- CONTENT -->
256</div>
257
258<c:if test="${model.customScrollbar}">
259<script type="text/javascript">
260        (function($){
261            $(window).load(function(){
262
263                $("#content_main").mCustomScrollbar({
264                    axis:"y",
265                    scrollInertia:880, /*scrolling inertia: integer (milliseconds)*/
266  		    scrollEasing:"easeOutCubic", /*scrolling easing: string*/
267                    mouseWheel:true, /*mousewheel support: boolean*/
268                    mouseWheelPixels:"auto", /*mousewheel pixels amount: integer, "auto"*/
269                    autoDraggerLength:true, /*auto-adjust scrollbar dragger length: boolean*/
270                    autoHideScrollbar:false, /*auto-hide scrollbar when idle*/
271                    scrollButtons:{ enable:true, /*scroll buttons support: boolean*/
272                                    scrollType:"continuous", /*scroll buttons scrolling type: "continuous", "pixels"*/
273                                    scrollSpeed:"auto", /*scroll buttons continuous scrolling speed: integer, "auto"*/
274                                    scrollAmount:40 /*scroll buttons pixels scroll amount: integer (pixels)*/},
275                                    theme:"${model.customScrollbarTheme}",
276                                    scrollbarPosition:"inside"
277                });
278            });
279        })(jQuery);
280
281$(".content_main").resize(function(e){
282    $(".content_main").mCustomScrollbar("update");
283});
284</script>
285</c:if>
286
287</body>
288</html>