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,23 +13,83 @@ import org.jivesoftware.messenger.container.Plugin; ...@@ -13,23 +13,83 @@ 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();
...@@ -37,26 +97,29 @@ public class RegistrationPlugin implements Plugin { ...@@ -37,26 +97,29 @@ public class RegistrationPlugin implements Plugin {
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);
setRegistrationNotificationEnabled(registrationWelcomeEnabled);
contact = JiveGlobals.getProperty("registration.notification.contact", "admin"); String ecs = JiveGlobals.getProperty(EMAIL_CONTACTS);
if (ecs != null) {
emailContacts.addAll(Arrays.asList(ecs.split(",")));
}
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,46 +135,154 @@ public class RegistrationPlugin implements Plugin { ...@@ -72,46 +135,154 @@ 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!");
}
public void setGroupEnabled(boolean enable) {
JiveGlobals.setProperty(GROUP_ENABLED, enable ? "true" : "false");
}
public boolean groupEnabled() {
return JiveGlobals.getBooleanProperty(GROUP_ENABLED, false);
} }
private void sendRegistrationNotificatonMessage(User user) { public void setGroup(String group) {
JiveGlobals.setProperty(REGISTRAION_GROUP, group);
}
public String getGroup() {
return JiveGlobals.getProperty(REGISTRAION_GROUP);
}
private class RegistrationUserEventListener implements UserEventListener {
public void userCreated(User user, Map params) {
if (imNotificationEnabled()) {
sendIMNotificatonMessage(user);
}
if (emailNotificationEnabled()) {
sendAlertEmail(user);
}
if (welcomeEnabled()) {
sendWelcomeMessage(user);
}
if (groupEnabled()) {
addUserToGroup(user);
}
}
public void userDeleting(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"; String msg = " A new user with the username of '" + user.getUsername() + "' just registered";
router.route(createServerMessage(getContact() + "@" + serverName,
for (String contact : getIMContacts()) {
router.route(createServerMessage(contact + "@" + serverName,
"Registration Notification", msg)); "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) { private void sendWelcomeMessage(User user) {
router.route(createServerMessage(user.getUsername() + "@" + serverName, "Welcome", router.route(createServerMessage(user.getUsername() + "@" + serverName, "Welcome",
...@@ -129,23 +300,42 @@ public class RegistrationPlugin implements Plugin { ...@@ -129,23 +300,42 @@ public class RegistrationPlugin implements Plugin {
return message; return message;
} }
//TODO JM-170 private void addUserToGroup(User user) {
//TODO add the ability for the admin to monitor when users are deleted? try {
private class RegistrationUserEventListener implements UserEventListener { GroupManager groupManager = GroupManager.getInstance();
public void userCreated(User user, Map params) { Group group = groupManager.getGroup(getGroup());
if (registrationNotificationEnabled) { group.getMembers().add(user.getUsername());
sendRegistrationNotificatonMessage(user); }
catch (GroupNotFoundException e) {
Log.error(e);
}
}
} }
if (registrationWelcomeEnabled) { private String propPrep(Collection<String> props) {
sendWelcomeMessage(user); 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 void userDeleting(User user, Map params) { public boolean isValidAddress(String address) {
if (address == null) {
return false;
} }
public void userModified(User user, Map params) { //must at least match x@x.xx
if (!address.matches(".{1,}[@].{1,}[.].{2,}")) {
return false;
} }
return true;
} }
} }
<%@ page import="java.util.*, <%@ page
import="java.util.*,
org.jivesoftware.admin.*, org.jivesoftware.admin.*,
org.jivesoftware.messenger.XMPPServer, org.jivesoftware.messenger.XMPPServer,
org.jivesoftware.messenger.user.*, org.jivesoftware.messenger.user.*,
org.jivesoftware.messenger.plugin.RegistrationPlugin, org.jivesoftware.messenger.plugin.RegistrationPlugin,
org.jivesoftware.messenger.group.*,
org.jivesoftware.util.*" org.jivesoftware.util.*"
errorPage="error.jsp" errorPage="error.jsp"%>
%>
<script lang="JavaScript" type="text/javascript">
function addIMContact() {
document.regform.addIM.value = 'true';
document.regform.submit();
}
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %> function addEmailContact() {
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %> document.regform.addEmail.value = 'true';
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" /> <jsp:useBean id="admin" class="org.jivesoftware.util.WebManager" />
<c:set var="admin" value="${admin.manager}" /> <c:set var="admin" value="${admin.manager}" />
<% admin.init(request, response, session, application, out ); %>
<% <%
admin.init(request, response, session, application, out);
boolean save = request.getParameter("save") != null; boolean save = request.getParameter("save") != null;
boolean success = request.getParameter("success") != null; boolean saveWelcome = request.getParameter("savemessage") != null;
boolean notificationEnabled = ParamUtils.getBooleanParameter(request, "notificationenabled"); boolean saveGroup = request.getParameter("savegroup") != null;
String contactName = ParamUtils.getParameter(request, "contactname");
boolean welcomeEnabled = ParamUtils.getBooleanParameter(request, "welcomeenabled"); 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 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 { else {
contactName = contactName.trim().toLowerCase(); contactIM = contactIM.trim().toLowerCase();
try { try {
UserManager.getInstance().getUser(contactName); admin.getUserManager().getUser(contactIM);
} catch (UserNotFoundException unfe) { plugin.addIMContact(contactIM);
response.sendRedirect("registration-props-form.jsp?addSuccess=true");
return;
}
catch (UserNotFoundException unfe) {
errors.put("userNotFound", "userNotFound"); errors.put("userNotFound", "userNotFound");
} }
} }
} }
if (welcomeEnabled) { if (deleteIM) {
if (welcomeMessage == null) { plugin.removeIMContact(contactIM);
errors.put("missingWelcomeMessage", "missingWelcomeMessage"); 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) { if (errors.size() == 0) {
plugin.setRegistrationNotificationEnabled(notificationEnabled); plugin.setGroupEnabled(groupEnabled);
plugin.setContact(contactName); response.sendRedirect("registration-props-form.jsp?settingsSaved=true");
return;
}
}
plugin.setRegistrationWelcomeEnabled(welcomeEnabled); if (saveWelcome) {
plugin.setWelcomeMessage(welcomeMessage.trim()); if (welcomeMessage == null || welcomeMessage.trim().length() < 1) {
response.sendRedirect("registration-props-form.jsp?success=true"); errors.put("missingWelcomeMessage", "missingWelcomeMessage");
} else {
plugin.setWelcomeMessage(welcomeMessage);
response.sendRedirect("registration-props-form.jsp?welcomeSaved=true");
return; return;
} }
}
if (saveGroup && plugin.groupEnabled()) {
if (group == null || group.trim().length() < 1) {
errors.put("groupNotFound", "groupNotFound");
} }
else {
contactName = plugin.getContact(); try {
welcomeMessage = plugin.getWelcomeMessage(); admin.getGroupManager().getGroup(group);
}
catch (Exception e) {
errors.put("groupNotFound", "groupNotFound");
} }
if (errors.size() == 0) { if (errors.size() == 0) {
contactName = plugin.getContact(); plugin.setGroup(group);
welcomeMessage = plugin.getWelcomeMessage(); response.sendRedirect("registration-props-form.jsp?groupSaved=true");
return;
}
}
if (saveGroup && !plugin.groupEnabled()) {
group = (group == null) ? "" : group;
plugin.setGroup(group);
} }
notificationEnabled = plugin.registrationNotificationEnabled(); imEnabled = plugin.imNotificationEnabled();
welcomeEnabled = plugin.registrationWelcomeEnabled(); emailEnabled = plugin.emailNotificationEnabled();
welcomeEnabled = plugin.welcomeEnabled();
groupEnabled = plugin.groupEnabled();
welcomeMessage = plugin.getWelcomeMessage();
group = plugin.getGroup();
%> %>
<jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" /> <jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" />
...@@ -84,127 +178,270 @@ ...@@ -84,127 +178,270 @@
<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> <form action="registration-props-form.jsp?save" name="regform" method="post">
<input type="hidden" name="addIM" value="">
<input type="hidden" name="addEmail" value="">
<fieldset>
<legend>Registration Settings</legend>
<div>
<% if (success) { %> <% if (ParamUtils.getBooleanParameter(request, "settingsSaved")) { %>
<div class="jive-success"> <div class="jive-success">
<table cellpadding="0" cellspacing="0" border="0"> <table cellpadding="0" cellspacing="0" border="0">
<tbody> <tbody>
<tr> <tr>
<td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" border="0"></td> <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> <td class="jive-icon-label">Settings saved successfully.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div><br> </div>
<% } %>
<% } else if (errors.size() > 0) { %> <% if (errors.containsKey("groupNotFound")) { %>
<div class="jive-error"> <div class="jive-error">
<table cellpadding="0" cellspacing="0" border="0"> <table cellpadding="0" cellspacing="0" border="0">
<tbody> <tbody>
<tr> <tr>
<td class="jive-icon"><img src="images/error-16x16.gif" width="16" height="16" border="0"></td> <td class="jive-icon"><img src="images/error-16x16.gif" width="16" height="16" border="0"></td>
<td class="jive-icon-label">Error saving the service settings.</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> </tr>
</tbody> </tbody>
</table> </table>
</div><br> </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>
<table cellpadding="3" cellspacing="0" border="0" width="100%"> <% if (ParamUtils.getBooleanParameter(request, "deleteSuccess")) { %>
<div class="jive-success">
<table cellpadding="0" cellspacing="0" border="0">
<tbody> <tbody>
<tr> <tr>
<td width="1%"> <td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" border="0"></td>
<input type="radio" name="notificationenabled" value="false" id="not01" <td class="jive-icon-label">Contact successfully removed.</td>
<%= ((notificationEnabled) ? "" : "checked") %>>
</td>
<td width="99%">
<label for="not01"><b>Disabled</b></label> - Notifications will not be sent out.
</td>
</tr> </tr>
</tbody>
</table>
</div>
<% } else if (ParamUtils.getBooleanParameter(request, "addSuccess")) { %>
<div class="jive-success">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr> <tr>
<td width="1%"> <td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" border="0"></td>
<input type="radio" name="notificationenabled" value="true" id="not02" <td class="jive-icon-label">Contact successfully added.</td>
<%= ((notificationEnabled) ? "checked" : "") %>>
</td>
<td width="99%">
<label for="not02"><b>Enabled</b></label> - Notifications will be sent out.
</td>
</tr> </tr>
</tbody>
</table>
</div>
<% } else if (errors.containsKey("missingContact")) { %>
<div class="jive-error">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr> <tr>
<td>&nbsp;</td> <td class="jive-icon"><img src="images/error-16x16.gif" width="16" height="16" border="0"></td>
<td align="left">Username:&nbsp; <td class="jive-icon-label">Missing contact.</td>
<input type="text" size="30" maxlength="75" name="contactname" </tr>
value="<%= (contactName != null ? contactName : "") %>">@<%= XMPPServer.getInstance().getServerInfo().getName() %> </tbody>
<% if (errors.containsKey("missingContactName")) { %> </table>
<span class="jive-error-text"> </div>
<br>Please enter a username.
</span>
<% } else if (errors.containsKey("userNotFound")) { %> <% } else if (errors.containsKey("userNotFound")) { %>
<span class="jive-error-text">
<br>Could not find user. Please try again. <div class="jive-error">
</span> <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> </td>
</tr> </tr>
<% } %>
</tbody> </tbody>
</table> </table>
</div> </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>
<table cellpadding="3" cellspacing="0" border="0" width="100%"> <% if (ParamUtils.getBooleanParameter(request, "messageSaved")) { %>
<div class="jive-success">
<table cellpadding="0" cellspacing="0" border="0">
<tbody> <tbody>
<tr> <tr>
<td width="1%"> <td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" border="0"></td>
<input type="radio" name="welcomeenabled" value="false" id="wel01" <td class="jive-icon-label">Message saved successfully.</td>
<%= ((welcomeEnabled) ? "" : "checked") %>>
</td>
<td colspan="2">
<label for="wel01"><b>Disabled</b></label> - Welcome message will not be sent out.
</td>
</tr>
<tr>
<td width="1%">
<input type="radio" name="welcomeenabled" value="true" id="wel02"
<%= ((welcomeEnabled) ? "checked" : "") %>>
</td>
<td colspan="2">
<label for="wel02"><b>Enabled</b></label> - Welcome message will be sent out.
</td>
</tr> </tr>
</tbody>
</table>
</div>
<% } %>
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tbody>
<tr> <tr>
<td width="1%">&nbsp;</td> <td width="5%" valign="top">Message:&nbsp;</td>
<td width="9%" valign="top">Message:&nbsp;</td> <td width="95%"><textarea cols="45" rows="5" wrap="virtual" name="welcomemessage"><%= welcomeMessage %></textarea>
<td width="90%">
<textarea cols="45" rows="5" wrap="virtual" name="welcomemessage"><%= welcomeMessage %></textarea>
<% if (errors.containsKey("missingWelcomeMessage")) { %> <% if (errors.containsKey("missingWelcomeMessage")) { %>
<span class="jive-error-text"> <span class="jive-error-text"> <br>
<br>Please enter a welcome message. Please enter a welcome message.
</span> </span>
<% } %> <% } %>
</td> </td>
...@@ -212,11 +449,48 @@ Use the form below to edit user registration settings.<br> ...@@ -212,11 +449,48 @@ Use the form below to edit user registration settings.<br>
</tbody> </tbody>
</table> </table>
</div> </div>
<input type="submit" value="Save Message"/>
</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