I2PSnark tweaks:

- Replace theme selector with a message when universal theming is enabled
- Move DHT debug info into its own <tr>
This commit is contained in:
str4d
2017-05-14 12:26:17 +00:00
parent 6f60d642af
commit 5caefb5ea9
2 changed files with 31 additions and 17 deletions

View File

@ -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

View File

@ -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=\"");