1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
<%--
- $RCSfile$
- $Revision$
- $Date$
-
- 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.
--%>
<%@ page import="java.io.File,
java.util.*,
org.jivesoftware.util.*,
org.jivesoftware.util.ParamUtils,
org.jivesoftware.util.JiveGlobals,
org.jivesoftware.admin.AdminPageBean"
errorPage="error.jsp"
%>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" />
<%!
/**
* Make sure the String can wrap at 80 chars.
*
* @param str the string.
* @return a wrappable string.
*/
String wrappableString(String str) {
if (str.length() <= 60) {
return str;
}
int count = 0;
StringBuffer buf = new StringBuffer();
char [] strChars = str.toCharArray();
for (int i=0; i<strChars.length; i++) {
if (Character.isWhitespace(strChars[i])) {
count = 0;
}
count++;
buf.append(strChars[i]);
if (count >= 60) {
buf.append(" ");
count = 0;
}
}
return buf.toString();
}
%>
<%
String propName = ParamUtils.getParameter(request,"propName");
String propValue = ParamUtils.getParameter(request,"propValue",true);
boolean edit = ParamUtils.getBooleanParameter(request,"edit");
boolean save = request.getParameter("save") != null;
boolean delete = ParamUtils.getBooleanParameter(request,"del");
if (request.getParameter("cancel") != null) {
response.sendRedirect("server-properties.jsp");
return;
}
if (delete) {
if (propName != null) {
JiveGlobals.deleteProperty(propName);
response.sendRedirect("server-properties.jsp?deletesuccess=true");
return;
}
}
Map errors = new HashMap();
if (save) {
if (propName == null || "".equals(propName.trim())) {
errors.put("propName","");
}
if (propValue == null) {
errors.put("propValue","");
}
else if (propValue.length() > 4000) {
errors.put("propValueLength","");
}
if (errors.size() == 0) {
JiveGlobals.setProperty(propName, propValue);
response.sendRedirect("server-properties.jsp?success=true");
return;
}
}
List properties = JiveGlobals.getPropertyNames();
Collections.sort(properties, new Comparator() {
public int compare(Object o1, Object o2) {
String s1 = (String)o1;
String s2 = (String)o2;
return s1.toLowerCase().compareTo(s2.toLowerCase());
}
});
if (edit) {
propValue = JiveGlobals.getProperty(propName);
}
%>
<% // Title of this page and breadcrumbs
String title = LocaleUtils.getLocalizedString("server.properties.title");
pageinfo.setTitle(title);
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(LocaleUtils.getLocalizedString("global.main"), "index.jsp"));
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "server-properties.jsp"));
pageinfo.setPageID("server-props");
%>
<jsp:include page="top.jsp" flush="true">
<jsp:param name="helpPage" value="manage_system_properties.html" />
</jsp:include>
<jsp:include page="title.jsp" flush="true" />
<p>
<fmt:message key="server.properties.info" />
</p>
<p><b><fmt:message key="server.properties.system" /></b></p>
<% 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">
<fmt:message key="server.properties.error" />
</td></tr>
</tbody>
</table>
</div><br>
<% } else if ("true".equals(request.getParameter("success"))) { %>
<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="server.properties.saved" />
</td></tr>
</tbody>
</table>
</div><br>
<% } else if ("true".equals(request.getParameter("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">
<fmt:message key="server.properties.deleted" />
</td></tr>
</tbody>
</table>
</div><br>
<% } %>
<% if (edit) { %>
<div class="jive-info">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr><td class="jive-icon"><img src="images/info-16x16.gif" width="16" height="16" border="0"></td>
<td class="jive-icon-label">
<fmt:message key="server.properties.edit_property" />
</td></tr>
</tbody>
</table>
</div><br>
<% } %>
<% if (request.getParameter("delerror") != null) { %>
<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="server.properties.error_deleting" />
</td></tr>
</tbody>
</table>
</div><br>
<% } %>
<script language="JavaScript" type="text/javascript">
function doedit(propName) {
document.propform.propName.value = propName;
document.propform.edit.value = 'true';
document.propform.action = document.propform.action + '#edit';
document.propform.submit();
}
function dodelete(propName) {
var dodelete = confirm('Are you sure you want to delete this property?');
if (dodelete) {
document.propform.propName.value = propName;
document.propform.del.value = 'true';
document.propform.submit();
return true;
}
else {
return false;
}
}
</script>
<form action="server-properties.jsp" method="post" name="propform">
<input type="hidden" name="edit" value="">
<input type="hidden" name="del" value="">
<input type="hidden" name="propName" value="">
<style type="text/css">
.hidebox {
text-overflow : ellipsis;
overflow : hidden;
white-space : nowrap;
}
</style>
<div class="jive-table">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<thead>
<tr>
<th nowrap><fmt:message key="server.properties.name" /></th>
<th nowrap><fmt:message key="server.properties.value" /></th>
<th style="text-align:center;"><fmt:message key="server.properties.edit" /></th>
<th style="text-align:center;"><fmt:message key="global.delete" /></th>
</tr>
</thead>
<tbody>
<% if (properties.size() == 0) { %>
<tr>
<td colspan="4">
<fmt:message key="server.properties.no_property" />
</td>
</tr>
<% } %>
<% for (int i=0; i<properties.size(); i++) {
String n = (String)properties.get(i);
String v = JiveGlobals.getProperty(n);
v = StringUtils.replace(StringUtils.escapeHTMLTags(v), "\n", "<br>");
%>
<tr class="<%= (n.equals(propName) ? "hilite" : "") %>">
<td>
<div class="hidebox" style="width:150px;">
<span title="<%= StringUtils.escapeHTMLTags(n) %>">
<%= StringUtils.escapeHTMLTags(n) %>
</span>
</div>
</td>
<td>
<div class="hidebox" style="width:350px;">
<% if (n.indexOf("passwd") > -1 || n.indexOf("password") > -1 || n.indexOf("cookieKey") > -1) { %>
<span style="color:#999;"><i>hidden</i></span>
<% } else { %>
<span title="<%= ("".equals(v) ? " " : v) %>"><%= ("".equals(v) ? " " : v) %></span>
<% } %>
</div>
</td>
<td align="center"><a href="#" onclick="doedit('<%= StringUtils.replace(n,"'","''") %>');"
><img src="images/edit-16x16.gif" width="16" height="16" alt="<fmt:message key="server.properties.alt_edit" />" border="0"></a
>
</td>
<td align="center"><a href="#" onclick="return dodelete('<%= StringUtils.replace(n,"'","''") %>');"
><img src="images/delete-16x16.gif" width="16" height="16" alt="<fmt:message key="server.properties.alt_delete" />" border="0"></a
>
</td>
</tr>
<% } %>
</tbody>
</table>
</div>
</form>
<br><br>
<a name="edit"></a>
<form action="server-properties.jsp" method="post" name="editform">
<div class="jive-table">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<thead>
<tr>
<th colspan="2">
<% if (edit) { %>
<fmt:message key="server.properties.edit_property_title" />
<% } else { %>
<fmt:message key="server.properties.new_property" />
<% } %>
</th>
</tr>
</thead>
<tbody>
<tr valign="top">
<td>
<fmt:message key="server.properties.name" />:
</td>
<td>
<% if (edit) { %>
<input type="hidden" name="propName" value="<%= StringUtils.escapeHTMLTags(propName) %>">
<%= StringUtils.escapeHTMLTags(propName) %>
<% } else { %>
<input type="text" name="propName" size="40" maxlength="100" value="<%= (propName != null ? StringUtils.escapeHTMLTags(propName) : "") %>">
<% if (errors.containsKey("propName")) { %>
<br><span class="jive-error-text"><fmt:message key="server.properties.enter_property_name" /></span>
<% } %>
<% } %>
</td>
</tr>
<tr valign="top">
<td>
<fmt:message key="server.properties.value" />:
</td>
<td>
<textarea cols="45" rows="5" name="propValue" wrap="virtual"><%= (propValue != null ? StringUtils.escapeHTMLTags(propValue) : "") %></textarea>
<% if (errors.containsKey("propValue")) { %>
<br><span class="jive-error-text"><fmt:message key="server.properties.enter_property_value" /></span>
<% } else if (errors.containsKey("propValueLength")) { %>
<br><span class="jive-error-text"><fmt:message key="server.properties.max_character" /></span>
<% } %>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2">
<input type="submit" name="save" value="<fmt:message key="global.save_property" />">
<input type="submit" name="cancel" value="<fmt:message key="global.cancel" />">
</td>
</tr>
</tfoot>
</table>
</div>
</form>
<br><br><br><br><br><br>
<br><br><br><br><br><br>
<br><br><br><br><br><br>
<br><br><br><br><br><br>
<jsp:include page="bottom.jsp" flush="true" />