audit-policy.jsp 10.6 KB
Newer Older
Bill Lynch's avatar
Bill Lynch committed
1
<%--
Matt Tucker's avatar
Matt Tucker committed
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
--%>
Bill Lynch's avatar
Bill Lynch committed
11 12

<%@ page import="org.jivesoftware.messenger.audit.AuditManager,
Derek DeMoro's avatar
Derek DeMoro committed
13 14
                   org.jivesoftware.admin.*,
                   org.jivesoftware.util.*,
Bill Lynch's avatar
Bill Lynch committed
15 16 17 18
                   java.util.*"
    errorPage="error.jsp"
%>

19
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
Bill Lynch's avatar
Bill Lynch committed
20

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

Derek DeMoro's avatar
Derek DeMoro committed
24 25
<jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" />
<%  // Title of this page and breadcrumbs
26
    String title = LocaleUtils.getLocalizedString("audit.policy.title");
Derek DeMoro's avatar
Derek DeMoro committed
27
    pageinfo.setTitle(title);
28
    pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(LocaleUtils.getLocalizedString("global.main"), "index.jsp"));
Derek DeMoro's avatar
Derek DeMoro committed
29 30 31
    pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "audit-policy.jsp"));
    pageinfo.setPageID("server-audit-policy");
%>
Bill Lynch's avatar
Bill Lynch committed
32
<jsp:include page="top.jsp" flush="true" />
Derek DeMoro's avatar
Derek DeMoro committed
33 34
<jsp:include page="title.jsp" flush="true" />

Bill Lynch's avatar
Bill Lynch committed
35
<%   // Get parameters:
Matt Tucker's avatar
Matt Tucker committed
36 37 38 39 40 41 42 43 44 45
    boolean update = request.getParameter("update") != null;
    boolean auditEnabled = ParamUtils.getBooleanParameter(request,"auditEnabled");
    boolean auditMessages = ParamUtils.getBooleanParameter(request,"auditMessages");
    boolean auditPresence = ParamUtils.getBooleanParameter(request,"auditPresence");
    boolean auditIQ = ParamUtils.getBooleanParameter(request,"auditIQ");
    boolean auditXPath = ParamUtils.getBooleanParameter(request,"auditXPath");
    String newXpathQuery = ParamUtils.getParameter(request,"newXpathQuery");
    String[] xpathQuery = ParamUtils.getParameters(request,"xpathQuery");
    String maxCount = ParamUtils.getParameter(request,"maxCount");
    String maxSize = ParamUtils.getParameter(request,"maxSize");
46
    String logTimeout = ParamUtils.getParameter(request,"logTimeout");
Matt Tucker's avatar
Matt Tucker committed
47 48

    // Get an audit manager:
49
    AuditManager auditManager = admin.getXMPPServer().getAuditManager();
Matt Tucker's avatar
Matt Tucker committed
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75

    Map errors = new HashMap();
    if (update) {
        auditManager.setEnabled(auditEnabled);
        auditManager.setAuditMessage(auditMessages);
        auditManager.setAuditPresence(auditPresence);
        auditManager.setAuditIQ(auditIQ);
        /*
        auditManager.setAuditXPath(auditXPath);
        if (newXpathQuery != null) {
            auditManager.addXPath(newXpathQuery);
        }
        for (int i=0; i<xpathQuery.length; i++) {
            auditManager.removeXPath(xpathQuery[i]);
        }
        */
        try {
            auditManager.setMaxFileCount(Integer.parseInt(maxCount));
        } catch (Exception e){
            errors.put("maxCount","maxCount");
        }
        try {
            auditManager.setMaxFileSize(Integer.parseInt(maxSize));
        } catch (Exception e){
            errors.put("maxSize","maxSize");
        }
76 77 78 79 80
        try {
            auditManager.setLogTimeout(Integer.parseInt(logTimeout) * 1000);
        } catch (Exception e){
            errors.put("logTimeout","logTimeout");
        }
Matt Tucker's avatar
Matt Tucker committed
81 82 83
        // All done, redirect
        if (errors.size() == 0){
        %>
Bill Lynch's avatar
Bill Lynch committed
84 85 86 87 88 89

    <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">
90
        <fmt:message key="audit.policy.settings.saved_successfully" />
Bill Lynch's avatar
Bill Lynch committed
91 92 93 94 95
        </td></tr>
    </tbody>
    </table>
    </div><br>

Matt Tucker's avatar
Matt Tucker committed
96 97 98 99 100 101 102 103 104 105 106 107 108
        <%
        }
    }

    // Set page vars
    if (errors.size() == 0) {
        auditEnabled = auditManager.isEnabled();
        auditMessages = auditManager.isAuditMessage();
        auditPresence = auditManager.isAuditPresence();
        auditIQ = auditManager.isAuditIQ();
        auditXPath = auditManager.isAuditXPath();
        maxCount = Integer.toString(auditManager.getMaxFileCount());
        maxSize = Integer.toString(auditManager.getMaxFileSize());
109
        logTimeout = Integer.toString(auditManager.getLogTimeout() / 1000);
Matt Tucker's avatar
Matt Tucker committed
110 111 112
    }
