Commit 5a72c447 authored by Derek DeMoro's avatar Derek DeMoro Committed by derek

Initial check in for plugins. Documentation and bug fixing to come now.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@4130 b35dd754-fafc-0310-a699-88a17e54d16e
parent 965f6b1d
......@@ -190,4 +190,12 @@ public class AvailablePlugin {
}
return Long.parseLong(fileSize);
}
/**
* Returns the hash code for this object.
* @return the hash code.
*/
public int getHashCode(){
return hashCode();
}
}
/**
* $Revision$
* $Date$
*
* Copyright (C) 1999-2005 Jive Software. All rights reserved.
* This software is the proprietary information of Jive Software. Use is subject to license terms.
*/
package org.jivesoftware.wildfire.update;
import org.jivesoftware.util.Log;
import org.jivesoftware.wildfire.XMPPServer;
import org.jivesoftware.wildfire.update.Update;
import org.jivesoftware.wildfire.update.UpdateManager;
/**
*
*/
public class PluginDownloadManager {
public Update downloadPlugin(String url) {
UpdateManager updateManager = XMPPServer.getInstance().getUpdateManager();
updateManager.downloadPlugin(url);
Update returnUpdate = null;
for (Update update : updateManager.getPluginUpdates()) {
if (update.getURL().equals(url)) {
returnUpdate = update;
break;
}
}
try {
updateManager.checkForPluginsUpdates(true);
}
catch (Exception e) {
Log.error(e);
}
return returnUpdate;
}
public int installPlugin(String url, int hashCode) {
UpdateManager updateManager = XMPPServer.getInstance().getUpdateManager();
updateManager.downloadPlugin(url);
return hashCode;
}
}
......@@ -109,4 +109,12 @@ public class Update {
public void setDownloaded(boolean downloaded) {
this.downloaded = downloaded;
}
/**
* Returns the hashCode for this update object.
* @return hashCode
*/
public int getHashCode(){
return hashCode();
}
}
......@@ -32,14 +32,27 @@ import org.jivesoftware.wildfire.container.Plugin;
import org.xmpp.packet.JID;
import org.xmpp.packet.Message;
import java.io.*;
import java.util.*;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.StringReader;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
* Service that frequently checks for new server or plugins releases. By default the service
* will check every 48 hours for updates. Use the system property <tt>update.frequency</tt>
* to set new values.<p>
*
* <p/>
* New versions of plugins can be downloaded and installed. However, new server releases
* should be manually installed.
*
......@@ -265,7 +278,7 @@ public class UpdateManager extends BasicModule {
// Remove installed plugins from the list of available plugins
for (Plugin plugin : server.getPluginManager().getPlugins()) {
String pluginName = server.getPluginManager().getName(plugin);
for (Iterator<AvailablePlugin> it=plugins.iterator(); it.hasNext();) {
for (Iterator<AvailablePlugin> it = plugins.iterator(); it.hasNext();) {
AvailablePlugin availablePlugin = it.next();
if (availablePlugin.getName().equals(pluginName)) {
it.remove();
......@@ -429,7 +442,7 @@ public class UpdateManager extends BasicModule {
Element xmlResponse = new SAXReader().read(new StringReader(response)).getRootElement();
Iterator plugins = xmlResponse.elementIterator("plugin");
while (plugins.hasNext()) {
Element plugin = (Element) plugins.next();
Element plugin = (Element)plugins.next();
String pluginName = plugin.attributeValue("name");
String latestVersion = plugin.attributeValue("latest");
String icon = plugin.attributeValue("icon");
......@@ -689,7 +702,7 @@ public class UpdateManager extends BasicModule {
// Parse info and recreate available plugins
Iterator it = xmlResponse.getRootElement().elementIterator("plugin");
while (it.hasNext()) {
Element plugin = (Element) it.next();
Element plugin = (Element)it.next();
String pluginName = plugin.attributeValue("name");
String latestVersion = plugin.attributeValue("latest");
String icon = plugin.attributeValue("icon");
......@@ -707,4 +720,13 @@ public class UpdateManager extends BasicModule {
availablePlugins.put(pluginName, available);
}
}
/**
* Returns a previously fetched list of updates.
*
* @return a previously fetched list of updates.
*/
public Collection<Update> getPluginUpdates() {
return pluginUpdates;
}
}
<!DOCTYPE dwr PUBLIC
"-//GetAhead Limited//DTD Direct Web Remoting 1.0//EN"
"http://www.getahead.ltd.uk/dwr/dwr10.dtd">
"-//GetAhead Limited//DTD Direct Web Remoting 1.0//EN"
"http://www.getahead.ltd.uk/dwr/dwr10.dtd">
<dwr>
<allow>
<create creator="new" javascript="JDate">
<param name="class" value="java.util.Date"/>
</create>
</allow>
<allow>
<create creator="new" javascript="JDate">
<param name="class" value="java.util.Date"/>
</create>
</allow>
<allow>
<create creator="new" javascript="downloader">
<param name="class" value="org.jivesoftware.wildfire.update.PluginDownloadManager"/>
</create>
<convert converter="bean" match="org.jivesoftware.wildfire.update.Update"/>
<convert converter="bean" match="org.jivesoftware.wildfire.update.AvailablePlugin"/>
</allow>
</dwr>
......@@ -9,14 +9,14 @@
org.jivesoftware.wildfire.update.AvailablePlugin,
org.jivesoftware.wildfire.update.UpdateManager,
java.util.Collections"
%>
<%@ page import="java.util.Comparator"%>
<%@ page import="java.util.List"%>
%>
<%@ page import="java.util.Comparator" %>
<%@ page import="java.util.List" %><%@ page import="org.jivesoftware.util.ByteFormat"%>
<%@ 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" />
<jsp:useBean id="webManager" class="org.jivesoftware.util.WebManager"/>
<%
boolean downloadRequested = request.getParameter("download") != null;
......@@ -28,7 +28,7 @@
// Sort plugins alphabetically
Collections.sort(plugins, new Comparator() {
public int compare(Object o1, Object o2) {
return ((AvailablePlugin) o1).getName().compareTo(((AvailablePlugin) o2).getName());
return ((AvailablePlugin)o1).getName().compareTo(((AvailablePlugin)o2).getName());
}
});
......@@ -44,34 +44,230 @@
<head>
<title><fmt:message key="plugin.available.title"/></title>
<meta name="pageID" content="available-plugins"/>
<style type="text/css">
.content {
border-color: #bbb;
border-style: solid;
border-width: 0px 0px 1px 0px;
}
.textfield {
font-size: 11px;
font-family: verdana;
padding: 3px 2px;
background: #efefef;
}
.text {
font-size: 11px;
font-family: verdana;
}
.small-label {
font-size: 11px;
font-weight: bold;
font-family: verdana;
}
.small-label-link {
font-size: 11px;
font-weight: bold;
font-family: verdana;
text-decoration: underline;
}
.light-gray-border {
border-color: #bbb;
border-style: solid;
border-width: 1px 1px 1px 1px;
padding: 5px;
}
.light-gray-border-bottom {
border-color: #bbb;
border-style: solid;
border-width: 0px 0px 1px 0px;
}
.table-header {
text-align: left;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 8pt;
font-weight: bold;
border-color: #bbb;
border-style: solid;
border-width: 1px 0px 1px 0px;
padding: 5px;
}
.row-header {
text-align: left;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 8pt;
font-weight: bold;
border-color: #bbb;
border-style: solid;
border-width: 1px 1px 1px 0px;
padding: 5px;
}
.table-header-left {
text-align: left;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 8pt;
font-weight: bold;
border-color: #bbb;
border-style: solid;
border-width: 1px 0px 1px 1px;
padding: 5px;
}
.table-header-right {
text-align: left;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 8pt;
font-weight: bold;
border-color: #bbb;
border-style: solid;
border-width: 1px 1px 1px 0px;
padding: 5px;
}
.update-top {
text-align: left;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 9pt;
background: #E7FBDE;
border-color: #73CB73;
border-style: solid;
border-width: 1px 0px 0px 0px;
padding: 5px;
}
.update-bottom {
text-align: left;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 8pt;
font-weight: bold;
background: #E7FBDE;
border-color: #73CB73;
border-style: solid;
border-width: 0px 0px 1px 0px;
padding: 5px;
}
.update-top-left {
text-align: left;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 8pt;
font-weight: bold;
background: #E7FBDE;
border-color: #73CB73;
border-style: solid;
border-width: 1px 0px 0px 1px;
padding: 5px;
}
.update-bottom-left {
text-align: left;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 8pt;
font-weight: bold;
background: #E7FBDE;
border-color: #73CB73;
border-style: solid;
border-width: 0px 0px 1px 1px;
padding: 5px;
}
.update-bottom-right {
text-align: left;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 8pt;
font-weight: bold;
background: #E7FBDE;
border-color: #73CB73;
border-style: solid;
border-width: 0px 1px 1px 0px;
padding: 5px;
}
.update-right {
text-align: left;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 8pt;
font-weight: bold;
background: #E7FBDE;
border-color: #73CB73;
border-style: solid;
border-width: 1px 1px 0px 0px;
padding: 5px;
}
.line-bottom-border {
font-family: verdana, arial, helvetica, sans-serif;
font-size: 9pt;
border-color: #bbb;
border-style: solid;
border-width: 0px 0px 1px 0px;
padding: 5px;
}
</style>
<script src="dwr/engine.js" type="text/javascript"></script>
<script src="dwr/util.js" type="text/javascript"></script>
<script src="dwr/interface/downloader.js" type="text/javascript"></script>
<script type="text/javascript">
function downloadPlugin(url, id) {
document.getElementById(id+"-image").innerHTML = '<img src="images/working-16x16.gif" border="0"/>';
document.getElementById(id).style.background = "#FFFFF7";
downloader.installPlugin(downloadComplete, url, id);
}
function downloadComplete(id) {
document.getElementById(id).style.display = 'none';
document.getElementById(id + "-row").style.display = '';
setTimeout("fadeIt('"+id+"')", 3000);
}
function fadeIt(id){
Effect.Fade(id+"-row");
}
</script>
</head>
<body>
<p>
<fmt:message key="plugin.available.info" />
<fmt:message key="plugin.available.info"/>
</p>
<p>
<div class="jive-table">
<div class="light-gray-border" style="padding:10px;">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<thead>
<tr>
<th>&nbsp;</th>
<th nowrap colspan="2"><fmt:message key="plugin.available.name" /></th>
<th nowrap><fmt:message key="plugin.available.description" /></th>
<th nowrap><fmt:message key="plugin.available.version" /></th>
<th nowrap><fmt:message key="plugin.available.author" /></th>
<th nowrap><fmt:message key="plugin.available.install" /></th>
<tr style="background:#F7F7FF;">
<td class="table-header-left">&nbsp;</td>
<td nowrap colspan="2" class="table-header">Open Source Plugins</td>
<td nowrap class="table-header"><fmt:message key="plugin.available.description"/></td>
<td nowrap class="table-header"><fmt:message key="plugin.available.version"/></td>
<td nowrap class="table-header"><fmt:message key="plugin.available.author"/></td>
<td nowrap class="table-header">File Size</td>
<td nowrap class="table-header-right"><fmt:message key="plugin.available.install"/></td>
</tr>
</thead>
<tbody>
<%
// If only the admin plugin is installed, show "none".
// If only the admin plugin is installed, show "none".
if (plugins.isEmpty()) {
%>
<tr>
<td align="center" colspan="8"><fmt:message key="plugin.available.no_plugin" /></td>
<td align="center" colspan="8"><fmt:message key="plugin.available.no_plugin"/></td>
</tr>
<%
}
......@@ -81,56 +277,156 @@
String pluginDescription = plugin.getDescription();
String pluginAuthor = plugin.getAuthor();
String pluginVersion = plugin.getLatestVersion();
ByteFormat byteFormat = new ByteFormat();
String fileSize = byteFormat.format(plugin.getFileSize());
if (plugin.isCommercial()) {
continue;
}
%>
<tr>
<td width="1%">
<tr id="<%= plugin.hashCode()%>">
<td width="1%" class="line-bottom-border">
<% if (plugin.getIcon() != null) { %>
<img src="<%= plugin.getIcon() %>" width="16" height="16" alt="Plugin">
<% } else { %>
<% }
else { %>
<img src="images/plugin-16x16.gif" width="16" height="16" alt="Plugin">
<% } %>
</td>
<td width="20%" nowrap>
<td width="20%" nowrap class="line-bottom-border">
<%= (pluginName != null ? pluginName : "") %> &nbsp;
</td>
<td nowrap valign="top">
<td nowrap valign="top" class="line-bottom-border">
<% if (plugin.getReadme() != null) { %>
<a href="<%= plugin.getReadme() %>"
><img src="images/doc-readme-16x16.gif" width="16" height="16" border="0" alt="README"></a>
<% } else { %> &nbsp; <% } %>
><img src="images/doc-readme-16x16.gif" width="16" height="16" border="0" alt="README"></a>
<% }
else { %> &nbsp; <% } %>
<% if (plugin.getChangelog() != null) { %>
<a href="<%= plugin.getChangelog() %>"
><img src="images/doc-changelog-16x16.gif" width="16" height="16" border="0" alt="changelog"></a>
<% } else { %> &nbsp; <% } %>
><img src="images/doc-changelog-16x16.gif" width="16" height="16" border="0" alt="changelog"></a>
<% }
else { %> &nbsp; <% } %>
</td>
<td width="60%">
<td width="60%" class="line-bottom-border">
<%= pluginDescription != null ? pluginDescription : "" %>
</td>
<td width="5%" align="center" valign="top">
<td width="5%" align="center" valign="top" class="line-bottom-border">
<%= pluginVersion != null ? pluginVersion : "" %>
</td>
<td width="15%" nowrap valign="top">
<td width="15%" nowrap valign="top" class="line-bottom-border">
<%= pluginAuthor != null ? pluginAuthor : "" %> &nbsp;
</td>
<td width="1%" align="center" valign="top">
<td width="15%" nowrap valign="top" class="line-bottom-border">
<%= fileSize %>
</td>
<td width="1%" align="center" valign="top" class="line-bottom-border">
<%
String updateURL = plugin.getURL();
if (updateManager.isPluginDownloaded(updateURL)) {
%>
&nbsp;
<% } else { %>
<% }
else { %>
<%
if (updateURL.endsWith(".jar") || updateURL.endsWith(".zip") || updateURL.endsWith(".war")) {
// Change it so that the server downloads and installs the new version of the plugin
updateURL = "available-plugins.jsp?download=true&url="+ updateURL;
}
%>
<a href="<%= updateURL %>"
><img src="images/doc-down-16x16.gif" width="16" height="16" border="0" alt="<fmt:message key="plugin.available.download" />"></a>
<span id="<%= plugin.hashCode() %>-image"><a href="javascript:downloadPlugin('<%=updateURL%>', '<%= plugin.hashCode()%>')"><img src="images/add-16x16.gif" width="16" height="16" border="0" alt="<fmt:message key="plugin.available.download" />"></a></span>
<% } %>
</td>
</tr>
<%
<tr id="<%= plugin.hashCode()%>-row" style="display:none;">
<td width="1%" class="line-bottom-border">
<img src="<%= plugin.getIcon()%>" width="16" height="16" />
</td>
<td nowrap class="line-bottom-border"><%= plugin.getName()%> plugin installed successfully!</td>
<td colspan="5" class="line-bottom-border">&nbsp;</td>
<td class="line-bottom-border" align="center">
<img src="images/success-16x16.gif" height="16" width="16" />
</td>
</tr>
<%
}
%>
<tr><td><br/></td></tr>
<tr style="background:#F7F7FF;">
<td class="table-header-left">&nbsp;</td>
<td nowrap colspan="7" class="row-header">Commercial Plugins</td>
</tr>
<%
for (AvailablePlugin plugin : plugins) {
String pluginName = plugin.getName();
String pluginDescription = plugin.getDescription();
String pluginAuthor = plugin.getAuthor();
String pluginVersion = plugin.getLatestVersion();
ByteFormat byteFormat = new ByteFormat();
String fileSize = byteFormat.format(plugin.getFileSize());
if (plugin.isCommercial()) {
continue;
}
%>
<tr id="<%= plugin.hashCode()%>">
<td width="1%" class="line-bottom-border">
<% if (plugin.getIcon() != null) { %>
<img src="<%= plugin.getIcon() %>" width="16" height="16" alt="Plugin">
<% }
else { %>
<img src="images/plugin-16x16.gif" width="16" height="16" alt="Plugin">
<% } %>
</td>
<td width="20%" nowrap class="line-bottom-border">
<%= (pluginName != null ? pluginName : "") %> &nbsp;
</td>
<td nowrap valign="top" class="line-bottom-border">
<% if (plugin.getReadme() != null) { %>
<a href="<%= plugin.getReadme() %>"
><img src="images/doc-readme-16x16.gif" width="16" height="16" border="0" alt="README"></a>
<% }
else { %> &nbsp; <% } %>
<% if (plugin.getChangelog() != null) { %>
<a href="<%= plugin.getChangelog() %>"
><img src="images/doc-changelog-16x16.gif" width="16" height="16" border="0" alt="changelog"></a>
<% }
else { %> &nbsp; <% } %>
</td>
<td width="60%" class="line-bottom-border">
<%= pluginDescription != null ? pluginDescription : "" %>
</td>
<td width="5%" align="center" valign="top" class="line-bottom-border">
<%= pluginVersion != null ? pluginVersion : "" %>
</td>
<td width="15%" nowrap valign="top" class="line-bottom-border">
<%= pluginAuthor != null ? pluginAuthor : "" %> &nbsp;
</td>
<td width="15%" nowrap valign="top" class="line-bottom-border">
<%= fileSize %>
</td>
<td width="1%" align="center" valign="top" class="line-bottom-border">
<%
String updateURL = plugin.getURL();
if (updateManager.isPluginDownloaded(updateURL)) {
%>
&nbsp;
<% }
else { %>
<span id="<%= plugin.hashCode() %>-image"><a href="javascript:downloadPlugin('<%=updateURL%>', '<%= plugin.hashCode()%>')"><img src="images/add-16x16.gif" width="16" height="16" border="0" alt="<fmt:message key="plugin.available.download" />"></a></span>
<% } %>
</td>
</tr>
<tr id="<%= plugin.hashCode()%>-row" style="display:none;">
<td width="1%" class="line-bottom-border">
<img src="<%= plugin.getIcon()%>" width="16" height="16" />
</td>
<td class="line-bottom-border"><%= plugin.getName()%> plugin installed successfully!</td>
<td colspan="5" class="line-bottom-border">&nbsp;</td>
<td class="line-bottom-border">
<img src="images/success-16x16.gif" height="16" width="16" />
</td>
</tr>
<%
}
%>
</tbody>
......
......@@ -6,30 +6,32 @@
--%>
<%@ page import="org.jivesoftware.util.ParamUtils,
org.jivesoftware.wildfire.XMPPServer,
org.jivesoftware.wildfire.container.Plugin,
org.jivesoftware.util.WebManager,
org.jivesoftware.wildfire.XMPPServer,
org.jivesoftware.wildfire.container.Plugin,
org.jivesoftware.wildfire.container.PluginManager,
org.jivesoftware.wildfire.update.Update,
org.jivesoftware.wildfire.update.UpdateManager"
%>
<%@ page import="java.io.BufferedReader"%>
<%@ page import="java.io.File"%>
<%@ page import="java.io.FileReader"%>
<%@ page import="java.io.IOException"%>
<%@ page import="java.net.URLEncoder"%>
<%@ page import="java.util.ArrayList"%>
<%@ page import="java.util.Collections"%>
<%@ page import="java.util.Comparator"%>
<%@ page import="java.util.List"%>
org.jivesoftware.wildfire.update.Update"
%>
<%@ page import="org.jivesoftware.wildfire.update.UpdateManager" %>
<%@ page import="java.io.BufferedReader" %>
<%@ page import="java.io.File" %>
<%@ page import="java.io.FileReader" %>
<%@ page import="java.io.IOException" %>
<%@ page import="java.net.URLEncoder" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.Collections" %>
<%@ page import="java.util.Comparator" %>
<%@ page import="java.util.List" %>
<%@ 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" />
<%
String deletePlugin = ParamUtils.getParameter(request, "deleteplugin");
String reloadPlugin = ParamUtils.getParameter(request, "reloadplugin");
WebManager webManager = new WebManager();
%>
<%
String deletePlugin = ParamUtils.getParameter(request, "deleteplugin");
String reloadPlugin = ParamUtils.getParameter(request, "reloadplugin");
boolean showReadme = ParamUtils.getBooleanParameter(request, "showReadme", false);
boolean showChangelog = ParamUtils.getBooleanParameter(request, "showChangelog", false);
boolean showIcon = ParamUtils.getBooleanParameter(request, "showIcon", false);
......@@ -49,7 +51,7 @@
}
});
}
if (downloadRequested) {
// Download and install new version of plugin
updateManager.downloadPlugin(url);
......@@ -57,7 +59,7 @@
if (deletePlugin != null) {
File pluginDir = pluginManager.getPluginDirectory(pluginManager.getPlugin(deletePlugin));
File pluginJar = new File(pluginDir.getParent(), pluginDir.getName() + ".jar");
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");
......@@ -66,158 +68,366 @@
pluginManager.unloadPlugin(pluginDir.getName());
response.sendRedirect("plugin-admin.jsp?deletesuccess=true");
return;
}
if (reloadPlugin != null) {
for (Plugin plugin : plugins) {
}
if (reloadPlugin != null) {
for (Plugin plugin : plugins) {
File pluginDir = pluginManager.getPluginDirectory(plugin);
if (reloadPlugin.equals(pluginDir.getName())) {
pluginManager.unloadPlugin(reloadPlugin);
response.sendRedirect("plugin-admin.jsp?reloadsuccess=true");
if (reloadPlugin.equals(pluginDir.getName())) {
pluginManager.unloadPlugin(reloadPlugin);
response.sendRedirect("plugin-admin.jsp?reloadsuccess=true");
return;
}
}
}
}
}
}
%>
<% if (showReadme) {
String pluginName = ParamUtils.getParameter(request, "plugin");
Plugin plugin = pluginManager.getPlugin(pluginName);
if (plugin != null) {
File readme = new File(pluginManager.getPluginDirectory(plugin), "readme.html");
if (readme.exists()) {
BufferedReader in = null;
try {
in = new BufferedReader(new FileReader(readme));
String line;
while ((line = in.readLine()) != null) {
String pluginName = ParamUtils.getParameter(request, "plugin");
Plugin plugin = pluginManager.getPlugin(pluginName);
if (plugin != null) {
File readme = new File(pluginManager.getPluginDirectory(plugin), "readme.html");
if (readme.exists()) {
BufferedReader in = null;
try {
in = new BufferedReader(new FileReader(readme));
String line;
while ((line = in.readLine()) != null) {
%>
<%= line %>
<%= line %>
<%
}
}
catch (IOException ioe) {
ioe.printStackTrace();
}
finally {
if (in != null) {
try { in.close(); } catch (Exception e) { }
}
}
}
}
return;
}
}
}
catch (IOException ioe) {
ioe.printStackTrace();
}
finally {
if (in != null) {
try {
in.close();
}
catch (Exception e) {
}
}
}
}
}
return;
}
%>
<% if (showChangelog) {
String pluginName = ParamUtils.getParameter(request, "plugin");
Plugin plugin = pluginManager.getPlugin(pluginName);
if (plugin != null) {
File changelog = new File(pluginManager.getPluginDirectory(plugin), "changelog.html");
if (changelog.exists()) {
BufferedReader in = null;
try {
in = new BufferedReader(new FileReader(changelog));
String line;
while ((line = in.readLine()) != null) {
String pluginName = ParamUtils.getParameter(request, "plugin");
Plugin plugin = pluginManager.getPlugin(pluginName);
if (plugin != null) {
File changelog = new File(pluginManager.getPluginDirectory(plugin), "changelog.html");
if (changelog.exists()) {
BufferedReader in = null;
try {
in = new BufferedReader(new FileReader(changelog));
String line;
while ((line = in.readLine()) != null) {
%>
<%= line %>
<%= line %>
<%
}
}
catch (IOException ioe) {
}
finally {
if (in != null) {
try { in.close(); } catch (Exception e) { }
}
}
}
}
return;
}
}
catch (IOException ioe) {
}
finally {
if (in != null) {
try {
in.close();
}
catch (Exception e) {
}
}
}
}
}
return;
}
%>
<html>
<head>
<title><fmt:message key="plugin.admin.title"/></title>
<meta name="pageID" content="plugin-settings"/>
<meta name="helpPage" content="manage_system_plugins.html"/>
</head>
<body>
<head>
<title><fmt:message key="plugin.admin.title"/></title>
<meta name="pageID" content="plugin-settings"/>
<meta name="helpPage" content="manage_system_plugins.html"/>
<script src="dwr/engine.js" type="text/javascript"></script>
<script src="dwr/util.js" type="text/javascript"></script>
<script src="dwr/interface/downloader.js" type="text/javascript"></script>
<style type="text/css">
.content {
border-color: #bbb;
border-style: solid;
border-width: 0px 0px 1px 0px;
}
.textfield {
font-size: 11px;
font-family: verdana;
padding: 3px 2px;
background: #efefef;
}
.text {
font-size: 11px;
font-family: verdana;
}
.small-label {
font-size: 11px;
font-weight: bold;
font-family: verdana;
}
.small-label-link {
font-size: 11px;
font-weight: bold;
font-family: verdana;
text-decoration: underline;
}
.light-gray-border {
border-color: #bbb;
border-style: solid;
border-width: 1px 1px 1px 1px;
padding: 5px;
}
.light-gray-border-bottom {
border-color: #bbb;
border-style: solid;
border-width: 0px 0px 1px 0px;
}
.table-header {
text-align: left;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 8pt;
font-weight: bold;
border-color: #bbb;
border-style: solid;
border-width: 1px 0px 1px 0px;
padding: 5px;
}
.table-header-left {
text-align: left;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 8pt;
font-weight: bold;
border-color: #bbb;
border-style: solid;
border-width: 1px 0px 1px 1px;
padding: 5px;
}
.table-header-right {
text-align: left;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 8pt;
font-weight: bold;
border-color: #bbb;
border-style: solid;
border-width: 1px 1px 1px 0px;
padding: 5px;
}
.table-font {
font-family: verdana, arial, helvetica, sans-serif;
font-size: 8pt;
}
.update-top {
text-align: left;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 9pt;
background: #E7FBDE;
border-color: #73CB73;
border-style: solid;
border-width: 1px 0px 0px 0px;
padding: 5px;
}
.update {
font-family: verdana, arial, helvetica, sans-serif;
font-size: 8pt;
background: #E7FBDE;
border-color: #73CB73;
border-style: solid;
border-width: 0px 1px 1px 1px;
padding: 5px;
}
.update-bottom {
text-align: left;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 8pt;
font-weight: bold;
background: #E7FBDE;
border-color: #73CB73;
border-style: solid;
border-width: 0px 0px 1px 0px;
padding: 5px;
}
.update-top-left {
text-align: left;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 8pt;
font-weight: bold;
background: #E7FBDE;
border-color: #73CB73;
border-style: solid;
border-width: 1px 0px 0px 1px;
padding: 5px;
}
.update-bottom-left {
text-align: left;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 8pt;
font-weight: bold;
background: #E7FBDE;
border-color: #73CB73;
border-style: solid;
border-width: 0px 0px 1px 1px;
padding: 5px;
}
.update-bottom-right {
text-align: left;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 8pt;
font-weight: bold;
background: #E7FBDE;
border-color: #73CB73;
border-style: solid;
border-width: 0px 1px 1px 0px;
padding: 5px;
}
.update-right {
text-align: left;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 8pt;
font-weight: bold;
background: #E7FBDE;
border-color: #73CB73;
border-style: solid;
border-width: 1px 1px 0px 0px;
padding: 5px;
}
.line-bottom-border {
text-align: left;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 9pt;
border-color: #bbb;
border-style: solid;
border-width: 0px 0px 1px 0px;
padding: 5px;
}
</style>
<script type="text/javascript">
function download(url, hashCode) {
document.getElementById(hashCode + "-row").style.display = 'none';
document.getElementById(hashCode + "-update").style.display = '';
downloader.downloadPlugin(downloadComplete, url);
}
function downloadComplete(update) {
document.getElementById(update.hashCode + "-row").style.display = 'none';
document.getElementById(update.hashCode + "-update").style.display = '';
document.getElementById(update.hashCode + "-image").innerHTML = '<img src="images/success-16x16.gif" border="0"/>';
document.getElementById(update.hashCode + "-text").innerHTML = 'Update Completed';
}
</script>
</head>
<body>
<% if ("true".equals(request.getParameter("deletesuccess"))) { %>
<div class="jive-success">
<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" alt=""></td>
<td class="jive-icon-label"><fmt:message key="plugin.admin.deleted_success" /></td>
</tr>
</tbody>
<tbody>
<tr>
<td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" border="0" alt=""></td>
<td class="jive-icon-label"><fmt:message key="plugin.admin.deleted_success"/></td>
</tr>
</tbody>
</table>
</div>
<br>
</div>
<br>
<% } else if ("false".equals(request.getParameter("deletesuccess"))) { %>
<% }
else if ("false".equals(request.getParameter("deletesuccess"))) { %>
<div class="jive-error">
<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" alt="" />></td>
<td class="jive-icon-label"><fmt:message key="plugin.admin.deleted_failure" /></td>
</tr>
</tbody>
<tbody>
<tr>
<td class="jive-icon"><img src="images/error-16x16.gif" width="16" height="16" border="0" alt=""/>></td>
<td class="jive-icon-label"><fmt:message key="plugin.admin.deleted_failure"/></td>
</tr>
</tbody>
</table>
</div>
<br>
</div>
<br>
<% } %>
<% if ("true".equals(request.getParameter("reloadsuccess"))) { %>
<div class="jive-success">
<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" alt=""></td>
<td class="jive-icon-label"><fmt:message key="plugin.admin.reload_success" /></td></tr>
</tbody>
<tbody>
<tr><td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" border="0" alt=""></td>
<td class="jive-icon-label"><fmt:message key="plugin.admin.reload_success"/></td></tr>
</tbody>
</table>
</div>
<br>
</div>
<br>
<% } %>
<p>
<fmt:message key="plugin.admin.info" />
<fmt:message key="plugin.admin.info"/>
</p>
<p>
<div class="jive-table">
<div class="light-gray-border" style="padding:10px;">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<thead>
<tr>
<th>&nbsp;</th>
<th nowrap colspan="2"><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="global.delete" /></th>
</tr>
</thead>
<tr>
<td nowrap colspan="3" class="table-header-left"><fmt:message key="plugin.admin.name"/></td>
<td nowrap class="table-header"><fmt:message key="plugin.admin.description"/></td>
<td nowrap class="table-header"><fmt:message key="plugin.admin.version"/></td>
<td nowrap class="table-header"><fmt:message key="plugin.admin.author"/></td>
<td nowrap class="table-header"><fmt:message key="plugin.admin.restart"/></td>
<td nowrap class="table-header-right"><fmt:message key="global.delete"/></td>
</tr>
<tbody>
<tr><td colspan="8"><br/></td></tr>
<%
// If only the admin plugin is installed, show "none".
// If only the admin plugin is installed, show "none".
if (plugins.size() == 1) {
%>
<tr>
<td align="center" colspan="8"><fmt:message key="plugin.admin.no_plugin" /></td>
</tr>
<tr>
<td align="center" colspan="8"><fmt:message key="plugin.admin.no_plugin"/></td>
</tr>
<%
}
......@@ -240,76 +450,111 @@
Update update = updateManager.getPluginUpdate(pluginName, pluginVersion);
%>
<tr>
<td width="1%">
<% if (icon.exists()) { %>
<img src="plugin-icon.jsp?plugin=<%= URLEncoder.encode(pluginDir.getName(), "utf-8") %>&showIcon=true&decorator=none" width="16" height="16" alt="Plugin">
<% } else { %>
<img src="images/plugin-16x16.gif" width="16" height="16" alt="Plugin">
<% } %>
</td>
<td width="20%" nowrap>
<%= (pluginName != null ? pluginName : dirName) %> &nbsp;
<%
boolean readmeExists = new File(pluginDir, "readme.html").exists();
boolean changelogExists = new File(pluginDir, "changelog.html").exists();
%>
</td>
<td nowrap valign="top">
<p><% if (readmeExists) { %>
<a href="plugin-admin.jsp?plugin=<%= URLEncoder.encode(pluginDir.getName(), "utf-8") %>&showReadme=true&decorator=none"
><img src="images/doc-readme-16x16.gif" width="16" height="16" border="0" alt="README"></a>
<% } else { %> &nbsp; <% } %>
<% if (changelogExists) { %>
<a href="plugin-admin.jsp?plugin=<%= URLEncoder.encode(pluginDir.getName(), "utf-8") %>&showChangelog=true&decorator=none"
><img src="images/doc-changelog-16x16.gif" width="16" height="16" border="0" alt="changelog"></a>
<% } else { %> &nbsp; <% } %></p>
<% if (update != null) { %>
<p>
<%
String updateURL = update.getURL();
if (updateURL.endsWith(".jar") || updateURL.endsWith(".zip") || updateURL.endsWith(".war")) {
// Change it so that the server downloads and installs the new version of the plugin
updateURL = "plugin-admin.jsp?download=true&url="+ updateURL;
}
%>
<a href="<%= updateURL %>"
><img src="images/doc-down-16x16.gif" width="16" height="16" border="0" alt="<fmt:message key="plugin.admin.download" />"></a>
<% if (update.getChangelog() != null) { %>
<a href="<%= update.getChangelog()%>"
<tr valign="top">
<td width="1%" class="<%= update != null ? "update-top-left" : "line-bottom-border"%>">
<% if (icon.exists()) { %>
<img src="plugin-icon.jsp?plugin=<%= URLEncoder.encode(pluginDir.getName(), "utf-8") %>&showIcon=true&decorator=none" width="16" height="16" alt="Plugin">
<% }
else { %>
<img src="images/plugin-16x16.gif" width="16" height="16" alt="Plugin">
<% } %>
</td>
<td width="20%" nowrap valign="top" class="<%= update != null ? "update-top" : "line-bottom-border"%>">
<%= (pluginName != null ? pluginName : dirName) %> &nbsp;
<%
boolean readmeExists = new File(pluginDir, "readme.html").exists();
boolean changelogExists = new File(pluginDir, "changelog.html").exists();
%>
</td>
<td nowrap valign="top" class="<%= update != null ? "update-top" : "line-bottom-border"%>">
<p><% if (readmeExists) { %>
<a href="plugin-admin.jsp?plugin=<%= URLEncoder.encode(pluginDir.getName(), "utf-8") %>&showReadme=true&decorator=none"
><img src="images/doc-readme-16x16.gif" width="16" height="16" border="0" alt="README"></a>
<% }
else { %> &nbsp; <% } %>
<% if (changelogExists) { %>
<a href="plugin-admin.jsp?plugin=<%= URLEncoder.encode(pluginDir.getName(), "utf-8") %>&showChangelog=true&decorator=none"
><img src="images/doc-changelog-16x16.gif" width="16" height="16" border="0" alt="changelog"></a>
<% } else { %> &nbsp; <% } %>
</p>
<% } %>
</td>
<td width="60%">
<p><%= pluginDescription != null ? pluginDescription : "" %></p>
<% if (update != null) { %>
<p><fmt:message key="plugin.admin.update-desc" /></p>
<% } %>
</td>
<td width="5%" align="center" valign="top">
<p><%= pluginVersion != null ? pluginVersion : "" %></p>
<% if (update != null) { %>
<p><%= update.getLatestVersion() %></p>
<% } %>
</td>
<td width="15%" nowrap valign="top">
<%= pluginAuthor != null ? pluginAuthor : "" %> &nbsp;
</td>
<td width="1%" align="center" valign="top">
<a href="plugin-admin.jsp?reloadplugin=<%= dirName %>"
title="<fmt:message key="plugin.admin.click_reload" />"
><img src="images/refresh-16x16.gif" width="16" height="16" border="0" alt="<fmt:message key="global.refresh" />"></a>
</td>
<td width="1%" align="center" valign="top" 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="global.click_delete" />"
><img src="images/delete-16x16.gif" width="16" height="16" border="0" alt="<fmt:message key="global.delete" />"></a>
</td>
</tr>
<%
<% }
else { %> &nbsp; <% } %></p>
</td>
<td width="60%" valign="top" class="<%= update != null ? "update-top" : "line-bottom-border"%>">
<%= pluginDescription != null ? pluginDescription : "" %>
</td>
<td width="5%" align="center" valign="top" class="<%= update != null ? "update-top" : "line-bottom-border"%>">
<p><%= pluginVersion != null ? pluginVersion : "" %></p>
</td>
<td width="15%" nowrap valign="top" class="<%= update != null ? "update-top" : "line-bottom-border"%>">
<%= pluginAuthor != null ? pluginAuthor : "" %> &nbsp;
</td>
<td width="1%" align="center" valign="top" class="<%= update != null ? "update-top" : "line-bottom-border"%>">
<a href="plugin-admin.jsp?reloadplugin=<%= dirName %>"
title="<fmt:message key="plugin.admin.click_reload" />"
><img src="images/refresh-16x16.gif" width="16" height="16" border="0" alt="<fmt:message key="global.refresh" />"></a>
</td>
<td width="1%" align="center" valign="top" class="<%= update != null ? "update-right" : "line-bottom-border"%>">
<a href="#" onclick="if (confirm('<fmt:message key="plugin.admin.confirm" />')) { location.replace('plugin-admin.jsp?deleteplugin=<%= dirName %>'); } "
title="<fmt:message key="global.click_delete" />"
><img src="images/delete-16x16.gif" width="16" height="16" border="0" alt="<fmt:message key="global.delete" />"></a>
</td>
</tr>
<% if (update != null) { %>
<!-- Has Updates, show show -->
<%
String updateURL = update.getURL();
if (updateURL.endsWith(".jar") || updateURL.endsWith(".zip") || updateURL.endsWith(".war")) {
// Change it so that the server downloads and installs the new version of the plugin
updateURL = "plugin-admin.jsp?download=true&url=" + updateURL;
}
%>
<tr id="<%= update.hashCode() %>-row">
<td class="update-bottom-left">&nbsp;</td>
<td class="update-bottom" nowrap>
<span class="small-label">Version <%= update.getLatestVersion()%> Available</span>
</td>
<td nowrap class="update-bottom">
<% if (update.getChangelog() != null) { %>
<span class="text">(<a href="<%= update.getChangelog()%>">Change Log</a>)</span>
<% }
else { %>
&nbsp;
<% } %>
</td>
<td class="update-bottom">
<table>
<tr>
<td><a href="javascript:download('<%= update.getURL()%>', '<%=update.hashCode()%>')"><img src="images/icon_update-16x16.gif" width="16" height="16" border="0" alt="changelog"></a></td>
<td><a href="javascript:download('<%= update.getURL()%>', '<%=update.hashCode()%>')"><span class="small-label">Update</span></a></td>
</tr>
</table>
</td>
<td class="update-bottom" colspan="3">&nbsp;</td>
<td class="update-bottom-right" colspan="3">&nbsp;</td>
</tr>
<tr id="<%= update.hashCode()%>-update" style="display:none;">
<td colspan="8" align="center" class="update">
<table>
<tr>
<td id="<%= update.hashCode()%>-image"><img src="images/working-16x16.gif" border="0"/></td>
<td id="<%= update.hashCode()%>-text" class="table-font">Updating</td>
</tr>
</table>
</td>
</tr>
<% } %>
<tr><td></td></tr>
<!-- End of update section -->
<%
}
}
%>
......@@ -317,5 +562,5 @@
</table>
</div>
</body>
</body>
</html>
\ 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