From 5caefb5ea92e8e37c16a5f9abaa486032fae93a8 Mon Sep 17 00:00:00 2001 From: str4d <str4d@mail.i2p> Date: Sun, 14 May 2017 12:26:17 +0000 Subject: [PATCH] I2PSnark tweaks: - Replace theme selector with a message when universal theming is enabled - Move DHT debug info into its own <tr> --- .../src/org/klomp/snark/SnarkManager.java | 7 +++- .../org/klomp/snark/web/I2PSnarkServlet.java | 41 ++++++++++++------- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java b/apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java index 6735d42994..8241b91804 100644 --- a/apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java +++ b/apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java @@ -795,14 +795,17 @@ public class SnarkManager implements CompleteListener, ClientApp { updateConfig(); } + public boolean getUniversalTheming() { + return _context.getBooleanProperty(RC_PROP_UNIVERSAL_THEMING); + } + /** * Get current theme. * @return String -- the current theme */ public String getTheme() { String theme = _config.getProperty(PROP_THEME); - boolean universalTheming = _context.getBooleanProperty(RC_PROP_UNIVERSAL_THEMING); - if (universalTheming) { + if (getUniversalTheming()) { // Fetch routerconsole theme (or use our default if it doesn't exist) theme = _context.getProperty(RC_PROP_THEME, DEFAULT_THEME); // Ensure that theme exists diff --git a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java index 9d8b93f050..351e80e167 100644 --- a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java +++ b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java @@ -708,10 +708,6 @@ public class I2PSnarkServlet extends BasicServlet { out.write("</tt>"); } out.write("</span>"); - if (dht != null) { - if (showDebug) - out.write(dht.renderStatusHTML()); - } out.write("</th>\n"); if (_manager.util().connected() && total > 0) { out.write(" <th align=\"right\">" + formatSize(stats[0]) + "</th>\n" + @@ -722,6 +718,12 @@ public class I2PSnarkServlet extends BasicServlet { } else { out.write("<th colspan=\"5\"></th>"); } + if (dht != null) { + if (showDebug) { + out.write("</tr>\n<tr class=\"dhtDebug\">"); + out.write(dht.renderStatusHTML()); + } + } out.write("</tr></tfoot>\n"); } @@ -2270,19 +2272,28 @@ public class I2PSnarkServlet extends BasicServlet { out.write("<tr><td>"); out.write(_t("Theme")); - out.write(":<td colspan=\"2\"><select name='theme'>"); - String theme = _manager.getTheme(); - String[] themes = _manager.getThemes(); - Arrays.sort(themes); - for(int i = 0; i < themes.length; i++) { - if(themes[i].equals(theme)) - out.write("\n<OPTION value=\"" + themes[i] + "\" SELECTED>" + themes[i]); - else - out.write("\n<OPTION value=\"" + themes[i] + "\">" + themes[i]); + out.write(":<td colspan=\"2\">"); + if (_manager.getUniversalTheming()) { + out.write("<b>"); + out.write(_manager.getTheme()); + out.write("</b> (<a href=\"/configui\">"); + out.write(_t("Universal theming is enabled")); + out.write("</a>)"); + } else { + out.write("<select name='theme'>"); + String theme = _manager.getTheme(); + String[] themes = _manager.getThemes(); + Arrays.sort(themes); + for (int i = 0; i < themes.length; i++) { + if(themes[i].equals(theme)) + out.write("\n<OPTION value=\"" + themes[i] + "\" SELECTED>" + themes[i]); + else + out.write("\n<OPTION value=\"" + themes[i] + "\">" + themes[i]); + } + out.write("</select>\n"); } - out.write("</select>\n" + - "<tr><td>"); + out.write("<tr><td>"); out.write(_t("Refresh time")); out.write(":<td colspan=\"2\"><select name=\"refreshDelay\"" + " title=\""); -- GitLab