From 8a7c3390f5048e7e9de0ecaad9d36b0eba95ef22 Mon Sep 17 00:00:00 2001 From: zzz Date: Sat, 30 Aug 2014 16:14:41 +0000 Subject: [PATCH] /configclients: - Re-enable plugin installation by default - Don't show configuration section or update-all button if no plugins installed --- .../i2p/router/web/ConfigClientsHandler.java | 2 +- .../i2p/router/web/ConfigClientsHelper.java | 7 ++- apps/routerconsole/jsp/configclients.jsp | 43 +++++++++++++++---- 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHandler.java b/apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHandler.java index 48343ff199..729a4b14d1 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHandler.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHandler.java @@ -59,7 +59,7 @@ public class ConfigClientsHandler extends FormHandler { } if (_action.equals(_("Install Plugin"))) { if (pluginsEnabled && - (_context.getBooleanProperty(ConfigClientsHelper.PROP_ENABLE_PLUGIN_INSTALL) || + (_context.getBooleanPropertyDefaultTrue(ConfigClientsHelper.PROP_ENABLE_PLUGIN_INSTALL) || isAdvanced())) installPlugin(); else diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHelper.java index c9620cb7a9..ab83bcbd20 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHelper.java @@ -39,7 +39,12 @@ public class ConfigClientsHelper extends HelperBase { /** @since 0.9.14.1 */ public boolean isPluginInstallEnabled() { return PluginStarter.pluginsEnabled(_context) && - (_context.getBooleanProperty(PROP_ENABLE_PLUGIN_INSTALL) || isAdvanced()); + (_context.getBooleanPropertyDefaultTrue(PROP_ENABLE_PLUGIN_INSTALL) || isAdvanced()); + } + + /** @since 0.9.15 */ + public boolean isPluginUpdateEnabled() { + return !PluginStarter.getPlugins().isEmpty(); } /** @since 0.8.3 */ diff --git a/apps/routerconsole/jsp/configclients.jsp b/apps/routerconsole/jsp/configclients.jsp index 8bbfef188f..a6d049ed7f 100644 --- a/apps/routerconsole/jsp/configclients.jsp +++ b/apps/routerconsole/jsp/configclients.jsp @@ -105,7 +105,10 @@ input.default { width: 1px; height: 1px; visibility: hidden; } " /> -<% if (clientshelper.showPlugins()) { %> +<% + if (clientshelper.showPlugins()) { + if (clientshelper.isPluginUpdateEnabled()) { +%>

<%=intl._("Plugin Configuration")%>

<%=intl._("The plugins listed below are started by the webConsole client.")%>

@@ -116,25 +119,47 @@ input.default { width: 1px; height: 1px; visibility: hidden; } " /> " />
- -<% if (clientshelper.isPluginInstallEnabled()) { %> +<% + } // pluginUpdateEnabled + if (clientshelper.isPluginInstallEnabled()) { +%>

<%=intl._("Plugin Installation")%>

<%=intl._("Look for available plugins on {0}.", "plugins.i2p")%> <%=intl._("To install a plugin, enter the download URL:")%> -

+

+<% + } // pluginInstallEnabled + if (clientshelper.isPluginInstallEnabled() || clientshelper.isPluginUpdateEnabled()) { +%> +
+<% + if (clientshelper.isPluginInstallEnabled()) { +%>


" /> " /> " /> -

- " /> -
+
<% - } // pluginInstallEnabled - } // showPlugins + } // pluginInstallEnabled +%> + +<% + if (clientshelper.isPluginUpdateEnabled()) { +%> +
+ " /> +
+<% + } // pluginUpdateEnabled +%> + +<% + } // pluginInstallEnabled || pluginUpdateEnabled + } // showPlugins %>