forked from I2P_Developers/i2p.i2p
* Console:
- More tagging - Show user-installed themes on configui.jsp - Fix reseed button spacing * GraphHelper cleanup * Susidns: add link to subscription faq
This commit is contained in:
@ -1,13 +1,15 @@
|
||||
package net.i2p.router.web;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.TreeSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class ConfigUIHelper extends HelperBase {
|
||||
public ConfigUIHelper() {}
|
||||
|
||||
private static final String themes[] = {_x("classic"), _x("dark"), _x("light")};
|
||||
|
||||
public String getSettings() {
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
String current = _context.getProperty(CSSHelper.PROP_THEME_NAME, CSSHelper.DEFAULT_THEME);
|
||||
Set<String> themes = themeSet();
|
||||
for (String theme : themes) {
|
||||
buf.append("<input type=\"radio\" class=\"optbox\" name=\"theme\" ");
|
||||
if (theme.equals(current))
|
||||
@ -17,10 +19,28 @@ public class ConfigUIHelper extends HelperBase {
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
/** @return standard and user-installed themes, sorted (untranslated) */
|
||||
private Set<String> themeSet() {
|
||||
Set<String> rv = new TreeSet();
|
||||
// add a failsafe even if we can't find any themes
|
||||
rv.add(CSSHelper.DEFAULT_THEME);
|
||||
File dir = new File(_context.getBaseDir(), "docs/themes/console");
|
||||
File[] files = dir.listFiles();
|
||||
if (files == null)
|
||||
return rv;
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
String name = files[i].getName();
|
||||
if (files[i].isDirectory() && ! name.equals("images"))
|
||||
rv.add(name);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
private static final String langs[] = {"de", "en", "fr", "nl", "se", "zh"};
|
||||
private static final String xlangs[] = {_x("German"), _x("English"), _x("French"),
|
||||
_x("Dutch"), _x("Swedish"), _x("Chinese")};
|
||||
|
||||
/** todo sort by translated string */
|
||||
public String getLangSettings() {
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
String current = Messages.getLanguage(_context);
|
||||
|
@ -119,18 +119,9 @@ public class GraphHelper extends HelperBase {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
public String getPeerSummary() {
|
||||
try {
|
||||
_context.commSystem().renderStatusHTML(_out);
|
||||
_context.bandwidthLimiter().renderStatusHTML(_out);
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
class AlphaComparator implements Comparator {
|
||||
/** inner class, don't bother reindenting */
|
||||
private static class AlphaComparator implements Comparator {
|
||||
public int compare(Object lhs, Object rhs) {
|
||||
SummaryListener l = (SummaryListener)lhs;
|
||||
SummaryListener r = (SummaryListener)rhs;
|
||||
@ -139,3 +130,5 @@ class AlphaComparator implements Comparator {
|
||||
return lName.compareTo(rName);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -287,9 +287,9 @@ public class SummaryBarRenderer {
|
||||
if (prev != null) System.setProperty("net.i2p.router.web.ReseedHandler.noncePrev", prev);
|
||||
System.setProperty("net.i2p.router.web.ReseedHandler.nonce", nonce+"");
|
||||
String uri = _helper.getRequestURI();
|
||||
buf.append("<form action=\"").append(uri).append("\" method=\"GET\">\n");
|
||||
buf.append("<p><form action=\"").append(uri).append("\" method=\"GET\">\n");
|
||||
buf.append("<input type=\"hidden\" name=\"reseedNonce\" value=\"").append(nonce).append("\" >\n");
|
||||
buf.append("<button type=\"submit\" value=\"Reseed\" >").append(_("Reseed")).append("</button></form>\n");
|
||||
buf.append("<button type=\"submit\" value=\"Reseed\" >").append(_("Reseed")).append("</button></form></p>\n");
|
||||
}
|
||||
anotherLine = true;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ package dummy;
|
||||
*/
|
||||
class Dummy {
|
||||
void dummy {
|
||||
// wars
|
||||
// wars for ConfigClientsHelper
|
||||
_("addressbook");
|
||||
_("i2psnark");
|
||||
_("i2ptunnel");
|
||||
@ -16,7 +16,7 @@ class Dummy {
|
||||
_("susidns");
|
||||
_("routerconsole");
|
||||
|
||||
// clients, taken from clients.config
|
||||
// clients, taken from clients.config, for ConfigClientsHelper
|
||||
// note that if the wording changes in clients.config, we have to
|
||||
// keep the old string here as well for existing installs
|
||||
_("Web console");
|
||||
@ -35,5 +35,10 @@ class Dummy {
|
||||
_("eepsite");
|
||||
// hardcoded in i2psnark
|
||||
_("I2PSnark");
|
||||
|
||||
// standard themes for ConfigUIHelper
|
||||
_("classic");
|
||||
_("dark");
|
||||
_("light");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user