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.

View file

@ -103,11 +103,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>
@ -260,6 +255,74 @@
</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" />
</td>
</tr>
</table>
<br />
</asp:Panel>
<wsp:CollapsiblePanel id="secRetentionPolicyTags" runat="server"
TargetControlID="RetentionPolicyTags" meta:resourcekey="secRetentionPolicyTags" Text="Retention policy tags">
</wsp:CollapsiblePanel>
<asp:Panel ID="RetentionPolicyTags" runat="server" Height="0" style="overflow:hidden;">
<asp:UpdatePanel ID="GeneralUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<asp:GridView id="gvPolicy" runat="server" EnableViewState="true" AutoGenerateColumns="false"
Width="100%" EmptyDataText="" CssSelectorClass="NormalGridView" OnRowCommand="gvPolicy_RowCommand" >
<Columns>
<asp:TemplateField HeaderText="Tag">
<ItemStyle Width="70%"></ItemStyle>
<ItemTemplate>
<asp:Label id="displayPolicy" runat="server" EnableViewState="true" ><%# PortalAntiXSS.Encode((string)Eval("TagName"))%></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
&nbsp;<asp:ImageButton id="imgDelPolicy" runat="server" Text="Delete" SkinID="ExchangeDelete"
CommandName="DeleteItem" CommandArgument='<%# Eval("TagId") %>'
meta:resourcekey="cmdDelete" OnClientClick="return confirm('Are you sure you want to delete selected policy tag?')" >
</asp:ImageButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<br />
<asp:DropDownList ID="ddTags" runat ="server"></asp:DropDownList>
<asp:Button ID="bntAddTag" runat="server" Text="Add tag" meta:resourcekey="bntAddTag" OnClick="bntAddTag_Click"/>
<br />
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
<table>
<tr>

View file

