Fix archiving

This commit is contained in:
dev_amdtel 2014-05-15 20:52:56 +04:00
parent 2170367f8f
commit 56cf823559
19 changed files with 371 additions and 179 deletions

View file

@ -91,11 +91,6 @@ namespace WebsitePanel.Portal.ExchangeServer
if (RetentionPolicy)
{
chkEnableArchiving.Checked = plan.EnableArchiving;
archiveQuota.QuotaValue = plan.MailboxSizeMB;
archiveWarningQuota.ValueKB = plan.IssueWarningPct;
List<ExchangeMailboxPlanRetentionPolicyTag> tags = new List<ExchangeMailboxPlanRetentionPolicyTag>();
tags.AddRange(ES.Services.ExchangeServer.GetExchangeMailboxPlanRetentionPolicyTags(plan.MailboxPlanId));
@ -124,6 +119,11 @@ namespace WebsitePanel.Portal.ExchangeServer
recoverableItemsWarning.ValueKB = plan.RecoverableItemsWarningPct;
txtLitigationHoldMsg.Text = plan.LitigationHoldMsg;
txtLitigationHoldUrl.Text = plan.LitigationHoldUrl;
chkEnableArchiving.Checked = plan.EnableArchiving;
archiveQuota.QuotaValue = plan.ArchiveSizeMB;
archiveWarningQuota.ValueKB = plan.ArchiveWarningPct;
}
locTitle.Text = plan.MailboxPlan;
@ -198,7 +198,7 @@ namespace WebsitePanel.Portal.ExchangeServer
RetentionPolicy = PanelRequest.GetBool("archiving", false);
if (RetentionPolicy)
if (!RetentionPolicy)
{
chkEnableArchiving.Checked = true;
archiveQuota.QuotaValue = cntx.Quotas[Quotas.EXCHANGE2013_ARCHIVINGSTORAGE].QuotaAllocatedValue;
@ -230,7 +230,8 @@ namespace WebsitePanel.Portal.ExchangeServer
secDeleteRetention.Visible = !RetentionPolicy;
secLitigationHold.Visible = !RetentionPolicy;
secArchiving.Visible = RetentionPolicy;
secArchiving.Visible = !RetentionPolicy;
secRetentionPolicyTags.Visible = RetentionPolicy;
valRequireMailboxPlan.ValidationGroup = MainValidationGroup;
@ -283,11 +284,6 @@ namespace WebsitePanel.Portal.ExchangeServer
if (RetentionPolicy)
{
plan.EnableArchiving = chkEnableArchiving.Checked;
plan.MailboxSizeMB = archiveQuota.QuotaValue;
plan.IssueWarningPct = archiveWarningQuota.ValueKB;
if ((plan.IssueWarningPct == 0)) plan.IssueWarningPct = 100;
}
else
@ -317,6 +313,13 @@ namespace WebsitePanel.Portal.ExchangeServer
if ((plan.RecoverableItemsWarningPct == 0)) plan.RecoverableItemsWarningPct = 100;
plan.LitigationHoldMsg = txtLitigationHoldMsg.Text.Trim();
plan.LitigationHoldUrl = txtLitigationHoldUrl.Text.Trim();
plan.EnableArchiving = chkEnableArchiving.Checked;
plan.ArchiveSizeMB = archiveQuota.QuotaValue;
plan.ArchiveWarningPct = archiveWarningQuota.ValueKB;
if ((plan.ArchiveWarningPct == 0)) plan.ArchiveWarningPct = 100;
}
int planId = ES.Services.ExchangeServer.AddExchangeMailboxPlan(PanelRequest.ItemID,

View file

@ -147,6 +147,13 @@
</td>
<td>
<wsp:MailboxPlanSelector ID="archivingMailboxPlanSelector" runat="server" Archiving="true" AddNone="true" />
</td>
</tr>
<tr id="rowArchiving" runat="server">
<td class="FormLabel150">
</td>
<td>
<asp:CheckBox ID="chkEnableArchiving" runat="server" meta:resourcekey="chkEnableArchiving" Text="Enable archiving" />
</td>
</tr>
</table>

View file

@ -101,6 +101,7 @@ namespace WebsitePanel.Portal.ExchangeServer
}
rowRetentionPolicy.Visible = Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWRETENTIONPOLICY, cntx);
rowArchiving.Visible = Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWARCHIVING, cntx);
}
}
@ -121,6 +122,8 @@ namespace WebsitePanel.Portal.ExchangeServer
string displayName = IsNewUser ? txtDisplayName.Text.Trim() : userSelector.GetDisplayName();
string accountName = IsNewUser ? string.Empty : userSelector.GetAccount();
bool enableArchive = chkEnableArchiving.Checked;
ExchangeAccountType type = IsNewUser
? (ExchangeAccountType)Utils.ParseInt(rbMailboxType.SelectedValue, 1)
: ExchangeAccountType.Mailbox;
@ -141,7 +144,7 @@ namespace WebsitePanel.Portal.ExchangeServer
sendInstructionEmail.Text,
Convert.ToInt32(mailboxPlanSelector.MailboxPlanId),
Convert.ToInt32(archivingMailboxPlanSelector.MailboxPlanId),
subscriberNumber);
subscriberNumber, enableArchive);
if (accountId < 0)

