⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 registration-props-form.jsp

📁 openfire 服务器源码下载
💻 JSP
📖 第 1 页 / 共 2 页
字号:
<%--  - Copyright (C) 2008 Jive Software. All rights reserved.  -  - This software is published under the terms of the GNU Public License (GPL),  - a copy of which is included in this distribution.--%><%@ page   import="java.util.*,           org.jivesoftware.admin.*,           org.jivesoftware.openfire.XMPPServer,           org.jivesoftware.openfire.user.*,           org.jivesoftware.openfire.plugin.RegistrationPlugin,           org.jivesoftware.openfire.group.*,           org.jivesoftware.util.*"   errorPage="error.jsp"%><%@ page import="org.xmpp.packet.JID" %><%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%><%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt"%><%    boolean save = request.getParameter("save") != null;    boolean saveWelcome = request.getParameter("savemessage") != null;    boolean saveGroup = request.getParameter("savegroup") != null;    boolean saveHeader = request.getParameter("saveheader") != 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);    boolean webEnabled = ParamUtils.getBooleanParameter(request, "webenabled", 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");    String header = ParamUtils.getParameter(request, "header");    RegistrationPlugin plugin = (RegistrationPlugin) XMPPServer.getInstance().getPluginManager().getPlugin("registration");    Map<String, String> errors = new HashMap<String, String>();    if (addIM) {        if (contactIM == null) {            errors.put("missingContact", "missingContact");        }        else {            contactIM = contactIM.trim().toLowerCase();                    if(contactIM.contains("@")) {                if (!XMPPServer.getInstance().isLocal(new JID(contactIM))) {                    errors.put("remoteContact", "remoteContact");                }                contactIM = contactIM.substring(0,contactIM.lastIndexOf("@"));            }        }        if (errors.isEmpty()) {            try  {                XMPPServer.getInstance().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);        plugin.setWebEnabled(webEnabled);                if (groupEnabled) {            group = plugin.getGroup();            if (group == null || group.trim().length() < 1) {                errors.put("groupNotFound", "groupNotFound");            }                        try {                GroupManager.getInstance().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");        }                try {            GroupManager.getInstance().getGroup(group);        }        catch (Exception e) {            errors.put("groupNotFound", "groupNotFound");        }                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);    }        if (saveHeader) {        if (header == null || header.trim().length() < 1) {            errors.put("missingHeader", "missingHeader");        } else {            plugin.setHeader(header);            response.sendRedirect("registration-props-form.jsp?headerSaved=true");            return;        }    }        imEnabled = plugin.imNotificationEnabled();    emailEnabled = plugin.emailNotificationEnabled();    welcomeEnabled = plugin.welcomeEnabled();    groupEnabled = plugin.groupEnabled();    webEnabled = plugin.webEnabled();        welcomeMessage = plugin.getWelcomeMessage();    group = plugin.getGroup();    header = plugin.getHeader();%><html>    <head>        <title><fmt:message key="registration.props.form.title" /></title>        <meta name="pageID" content="registration-props-form"/>    </head>    <body><script language="JavaScript" type="text/javascript">function addIMContact() {    document.regform.addIM.value = 'true';    document.regform.submit();}function addEmailContact() {    document.regform.addEmail.value = 'true';    document.regform.submit();}</script><p><fmt:message key="registration.props.form.details" /></p><form action="registration-props-form.jsp?save" name="regform" method="post"><input type="hidden" name="addIM" value=""><input type="hidden" name="addEmail" value=""><div class="jive-contentBoxHeader"><fmt:message key="registration.props.form.registration_settings" /></div><div class="jive-contentBox">    <p><fmt:message key="registration.props.form.enable_features" /></p>       <% 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"><fmt:message key="registration.props.form.save_success" /></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"><fmt:message key="registration.props.form.invalid_group" /></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" : "" %>></td>            <td width="99%" align="left"><fmt:message key="registration.props.form.enable_im_notification" /></td>        </tr>        <tr>            <td width="1%" align="center" nowrap><input type="checkbox" name="emailenabled" <%=(emailEnabled) ? "checked" : "" %>></td>            <td width="99%" align="left"><fmt:message key="registration.props.form.enable_email_notification" /></td>        </tr>        <tr>            <td width="1%" align="center" nowrap><input type="checkbox" name="welcomeenabled" <%=(welcomeEnabled) ? "checked" : "" %>></td>            <td width="99%" align="left"><fmt:message key="registration.props.form.enable_welcome_msg" /></td>        </tr>        <tr>            <td width="1%" align="center" nowrap><input type="checkbox" name="groupenabled" <%=(groupEnabled) ? "checked" : "" %>></td>            <td width="99%" align="left"><fmt:message key="registration.props.form.enable_add_user_to_group" /></td>        </tr>        <tr>            <td width="1%" align="center" nowrap><input type="checkbox" name="webenabled" <%=(webEnabled) ? "checked" : "" %>></td>            <td width="99%" align="left"><fmt:message key="registration.props.form.enable_web_registration" /> <%=plugin.webRegistrationAddress() %></td>        </tr>    </tbody>    </table>    <br>    <input type="submit" value="<fmt:message key="registration.props.form.save_settings" />"/></div><br><div class="jive-contentBoxHeader"><fmt:message key="registration.props.form.registration_contacts" /></div><div class="jive-contentBox">    <p><fmt:message key="registration.props.form.registration_contacts_details" /></p>       <% if (ParamUtils.getBooleanParameter(request, "deleteSuccess")) { %>       <div class="jive-success">

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -