I2PSnark UI changes: add a splash of color! Fix for light i2ptunnels theme.

This commit is contained in:
z3d
2009-07-23 17:01:43 +00:00
parent fb47eef218
commit 718f73ebb1
10 changed files with 166 additions and 73 deletions

View File

@ -339,20 +339,20 @@ public class SnarkManager implements Snark.CompleteListener {
}
if (_util.shouldUseOpenTrackers() != useOpenTrackers) {
_config.setProperty(I2PSnarkUtil.PROP_USE_OPENTRACKERS, useOpenTrackers + "");
addMessage((useOpenTrackers ? "En" : "Dis") + "abled open trackers - torrent restart required to take effect");
addMessage((useOpenTrackers ? "En" : "Dis") + "abled open trackers - torrent restart required to take effect.");
changed = true;
}
if (openTrackers != null) {
if (openTrackers.trim().length() > 0 && !openTrackers.trim().equals(_util.getOpenTrackerString())) {
_config.setProperty(I2PSnarkUtil.PROP_OPENTRACKERS, openTrackers.trim());
addMessage("Open Tracker list changed - torrent restart required to take effect");
addMessage("Open Tracker list changed - torrent restart required to take effect.");
changed = true;
}
}
if (changed) {
saveConfig();
} else {
addMessage("Configuration unchanged");
addMessage("Configuration unchanged.");
}
}
@ -362,7 +362,7 @@ public class SnarkManager implements Snark.CompleteListener {
DataHelper.storeProps(_config, _configFile);
}
} catch (IOException ioe) {
addMessage("Unable to save the config to '" + _configFile.getAbsolutePath() + "'");
addMessage("Unable to save the config to '" + _configFile.getAbsolutePath() + "'.");
}
}
@ -383,7 +383,7 @@ public class SnarkManager implements Snark.CompleteListener {
addMessage("Connecting to I2P");
boolean ok = _util.connect();
if (!ok) {
addMessage("Error connecting to I2P - check your I2CP settings");
addMessage("Error connecting to I2P - check your I2CP settings!");
return;
}
}
@ -446,9 +446,9 @@ public class SnarkManager implements Snark.CompleteListener {
File f = new File(filename);
if (!dontAutoStart && shouldAutoStart()) {
torrent.startTorrent();
addMessage("Torrent added and started: '" + f.getName() + "'");
addMessage("Torrent added and started: '" + f.getName() + "'.");
} else {
addMessage("Torrent added: '" + f.getName() + "'");
addMessage("Torrent added: '" + f.getName() + "'.");
}
}
@ -544,24 +544,24 @@ public class SnarkManager implements Snark.CompleteListener {
// basic validation of url
if ((!announce.startsWith("http://")) ||
(announce.indexOf(".i2p/") < 0)) // need to do better than this
return "Non-i2p tracker in " + info.getName() + ", deleting it";
return "Non-i2p tracker in " + info.getName() + ", removing it from our list of trackers!";
List files = info.getFiles();
if ( (files != null) && (files.size() > MAX_FILES_PER_TORRENT) ) {
return "Too many files in " + info.getName() + " (" + files.size() + "), deleting it";
return "Too many files in " + info.getName() + " (" + files.size() + "), deleting it!";
} else if (info.getPieces() <= 0) {
return "No pieces in " + info.getName() + "? deleting it";
return "No pieces in " + info.getName() + "? deleting it!";
} else if (info.getPieceLength(0) > Storage.MAX_PIECE_SIZE) {
return "Pieces are too large in " + info.getName() + " (" + DataHelper.formatSize(info.getPieceLength(0)) +
"B), deleting it";
"B), deleting it.";
} else if (info.getTotalLength() > Storage.MAX_TOTAL_SIZE) {
System.out.println("torrent info: " + info.toString());
List lengths = info.getLengths();
if (lengths != null)
for (int i = 0; i < lengths.size(); i++)
System.out.println("File " + i + " is " + lengths.get(i) + " long");
System.out.println("File " + i + " is " + lengths.get(i) + " long.");
return "Torrents larger than " + DataHelper.formatSize(Storage.MAX_TOTAL_SIZE) +
"B are not supported yet (because we're paranoid): " + info.getName() + ", deleting it";
"B are not supported yet (because we're paranoid): " + info.getName() + ", deleting it!";
} else {
// ok
return null;
@ -598,7 +598,7 @@ public class SnarkManager implements Snark.CompleteListener {
////_util.
}
if (!wasStopped)
addMessage("Torrent stopped: '" + sfile.getName() + "'");
addMessage("Torrent stopped: '" + sfile.getName() + "'.");
}
return torrent;
}
@ -613,7 +613,7 @@ public class SnarkManager implements Snark.CompleteListener {
torrentFile.delete();
if (torrent.storage != null)
removeTorrentStatus(torrent.storage.getMetaInfo());
addMessage("Torrent removed: '" + torrentFile.getName() + "'");
addMessage("Torrent removed: '" + torrentFile.getName() + "'.");
}
}
@ -646,7 +646,7 @@ public class SnarkManager implements Snark.CompleteListener {
public void torrentComplete(Snark snark) {
File f = new File(snark.torrent);
long len = snark.meta.getTotalLength();
addMessage("Download complete of " + f.getName() + " (size: " + DataHelper.formatSize(len) + "B)");
addMessage("Download finished: " + f.getName() + " (size: " + DataHelper.formatSize(len) + "B)");
updateStatus(snark);
}
@ -674,7 +674,7 @@ public class SnarkManager implements Snark.CompleteListener {
// already known. noop
} else {
if (shouldAutoStart() && !_util.connect())
addMessage("Unable to connect to I2P");
addMessage("Unable to connect to I2P!");
addTorrent((String)foundNames.get(i), !shouldAutoStart());
}
}

