<%-- - $Revision$ - $Date$ - - Copyright (C) 2004-2005 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="org.jivesoftware.util.*, org.jivesoftware.openfire.*, java.util.HashMap, java.util.Map, java.text.DecimalFormat" errorPage="error.jsp" %> <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %> <%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %> <% webManager.init(request, response, session, application, out ); %> <fmt:message key="offline.messages.title"/> <%! // Global vars and methods: // Strategy definitions: static final int BOUNCE = 1; static final int DROP = 2; static final int STORE = 3; static final int ALWAYS_STORE = 4; static final int STORE_AND_BOUNCE = 5; static final int STORE_AND_DROP = 6; %> <% // Get parameters OfflineMessageStrategy manager = webManager.getXMPPServer().getOfflineMessageStrategy(); boolean update = request.getParameter("update") != null; int strategy = ParamUtils.getIntParameter(request,"strategy",-1); int storeStrategy = ParamUtils.getIntParameter(request,"storeStrategy",-1); double quota = ParamUtils.getDoubleParameter(request,"quota", manager.getQuota()/1024); DecimalFormat format = new DecimalFormat("#0.00"); // Update the session kick policy if requested Map errors = new HashMap(); if (update) { // Validate params if (strategy != BOUNCE && strategy != DROP && strategy != STORE) { errors.put("general","Please choose one of the 3 strategies below."); } else { // Validate the storage policy of store strat is chosen: if (strategy == STORE) { if (storeStrategy != ALWAYS_STORE && storeStrategy != STORE_AND_BOUNCE && storeStrategy != STORE_AND_DROP) { errors.put("general", LocaleUtils.getLocalizedString("offline.messages.choose_policy")); } else { // Validate the store size limit: if (quota <= 0) { errors.put("quota", LocaleUtils.getLocalizedString("offline.messages.enter_store_size")); } } } } // If no errors, continue: if (errors.size() == 0) { if (strategy == STORE) { manager.setType(OfflineMessageStrategy.Type.store); if (storeStrategy == STORE_AND_BOUNCE) { manager.setType(OfflineMessageStrategy.Type.store_and_bounce); } else if (storeStrategy == STORE_AND_DROP) { manager.setType(OfflineMessageStrategy.Type.store_and_drop); } else /* (storeStrategy == ALWAYS_STORE) */ { manager.setType(OfflineMessageStrategy.Type.store); } } else { if (strategy == BOUNCE) { manager.setType(OfflineMessageStrategy.Type.bounce); } else if (strategy == DROP) { manager.setType(OfflineMessageStrategy.Type.drop); } } manager.setQuota((int)(quota*1024)); %> <% } } // Update variable values if (errors.size() == 0) { if (manager.getType() == OfflineMessageStrategy.Type.store || manager.getType() == OfflineMessageStrategy.Type.store_and_bounce || manager.getType() == OfflineMessageStrategy.Type.store_and_drop) { strategy = STORE; if (manager.getType() == OfflineMessageStrategy.Type.store_and_bounce) { storeStrategy = STORE_AND_BOUNCE; } else if (manager.getType() == OfflineMessageStrategy.Type.store_and_drop) { storeStrategy = STORE_AND_DROP; } else /*(manager.getType() == OfflineMessageStrategy.STORE)*/ { storeStrategy = ALWAYS_STORE; } } else { if (manager.getType() == OfflineMessageStrategy.Type.bounce) { strategy = BOUNCE; } else if (manager.getType() == OfflineMessageStrategy.Type.drop) { strategy = DROP; } } quota = ((double)manager.getQuota()) / (1024); if (quota < 0) { quota = 0; } } %>

<% if (errors.containsKey("general") || errors.containsKey("quota")) { %>
<% if (errors.containsKey("general")) { %> <%= errors.get("general") %> <% } else if (errors.containsKey("quota")) { %> <%= errors.get("quota") %> <% } %>

<% } %>

<%= format.format(OfflineMessageStore.getInstance().getSize()/1024.0/1024.0) %> MB

> -
 
> -
> -
> -
" onclick="this.form.strategy[2].checked=true;"> KB
> -
> -
">