I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 64824377 authored by idk's avatar idk
Browse files

Move plugins to their own section on /home, and make it so that if all the...

Move plugins to their own section on /home, and make it so that if all the elements of a section are shown, that section becomes hidden(so that plugins are not enabled by default)
parent 12e2daba
No related branches found
No related tags found
No related merge requests found
...@@ -111,28 +111,113 @@ public class HomeHelper extends HelperBase { ...@@ -111,28 +111,113 @@ public class HomeHelper extends HelperBase {
} }
public String getServices() { public String getServices() {
String table = homeTable(PROP_SERVICES, DEFAULT_SERVICES, null);
if (table.length() == 0) {
return "";
}
StringBuilder buf = new StringBuilder(1380);
buf.append("<div class=\"ag2\">");
buf.append("<h4 class=\"app\">");
buf.append(_t("Applications"));
buf.append("</h4>");
buf.append("<div class=\"homeapps\">");
buf.append(table);
buf.append("<br>");
buf.append("<div class=\"clearer\">&nbsp;</div>");
buf.append("</div>");
buf.append("</div>");
return buf.toString();
}
/** @since 0.9.47 */
public String getPlugins(){
List<App> plugins = NavHelper.getClientApps(_context); List<App> plugins = NavHelper.getClientApps(_context);
return homeTable(PROP_SERVICES, DEFAULT_SERVICES, plugins); String table = pluginTable(plugins);
if (table.length() == 0) {
return "";
}
StringBuilder buf = new StringBuilder(1380);
buf.append("<div class=\"ag2\">");
buf.append("<h4 class=\"app\">");
buf.append(_t("Plugins"));
buf.append("</h4>");
buf.append("<div class=\"homeapps\">");
buf.append(table);
buf.append("<br>");
buf.append("<div class=\"clearer\">&nbsp;</div>");
buf.append("</div>");
buf.append("</div>");
return buf.toString();
} }
/** @since 0.9.44 */ /** @since 0.9.44 */
public String getConfig(){ public String getConfig(){
return homeTable(PROP_CONFIG, DEFAULT_CONFIG, null); String table = homeTable(PROP_CONFIG, DEFAULT_CONFIG, null);
if (table.length() == 0) {
return "";
}
StringBuilder buf = new StringBuilder(1380);
buf.append("<div class=\"ag2\">");
buf.append("<h4 class=\"app\">");
buf.append(_t("Configuration"));
buf.append("</h4>");
buf.append("<div class=\"homeapps\">");
buf.append(table);
buf.append("<br>");
buf.append("<div class=\"clearer\">&nbsp;</div>");
buf.append("</div>");
buf.append("</div>");
return buf.toString();
} }
/** @since 0.9.44 */ /** @since 0.9.44 */
public String getMonitoring(){ public String getMonitoring(){
return homeTable(PROP_MONITORING, DEFAULT_MONITORING, null); String table = homeTable(PROP_MONITORING, DEFAULT_MONITORING, null);
if (table.length() == 0) {
return "";
}
StringBuilder buf = new StringBuilder(1380);
buf.append("<div class=\"ag2\">");
buf.append("<h4 class=\"app\">");
buf.append(_t("Developer Information"));
buf.append("</h4>");
buf.append("<div class=\"homeapps\">");
buf.append(table);
buf.append("<br>");
buf.append("<div class=\"clearer\">&nbsp;</div>");
buf.append("</div>");
buf.append("</div>");
return buf.toString();
} }
public String getFavorites() { public String getFavorites() {
return homeTable(PROP_FAVORITES, DEFAULT_FAVORITES, null); String table = homeTable(PROP_FAVORITES, DEFAULT_FAVORITES, null);
if (table.length() == 0) {
return "";
}
StringBuilder buf = new StringBuilder(1380);
buf.append("<div class=\"ag2\">");
buf.append("<h4 class=\"app\">");
buf.append(_t("I2P Sites"));
buf.append("</h4>");
buf.append("<div class=\"homeapps\">");
buf.append(table);
buf.append("<br>");
buf.append("<div class=\"clearer\">&nbsp;</div>");
buf.append("</div>");
buf.append("</div>");
return buf.toString();
} }
public String getConfigServices() { public String getConfigServices() {
return configTable(PROP_SERVICES, DEFAULT_SERVICES); return configTable(PROP_SERVICES, DEFAULT_SERVICES);
} }
/** @since 0.9.47 */
public String getConfigPlugins() {
return getPlugins();
}
/** @since 0.9.44 */ /** @since 0.9.44 */
public String getConfigConfig() { public String getConfigConfig() {
return configTable(PROP_CONFIG, DEFAULT_CONFIG); return configTable(PROP_CONFIG, DEFAULT_CONFIG);
...@@ -165,6 +250,14 @@ public class HomeHelper extends HelperBase { ...@@ -165,6 +250,14 @@ public class HomeHelper extends HelperBase {
"\">"; "\">";
} }
private String pluginTable(Collection<App> toAdd) {
Collection<App> apps = buildApps(_context, "");
if (toAdd != null)
apps.addAll(toAdd);
return renderApps(apps);
}
private String homeTable(String prop, String dflt, Collection<App> toAdd) { private String homeTable(String prop, String dflt, Collection<App> toAdd) {
String config = _context.getProperty(prop, dflt); String config = _context.getProperty(prop, dflt);
Collection<App> apps = buildApps(_context, config); Collection<App> apps = buildApps(_context, config);
...@@ -223,6 +316,9 @@ public class HomeHelper extends HelperBase { ...@@ -223,6 +316,9 @@ public class HomeHelper extends HelperBase {
} }
private String renderApps(Collection<App> apps) { private String renderApps(Collection<App> apps) {
if (apps.size() == 0) {
return "";
}
String website = _t("Web Server"); String website = _t("Web Server");
StringBuilder buf = new StringBuilder(1024); StringBuilder buf = new StringBuilder(1024);
buf.append("<div class=\"appgroup\">"); buf.append("<div class=\"appgroup\">");
......
...@@ -84,34 +84,15 @@ ...@@ -84,34 +84,15 @@
<% <%
} // shouldShowSearch() } // shouldShowSearch()
%> %>
<div class="ag2"> <jsp:getProperty name="homehelper" property="services" />
<h4 class="app"><%=intl._t("Applications")%></h4>
<div class="homeapps"> <jsp:getProperty name="homehelper" property="plugins" />
<jsp:getProperty name="homehelper" property="services" /><br>
<div class="clearer">&nbsp;</div> <jsp:getProperty name="homehelper" property="favorites" /><br>
</div>
</div> <jsp:getProperty name="homehelper" property="config" /><br>
<div class="ag2">
<h4 class="app2"><%=intl._t("Websites Inside I2P")%></h4> <jsp:getProperty name="homehelper" property="monitoring" /><br>
<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("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("Developer Information")%></h4>
<div class="homedevs">
<jsp:getProperty name="homehelper" property="monitoring" /><br>
<div class="clearer">&nbsp;</div>
</div>
</div>
</div>
</div> </div>
</body></html> </body></html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment