* 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:
zzz
2009-10-31 18:18:36 +00:00
parent 7594c4383b
commit 428cbdce2a
11 changed files with 53 additions and 24 deletions

View File

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

View File

@ -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);
}
}
}

View File

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

View File

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

View File

@ -61,12 +61,12 @@
<input type="text" size="8" name="capacity" value="<%=capacity%>" />
<input type="submit" name="action" value="<%=intl._("Adjust peer bonuses")%>" /></p></div>
</form>
<a name="shitlist"> </a>
<a name="shitlist"> </a><h2><%=intl._("Banned Peers")%></h2>
<jsp:useBean class="net.i2p.router.web.ProfilesHelper" id="profilesHelper" scope="request" />
<jsp:setProperty name="profilesHelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<jsp:setProperty name="profilesHelper" property="writer" value="<%=out%>" />
<jsp:getProperty name="profilesHelper" property="shitlistSummary" />
<div class="wideload">
<div class="wideload"><h2><%=intl._("Banned IPs")%></h2>
<jsp:getProperty name="peerhelper" property="blocklistSummary" />
</div><hr></div></div></body></html>

View File

@ -12,6 +12,6 @@
<jsp:setProperty name="profilesHelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<jsp:setProperty name="profilesHelper" property="writer" value="<%=out%>" />
<jsp:getProperty name="profilesHelper" property="profileSummary" />
<a name="shitlist"> </a>
<a name="shitlist"> </a><h2><%=intl._("Banned Peers")%></h2>
<jsp:getProperty name="profilesHelper" property="shitlistSummary" />
<hr></div></div></body></html>

View File

@ -71,6 +71,7 @@ The subscription file contains a list of (i2p) URLs. The addressbook application
regularly (once per hour) checks this list for new eepsites. Those URLs simply contain the published hosts.txt
file of other people. The default subscription is the hosts.txt from www.i2p2.i2p, which is updated infrequently.
So it is a good idea to add additional subscriptions to sites that have the latest addresses.
<a href="http://www.i2p2.i2p/faq.html#subscriptions">See the FAQ for a list of subscription URLs.</a>
</p>
</div><hr>
<div id="footer">

View File

@ -1,3 +1,11 @@
2009-10-31 zzz
* Console:
- More tagging
- Show user-installed themes on configui.jsp
- Fix reseed button spacing
* GraphHelper cleanup
* Susidns: add link to subscription faq
2009-10-29 zzz
* Console tag fixes, bundle script fix
* Add help target to build.xml

View File

@ -757,7 +757,8 @@ public class Blocklist {
/** write directly to the stream so we don't OOM on a huge list */
public void renderStatusHTML(Writer out) throws IOException {
out.write("<h2>Banned IPs</h2>");
// move to the jsp
//out.write("<h2>Banned IPs</h2>");
Set singles = new TreeSet();
singles.addAll(_singleIPBlocklist);
if (singles.size() > 0) {

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 9;
public final static long BUILD = 10;
/** for example "-test" */
public final static String EXTRA = "";
public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;

View File

@ -253,7 +253,8 @@ public class Shitlist {
public void renderStatusHTML(Writer out) throws IOException {
StringBuilder buf = new StringBuilder(1024);
buf.append("<h2>Banned Peers</h2>");
// move to the jsp
//buf.append("<h2>Banned Peers</h2>");
Map<Hash, Entry> entries = new TreeMap(new HashComparator());
entries.putAll(_entries);