session-conflict.jsp 6.18 KB
Newer Older
Matt Tucker's avatar
Matt Tucker committed
1 2 3 4
<%--
  -	$RCSfile$
  -	$Revision$
  -	$Date$
Bill Lynch's avatar
Bill Lynch committed
5 6 7 8 9
  -
  - Copyright (C) 2004 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.
Matt Tucker's avatar
Matt Tucker committed
10 11
--%>

12 13
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
Bill Lynch's avatar
Bill Lynch committed
14

Matt Tucker's avatar
Matt Tucker committed
15 16 17 18 19 20
<%@ page import="org.jivesoftware.util.*,
                 java.util.Iterator,
                 org.jivesoftware.messenger.*,
                 java.util.Date,
                 java.text.DateFormat,
                 java.util.HashMap,
Derek DeMoro's avatar
Derek DeMoro committed
21
                 java.util.Map,
Bill Lynch's avatar
Bill Lynch committed
22 23 24 25 26 27 28
                 org.jivesoftware.admin.AdminPageBean"
    errorPage="error.jsp"
%>

<jsp:useBean id="admin" class="org.jivesoftware.util.WebManager"  />
<% admin.init(request, response, session, application, out ); %>

Derek DeMoro's avatar
Derek DeMoro committed
29 30
<jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" />
<%  // Title of this page and breadcrumbs
31
    String title = LocaleUtils.getLocalizedString("session.conflict.title");
Derek DeMoro's avatar
Derek DeMoro committed
32
    pageinfo.setTitle(title);
33 34
    pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(LocaleUtils.getLocalizedString("global.main"), "index.jsp"));
    pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "session-conflict.jsp"));
Derek DeMoro's avatar
Derek DeMoro committed
35 36
    pageinfo.setPageID("server-session-conflict");
%>
Matt Tucker's avatar
Matt Tucker committed
37

Bill Lynch's avatar
Bill Lynch committed
38
<jsp:include page="top.jsp" flush="true" />
Derek DeMoro's avatar
Derek DeMoro committed
39
<jsp:include page="title.jsp" flush="true" />
Matt Tucker's avatar
Matt Tucker committed
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67

<%  // Get parameters
    boolean update = request.getParameter("update") != null;
    int kickPolicy = ParamUtils.getIntParameter(request,"kickPolicy",Integer.MAX_VALUE);
    int kickValue = ParamUtils.getIntParameter(request,"kickValue",-2);

    if (kickPolicy == -2) {
        kickPolicy = admin.getSessionManager().getConflictKickLimit();
    }

    // Update the session kick policy if requested
    Map errors = new HashMap();
    if (update) {
        // Validate params
        if (kickPolicy != 0 && kickPolicy != 1 && kickPolicy != SessionManager.NEVER_KICK) {
            if (kickValue <= 1) {
                errors.put("kickValue","");
            }
        }
        // If no errors, continue:
        if (errors.size() == 0) {
            if (kickPolicy != 0 && kickPolicy != 1 && kickPolicy != SessionManager.NEVER_KICK) {
                admin.getSessionManager().setConflictKickLimit(kickValue);
            }
            else {
                admin.getSessionManager().setConflictKickLimit(kickPolicy);
            }
            %>
Bill Lynch's avatar
Bill Lynch committed
68 69 70 71 72 73

    <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">
74
        <fmt:message key="session.conflict.update" />
Bill Lynch's avatar
Bill Lynch committed
75 76 77 78 79
        </td></tr>
    </tbody>
    </table>
    </div><br>

Matt Tucker's avatar
Matt Tucker committed
80 81 82 83 84 85 86 87 88
            <%
          
          
        }
    }

    // Update variable values
    kickPolicy = admin.getSessionManager().getConflictKickLimit();
%>
Bill Lynch's avatar
Bill Lynch committed
89 90

<p>
91
<fmt:message key="session.conflict.info" />
Bill Lynch's avatar
Bill Lynch committed
92 93 94 95 96
</p>

<form action="session-conflict.jsp" method="post">

<fieldset>
97
    <legend><fmt:message key="session.conflict.policy" /></legend>
Bill Lynch's avatar
Bill Lynch committed
98 99 100
    <div>
    <table cellpadding="3" cellspacing="0" border="0" width="100%">
    <tbody>
