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;
import org.jivesoftware.util.ClassUtils;
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.Element;
import org.dom4j.DocumentFactory;
......@@ -78,7 +81,7 @@ public class AdminConsole {
* Returns the name of the application.
*/
public static String getAppName() {
Element appName = (Element)generatedModel.selectSingleNode("/adminconsole/global/appname");
Element appName = (Element)generatedModel.selectSingleNode("//adminconsole/global/appname");
if (appName != null) {
return appName.getText();
}
......@@ -94,7 +97,7 @@ public class AdminConsole {
*/
public static String getLogoImage() {
Element globalLogoImage = (Element)generatedModel.selectSingleNode(
"/adminconsole/global/logo-image");
"//adminconsole/global/logo-image");
if (globalLogoImage != null) {
return globalLogoImage.getText();
}
......@@ -110,7 +113,7 @@ public class AdminConsole {
*/
public static String getLoginLogoImage() {
Element globalLoginLogoImage = (Element)generatedModel.selectSingleNode(
"/adminconsole/global/login-image");
"//adminconsole/global/login-image");
if (globalLoginLogoImage != null) {
return globalLoginLogoImage.getText();
}
......@@ -126,12 +129,21 @@ public class AdminConsole {
*/
public static String getVersionString() {
Element globalVersion = (Element)generatedModel.selectSingleNode(
"/adminconsole/global/version");
"//adminconsole/global/version");
if (globalVersion != null) {
return globalVersion.getText();
}
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 {
// Add in all overrides.
for (Element element : overrideModels) {
// 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) {
Element existingAppName = (Element)generatedModel.selectSingleNode(
"/adminconsole/global/appname");
"//adminconsole/global/appname");
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) {
Element existingLogoImage = (Element)generatedModel.selectSingleNode(
"/adminconsole/global/logo-image");
"//adminconsole/global/logo-image");
existingLogoImage.setText(appLogoImage.getText());
}
Element appLoginImage = (Element)element.selectSingleNode("/adminconsole/global/login-image");
if (appLogoImage != null) {
Element appLoginImage = (Element)element.selectSingleNode("//adminconsole/global/login-image");
if (appLoginImage != null) {
Element existingLoginImage = (Element)generatedModel.selectSingleNode(
"/adminconsole/global/login-image");
"//adminconsole/global/login-image");
existingLoginImage.setText(appLoginImage.getText());
}
Element appVersion = (Element)element.selectSingleNode("/adminconsole/global/version");
if (appLogoImage != null) {
Element appVersion = (Element)element.selectSingleNode("//adminconsole/global/version");
if (appVersion != null) {
Element existingVersion = (Element)generatedModel.selectSingleNode(
"/adminconsole/global/version");
"//adminconsole/global/version");
existingVersion.setText(appVersion.getText());
}
// Tabs
......
......@@ -125,6 +125,17 @@ public class PluginManager {
// If there a <adminconsole> section defined, register it.
Element adminElement = (Element)pluginXML.selectSingleNode("/plugin/adminconsole");
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
// the plugin servlet correctly.
List urls = adminElement.selectNodes("//@url");
......
......@@ -3,6 +3,7 @@
<global>
<appname>Jive Messenger</appname>
<logo-image>images/header-title.gif</logo-image>
<login-image>images/logo-messenger.gif</login-image>
</global>
<tab id="tab-server" name="Server" url="index.jsp" description="Click to manage server settings">
......
......@@ -16,7 +16,7 @@
<filter-class>org.jivesoftware.admin.AuthCheckFilter</filter-class>
<init-param>
<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>
</filter>
......
......@@ -14,7 +14,8 @@
org.jivesoftware.messenger.container.ServiceLookup,
org.jivesoftware.messenger.JiveGlobals,
org.jivesoftware.util.Version,
org.jivesoftware.util.Log"
org.jivesoftware.util.Log,
org.jivesoftware.admin.AdminConsole"
errorPage="error.jsp"
%>
......@@ -95,7 +96,7 @@
<html>
<head>
<title>Jive Messenger Admin Console</title>
<title><%= AdminConsole.getAppName() %> Admin Console</title>
<script language="JavaScript" type="text/javascript">
<!--
// break out of frames
......@@ -174,7 +175,7 @@
<tr valign="top">
<td rowspan="99"
><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>
<td colspan="3"
><div id="jive-login-text-image"
......@@ -253,8 +254,7 @@
<tr class="jive-footer">
<td colspan="3" nowrap>
<span style="font-size:0.8em;">
Jive Messenger, Version:
<%= admin.getXMPPServer().getServerInfo().getVersion().getVersionString() %>
<%= AdminConsole.getAppName() %>, Version: <%= AdminConsole.getVersionString() %>
</span>
</td>
</tr>
......
......@@ -55,7 +55,7 @@
&nbsp;
</td>
<td class="info">
<nobr><%= AdminConsole.getAppName() %> <%= admin.getXMPPServer().getServerInfo().getVersion().getVersionString() %></nobr>
<nobr><%= AdminConsole.getAppName() %> <%= AdminConsole.getVersionString() %></nobr>
</td>
</tr>
</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