I was looking at a thread requesting more admin controls the other day, so I went and added a little user/admin "recognition" to "the Packs" upload window. And why not share it with the world:
In admin mode, the full destination path can be edited (dangerous!) and you get to decide whether zipped stuff should be auto-extracted after upload.
In user mode and with upload right, destination path will be <music path>/Incoming/<username> and the user will not see the path. he can select a file or zip to be uploaded, but cannot decide whether zips should auto-extract. they will per default and the checkbox is invisible.
The screenshots roughly reflect the code.Though the layout is still the same, I tweaked it a bit for convenience. I removed the german
And the heading "User interface" too, was confusing and a bit belittling
Admin view:
User view:
To install:
1. BACKUP
2. shut down subsonic
3. open moree.jsp in
subsonic/jetty/xxxx/webapp/WEB-INF/jsp and find
- Code: Select all
<c:if test="${model.user.uploadRole}">
<h2></h2>
<form method="post" enctype="multipart/form-data" action="upwin.view">
<table>
<tr>
<td><fmt:message key="more.upload.source"/></td>
<td colspan="2"><input type="file" id="file" name="file" size="40"/></td>
</tr>
<tr>
<td><fmt:message key="more.upload.target"/></td>
<td><input type="text" id="dir" readonly="readonly" name="dir" size="37" value="${model.uploadDirectory}/${model.user.username}"/></td>
<td><input type="submit" value="<fmt:message key="more.upload.ok"/>"/></td>
</tr>
<tr>
<td colspan="2">
<input type="checkbox" checked name="unzip" id="unzip" class="checkbox"/>
<label for="unzip"><fmt:message key="more.upload.unzip"/></label>
</td>
</tr>
</table>
</form>
<p class="enter" id="progressText"/>
<div id="progressBar">
<div id="progressBarContent"/>
</div>
</c:if>
replace with
- Code: Select all
<!-- Upload Windows for normal users -->
<c:if test="${model.user.uploadRole and not model.user.adminRole}">
<h2></h2>
<form method="post" enctype="multipart/form-data" action="upwin.view">
<table>
<tr>
<td><fmt:message key="more.upload.source"/></td>
<td><input type="file" id="file" name="file" size="40"/></td>
</tr>
<tr>
<!-- <td><fmt:message key="more.upload.target"/></td> -->
<td><input type="hidden" id="dir" name="dir" size="37" value="${model.uploadDirectory}/${model.user.username}"/></td>
<td><b>You can upload single files and zipped folders. Zipped folders will be automatically extracted.</b></td>
</tr>
<tr>
<td colspan="2">
<input type="hidden" checked name="unzip" id="unzip" class="checkbox"/>
<!-- <label for="unzip"><fmt:message key="more.upload.unzip"/></label> -->
</td>
<td><input type="submit" value="<fmt:message key="more.upload.ok"/>"/></td>
</tr>
</table>
</form>
<p class="enter" id="progressText"/>
<div id="progressBar">
<div id="progressBarContent"/>
</div>
</c:if>
<!-- Upload Win for Admin -->
<c:if test="${model.user.adminRole}">
<h2>Admin Interface</h2>
<form method="post" enctype="multipart/form-data" action="upwin.view">
<table>
<tr>
<td><fmt:message key="more.upload.source"/></td>
<td><input type="file" id="file" name="file" size="40"/></td>
</tr>
<tr>
<td><fmt:message key="more.upload.target"/></td>
<td><input type="text" id="dir" name="dir" size="56" value="${model.uploadDirectory}/${model.user.username}"/></td>
</tr>
<tr>
<td colspan="2">
<input type="checkbox" checked name="unzip" id="unzip" class="checkbox"/>
<label for="unzip"><fmt:message key="more.upload.unzip"/></label>
</td>
<td><input type="submit" value="<fmt:message key="more.upload.ok"/>"/></td>
</tr>
<tr><td colspan="3"><b>You are admin, you already know everything I could possibly print here.</b></td></tr>
</table>
</form>
<p class="enter" id="progressText"/>
<div id="progressBar">
<div id="progressBarContent"/>
</div>
</c:if>
4. save file
5. clear jetty cache
6. start subsonic
This is based on my own modification of cyclopes SS pack. I left anything from his original mod mostly intact, just commented some stuff out so you can easyly restore to that layout or just change little bits.
awaiting feedback