Re-categorize items from /home and introduce 2 new categories. Make them configurable on /confighome

This commit is contained in:
hankhill19580
2019-11-11 00:49:26 +00:00
parent b5d7f3e460
commit f7471713da
4 changed files with 91 additions and 9 deletions

View File

@ -41,6 +41,12 @@ public class ConfigHomeHandler extends FormHandler {
} else if ("3".equals(group)) {
prop = SearchHelper.PROP_ENGINES;
dflt = SearchHelper.ENGINES_DEFAULT;
} else if ("4".equals(group)) {
prop = HomeHelper.PROP_CONFIG;
dflt = HomeHelper.DEFAULT_CONFIG;
} else if ("5".equals(group)) {
prop = HomeHelper.PROP_MONITORING;
dflt = HomeHelper.DEFAULT_MONITORING;
} else {
addFormError("Bad group");
return;

View File

@ -30,23 +30,30 @@ public class HomeHelper extends HelperBase {
private static final String I = "/themes/console/images/";
static final String PROP_SERVICES = "routerconsole.services";
static final String PROP_FAVORITES = "routerconsole.favorites";
static final String PROP_CONFIG = "routerconsole.configopts";
static final String PROP_MONITORING = "routerconsole.monitoring";
static final String PROP_OLDHOME = "routerconsole.oldHomePage";
private static final String PROP_SEARCH = "routerconsole.showSearch";
// No commas allowed in text strings!
static final String DEFAULT_SERVICES =
_x("Email") + S + _x("Anonymous webmail client") + S + "/webmail" + S + I + "email.png" + S +
_x("I2P Tunnel") + S + _x("Port-Forwarding to and from I2P") + S + "/i2ptunnelmgr" + S + I + "itoopie_xsm.png" + S +
_x("Torrents") + S + _x("Built-in anonymous BitTorrent Client") + S + "/torrents" + S + I + "i2psnark.png" + S +
_x("Web Server") + S + _x("Local web server for hosting your own content on I2P") + S + "http://127.0.0.1:7658/" + S + I + "server_32x32.png" + S +
_x("Addressbook") + S + _x("Manage your I2P hosts file here (I2P domain name resolution)") + S + "/dns" + S + I + "book_addresses.png" + S +
"";
static final String DEFAULT_CONFIG =
_x("Configure Homepage") + S + _x("Configure the contents of this page") + S + "/confighome" + S + I + "info/home.png" + S +
_x("Configure Bandwidth") + S + _x("I2P Bandwidth Configuration") + S + "/config" + S + I + "info/bandwidth.png" + S +
// FIXME wasn't escaped
//_x("Configure UI") + S + _x("Select console theme & language & set optional console password").replace("&", "&") + S + "/configui" + S + I + "info/ui.png" + S +
//_x("Customize Home Page") + S + _x("I2P Home Page Configuration") + S + "/confighome" + S + I + "home_page.png" + S +
//_x("Customize Sidebar") + S + _x("Customize the sidebar by adding or removing or repositioning elements") + S + "/configsidebar" + S + I + "info/sidebar.png" + S +
_x("Email") + S + _x("Anonymous webmail client") + S + "/webmail" + S + I + "email.png" + S +
_x("Help") + S + _x("I2P Router Help") + S + "/help" + S + I + "support.png" + S +
_x("Manage Plugins") + S + _x("Install and configure I2P plugins") + S + "/configplugins" + S + I + "plugin.png" + S +
_x("Router Console") + S + _x("I2P Router Console") + S + "/console" + S + I + "info/console.png" + S +
_x("Torrents") + S + _x("Built-in anonymous BitTorrent Client") + S + "/torrents" + S + I + "i2psnark.png" + S +
_x("Web Server") + S + _x("Local web server for hosting your own content on I2P") + S + "http://127.0.0.1:7658/" + S + I + "server_32x32.png" + S +
"";
// No commas allowed in text strings!
@ -87,6 +94,14 @@ public class HomeHelper extends HelperBase {
//"sponge.i2p" + S + _x("Seedless and the Robert BitTorrent applications") + S + "http://sponge.i2p/" + S + I + "user_astronaut.png" + S +
"";
// No commas allowed in text strings!
static final String DEFAULT_MONITORING =
_x("Logs") + S + _x("View the logs") + S + "/logs" + S + I + "billiard_marker.png" + S +
_x("Router Stats") + S + _x("View router stats") + S + "/stats" + S + I + "info/bandwidth.png" + S +
_x("Charts and Graphs") + S + _x("Visualize information about the router") + S + "/graphs" + S + I + "chart_line.png" + S +
_x("Network Database") + S + _x("View the NetDB") + S + "/netdb" + S + I + "support.png" + S +
_x("Peers") + S + _x("View your known peers") + S + "/peers" + S + I + "group.png" + S +
"";
public boolean shouldShowWelcome() {
return _context.getProperty(Messages.PROP_LANG) == null;
@ -101,6 +116,14 @@ public class HomeHelper extends HelperBase {
return homeTable(PROP_SERVICES, DEFAULT_SERVICES, plugins);
}
public String getConfig(){
return homeTable(PROP_CONFIG, DEFAULT_CONFIG, null);
}
public String getMonitoring(){
return homeTable(PROP_MONITORING, DEFAULT_MONITORING, null);
}
public String getFavorites() {
return homeTable(PROP_FAVORITES, DEFAULT_FAVORITES, null);
}
@ -109,6 +132,14 @@ public class HomeHelper extends HelperBase {
return configTable(PROP_SERVICES, DEFAULT_SERVICES);
}
public String getConfigConfig() {
return configTable(PROP_CONFIG, DEFAULT_CONFIG);
}
public String getConfigMonitoring() {
return configTable(PROP_MONITORING, DEFAULT_MONITORING);
}
public String getConfigFavorites() {
return configTable(PROP_FAVORITES, DEFAULT_FAVORITES);
}
@ -212,6 +243,9 @@ public class HomeHelper extends HelperBase {
} else if (url.equals("/torrents")) {
if (!pm.isRegistered("i2psnark"))
continue;
} else if (url.equals("/i2ptunnelmgr")) {
if (!pm.isRegistered("i2ptunnel"))
continue;
} else if (url.equals("/configplugins")) {
if (!PluginStarter.pluginsEnabled(_context))
continue;

View File

@ -62,7 +62,7 @@ input.default {
<%
} // shouldShowSearch()
%>
<h3 class="tabletitle"><%=intl._t("Hidden Services of Interest")%></h3>
<h3 class="tabletitle"><%=intl._t("Blogs, Forums, and Web Sites")%></h3>
<form action="" method="POST">
<input type="hidden" name="nonce" value="<%=pageNonce%>" >
<input type="hidden" name="group" value="1">
@ -76,7 +76,7 @@ input.default {
</div>
</form>
<h3 class="tabletitle"><%=intl._t("Applications and Configuration")%></h3>
<h3 class="tabletitle"><%=intl._t("Applications")%></h3>
<form action="" method="POST">
<input type="hidden" name="nonce" value="<%=pageNonce%>" >
<input type="hidden" name="group" value="2">
@ -89,4 +89,32 @@ input.default {
<input type="submit" name="action" class="add" value="<%=intl._t("Add item")%>" >
</div>
</form>
<h3 class="tabletitle"><%=intl._t("Configuration")%></h3>
<form action="" method="POST">
<input type="hidden" name="nonce" value="<%=pageNonce%>" >
<input type="hidden" name="group" value="4">
<jsp:getProperty name="homehelper" property="configConfig" />
<div class="formaction" id="homeconfig">
<input type="submit" name="action" class="default" value="<%=intl._t("Add item")%>" >
<input type="submit" name="action" class="delete" value="<%=intl._t("Delete selected")%>" >
<input type="reset" class="cancel" value="<%=intl._t("Cancel")%>" >
<input type="submit" name="action" class="reload" value="<%=intl._t("Restore defaults")%>" >
<input type="submit" name="action" class="add" value="<%=intl._t("Add item")%>" >
</div>
</form>
<h3 class="tabletitle"><%=intl._t("Monitoring")%></h3>
<form action="" method="POST">
<input type="hidden" name="nonce" value="<%=pageNonce%>" >
<input type="hidden" name="group" value="5">
<jsp:getProperty name="homehelper" property="configMonitoring" />
<div class="formaction" id="homemonitor">
<input type="submit" name="action" class="default" value="<%=intl._t("Add item")%>" >
<input type="submit" name="action" class="delete" value="<%=intl._t("Delete selected")%>" >
<input type="reset" class="cancel" value="<%=intl._t("Cancel")%>" >
<input type="submit" name="action" class="reload" value="<%=intl._t("Restore defaults")%>" >
<input type="submit" name="action" class="add" value="<%=intl._t("Add item")%>" >
</div>
</form>
</div></body></html>

View File

@ -86,16 +86,30 @@
} // shouldShowSearch()
%>
<div class="ag2">
<h4 class="app2"><%=intl._t("Hidden Services of Interest")%></h4>
<h4 class="app"><%=intl._t("Applications")%></h4>
<div class="homeapps">
<jsp:getProperty name="homehelper" property="services" /><br>
<div class="clearer">&nbsp;</div>
</div>
</div>
<div class="ag2">
<h4 class="app2"><%=intl._t("Blogs, Forums, and Web Sites")%></h4>
<div class="homesites">
<jsp:getProperty name="homehelper" property="favorites" /><br>
<div class="clearer">&nbsp;</div>
</div>
</div>
<div class="ag2">
<h4 class="app"><%=intl._t("Applications and Configuration")%></h4>
<div class="homeapps">
<jsp:getProperty name="homehelper" property="services" /><br>
<h4 class="app"><%=intl._t("Configuration")%></h4>
<div class="homeconfig">
<jsp:getProperty name="homehelper" property="config" /><br>
<div class="clearer">&nbsp;</div>
</div>
</div>
<div class="ag2">
<h4 class="app"><%=intl._t("Monitoring")%></h4>
<div class="homedevs">
<jsp:getProperty name="homehelper" property="monitoring" /><br>
<div class="clearer">&nbsp;</div>
</div>
</div>