%>

Bill Lynch's avatar
Bill Lynch committed
113
<p>
114
<fmt:message key="title" />
115
<fmt:message key="audit.policy.title_info" />
Bill Lynch's avatar
Bill Lynch committed
116
</p>
Matt Tucker's avatar
Matt Tucker committed
117

Bill Lynch's avatar
Bill Lynch committed
118
<form action="audit-policy.jsp">
Matt Tucker's avatar
Matt Tucker committed
119

Bill Lynch's avatar
Bill Lynch committed
120
<fieldset>
121
    <legend><fmt:message key="audit.policy.policytitle" /></legend>
Bill Lynch's avatar
Bill Lynch committed
122 123 124
    <div>
    <table cellpadding="3" cellspacing="0" border="0" width="100%">
    <tbody>
Matt Tucker's avatar
Matt Tucker committed
125
        <tr valign="middle">
Matt Tucker's avatar
Matt Tucker committed
126
            <td width="1%" nowrap>
Bill Lynch's avatar
Bill Lynch committed
127 128
                <input type="radio" name="auditEnabled" value="false" id="rb01"
                 <%= (!auditEnabled ? "checked" : "") %>>
Matt Tucker's avatar
Matt Tucker committed
129 130
            </td>
            <td width="99%">
Bill Lynch's avatar
Bill Lynch committed
131
                <label for="rb01">
132
                <b><fmt:message key="audit.policy.label_disable_auditing" /></b> <fmt:message key="audit.policy.label_disable_auditing_info" />
Matt Tucker's avatar
Matt Tucker committed
133 134 135
                </label>
            </td>
        </tr>
Matt Tucker's avatar
Matt Tucker committed
136
        <tr valign="middle">
Matt Tucker's avatar
Matt Tucker committed
137
            <td width="1%" nowrap>
Bill Lynch's avatar
Bill Lynch committed
138 139
                <input type="radio" name="auditEnabled" value="true" id="rb02"
                 <%= (auditEnabled ? "checked" : "") %>>
Matt Tucker's avatar
Matt Tucker committed
140 141
            </td>
            <td width="99%">
Bill Lynch's avatar
Bill Lynch committed
142
                <label for="rb02">
143
                <b><fmt:message key="audit.policy.label_enable_auditing" /></b> <fmt:message key="audit.policy.label_enable_auditing_info" />
Matt Tucker's avatar
Matt Tucker committed
144 145 146 147 148 149 150 151
                </label>
            </td>
        </tr>
        <tr valign="top">
            <td width="1%" nowrap>
                &nbsp;
            </td>
            <td width="99%">
Bill Lynch's avatar
Bill Lynch committed
152 153 154
                <table cellpadding="3" cellspacing="0" border="0" width="100%">
                <tr valign="top">
                    <td width="1%" nowrap class="c1">
155
                        <fmt:message key="audit.policy.maxfile_size" />
Matt Tucker's avatar
Matt Tucker committed
156
                    </td>
Bill Lynch's avatar
Bill Lynch committed
157 158 159
                    <td width="99%">
                        <input type="text" size="15" maxlength="50" name="maxSize"
                         value="<%= ((maxSize != null) ? maxSize : "") %>">
Matt Tucker's avatar
Matt Tucker committed
160

Bill Lynch's avatar
Bill Lynch committed
161
                    <%  if (errors.get("maxSize") != null) { %>
Matt Tucker's avatar
Matt Tucker committed
162

Bill Lynch's avatar
Bill Lynch committed
163
                        <span class="jive-error-text">
164
                        <fmt:message key="audit.policy.validnumber" />
Bill Lynch's avatar
Bill Lynch committed
165
                        </span>
Matt Tucker's avatar
Matt Tucker committed
166

Bill Lynch's avatar
Bill Lynch committed
167
                    <%  } %>
Matt Tucker's avatar
Matt Tucker committed
168

Bill Lynch's avatar
Bill Lynch committed
169 170 171 172
                    </td>
                </tr>
                <tr valign="top">
                    <td width="1%" nowrap class="c1">
173
                        <fmt:message key="audit.policy.maxfile_number" />
Bill Lynch's avatar
Bill Lynch committed
174 175 176 177
                    </td>
                    <td width="99%">
                        <input type="text" size="15" maxlength="50" name="maxCount"
                         value="<%= ((maxCount != null) ? maxCount : "") %>">