@ -70,10 +70,21 @@ namespace WebsitePanel.Portal
secMailboxFeatures.Visible = !RetentionPolicy;
secMailboxGeneral.Visible = !RetentionPolicy;
secStorageQuotas.Visible = !RetentionPolicy;
secDeleteRetention.Visible = !RetentionPolicy;
secLitigationHold.Visible = !RetentionPolicy;
secArchiving.Visible = RetentionPolicy;
secRetentionPolicyTags.Visible = RetentionPolicy;
gvMailboxPlans.Columns[4].Visible = !RetentionPolicy;
gvMailboxPlans.Columns[5].Visible = !RetentionPolicy;
btnAddMailboxPlan.CausesValidation = RetentionPolicy;
btnUpdateMailboxPlan.CausesValidation = RetentionPolicy;
UpdateTags();
}
@ -109,44 +120,54 @@ namespace WebsitePanel.Portal
public void btnAddMailboxPlan_Click(object sender, EventArgs e)
{
Page.Validate("CreateMailboxPlan");
if (!RetentionPolicy)
Page.Validate("CreateMailboxPlan");
if (!Page.IsValid)
return;
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.EnableArchiving = chkEnableArchiving.Checked;
plan.Archiving = RetentionPolicy;
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();
}
if (PanelSecurity.SelectedUser.Role == UserRole.Administrator)
plan.MailboxPlanType = (int)ExchangeMailboxPlanType.Administrator;
else
@ -172,13 +193,16 @@ namespace WebsitePanel.Portal
if ((orgs != null) & (orgs.GetLength(0) > 0))
{
int result = ES.Services.ExchangeServer.AddExchangeMailboxPlan(orgs[0].Id, plan);
int planId = ES.Services.ExchangeServer.AddExchangeMailboxPlan(orgs[0].Id, plan);
if (result < 0)
if (planId < 0)
{
messageBox.ShowResultMessage(result);
messageBox.ShowResultMessage(planId);
return;
}
if (RetentionPolicy)
SaveTags(orgs[0].Id, planId);
}
BindMailboxPlans();
@ -251,6 +275,13 @@ namespace WebsitePanel.Portal
txtLitigationHoldUrl.Text = string.Empty;
chkEnableArchiving.Checked = false;
archiveQuota.QuotaValue = 0;
archiveWarningQuota.ValueKB = 0;
ViewState["Tags"] = null;
gvPolicy.DataSource = null;
gvPolicy.DataBind();
UpdateTags();
btnUpdateMailboxPlan.Enabled = (string.IsNullOrEmpty(txtMailboxPlan.Text)) ? false : true;
@ -282,30 +313,48 @@ namespace WebsitePanel.Portal
plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(orgs[0].Id, 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;
if (plan.KeepDeletedItemsDays != -1)
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;
chkEnableArchiving.Checked = plan.EnableArchiving;
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));
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;
if (plan.KeepDeletedItemsDays != -1)
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;
}
btnUpdateMailboxPlan.Enabled = (string.IsNullOrEmpty(txtMailboxPlan.Text)) ? false : true;
@ -388,37 +437,48 @@ namespace WebsitePanel.Portal
plan = new Providers.HostedSolution.ExchangeMailboxPlan();
plan.MailboxPlanId = (int)ViewState["MailboxPlanID"];
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.EnableArchiving = chkEnableArchiving.Checked;
plan.Archiving = RetentionPolicy;
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();
}
if (PanelSecurity.SelectedUser.Role == UserRole.Administrator)
plan.MailboxPlanType = (int)ExchangeMailboxPlanType.Administrator;
else
@ -436,8 +496,12 @@ namespace WebsitePanel.Portal
}
else
{
if (RetentionPolicy)
SaveTags(orgs[0].Id, mailboxPlanId);
messageBox.ShowSuccessMessage("EXCHANGE_UPDATEPLANS");
}
}
BindMailboxPlans();
@ -518,5 +582,130 @@ namespace WebsitePanel.Portal
BindMailboxPlans();
}
protected void gvPolicy_RowCommand(object sender, GridViewCommandEventArgs e)
{
switch (e.CommandName)
{
case "DeleteItem":
try
{
int tagId;
if (!int.TryParse(e.CommandArgument.ToString(), out tagId))
return;
List<ExchangeMailboxPlanRetentionPolicyTag> tags = ViewState["Tags"] as List<ExchangeMailboxPlanRetentionPolicyTag>;
if (tags == null) return;
int i = tags.FindIndex(x => x.TagID == tagId);
if (i >= 0) tags.RemoveAt(i);
ViewState["Tags"] = tags;
gvPolicy.DataSource = tags;
gvPolicy.DataBind();
UpdateTags();
}
catch (Exception)
{
}
break;
}
}
protected void bntAddTag_Click(object sender, EventArgs e)
{
int addTagId;
if (!int.TryParse(ddTags.SelectedValue, out addTagId))
return;
Providers.HostedSolution.ExchangeRetentionPolicyTag tag = ES.Services.ExchangeServer.GetExchangeRetentionPolicyTag(PanelRequest.ItemID, addTagId);
if (tag == null) return;
List<ExchangeMailboxPlanRetentionPolicyTag> res = ViewState["Tags"] as List<ExchangeMailboxPlanRetentionPolicyTag>;
if (res == null) res = new List<ExchangeMailboxPlanRetentionPolicyTag>();
ExchangeMailboxPlanRetentionPolicyTag add = new ExchangeMailboxPlanRetentionPolicyTag();
add.MailboxPlanId = PanelRequest.GetInt("MailboxPlanId");
add.TagID = tag.TagID;
add.TagName = tag.TagName;
res.Add(add);
ViewState["Tags"] = res;
gvPolicy.DataSource = res;
gvPolicy.DataBind();
UpdateTags();
}
protected void UpdateTags()
{
if (RetentionPolicy)
{
ddTags.Items.Clear();
Providers.HostedSolution.Organization[] orgs = null;
if (PanelSecurity.SelectedUserId != 1)
{
PackageInfo[] Packages = ES.Services.Packages.GetPackages(PanelSecurity.SelectedUserId);
if ((Packages != null) & (Packages.GetLength(0) > 0))
{
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Packages[0].PackageId, false);
}
}
else
{
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(1, false);
}
if ((orgs != null) & (orgs.GetLength(0) > 0))
{
Providers.HostedSolution.ExchangeRetentionPolicyTag[] allTags = ES.Services.ExchangeServer.GetExchangeRetentionPolicyTags(orgs[0].Id);
List<ExchangeMailboxPlanRetentionPolicyTag> selectedTags = ViewState["Tags"] as List<ExchangeMailboxPlanRetentionPolicyTag>;
foreach (Providers.HostedSolution.ExchangeRetentionPolicyTag tag in allTags)
{
if (selectedTags != null)
{
if (selectedTags.Find(x => x.TagID == tag.TagID) != null)
continue;
}
ddTags.Items.Add(new System.Web.UI.WebControls.ListItem(tag.TagName, tag.TagID.ToString()));
}
}
}
}
protected void SaveTags(int ItemId, int planId)
{
ExchangeMailboxPlanRetentionPolicyTag[] currenttags = ES.Services.ExchangeServer.GetExchangeMailboxPlanRetentionPolicyTags(planId);
foreach (ExchangeMailboxPlanRetentionPolicyTag tag in currenttags)
ES.Services.ExchangeServer.DeleteExchangeMailboxPlanRetentionPolicyTag(ItemId, planId, tag.PlanTagID);
List<ExchangeMailboxPlanRetentionPolicyTag> tags = ViewState["Tags"] as List<ExchangeMailboxPlanRetentionPolicyTag>;
if (tags != null)
{
foreach (ExchangeMailboxPlanRetentionPolicyTag tag in tags)
{
tag.MailboxPlanId = planId;
int result = ES.Services.ExchangeServer.AddExchangeMailboxPlanRetentionPolicyTag(ItemId, tag);
if (result < 0)
{
messageBox.ShowResultMessage(result);
return;
}
}
}
}
}
}

View file

@ -138,15 +138,6 @@ namespace WebsitePanel.Portal {
/// </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>
@ -462,6 +453,123 @@ namespace WebsitePanel.Portal {
/// </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>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secRetentionPolicyTags;
/// <summary>
/// RetentionPolicyTags 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 RetentionPolicyTags;
/// <summary>
/// GeneralUpdatePanel 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 GeneralUpdatePanel;
/// <summary>
/// gvPolicy 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.GridView gvPolicy;
/// <summary>
/// ddTags 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.DropDownList ddTags;
/// <summary>
/// bntAddTag 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.Button bntAddTag;
/// <summary>
/// btnAddMailboxPlan control.
/// </summary>