Matt Tucker's avatar
Matt Tucker committed
101
        <tr valign="middle">
Bill Lynch's avatar
Bill Lynch committed
102 103 104 105 106
            <td width="1%">
                <input type="radio" name="kickPolicy" value="0" id="rb01"
                 <%= ((kickPolicy==0) ? "checked" : "") %>>
            </td>
            <td width="99%">
107 108
                <label for="rb01"><b><fmt:message key="session.conflict.always_kick" /></b></label> - 
                <fmt:message key="session.conflict.always_kick_info" />
Bill Lynch's avatar
Bill Lynch committed
109 110
            </td>
        </tr>
Matt Tucker's avatar
Matt Tucker committed
111
        <tr valign="middle">
Bill Lynch's avatar
Bill Lynch committed
112 113 114 115 116
            <td width="1%">
                <input type="radio" name="kickPolicy" value="<%= SessionManager.NEVER_KICK %>" id="rb02"
                 <%= ((kickPolicy==SessionManager.NEVER_KICK) ? "checked" : "") %>>
            </td>
            <td width="99%">
117 118
                <label for="rb02"><b><fmt:message key="session.conflict.never_kick" /></b></label> - 
                <fmt:message key="session.conflict.never_kick_info" />
Bill Lynch's avatar
Bill Lynch committed
119 120
            </td>
        </tr>
Matt Tucker's avatar
Matt Tucker committed
121
        <tr valign="middle">
Bill Lynch's avatar
Bill Lynch committed
122 123 124 125 126
            <td width="1%">
                <input type="radio" name="kickPolicy" value="1" id="rb04"
                 <%= ((kickPolicy==1) ? "checked" : "") %>>
            </td>
            <td width="99%">
127 128
                <label for="rb04"><b><fmt:message key="session.conflict.allow_one" /></b></label> - 
                <fmt:message key="session.conflict.resource_conflict" />
Bill Lynch's avatar
Bill Lynch committed
129 130
            </td>
        </tr>
Matt Tucker's avatar
Matt Tucker committed
131 132 133 134 135 136
<%  // Figure out if the kick policy is neither 0 nor SessionManager.NEVER_KICK:
    boolean assignedKickPolicy = false;
    if (kickPolicy != 0 && kickPolicy != 1 && kickPolicy != SessionManager.NEVER_KICK) {
       assignedKickPolicy = true;
    }
%>
Matt Tucker's avatar
Matt Tucker committed
137
        <tr valign="middle">
Bill Lynch's avatar
Bill Lynch committed
138 139 140 141 142 143
            <td width="1%">
                <input type="radio" name="kickPolicy" value="<%= Integer.MAX_VALUE %>" id="rb03"
                 onfocus="this.form.kickValue.focus();"
                 <%= ((assignedKickPolicy) ? "checked" : "") %>>
            </td>
            <td width="99%">
144 145 146
                <label for="rb03"><b><fmt:message key="session.conflict.kick_value" /></b></label> - 
                <fmt:message key="session.conflict.kick_value_info" />
                
Bill Lynch's avatar
Bill Lynch committed
147 148
            </td>
        </tr>
Matt Tucker's avatar
Matt Tucker committed
149
        <tr valign="middle">
Bill Lynch's avatar
Bill Lynch committed
150 151 152 153 154 155
            <td width="1%">
                &nbsp;
            </td>
            <td width="99%">
                <%  if (errors.get("kickValue") != null) { %>
                    <span class="jive-error-text">
156
                    <fmt:message key="session.conflict.enter_value" />
Bill Lynch's avatar
Bill Lynch committed
157 158 159 160 161 162 163 164 165 166 167 168 169
                    </span><br>
                <%  } %>
                <input type="text" name="kickValue" value="<%= ((assignedKickPolicy) ? ""+kickPolicy : "") %>"
                 size="5" maxlength="10"
                 onclick="this.form.kickPolicy[3].checked=true;">
            </td>
        </tr>
    </tbody>
    </table>
    </div>
</fieldset>

<br><br>
Matt Tucker's avatar
Matt Tucker committed
170

171
<input type="submit" name="update" value="<fmt:message key="global.save_settings" />">
Matt Tucker's avatar
Matt Tucker committed
172 173 174

</form>

Bill Lynch's avatar
Bill Lynch committed
175
<jsp:include page="bottom.jsp" flush="true" />