Commit 52d507f7 authored by Matt Tucker's avatar Matt Tucker Committed by matt

Added branding support.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@533 b35dd754-fafc-0310-a699-88a17e54d16e
parent 5b242506
...@@ -13,6 +13,9 @@ package org.jivesoftware.admin; ...@@ -13,6 +13,9 @@ package org.jivesoftware.admin;
import org.jivesoftware.util.ClassUtils; import org.jivesoftware.util.ClassUtils;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.messenger.XMPPServer;
import org.jivesoftware.messenger.auth.UnauthorizedException;
import org.jivesoftware.messenger.container.ServiceLookupFactory;
import org.dom4j.Document; import org.dom4j.Document;
import org.dom4j.Element; import org.dom4j.Element;
import org.dom4j.DocumentFactory; import org.dom4j.DocumentFactory;
...@@ -78,7 +81,7 @@ public class AdminConsole { ...@@ -78,7 +81,7 @@ public class AdminConsole {
* Returns the name of the application. * Returns 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");
if (appName != null) { if (appName != null) {
return appName.getText(); return appName.getText();
} }
...@@ -94,7 +97,7 @@ public class AdminConsole { ...@@ -94,7 +97,7 @@ public class AdminConsole {
*/ */
public static String getLogoImage() { public static String getLogoImage() {
Element globalLogoImage = (Element)generatedModel.selectSingleNode( Element globalLogoImage = (Element)generatedModel.selectSingleNode(
"/adminconsole/global/logo-image"); "//adminconsole/global/logo-image");
if (globalLogoImage != null) { if (globalLogoImage != null) {
return globalLogoImage.getText(); return globalLogoImage.getText();
} }
...@@ -110,7 +113,7 @@ public class AdminConsole { ...@@ -110,7 +113,7 @@ public class AdminConsole {
*/ */
public static String getLoginLogoImage() { public static String getLoginLogoImage() {
Element globalLoginLogoImage = (Element)generatedModel.selectSingleNode( Element globalLoginLogoImage = (Element)generatedModel.selectSingleNode(
"/adminconsole/global/login-image"); "//adminconsole/global/login-image");
if (globalLoginLogoImage != null) { if (globalLoginLogoImage != null) {
return globalLoginLogoImage.getText(); return globalLoginLogoImage.getText();
} }
...@@ -126,12 +129,21 @@ public class AdminConsole { ...@@ -126,12 +129,21 @@ public class AdminConsole {
*/ */
public static String getVersionString() { public static String getVersionString() {
Element globalVersion = (Element)generatedModel.selectSingleNode( Element globalVersion = (Element)generatedModel.selectSingleNode(
"/adminconsole/global/version"); "//adminconsole/global/version");
if (globalVersion != null) { if (globalVersion != null) {
return globalVersion.getText(); return globalVersion.getText();
} }
else { else {
return null; // Default to the Jive Messenger version if none has been provided via XML.
try {
XMPPServer xmppServer = (XMPPServer)ServiceLookupFactory.getLookup().lookup(
XMPPServer.class);
return xmppServer.getServerInfo().getVersion().getVersionString();
}
catch (UnauthorizedException ue) {
Log.error(ue);
return null;
}
} }
} }
...@@ -218,28 +230,28 @@ public class AdminConsole { ...@@ -218,28 +230,28 @@ public class AdminConsole {
// Add in all overrides. // Add in all overrides.
for (Element element : overrideModels) { for (Element element : overrideModels) {
// See if global settings are overriden. // See if global settings are overriden.
Element appName = (Element)element.selectSingleNode("/adminconsole/global/appname"); Element appName = (Element)element.selectSingleNode("//adminconsole/global/appname");
if (appName != null) { if (appName != null) {
Element existingAppName = (Element)generatedModel.selectSingleNode( Element existingAppName = (Element)generatedModel.selectSingleNode(
"/adminconsole/global/appname"); "//adminconsole/global/appname");
existingAppName.setText(appName.getText()); existingAppName.setText(appName.getText());
} }
Element appLogoImage = (Element)element.selectSingleNode("/adminconsole/global/logo-image"); Element appLogoImage = (Element)element.selectSingleNode("//adminconsole/global/logo-image");
if (appLogoImage != null) { if (appLogoImage != null) {
Element existingLogoImage = (Element)generatedModel.selectSingleNode( Element existingLogoImage = (Element)generatedModel.selectSingleNode(
"/adminconsole/global/logo-image"); "//adminconsole/global/logo-image");
existingLogoImage.setText(appLogoImage.getText()); existingLogoImage.setText(appLogoImage.getText());
} }
Element appLoginImage = (Element)element.selectSingleNode("/adminconsole/global/login-image"); Element appLoginImage = (Element)element.selectSingleNode("//adminconsole/global/login-image");
if (appLogoImage != null) { if (appLoginImage != null) {
Element existingLoginImage = (Element)generatedModel.selectSingleNode( Element existingLoginImage = (Element)generatedModel.selectSingleNode(
"/adminconsole/global/login-image"); "//adminconsole/global/login-image");
existingLoginImage.setText(appLoginImage.getText()); existingLoginImage.setText(appLoginImage.getText());
} }
Element appVersion = (Element)element.selectSingleNode("/adminconsole/global/version"); Element appVersion = (Element)element.selectSingleNode("//adminconsole/global/version");
if (appLogoImage != null) { if (appVersion != null) {
Element existingVersion = (Element)generatedModel.selectSingleNode( Element existingVersion = (Element)generatedModel.selectSingleNode(
"/adminconsole/global/version"); "//adminconsole/global/version");
existingVersion.setText(appVersion.getText()); existingVersion.setText(appVersion.getText());
} }
// Tabs // Tabs
......
...@@ -125,6 +125,17 @@ public class PluginManager { ...@@ -125,6 +125,17 @@ public class PluginManager {
// If there a <adminconsole> section defined, register it. // If there a <adminconsole> section defined, register it.
Element adminElement = (Element)pluginXML.selectSingleNode("/plugin/adminconsole"); Element adminElement = (Element)pluginXML.selectSingleNode("/plugin/adminconsole");
if (adminElement != null) { if (adminElement != null) {
// If global images are specified, override their URL.
Element imageEl = (Element)adminElement.selectSingleNode(
"/plugin/adminconsole/global/logo-image");
if (imageEl != null) {
imageEl.setText("plugins/" + pluginDir.getName() + "/" + imageEl.getText());
}
imageEl = (Element)adminElement.selectSingleNode(
"/plugin/adminconsole/global/login-image");
if (imageEl != null) {
imageEl.setText("plugins/" + pluginDir.getName() + "/" + imageEl.getText());
}
// Modify all the URL's in the XML so that they are passed through // Modify all the URL's in the XML so that they are passed through
// the plugin servlet correctly. // the plugin servlet correctly.
List urls = adminElement.selectNodes("//@url"); List urls = adminElement.selectNodes("//@url");
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
<global> <global>
<appname>Jive Messenger</appname> <appname>Jive Messenger</appname>
<logo-image>images/header-title.gif</logo-image> <logo-image>images/header-title.gif</logo-image>
<login-image>images/logo-messenger.gif</login-image>
</global> </global>
<tab id="tab-server" name="Server" url="index.jsp" description="Click to manage server settings"> <tab id="tab-server" name="Server" url="index.jsp" description="Click to manage server settings">
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<filter-class>org.jivesoftware.admin.AuthCheckFilter</filter-class> <filter-class>org.jivesoftware.admin.AuthCheckFilter</filter-class>
<init-param> <init-param>
<param-name>excludes</param-name> <param-name>excludes</param-name>
<param-value>login.jsp,index.jsp?logout=true,setup-</param-value> <param-value>login.jsp,index.jsp?logout=true,setup-,.gif,.png</param-value>
</init-param> </init-param>
</filter> </filter>
......
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
org.jivesoftware.messenger.container.ServiceLookup, org.jivesoftware.messenger.container.ServiceLookup,
org.jivesoftware.messenger.JiveGlobals, org.jivesoftware.messenger.JiveGlobals,
org.jivesoftware.util.Version, org.jivesoftware.util.Version,
org.jivesoftware.util.Log" org.jivesoftware.util.Log,
org.jivesoftware.admin.AdminConsole"
errorPage="error.jsp" errorPage="error.jsp"
%> %>
...@@ -95,7 +96,7 @@ ...@@ -95,7 +96,7 @@
<html> <html>
<head> <head>
<title>Jive Messenger Admin Console</title> <title><%= AdminConsole.getAppName() %> Admin Console</title>
<script language="JavaScript" type="text/javascript"> <script language="JavaScript" type="text/javascript">
<!-- <!--
// break out of frames // break out of frames
...@@ -174,7 +175,7 @@ ...@@ -174,7 +175,7 @@
<tr valign="top"> <tr valign="top">
<td rowspan="99" <td rowspan="99"
><div id="jive-logo-image" ><div id="jive-logo-image"
><img src="images/logo-messenger.gif" width="100" height="100" border="0" alt="Jive Messenger" ><img src="<%= AdminConsole.getLoginLogoImage() %>" border="0" alt="<%= AdminConsole.getAppName() %>"
></div></td> ></div></td>
<td colspan="3" <td colspan="3"
><div id="jive-login-text-image" ><div id="jive-login-text-image"
...@@ -253,8 +254,7 @@ ...@@ -253,8 +254,7 @@
<tr class="jive-footer"> <tr class="jive-footer">
<td colspan="3" nowrap> <td colspan="3" nowrap>
<span style="font-size:0.8em;"> <span style="font-size:0.8em;">
Jive Messenger, Version: <%= AdminConsole.getAppName() %>, Version: <%= AdminConsole.getVersionString() %>
<%= admin.getXMPPServer().getServerInfo().getVersion().getVersionString() %>
</span> </span>
</td> </td>
</tr> </tr>
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
&nbsp; &nbsp;
</td> </td>
<td class="info"> <td class="info">
<nobr><%= AdminConsole.getAppName() %> <%= admin.getXMPPServer().getServerInfo().getVersion().getVersionString() %></nobr> <nobr><%= AdminConsole.getAppName() %> <%= AdminConsole.getVersionString() %></nobr>
</td> </td>
</tr> </tr>
</table> </table>
......
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