Matt Tucker's avatar
Matt Tucker committed
178

Bill Lynch's avatar
Bill Lynch committed
179
                        <%  if (errors.get("maxCount") != null) { %>
Matt Tucker's avatar
Matt Tucker committed
180

Bill Lynch's avatar
Bill Lynch committed
181
                            <span class="jive-error-text">
182
                            <fmt:message key="audit.policy.validnumber" />
Bill Lynch's avatar
Bill Lynch committed
183
                            </span>
Matt Tucker's avatar
Matt Tucker committed
184

Bill Lynch's avatar
Bill Lynch committed
185
                        <%  } %>
Matt Tucker's avatar
Matt Tucker committed
186

Bill Lynch's avatar
Bill Lynch committed
187 188
                    </td>
                </tr>
189 190
                <tr valign="top">
                    <td width="1%" nowrap class="c1">
191
                        <fmt:message key="audit.policy.flush_interval" />
192 193 194 195 196 197 198 199
                    </td>
                    <td width="99%">
                        <input type="text" size="15" maxlength="50" name="logTimeout"
                         value="<%= ((logTimeout != null) ? logTimeout : "") %>">

                    <%  if (errors.get("logTimeout") != null) { %>

                        <span class="jive-error-text">
200
                        <fmt:message key="audit.policy.validnumber" />
201 202 203 204 205 206
                        </span>

                    <%  } %>

                    </td>
                </tr>
Bill Lynch's avatar
Bill Lynch committed
207 208
                <tr valign="top">
                    <td width="1%" nowrap class="c1">
209
                        <fmt:message key="audit.policy.packet_audit" />
Bill Lynch's avatar
Bill Lynch committed
210 211 212 213 214 215 216 217 218 219 220 221
                    </td>
                    <td width="99%">

                        <table cellpadding="4" cellspacing="0" border="0" width="100%">
                        <tr valign="top">
                            <td width="1%" nowrap>
                                <input type="checkbox" name="auditMessages" id="cb01"
                                 onclick="this.form.auditEnabled[1].checked=true;"
                                 <%= (auditMessages ? "checked" : "") %>>
                            </td>
                            <td width="99%">
                                <label for="cb01">
222
                                <b><fmt:message key="audit.policy.label_audit_messenge_packets" /></b>
Bill Lynch's avatar
Bill Lynch committed
223 224 225 226 227 228 229 230 231 232 233
                                </label>
                            </td>
                        </tr>
                        <tr valign="top">
                            <td width="1%" nowrap>
                                <input type="checkbox" name="auditPresence" id="cb02"
                                 onclick="this.form.auditEnabled[1].checked=true;"
                                 <%= (auditPresence ? "checked" : "") %>>
                            </td>
                            <td width="99%">
                                <label for="cb02">
234
                                <b><fmt:message key="audit.policy.label_audit_presence_packets" /></b>
Bill Lynch's avatar
Bill Lynch committed
235 236 237 238 239 240 241 242 243 244 245
                                </label>
                            </td>
                        </tr>
                        <tr valign="top">
                            <td width="1%" nowrap>
                                <input type="checkbox" name="auditIQ" id="cb03"
                                 onclick="this.form.auditEnabled[1].checked=true;"
                                 <%= (auditIQ ? "checked" : "") %>>
                            </td>
                            <td width="99%">
                                <label for="cb03">
246
                                <b><fmt:message key="audit.policy.label_audit_iq_packets" /></b>
Bill Lynch's avatar
Bill Lynch committed
247 248 249 250 251 252
                                </label>
                            </td>
                        </tr>
                        </table>
                    </td>
                </tr>
Matt Tucker's avatar
Matt Tucker committed
253 254 255
                </table>
            </td>
        </tr>
Bill Lynch's avatar
Bill Lynch committed
256 257
    </tbody>
    </table>
Matt Tucker's avatar
Matt Tucker committed
258 259 260
    <table border="0">
        <tr valign="top">
            <td width="1%" nowrap class="c1">
261
                <fmt:message key="audit.policy.queued_packets" />
Matt Tucker's avatar
Matt Tucker committed
262 263 264 265 266 267
            </td>
            <td width="99%">
                 <%= auditManager.getAuditor().getQueuedPacketsNumber() %>
            </td>
        </tr>
    </table>
Bill Lynch's avatar
Bill Lynch committed
268 269
    </div>
</fieldset>
Matt Tucker's avatar
Matt Tucker committed
270

Bill Lynch's avatar
Bill Lynch committed
271
<br><br>
Matt Tucker's avatar
Matt Tucker committed
272

273
<input type="submit" name="update" value="<fmt:message key="global.save_settings" />">
Matt Tucker's avatar
Matt Tucker committed
274 275 276

</form>

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