View file

@ -336,6 +336,24 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.MailboxPlanSelector archivingMailboxPlanSelector;
/// <summary>
/// rowArchiving control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow rowArchiving;
/// <summary>
/// chkEnableArchiving control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkEnableArchiving;
/// <summary>
/// chkSendInstructions control.
/// </summary>

View file

@ -49,7 +49,7 @@
<tr>
<td class="FormLabel150"><asp:Localize ID="Localize2" runat="server" meta:resourcekey="locMailboxplanName" Text="Mailbox plan: *"></asp:Localize></td>
<td>
<wsp:MailboxPlanSelector ID="mailboxPlanSelector" runat="server" />
<wsp:MailboxPlanSelector ID="mailboxPlanSelector" runat="server" Changed="mailboxPlanSelector_Changed" />
</td>
</tr>
<tr>
@ -80,13 +80,8 @@
</table>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
<wsp:CollapsiblePanel id="secLitigationHoldSettings" runat="server" TargetControlID="LitigationHoldSettings" meta:resourcekey="secLitigationHoldSettings" Text="Litigation Hold"></wsp:CollapsiblePanel>
<asp:Panel ID="LitigationHoldSettings" runat="server" Height="0" style="overflow:hidden;">
<asp:UpdatePanel ID="LitigationHoldUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<wsp:CollapsiblePanel id="secLitigationHoldSettings" runat="server" TargetControlID="LitigationHoldSettings" meta:resourcekey="secLitigationHoldSettings" Text="Litigation Hold"></wsp:CollapsiblePanel>
<asp:Panel ID="LitigationHoldSettings" runat="server" Height="0" style="overflow:hidden;">
<table>
<!--
<tr>
@ -105,9 +100,30 @@
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
</asp:Panel>
<wsp:CollapsiblePanel id="secArchiving" runat="server" TargetControlID="Archiving" meta:resourcekey="secArchiving" Text="Archiving"></wsp:CollapsiblePanel>
<asp:Panel ID="Archiving" runat="server" Height="0" style="overflow:hidden;">
<table>
<tr>
<td class="FormLabel150"></td>
<td>
<asp:CheckBox ID="chkEnableArchiving" runat="server" meta:resourcekey="chkEnableArchiving" Text="Enable archiving" AutoPostBack="true" />
<br />
</td>
</tr>
<tr id="rowArchiving" runat="server">
<td class="FormLabel150"><asp:Localize ID="locArchivingQuotaViewer" runat="server" meta:resourcekey="locArchivingQuotaViewer" Text="Archive Size:"></asp:Localize></td>
<td>
<wsp:QuotaViewer ID="archivingQuotaViewer" runat="server" QuotaTypeId="2" DisplayGauge="true" /> MB
</td>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
<wsp:CollapsiblePanel id="secCalendarSettings" runat="server" TargetControlID="CalendarSettings" meta:resourcekey="secCalendarSettings" Text="General"></wsp:CollapsiblePanel>
<asp:Panel ID="CalendarSettings" runat="server" Height="0" style="overflow:hidden;">

View file

