Commit 569f6776 authored by Matt Tucker's avatar Matt Tucker Committed by matt

Plugin admin page from ryang -- still needs tweaking.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1068 b35dd754-fafc-0310-a699-88a17e54d16e
parent 974e941a
......@@ -55,6 +55,8 @@ tab.server.descr=Click to manage server settings
sidebar.server-db.descr=Database
sidebar.server-logs=Logs
sidebar.server-logs.descr=Click to view server logs
sidebar.plugin-settings=Plugins
sidebar.plugin-settings.descr=Click to view plugins
sidebar.sidebar-server-settings=Server Settings
sidebar.server-reg-and-login=Registration & Login
sidebar.server-reg-and-login.descr=Click to edit registration & login policies
......@@ -1221,4 +1223,22 @@ user.tabs.properties=User Properties
user.tabs.edit=Edit User
user.tabs.send=Send Message
user.tabs.change_pwd=Change Password
user.tabs.delete_user=Delete User
\ No newline at end of file
user.tabs.delete_user=Delete User
# Plugins Admin Page
plugin.admin.title=Plugins
plugin.admin.info=Below is a list of plugins in the system.
plugin.admin.deleted_success=Plugin deleted successfully.
plugin.admin.deleted_failure=Unable to delete plugin.
plugin.admin.refresh_success=Plugin was successfully refreshed.
plugin.admin.name=Plugins
plugin.admin.description=Description
plugin.admin.version=Version
plugin.admin.author=Author
plugin.admin.restart=Restart
plugin.admin.delete=Delete
plugin.admin.no_plugin=No Plugins Loaded.
plugin.admin.click_edit=Click to edit...
plugin.admin.click_delete=Click to delete...
plugin.admin.confirm=Delete plugin?
\ No newline at end of file
......@@ -29,6 +29,8 @@ tab.server.descr=\u5355\u51fb\u53ef\u7ba1\u7406\u670d\u52a1\u5668\u8bbe\u7f6e
sidebar.server-db.descr=\u6570\u636e\u5e93
sidebar.server-logs=\u65e5\u5fd7
sidebar.server-logs.descr=\u5355\u51fb\u53ef\u67e5\u770b\u670d\u52a1\u5668\u65e5\u5fd7
sidebar.plugin-settings=Plugins
sidebar.plugin-settings.descr=Click to view plugins
sidebar.sidebar-server-settings=\u670d\u52a1\u5668\u8bbe\u7f6e
sidebar.server-reg-and-login=\u6ce8\u518c\u548c\u767b\u5f55
sidebar.server-reg-and-login.descr=\u5355\u51fb\u53ef\u7f16\u8f91\u6ce8\u518c\u548c\u767b\u5f55\u7b56\u7565
......@@ -1094,4 +1096,22 @@ user.tabs.properties=\u7528\u6237\u5c5e\u6027
user.tabs.edit=\u7f16\u8f91\u7528\u6237
user.tabs.send=\u53d1\u9001\u6d88\u606f
user.tabs.change_pwd=\u66f4\u6539\u5bc6\u7801
user.tabs.delete_user=\u5220\u9664\u7528\u6237
\ No newline at end of file
user.tabs.delete_user=\u5220\u9664\u7528\u6237
# Plugins Admin Page
plugin.admin.title=Plugins
plugin.admin.info=Below is a list of plugins in the system.
plugin.admin.deleted_success=Plugin deleted successfully.
plugin.admin.deleted_failure=Unable to delete plugin.
plugin.admin.refresh_success=Plugin was successfully refreshed.
plugin.admin.name=Plugins
plugin.admin.description=Description
plugin.admin.version=Version
plugin.admin.author=Author
plugin.admin.restart=Restart
plugin.admin.delete=Delete
plugin.admin.no_plugin=No Plugins Loaded.
plugin.admin.click_edit=Click to edit...
plugin.admin.click_delete=Click to delete...
plugin.admin.confirm=Delete plugin?
\ No newline at end of file
......@@ -37,6 +37,11 @@
<item id="server-logs" name="${sidebar.server-logs}"
url="logviewer.jsp"
description="${sidebar.server-logs.descr}" />
<!-- Plugins -->
<item id="plugin-settings" name="${sidebar.plugin-settings}"
url="plugin-admin.jsp"
description="${sidebar.plugin-settings.descr}" />
</sidebar>
<!-- Server Settings -->
......
<%--
- Copyright (C) 2005 Jive Software. All rights reserved.
-
- This software is published under the terms of the GNU Public License (GPL),
- a copy of which is included in this distribution.
--%>
<%@ page import="java.util.zip.ZipFile,
java.util.jar.JarFile,
java.util.jar.JarEntry,
java.io.*,
org.dom4j.io.SAXReader,
org.dom4j.Document,
org.dom4j.Element,
org.dom4j.Node,
java.text.DateFormat,
org.jivesoftware.admin.AdminPageBean,
org.jivesoftware.messenger.XMPPServer,
org.jivesoftware.messenger.container.PluginManager,
org.jivesoftware.util.*,
org.jivesoftware.messenger.container.Plugin,
java.util.*"
%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<jsp:useBean id="webManager" class="org.jivesoftware.util.WebManager" />
<% webManager.init(request, response, session, application, out ); %>
<%
String deletePlugin = ParamUtils.getParameter(request, "deleteplugin");
String refreshPlugin = ParamUtils.getParameter(request, "refreshplugin");
final PluginManager pluginManager = webManager.getXMPPServer().getPluginManager();
List<Plugin> plugins = new ArrayList<Plugin>(pluginManager.getPlugins());
if (plugins != null) {
Collections.sort(plugins, new Comparator<Plugin>() {
public int compare(Plugin p1, Plugin p2) {
return pluginManager.getName(p1).compareTo(pluginManager.getName(p2));
}
});
}
if (deletePlugin != null) {
File pluginDir = pluginManager.getPluginDirectory(pluginManager.getPlugin(deletePlugin));
File pluginJar = new File(pluginDir.getParent(), pluginDir.getName() + ".jar");
// Also try the .war extension.
if (!pluginJar.exists()) {
pluginJar = new File(pluginDir.getParent(), pluginDir.getName() + ".war");
}
pluginJar.delete();
response.sendRedirect("plugin-admin.jsp?deletesuccess=false");
return;
}
if (refreshPlugin != null) {
for (Plugin plugin : plugins) {
File pluginDir = pluginManager.getPluginDirectory(plugin);
if (refreshPlugin.equals(pluginDir.getName())) {
pluginManager.unloadPlugin(refreshPlugin);
response.sendRedirect("plugin-admin.jsp?refrehsuccess=true");
return;
}
}
}
%>
<jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" />
<%
String title = LocaleUtils.getLocalizedString("plugin.admin.title");
pageinfo.setTitle(title);
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Main", "index.jsp"));
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "plugin-admin.jsp"));
pageinfo.setPageID("plugin-settings");
%>
<jsp:include page="top.jsp" flush="true" />
<jsp:include page="title.jsp" flush="true" />
<% if ("true".equals(request.getParameter("deletesuccess"))) { %>
<div class="jive-success">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr>
<td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" border="0"></td>
<td class="jive-icon-label"><fmt:message key="plugin.admin.deleted_success" /></td>
</tr>
</tbody>
</table>
</div>
<br>
<% } else if ("false".equals(request.getParameter("deletesuccess"))) { %>
<div class="jive-error">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr>
<td class="jive-icon"><img src="images/error-16x16.gif" width="16" height="16" border="0"></td>
<td class="jive-icon-label"><fmt:message key="plugin.admin.deleted_failure" /></td>
</tr>
</tbody>
</table>
</div>
<br>
<% } %>
<% if ("true".equals(request.getParameter("refrehsuccess"))) { %>
<div class="jive-success">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr><td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" border="0"></td>
<td class="jive-icon-label"><fmt:message key="plugin.admin.refresh_success" /></td></tr>
</tbody>
</table>
</div>
<br>
<% } %>
<p>
<fmt:message key="plugin.admin.info" />
</p>
<p>
<div class="jive-table">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<thead>
<tr>
<th>&nbsp;</th>
<th nowrap><fmt:message key="plugin.admin.name" /></th>
<th nowrap><fmt:message key="plugin.admin.description" /></th>
<th nowrap><fmt:message key="plugin.admin.version" /></th>
<th nowrap><fmt:message key="plugin.admin.author" /></th>
<th nowrap><fmt:message key="plugin.admin.restart" /></th>
<th nowrap><fmt:message key="plugin.admin.delete" /></th>
</tr>
</thead>
<tbody>
<%
if (plugins.size() == 0) {
%>
<tr>
<td align="center" colspan="7"><fmt:message key="plugin.admin.no_plugin" /></td>
</tr>
<%
}
for (int i=0; i<plugins.size(); i++) {
Plugin plugin = plugins.get(i);
String dirName = pluginManager.getPluginDirectory(pluginManager.getPlugin(deletePlugin)).getName();
String pluginName = pluginManager.getName(plugin);
String pluginDescription = pluginManager.getDescription(plugin);
String pluginAuthor = pluginManager.getAuthor(plugin);
String pluginVersion = pluginManager.getVersion(plugin);
%>
<tr class="jive-<%= (((i%2)==0) ? "even" : "odd") %>">
<td width="1%">
<%= i+1 %>
</td>
<td width="20%">
<%= (pluginName != null ? pluginName : dirName) %> &nbsp;
</td>
<td width="60%">
<%= pluginDescription != null ? pluginDescription : "" %> &nbsp;
</td>
<td width="5%">
<%= pluginVersion != null ? pluginVersion : "" %> &nbsp;
</td>
<td width="15%">
<%= pluginAuthor != null ? pluginAuthor : "" %> &nbsp;
</td>
<td width="1%" align="center">
<a href="plugin-admin.jsp?refreshplugin=<%= dirName %>"
title="<fmt:message key="plugin.admin.click_refresh" />"
><img src="images/refresh-16x16.gif" width="16" height="16" border="0"></a>
</td>
<td width="1%" align="center" style="border-right:1px #ccc solid;">
<a href="#" onclick="if (confirm('<fmt:message key="plugin.admin.confirm" />')) { location.replace('plugin-admin.jsp?deleteplugin=<%= dirName %>'); } "
title="<fmt:message key="plugin.admin.click_delete" />"
><img src="images/delete-16x16.gif" width="16" height="16" border="0"></a>
</td>
</tr>
<%
}
%>
</tbody>
</table>
</div>
<jsp:include page="bottom.jsp" flush="true" />
\ No newline at end of file
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