diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Common/BusinessErrorCodes.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Common/BusinessErrorCodes.cs index 4a50b093..41737a73 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Common/BusinessErrorCodes.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Common/BusinessErrorCodes.cs @@ -311,6 +311,7 @@ namespace WebsitePanel.EnterpriseServer public const int ERROR_EXCHANGE_PFOLDERS_QUOTA_LIMIT = -2610; public const int ERROR_EXCHANGE_DOMAINS_QUOTA_LIMIT = -2611; public const int ERROR_EXCHANGE_STORAGE_QUOTAS_EXCEED_HOST_VALUES = -2612; + public const int ERROR_EXCHANGE_INVALID_RECOVERABLEITEMS_QUOTA = -2613; #endregion #region Organizations diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs index a8d42a50..0b3f3cdf 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs @@ -1728,6 +1728,9 @@ namespace WebsitePanel.EnterpriseServer if (plan.RecoverableItemsSpace == -1) return BusinessErrorCodes.ERROR_EXCHANGE_STORAGE_QUOTAS_EXCEED_HOST_VALUES; + if (plan.RecoverableItemsSpace < 6144) + return BusinessErrorCodes.ERROR_EXCHANGE_INVALID_RECOVERABLEITEMS_QUOTA; + if ((quotaRecoverableItemsUsed + plan.RecoverableItemsSpace) > (maxRecoverableItemsSpace)) return BusinessErrorCodes.ERROR_EXCHANGE_STORAGE_QUOTAS_EXCEED_HOST_VALUES; } @@ -2702,6 +2705,9 @@ namespace WebsitePanel.EnterpriseServer if (plan.RecoverableItemsSpace == -1) return BusinessErrorCodes.ERROR_EXCHANGE_STORAGE_QUOTAS_EXCEED_HOST_VALUES; + if (plan.RecoverableItemsSpace < 6144) + return BusinessErrorCodes.ERROR_EXCHANGE_INVALID_RECOVERABLEITEMS_QUOTA; + if ((quotaRecoverableItemsUsed + plan.RecoverableItemsSpace) > (maxRecoverableItemsSpace)) return BusinessErrorCodes.ERROR_EXCHANGE_STORAGE_QUOTAS_EXCEED_HOST_VALUES; } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx index a50c8848..985172f2 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx @@ -3190,6 +3190,9 @@ Specified storage quotas exceed maximum values assigned at the host level + + Invalid recoverable items quota specified, should be greater or equal to 6144MB + Calculate organization disk space diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeAddMailboxPlan.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeAddMailboxPlan.ascx index 4a62b784..2a8a8523 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeAddMailboxPlan.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeAddMailboxPlan.ascx @@ -192,7 +192,9 @@ diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/QuotaEditor.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/QuotaEditor.ascx index 303f1421..199c9cae 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/QuotaEditor.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/QuotaEditor.ascx @@ -1,2 +1,4 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="QuotaEditor.ascx.cs" Inherits="WebsitePanel.Portal.QuotaEditor" %> - + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/QuotaEditor.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/QuotaEditor.ascx.cs index d063d442..febe3e4b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/QuotaEditor.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/QuotaEditor.ascx.cs @@ -70,26 +70,106 @@ namespace WebsitePanel.Portal { if (ParentQuotaValue == -1) { - // numeric quota - return chkQuotaUnlimited.Checked ? -1 : Utils.ParseInt(txtQuotaValue.Text, 0); + if ((QuotaMinValue > 0) | (QuotaMaxValue > 0)) + { + int quotaValue = 0; + // numeric quota + if (chkQuotaUnlimited.Checked) + quotaValue = -1; + else + { + + if (QuotaMinValue > 0) + quotaValue = Math.Max(Utils.ParseInt(txtQuotaValue.Text, 0), QuotaMinValue); + else + quotaValue = Utils.ParseInt(txtQuotaValue.Text, 0); + + if (QuotaMaxValue > 0) + { + if (Utils.ParseInt(txtQuotaValue.Text, 0) > QuotaMaxValue) + quotaValue = QuotaMaxValue; + } + } + return quotaValue; + } + else + return chkQuotaUnlimited.Checked ? -1 : Utils.ParseInt(txtQuotaValue.Text, 0); + } else { - return - chkQuotaUnlimited.Checked - ? ParentQuotaValue - : Math.Min(Utils.ParseInt(txtQuotaValue.Text, 0), ParentQuotaValue); + + if ((QuotaMinValue > 0) | (QuotaMaxValue > 0)) + { + + int quotaValue = 0; + // numeric quota + if (chkQuotaUnlimited.Checked) + quotaValue = ParentQuotaValue; + else + { + quotaValue = Utils.ParseInt(txtQuotaValue.Text, 0); + + + if (QuotaMinValue > 0) + quotaValue = Math.Max(quotaValue, QuotaMinValue); + + if (QuotaMaxValue > 0) + { + if (quotaValue > QuotaMaxValue) + quotaValue = QuotaMaxValue; + } + + quotaValue = Math.Min(quotaValue, ParentQuotaValue); + } + return quotaValue; + } + else + { + return + chkQuotaUnlimited.Checked + ? ParentQuotaValue + : Math.Min(Utils.ParseInt(txtQuotaValue.Text, 0), ParentQuotaValue); + } + + + } } } set { - txtQuotaValue.Text = value.ToString(); + if (QuotaMinValue > 0) + txtQuotaValue.Text = Math.Max(value, QuotaMinValue).ToString(); + else + txtQuotaValue.Text = value.ToString(); + chkQuotaEnabled.Checked = (value > 0); chkQuotaUnlimited.Checked = (value == -1); } } + public int QuotaMinValue + { + get { return ViewState["QuotaMinValue"] != null ? (int)ViewState["QuotaMinValue"] : 0; } + set + { + ViewState["QuotaMinValue"] = value; + + if (QuotaMinValue > 0) + { + if (QuotaValue < QuotaMinValue) QuotaValue = QuotaMinValue; + } + } + + } + + public int QuotaMaxValue + { + get { return ViewState["QuotaMaxValue"] != null ? (int)ViewState["QuotaMaxValue"] : 0; } + set { ViewState["QuotaMaxValue"] = value; } + } + public int ParentQuotaValue { set @@ -122,11 +202,8 @@ namespace WebsitePanel.Portal // set textbox attributes txtQuotaValue.Style["display"] = (txtQuotaValue.Text == "-1") ? "none" : "inline"; - - - chkQuotaUnlimited.Attributes["onclick"] = String.Format("ToggleQuota('{0}', '{1}');", - txtQuotaValue.ClientID, chkQuotaUnlimited.ClientID); - + chkQuotaUnlimited.Attributes["onclick"] = String.Format("ToggleQuota('{0}', '{1}', {2});", + txtQuotaValue.ClientID, chkQuotaUnlimited.ClientID, QuotaMinValue); // call base handler base.OnPreRender(e); @@ -138,15 +215,21 @@ namespace WebsitePanel.Portal if (!Page.ClientScript.IsClientScriptBlockRegistered(scriptKey)) { Page.ClientScript.RegisterClientScriptBlock(GetType(), scriptKey, @""); } } + + } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/QuotaEditor.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/QuotaEditor.ascx.designer.cs index cd40188b..c535ae48 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/QuotaEditor.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/QuotaEditor.ascx.designer.cs @@ -1,31 +1,3 @@ -// Copyright (c) 2014, Outercurve Foundation. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// - Neither the name of the Outercurve Foundation nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - //------------------------------------------------------------------------------ // // This code was generated by a tool.