Commit bd581076 authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

[JM-761] Working on making web interface functional.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@4650 b35dd754-fafc-0310-a699-88a17e54d16e
parent 9548f03a
<%@ page import="java.util.*,
org.jivesoftware.wildfire.XMPPServer,
org.jivesoftware.util.*,
org.jivesoftware.wildfire.gateway.GatewayPlugin"
errorPage="error.jsp"
%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<% // Get parameters
boolean save = request.getParameter("save") != null;
boolean success = request.getParameter("success") != null;
boolean aimEnabled = ParamUtils.getBooleanParameter(request, "aimEnabled");
boolean icqEnabled = ParamUtils.getBooleanParameter(request, "icqEnabled");
boolean yahooEnabled = ParamUtils.getBooleanParameter(request, "yahooEnabled");
boolean msnEnabled = ParamUtils.getBooleanParameter(request, "msnEnabled");
String serverName = XMPPServer.getInstance().getServerInfo().getName();
GatewayPlugin plugin = (GatewayPlugin)XMPPServer.getInstance().getPluginManager().getPlugin("gateway");
// Handle a save
if (save) {
//plugin.setPresencePublic(presencePublic);
if (aimEnabled) {
plugin.enableService("aim");
}
else {
plugin.disableService("aim");
}
if (icqEnabled) {
plugin.enableService("icq");
}
else {
plugin.disableService("icq");
}
if (yahooEnabled) {
plugin.enableService("yahoo");
}
else {
plugin.disableService("yahoo");
}
if (msnEnabled) {
plugin.enableService("msn");
}
else {
plugin.disableService("msn");
}
response.sendRedirect("gateway-service.jsp?success=true");
return;
}
aimEnabled = plugin.serviceEnabled("aim");
icqEnabled = plugin.serviceEnabled("icq");
yahooEnabled = plugin.serviceEnabled("yahoo");
msnEnabled = plugin.serviceEnabled("msn");
%>
<html>
<head>
<title>IM Gateway Settings</title>
<meta name="pageID" content="gateway-service"/>
</head>
<body>
<p>
Use the form below to enable or disable any of the available gateways. By
default, all of the gateways are turned off. Gateways will answer as the
JID provided in each corresponding section.
</p>
<% if (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"></td>
<td class="jive-icon-label">
Gateway services successfully updated.
</td></tr>
</tbody>
</table>
</div><br>
<% } %>
<form action="gateway-service.jsp?save" method="post">
<fieldset>
<legend>AIM Gateway</legend>
<div>
<p>
This gateway provides a mechanism for users to access the AIM network.
Users will be able to register with the JID specified below, specifying
their AIM screen name and password.<br />
<br />
JID: aim.<%= serverName %>
</p>
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tbody>
<tr>
<td width="1%">
<input type="radio" name="aimEnabled" value="true" id="rb01"
<%= ((aimEnabled) ? "checked" : "") %>>
</td>
<td width="99%">
<label for="rb01"><b>Enabled</b> - AIM gateway is available.</label>
</td>
</tr>
<tr>
<td width="1%">
<input type="radio" name="aimEnabled" value="false" id="rb02"
<%= ((!aimEnabled) ? "checked" : "") %>>
</td>
<td width="99%">
<label for="rb01"><b>Disabled</b> - AIM gateway is not available.</label>
</td>
</tr>
</tbody>
</table>
</div>
</fieldset>
<br><br>
<fieldset>
<legend>ICQ Gateway</legend>
<div>
<p>
This gateway provides a mechanism for users to access the ICQ network.
Users will be able to register with the JID specified below, specifying
their ICQ UIN (user identification number) and password.<br />
<br />
JID: icq.<%= serverName %>
</p>
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tbody>
<tr>
<td width="1%">
<input type="radio" name="icqEnabled" value="true" id="rb03"
<%= ((icqEnabled) ? "checked" : "") %>>
</td>
<td width="99%">
<label for="rb01"><b>Enabled</b> - ICQ gateway is available.</label>
</td>
</tr>
<tr>
<td width="1%">
<input type="radio" name="icqEnabled" value="false" id="rb04"
<%= ((!icqEnabled) ? "checked" : "") %>>
</td>
<td width="99%">
<label for="rb01"><b>Disabled</b> - ICQ gateway is not available.</label>
</td>
</tr>
</tbody>
</table>
</div>
</fieldset>
<br><br>
<fieldset>
<legend>Yahoo Gateway</legend>
<div>
<p>
This gateway provides a mechanism for users to access the YIM network.
Users will be able to register with the JID specified below, specifying
their YIM username and password.<br />
<br />
JID: yahoo.<%= serverName %>
</p>
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tbody>
<tr>
<td width="1%">
<input type="radio" name="yahooEnabled" value="true" id="rb03"
<%= ((yahooEnabled) ? "checked" : "") %>>
</td>
<td width="99%">
<label for="rb01"><b>Enabled</b> - Yahoo gateway is available.</label>
</td>
</tr>
<tr>
<td width="1%">
<input type="radio" name="yahooEnabled" value="false" id="rb04"
<%= ((!yahooEnabled) ? "checked" : "") %>>
</td>
<td width="99%">
<label for="rb01"><b>Disabled</b> - Yahoo gateway is not available.</label>
</td>
</tr>
</tbody>
</table>
</div>
</fieldset>
<br><br>
<fieldset>
<legend>MSN Gateway</legend>
<div>
<p>
This gateway provides a mechanism for users to access the MSN network.
Users will be able to register with the JID specified below, specifying
their MSN username and password.<br />
<br />
JID: msn.<%= serverName %>
</p>
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tbody>
<tr>
<td width="1%">
<input type="radio" name="msnEnabled" value="true" id="rb03"
<%= ((msnEnabled) ? "checked" : "") %>>
</td>
<td width="99%">
<label for="rb01"><b>Enabled</b> - MSN gateway is available.</label>
</td>
</tr>
<tr>
<td width="1%">
<input type="radio" name="msnEnabled" value="false" id="rb04"
<%= ((!msnEnabled) ? "checked" : "") %>>
</td>
<td width="99%">
<label for="rb01"><b>Disabled</b> - MSN gateway is not available.</label>
</td>
</tr>
</tbody>
</table>
</div>
</fieldset>
<br><br>
<input type="submit" value="Save Settings">
</form>
</body>
</html>
<%@ page import="java.util.*,
org.jivesoftware.wildfire.XMPPServer,
org.jivesoftware.util.*,
org.jivesoftware.wildfire.gateway.GatewayPlugin"
errorPage="error.jsp"
%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<% // Get parameters
String gwType = ParamUtils.getParameter(request, "gwType");
boolean gwEnabled = ParamUtils.getBooleanParameter(request, "gwEnabled");
GatewayPlugin plugin = (GatewayPlugin)XMPPServer.getInstance().getPluginManager().getPlugin("gateway");
if (gwType != null) {
if (gwEnabled) {
plugin.enableService(gwType);
}
else {
plugin.disableService(gwType);
}
}
%>
...@@ -121,3 +121,28 @@ function toggleFilters() { ...@@ -121,3 +121,28 @@ function toggleFilters() {
Effect.toggle($(jiveFilterDrop),'slide', {duration: .4}); Effect.toggle($(jiveFilterDrop),'slide', {duration: .4});
} }
} }
/*
toggleGW function
this performs the actual work for enabling or disabling the gateway in
question.
*/
function toggleGW(gwType,gwSetting) {
if (document.getElementById(gwSetting)) {
var url = 'gateway-setting-handler.jsp?gwType=' + gwType + '&gwEnabled=';
if (document.getElementById(gwSetting).checked) {
url = url + "true";
}
else {
url = url + "false";
}
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
}
req.open("GET", url, true);
req.send(null);
}
}
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
border: 1px solid #f3f7fa; border: 1px solid #f3f7fa;
padding: 2px 10px 2px 18px; padding: 2px 10px 2px 18px;
margin: 0px 5px 0px 0px; margin: 0px 5px 0px 0px;
background: url('/images/twisty_closed_9x9.gif') no-repeat left; background: url('../images/twisty_closed_9x9.gif') no-repeat left;
background-position: 6px; background-position: 6px;
color: #34679a; color: #34679a;
} }
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
} }
a.jive-gatewayButtonOn { a.jive-gatewayButtonOn {
border: 1px solid #dcdcdc; border: 1px solid #dcdcdc;
background: #ffffff url('/images/twisty_opened_9x9.gif') no-repeat left; background: #ffffff url('../images/twisty_opened_9x9.gif') no-repeat left;
background-position: 6px; background-position: 6px;
} }
/* disabled panel, when a gateway isn't selected */ /* disabled panel, when a gateway isn't selected */
...@@ -63,7 +63,7 @@ a.jive-gatewayButtonOn { ...@@ -63,7 +63,7 @@ a.jive-gatewayButtonOn {
} }
.jive-gatewayDisabled .jive-gatewayButtons a { .jive-gatewayDisabled .jive-gatewayButtons a {
border: 1px solid #fcfcfc; border: 1px solid #fcfcfc;
background: url('/images/twisty_inactive_9x9.gif') no-repeat left; background: url('../images/twisty_inactive_9x9.gif') no-repeat left;
background-position: 6px; background-position: 6px;
color: #999999; color: #999999;
text-decoration: none; text-decoration: none;
...@@ -147,7 +147,7 @@ a.jive-gatewayButtonOn { ...@@ -147,7 +147,7 @@ a.jive-gatewayButtonOn {
.jive-gateway-filter input.filterBtn { .jive-gateway-filter input.filterBtn {
float: right; float: right;
} }
/* the below is for a future feature */. /* the below is for a future feature */
.jive-gateway-filter-dropdownLink { .jive-gateway-filter-dropdownLink {
display: block; display: block;
float: left; float: left;
...@@ -264,35 +264,35 @@ a.jive-gatewayButtonOn { ...@@ -264,35 +264,35 @@ a.jive-gatewayButtonOn {
padding: 1px 0px 2px 25px; padding: 1px 0px 2px 25px;
} }
.jive-gateway-AIMon { .jive-gateway-AIMon {
background: url(/images/aim.gif) no-repeat left; background: url(../images/aim.gif) no-repeat left;
background-position: 2px 1px; background-position: 2px 1px;
} }
.jive-gateway-AIMoff { .jive-gateway-AIMoff {
background: url(/images/aim-gray.gif) no-repeat left; background: url(../images/aim-gray.gif) no-repeat left;
background-position: 2px 1px; background-position: 2px 1px;
} }
.jive-gateway-ICQon { .jive-gateway-ICQon {
background: url(/images/icq.gif) no-repeat left; background: url(../images/icq.gif) no-repeat left;
background-position: 2px 1px; background-position: 2px 1px;
} }
.jive-gateway-ICQoff { .jive-gateway-ICQoff {
background: url(/images/icq-gray.gif) no-repeat left; background: url(../images/icq-gray.gif) no-repeat left;
background-position: 2px 1px; background-position: 2px 1px;
} }
.jive-gateway-MSNon { .jive-gateway-MSNon {
background: url(/images/msn.gif) no-repeat left; background: url(../images/msn.gif) no-repeat left;
background-position: 2px 1px; background-position: 2px 1px;
} }
.jive-gateway-MSNoff { .jive-gateway-MSNoff {
background: url(/images/msn-gray.gif) no-repeat left; background: url(../images/msn-gray.gif) no-repeat left;
background-position: 2px 1px; background-position: 2px 1px;
} }
.jive-gateway-Yon { .jive-gateway-YAHOOon {
background: url(/images/yahoo.gif) no-repeat left; background: url(../images/yahoo.gif) no-repeat left;
background-position: 0px 1px; background-position: 0px 1px;
} }
.jive-gateway-Yoff { .jive-gateway-YAHOOoff {
background: url(/images/yahoo-gray.gif) no-repeat left; background: url(../images/yahoo-gray.gif) no-repeat left;
background-position: 0px 1px; background-position: 0px 1px;
} }
......
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