@ -85,6 +85,13 @@ namespace WebsitePanel.Portal.ExchangeServer
}
int planId = -1;
int.TryParse(mailboxPlanSelector.MailboxPlanId, out planId);
ExchangeMailboxPlan plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(PanelRequest.ItemID, planId);
secArchiving.Visible = Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWARCHIVING, cntx) && plan.EnableArchiving;
rowArchiving.Visible = chkEnableArchiving.Checked;
}
private void BindSettings()
@ -99,6 +106,8 @@ namespace WebsitePanel.Portal.ExchangeServer
ExchangeMailboxStatistics stats = ES.Services.ExchangeServer.GetMailboxStatistics(PanelRequest.ItemID,
PanelRequest.AccountID);
// mailbox plan
// title
litDisplayName.Text = mailbox.DisplayName;
@ -147,6 +156,13 @@ namespace WebsitePanel.Portal.ExchangeServer
ddDisclaimer.SelectedValue = disclaimerId.ToString();
}
if (Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWARCHIVING, Cntx))
{
chkEnableArchiving.Checked = account.EnableArchiving;
archivingQuotaViewer.QuotaUsedValue = Convert.ToInt32(stats.ArchivingTotalSize / 1024 / 1024);
archivingQuotaViewer.QuotaValue = (stats.ArchivingMaxSize == -1) ? -1 : (int)Math.Round((double)(stats.ArchivingMaxSize / 1024 / 1024));
}
}
catch (Exception ex)
{
@ -183,8 +199,10 @@ namespace WebsitePanel.Portal.ExchangeServer
int policyId = -1;
int.TryParse(mailboxRetentionPolicySelector.MailboxPlanId, out policyId);
bool EnableArchiving = chkEnableArchiving.Checked;
result = ES.Services.ExchangeServer.SetExchangeMailboxPlan(PanelRequest.ItemID, PanelRequest.AccountID, planId,
policyId);
policyId, EnableArchiving);
if (result < 0)
{
@ -262,5 +280,9 @@ namespace WebsitePanel.Portal.ExchangeServer
return result;
}
public void mailboxPlanSelector_Changed(object sender, EventArgs e)
{
}
}
}

View file

@ -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.
@ -40,31 +12,6 @@ namespace WebsitePanel.Portal.ExchangeServer {
public partial class ExchangeMailboxGeneralSettings {
/// <summary>
/// asyncTasks control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks;
/// breadcrumb control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Breadcrumb breadcrumb;
/// <summary>
/// menu control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Menu menu;
/// <summary>
/// Image1 control.
/// </summary>
@ -263,15 +210,6 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// </remarks>
protected global::System.Web.UI.WebControls.Panel LitigationHoldSettings;
/// <summary>
/// LitigationHoldUpdatePanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel LitigationHoldUpdatePanel;
/// <summary>
/// chkEnableLitigationHold control.
/// </summary>
@ -299,6 +237,60 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// </remarks>
protected global::WebsitePanel.Portal.QuotaViewer litigationHoldSpace;
/// <summary>
/// secArchiving control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secArchiving;
/// <summary>
/// Archiving control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel Archiving;
/// <summary>
/// chkEnableArchiving control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkEnableArchiving;
/// <summary>
/// rowArchiving control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow rowArchiving;
/// <summary>
/// locArchivingQuotaViewer control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locArchivingQuotaViewer;
/// <summary>
/// archivingQuotaViewer control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.QuotaViewer archivingQuotaViewer;
/// <summary>
/// secCalendarSettings control.
/// </summary>

View file

@ -213,7 +213,7 @@ namespace WebsitePanel.Portal.ExchangeServer
foreach (ExchangeAccount a in Accounts)
{
txtStatus.Text = "Completed";
int result = ES.Services.ExchangeServer.SetExchangeMailboxPlan(PanelRequest.ItemID, a.AccountId, Convert.ToInt32(mailboxPlanSelectorTarget.MailboxPlanId), a.ArchivingMailboxPlanId);
int result = ES.Services.ExchangeServer.SetExchangeMailboxPlan(PanelRequest.ItemID, a.AccountId, Convert.ToInt32(mailboxPlanSelectorTarget.MailboxPlanId), a.ArchivingMailboxPlanId, a.EnableArchiving);
if (result < 0)
{
BindMailboxPlans();