View File

@ -83,8 +83,8 @@ public class I2PSnarkServlet extends HttpServlet {
out.write("<meta http-equiv=\"refresh\" content=\"300;" + req.getRequestURI() + peerString + "\">\n");
out.write(HEADER);
out.write("</head><body>");
out.write("<div class=\"page\"><table border=\"0\" width=\"100%\"><tr><td align=\"center\" class=\"snarkTitle\"><a href=\"" + req.getRequestURI() + peerString + "\" title=\"I2PSnark (Manual Page Refresh)\"><img src=\"/themes/console/images/i2psnark.png\" alt=\"I2PSnark Anonymous BitTorrent Client\" border=\"0\"></a><hr>");
out.write("<a href=\"http://forum.i2p/viewforum.php?f=21\" class=\"snarkRefresh\">Forum</a>\n");
out.write("<div class=\"page\"><table border=\"0\" width=\"100%\"><tr><td align=\"center\" class=\"snarkTitle\"><a href=\"" + req.getRequestURI() + peerString + "\" title=\"I2PSnark (Manual Page Refresh)\"><img src=\"/themes/console/images/i2psnark.png\" alt=\"I2PSnark Anonymous BitTorrent Client\" border=\"0\" class=\"snarklogo\"></a><br>");
out.write("<a href=\"http://forum.i2p/viewforum.php?f=21\" class=\"snarkRefresh\" target=\"_blank\">Forum</a>\n");
Map trackers = _manager.getTrackers();
for (Iterator iter = trackers.entrySet().iterator(); iter.hasNext(); ) {
Map.Entry entry = (Map.Entry)iter.next();
@ -94,10 +94,10 @@ public class I2PSnarkServlet extends HttpServlet {
if (e < 0)
continue;
baseURL = baseURL.substring(e + 1);
out.write("<a href=\"" + baseURL + "\" class=\"snarkRefresh\">" + name + "</a>");
out.write("<a href=\"" + baseURL + "\" class=\"snarkRefresh\" target=\"_blank\">" + name + "</a>");
}
out.write("</table>\n");
out.write("<div class=\"section\"><div class=\"snarkMessages\"><table><tr><td valign=\"top\" align=\"left\"><pre>");
out.write("<div class=\"mainsection\"><div class=\"snarkMessages\"><table><tr><td valign=\"top\" align=\"left\"><pre>");
List msgs = _manager.getMessages();
for (int i = msgs.size()-1; i >= 0; i--) {
String msg = (String)msgs.get(i);
@ -353,7 +353,7 @@ public class I2PSnarkServlet extends HttpServlet {
}
}
} else if ("StopAll".equals(action)) {
_manager.addMessage("Stopping all torrents and closing the I2P tunnel");
_manager.addMessage("Stopping all torrents and closing the I2P tunnel.");
List snarks = getSortedSnarks(req);
for (int i = 0; i < snarks.size(); i++) {
Snark snark = (Snark)snarks.get(i);
@ -362,10 +362,10 @@ public class I2PSnarkServlet extends HttpServlet {
}
if (_manager.util().connected()) {
_manager.util().disconnect();
_manager.addMessage("I2P tunnel closed");
_manager.addMessage("I2P tunnel closed.");
}
} else if ("StartAll".equals(action)) {
_manager.addMessage("Opening the I2P tunnel and starting all torrents");
_manager.addMessage("Opening the I2P tunnel and starting all torrents.");
List snarks = getSortedSnarks(req);
for (int i = 0; i < snarks.size(); i++) {
Snark snark = (Snark)snarks.get(i);
@ -510,9 +510,9 @@ public class I2PSnarkServlet extends HttpServlet {
if (e < 0)
continue;
baseURL = baseURL.substring(e + 1);
out.write("&nbsp;&nbsp;&nbsp;(<a href=\"" + baseURL + "details.php?dllist=1&filelist=1&info_hash=");
out.write("&nbsp;&nbsp;&nbsp;[<a href=\"" + baseURL + "details.php?dllist=1&filelist=1&info_hash=");
out.write(TrackerClient.urlencode(snark.meta.getInfoHash()));
out.write("\" title=\"" + name + " Tracker\">Details</a>)");
out.write("\" title=\"" + name + " Tracker\">Details</a>]");
break;
}
}
@ -652,7 +652,7 @@ public class I2PSnarkServlet extends HttpServlet {
// *not* enctype="multipart/form-data", so that the input type=file sends the filename, not the file
out.write("<form action=\"" + uri + "\" method=\"POST\">\n");
out.write("<input type=\"hidden\" name=\"nonce\" value=\"" + _nonce + "\" />\n");
out.write("<div class=\"section\"><span class=\"snarkConfigTitle\">Add Torrent:</span><br />\n");
out.write("<div class=\"addtorrentsection\"><span class=\"snarkConfigTitle\">Add Torrent:</span><br />\n");
out.write("From URL&nbsp;: <input type=\"text\" name=\"newURL\" size=\"80\" value=\"" + newURL + "\" /> \n");
// not supporting from file at the moment, since the file name passed isn't always absolute (so it may not resolve)
//out.write("From file: <input type=\"file\" name=\"newFile\" size=\"50\" value=\"" + newFile + "\" /><br />\n");
@ -668,7 +668,7 @@ public class I2PSnarkServlet extends HttpServlet {
if (baseFile == null)
baseFile = "";
out.write("<div class=\"section\"><span class=\"snarkNewTorrent\">\n");
out.write("<div class=\"newtorrentsection\"><span class=\"snarkNewTorrent\">\n");
// *not* enctype="multipart/form-data", so that the input type=file sends the filename, not the file
out.write("<form action=\"" + uri + "\" method=\"POST\">\n");
out.write("<input type=\"hidden\" name=\"nonce\" value=\"" + _nonce + "\" />\n");
@ -704,7 +704,7 @@ public class I2PSnarkServlet extends HttpServlet {
//int seedPct = 0;
out.write("<form action=\"" + uri + "\" method=\"POST\">\n");
out.write("<div class=\"section\"><span class=\"snarkConfig\">\n");
out.write("<div class=\"configsection\"><span class=\"snarkConfig\">\n");
out.write("<input type=\"hidden\" name=\"nonce\" value=\"" + _nonce + "\" />\n");
out.write("<span class=\"snarkConfigTitle\">Configuration:</span><br />\n");
out.write("Data directory: <input type=\"text\" size=\"40\" name=\"dataDir\" value=\"" + dataDir + "\" ");

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -26,7 +26,7 @@ label {
padding: 1px 10px 2px 0px;
float: left;
width: 120px;
height: 28px;
height: 24px;
font-weight: normal;
text-align: right;
font-size: 8pt;
@ -34,6 +34,7 @@ label {
-moz-box-sizing: border-box;
box-sizing: border-box;
line-height: 120%;
color: #427;
}
h4 {
@ -84,7 +85,7 @@ br {
div.statusNotRunning {
float: left;
width: 72px;
width: 68px;
height: 24px;
overflow: hidden;
color: #d00;
@ -95,7 +96,7 @@ div.statusNotRunning {
div.statusRunning {
float: left;
width: 72px;
width: 68px;
height: 24px;
overflow: hidden;
color: #0b0;
@ -106,7 +107,7 @@ div.statusRunning {
div.statusStarting {
float: left;
width: 72px;
width: 68px;
height: 24px;
overflow: hidden;
color: #339933;

View File

@ -11,14 +11,10 @@ body {
text-align: center;
}
.snarkRefresh {
font-size: 9pt;
}
.snarkRefresh {
border: 1px outset #001;
padding: 1px 10px;
background: #ffb;
background: #eef;
text-decoration: none;
border-radius: 4px;
-moz-border-radius: 4px;
@ -31,15 +27,32 @@ body {
text-transform: uppercase;
}
.snarkRefresh a:hover{
border: 1px inset #001;
padding: 1px 10px;
background: #003;
text-decoration: none;
border-radius: 4px;
-moz-border-radius: 4px;
-khtml-border-radius: 4px;
font-size: 9pt;
font-weight: bold;
margin: -10px 3px 0 3px;
text-align: center;
vertical-align: middle;
text-transform: uppercase;
color: #f60;
}
.snarkMessages {
background-color: #fe9;
background-color: #f83;
font-family: "Lucida Console", "DejaVu Sans Mono", Courier, mono !important;
font-size: 9pt;
font-weight: bold;
text-align: left;
margin: 0 0 15px 0;
border: 0px;
padding: 5px;
padding: 0px;
border-spacing: 0px;
-moz-border-radius: 4px;
-khtml-border-radius: 4px;
@ -47,7 +60,9 @@ body {
border: 2px inset #770;
text-align: center;
overflow-x: scroll;
background: #ddf url('../console/light/images/lightbluetile.png');
background: #ddf url('../console/images/orangetile.png');
color: #531;
height: 64px;
}
pre {
@ -55,6 +70,8 @@ pre {
width: 100%;
font-size: 8pt;
padding: 0;
text-align: left !important;
height: 8px;
}
table {
@ -64,12 +81,14 @@ table {
border-width: 0px;
border-spacing: 0px;
}
th {
background-color: #f91;
padding: 5px;
font-size: 9pt;
font-size: 8pt;
border-top: 1px outset #001;
border-bottom: 1px inset #001;
background: #f91 url('.../console/images/tabletitleorangealt.png') repeat-x;
text-align: center;
}
.SnarkTorrents {
@ -79,20 +98,21 @@ th {
td {
padding: 5px;
text-align: center;
}
.snarkTorrentEven {
background-color: #fb1;
font-size: 8pt;
font-size: 7pt;
}
.snarkTorrentOdd {
background-color: #fa1;
font-size: 8pt;
font-size: 7pt;
}
.snarkNewTorrent {
font-size: 10pt;
font-size: 9pt;
}
.snarkAddInfo {
font-size: 10pt;
font-size: 9pt;
line-height: 130% !important;
}
.snarkConfigTitle {
@ -107,7 +127,7 @@ td {
.page {
background-color: #fff;
color:#001;
color:#310;
margin: 20px;
padding: 10px 20px 5px 20px;
-moz-border-radius: 4px;
@ -118,7 +138,7 @@ td {
line-height: 160% !important;
-moz-box-shadow: inset 0px 0px 1px 0px #002;
text-align: center;
background: #ddf url('../console/light/images/sandtile.png');
background: #ddf url('../console/light/images/lightbluetile.png');
}
form {
@ -138,40 +158,27 @@ hr {
background: #003;
height: 1px;
border: 0px solid #003;
margin: 5px 0;
}
div.section {
margin: 0 0 20px 0;
padding: 10px;
background: #ffe;
border: 1px solid #001;
text-align: left;
color: #001;
-moz-border-radius: 4px;
-khtml-border-radius: 4px;
border-radius: 4px;
-moz-box-shadow: inset 0px 0px 1px 0px #002;
word-wrap: break-word;
width: 100%;
margin: 10px 0 7px 0;
text-align: center;
}
a:link{
color: #830;
text-decoration: none;
font-weight: bold;
word-wrap: break-word;
color: #830;
text-decoration: none;
font-weight: bold;
word-wrap: break-word;
}
a:visited{
color: #606;
text-decoration: none;
font-weight: bold;
color: #606;
text-decoration: none;
font-weight: bold;
}
a:hover{
color: #f60;
font-weight: bold;
color: #f60;
font-weight: bold;
}
input {
@ -188,4 +195,89 @@ select {
color: #310;
font-size: 9pt;
}
img {
border: none;
margin: 5px 5px 10px 5px;
}
div.section {
margin: 0 0 20px 0;
padding: 10px;
background: #ffe;
border: 1px solid #001;
text-align: center;
color: #001;
-moz-border-radius: 4px;
-khtml-border-radius: 4px;
border-radius: 4px;
-moz-box-shadow: inset 0px 0px 1px 0px #002;
word-wrap: break-word;
text-align: center;
background: #ffe url('../console/light/images/tabletile.png');
}
div.mainsection {
margin: 0 0 20px 0;
padding: 10px;
background: #ffe;
border: 1px solid #001;
text-align: center;
color: #001;
-moz-border-radius: 4px;
-khtml-border-radius: 4px;
border-radius: 4px;
-moz-box-shadow: inset 0px 0px 1px 0px #002;
word-wrap: break-word;
text-align: center;
background: #ffe url('../console/light/images/tabletile.png');
}
div.newtorrentsection {
margin: 0 0 20px 0;
padding: 10px;
background: #ffe;
border: 1px solid #001;
text-align: center;
color: #001;
-moz-border-radius: 4px;
-khtml-border-radius: 4px;
border-radius: 4px;
-moz-box-shadow: inset 0px 0px 1px 0px #002;
word-wrap: break-word;
text-align: center;
background: #ffe url('../console/images/yellowtile.png');
}
div.addtorrentsection {
margin: 0 0 20px 0;
padding: 10px;
background: #ffe;
border: 1px solid #001;
text-align: center;
color: #001;
-moz-border-radius: 4px;
-khtml-border-radius: 4px;
border-radius: 4px;
-moz-box-shadow: inset 0px 0px 1px 0px #002;
word-wrap: break-word;
text-align: center;
background: #ffe url('../console/images/greentile.png');
}
div.configsection {
margin: 0 0 20px 0;
padding: 10px;
background: #ffe;
border: 1px solid #001;
text-align: center;
color: #fff;
-moz-border-radius: 4px;
-khtml-border-radius: 4px;
border-radius: 4px;
-moz-box-shadow: inset 0px 0px 1px 0px #002;
word-wrap: break-word;
text-align: center;
background: #ffe url('../console/images/redtile.png');
}