Exchange archiving

This commit is contained in:
dev_amdtel 2014-04-14 23:12:27 +04:00
parent 5f951183e3
commit 7755217dfb
21 changed files with 1485 additions and 265 deletions

View file

@ -80,11 +80,6 @@
<asp:CheckBox ID="chkActiveSync" runat="server" meta:resourcekey="chkActiveSync" Text="ActiveSync"></asp:CheckBox>
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="chkEnableArchiving" runat="server" meta:resourcekey="chkEnableArchiving" Text="Archiving"></asp:CheckBox>
</td>
</tr>
</table>
<br />
</asp:Panel>
@ -228,6 +223,41 @@
</table>
</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="FormLabel200">
<asp:CheckBox ID="chkEnableArchiving" runat="server" meta:resourcekey="chkEnableArchiving" Text="Archiving"></asp:CheckBox>
</td>
<td></td>
</tr>
<tr>
<td class="FormLabel200" align="right"><asp:Localize ID="locArchiveQuota" runat="server" meta:resourcekey="locArchiveQuota" Text="Archive quota:"></asp:Localize></td>
<td>
<div class="Right">
<uc1:QuotaEditor id="archiveQuota" runat="server"
QuotaTypeID="2"
QuotaValue="0"
ParentQuotaValue="-1">
</uc1:QuotaEditor>
</div>
</td>
</tr>
<tr>
<td class="FormLabel200" align="right"><asp:Localize ID="locArchiveWarningQuota" runat="server" meta:resourcekey="locArchiveWarningQuota" Text="Archive warning quota:"></asp:Localize></td>
<td>
<wsp:SizeBox id="archiveWarningQuota" runat="server" DisplayUnitsKB="false" DisplayUnitsMB="false" DisplayUnitsPct="true" RequireValidatorEnabled="true"/>
</td>
</tr>
</table>
<br />
</asp:Panel>
<wsp:CollapsiblePanel id="secRetentionPolicyTags" runat="server"
TargetControlID="RetentionPolicyTags" meta:resourcekey="secRetentionPolicyTags" Text="Retention policy tags">
</wsp:CollapsiblePanel>

View file

