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;
import org.jivesoftware.messenger.container.PluginManager;
import org.jivesoftware.messenger.event.UserEventDispatcher;
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.util.EmailService;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.Log;
import org.xmpp.packet.JID;
import org.xmpp.packet.Message;
import org.xmpp.packet.Packet;
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 javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeUtility;
/**
* Registration plugin.
*
* TODO: document plugin property names here.
*
* @author Ryan Graham.
*/
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 String serverName;
private JID serverAddress;
private MessageRouter router;
private boolean registrationNotificationEnabled;
private boolean registrationWelcomeEnabled;
private String contact;
private List<String> imContacts = new ArrayList<String>();
private List<String> emailContacts = new ArrayList<String>();
public RegistrationPlugin() {
serverName = XMPPServer.getInstance().getServerInfo().getName();
serverAddress = new JID(serverName);
router = XMPPServer.getInstance().getMessageRouter();
registrationNotificationEnabled = JiveGlobals.getBooleanProperty(
"registration.notification.enabled", false);
setRegistrationNotificationEnabled(registrationNotificationEnabled);
registrationWelcomeEnabled = JiveGlobals.getBooleanProperty(
"registration.welcome.enabled", false);
setRegistrationNotificationEnabled(registrationWelcomeEnabled);
contact = JiveGlobals.getProperty("registration.notification.contact", "admin");
String imcs = JiveGlobals.getProperty(IM_CONTACTS);
if (imcs != null) {
imContacts.addAll(Arrays.asList(imcs.split(",")));
}
String ecs = JiveGlobals.getProperty(EMAIL_CONTACTS);
if (ecs != null) {
emailContacts.addAll(Arrays.asList(ecs.split(",")));
}
UserEventDispatcher.addListener(listener);
//delete properties from version 1.0
JiveGlobals.deleteProperty("registration.notification.contact");
JiveGlobals.deleteProperty("registration.notification.enabled");
}
public void processPacket(Packet packet) {
......@@ -72,74 +135,115 @@ public class RegistrationPlugin implements Plugin {
router = null;
}
public void setRegistrationNotificationEnabled(boolean enable) {
registrationNotificationEnabled = enable;
JiveGlobals.setProperty("registration.notification.enabled", enable ? "true" : "false");
public void setIMNotificationEnabled(boolean enable) {
JiveGlobals.setProperty(IM_NOTIFICATION_ENABLED, enable ? "true" : "false");
}
public boolean registrationNotificationEnabled() {
return JiveGlobals.getBooleanProperty("registration.notification.enabled", false);
public boolean imNotificationEnabled() {
return JiveGlobals.getBooleanProperty(IM_NOTIFICATION_ENABLED, false);
}
public void setContact(String contact) {
this.contact = contact;
JiveGlobals.setProperty("registration.notification.contact", contact);
public void setEmailNotificationEnabled(boolean enable) {
JiveGlobals.setProperty(EMAIL_NOTIFICATION_ENABLED, enable ? "true" : "false");
}
public String getContact() {
return contact;
public boolean emailNotificationEnabled() {
return JiveGlobals.getBooleanProperty(EMAIL_NOTIFICATION_ENABLED, false);
}
public void setRegistrationWelcomeEnabled(boolean enable) {
registrationWelcomeEnabled = enable;
JiveGlobals.setProperty("registration.welcome.enabled", enable ? "true" : "false");
public Collection<String> getIMContacts() {
Collections.sort(imContacts);
return imContacts;
}
public boolean registrationWelcomeEnabled() {
return JiveGlobals.getBooleanProperty("registration.welcome.enabled", false);
public void addIMContact(String contact) {
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) {
JiveGlobals.setProperty("registration.welcome.message", message);
JiveGlobals.setProperty(WELCOME_MSG, message);
}
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) {
String msg = " A new user with the username of '" + user.getUsername() + "' just registered";
router.route(createServerMessage(getContact() + "@" + serverName,
"Registration Notification", msg));
public void setGroupEnabled(boolean enable) {
JiveGlobals.setProperty(GROUP_ENABLED, enable ? "true" : "false");
}
private void sendWelcomeMessage(User user) {
router.route(createServerMessage(user.getUsername() + "@" + serverName, "Welcome",
getWelcomeMessage()));
public boolean groupEnabled() {
return JiveGlobals.getBooleanProperty(GROUP_ENABLED, false);
}
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;
public void setGroup(String group) {
JiveGlobals.setProperty(REGISTRAION_GROUP, group);
}
//TODO JM-170
//TODO add the ability for the admin to monitor when users are deleted?
public String getGroup() {
return JiveGlobals.getProperty(REGISTRAION_GROUP);
}
private class RegistrationUserEventListener implements UserEventListener {
public void userCreated(User user, Map params) {
if (registrationNotificationEnabled) {
sendRegistrationNotificatonMessage(user);
if (imNotificationEnabled()) {
sendIMNotificatonMessage(user);
}
if (registrationWelcomeEnabled) {
if (emailNotificationEnabled()) {
sendAlertEmail(user);
}
if (welcomeEnabled()) {
sendWelcomeMessage(user);
}
if (groupEnabled()) {
addUserToGroup(user);
}
}
public void userDeleting(User user, Map params) {
......@@ -147,5 +251,91 @@ public class RegistrationPlugin implements Plugin {
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.*,
org.jivesoftware.admin.*,
org.jivesoftware.messenger.XMPPServer,
org.jivesoftware.messenger.user.*,
org.jivesoftware.messenger.plugin.RegistrationPlugin,
org.jivesoftware.util.*"
errorPage="error.jsp"
%>
<%@ page
import="java.util.*,
org.jivesoftware.admin.*,
org.jivesoftware.messenger.XMPPServer,
org.jivesoftware.messenger.user.*,
org.jivesoftware.messenger.plugin.RegistrationPlugin,
org.jivesoftware.messenger.group.*,
org.jivesoftware.util.*"
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" %>
<script lang="JavaScript" type="text/javascript">
function addIMContact() {
document.regform.addIM.value = 'true';
document.regform.submit();
}
<jsp:useBean id="admin" class="org.jivesoftware.util.WebManager" />
<c:set var="admin" value="${admin.manager}" />
<% admin.init(request, response, session, application, out ); %>
function addEmailContact() {
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" />
<c:set var="admin" value="${admin.manager}" />
<%
boolean save = request.getParameter("save") != null;
boolean success = request.getParameter("success") != null;
boolean notificationEnabled = ParamUtils.getBooleanParameter(request, "notificationenabled");
String contactName = ParamUtils.getParameter(request, "contactname");
boolean welcomeEnabled = ParamUtils.getBooleanParameter(request, "welcomeenabled");
String welcomeMessage = ParamUtils.getParameter(request, "welcomemessage");
admin.init(request, response, session, application, out);
boolean save = request.getParameter("save") != null;
boolean saveWelcome = request.getParameter("savemessage") != null;
boolean saveGroup = request.getParameter("savegroup") != null;
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");
Map errors = new HashMap();
if (save) {
if (notificationEnabled) {
if (contactName == null) {
errors.put("missingContactName", "missingContactName");
}
else {
contactName = contactName.trim().toLowerCase();
try {
UserManager.getInstance().getUser(contactName);
} catch (UserNotFoundException unfe) {
errors.put("userNotFound", "userNotFound");
}
}
}
Map<String, String> errors = new HashMap<String, String>();
if (addIM) {
if (contactIM == null) {
errors.put("missingContact", "missingContact");
}
else {
contactIM = contactIM.trim().toLowerCase();
try {
admin.getUserManager().getUser(contactIM);
plugin.addIMContact(contactIM);
response.sendRedirect("registration-props-form.jsp?addSuccess=true");
return;
}
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) {
if (welcomeMessage == null) {
errors.put("missingWelcomeMessage", "missingWelcomeMessage");
}
}
try {
admin.getGroupManager().getGroup(group);
}
catch (Exception e) {
errors.put("groupNotFound", "groupNotFound");
}
if (errors.size() == 0) {
plugin.setRegistrationNotificationEnabled(notificationEnabled);
plugin.setContact(contactName);
plugin.setRegistrationWelcomeEnabled(welcomeEnabled);
plugin.setWelcomeMessage(welcomeMessage.trim());
response.sendRedirect("registration-props-form.jsp?success=true");
return;
}
}
else {
contactName = plugin.getContact();
welcomeMessage = plugin.getWelcomeMessage();
}
if (errors.size() == 0) {
contactName = plugin.getContact();
welcomeMessage = plugin.getWelcomeMessage();
}
notificationEnabled = plugin.registrationNotificationEnabled();
welcomeEnabled = plugin.registrationWelcomeEnabled();
if (errors.size() == 0) {
plugin.setGroup(group);
response.sendRedirect("registration-props-form.jsp?groupSaved=true");
return;
}
}
if (saveGroup && !plugin.groupEnabled()) {
group = (group == null) ? "" : group;
plugin.setGroup(group);
}
imEnabled = plugin.imNotificationEnabled();
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" />
......@@ -84,139 +178,319 @@
<jsp:include page="top.jsp" flush="true" />
<jsp:include page="title.jsp" flush="true" />
<p>
Use the form below to edit user registration settings.<br>
</p>
<% if (success) { %>
<p>Use the form below to edit user registration settings.</p>
<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">Service settings updated successfully.</td>
</tr>
</tbody>
</table>
</div><br>
<form action="registration-props-form.jsp?save" name="regform" method="post">
<input type="hidden" name="addIM" value="">
<input type="hidden" name="addEmail" value="">
<% } else if (errors.size() > 0) { %>
<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">Error saving the service settings.</td>
</tr>
</tbody>
</table>
</div><br>
<fieldset>
<legend>Registration Settings</legend>
<div>
<% if (ParamUtils.getBooleanParameter(request, "settingsSaved")) { %>
<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">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>
<legend>Registration Notification</legend>
<div>
<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%">
<tbody>
<tr>
<td width="1%">
<input type="radio" name="notificationenabled" value="false" id="not01"
<%= ((notificationEnabled) ? "" : "checked") %>>
</td>
<td width="99%">
<label for="not01"><b>Disabled</b></label> - Notifications will not be sent out.
</td>
</tr>
<tr>
<td width="1%">
<input type="radio" name="notificationenabled" value="true" id="not02"
<%= ((notificationEnabled) ? "checked" : "") %>>
</td>
<td width="99%">
<label for="not02"><b>Enabled</b></label> - Notifications will be sent out.
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td align="left">Username:&nbsp;
<input type="text" size="30" maxlength="75" name="contactname"
value="<%= (contactName != null ? contactName : "") %>">@<%= XMPPServer.getInstance().getServerInfo().getName() %>
<% if (errors.containsKey("missingContactName")) { %>
<span class="jive-error-text">
<br>Please enter a username.
</span>
<% } else if (errors.containsKey("userNotFound")) { %>
<span class="jive-error-text">
<br>Could not find user. Please try again.
</span>
<% } %>
</td>
</tr>
</tbody>
</table>
</div>
<legend>Registration Notification Contacts</legend>
<div>
<p>Add or remove contacts to be alerted when a new user registers.</p>
<% if (ParamUtils.getBooleanParameter(request, "deleteSuccess")) { %>
<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">Contact successfully removed.</td>
</tr>
</tbody>
</table>
</div>
<% } else if (ParamUtils.getBooleanParameter(request, "addSuccess")) { %>
<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">Contact successfully added.</td>
</tr>
</tbody>
</table>
</div>
<% } else if (errors.containsKey("missingContact")) { %>
<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">Missing contact.</td>
</tr>
</tbody>
</table>
</div>
<% } else if (errors.containsKey("userNotFound")) { %>
<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>
</form>
<br><br>
<form action="registration-props-form.jsp?savemessage=true" method="post">
<fieldset>
<legend>Welcome Message</legend>
<div>
<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%">
<tbody>
<tr>
<td width="1%">
<input type="radio" name="welcomeenabled" value="false" id="wel01"
<%= ((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.
<legend>Welcome Message</legend>
<div>
<p>Enter the welcome message that will be sent to new users when they register.</p>
<% if (ParamUtils.getBooleanParameter(request, "messageSaved")) { %>
<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">Message saved successfully.</td>
</tr>
</tbody>
</table>
</div>
<% } %>
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tbody>
<tr>
<td width="5%" valign="top">Message:&nbsp;</td>
<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>
</tr>
<tr>
<td width="1%">&nbsp;</td>
<td width="9%" valign="top">Message:&nbsp;</td>
<td width="90%">
<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>
</tr>
</tbody>
</table>
</div>
</tr>
</tbody>
</table>
</div>
<input type="submit" value="Save Message"/>
</fieldset>
</form>
<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>
<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