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;
import org.jivesoftware.util.*;
import org.jivesoftware.wildfire.XMPPServer;
import org.jivesoftware.wildfire.container.PluginManager;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.DocumentFactory;
......@@ -111,6 +112,8 @@ public class AdminConsole {
/**
* Returns the name of the application.
*
* @return the name of the application.
*/
public static String getAppName() {
Element appName = (Element)generatedModel.selectSingleNode("//adminconsole/global/appname");
......@@ -239,7 +242,9 @@ public class AdminConsole {
try {
in.close();
}
catch (Exception ignored) {}
catch (Exception ignored) {
// Ignore.
}
// Load other admin-sidebar.xml files from the classpath
ClassLoader[] classLoaders = getClassLoaders();
......@@ -256,7 +261,9 @@ public class AdminConsole {
}
finally {
try { if (in != null) { in.close(); } }
catch (Exception ignored) {}
catch (Exception ignored) {
// Ignore.
}
}
}
}
......@@ -354,9 +361,11 @@ public class AdminConsole {
// Special case: show an informational tab about Wildfire Enterprise if Enterprise
// is not installed and if the user has not chosen to hide tab.
Element enterprise = (Element)generatedModel.selectSingleNode("//tab[@id='tab-enterprise']");
if (enterprise == null && JiveGlobals.getBooleanProperty("enterpriseInfoEnabled", true)) {
enterprise = generatedModel.addElement("tab");
PluginManager pluginManager = XMPPServer.getInstance().getPluginManager();
boolean pluginExists = pluginManager != null && pluginManager.isPluginDownloaded(
"enterprise.jar");
if (!pluginExists && JiveGlobals.getBooleanProperty("enterpriseInfoEnabled", true)) {
Element enterprise = generatedModel.addElement("tab");
enterprise.addAttribute("id", "tab-enterprise");
enterprise.addAttribute("name", "Enterprise");
enterprise.addAttribute("url", "enterprise-info.jsp");
......@@ -464,6 +473,8 @@ public class AdminConsole {
/**
* Returns an array of class loaders to load resources from.
*
* @return an array of class loaders to load resources from.
*/
private static ClassLoader[] getClassLoaders() {
ClassLoader[] classLoaders = new ClassLoader[3];
......
......@@ -11,7 +11,10 @@
<%@ page import="org.jivesoftware.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"
%>
......@@ -19,10 +22,17 @@
<%@ 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;
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