Quota Editor control update to support min and max values.
Exchange controller updated to not accept recoverable item space of smaller than 6144MB
This commit is contained in:
parent
7de55cfd78
commit
03dd3cfad9
7 changed files with 112 additions and 43 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -3190,6 +3190,9 @@
|
|||
<data name="Warning.2612" xml:space="preserve">
|
||||
<value>Specified storage quotas exceed maximum values assigned at the host level</value>
|
||||
</data>
|
||||
<data name="Warning.2613" xml:space="preserve">
|
||||
<value>Invalid recoverable items quota specified, should be greater or equal to 6144MB</value>
|
||||
</data>
|
||||
<data name="AuditLogTask.EXCHANGE_CALCULATE_DISKSPACE" xml:space="preserve">
|
||||
<value>Calculate organization disk space</value>
|
||||
</data>
|
||||
|
|
|
@ -192,7 +192,9 @@
|
|||
<td>
|
||||
<uc1:QuotaEditor id="recoverableItemsSpace" runat="server"
|
||||
QuotaTypeID="2"
|
||||
QuotaValue="0"
|
||||
QuotaValue="6144"
|
||||
QuotaMinValue="6144"
|
||||
QuotaMaxValue="-1"
|
||||
ParentQuotaValue="-1">
|
||||
</uc1:QuotaEditor>
|
||||
</td>
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="QuotaEditor.ascx.cs" Inherits="WebsitePanel.Portal.QuotaEditor" %>
|
||||
<asp:TextBox ID="txtQuotaValue" runat="server" CssClass="NormalTextBox" Width="80px"></asp:TextBox><asp:CheckBox ID="chkQuotaEnabled" runat="server" Text="Enabled" meta:resourcekey="chkQuotaEnabled" /><asp:CheckBox ID="chkQuotaUnlimited" runat="server" Text="Unlimited" meta:resourcekey="chkQuotaUnlimited" />
|
||||
<asp:TextBox ID="txtQuotaValue" runat="server" CssClass="NormalTextBox" Width="80px" ></asp:TextBox>
|
||||
<asp:CheckBox ID="chkQuotaEnabled" runat="server" Text="Enabled" meta:resourcekey="chkQuotaEnabled" />
|
||||
<asp:CheckBox ID="chkQuotaUnlimited" runat="server" Text="Unlimited" meta:resourcekey="chkQuotaUnlimited" />
|
||||
|
|
|
@ -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, @"<script language='javascript' type='text/javascript'>
|
||||
function ToggleQuota(txtId, chkId)
|
||||
function ToggleQuota(txtId, chkId, minValue)
|
||||
{
|
||||
var unlimited = document.getElementById(chkId).checked;
|
||||
document.getElementById(txtId).style.display = unlimited ? 'none' : 'inline';
|
||||
document.getElementById(txtId).value = unlimited ? '-1' : '0';
|
||||
if (minValue > 0)
|
||||
{
|
||||
if (document.getElementById(txtId).value < minValue) document.getElementById(txtId).value = minValue;
|
||||
}
|
||||
}
|
||||
</script>");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -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.
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue