i2psnark:
- Set-all priority buttons (ticket #1376) - Move icons to resources dir, add js dir - Todo: more CSS
@ -100,15 +100,15 @@
|
||||
<target name="war" depends="jar, bundle, warUpToDate, listChangedFiles" unless="war.uptodate" >
|
||||
<!-- set if unset -->
|
||||
<property name="workspace.changes.tr" value="" />
|
||||
<copy todir="build/icons/.icons" >
|
||||
<fileset dir="../icons/" />
|
||||
<copy todir="build/resources/.resources" >
|
||||
<fileset dir="../resources/" />
|
||||
</copy>
|
||||
<!-- mime.properties must be in with the classes -->
|
||||
<copy file="../mime.properties" todir="build/obj/org/klomp/snark/web" />
|
||||
<war destfile="../i2psnark.war" webxml="../web.xml" >
|
||||
<!-- include only the web stuff, as of 0.7.12 the router will add i2psnark.jar to the classpath for the war -->
|
||||
<classes dir="./build/obj" includes="**/web/*" />
|
||||
<fileset dir="build/icons/" />
|
||||
<fileset dir="build/resources/" />
|
||||
<manifest>
|
||||
<attribute name="Implementation-Version" value="${full.version}" />
|
||||
<attribute name="Built-By" value="${build.built-by}" />
|
||||
@ -121,7 +121,7 @@
|
||||
|
||||
<target name="warUpToDate">
|
||||
<uptodate property="war.uptodate" targetfile="../i2psnark.war" >
|
||||
<srcfiles dir= "." includes="build/obj/org/klomp/snark/web/*.class ../icons/* ../web.xml" />
|
||||
<srcfiles dir= "." includes="build/obj/org/klomp/snark/web/*.class ../resources/**/* ../web.xml" />
|
||||
</uptodate>
|
||||
</target>
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
|
||||
private static final String DEFAULT_NAME = "i2psnark";
|
||||
public static final String PROP_CONFIG_FILE = "i2psnark.configFile";
|
||||
private static final String WARBASE = "/.icons/";
|
||||
private static final String WARBASE = "/.resources/";
|
||||
private static final char HELLIP = '\u2026';
|
||||
|
||||
public I2PSnarkServlet() {
|
||||
@ -2393,6 +2393,10 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
// dummy
|
||||
r = new File("");
|
||||
}
|
||||
|
||||
boolean showPriority = snark != null && snark.getStorage() != null && !snark.getStorage().complete() &&
|
||||
r.isDirectory();
|
||||
|
||||
StringBuilder buf=new StringBuilder(4096);
|
||||
buf.append(DOCTYPE).append("<HTML><HEAD><TITLE>");
|
||||
if (title.endsWith("/"))
|
||||
@ -2400,8 +2404,14 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
String directory = title;
|
||||
title = _("Torrent") + ": " + DataHelper.escapeHTML(title);
|
||||
buf.append(title);
|
||||
buf.append("</TITLE>").append(HEADER_A).append(_themePath).append(HEADER_B).append("<link rel=\"shortcut icon\" href=\"" + _themePath + "favicon.ico\">" +
|
||||
"</HEAD><BODY>\n<center><div class=\"snarknavbar\"><a href=\"").append(_contextPath).append("/\" title=\"Torrents\"");
|
||||
buf.append("</TITLE>\n").append(HEADER_A).append(_themePath).append(HEADER_B)
|
||||
.append("<link rel=\"shortcut icon\" href=\"" + _themePath + "favicon.ico\">\n");
|
||||
if (showPriority)
|
||||
buf.append("<script src=\"").append(_contextPath).append(WARBASE + "js/folder.js\" type=\"text/javascript\"></script>\n");
|
||||
buf.append("</HEAD><BODY");
|
||||
if (showPriority)
|
||||
buf.append(" onload=\"setupbuttons()\"");
|
||||
buf.append(">\n<center><div class=\"snarknavbar\"><a href=\"").append(_contextPath).append("/\" title=\"Torrents\"");
|
||||
buf.append(" class=\"snarkRefresh\"><img alt=\"\" border=\"0\" src=\"").append(_imgPath).append("arrow_refresh.png\"> ");
|
||||
if (_contextName.equals(DEFAULT_NAME))
|
||||
buf.append(_("I2PSnark"));
|
||||
@ -2411,8 +2421,6 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
|
||||
if (parent) // always true
|
||||
buf.append("<div class=\"page\"><div class=\"mainsection\">");
|
||||
boolean showPriority = snark != null && snark.getStorage() != null && !snark.getStorage().complete() &&
|
||||
r.isDirectory();
|
||||
if (showPriority) {
|
||||
buf.append("<form action=\"").append(base).append("\" method=\"POST\">\n");
|
||||
buf.append("<input type=\"hidden\" name=\"nonce\" value=\"").append(_nonce).append("\" >\n");
|
||||
@ -2737,19 +2745,19 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
if (showPriority) {
|
||||
buf.append("<td class=\"priority\">");
|
||||
if ((!complete) && (!item.isDirectory())) {
|
||||
buf.append("<input type=\"radio\" value=\"5\" name=\"pri.").append(item).append("\" ");
|
||||
buf.append("\n<input type=\"radio\" onclick=\"priorityclicked();\" class=\"prihigh\" value=\"5\" name=\"pri.").append(item).append("\" ");
|
||||
if (priority > 0)
|
||||
buf.append("checked=\"true\"");
|
||||
buf.append("checked=\"checked\"");
|
||||
buf.append('>').append(_("High"));
|
||||
|
||||
buf.append("<input type=\"radio\" value=\"0\" name=\"pri.").append(item).append("\" ");
|
||||
buf.append("\n<input type=\"radio\" onclick=\"priorityclicked();\" class=\"prinorm\" value=\"0\" name=\"pri.").append(item).append("\" ");
|
||||
if (priority == 0)
|
||||
buf.append("checked=\"true\"");
|
||||
buf.append("checked=\"checked\"");
|
||||
buf.append('>').append(_("Normal"));
|
||||
|
||||
buf.append("<input type=\"radio\" value=\"-9\" name=\"pri.").append(item).append("\" ");
|
||||
buf.append("\n<input type=\"radio\" onclick=\"priorityclicked();\" class=\"priskip\" value=\"-9\" name=\"pri.").append(item).append("\" ");
|
||||
if (priority < 0)
|
||||
buf.append("checked=\"true\"");
|
||||
buf.append("checked=\"checked\"");
|
||||
buf.append('>').append(_("Skip"));
|
||||
showSaveButton = true;
|
||||
}
|
||||
@ -2758,9 +2766,12 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
buf.append("</TR>\n");
|
||||
}
|
||||
if (showSaveButton) {
|
||||
buf.append("<thead><tr><th colspan=\"4\"> </th><th class=\"headerpriority\"><input type=\"submit\" value=\"");
|
||||
buf.append(_("Save priorities"));
|
||||
buf.append("\" name=\"foo\" ></th></tr></thead>\n");
|
||||
buf.append("<thead><tr><th colspan=\"4\"> </th><th class=\"headerpriority\">" +
|
||||
"<a class=\"control\" id=\"setallhigh\" href=\"javascript:void(null);\" onclick=\"setallhigh();\">").append(_("Set all high")).append("</a>\n" +
|
||||
"<a class=\"control\" id=\"setallnorm\" href=\"javascript:void(null);\" onclick=\"setallnorm();\">").append(_("Set all normal")).append("</a>\n" +
|
||||
"<a class=\"control\" id=\"setallskip\" href=\"javascript:void(null);\" onclick=\"setallskip();\">").append(_("Skip all")).append("</a>\n" +
|
||||
"<br><input type=\"submit\" class=\"accept\" value=\"").append(_("Save priorities")).append("\" name=\"savepri\" >\n" +
|
||||
"</th></tr></thead>\n");
|
||||
}
|
||||
buf.append("</table>\n");
|
||||
if (showPriority)
|
||||
@ -2829,12 +2840,12 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
|
||||
/** @since 0.7.14 */
|
||||
private String toImg(String icon) {
|
||||
return "<img alt=\"\" height=\"16\" width=\"16\" src=\"" + _contextPath + "/.icons/" + icon + ".png\">";
|
||||
return "<img alt=\"\" height=\"16\" width=\"16\" src=\"" + _contextPath + WARBASE + "icons/" + icon + ".png\">";
|
||||
}
|
||||
|
||||
/** @since 0.8.2 */
|
||||
private String toImg(String icon, String altText) {
|
||||
return "<img alt=\"" + altText + "\" height=\"16\" width=\"16\" src=\"" + _contextPath + "/.icons/" + icon + ".png\">";
|
||||
return "<img alt=\"" + altText + "\" height=\"16\" width=\"16\" src=\"" + _contextPath + WARBASE + "icons/" + icon + ".png\">";
|
||||
}
|
||||
|
||||
/** @since 0.8.1 */
|
||||
|
Before Width: | Height: | Size: 464 B After Width: | Height: | Size: 464 B |
Before Width: | Height: | Size: 733 B After Width: | Height: | Size: 733 B |
Before Width: | Height: | Size: 587 B After Width: | Height: | Size: 587 B |
Before Width: | Height: | Size: 673 B After Width: | Height: | Size: 673 B |
Before Width: | Height: | Size: 882 B After Width: | Height: | Size: 882 B |
Before Width: | Height: | Size: 889 B After Width: | Height: | Size: 889 B |
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 766 B |
Before Width: | Height: | Size: 653 B After Width: | Height: | Size: 653 B |
Before Width: | Height: | Size: 537 B After Width: | Height: | Size: 537 B |
Before Width: | Height: | Size: 578 B After Width: | Height: | Size: 578 B |
Before Width: | Height: | Size: 591 B After Width: | Height: | Size: 591 B |
Before Width: | Height: | Size: 385 B After Width: | Height: | Size: 385 B |
Before Width: | Height: | Size: 853 B After Width: | Height: | Size: 853 B |
Before Width: | Height: | Size: 635 B After Width: | Height: | Size: 635 B |
Before Width: | Height: | Size: 294 B After Width: | Height: | Size: 294 B |
Before Width: | Height: | Size: 591 B After Width: | Height: | Size: 591 B |
Before Width: | Height: | Size: 589 B After Width: | Height: | Size: 589 B |
Before Width: | Height: | Size: 591 B After Width: | Height: | Size: 591 B |
Before Width: | Height: | Size: 537 B After Width: | Height: | Size: 537 B |
93
apps/i2psnark/resources/js/folder.js
Normal file
@ -0,0 +1,93 @@
|
||||
function setupbuttons() {
|
||||
updatesetallbuttons();
|
||||
var form = document.forms[0];
|
||||
form.savepri.disabled = true;
|
||||
form.savepri.className = 'foo';
|
||||
}
|
||||
|
||||
function priorityclicked() {
|
||||
updatesetallbuttons();
|
||||
var form = document.forms[0];
|
||||
form.savepri.disabled = false;
|
||||
form.savepri.className = 'accept';
|
||||
}
|
||||
|
||||
function updatesetallbuttons() {
|
||||
var notNorm = false;
|
||||
var notHigh = false;
|
||||
var notSkip = false;
|
||||
var form = document.forms[0];
|
||||
for(i = 0; i < form.elements.length; i++) {
|
||||
var elem = form.elements[i];
|
||||
if (elem.type == 'radio') {
|
||||
if (!elem.checked) {
|
||||
if (elem.className == 'prinorm')
|
||||
notNorm = true;
|
||||
else if (elem.className == 'prihigh')
|
||||
notHigh = true;
|
||||
else
|
||||
notSkip = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (notNorm)
|
||||
document.getElementById('setallnorm').className = 'control';
|
||||
else
|
||||
document.getElementById('setallnorm').className = 'controld';
|
||||
if (notHigh)
|
||||
document.getElementById('setallhigh').className = 'control';
|
||||
else
|
||||
document.getElementById('setallhigh').className = 'controld';
|
||||
if (notSkip)
|
||||
document.getElementById('setallskip').className = 'control';
|
||||
else
|
||||
document.getElementById('setallskip').className = 'controld';
|
||||
}
|
||||
|
||||
function setallnorm() {
|
||||
var form = document.forms[0];
|
||||
for(i = 0; i < form.elements.length; i++) {
|
||||
var elem = form.elements[i];
|
||||
if (elem.type == 'radio') {
|
||||
if (elem.className === 'prinorm')
|
||||
elem.checked = true;
|
||||
}
|
||||
}
|
||||
document.getElementById('setallnorm').className = 'controld';
|
||||
document.getElementById('setallhigh').className = 'control';
|
||||
document.getElementById('setallskip').className = 'control';
|
||||
form.savepri.disabled = false;
|
||||
form.savepri.className = 'accept';
|
||||
}
|
||||
|
||||
function setallhigh() {
|
||||
var form = document.forms[0];
|
||||
for(i = 0; i < form.elements.length; i++) {
|
||||
var elem = form.elements[i];
|
||||
if (elem.type == 'radio') {
|
||||
if (elem.className === 'prihigh')
|
||||
elem.checked = true;
|
||||
}
|
||||
}
|
||||
document.getElementById('setallnorm').className = 'control';
|
||||
document.getElementById('setallhigh').className = 'controld';
|
||||
document.getElementById('setallskip').className = 'control';
|
||||
form.savepri.disabled = false;
|
||||
form.savepri.className = 'accept';
|
||||
}
|
||||
|
||||
function setallskip() {
|
||||
var form = document.forms[0];
|
||||
for(i = 0; i < form.elements.length; i++) {
|
||||
var elem = form.elements[i];
|
||||
if (elem.type == 'radio') {
|
||||
if (elem.className === 'priskip')
|
||||
elem.checked = true;
|
||||
}
|
||||
}
|
||||
document.getElementById('setallnorm').className = 'control';
|
||||
document.getElementById('setallhigh').className = 'control';
|
||||
document.getElementById('setallskip').className = 'controld';
|
||||
form.savepri.disabled = false;
|
||||
form.savepri.className = 'accept';
|
||||
}
|
@ -526,6 +526,36 @@ a:hover {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
a.control, a.controld {
|
||||
background: #989;
|
||||
border: 1px inset #bbb;
|
||||
border-radius: 4px;
|
||||
color: #000;
|
||||
font-weight: bold;
|
||||
margin: 2px 4px;
|
||||
padding: 2px;
|
||||
text-shadow: 0px 0px #410;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
a.controld {
|
||||
color: #444;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
a.control:hover {
|
||||
background-color: #f60;
|
||||
border: 1px outset #bbb;
|
||||
color: #fff;
|
||||
text-shadow: 0px 1px 5px #f00;
|
||||
}
|
||||
|
||||
a.control:active {
|
||||
background: #000 !important;
|
||||
color: #f60 !important;
|
||||
text-shadow: 0 !important;
|
||||
}
|
||||
|
||||
input {
|
||||
font-size: 8.5pt;
|
||||
font-weight: bold;
|
||||
|