@ -67,38 +67,48 @@ namespace WebsitePanel.Portal.ExchangeServer
{
Providers.HostedSolution.ExchangeMailboxPlan plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(PanelRequest.ItemID, PanelRequest.GetInt("MailboxPlanId"));
txtMailboxPlan.Text = plan.MailboxPlan;
mailboxSize.QuotaValue = plan.MailboxSizeMB;
maxRecipients.QuotaValue = plan.MaxRecipients;
maxSendMessageSizeKB.QuotaValue = plan.MaxSendMessageSizeKB;
maxReceiveMessageSizeKB.QuotaValue = plan.MaxReceiveMessageSizeKB;
chkPOP3.Checked = plan.EnablePOP;
chkIMAP.Checked = plan.EnableIMAP;
chkOWA.Checked = plan.EnableOWA;
chkMAPI.Checked = plan.EnableMAPI;
chkActiveSync.Checked = plan.EnableActiveSync;
sizeIssueWarning.ValueKB = plan.IssueWarningPct;
sizeProhibitSend.ValueKB = plan.ProhibitSendPct;
sizeProhibitSendReceive.ValueKB = plan.ProhibitSendReceivePct;
daysKeepDeletedItems.ValueDays = plan.KeepDeletedItemsDays;
chkHideFromAddressBook.Checked = plan.HideFromAddressBook;
chkEnableLitigationHold.Checked = plan.AllowLitigationHold;
recoverableItemsSpace.QuotaValue = plan.RecoverableItemsSpace;
recoverableItemsWarning.ValueKB = plan.RecoverableItemsWarningPct;
txtLitigationHoldMsg.Text = plan.LitigationHoldMsg;
txtLitigationHoldUrl.Text = plan.LitigationHoldUrl;
RetentionPolicy = plan.Archiving;
chkEnableArchiving.Checked = plan.EnableArchiving;
locTitle.Text = plan.MailboxPlan;
if (RetentionPolicy)
{
ExchangeMailboxPlanRetentionPolicyTag[] tags = ES.Services.ExchangeServer.GetExchangeMailboxPlanRetentionPolicyTags(plan.MailboxPlanId);
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));
ViewState["Tags"] = tags;
gvPolicy.DataSource = tags;
gvPolicy.DataBind();
UpdateTags();
}
else
{
mailboxSize.QuotaValue = plan.MailboxSizeMB;
maxRecipients.QuotaValue = plan.MaxRecipients;
maxSendMessageSizeKB.QuotaValue = plan.MaxSendMessageSizeKB;
maxReceiveMessageSizeKB.QuotaValue = plan.MaxReceiveMessageSizeKB;
chkPOP3.Checked = plan.EnablePOP;
chkIMAP.Checked = plan.EnableIMAP;
chkOWA.Checked = plan.EnableOWA;
chkMAPI.Checked = plan.EnableMAPI;
chkActiveSync.Checked = plan.EnableActiveSync;
sizeIssueWarning.ValueKB = plan.IssueWarningPct;
sizeProhibitSend.ValueKB = plan.ProhibitSendPct;
sizeProhibitSendReceive.ValueKB = plan.ProhibitSendReceivePct;
daysKeepDeletedItems.ValueDays = plan.KeepDeletedItemsDays;
chkHideFromAddressBook.Checked = plan.HideFromAddressBook;
chkEnableLitigationHold.Checked = plan.AllowLitigationHold;
recoverableItemsSpace.QuotaValue = plan.RecoverableItemsSpace;
recoverableItemsWarning.ValueKB = plan.RecoverableItemsWarningPct;
txtLitigationHoldMsg.Text = plan.LitigationHoldMsg;
txtLitigationHoldUrl.Text = plan.LitigationHoldUrl;
}
locTitle.Text = plan.MailboxPlan;
this.DisableControls = true;
@ -177,12 +187,16 @@ namespace WebsitePanel.Portal.ExchangeServer
locTitle.Text = RetentionPolicy ? GetLocalizedString("locTitleArchiving.Text") : GetLocalizedString("locTitle.Text");
UpdateTags();
secMailboxFeatures.Visible = !RetentionPolicy;
secMailboxGeneral.Visible = !RetentionPolicy;
secStorageQuotas.Visible = !RetentionPolicy;
secDeleteRetention.Visible = !RetentionPolicy;
secLitigationHold.Visible = !RetentionPolicy;
secArchiving.Visible = RetentionPolicy;
secRetentionPolicyTags.Visible = RetentionPolicy;
btnAdd.CausesValidation = RetentionPolicy;
}
@ -222,36 +236,45 @@ namespace WebsitePanel.Portal.ExchangeServer
{
Providers.HostedSolution.ExchangeMailboxPlan plan = new Providers.HostedSolution.ExchangeMailboxPlan();
plan.MailboxPlan = txtMailboxPlan.Text;
plan.MailboxSizeMB = mailboxSize.QuotaValue;
plan.IsDefault = false;
plan.MaxRecipients = maxRecipients.QuotaValue;
plan.MaxSendMessageSizeKB = maxSendMessageSizeKB.QuotaValue;
plan.MaxReceiveMessageSizeKB = maxReceiveMessageSizeKB.QuotaValue;
plan.EnablePOP = chkPOP3.Checked;
plan.EnableIMAP = chkIMAP.Checked;
plan.EnableOWA = chkOWA.Checked;
plan.EnableMAPI = chkMAPI.Checked;
plan.EnableActiveSync = chkActiveSync.Checked;
plan.IssueWarningPct = sizeIssueWarning.ValueKB;
if ((plan.IssueWarningPct == 0)) plan.IssueWarningPct = 100;
plan.ProhibitSendPct = sizeProhibitSend.ValueKB;
if ((plan.ProhibitSendPct == 0)) plan.ProhibitSendPct = 100;
plan.ProhibitSendReceivePct = sizeProhibitSendReceive.ValueKB;
if ((plan.ProhibitSendReceivePct == 0)) plan.ProhibitSendReceivePct = 100;
plan.KeepDeletedItemsDays = daysKeepDeletedItems.ValueDays;
plan.HideFromAddressBook = chkHideFromAddressBook.Checked;
plan.AllowLitigationHold = chkEnableLitigationHold.Checked;
plan.RecoverableItemsSpace = recoverableItemsSpace.QuotaValue;
plan.RecoverableItemsWarningPct = recoverableItemsWarning.ValueKB;
if ((plan.RecoverableItemsWarningPct == 0)) plan.RecoverableItemsWarningPct = 100;
plan.LitigationHoldMsg = txtLitigationHoldMsg.Text.Trim();
plan.LitigationHoldUrl = txtLitigationHoldUrl.Text.Trim();
plan.Archiving = RetentionPolicy;
plan.EnableArchiving = chkEnableArchiving.Checked;
if (RetentionPolicy)
{
plan.EnableArchiving = chkEnableArchiving.Checked;
plan.MailboxSizeMB = archiveQuota.QuotaValue;
plan.IssueWarningPct = archiveWarningQuota.ValueKB;
if ((plan.IssueWarningPct == 0)) plan.IssueWarningPct = 100;
}
else
{
plan.MailboxSizeMB = mailboxSize.QuotaValue;
plan.IsDefault = false;
plan.MaxRecipients = maxRecipients.QuotaValue;
plan.MaxSendMessageSizeKB = maxSendMessageSizeKB.QuotaValue;
plan.MaxReceiveMessageSizeKB = maxReceiveMessageSizeKB.QuotaValue;
plan.EnablePOP = chkPOP3.Checked;
plan.EnableIMAP = chkIMAP.Checked;
plan.EnableOWA = chkOWA.Checked;
plan.EnableMAPI = chkMAPI.Checked;
plan.EnableActiveSync = chkActiveSync.Checked;
plan.IssueWarningPct = sizeIssueWarning.ValueKB;
if ((plan.IssueWarningPct == 0)) plan.IssueWarningPct = 100;
plan.ProhibitSendPct = sizeProhibitSend.ValueKB;
if ((plan.ProhibitSendPct == 0)) plan.ProhibitSendPct = 100;
plan.ProhibitSendReceivePct = sizeProhibitSendReceive.ValueKB;
if ((plan.ProhibitSendReceivePct == 0)) plan.ProhibitSendReceivePct = 100;
plan.KeepDeletedItemsDays = daysKeepDeletedItems.ValueDays;
plan.HideFromAddressBook = chkHideFromAddressBook.Checked;
plan.AllowLitigationHold = chkEnableLitigationHold.Checked;
plan.RecoverableItemsSpace = recoverableItemsSpace.QuotaValue;
plan.RecoverableItemsWarningPct = recoverableItemsWarning.ValueKB;
if ((plan.RecoverableItemsWarningPct == 0)) plan.RecoverableItemsWarningPct = 100;
plan.LitigationHoldMsg = txtLitigationHoldMsg.Text.Trim();
plan.LitigationHoldUrl = txtLitigationHoldUrl.Text.Trim();
}
int planId = ES.Services.ExchangeServer.AddExchangeMailboxPlan(PanelRequest.ItemID,
plan);

View file

@ -174,15 +174,6 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkActiveSync;
/// <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>
/// secMailboxGeneral control.
/// </summary>
@ -498,6 +489,69 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtLitigationHoldMsg;
/// <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>
/// locArchiveQuota 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 locArchiveQuota;
/// <summary>
/// archiveQuota control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.QuotaEditor archiveQuota;
/// <summary>
/// locArchiveWarningQuota 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 locArchiveWarningQuota;
/// <summary>
/// archiveWarningQuota 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.SizeBox archiveWarningQuota;
/// <summary>
/// secRetentionPolicyTags control.
/// </summary>

View file

@ -147,7 +147,7 @@
</tr>
<tr>
<td class="FormLabel150">
<asp:Localize ID="locArchivingMailboxplanName" runat="server" meta:resourcekey="locArchivingMailboxplanName" Text="Archiving Mailboxplan Name: "></asp:Localize>
<asp:Localize ID="locRetentionPolicyName" runat="server" meta:resourcekey="locRetentionPolicyName" Text="Retention policy Name: "></asp:Localize>
</td>
<td>
<wsp:MailboxPlanSelector ID="archivingMailboxPlanSelector" runat="server" Archiving="true" AddNone="true" />

View file

@ -328,13 +328,13 @@ namespace WebsitePanel.Portal.ExchangeServer {
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.MailboxPlanSelector mailboxPlanSelector;
/// <summary>
/// locArchivingMailboxplanName control.
/// locRetentionPolicyName 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 locArchivingMailboxplanName;
protected global::System.Web.UI.WebControls.Localize locRetentionPolicyName;
/// <summary>
/// archivingMailboxPlanSelector control.

View file

@ -55,7 +55,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" OnChanged="mailboxPlanSelector_Changed" />
<wsp:MailboxPlanSelector ID="mailboxPlanSelector" runat="server" />
</td>
</tr>
<tr>
@ -74,16 +74,10 @@
</table>
</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;">
<wsp:CollapsiblePanel id="secRetentionPolicy" runat="server" TargetControlID="RetentionPolicy" meta:resourcekey="secRetentionPolicy" Text="Retention policy"></wsp:CollapsiblePanel>
<asp:Panel ID="RetentionPolicy" runat="server" Height="0" style="overflow:hidden;">
<table>
<tr>
<td class="FormLabel150"></td>
<td>
<asp:CheckBox ID="chkArchiving" runat="server" meta:resourcekey ="chkArchiving" Text ="Enable Archiving" AutoPostBack="true" OnCheckedChanged="chkArchiving_CheckedChanged"></asp:CheckBox>
</td>
</tr>
<tr runat="server" id="mailboxArchivePlan">
<tr runat="server">
<td class="FormLabel150"><asp:Localize ID="locRetentionPolicyName" runat="server" meta:resourcekey="locRetentionPolicyName" Text="Retention policy: "></asp:Localize></td>
<td>
<wsp:MailboxPlanSelector ID="mailboxRetentionPolicySelector" runat="server" Archiving="true" AddNone="true"/>

View file

@ -67,8 +67,6 @@ namespace WebsitePanel.Portal.ExchangeServer
BindSettings();
SetArchivingVisible();
UserInfo user = UsersHelper.GetUser(PanelSecurity.EffectiveUserId);
if (user != null)
@ -124,12 +122,10 @@ namespace WebsitePanel.Portal.ExchangeServer
if (account.ArchivingMailboxPlanId<1)
{
mailboxRetentionPolicySelector.MailboxPlanId = "-1";
chkArchiving.Checked = false;
}
else
{
mailboxRetentionPolicySelector.MailboxPlanId = account.ArchivingMailboxPlanId.ToString();
chkArchiving.Checked = true;
}
mailboxSize.QuotaUsedValue = Convert.ToInt32(stats.TotalSize / 1024 / 1024);
@ -182,8 +178,7 @@ namespace WebsitePanel.Portal.ExchangeServer
{
int planId = Convert.ToInt32(mailboxPlanSelector.MailboxPlanId);
int policyId = -1;
if (chkArchiving.Checked)
policyId = Convert.ToInt32(mailboxRetentionPolicySelector.MailboxPlanId);
int.TryParse(mailboxRetentionPolicySelector.MailboxPlanId, out policyId);
result = ES.Services.ExchangeServer.SetExchangeMailboxPlan(PanelRequest.ItemID, PanelRequest.AccountID, planId,
policyId);
@ -264,35 +259,5 @@ namespace WebsitePanel.Portal.ExchangeServer
return result;
}
protected void chkArchiving_CheckedChanged(object sender, EventArgs e)
{
SetArchivingVisible();
}
private void SetArchivingVisible()
{
int id;
if (!int.TryParse(mailboxPlanSelector.MailboxPlanId, out id))
return;
bool archiving = false;
ExchangeMailboxPlan policy = ES.Services.ExchangeServer.GetExchangeMailboxPlan(PanelRequest.ItemID, id);
if (policy != null)
archiving = policy.EnableArchiving & Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWARCHIVING, Cntx);
if (!archiving)
chkArchiving.Checked = false;
secArchiving.Visible = archiving;
mailboxArchivePlan.Visible = chkArchiving.Checked;
}
protected void mailboxPlanSelector_Changed(object sender, EventArgs e)
{
SetArchivingVisible();
}
}
}

View file

@ -175,40 +175,22 @@ namespace WebsitePanel.Portal.ExchangeServer {
protected global::WebsitePanel.Portal.QuotaViewer mailboxSize;
/// <summary>
/// secArchiving control.
/// secRetentionPolicy 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;
protected global::WebsitePanel.Portal.CollapsiblePanel secRetentionPolicy;
/// <summary>
/// Archiving control.
/// RetentionPolicy 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>
/// chkArchiving 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 chkArchiving;
/// <summary>
/// mailboxArchivePlan 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 mailboxArchivePlan;
protected global::System.Web.UI.WebControls.Panel RetentionPolicy;
/// <summary>
/// locRetentionPolicyName control.