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

11 12
<%@ 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
13

Matt Tucker's avatar
Matt Tucker committed
14
<%@ page import="org.jivesoftware.util.*,
15
                 org.jivesoftware.wildfire.*,
Matt Tucker's avatar
Matt Tucker committed
16
                 java.util.HashMap,
17
                 java.util.Map"
Bill Lynch's avatar
Bill Lynch committed
18 19 20
    errorPage="error.jsp"
%>

21 22
<jsp:useBean id="webManager" class="org.jivesoftware.util.WebManager"  />
<% webManager.init(request, response, session, application, out ); %>
Bill Lynch's avatar
Bill Lynch committed
23

24 25 26 27 28 29 30
<html>
    <head>
        <title><fmt:message key="session.conflict.title"/></title>
        <meta name="pageID" content="server-session-conflict"/>
        <meta name="helpPage" content="set_the_server_resource_conflict_policy.html"/>
    </head>
    <body>
Matt Tucker's avatar
Matt Tucker committed
31 32 33 34 35 36 37

<%  // 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) {
38
        kickPolicy = webManager.getSessionManager().getConflictKickLimit();
Matt Tucker's avatar
Matt Tucker committed
39 40 41 42 43 44 45 46 47 48 49 50 51 52
    }

    // 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) {
53
                webManager.getSessionManager().setConflictKickLimit(kickValue);
Matt Tucker's avatar
Matt Tucker committed
54 55
            }
            else {
56
                webManager.getSessionManager().setConflictKickLimit(kickPolicy);
Matt Tucker's avatar
Matt Tucker committed
57 58
            }
            %>
Bill Lynch's avatar
Bill Lynch committed
59 60 61 62 63 64

    <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">
65
        <fmt:message key="session.conflict.update" />
Bill Lynch's avatar
Bill Lynch committed
66 67 68 69 70
        </td></tr>
    </tbody>
    </table>
    </div><br>

Matt Tucker's avatar
Matt Tucker committed
71 72 73 74 75 76 77
            <%
          
          
        }
    }

    // Update variable values
78
    kickPolicy = webManager.getSessionManager().getConflictKickLimit();
Matt Tucker's avatar
Matt Tucker committed
79
%>
Bill Lynch's avatar
Bill Lynch committed
80 81

<p>
82
<fmt:message key="session.conflict.info" />
Bill Lynch's avatar
Bill Lynch committed
83 84 85 86 87
</p>

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

<fieldset>
88
    <legend><fmt:message key="session.conflict.policy" /></legend>
Bill Lynch's avatar
Bill Lynch committed
89 90 91
    <div>
    <table cellpadding="3" cellspacing="0" border="0" width="100%">
    <tbody>
Matt Tucker's avatar
Matt Tucker committed
92
        <tr valign="middle">
Bill Lynch's avatar
Bill Lynch committed
93 94 95 96 97
            <td width="1%">
                <input type="radio" name="kickPolicy" value="0" id="rb01"
                 <%= ((kickPolicy==0) ? "checked" : "") %>>
            </td>
            <td width="99%">
98 99
                <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
100 101
            </td>
        </tr>
Matt Tucker's avatar
Matt Tucker committed
102
        <tr valign="middle">
Bill Lynch's avatar
Bill Lynch committed
103 104 105 106 107
            <td width="1%">
                <input type="radio" name="kickPolicy" value="<%= SessionManager.NEVER_KICK %>" id="rb02"
                 <%= ((kickPolicy==SessionManager.NEVER_KICK) ? "checked" : "") %>>
            </td>
            <td width="99%">
108 109
                <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
110 111
            </td>
        </tr>
Matt Tucker's avatar
Matt Tucker committed
112
        <tr valign="middle">
Bill Lynch's avatar
Bill Lynch committed
113 114 115 116 117
            <td width="1%">
                <input type="radio" name="kickPolicy" value="1" id="rb04"
                 <%= ((kickPolicy==1) ? "checked" : "") %>>
            </td>
            <td width="99%">
118 119
                <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
120 121
            </td>
        </tr>
Matt Tucker's avatar
Matt Tucker committed
122 123 124 125 126 127
<%  // 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
128
        <tr valign="middle">
Bill Lynch's avatar
Bill Lynch committed
129 130 131 132 133 134
            <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%">
135 136 137
                <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
138 139
            </td>
        </tr>
Matt Tucker's avatar
Matt Tucker committed
140
        <tr valign="middle">
Bill Lynch's avatar
Bill Lynch committed
141 142 143 144 145 146
            <td width="1%">
                &nbsp;
            </td>
            <td width="99%">
                <%  if (errors.get("kickValue") != null) { %>
                    <span class="jive-error-text">
147
                    <fmt:message key="session.conflict.enter_value" />
Bill Lynch's avatar
Bill Lynch committed
148 149 150 151 152 153 154 155 156 157 158 159 160
                    </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
161

162
<input type="submit" name="update" value="<fmt:message key="global.save_settings" />">
Matt Tucker's avatar
Matt Tucker committed
163 164 165

</form>

166 167
    </body>
</html>