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.*, <%@ page import="java.util.*,
org.xmpp.packet.Presence,
org.jivesoftware.wildfire.ClientSession,
org.jivesoftware.wildfire.SessionManager,
org.jivesoftware.wildfire.XMPPServer, org.jivesoftware.wildfire.XMPPServer,
org.jivesoftware.util.*, org.jivesoftware.util.*,
org.jivesoftware.wildfire.gateway.GatewayPlugin" org.jivesoftware.wildfire.gateway.Registration,
org.jivesoftware.wildfire.gateway.RegistrationManager"
errorPage="error.jsp" errorPage="error.jsp"
%> %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %> <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %> <%@ 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);
RegistrationManager registrationManager = new RegistrationManager();
Collection<Registration> registrations = registrationManager.getRegistrations();
int regCount = registrations.size();
// Get the user manager
SessionManager sessionManager = webManager.getSessionManager();
%>
<html> <html>
<head> <head>
<title>Gateway Registrations</title> <title>Gateway Registrations</title>
...@@ -75,7 +92,7 @@ below and update the view.</p> ...@@ -75,7 +92,7 @@ below and update the view.</p>
<!-- BEGIN results --> <!-- BEGIN results -->
<div class="jive-registrations-results"> <div class="jive-registrations-results">
Registrations: <strong>1-15</strong> of <strong>52</strong> Registrations: <strong>1-15</strong> of <strong><%= regCount %></strong>
</div> </div>
<!-- END results --> <!-- END results -->
...@@ -100,7 +117,7 @@ below and update the view.</p> ...@@ -100,7 +117,7 @@ below and update the view.</p>
<a href="#">2</a> <a href="#">2</a>
<a href="#">3</a> <a href="#">3</a>
<a href="#">4</a> - <a href="#">4</a> -
<a href="#"><strong>Next ></strong></a> <a href="#"><strong>Next &gt;</strong></a>
</div> </div>
<!-- END pagination --> <!-- END pagination -->
...@@ -113,27 +130,27 @@ below and update the view.</p> ...@@ -113,27 +130,27 @@ below and update the view.</p>
<div> <div>
<strong>Filter by:</strong> <strong>Filter by:</strong>
<label for="filterAIMcheckbox"> <label for="filterAIMcheckbox">
<input type="checkbox" name="filter" value="aim" checked id="filterAIMcheckbox"> <input type="checkbox" name="filter[]" value="aim" checked id="filterAIMcheckbox">
<img src="/images/aim.gif" alt="" border="0"> <img src="images/aim.gif" alt="" border="0">
<span>AIM</span> <span>AIM</span>
</label> </label>
<label for="filterICQcheckbox"> <label for="filterICQcheckbox">
<input type="checkbox" name="filter" value="icq" checked id="filterICQcheckbox"> <input type="checkbox" name="filter[]" value="icq" checked id="filterICQcheckbox">
<img src="/images/icq.gif" alt="" border="0"> <img src="images/icq.gif" alt="" border="0">
<span>ICQ</span> <span>ICQ</span>
</label> </label>
<label for="filterMSNcheckbox"> <label for="filterMSNcheckbox">
<input type="checkbox" name="filter" value="msn" checked id="filterMSNcheckbox"> <input type="checkbox" name="filter[]" value="msn" checked id="filterMSNcheckbox">
<img src="/images/msn.gif" alt="" border="0"> <img src="images/msn.gif" alt="" border="0">
<span>MSN</span> <span>MSN</span>
</label> </label>
<label for="filterYAHOOcheckbox"> <label for="filterYAHOOcheckbox">
<input type="checkbox" name="filter" value="yahoo" checked id="filterYAHOOcheckbox"> <input type="checkbox" name="filter[]" value="yahoo" checked id="filterYAHOOcheckbox">
<img src="/images/yahoo.gif" alt="" border="0"> <img src="images/yahoo.gif" alt="" border="0">
<span>Yahoo</span> <span>Yahoo</span>
</label> </label>
<label for="filterActiveOnly"> <label for="filterActiveOnly">
<input type="checkbox" name="filter" value="signedon" id="filterActiveOnly"> <input type="checkbox" name="filter[]" value="signedon" id="filterActiveOnly">
<span>Signed on only</span> <span>Signed on only</span>
</label> </label>
<input type="submit" name="submit" value="Update" class="filterBtn"> <input type="submit" name="submit" value="Update" class="filterBtn">
...@@ -158,164 +175,75 @@ below and update the view.</p> ...@@ -158,164 +175,75 @@ below and update the view.</p>
</thead> </thead>
<tbody> <tbody>
<!-- <tr id="jiveRegistration1" class="jive-registrations-normal"> --> <%
<tr id="jiveRegistration1"> for (Registration registration : registrations) {
long id = registration.getRegistrationID();
ClientSession clientSession = (ClientSession)sessionManager.getSessions(registration.getJID().getNode()).toArray()[0];
String status = "unavailable";
String linestatus = "offline";
if (clientSession != null) {
Presence presence = clientSession.getPresence();
if (presence == null) {
// not logged in, leave alone
}
else if (presence.getShow() == Presence.Show.xa) {
status = "away";
linestatus = "online";
}
else if (presence.getShow() == Presence.Show.away) {
status = "away";
linestatus = "online";
}
else if (presence.getShow() == Presence.Show.chat) {
status = "free_chat";
linestatus = "online";
}
else if (presence.getShow() == Presence.Show.dnd) {
status = "dnd";
linestatus = "online";
}
else if (presence.isAvailable()) {
status = "available";
linestatus = "online";
}
}
Date lastLogin = registration.getLastLogin();
String lastLoginStr = ((lastLogin != null) ? lastLogin.toString() : "never");
%>
<tr id="jiveRegistration<%= id %>">
<td align="center"> <td align="center">
<img src="/images/im_available.gif" alt="online" border="0"></td> <img src="/images/im_<%= status %>.gif" alt="<%= linestatus %>" border="0"></td>
<td>anthony@jivesoftware.com</td> <td><%= registration.getJID() %></td>
<td><span class="jive-gateway-online jive-gateway-AIMon">antmanJive</span></td> <td><span class="jive-gateway-<%= linestatus %> jive-gateway-<%= registration.getTransportType().toString().toUpperCase() %>on"><%= registration.getUsername() %></span></td>
<td>Jun 27, 2006</td> <td><%= lastLoginStr %></td>
<td align="center"><a href="#" onClick="toggleEdit(1); return false"><img src="/images/edit-16x16.gif" alt="" border="0"></a></td> <td align="center"><a href="#" onClick="toggleEdit(<%= id %>); return false"><img src="/images/edit-16x16.gif" alt="" border="0"></a></td>
<td align="center"><a href="#" onClick="alert('Are you sure you want to delete this registration?'); return false"><img src="/images/delete-16x16.gif" alt="" border="0"></a></td> <td align="center"><a href="#" onClick="alert('Are you sure you want to delete this registration?'); return false"><img src="/images/delete-16x16.gif" alt="" border="0"></a></td>
</tr> </tr>
<!-- <tr id="jiveRegistrationEdit1" class="jive-registrations-edit"> --> <tr id="jiveRegistrationEdit<%= id %>" style="display: none;">
<tr id="jiveRegistrationEdit1" style="display: none;">
<td align="center"> <td align="center">
<img src="/images/im_available.gif" alt="online" border="0"></td> <img src="/images/im_<%= status %>.gif" alt="<%= status %>" border="0"></td>
<td>anthony@jivesoftware.com</td> <td><%= registration.getJID() %></td>
<td colspan="4"> <td colspan="4">
<span class="jive-gateway-online jive-gateway-AIMon"> <span class="jive-gateway-<%= linestatus %> jive-gateway-<%= registration.getTransportType().toString().toUpperCase() %>on">
<div class="jive-registrations-editUsername"> <div class="jive-registrations-editUsername">
<input type="text" name="aimname" size="12" maxlength="50" value="antmanJive"><br> <input type="text" name="username" size="12" maxlength="50" value="<%= registration.getUsername() %>"><br>
<strong>username</strong> <strong>username</strong>
</div> </div>
<div class="jive-registrations-editPassword"> <div class="jive-registrations-editPassword">
<input type="password" name="aimpwd" size="12" maxlength="50" value="*********"><br> <input type="password" name="password" size="12" maxlength="50" value="*********"><br>
<strong>password</strong> <strong>password</strong>
</div> </div>
<div class="jive-registrations-editButtons"> <div class="jive-registrations-editButtons">
<input type="submit" name="Submit" value="Save Changes" class="savechanges" onClick="toggleEdit(1);"> &nbsp; <input type="submit" name="Submit" value="Save Changes" class="savechanges" onClick="toggleEdit(<%= id %>);"> &nbsp;
<input type="reset" name="reset" value="Cancel" class="cancel" onClick="toggleEdit(1);"> <input type="reset" name="reset" value="Cancel" class="cancel" onClick="toggleEdit(<%= id %>);">
</div> </div>
</span> </span>
</td> </td>
</tr> </tr>
<tr> <%
<td align="center"> }
<img src="/images/im_away.gif" alt="online" border="0"></td> %>
<td>barry@jivesoftware.com</td>
<td><span class="jive-gateway-offline jive-gateway-MSNoff">mr_barry@msn.com</span></td>
<td>Jub 27, 2006</td>
<td align="center"><a href="#"><img src="/images/edit-16x16.gif" alt="" border="0"></a></td>
<td align="center"><a href="#" onClick="alert('Are you sure you want to delete this registration?'); return false"><img src="/images/delete-16x16.gif" alt="" border="0"></a></td>
</tr>
<tr>
<td align="center">
<img src="/images/im_available.gif" alt="online" border="0"></td>
<td>bill@jivesoftware.com</td>
<td><span class="jive-gateway-online jive-gateway-AIMon">lynchbill</span></td>
<td>Jul 15, 2006</td>
<td align="center"><a href="#"><img src="/images/edit-16x16.gif" alt="" border="0"></a></td>
<td align="center"><a href="#" onClick="alert('Are you sure you want to delete this registration?'); return false"><img src="/images/delete-16x16.gif" alt="" border="0"></a></td>
</tr>
<tr>
<td align="center">
<img src="/images/im_available.gif" alt="online" border="0"></td>
<td>dave@jivesoftware.com</td>
<td><span class="jive-gateway-online jive-gateway-AIMon">djhersh</span></td>
<td>Jun 11, 2006</td>
<td align="center"><a href="#"><img src="/images/edit-16x16.gif" alt="" border="0"></a></td>
<td align="center"><a href="#" onClick="alert('Are you sure you want to delete this registration?'); return false"><img src="/images/delete-16x16.gif" alt="" border="0"></a></td>
</tr>
<tr>
<td align="center">
<img src="/images/im_available.gif" alt="online" border="0"></td>
<td>matt@jivesoftware.com</td>
<td><span class="jive-gateway-online jive-gateway-AIMon">tuckermatt</span></td>
<td>Jul 15, 2006</td>
<td align="center"><a href="#"><img src="/images/edit-16x16.gif" alt="" border="0"></a></td>
<td align="center"><a href="#" onClick="alert('Are you sure you want to delete this registration?'); return false"><img src="/images/delete-16x16.gif" alt="" border="0"></a></td>
</tr>
<tr>
<td align="center">
<img src="/images/im_available.gif" alt="online" border="0"></td>
<td>matt@jivesoftware.com</td>
<td><span class="jive-gateway-offline jive-gateway-ICQoff">543124</span></td>
<td>Jun 22, 2006</td>
<td align="center"><a href="#"><img src="/images/edit-16x16.gif" alt="" border="0"></a></td>
<td align="center"><a href="#" onClick="alert('Are you sure you want to delete this registration?'); return false"><img src="/images/delete-16x16.gif" alt="" border="0"></a></td>
</tr>
<tr>
<td align="center">
<img src="/images/im_available.gif" alt="online" border="0"></td>
<td>matt@jivesoftware.com</td>
<td><span class="jive-gateway-offline jive-gateway-MSNoff">mtucker@hotmail.com</span></td>
<td>Jul 1, 2006</td>
<td align="center"><a href="#"><img src="/images/edit-16x16.gif" alt="" border="0"></a></td>
<td align="center"><a href="#" onClick="alert('Are you sure you want to delete this registration?'); return false"><img src="/images/delete-16x16.gif" alt="" border="0"></a></td>
</tr>
<tr>
<td align="center">
<img src="/images/im_available.gif" alt="online" border="0"></td>
<td>matt@jivesoftware.com</td>
<td><span class="jive-gateway-online jive-gateway-Yon">matt_tucker@yahoo.com</span></td>
<td>Jul 11, 2006</td>
<td align="center"><a href="#"><img src="/images/edit-16x16.gif" alt="" border="0"></a></td>
<td align="center"><a href="#" onClick="alert('Are you sure you want to delete this registration?'); return false"><img src="/images/delete-16x16.gif" alt="" border="0"></a></td>
</tr>
<tr>
<td align="center">
<img src="/images/im_available.gif" alt="online" border="0"></td>
<td>nick@jivesoftware.com</td>
<td><span class="jive-gateway-online jive-gateway-MSNon">nickJive@hotmail.com</span></td>
<td>Jul 5, 2006</td>
<td align="center"><a href="#"><img src="/images/edit-16x16.gif" alt="" border="0"></a></td>
<td align="center"><a href="#" onClick="alert('Are you sure you want to delete this registration?'); return false"><img src="/images/delete-16x16.gif" alt="" border="0"></a></td>
</tr>
<tr>
<td align="center">
<img src="/images/im_away.gif" alt="online" border="0"></td>
<td>ryan@jivesoftware.com</td>
<td><span class="jive-gateway-offline jive-gateway-AIMoff">vanman0001</span></td>
<td>Jul 18, 2006</td>
<td align="center"><a href="#"><img src="/images/edit-16x16.gif" alt="" border="0"></a></td>
<td align="center"><a href="#" onClick="alert('Are you sure you want to delete this registration?'); return false"><img src="/images/delete-16x16.gif" alt="" border="0"></a></td>
</tr>
<tr>
<td align="center">
<img src="/images/im_away.gif" alt="online" border="0"></td>
<td>ryan@jivesoftware.com</td>
<td><span class="jive-gateway-offline jive-gateway-ICQoff">4918312</span></td>
<td>Jun 22, 2006</td>
<td align="center"><a href="#"><img src="/images/edit-16x16.gif" alt="" border="0"></a></td>
<td align="center"><a href="#" onClick="alert('Are you sure you want to delete this registration?'); return false"><img src="/images/delete-16x16.gif" alt="" border="0"></a></td>
</tr>
<tr>
<td align="center">
<img src="/images/im_away.gif" alt="online" border="0"></td>
<td>ryan@jivesoftware.com</td>
<td><span class="jive-gateway-offline jive-gateway-MSNoff">ryan_vanderzanden@hotmail.com</span></td>
<td>Jul 7, 2006</td>
<td align="center"><a href="#"><img src="/images/edit-16x16.gif" alt="" border="0"></a></td>
<td align="center"><a href="#" onClick="alert('Are you sure you want to delete this registration?'); return false"><img src="/images/delete-16x16.gif" alt="" border="0"></a></td>
</tr>
<tr>
<td align="center">
<img src="/images/im_away.gif" alt="online" border="0"></td>
<td>ryan@jivesoftware.com</td>
<td><span class="jive-gateway-offline jive-gateway-Yoff">ryan_vanderzanden@yahoo.com</span></td>
<td>Jun 14, 2006</td>
<td align="center"><a href="#"><img src="/images/edit-16x16.gif" alt="" border="0"></a></td>
<td align="center"><a href="#" onClick="alert('Are you sure you want to delete this registration?'); return false"><img src="/images/delete-16x16.gif" alt="" border="0"></a></td>
</tr>
<tr>
<td align="center">
<img src="/images/im_away.gif" alt="online" border="0"></td>
<td>sam@jivesoftware.com</td>
<td><span class="jive-gateway-offline jive-gateway-AIMoff">mr_sam</span></td>
<td>Jul 14, 2006</td>
<td align="center"><a href="#"><img src="/images/edit-16x16.gif" alt="" border="0"></a></td>
<td align="center"><a href="#" onClick="alert('Are you sure you want to delete this registration?'); return false"><img src="/images/delete-16x16.gif" alt="" border="0"></a></td>
</tr>
<tr>
<td align="center">
<img src="/images/im_away.gif" alt="online" border="0"></td>
<td>sam@jivesoftware.com</td>
<td><span class="jive-gateway-offline jive-gateway-Yoff">samJive@yahoo.com</span></td>
<td>Jul 15, 2006</td>
<td align="center"><a href="#"><img src="/images/edit-16x16.gif" alt="" border="0"></a></td>
<td align="center"><a href="#" onClick="alert('Are you sure you want to delete this registration?'); return false"><img src="/images/delete-16x16.gif" alt="" border="0"></a></td>
</tr>
</tbody> </tbody>
</table> </table>
<!-- BEGIN registrations table --> <!-- BEGIN registrations table -->
...@@ -328,7 +256,7 @@ below and update the view.</p> ...@@ -328,7 +256,7 @@ below and update the view.</p>
<a href="#">2</a> <a href="#">2</a>
<a href="#">3</a> <a href="#">3</a>
<a href="#">4</a> - <a href="#">4</a> -
<a href="#"><strong>Next ></strong></a> <a href="#"><strong>Next &gt;</strong></a>
</div> </div>
<!-- END pagination --> <!-- END pagination -->
......
<%@ 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);
}
}
%>
<%@ page import="java.util.*, <%@ page import="java.util.*,
javax.servlet.jsp.JspWriter,
org.jivesoftware.wildfire.XMPPServer, org.jivesoftware.wildfire.XMPPServer,
org.jivesoftware.util.*, org.jivesoftware.util.*,
org.jivesoftware.wildfire.gateway.GatewayPlugin" org.jivesoftware.wildfire.gateway.GatewayPlugin,
org.jivesoftware.wildfire.gateway.TransportType"
errorPage="error.jsp" errorPage="error.jsp"
%> %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %> <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %> <%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<html> <%
<head> GatewayPlugin plugin = (GatewayPlugin)XMPPServer.getInstance().getPluginManager().getPlugin("gateway");
<title>Gateway Settings</title>
<meta name="pageID" content="gateway-settings">
<style type="text/css">
<!-- @import url("style/gateways.css"); -->
</style>
<script language="JavaScript" type="text/javascript" src="scripts/gateways.js"></script>
</head>
<body>
class GatewaySettings {
String description = null;
TransportType gatewayType = null;
boolean gwEnabled = false;
JspWriter out = null;
<p>Select which gateways will be allowed, what features are available, and who can connect to each gateway service. Checking a gateway enables the service.</p> GatewaySettings(JspWriter out, GatewayPlugin plugin, TransportType gatewayType, String desc) {
this.description = desc;
this.gatewayType = gatewayType;
this.gwEnabled = plugin.serviceEnabled(gatewayType.toString());
this.out = out;
}
<form action="" name="gatewayForm"> void printSettingsDialog() {
try {
%>
<!-- BEGIN gateway 1 - AIM --> <!-- BEGIN gateway - <%= this.gatewayType.toString().toUpperCase() %> -->
<div class="jive-gateway" id="jiveAIM"> <div <%= ((!this.gwEnabled) ? " class='jive-gateway jive-gatewayDisabled'" : "class='jive-gateway'") %> id="jive<%= this.gatewayType.toString().toUpperCase() %>">
<label for="jiveAIMcheckbox"> <label for="jive<%= this.gatewayType.toString().toUpperCase() %>checkbox">
<input type="checkbox" name="gateway" value="aim" id="jiveAIMcheckbox" checked onClick="checkToggle(jiveAIM); return true"> <input type="checkbox" name="gateway" value="<%= this.gatewayType.toString().toLowerCase() %>" id="jive<%= this.gatewayType.toString().toUpperCase() %>checkbox" <%= ((this.gwEnabled) ? "checked" : "") %> onClick="toggleGW('<%= this.gatewayType.toString().toLowerCase() %>','jive<%= this.gatewayType.toString().toUpperCase() %>checkbox'); checkToggle(jive<%= this.gatewayType.toString().toUpperCase() %>); return true">
<img src="/images/aim.gif" alt="" border="0"> <img src="images/<%= this.gatewayType.toString().toLowerCase() %>.gif" alt="" border="0">
<strong>AOL Instant Messenger</strong> <strong><%= this.description %></strong>
</label> </label>
<div class="jive-gatewayButtons"> <div class="jive-gatewayButtons">
<a href="#" onclick="togglePanel(jiveAIMoptions,jiveAIMperms); return false" id="jiveAIMoptionsLink"">Options</a> <a href="#" onclick="togglePanel(jive<%= this.gatewayType.toString().toUpperCase() %>options,jive<%= this.gatewayType.toString().toUpperCase() %>perms); return false" id="jive<%= this.gatewayType.toString().toUpperCase() %>optionsLink" <%= ((!this.gwEnabled) ? "style='display:none'" : "") %>>Options</a>
<a href="#" onclick="togglePanel(jiveAIMperms,jiveAIMoptions); return false" id="jiveAIMpermsLink">Permissions</a> <a href="#" onclick="togglePanel(jive<%= this.gatewayType.toString().toUpperCase() %>perms,jive<%= this.gatewayType.toString().toUpperCase() %>options); return false" id="jive<%= this.gatewayType.toString().toUpperCase() %>permsLink" <%= ((!this.gwEnabled) ? "style='display:none'" : "") %>>Permissions</a>
</div> </div>
</div> </div>
<div class="jive-gatewayPanel" id="jiveAIMoptions" style="display: none;"> <div class="jive-gatewayPanel" id="jive<%= this.gatewayType.toString().toUpperCase() %>options" style="display: none;">
<div> <div>
<form action=""> <form action="">
<input type="checkbox" name="filetransfer" value="enabled"> Enable file transfer<br> <!-- <input type="checkbox" name="filetransfer" value="enabled"> Enable file transfer<br> -->
<input type="checkbox" name="reconnect" value="enabled"> Reconnect on disconnect<br> <input type="checkbox" name="reconnect" value="enabled"> Reconnect on disconnect<br>
<input type="submit" name="submit" value="Save Options" onclick="togglePanel(jiveAIMoptions,jiveAIMperms); return false" class="jive-formButton"> <input type="submit" name="submit" value="Save Options" onclick="togglePanel(jive<%= this.gatewayType.toString().toUpperCase() %>options,jive<%= this.gatewayType.toString().toUpperCase() %>perms); return false" class="jive-formButton">
<input type="reset" name="cancel" value="Cancel" onclick="togglePanel(jiveAIMoptions,jiveAIMperms); return false" class="jive-formButton"> <input type="reset" name="cancel" value="Cancel" onclick="togglePanel(jive<%= this.gatewayType.toString().toUpperCase() %>options,jive<%= this.gatewayType.toString().toUpperCase() %>perms); return false" class="jive-formButton">
</form> </form>
</div> </div>
</div> </div>
<div class="jive-gatewayPanel" id="jiveAIMperms" style="display: none;"> <div class="jive-gatewayPanel" id="jive<%= this.gatewayType.toString().toUpperCase() %>perms" style="display: none;">
<div> <div>
<form action=""> <form action="">
<input type="radio" name="userreg" value="all" checked> All users can register<br> <input type="radio" name="userreg" value="all" checked> All users can register<br>
<input type="radio" name="userreg" value="specific"> These users and/or groups can register<br> <input type="radio" name="userreg" value="specific"> These users and/or groups can register<br>
<input type="radio" name="userreg" value="manual"> Manual registration only (see the Registrations section to manage)<br> <input type="radio" name="userreg" value="manual"> Manual registration only (see the Registrations section to manage)<br>
<input type="submit" name="submit" value="Save Permissions" onclick="togglePanel(jiveAIMperms,jiveAIMoptions); return false" class="jive-formButton"> <input type="submit" name="submit" value="Save Permissions" onclick="togglePanel(jive<%= this.gatewayType.toString().toUpperCase() %>perms,jive<%= this.gatewayType.toString().toUpperCase() %>options); return false" class="jive-formButton">
<input type="reset" name="cancel" value="Cancel" onclick="togglePanel(jiveAIMperms,jiveAIMoptions); return false" class="jive-formButton"> <input type="reset" name="cancel" value="Cancel" onclick="togglePanel(jive<%= this.gatewayType.toString().toUpperCase() %>perms,jive<%= this.gatewayType.toString().toUpperCase() %>options); return false" class="jive-formButton">
</form> </form>
</div> </div>
</div> </div>
<!-- END gateway 1 - AIM --> <!-- END gateway 1 - <%= this.gatewayType.toString().toUpperCase() %> -->
<%
}
catch (Exception e) {
// hrm
}
}
}
GatewaySettings aimSettings = new GatewaySettings(out, plugin, TransportType.aim, "AOL Instant Messenger");
GatewaySettings icqSettings = new GatewaySettings(out, plugin, TransportType.icq, "ICQ");
GatewaySettings msnSettings = new GatewaySettings(out, plugin, TransportType.msn, "MSN Messenger");
GatewaySettings yahooSettings = new GatewaySettings(out, plugin, TransportType.yahoo, "Yahoo! Messenger");
%>
<!-- BEGIN gateway 2 - ICQ -->
<div class="jive-gateway" id="jiveICQ">
<label for="jiveICQcheckbox">
<input type="checkbox" name="gateway" value="icq" id="jiveICQcheckbox" checked onClick="checkToggle(jiveICQ); return true">
<img src="/images/icq.gif" alt="" border="0">
<strong>ICQ</strong>
</label>
<div class="jive-gatewayButtons">
<a href="#" onclick="togglePanel(jiveICQoptions,jiveICQperms); return false" id="jiveICQoptionsLink">Options</a>
<a href="#" onclick="togglePanel(jiveICQperms,jiveICQoptions); return false" id="jiveICQpermsLink">Permissions</a>
</div>
</div>
<div class="jive-gatewayPanel" id="jiveICQoptions" style="display: none;">
<div>
<form action="">
<input type="checkbox" name="filetransfer" value="enabled"> Enable file transfer<br>
<input type="checkbox" name="reconnect" value="enabled"> Reconnect on disconnect<br>
<input type="submit" name="submit" value="Save Options" onclick="togglePanel(jiveICQoptions,jiveICQperms); return false" class="jive-formButton">
<input type="reset" name="cancel" value="Cancel" onclick="togglePanel(jiveICQoptions,jiveICQperms); return false" class="jive-formButton">
</form>
</div>
</div>
<div class="jive-gatewayPanel" id="jiveICQperms" style="display: none;">
<div>
<form action="">
<input type="radio" name="userreg" value="all" checked> All users can register<br>
<input type="radio" name="userreg" value="specific"> These users and/or groups can register<br>
<input type="radio" name="userreg" value="manual"> Manual registration only (see the Registrations section to manage)<br>
<input type="submit" name="submit" value="Save Permissions" onclick="togglePanel(jiveICQperms,jiveICQoptions); return false" class="jive-formButton">
<input type="reset" name="cancel" value="Cancel" onclick="togglePanel(jiveICQperms,jiveICQoptions); return false" class="jive-formButton">
</form>
</div>
</div>
<!-- END gateway 2 - ICQ -->
<html>
<head>
<title>Gateway Settings</title>
<meta name="pageID" content="gateway-settings">
<!-- BEGIN gateway 3 - MSN --> <style type="text/css">
<div class="jive-gateway" id="jiveMSN"> <!-- @import url("style/gateways.css"); -->
<label for="jiveMSNcheckbox"> </style>
<input type="checkbox" name="gateway" value="msn" id="jiveMSNcheckbox" checked onClick="checkToggle(jiveMSN); return true">
<img src="/images/msn.gif" alt="" border="0">
<strong>MSN Messenger</strong>
</label>
<div class="jive-gatewayButtons">
<a href="#" onclick="togglePanel(jiveMSNoptions,jiveMSNperms); return false" id="jiveMSNoptionsLink">Options</a>
<a href="#" onclick="togglePanel(jiveMSNperms,jiveMSNoptions); return false" id="jiveMSNpermsLink">Permissions</a>
</div>
</div>
<div class="jive-gatewayPanel" id="jiveMSNoptions" style="display: none;">
<div>
<form action="">
<input type="checkbox" name="filetransfer" value="enabled"> Enable file transfer<br>
<input type="checkbox" name="reconnect" value="enabled"> Reconnect on disconnect<br>
<input type="submit" name="submit" value="Save Options" onclick="togglePanel(jiveMSNoptions,jiveMSNperms); return false" class="jive-formButton">
<input type="reset" name="cancel" value="Cancel" onclick="togglePanel(jiveMSNoptions,jiveMSNperms); return false" class="jive-formButton">
</form>
</div>
</div>
<div class="jive-gatewayPanel" id="jiveMSNperms" style="display: none;">
<div>
<form action="">
<input type="radio" name="userreg" value="all" checked> All users can register<br>
<input type="radio" name="userreg" value="specific"> These users and/or groups can register<br>
<input type="radio" name="userreg" value="manual"> Manual registration only (see the Registrations section to manage)<br>
<input type="submit" name="submit" value="Save Permissions" onclick="togglePanel(jiveMSNerms,jiveMSNoptions); return false" class="jive-formButton">
<input type="reset" name="cancel" value="Cancel" onclick="togglePanel(jiveMSNerms,jiveMSNoptions); return false" class="jive-formButton">
</form>
</div>
</div>
<!-- END gateway 3 - MSN -->
<script language="JavaScript" type="text/javascript" src="scripts/gateways.js"></script>
</head>
<body>
<!-- BEGIN gateway 4 - Yahoo -->
<div class="jive-gateway" id="jiveYAHOO">
<label for="jiveYAHOOcheckbox">
<input type="checkbox" name="gateway" value="yahoo" id="jiveYAHOOcheckbox" checked onClick="checkToggle(jiveYAHOO); return true">
<img src="/images/yahoo.gif" alt="" border="0">
<strong>Yahoo Messenger</strong>
</label>
<div class="jive-gatewayButtons">
<a href="#" onclick="togglePanel(jiveYAHOOoptions,jiveYAHOOperms); return false" id="jiveYAHOOoptionsLink">Options</a>
<a href="#" onclick="togglePanel(jiveYAHOOperms,jiveYAHOOoptions); return false" id="jiveYAHOOpermsLink">Permissions</a>
</div>
</div>
<div class="jive-gatewayPanel" id="jiveYAHOOoptions" style="display: none;">
<div>
<form action="">
<input type="checkbox" name="filetransfer" value="enabled"> Enable file transfer<br>
<input type="checkbox" name="reconnect" value="enabled"> Reconnect on disconnect<br>
<input type="submit" name="submit" value="Save Options" onclick="togglePanel(jiveYAHOOoptions,jiveYAHOOperms); return false" class="jive-formButton">
<input type="reset" name="cancel" value="Cancel" onclick="togglePanel(jiveYAHOOoptions,jiveYAHOOperms); return false" class="jive-formButton">
</form>
</div>
</div>
<div class="jive-gatewayPanel" id="jiveYAHOOperms" style="display: none;">
<div>
<form action="">
<input type="radio" name="userreg" value="all" checked> All users can register<br>
<input type="radio" name="userreg" value="specific"> These users and/or groups can register<br>
<input type="radio" name="userreg" value="manual"> Manual registration only (see the Registrations section to manage)<br>
<input type="submit" name="submit" value="Save Permissions" onclick="togglePanel(jiveYAHOOerms,jiveYAHOOoptions); return false" class="jive-formButton">
<input type="reset" name="cancel" value="Cancel" onclick="togglePanel(jiveYAHOOerms,jiveYAHOOoptions); return false" class="jive-formButton">
</form>
</div>
</div>
<!-- END gateway 4 - Yahoo -->
<!-- <br clear="all"> <p>Select which gateways will be allowed, what features are available, and who can connect to each gateway service. Checking a gateway enables the service.</p>
<input type="submit" name="submit" value="Save Settings"> -->
<form action="" name="gatewayForm">
<% aimSettings.printSettingsDialog(); %>
<% icqSettings.printSettingsDialog(); %>
<% msnSettings.printSettingsDialog(); %>
<% yahooSettings.printSettingsDialog(); %>
</form> </form>
......
...@@ -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