Edit torrent UI fixes

after review by drzed. More to follow.
This commit is contained in:
zzz
2021-11-25 09:51:32 -05:00
parent 43fd47cc7f
commit 9a537e2207

View File

@@ -3064,7 +3064,7 @@ public class I2PSnarkServlet extends BasicServlet {
r = new File("");
}
boolean showStopStart = snark != null;
boolean showStopStart = snark != null && !showEdit;
Storage storage = snark != null ? snark.getStorage() : null;
boolean showPriority = storage != null && !storage.complete() &&
r.isDirectory();
@@ -4185,13 +4185,13 @@ public class I2PSnarkServlet extends BasicServlet {
return;
buf.append("<div id=\"snarkCommentSection\"><table class=\"snarkTorrentInfo\">\n<tr><th colspan=\"5\">")
.append(_t("Edit Torrent"))
.append("</th></tr><tr><td colspan=\"3\"></td><td>").append("Primary").append("</td><td>")
.append("Delete").append(" / ").append("Add").append("</td></tr>");
.append("</th></tr>");
boolean isRunning = !snark.isStopped();
if (isRunning) {
// shouldn't happen
buf.append(_t("Torrent must be stopped"));
buf.append("</th></table></div></form>");
buf.append("<tr><td colspan=\"5\">")
.append(_t("Torrent must be stopped"))
.append("</td></tr></table></div></form>");
return;
}
String announce = meta.getAnnounce();
@@ -4216,6 +4216,8 @@ public class I2PSnarkServlet extends BasicServlet {
if (announce != null)
annlist.add(announce);
if (!annlist.isEmpty()) {
buf.append("<tr><td colspan=\"3\"></td><td>").append("Primary").append("</td><td>")
.append("Delete").append("</td></tr>");
for (String s : annlist) {
int hc = s.hashCode();
buf.append("<tr><td>");
@@ -4246,21 +4248,25 @@ public class I2PSnarkServlet extends BasicServlet {
if (announceURL.equals(announce) || annlist.contains(announceURL))
iter.remove();
}
for (Tracker t : newTrackers) {
String name = t.name;
int hc = t.announceURL.hashCode();
String announceURL = t.announceURL.replace("&#61;", "=");
buf.append("<tr><td>");
toThemeImg(buf, "details");
buf.append("</td><td><b>")
.append(_t("Add Tracker")).append("</b></td><td>");
buf.append(name);
buf.append("</td><td><input type=\"radio\" class=\"optbox\" name=\"primary\" value=\"");
buf.append(hc);
buf.append("\"></td><td>");
buf.append("<input type=\"checkbox\" class=\"optbox\" id=\"").append(name).append("\" name=\"tradd.")
.append(hc).append("\" title=\"").append(_t("Add tracker")).append("\"> ")
.append("<td></td></tr>\n");
if (!newTrackers.isEmpty()) {
buf.append("<tr><td colspan=\"3\"></td><td>").append("Primary").append("</td><td>")
.append("Add").append("</td></tr>");
for (Tracker t : newTrackers) {
String name = t.name;
int hc = t.announceURL.hashCode();
String announceURL = t.announceURL.replace("&#61;", "=");
buf.append("<tr><td>");
toThemeImg(buf, "details");
buf.append("</td><td><b>")
.append(_t("Add Tracker")).append("</b></td><td>");
buf.append(name);
buf.append("</td><td><input type=\"radio\" class=\"optbox\" name=\"primary\" value=\"");
buf.append(hc);
buf.append("\"></td><td>");
buf.append("<input type=\"checkbox\" class=\"optbox\" id=\"").append(name).append("\" name=\"tradd.")
.append(hc).append("\" title=\"").append(_t("Add tracker")).append("\"> ")
.append("</td><td></td></tr>\n");
}
}
String com = meta.getComment();
@@ -4288,8 +4294,8 @@ public class I2PSnarkServlet extends BasicServlet {
buf.append("</td><td><b>")
.append(_t("Created By")).append("</b></td>");
buf.append("<td id=\"editTorrentCreatedBy\"><input type=\"text\" name=\"nofilter_newTorrentCreatedBy\" cols=\"44\" rows=\"1\" value=\"")
.append(cb).append("\"></td>");
//// new id
.append(cb).append("\"></td></tr>");
buf.append("<tr id=\"torrentInfoControl\"><td colspan=\"5\">");
buf.append("<input type=\"submit\" name=\"editTorrent\" value=\"");
buf.append(_t("Save Changes"));