<%-- - $Revision$ - $Date$ - - Copyright (C) 2004-2008 Jive Software. All rights reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. --%> <%@ page import="java.util.*, org.jivesoftware.util.*, org.jivesoftware.util.ParamUtils, org.jivesoftware.util.JiveGlobals" errorPage="error.jsp" %> <%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %> <% webManager.init(request, response, session, application, out ); %> <%! /** * 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 (char strChar : strChars) { if (Character.isWhitespace(strChar)) { count = 0; } count++; buf.append(strChar); 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); // Log the event webManager.logEvent("deleted server property "+propName, null); response.sendRedirect("server-properties.jsp?deletesuccess=true"); return; } } Map errors = new HashMap(); if (save) { if (propName == null || "".equals(propName.trim()) || propName.startsWith("\"")) { 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); // Log the event webManager.logEvent("set server property "+propName, propName+" = "+propValue); response.sendRedirect("server-properties.jsp?success=true"); return; } } List properties = JiveGlobals.getPropertyNames(); Collections.sort(properties, new Comparator() { public int compare(String s1, String s2) { return s1.toLowerCase().compareTo(s2.toLowerCase()); } }); if (edit) { propValue = JiveGlobals.getProperty(propName); } %> <fmt:message key="server.properties.title"/>

<% if (errors.size() > 0) { %>

<% } else if ("true".equals(request.getParameter("success"))) { %>

<% } else if ("true".equals(request.getParameter("deletesuccess"))) { %>

<% } %> <% if (edit) { %>

<% } %> <% if (request.getParameter("delerror") != null) { %>

<% } %>
<% if (properties.size() == 0) { %> <% } %> <% for (String n : properties) { String v = JiveGlobals.getProperty(n); v = StringUtils.replace(StringUtils.escapeHTMLTags(v), "\n", "
"); %> "> <% } %>
<%= StringUtils.escapeHTMLTags(n) %>
<% if (n.toLowerCase().indexOf("passwd") > -1 || n.toLowerCase().indexOf("password") > -1 || n.toLowerCase().indexOf("cookiekey") > -1) { %> hidden <% } else { %> "><%= ("".equals(v) ? " " : v) %> <% } %>
');" ><fmt:message key=" border="0"> ');" ><fmt:message key=" border="0">


<% if (edit) { %> <% } else { %> <% } %>
: <% if (edit) { %> <%= StringUtils.escapeHTMLTags(propName) %> <% } else { %> "> <% if (errors.containsKey("propName")) { %>
<% } %> <% } %>
: <% if (errors.containsKey("propValue")) { %>
<% } else if (errors.containsKey("propValueLength")) { %>
<% } %>
"> ">