Commit 08d41d19 authored by Ryan Graham's avatar Ryan Graham Committed by ryang

added the ability to send registration notifications to multiple users via...

added the ability to send registration notifications to multiple users via instant message and/or email
added the ability to automatically add new users to a specified group


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1770 b35dd754-fafc-0310-a699-88a17e54d16e
parent f4ed3500
...@@ -13,50 +13,113 @@ import org.jivesoftware.messenger.container.Plugin; ...@@ -13,50 +13,113 @@ import org.jivesoftware.messenger.container.Plugin;
import org.jivesoftware.messenger.container.PluginManager; import org.jivesoftware.messenger.container.PluginManager;
import org.jivesoftware.messenger.event.UserEventDispatcher; import org.jivesoftware.messenger.event.UserEventDispatcher;
import org.jivesoftware.messenger.event.UserEventListener; import org.jivesoftware.messenger.event.UserEventListener;
import org.jivesoftware.messenger.group.Group;
import org.jivesoftware.messenger.group.GroupManager;
import org.jivesoftware.messenger.group.GroupNotFoundException;
import org.jivesoftware.messenger.user.User; import org.jivesoftware.messenger.user.User;
import org.jivesoftware.util.EmailService;
import org.jivesoftware.util.JiveGlobals; import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.Log;
import org.xmpp.packet.JID; import org.xmpp.packet.JID;
import org.xmpp.packet.Message; import org.xmpp.packet.Message;
import org.xmpp.packet.Packet; import org.xmpp.packet.Packet;
import java.io.File; import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map; import java.util.Map;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeUtility;
/** /**
* Registration plugin. * Registration plugin.
* *
* TODO: document plugin property names here.
*
* @author Ryan Graham. * @author Ryan Graham.
*/ */
public class RegistrationPlugin implements Plugin { public class RegistrationPlugin implements Plugin {
/**
* The expected value is a boolean, if true all contacts specified in the property #IM_CONTACTS
* will receive a notification when a new user registers. The default value is false.
*/
private static final String IM_NOTIFICATION_ENABLED = "registration.imnotification.enabled";
/**
* The expected value is a boolean, if true all contacts specified in the property #EMAIL_CONTACTS
* will receive a notification when a new user registers. The default value is false.
*/
private static final String EMAIL_NOTIFICATION_ENABLED = "registration.emailnotification.enabled";
/**
* The expected value is a boolean, if true any user who registers will receive the welcome
* message specified in the property #WELCOME_MSG. The default value is false.
*/
private static final String WELCOME_ENABLED = "registration.welcome.enabled";
/**
* The expected value is a boolean, if true any user who registers will be added to the group
* specified in the property #REGISTRAION_GROUP. The default value is false.
*/
private static final String GROUP_ENABLED = "registration.group.enabled";
/**
* The expected value is a comma separated String of usernames who will receive a instant
* message when a new user registers if the property #IM_NOTIFICATION_ENABLED is set to true.
*/
private static final String IM_CONTACTS = "registration.notification.imContacts";
/**
* The expected value is a comma separated String of email addresses who will receive an email
* when a new user registers, if the property #EMAIL_NOTIFICATION_ENABLED is set to true.
*/
private static final String EMAIL_CONTACTS = "registration.notification.emailContacts";
/**
* The expected value is a String that contains the message that will be sent to a new user
* when they register, if the property #WELCOME_ENABLED is set to true.
*/
private static final String WELCOME_MSG = "registration.welcome.message";
/**
* The expected value is a String that contains the name of the group that a new user will
* be added to when they register, if the property #GROUP_ENABLED is set to true.
*/
private static final String REGISTRAION_GROUP = "registration.group";
private RegistrationUserEventListener listener = new RegistrationUserEventListener(); private RegistrationUserEventListener listener = new RegistrationUserEventListener();
private String serverName; private String serverName;
private JID serverAddress; private JID serverAddress;
private MessageRouter router; private MessageRouter router;
private boolean registrationNotificationEnabled; private List<String> imContacts = new ArrayList<String>();
private boolean registrationWelcomeEnabled; private List<String> emailContacts = new ArrayList<String>();
private String contact;
public RegistrationPlugin() { public RegistrationPlugin() {
serverName = XMPPServer.getInstance().getServerInfo().getName(); serverName = XMPPServer.getInstance().getServerInfo().getName();
serverAddress = new JID(serverName); serverAddress = new JID(serverName);
router = XMPPServer.getInstance().getMessageRouter(); router = XMPPServer.getInstance().getMessageRouter();
registrationNotificationEnabled = JiveGlobals.getBooleanProperty( String imcs = JiveGlobals.getProperty(IM_CONTACTS);
"registration.notification.enabled", false); if (imcs != null) {
setRegistrationNotificationEnabled(registrationNotificationEnabled); imContacts.addAll(Arrays.asList(imcs.split(",")));
}
registrationWelcomeEnabled = JiveGlobals.getBooleanProperty(
"registration.welcome.enabled", false); String ecs = JiveGlobals.getProperty(EMAIL_CONTACTS);
setRegistrationNotificationEnabled(registrationWelcomeEnabled); if (ecs != null) {
emailContacts.addAll(Arrays.asList(ecs.split(",")));
contact = JiveGlobals.getProperty("registration.notification.contact", "admin"); }
UserEventDispatcher.addListener(listener); UserEventDispatcher.addListener(listener);
//delete properties from version 1.0
JiveGlobals.deleteProperty("registration.notification.contact");
JiveGlobals.deleteProperty("registration.notification.enabled");
} }
public void processPacket(Packet packet) { public void processPacket(Packet packet) {
...@@ -72,74 +135,115 @@ public class RegistrationPlugin implements Plugin { ...@@ -72,74 +135,115 @@ public class RegistrationPlugin implements Plugin {
router = null; router = null;
} }
public void setRegistrationNotificationEnabled(boolean enable) { public void setIMNotificationEnabled(boolean enable) {
registrationNotificationEnabled = enable; JiveGlobals.setProperty(IM_NOTIFICATION_ENABLED, enable ? "true" : "false");
JiveGlobals.setProperty("registration.notification.enabled", enable ? "true" : "false");
} }
public boolean registrationNotificationEnabled() { public boolean imNotificationEnabled() {
return JiveGlobals.getBooleanProperty("registration.notification.enabled", false); return JiveGlobals.getBooleanProperty(IM_NOTIFICATION_ENABLED, false);
} }
public void setContact(String contact) { public void setEmailNotificationEnabled(boolean enable) {
this.contact = contact; JiveGlobals.setProperty(EMAIL_NOTIFICATION_ENABLED, enable ? "true" : "false");
JiveGlobals.setProperty("registration.notification.contact", contact);
} }
public String getContact() { public boolean emailNotificationEnabled() {
return contact; return JiveGlobals.getBooleanProperty(EMAIL_NOTIFICATION_ENABLED, false);
} }
public void setRegistrationWelcomeEnabled(boolean enable) { public Collection<String> getIMContacts() {
registrationWelcomeEnabled = enable; Collections.sort(imContacts);
JiveGlobals.setProperty("registration.welcome.enabled", enable ? "true" : "false"); return imContacts;
} }
public boolean registrationWelcomeEnabled() { public void addIMContact(String contact) {
return JiveGlobals.getBooleanProperty("registration.welcome.enabled", false); if (!imContacts.contains(contact.trim().toLowerCase())) {
imContacts.add(contact.trim().toLowerCase());
JiveGlobals.setProperty(IM_CONTACTS, propPrep(imContacts));
}
}
public void removeIMContact(String contact) {
imContacts.remove(contact.trim().toLowerCase());
if (imContacts.size() == 0) {
JiveGlobals.deleteProperty(IM_CONTACTS);
}
else {
JiveGlobals.setProperty(IM_CONTACTS, propPrep(imContacts));
}
}
public Collection<String> getEmailContacts() {
Collections.sort(emailContacts);
return emailContacts;
}
public void addEmailContact(String contact) {
if (!emailContacts.contains(contact.trim())) {
emailContacts.add(contact.trim());
JiveGlobals.setProperty(EMAIL_CONTACTS, propPrep(emailContacts));
}
}
public void removeEmailContact(String contact) {
emailContacts.remove(contact);
if (emailContacts.size() == 0) {
JiveGlobals.deleteProperty(EMAIL_CONTACTS);
}
else {
JiveGlobals.setProperty(EMAIL_CONTACTS, propPrep(emailContacts));
}
} }
public void setWelcomeEnabled(boolean enable) {
JiveGlobals.setProperty(WELCOME_ENABLED, enable ? "true" : "false");
}
public boolean welcomeEnabled() {
return JiveGlobals.getBooleanProperty(WELCOME_ENABLED, false);
}
public void setWelcomeMessage(String message) { public void setWelcomeMessage(String message) {
JiveGlobals.setProperty("registration.welcome.message", message); JiveGlobals.setProperty(WELCOME_MSG, message);
} }
public String getWelcomeMessage() { public String getWelcomeMessage() {
return JiveGlobals.getProperty("registration.welcome.message", "Welcome to Jive Messenger!"); return JiveGlobals.getProperty(WELCOME_MSG, "Welcome to Jive Messenger!");
} }
private void sendRegistrationNotificatonMessage(User user) { public void setGroupEnabled(boolean enable) {
String msg = " A new user with the username of '" + user.getUsername() + "' just registered"; JiveGlobals.setProperty(GROUP_ENABLED, enable ? "true" : "false");
router.route(createServerMessage(getContact() + "@" + serverName,
"Registration Notification", msg));
} }
private void sendWelcomeMessage(User user) { public boolean groupEnabled() {
router.route(createServerMessage(user.getUsername() + "@" + serverName, "Welcome", return JiveGlobals.getBooleanProperty(GROUP_ENABLED, false);
getWelcomeMessage()));
} }
private Message createServerMessage(String to, String subject, String body) { public void setGroup(String group) {
Message message = new Message(); JiveGlobals.setProperty(REGISTRAION_GROUP, group);
message.setTo(to);
message.setFrom(serverAddress);
if (subject != null) {
message.setSubject(subject);
}
message.setBody(body);
return message;
} }
//TODO JM-170 public String getGroup() {
//TODO add the ability for the admin to monitor when users are deleted? return JiveGlobals.getProperty(REGISTRAION_GROUP);
}
private class RegistrationUserEventListener implements UserEventListener { private class RegistrationUserEventListener implements UserEventListener {
public void userCreated(User user, Map params) { public void userCreated(User user, Map params) {
if (registrationNotificationEnabled) { if (imNotificationEnabled()) {
sendRegistrationNotificatonMessage(user); sendIMNotificatonMessage(user);
} }
if (registrationWelcomeEnabled) { if (emailNotificationEnabled()) {
sendAlertEmail(user);
}
if (welcomeEnabled()) {
sendWelcomeMessage(user); sendWelcomeMessage(user);
} }
if (groupEnabled()) {
addUserToGroup(user);
}
} }
public void userDeleting(User user, Map params) { public void userDeleting(User user, Map params) {
...@@ -147,5 +251,91 @@ public class RegistrationPlugin implements Plugin { ...@@ -147,5 +251,91 @@ public class RegistrationPlugin implements Plugin {
public void userModified(User user, Map params) { public void userModified(User user, Map params) {
} }
private void sendIMNotificatonMessage(User user) {
String msg = " A new user with the username of '" + user.getUsername() + "' just registered";
for (String contact : getIMContacts()) {
router.route(createServerMessage(contact + "@" + serverName,
"Registration Notification", msg));
}
}
private void sendAlertEmail(User user) {
String msg = " A new user with the username of '" + user.getUsername() + "' just registered";
List<MimeMessage> messages = new ArrayList<MimeMessage>();
EmailService emailService = EmailService.getInstance();
MimeMessage message = emailService.createMimeMessage();
String encoding = MimeUtility.mimeCharset("iso-8859-1");
for (String toAddress : emailContacts) {
try {
message.setRecipient(javax.mail.Message.RecipientType.TO, new InternetAddress(toAddress));
message.setFrom(new InternetAddress("no_reply@" + serverName, "Jive Messneger", encoding));
message.setText(msg);
message.setSubject("User Registration");
messages.add(message);
} catch (Exception e) {
Log.error(e);
}
}
emailService.sendMessages(messages);
}
private void sendWelcomeMessage(User user) {
router.route(createServerMessage(user.getUsername() + "@" + serverName, "Welcome",
getWelcomeMessage()));
}
private Message createServerMessage(String to, String subject, String body) {
Message message = new Message();
message.setTo(to);
message.setFrom(serverAddress);
if (subject != null) {
message.setSubject(subject);
}
message.setBody(body);
return message;
}
private void addUserToGroup(User user) {
try {
GroupManager groupManager = GroupManager.getInstance();
Group group = groupManager.getGroup(getGroup());
group.getMembers().add(user.getUsername());
}
catch (GroupNotFoundException e) {
Log.error(e);
}
}
}
private String propPrep(Collection<String> props) {
StringBuilder buf = new StringBuilder();
Iterator<String> iter = props.iterator();
while (iter.hasNext()) {
String con = iter.next();
buf.append(con);
if (iter.hasNext()) {
buf.append(",");
}
}
return buf.toString();
}
public boolean isValidAddress(String address) {
if (address == null) {
return false;
}
//must at least match x@x.xx
if (!address.matches(".{1,}[@].{1,}[.].{2,}")) {
return false;
}
return true;
} }
} }
<%@ page import="java.util.*, <%@ page
org.jivesoftware.admin.*, import="java.util.*,
org.jivesoftware.messenger.XMPPServer, org.jivesoftware.admin.*,
org.jivesoftware.messenger.user.*, org.jivesoftware.messenger.XMPPServer,
org.jivesoftware.messenger.plugin.RegistrationPlugin, org.jivesoftware.messenger.user.*,
org.jivesoftware.util.*" org.jivesoftware.messenger.plugin.RegistrationPlugin,
errorPage="error.jsp" org.jivesoftware.messenger.group.*,
%> org.jivesoftware.util.*"
errorPage="error.jsp"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %> <script lang="JavaScript" type="text/javascript">
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %> function addIMContact() {
document.regform.addIM.value = 'true';
document.regform.submit();
}
<jsp:useBean id="admin" class="org.jivesoftware.util.WebManager" /> function addEmailContact() {
<c:set var="admin" value="${admin.manager}" /> document.regform.addEmail.value = 'true';
<% admin.init(request, response, session, application, out ); %> document.regform.submit();
}
</script>
<%@ 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="admin" class="org.jivesoftware.util.WebManager" />
<c:set var="admin" value="${admin.manager}" />
<% <%
boolean save = request.getParameter("save") != null; admin.init(request, response, session, application, out);
boolean success = request.getParameter("success") != null;
boolean notificationEnabled = ParamUtils.getBooleanParameter(request, "notificationenabled"); boolean save = request.getParameter("save") != null;
String contactName = ParamUtils.getParameter(request, "contactname"); boolean saveWelcome = request.getParameter("savemessage") != null;
boolean welcomeEnabled = ParamUtils.getBooleanParameter(request, "welcomeenabled"); boolean saveGroup = request.getParameter("savegroup") != null;
String welcomeMessage = ParamUtils.getParameter(request, "welcomemessage");
boolean imEnabled = ParamUtils.getBooleanParameter(request, "imenabled", false);
boolean emailEnabled = ParamUtils.getBooleanParameter(request, "emailenabled", false);
boolean welcomeEnabled = ParamUtils.getBooleanParameter(request, "welcomeenabled", false);
boolean groupEnabled = ParamUtils.getBooleanParameter(request, "groupenabled", false);
String contactIM = ParamUtils.getParameter(request, "contactIM");
boolean addIM = ParamUtils.getBooleanParameter(request, "addIM");
boolean deleteIM = ParamUtils.getBooleanParameter(request, "deleteIM");
String contactEmail = ParamUtils.getParameter(request, "contactEmail");
boolean addEmail = ParamUtils.getBooleanParameter(request, "addEmail");
boolean deleteEmail = ParamUtils.getBooleanParameter(request, "deleteEmail");
String welcomeMessage = ParamUtils.getParameter(request, "welcomemessage");
String group = ParamUtils.getParameter(request, "groupname");
RegistrationPlugin plugin = (RegistrationPlugin) XMPPServer.getInstance().getPluginManager().getPlugin("registration"); RegistrationPlugin plugin = (RegistrationPlugin) XMPPServer.getInstance().getPluginManager().getPlugin("registration");
Map errors = new HashMap(); Map<String, String> errors = new HashMap<String, String>();
if (save) { if (addIM) {
if (contactIM == null) {
if (notificationEnabled) { errors.put("missingContact", "missingContact");
if (contactName == null) { }
errors.put("missingContactName", "missingContactName"); else {
} contactIM = contactIM.trim().toLowerCase();
else {
contactName = contactName.trim().toLowerCase(); try {
admin.getUserManager().getUser(contactIM);
try { plugin.addIMContact(contactIM);
UserManager.getInstance().getUser(contactName); response.sendRedirect("registration-props-form.jsp?addSuccess=true");
} catch (UserNotFoundException unfe) { return;
errors.put("userNotFound", "userNotFound"); }
} catch (UserNotFoundException unfe) {
} errors.put("userNotFound", "userNotFound");
} }
}
}
if (deleteIM) {
plugin.removeIMContact(contactIM);
response.sendRedirect("registration-props-form.jsp?deleteSuccess=true");
return;
}
if (addEmail) {
if (contactEmail == null) {
errors.put("missingContact", "missingContact");
}
else {
if (plugin.isValidAddress(contactEmail)) {
plugin.addEmailContact(contactEmail);
response.sendRedirect("registration-props-form.jsp?addSuccess=true");
return;
}
else {
errors.put("invalidAddress", "invalidAddress");
}
}
}
if (deleteEmail) {
plugin.removeEmailContact(contactEmail);
response.sendRedirect("registration-props-form.jsp?deleteSuccess=true");
return;
}
if (save) {
plugin.setIMNotificationEnabled(imEnabled);
plugin.setEmailNotificationEnabled(emailEnabled);
plugin.setWelcomeEnabled(welcomeEnabled);
if (groupEnabled) {
group = plugin.getGroup();
if (group == null || group.trim().length() < 1) {
errors.put("groupNotFound", "groupNotFound");
}
try {
admin.getGroupManager().getGroup(group);
}
catch (Exception e) {
errors.put("groupNotFound", "groupNotFound");
}
}
if (errors.size() == 0) {
plugin.setGroupEnabled(groupEnabled);
response.sendRedirect("registration-props-form.jsp?settingsSaved=true");
return;
}
}
if (saveWelcome) {
if (welcomeMessage == null || welcomeMessage.trim().length() < 1) {
errors.put("missingWelcomeMessage", "missingWelcomeMessage");
} else {
plugin.setWelcomeMessage(welcomeMessage);
response.sendRedirect("registration-props-form.jsp?welcomeSaved=true");
return;
}
}
if (saveGroup && plugin.groupEnabled()) {
if (group == null || group.trim().length() < 1) {
errors.put("groupNotFound", "groupNotFound");
}
if (welcomeEnabled) { try {
if (welcomeMessage == null) { admin.getGroupManager().getGroup(group);
errors.put("missingWelcomeMessage", "missingWelcomeMessage"); }
} catch (Exception e) {
} errors.put("groupNotFound", "groupNotFound");
}
if (errors.size() == 0) { if (errors.size() == 0) {
plugin.setRegistrationNotificationEnabled(notificationEnabled); plugin.setGroup(group);
plugin.setContact(contactName); response.sendRedirect("registration-props-form.jsp?groupSaved=true");
return;
plugin.setRegistrationWelcomeEnabled(welcomeEnabled); }
plugin.setWelcomeMessage(welcomeMessage.trim()); }
response.sendRedirect("registration-props-form.jsp?success=true");
return; if (saveGroup && !plugin.groupEnabled()) {
} group = (group == null) ? "" : group;
plugin.setGroup(group);
} }
else {
contactName = plugin.getContact(); imEnabled = plugin.imNotificationEnabled();
welcomeMessage = plugin.getWelcomeMessage(); emailEnabled = plugin.emailNotificationEnabled();
} welcomeEnabled = plugin.welcomeEnabled();
groupEnabled = plugin.groupEnabled();
if (errors.size() == 0) {
contactName = plugin.getContact(); welcomeMessage = plugin.getWelcomeMessage();
welcomeMessage = plugin.getWelcomeMessage(); group = plugin.getGroup();
}
notificationEnabled = plugin.registrationNotificationEnabled();
welcomeEnabled = plugin.registrationWelcomeEnabled();
%> %>
<jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" /> <jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" />
...@@ -84,139 +178,319 @@ ...@@ -84,139 +178,319 @@
<jsp:include page="top.jsp" flush="true" /> <jsp:include page="top.jsp" flush="true" />
<jsp:include page="title.jsp" flush="true" /> <jsp:include page="title.jsp" flush="true" />
<p> <p>Use the form below to edit user registration settings.</p>
Use the form below to edit user registration settings.<br>
</p>
<% if (success) { %>
<div class="jive-success"> <form action="registration-props-form.jsp?save" name="regform" method="post">
<table cellpadding="0" cellspacing="0" border="0"> <input type="hidden" name="addIM" value="">
<tbody> <input type="hidden" name="addEmail" value="">
<tr>
<td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" border="0"></td>
<td class="jive-icon-label">Service settings updated successfully.</td>
</tr>
</tbody>
</table>
</div><br>
<% } else if (errors.size() > 0) { %> <fieldset>
<legend>Registration Settings</legend>
<div class="jive-error"> <div>
<table cellpadding="0" cellspacing="0" border="0">
<tbody> <% if (ParamUtils.getBooleanParameter(request, "settingsSaved")) { %>
<tr>
<td class="jive-icon"><img src="images/error-16x16.gif" width="16" height="16" border="0"></td> <div class="jive-success">
<td class="jive-icon-label">Error saving the service settings.</td> <table cellpadding="0" cellspacing="0" border="0">
</tr> <tbody>
</tbody> <tr>
</table> <td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" border="0"></td>
</div><br> <td class="jive-icon-label">Settings saved successfully.</td>
</tr>
</tbody>
</table>
</div>
<% } %>
<% if (errors.containsKey("groupNotFound")) { %>
<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">Please enter and save a valid group name before enabling automatic group adding.</td>
</tr>
</tbody>
</table>
</div>
<% } %>
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tbody>
<tr>
<td width="1%" align="center" nowrap><input type="checkbox" name="imenabled" <%=(imEnabled) ? "checked" : "" %> onclick="return enableWelcomeMessage();"></td>
<td width="99%" align="left">Enable instant message registraion notification.</td>
</tr>
<tr>
<td width="1%" align="center" nowrap><input type="checkbox" name="emailenabled" <%=(emailEnabled) ? "checked" : "" %> onclick="return enableWelcomeMessage();"></td>
<td width="99%" align="left">Enable email registraion notification.</td>
</tr>
<tr>
<td width="1%" align="center" nowrap><input type="checkbox" name="welcomeenabled" <%=(welcomeEnabled) ? "checked" : "" %> onclick="return enableWelcomeMessage();"></td>
<td width="99%" align="left">Enable welcome message.</td>
</tr>
<tr>
<td width="1%" align="center" nowrap><input type="checkbox" name="groupenabled" <%=(groupEnabled) ? "checked" : "" %> onclick="return enableWelcomeMessage();"></td>
<td width="99%" align="left">Enable automatically adding of new users to a group.</td>
</tr>
</tbody>
</table>
</div>
<% } %> <input type="submit" value="Save Settings"/>
</fieldset>
<form action="registration-props-form.jsp?save" method="post"> <br><br>
<fieldset> <fieldset>
<legend>Registration Notification</legend> <legend>Registration Notification Contacts</legend>
<div> <div>
<p> <p>Add or remove contacts to be alerted when a new user registers.</p>
Enable this feature to have the contact person notified whenever a new user registers.
</p> <% if (ParamUtils.getBooleanParameter(request, "deleteSuccess")) { %>
<table cellpadding="3" cellspacing="0" border="0" width="100%"> <div class="jive-success">
<tbody> <table cellpadding="0" cellspacing="0" border="0">
<tr> <tbody>
<td width="1%"> <tr>
<input type="radio" name="notificationenabled" value="false" id="not01" <td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" border="0"></td>
<%= ((notificationEnabled) ? "" : "checked") %>> <td class="jive-icon-label">Contact successfully removed.</td>
</td> </tr>
<td width="99%"> </tbody>
<label for="not01"><b>Disabled</b></label> - Notifications will not be sent out. </table>
</td> </div>
</tr>
<tr> <% } else if (ParamUtils.getBooleanParameter(request, "addSuccess")) { %>
<td width="1%">
<input type="radio" name="notificationenabled" value="true" id="not02" <div class="jive-success">
<%= ((notificationEnabled) ? "checked" : "") %>> <table cellpadding="0" cellspacing="0" border="0">
</td> <tbody>
<td width="99%"> <tr>
<label for="not02"><b>Enabled</b></label> - Notifications will be sent out. <td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" border="0"></td>
</td> <td class="jive-icon-label">Contact successfully added.</td>
</tr> </tr>
<tr> </tbody>
<td>&nbsp;</td> </table>
<td align="left">Username:&nbsp; </div>
<input type="text" size="30" maxlength="75" name="contactname"
value="<%= (contactName != null ? contactName : "") %>">@<%= XMPPServer.getInstance().getServerInfo().getName() %> <% } else if (errors.containsKey("missingContact")) { %>
<% if (errors.containsKey("missingContactName")) { %>
<span class="jive-error-text"> <div class="jive-error">
<br>Please enter a username. <table cellpadding="0" cellspacing="0" border="0">
</span> <tbody>
<% } else if (errors.containsKey("userNotFound")) { %> <tr>
<span class="jive-error-text"> <td class="jive-icon"><img src="images/error-16x16.gif" width="16" height="16" border="0"></td>
<br>Could not find user. Please try again. <td class="jive-icon-label">Missing contact.</td>
</span> </tr>
<% } %> </tbody>
</td> </table>
</tr> </div>
</tbody>
</table> <% } else if (errors.containsKey("userNotFound")) { %>
</div>
<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">Contact not found.</td>
</tr>
</tbody>
</table>
</div>
<% } else if (errors.containsKey("invalidAddress")) { %>
<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">Invalid email address.</td>
</tr>
</tbody>
</table>
</div>
<% } %>
<div>
<label for="contacttf">Add IM Contact</label>
<input type="text" name="contactIM" size="30" maxlength="100" value="<%= (contactIM != null ? contactIM : "") %>" id="contacttf"/>
<input type="submit" value="Add" onclick="return addIMContact();"/>
<br>
<br>
<div class="jive-table" style="width:400px;">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<thead>
<tr>
<th width="99%">IM Contact</th>
<th width="1%" nowrap>Remove</th>
</tr>
</thead>
<tbody>
<% if (plugin.getIMContacts().size() == 0) { %>
<tr>
<td width="100%" colspan="2" align="center" nowrap>No contacts specified, use the form above to add one.</td>
</tr>
<% } %>
<% for (String imContact : plugin.getIMContacts()) { %>
<tr>
<td width="99%"><%=imContact %></td>
<td width="1%" align="center"><a
href="registration-props-form.jsp?deleteIM=true&contactIM=<%=imContact %>"
title="Delete Contact?"
onclick="return confirm('Are you sure you want to delete this contact?');"><img
src="images/delete-16x16.gif" width="16" height="16"
border="0"></a>
</td>
</tr>
<% } %>
</tbody>
</table>
</div>
</div>
<div>
<label for="emailtf">Add Email Contact</label>
<input type="text" name="contactEmail" size="30" maxlength="100" value="<%= (contactEmail != null ? contactEmail : "") %>" id="emailtf"/>
<input type="submit" value="Add" onclick="return addEmailContact();"/>
<br>
<br>
<div class="jive-table" style="width:400px;">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<thead>
<tr>
<th width="99%">Email Contact</th>
<th width="1%" nowrap>Remove</th>
</tr>
</thead>
<tbody>
<% if (plugin.getEmailContacts().size() == 0) { %>
<tr>
<td width="100%" colspan="2" align="center" nowrap>No contacts
specified, use the form above to add one.</td>
</tr>
<% } %>
<% for (String emailContact : plugin.getEmailContacts()) { %>
<tr>
<td width="99%"><%=emailContact %></td>
<td width="1%" align="center"><a
href="registration-props-form.jsp?deleteEmail=true&contactEmail=<%=emailContact %>"
title="Delete Contact?"
onclick="return confirm('Are you sure you want to delete this contact?');"><img
src="images/delete-16x16.gif" width="16" height="16"
border="0"></a>
</td>
</tr>
<% } %>
</tbody>
</table>
</div>
</div>
</div>
</fieldset> </fieldset>
</form>
<br><br> <br><br>
<form action="registration-props-form.jsp?savemessage=true" method="post">
<fieldset> <fieldset>
<legend>Welcome Message</legend> <legend>Welcome Message</legend>
<div> <div>
<p> <p>Enter the welcome message that will be sent to new users when they register.</p>
Enable this feature to send a welcome message to new users after they have registered.
</p> <% if (ParamUtils.getBooleanParameter(request, "messageSaved")) { %>
<table cellpadding="3" cellspacing="0" border="0" width="100%"> <div class="jive-success">
<tbody> <table cellpadding="0" cellspacing="0" border="0">
<tr> <tbody>
<td width="1%"> <tr>
<input type="radio" name="welcomeenabled" value="false" id="wel01" <td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" border="0"></td>
<%= ((welcomeEnabled) ? "" : "checked") %>> <td class="jive-icon-label">Message saved successfully.</td>
</td> </tr>
<td colspan="2"> </tbody>
<label for="wel01"><b>Disabled</b></label> - Welcome message will not be sent out. </table>
</td> </div>
</tr>
<tr> <% } %>
<td width="1%">
<input type="radio" name="welcomeenabled" value="true" id="wel02" <table cellpadding="3" cellspacing="0" border="0" width="100%">
<%= ((welcomeEnabled) ? "checked" : "") %>> <tbody>
</td> <tr>
<td colspan="2"> <td width="5%" valign="top">Message:&nbsp;</td>
<label for="wel02"><b>Enabled</b></label> - Welcome message will be sent out. <td width="95%"><textarea cols="45" rows="5" wrap="virtual" name="welcomemessage"><%= welcomeMessage %></textarea>
<% if (errors.containsKey("missingWelcomeMessage")) { %>
<span class="jive-error-text"> <br>
Please enter a welcome message.
</span>
<% } %>
</td> </td>
</tr> </tr>
<tr> </tbody>
<td width="1%">&nbsp;</td> </table>
<td width="9%" valign="top">Message:&nbsp;</td> </div>
<td width="90%">
<textarea cols="45" rows="5" wrap="virtual" name="welcomemessage"><%= welcomeMessage %></textarea> <input type="submit" value="Save Message"/>
<% if (errors.containsKey("missingWelcomeMessage")) { %>
<span class="jive-error-text">
<br>Please enter a welcome message.
</span>
<% } %>
</td>
</tr>
</tbody>
</table>
</div>
</fieldset> </fieldset>
</form>
<br><br> <br><br>
<input type="submit" value="Save Properties"> <form action="registration-props-form.jsp?savegroup=true" method="post">
<fieldset>
<legend>Default Group</legend>
<div>
<p>Enter the name of the group that all new users will be automatically added to.</p>
<% if (ParamUtils.getBooleanParameter(request, "groupSaved")) { %>
<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">Group saved successfully.</td>
</tr>
</tbody>
</table>
</div>
<% } %>
<label>Default Group</label>
<input type="text" name="groupname" size="30" maxlength="100" value="<%= (group != null ? group : "") %>"/>
<% if (errors.containsKey("groupNotFound")) { %>
<span class="jive-error-text"> <br>
Group not found or is invalid.
</span>
<% } %>
</div>
<input type="submit" value="Save Group"/>
</fieldset>
</form> </form>
<jsp:include page="bottom.jsp" flush="true" /> <jsp:include page="bottom.jsp" flush="true" />
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