Commit 15501e49 authored by Matt Tucker's avatar Matt Tucker Committed by matt

Improved logic around when to display enterprise info tab.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@5777 b35dd754-fafc-0310-a699-88a17e54d16e
parent 6ca81937
...@@ -13,6 +13,7 @@ package org.jivesoftware.admin; ...@@ -13,6 +13,7 @@ package org.jivesoftware.admin;
import org.jivesoftware.util.*; import org.jivesoftware.util.*;
import org.jivesoftware.wildfire.XMPPServer; import org.jivesoftware.wildfire.XMPPServer;
import org.jivesoftware.wildfire.container.PluginManager;
import org.dom4j.Document; import org.dom4j.Document;
import org.dom4j.Element; import org.dom4j.Element;
import org.dom4j.DocumentFactory; import org.dom4j.DocumentFactory;
...@@ -111,6 +112,8 @@ public class AdminConsole { ...@@ -111,6 +112,8 @@ public class AdminConsole {
/** /**
* Returns the name of the application. * Returns the name of the application.
*
* @return the name of the application.
*/ */
public static String getAppName() { public static String getAppName() {
Element appName = (Element)generatedModel.selectSingleNode("//adminconsole/global/appname"); Element appName = (Element)generatedModel.selectSingleNode("//adminconsole/global/appname");
...@@ -239,7 +242,9 @@ public class AdminConsole { ...@@ -239,7 +242,9 @@ public class AdminConsole {
try { try {
in.close(); in.close();
} }
catch (Exception ignored) {} catch (Exception ignored) {
// Ignore.
}
// Load other admin-sidebar.xml files from the classpath // Load other admin-sidebar.xml files from the classpath
ClassLoader[] classLoaders = getClassLoaders(); ClassLoader[] classLoaders = getClassLoaders();
...@@ -256,7 +261,9 @@ public class AdminConsole { ...@@ -256,7 +261,9 @@ public class AdminConsole {
} }
finally { finally {
try { if (in != null) { in.close(); } } try { if (in != null) { in.close(); } }
catch (Exception ignored) {} catch (Exception ignored) {
// Ignore.
}
} }
} }
} }
...@@ -354,9 +361,11 @@ public class AdminConsole { ...@@ -354,9 +361,11 @@ public class AdminConsole {
// Special case: show an informational tab about Wildfire Enterprise if Enterprise // Special case: show an informational tab about Wildfire Enterprise if Enterprise
// is not installed and if the user has not chosen to hide tab. // is not installed and if the user has not chosen to hide tab.
Element enterprise = (Element)generatedModel.selectSingleNode("//tab[@id='tab-enterprise']"); PluginManager pluginManager = XMPPServer.getInstance().getPluginManager();
if (enterprise == null && JiveGlobals.getBooleanProperty("enterpriseInfoEnabled", true)) { boolean pluginExists = pluginManager != null && pluginManager.isPluginDownloaded(
enterprise = generatedModel.addElement("tab"); "enterprise.jar");
if (!pluginExists && JiveGlobals.getBooleanProperty("enterpriseInfoEnabled", true)) {
Element enterprise = generatedModel.addElement("tab");
enterprise.addAttribute("id", "tab-enterprise"); enterprise.addAttribute("id", "tab-enterprise");
enterprise.addAttribute("name", "Enterprise"); enterprise.addAttribute("name", "Enterprise");
enterprise.addAttribute("url", "enterprise-info.jsp"); enterprise.addAttribute("url", "enterprise-info.jsp");
...@@ -464,6 +473,8 @@ public class AdminConsole { ...@@ -464,6 +473,8 @@ public class AdminConsole {
/** /**
* Returns an array of class loaders to load resources from. * Returns an array of class loaders to load resources from.
*
* @return an array of class loaders to load resources from.
*/ */
private static ClassLoader[] getClassLoaders() { private static ClassLoader[] getClassLoaders() {
ClassLoader[] classLoaders = new ClassLoader[3]; ClassLoader[] classLoaders = new ClassLoader[3];
......
...@@ -11,7 +11,10 @@ ...@@ -11,7 +11,10 @@
<%@ page import="org.jivesoftware.util.*, <%@ page import="org.jivesoftware.util.*,
java.util.*, java.util.*,
org.jivesoftware.wildfire.*, org.jivesoftware.wildfire.update.UpdateManager, org.jivesoftware.wildfire.update.AvailablePlugin, java.net.URLEncoder, java.io.File, org.jivesoftware.wildfire.container.PluginManager, org.jivesoftware.wildfire.container.Plugin" org.jivesoftware.wildfire.*,
org.jivesoftware.wildfire.update.UpdateManager,
org.jivesoftware.wildfire.update.AvailablePlugin,
org.jivesoftware.wildfire.container.PluginManager"
errorPage="error.jsp" errorPage="error.jsp"
%> %>
...@@ -19,10 +22,17 @@ ...@@ -19,10 +22,17 @@
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %> <%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<% <%
WebManager webManager = new WebManager(); // It's possible for the page to still be displayed after Enterprise
%> // has been downloaded, like when the user has not done a page refresh.
// Detect that case and do a re-direct.
PluginManager pluginManager = XMPPServer.getInstance().getPluginManager();
boolean pluginExists = pluginManager != null && pluginManager.getPlugin("enterprise") != null;
if (pluginExists) {
// Redirect to the main Enterprise page.
response.sendRedirect("/plugins/enterprise/dashboard.jsp");
return;
}
<%
boolean downloadRequested = request.getParameter("download") != null; boolean downloadRequested = request.getParameter("download") != null;
String url = request.getParameter("url"); String url = request.getParameter("url");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment