Approaches with mailbox plan changed: ServerAdmin and Reseller are able to

define global plans. The plans will accumulate through out the tree.

Various UI optimizations

Before defining global plans ensure you create a hosted organization for each
reseller. Spaces -> Hosted Organization -> New Organization
This commit is contained in:
robvde 2012-08-05 23:16:48 +04:00
parent a99d7f8edd
commit 3be20ebaa4
32 changed files with 1745 additions and 580 deletions

View file

@ -3,7 +3,7 @@
<!-- Display Settings -->
<PortalName>WebsitePanel</PortalName>
<!-- Enterprise Server -->
<EnterpriseServer>http://localhost:9005</EnterpriseServer>
<EnterpriseServer>http://localhost:9002</EnterpriseServer>
<!-- General Settings -->
<CultureCookieName>UserCulture</CultureCookieName>
<ThemeCookieName>UserTheme</ThemeCookieName>

View file

@ -5155,6 +5155,9 @@
<data name="Error.EXCHANGE_SET_DEFAULT_MAILBOXPLAN" xml:space="preserve">
<value>Failed to set default mailbox plan.</value>
</data>
<data name="Error.EXCHANGE_UNABLE_USE_SYSTEMPLAN" xml:space="preserve">
<value>Not possible to perform requested action on a system defined plan.</value>
</data>
<data name="Error.EXCHANGE_FAILED_TO_STAMP" xml:space="preserve">
<value>Failed to stamp mailbox with a mailbox plan. See storage allocation.</value>
</data>
@ -5176,10 +5179,30 @@
<data name="Success.EXCHANGE_MATCHPLANS" xml:space="preserve">
<value>Succesfully plans matched and applied</value>
</data>
<data name="Error.EXCHANGE_STAMPMAILBOXES" xml:space="preserve">
<value>Failed to stamp mailboxes</value>
</data>
<data name="Success.EXCHANGE_STAMPMAILBOXES" xml:space="preserve">
<value>Succesfully stamp mailboxes</value>
</data>
<data name="Error.EXCHANGE_UPDATEPLANS" xml:space="preserve">
<value>Mailbox plan update failed</value>
</data>
<data name="Success.EXCHANGE_UPDATEPLANS" xml:space="preserve">
<value>Mailbox plan updated</value>
</data>
<data name="Error.LYNC_APPLYPLANTEMPLATE" xml:space="preserve">
<value>Failed to apply plans template</value>
</data>
<data name="Success.LYNC_APPLYPLANTEMPLATE" xml:space="preserve">
<value>Succesfully applied plans template</value>
</data>
<data name="Success.REQUEST_COMPLETED_SUCCESFULLY" xml:space="preserve">
<value>Request Completed Succesfully</value>
</data>
</root>

View file

@ -219,6 +219,22 @@ TEXTAREA.TextBox200
width: 200px;
}
TEXTAREA.TextBox300
{
border: solid 1px #909090;
padding-left: 2px;
padding-top: 1px;
width: 300px;
}
TEXTAREA.TextBox400
{
border: solid 1px #909090;
padding-left: 2px;
padding-top: 1px;
width: 400px;
}
.HugeTextBox
{
font-family: Tahoma;

View file

@ -219,4 +219,13 @@
<data name="btnMatchMailboxPlanToUser.Text" xml:space="preserve">
<value>Match Mailbox Plan to User</value>
</data>
<data name="secTools.Text" xml:space="preserve">
<value>Tools</value>
</data>
<data name="btnStamp.Text" xml:space="preserve">
<value>Restamp all mailboxes</value>
</data>
<data name="btnUpdateMailboxPlan.Text" xml:space="preserve">
<value>Update Mailbox Plan</value>
</data>
</root>

View file

@ -136,7 +136,7 @@
<value>POP3</value>
</data>
<data name="FormComments.Text" xml:space="preserve">
<value>&lt;p&gt; A Mailbox plan is a template that defines the characteristics of a mailbox &lt;/p&gt; &lt;p&gt;The mailbox plan name needs to be unique. A mailbox plan cannot be modified. In case a mailbox needs a mailbox plan with another characteristics, a new mailbox plan needs to be created and assigned to the mailbox. A mailbox plan can only be deleted when the plan is not assigned to any mailboxes. &lt;/p&gt;</value>
<value>&lt;p&gt; A Mailbox plan is a template that defines the characteristics of a mailbox &lt;/p&gt; &lt;p&gt;The mailbox plan name needs to be unique. A mailbox plan cannot be modified. In case a mailbox needs a mailbox plan with another characteristics, a new mailbox plan needs to be created and assigned to the mailbox. A mailbox plan can only be deleted when the plan is not assigned to any mailboxes. &lt;/p&gt;&lt;p&gt; Empty value indicates &lt;b&gt;'Unlimited'&lt;/b&gt;, percentages have to be a value between 0 and 100 (a value of 0 can block the mailbox from sending and receiving email) &lt;/p&gt; &lt;p&gt; Unllimited values can only be used when the hosting plan allows to do so&lt;/p&gt;</value>
</data>
<data name="locDays.Text" xml:space="preserve">
<value>days</value>

View file

@ -139,7 +139,7 @@
<value>Mailbox plan</value>
</data>
<data name="gvMailboxPlanDefault.Header" xml:space="preserve">
<value>Default Mailbox plan</value>
<value>Default</value>
</data>
<data name="gvMailboxPlans.Empty" xml:space="preserve">
<value>No mailbox plans have been added yet. To add a new mailbox plan click "Add New Mailbox plan" button.</value>

View file

@ -101,25 +101,25 @@
<tr>
<td class="FormLabel200" align="right"><asp:Localize ID="locMailboxSize" runat="server" meta:resourcekey="locMailboxSize" Text="Mailbox size:"></asp:Localize></td>
<td>
<wsp:SizeBox id="mailboxSize" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="false" DisplayUnitsMB="true" DisplayUnitsPct="false" RequireValidatorEnabled="true"/>
<wsp:SizeBox id="mailboxSize" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="false" DisplayUnitsMB="true" DisplayUnitsPct="false"/>
</td>
</tr>
<tr>
<td class="FormLabel200" align="right"><asp:Localize ID="locMaxRecipients" runat="server" meta:resourcekey="locMaxRecipients" Text="Maximum Recipients:"></asp:Localize></td>
<td>
<wsp:SizeBox id="maxRecipients" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="false" DisplayUnitsMB="false" DisplayUnitsPct="false" RequireValidatorEnabled="true"/>
<wsp:SizeBox id="maxRecipients" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="false" DisplayUnitsMB="false" DisplayUnitsPct="false"/>
</td>
</tr>
<tr>
<td class="FormLabel200" align="right"><asp:Localize ID="locMaxSendMessageSizeKB" runat="server" meta:resourcekey="locMaxSendMessageSizeKB" Text="Maximum Send Message Size (Kb):"></asp:Localize></td>
<td>
<wsp:SizeBox id="maxSendMessageSizeKB" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="true" DisplayUnitsMB="false" DisplayUnitsPct="false" RequireValidatorEnabled="true"/>
<wsp:SizeBox id="maxSendMessageSizeKB" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="true" DisplayUnitsMB="false" DisplayUnitsPct="false"/>
</td>
</tr>
<tr>
<td class="FormLabel200" align="right"><asp:Localize ID="locMaxReceiveMessageSizeKB" runat="server" meta:resourcekey="locMaxReceiveMessageSizeKB" Text="Maximum Receive Message Size (Kb):"></asp:Localize></td>
<td>
<wsp:SizeBox id="maxReceiveMessageSizeKB" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="true" DisplayUnitsMB="false" DisplayUnitsPct="false" RequireValidatorEnabled="true"/>
<wsp:SizeBox id="maxReceiveMessageSizeKB" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="true" DisplayUnitsMB="false" DisplayUnitsPct="false"/>
</td>
</tr>

View file

@ -40,14 +40,20 @@ namespace WebsitePanel.Portal.ExchangeServer
if (!IsPostBack)
{
PackageContext cntx = ES.Services.Packages.GetPackageContext(PanelSecurity.PackageId);
if (PanelRequest.GetInt("MailboxPlanId") != 0)
{
Providers.HostedSolution.ExchangeMailboxPlan plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(PanelRequest.ItemID, PanelRequest.GetInt("MailboxPlanId"));
txtMailboxPlan.Text = plan.MailboxPlan;
mailboxSize.ValueKB = plan.MailboxSizeMB;
maxRecipients.ValueKB = plan.MaxRecipients;
maxSendMessageSizeKB.ValueKB = plan.MaxSendMessageSizeKB;
maxReceiveMessageSizeKB.ValueKB = plan.MaxReceiveMessageSizeKB;
if (plan.MailboxSizeMB != -1)
mailboxSize.ValueKB = plan.MailboxSizeMB;
if (plan.MaxRecipients != -1)
maxRecipients.ValueKB = plan.MaxRecipients;
if (plan.MaxSendMessageSizeKB != -1)
maxSendMessageSizeKB.ValueKB = plan.MaxSendMessageSizeKB;
if (plan.MaxReceiveMessageSizeKB != -1)
maxReceiveMessageSizeKB.ValueKB = plan.MaxReceiveMessageSizeKB;
chkPOP3.Checked = plan.EnablePOP;
chkIMAP.Checked = plan.EnableIMAP;
chkOWA.Checked = plan.EnableOWA;
@ -85,21 +91,47 @@ namespace WebsitePanel.Portal.ExchangeServer
}
else
{
PackageContext cntx = ES.Services.Packages.GetPackageContext(PanelSecurity.PackageId);
if (cntx != null)
{
foreach (QuotaValueInfo quota in cntx.QuotasArray)
{
switch (quota.QuotaId)
{
case 77:
if (quota.QuotaAllocatedValue != -1)
{
mailboxSize.RequireValidatorEnabled = true;
}
else
mailboxSize.RequireValidatorEnabled = false;
break;
case 365:
maxRecipients.ValueKB = quota.QuotaAllocatedValue;
if (quota.QuotaAllocatedValue != -1)
{
maxRecipients.ValueKB = quota.QuotaAllocatedValue;
maxRecipients.RequireValidatorEnabled = true;
}
else
maxRecipients.RequireValidatorEnabled = false;
break;
case 366:
maxSendMessageSizeKB.ValueKB = quota.QuotaAllocatedValue;
if (quota.QuotaAllocatedValue != -1)
{
maxSendMessageSizeKB.ValueKB = quota.QuotaAllocatedValue;
maxSendMessageSizeKB.RequireValidatorEnabled = true;
}
else
maxSendMessageSizeKB.RequireValidatorEnabled = false;
break;
case 367:
maxReceiveMessageSizeKB.ValueKB = quota.QuotaAllocatedValue;
if (quota.QuotaAllocatedValue != -1)
{
maxReceiveMessageSizeKB.ValueKB = quota.QuotaAllocatedValue;
maxReceiveMessageSizeKB.RequireValidatorEnabled = true;
}
else
maxReceiveMessageSizeKB.RequireValidatorEnabled = false;
break;
case 83:
chkPOP3.Checked = Convert.ToBoolean(quota.QuotaAllocatedValue);
@ -123,6 +155,7 @@ namespace WebsitePanel.Portal.ExchangeServer
break;
case 364:
daysKeepDeletedItems.ValueDays = quota.QuotaAllocatedValue;
daysKeepDeletedItems.RequireValidatorEnabled = true;
break;
}
@ -149,13 +182,13 @@ namespace WebsitePanel.Portal.ExchangeServer
{
Providers.HostedSolution.ExchangeMailboxPlan plan = new Providers.HostedSolution.ExchangeMailboxPlan();
plan.MailboxPlan = txtMailboxPlan.Text;
plan.MailboxSizeMB = mailboxSize.ValueKB;
if ((plan.MailboxSizeMB == 0)) plan.MailboxSizeMB = 1;
plan.IsDefault = false;
plan.MaxRecipients = maxRecipients.ValueKB;
plan.MaxSendMessageSizeKB = maxSendMessageSizeKB.ValueKB;
plan.MaxReceiveMessageSizeKB = maxReceiveMessageSizeKB.ValueKB;
plan.MaxReceiveMessageSizeKB = maxReceiveMessageSizeKB.ValueKB;
plan.EnablePOP = chkPOP3.Checked;
plan.EnableIMAP = chkIMAP.Checked;
plan.EnableOWA = chkOWA.Checked;

View file

@ -62,7 +62,7 @@
<tr>
<td class="FormLabel150"><asp:Localize ID="locQuota" runat="server" meta:resourcekey="locQuota" Text="Mailbox Size:"></asp:Localize></td>
<td>
<wsp:QuotaViewer ID="mailboxSize" runat="server" QuotaTypeId="2" /> MB
<wsp:QuotaViewer ID="mailboxSize" runat="server" QuotaTypeId="2" DisplayGauge="true" /> MB
</td>
</tr>

View file

@ -78,7 +78,7 @@ namespace WebsitePanel.Portal.ExchangeServer
}
mailboxSize.QuotaUsedValue = Convert.ToInt32(stats.TotalSize / 1024 / 1024);
mailboxSize.QuotaValue = (int)Math.Round((double)(stats.MaxSize / 1024 / 1024));
mailboxSize.QuotaValue = (stats.MaxSize == -1) ? -1: (int)Math.Round((double)(stats.MaxSize / 1024 / 1024));
if ((account.AccountType == ExchangeAccountType.Equipment) | (account.AccountType == ExchangeAccountType.Room))
secCalendarSettings.Visible = true;

View file

@ -34,6 +34,12 @@
<asp:GridView ID="gvMailboxPlans" runat="server" AutoGenerateColumns="False" EnableViewState="true"
Width="100%" EmptyDataText="gvMailboxPlans" CssSelectorClass="NormalGridView" OnRowCommand="gvMailboxPlan_RowCommand">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Image ID="img2" runat="server" Width="16px" Height="16px" ImageUrl='<%# GetPlanType((int)Eval("MailboxPlanType")) %>' ImageAlign="AbsMiddle" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="gvMailboxPlan">
<ItemStyle Width="70%"></ItemStyle>
<ItemTemplate>
@ -50,11 +56,11 @@
</div>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<asp:TemplateField >
<ItemTemplate>
&nbsp;<asp:ImageButton ID="imgDelMailboxPlan" runat="server" Text="Delete" SkinID="ExchangeDelete"
CommandName="DeleteItem" CommandArgument='<%# Eval("MailboxPlanId") %>'
meta:resourcekey="cmdDelete" OnClientClick="return confirm('Are you sure you want to delete selected mailbox plan?')"></asp:ImageButton>
meta:resourcekey="cmdDelete" OnClientClick="return confirm('Are you sure you want to delete selected mailbox plan?')" ></asp:ImageButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
@ -85,7 +91,7 @@
<td>
</td>
<td>
<asp:TextBox ID="txtStatus" runat="server" CssClass="TextBox200" MaxLength="128" ReadOnly="true"></asp:TextBox>
<asp:TextBox ID="txtStatus" runat="server" CssClass="TextBox400" MaxLength="128" ReadOnly="true"></asp:TextBox>
</td>
</tr>
<tr>

View file

@ -102,9 +102,19 @@ namespace WebsitePanel.Portal.ExchangeServer
if (e.CommandName == "DeleteItem")
{
int mailboxPlanId = Utils.ParseInt(e.CommandArgument.ToString(), 0);
try
{
ExchangeMailboxPlan plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(PanelRequest.ItemID, mailboxPlanId);
if (plan.MailboxPlanType > 0)
{
ShowErrorMessage("EXCHANGE_UNABLE_USE_SYSTEMPLAN");
BindMailboxPlans();
return;
}
int result = ES.Services.ExchangeServer.DeleteExchangeMailboxPlan(PanelRequest.ItemID, mailboxPlanId);
if (result < 0)
@ -112,6 +122,8 @@ namespace WebsitePanel.Portal.ExchangeServer
messageBox.ShowResultMessage(result);
return;
}
else
ShowSuccessMessage("REQUEST_COMPLETED_SUCCESFULLY");
}
catch (Exception)
@ -130,8 +142,20 @@ namespace WebsitePanel.Portal.ExchangeServer
try
{
ExchangeMailboxPlan plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(PanelRequest.ItemID, mailboxPlanId);
if (plan.MailboxPlanType > 0)
{
ShowErrorMessage("EXCHANGE_UNABLE_USE_SYSTEMPLAN");
BindMailboxPlans();
return;
}
ES.Services.ExchangeServer.SetOrganizationDefaultExchangeMailboxPlan(PanelRequest.ItemID, mailboxPlanId);
ShowSuccessMessage("REQUEST_COMPLETED_SUCCESFULLY");
// rebind domains
BindMailboxPlans();
}
@ -167,6 +191,31 @@ namespace WebsitePanel.Portal.ExchangeServer
{
ShowErrorMessage("EXCHANGE_FAILED_TO_STAMP", ex);
}
BindMailboxPlans();
}
public string GetPlanType(int mailboxPlanType)
{
string imgName = string.Empty;
ExchangeMailboxPlanType planType = (ExchangeMailboxPlanType)mailboxPlanType;
switch (planType)
{
case ExchangeMailboxPlanType.Reseller:
imgName = "company24.png";
break;
case ExchangeMailboxPlanType.Administrator:
imgName = "company24.png";
break;
default:
imgName = "admin_16.png";
break;
}
return GetThemedImage("Exchange/" + imgName);
}
}
}

View file

@ -1,33 +1,4 @@
// Copyright (c) 2012, 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.
//
@ -36,13 +7,11 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.Portal.ExchangeServer
{
public partial class ExchangeMailboxPlans
{
namespace WebsitePanel.Portal.ExchangeServer {
public partial class ExchangeMailboxPlans {
/// <summary>
/// asyncTasks control.
/// </summary>
@ -51,7 +20,7 @@ namespace WebsitePanel.Portal.ExchangeServer
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks;
/// <summary>
/// breadcrumb control.
/// </summary>
@ -60,7 +29,7 @@ namespace WebsitePanel.Portal.ExchangeServer
/// 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>
@ -69,7 +38,7 @@ namespace WebsitePanel.Portal.ExchangeServer
/// 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>
@ -78,7 +47,7 @@ namespace WebsitePanel.Portal.ExchangeServer
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Image Image1;
/// <summary>
/// locTitle control.
/// </summary>
@ -87,7 +56,7 @@ namespace WebsitePanel.Portal.ExchangeServer
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locTitle;
/// <summary>
/// messageBox control.
/// </summary>
@ -96,7 +65,7 @@ namespace WebsitePanel.Portal.ExchangeServer
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox;
/// <summary>
/// btnAddMailboxPlan control.
/// </summary>
@ -105,7 +74,7 @@ namespace WebsitePanel.Portal.ExchangeServer
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnAddMailboxPlan;
/// <summary>
/// gvMailboxPlans control.
/// </summary>
@ -114,7 +83,7 @@ namespace WebsitePanel.Portal.ExchangeServer
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.GridView gvMailboxPlans;
/// <summary>
/// btnSetDefaultMailboxPlan control.
/// </summary>
@ -123,7 +92,7 @@ namespace WebsitePanel.Portal.ExchangeServer
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnSetDefaultMailboxPlan;
/// <summary>
/// secMainTools control.
/// </summary>
@ -132,7 +101,7 @@ namespace WebsitePanel.Portal.ExchangeServer
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secMainTools;
/// <summary>
/// ToolsPanel control.
/// </summary>
@ -141,7 +110,7 @@ namespace WebsitePanel.Portal.ExchangeServer
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel ToolsPanel;
/// <summary>
/// tblMaintenance control.
/// </summary>
@ -150,7 +119,7 @@ namespace WebsitePanel.Portal.ExchangeServer
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTable tblMaintenance;
/// <summary>
/// lblSourcePlan control.
/// </summary>
@ -159,7 +128,7 @@ namespace WebsitePanel.Portal.ExchangeServer
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize lblSourcePlan;
/// <summary>
/// mailboxPlanSelectorSource control.
/// </summary>
@ -168,7 +137,7 @@ namespace WebsitePanel.Portal.ExchangeServer
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.MailboxPlanSelector mailboxPlanSelectorSource;
/// <summary>
/// lblTargetPlan control.
/// </summary>
@ -177,7 +146,7 @@ namespace WebsitePanel.Portal.ExchangeServer
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize lblTargetPlan;
/// <summary>
/// mailboxPlanSelectorTarget control.
/// </summary>
@ -186,7 +155,7 @@ namespace WebsitePanel.Portal.ExchangeServer
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.MailboxPlanSelector mailboxPlanSelectorTarget;
/// <summary>
/// txtStatus control.
/// </summary>
@ -195,7 +164,7 @@ namespace WebsitePanel.Portal.ExchangeServer
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtStatus;
/// <summary>
/// btnSave control.
/// </summary>
@ -204,7 +173,7 @@ namespace WebsitePanel.Portal.ExchangeServer
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnSave;
/// <summary>
/// FormComments control.
/// </summary>

View file

@ -112,16 +112,16 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="locKB.Text" xml:space="preserve">
<value>KB</value>
</data>
<data name="valRequireCorrectNumber.ErrorMessage" xml:space="preserve">
<value>Please enter correct number. The number should be positive. Empty value = "Unlimited".</value>
<value>Please enter correct number. The number should be positive. Percentage should be between 0 and 100. Empty value = "Unlimited".</value>
</data>
<data name="valRequireCorrectNumber.Text" xml:space="preserve">
<value />

View file

@ -41,7 +41,15 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
{
public partial class DaysBox : System.Web.UI.UserControl
{
public string ValidationGroup
int emptyValue = -1;
public int EmptyValue
{
get { return emptyValue; }
set { emptyValue = value; }
}
public string ValidationGroup
{
get { return valRequireCorrectNumber.ValidationGroup; }
set { valRequireCorrectNumber.ValidationGroup = valRequireNumber.ValidationGroup = value; }
@ -58,18 +66,25 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
}
}
public bool RequireValidatorEnabled
{
get { return valRequireNumber.Enabled; }
set { valRequireNumber.Enabled = value; }
}
public int ValueDays
{
get
{
string val = txtValue.Text.Trim();
return Utils.ParseInt(val, 0);
}
set
{
txtValue.Text = value.ToString();
}
}
get
{
string val = txtValue.Text.Trim();
return val == "" ? emptyValue : Utils.ParseInt(val, 0);
}
set
{
txtValue.Text = value == emptyValue ? "" : value.ToString();
}
}
protected void Page_Load(object sender, EventArgs e)
{

View file

@ -18,4 +18,4 @@
<asp:RequiredFieldValidator ID="valRequireNumber" runat="server" meta:resourcekey="valRequireNumber" Enabled="false"
ErrorMessage="Please enter value" ControlToValidate="txtValue" Display="None" SetFocusOnError="True"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="valRequireCorrectNumber" runat="server" meta:resourcekey="valRequireCorrectNumber"
ErrorMessage="Enter correct number" ControlToValidate="txtValue" Display="None" ValidationExpression="[0-9]{0,15}" SetFocusOnError="True"></asp:RegularExpressionValidator>
ErrorMessage="Enter correct number" ControlToValidate="txtValue" Display="None" SetFocusOnError="True"></asp:RegularExpressionValidator>

View file

@ -78,24 +78,38 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
public bool DisplayUnitsKB
{
get { return locKB.Visible; }
set { locKB.Visible = value; }
set {
locKB.Visible = value;
}
}
public bool DisplayUnitsMB
{
get { return locMB.Visible; }
set { locMB.Visible = value; }
set {
locMB.Visible = value;
}
}
public bool DisplayUnitsPct
{
get { return locPct.Visible; }
set { locPct.Visible = value; }
set {
locPct.Visible = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (locPct.Visible)
{
valRequireCorrectNumber.ValidationExpression = @"(^100)$|^([0-9]{1,2})$";
}
else
valRequireCorrectNumber.ValidationExpression = @"[0-9]{0,15}";
}
}
}

View file

@ -15,19 +15,17 @@
<asp:ImageButton ID="cmdEdit" runat="server" SkinID="EditSmall" CommandName="EditItem" AlternateText="Edit record" CommandArgument='<%# Eval("MailboxPlanId") %>' ></asp:ImageButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Image ID="img2" runat="server" Width="16px" Height="16px" ImageUrl='<%# GetPlanType((int)Eval("MailboxPlanType")) %>' ImageAlign="AbsMiddle" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="gvMailboxPlan">
<ItemStyle Width="70%"></ItemStyle>
<ItemTemplate>
<asp:Label id="lnkDisplayMailboxPlan" runat="server" EnableViewState="true" ><%# Eval("MailboxPlan")%></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="gvMailboxPlanDefault">
<ItemTemplate>
<div style="text-align:center">
<input type="radio" name="DefaultMailboxPlan" value='<%# Eval("MailboxPlanId") %>' <%# IsChecked((bool)Eval("IsDefault")) %> />
</div>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
&nbsp;<asp:ImageButton id="imgDelMailboxPlan" runat="server" Text="Delete" SkinID="ExchangeDelete"
@ -38,10 +36,6 @@
</Columns>
</asp:GridView>
<br />
<div style="text-align: center">
<asp:Button ID="btnSetDefaultMailboxPlan" runat="server" meta:resourcekey="btnSetDefaultMailboxPlan"
Text="Set Default Mailboxplan" CssClass="Button1" OnClick="btnSetDefaultMailboxPlan_Click" />
</div>
<wsp:CollapsiblePanel id="secMailboxPlan" runat="server"
TargetControlID="MailboxPlan" meta:resourcekey="secMailboxPlan" Text="Mailboxplan">
</wsp:CollapsiblePanel>
@ -52,7 +46,8 @@
</td>
<td>
<asp:TextBox ID="txtMailboxPlan" runat="server" CssClass="TextBox200" ></asp:TextBox>
<asp:TextBox ID="txtMailboxPlan" runat="server" CssClass="TextBox200"
ontextchanged="txtMailboxPlan_TextChanged" ></asp:TextBox>
<asp:RequiredFieldValidator ID="valRequireMailboxPlan" runat="server" meta:resourcekey="valRequireMailboxPlan" ControlToValidate="txtMailboxPlan"
ErrorMessage="Enter mailbox plan name" ValidationGroup="CreateMailboxPlan" Display="Dynamic" Text="*" SetFocusOnError="True"></asp:RequiredFieldValidator>
</td>
@ -117,25 +112,25 @@
<tr>
<td class="FormLabel200" align="right"><asp:Localize ID="locMailboxSize" runat="server" meta:resourcekey="locMailboxSize" Text="Mailbox size:"></asp:Localize></td>
<td>
<wsp:SizeBox id="mailboxSize" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="false" DisplayUnitsMB="true" DisplayUnitsPct="false" RequireValidatorEnabled="true"/>
<wsp:SizeBox id="mailboxSize" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="false" DisplayUnitsMB="true" DisplayUnitsPct="false" RequireValidatorEnabled="false"/>
</td>
</tr>
<tr>
<td class="FormLabel200" align="right"><asp:Localize ID="locMaxRecipients" runat="server" meta:resourcekey="locMaxRecipients" Text="Maximum Recipients:"></asp:Localize></td>
<td>
<wsp:SizeBox id="maxRecipients" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="false" DisplayUnitsMB="false" DisplayUnitsPct="false" RequireValidatorEnabled="true"/>
<wsp:SizeBox id="maxRecipients" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="false" DisplayUnitsMB="false" DisplayUnitsPct="false" RequireValidatorEnabled="false"/>
</td>
</tr>
<tr>
<td class="FormLabel200" align="right"><asp:Localize ID="locMaxSendMessageSizeKB" runat="server" meta:resourcekey="locMaxSendMessageSizeKB" Text="Maximum Send Message Size (Kb):"></asp:Localize></td>
<td>
<wsp:SizeBox id="maxSendMessageSizeKB" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="true" DisplayUnitsMB="false" DisplayUnitsPct="false" RequireValidatorEnabled="true"/>
<wsp:SizeBox id="maxSendMessageSizeKB" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="true" DisplayUnitsMB="false" DisplayUnitsPct="false" RequireValidatorEnabled="false"/>
</td>
</tr>
<tr>
<td class="FormLabel200" align="right"><asp:Localize ID="locMaxReceiveMessageSizeKB" runat="server" meta:resourcekey="locMaxReceiveMessageSizeKB" Text="Maximum Receive Message Size (Kb):"></asp:Localize></td>
<td>
<wsp:SizeBox id="maxReceiveMessageSizeKB" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="true" DisplayUnitsMB="false" DisplayUnitsPct="false" RequireValidatorEnabled="true"/>
<wsp:SizeBox id="maxReceiveMessageSizeKB" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="true" DisplayUnitsMB="false" DisplayUnitsPct="false" RequireValidatorEnabled="false"/>
</td>
</tr>
@ -165,37 +160,61 @@
</asp:Panel>
<wsp:CollapsiblePanel id="secDeleteRetention" runat="server"
TargetControlID="DeleteRetention" meta:resourcekey="secDeleteRetention" Text="Delete Item Retention">
<wsp:CollapsiblePanel id="secDeleteRetention" runat="server" TargetControlID="DeleteRetention" meta:resourcekey="secDeleteRetention" Text="Delete Item Retention">
</wsp:CollapsiblePanel>
<asp:Panel ID="DeleteRetention" runat="server" Height="0" style="overflow:hidden;">
<table>
<tr>
<td class="FormLabel200" align="right"><asp:Localize ID="locKeepDeletedItems" runat="server" meta:resourcekey="locKeepDeletedItems" Text="Keep deleted items for:"></asp:Localize></td>
<td>
<wsp:DaysBox id="daysKeepDeletedItems" runat="server" ValidationGroup="CreateMailboxPlan" />
<wsp:DaysBox id="daysKeepDeletedItems" runat="server" ValidationGroup="CreateMailboxPlan" RequireValidatorEnabled="true"/>
</td>
</tr>
</table>
<br />
</asp:Panel>
<br />
<table>
<tr>
<td>
<div class="FormButtonsBarClean">
<asp:Button ID="btnAddMailboxPlan" runat="server" meta:resourcekey="btnAddMailboxPlan"
Text="Add New Mailboxplan" CssClass="Button1" OnClick="btnAddMailboxPlan_Click" />
</div>
</td>
<td>
<div class="FormButtonsBarClean">
<asp:Button ID="btnUpdateMailboxPlan" runat="server" meta:resourcekey="btnUpdateMailboxPlan"
Text="Update Mailboxplan" CssClass="Button1" OnClick="btnUpdateMailboxPlan_Click" />
</td>
</tr>
</table>
<div class="FormButtonsBarClean">
<asp:Button ID="btnAddMailboxPlan" runat="server" meta:resourcekey="btnAddMailboxPlan"
Text="Add New Mailboxplan" CssClass="Button1" OnClick="btnAddMailboxPlan_Click" />
</div>
<br />
<div class="FormButtonsBarClean">
<asp:Button ID="btnAddMailboxPlanToOrganizations" runat="server" meta:resourcekey="btnAddMailboxPlanToOrganizations"
Text="Add Mailbox Plans Template to All Organizations" CssClass="Button1" OnClick="btnAddMailboxPlanToOrganizations_Click" OnClientClick="if (confirm('Plans with an existing name will not be added. \nAre you sure you want to add the plans template to all tenants ?')) ShowProgressDialog('Adding mailbox plans, this might take a while ...'); else return false;"/>
</div>
<wsp:CollapsiblePanel id="secTools" runat="server" TargetControlID="Tools" meta:resourcekey="secTools" Text="Tools">
</wsp:CollapsiblePanel>
<asp:Panel ID="Tools" runat="server" Height="0" style="overflow:hidden;">
<table>
<tr>
<td>
<asp:Button ID="btnStamp" runat="server" meta:resourcekey="btnStamp"
Text="Restamp all mailboxes" CssClass="Button1" OnClick="btnStampClick" OnClientClick="if (confirm('Restamp mailboxes with these plans. \nAre you sure you want to restamp the mailbox plans ?')) ShowProgressDialog('Stamping mailboxes, this might take a while ...'); else return false;"/>
</td>
<td>
<asp:TextBox ID="txtStatus" runat="server" CssClass="TextBox400" MaxLength="128" ReadOnly="true"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnMatchMailboxPlanToUser" runat="server" meta:resourcekey="btnMatchMailboxPlanToUser"
Text="Match Plan to User" CssClass="Button1"
OnClientClick="if (confirm('Mail enabled users with no mailbox plan assigned will get a matching mailbox plan applied.\nMatching takes place on mailbox size and the MAPI properties.\n\nAre you sure you want to continue with this ?')) ShowProgressDialog('Applying mailbox plans, this might take a while ...'); else return false;"
onclick="btnMatchMailboxPlanToUser_Click" />
</td>
</tr>
</table>
<br />
</asp:Panel>
<div class="FormButtonsBarClean">
<asp:Button ID="btnMatchMailboxPlanToUser" runat="server" meta:resourcekey="btnMatchMailboxPlanToUser"
Text="Match Plan to User" CssClass="Button1"
OnClientClick="if (confirm('Mail enabled users with no mailbox plan assigned will get a matching mailbox plan applied.\nMatching takes place on mailbox size and the MAPI properties.\n\nAre you sure you want to continue with this ?')) ShowProgressDialog('Applying mailbox plans, this might take a while ...'); else return false;"
onclick="btnMatchMailboxPlanToUser_Click" />
</div>

View file

@ -53,63 +53,56 @@ namespace WebsitePanel.Portal
public partial class SettingsExchangeMailboxPlansPolicy : WebsitePanelControlBase, IUserSettingsEditorControl
{
internal static List<ExchangeMailboxPlan> list;
public void BindSettings(UserSettings settings)
{
BindMailboxPlans();
if (list == null)
list = new List<ExchangeMailboxPlan>();
if (!string.IsNullOrEmpty(settings[UserSettings.DEFAULT_MAILBOXPLANS]))
{
XmlSerializer serializer = new XmlSerializer(list.GetType());
StringReader reader = new StringReader(settings[UserSettings.DEFAULT_MAILBOXPLANS]);
list = (List<ExchangeMailboxPlan>)serializer.Deserialize(reader);
}
gvMailboxPlans.DataSource = list;
gvMailboxPlans.DataBind();
if (gvMailboxPlans.Rows.Count <= 1)
{
btnSetDefaultMailboxPlan.Enabled = false;
}
else
btnSetDefaultMailboxPlan.Enabled = true;
txtStatus.Visible = false;
}
public string IsChecked(bool val)
private void BindMailboxPlans()
{
return val ? "checked" : "";
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))
{
ExchangeMailboxPlan[] list = ES.Services.ExchangeServer.GetExchangeMailboxPlans(orgs[0].Id);
gvMailboxPlans.DataSource = list;
gvMailboxPlans.DataBind();
}
btnUpdateMailboxPlan.Enabled = (string.IsNullOrEmpty(txtMailboxPlan.Text)) ? false : true;
}
public void btnAddMailboxPlan_Click(object sender, EventArgs e)
{
int count = 0;
if (list != null)
{
foreach (ExchangeMailboxPlan p in list)
{
p.MailboxPlanId = count;
count++;
}
}
Page.Validate("CreateMailboxPlan");
ExchangeMailboxPlan plan = new ExchangeMailboxPlan();
if (!Page.IsValid)
return;
Providers.HostedSolution.ExchangeMailboxPlan plan = new Providers.HostedSolution.ExchangeMailboxPlan();
plan.MailboxPlan = txtMailboxPlan.Text;
plan.MailboxSizeMB = mailboxSize.ValueKB;
if ((plan.MailboxSizeMB == 0)) plan.MailboxSizeMB = 1;
plan.MailboxPlanId = count;
plan.IsDefault = false;
plan.MaxRecipients = maxRecipients.ValueKB;
plan.MaxSendMessageSizeKB = maxSendMessageSizeKB.ValueKB;
@ -128,170 +121,277 @@ namespace WebsitePanel.Portal
plan.KeepDeletedItemsDays = daysKeepDeletedItems.ValueDays;
plan.HideFromAddressBook = chkHideFromAddressBook.Checked;
if (list == null)
list = new List<ExchangeMailboxPlan>();
if (PanelSecurity.SelectedUser.Role == UserRole.Administrator)
plan.MailboxPlanType = (int)ExchangeMailboxPlanType.Administrator;
else
if (PanelSecurity.SelectedUser.Role == UserRole.Reseller)
plan.MailboxPlanType = (int)ExchangeMailboxPlanType.Reseller;
list.Add(plan);
gvMailboxPlans.DataSource = list;
gvMailboxPlans.DataBind();
Providers.HostedSolution.Organization[] orgs = null;
if (gvMailboxPlans.Rows.Count <= 1)
if (PanelSecurity.SelectedUserId != 1)
{
btnSetDefaultMailboxPlan.Enabled = false;
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
btnSetDefaultMailboxPlan.Enabled = true;
{
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(1, false);
}
if ((orgs != null) & (orgs.GetLength(0) > 0))
{
int result = ES.Services.ExchangeServer.AddExchangeMailboxPlan(orgs[0].Id, plan);
if (result < 0)
{
messageBox.ShowResultMessage(result);
return;
}
}
BindMailboxPlans();
}
protected void gvMailboxPlan_RowCommand(object sender, GridViewCommandEventArgs e)
{
int mailboxPlanId = Utils.ParseInt(e.CommandArgument.ToString(), 0);
Providers.HostedSolution.Organization[] orgs = null;
Providers.HostedSolution.ExchangeMailboxPlan plan;
switch (e.CommandName)
{
case "DeleteItem":
foreach (ExchangeMailboxPlan p in list)
try
{
if (p.MailboxPlanId == mailboxPlanId)
if (PanelSecurity.SelectedUserId != 1)
{
list.Remove(p);
break;
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);
}
plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(orgs[0].Id, mailboxPlanId);
if (plan.ItemId != orgs[0].Id)
{
messageBox.ShowErrorMessage("EXCHANGE_UNABLE_USE_SYSTEMPLAN");
BindMailboxPlans();
return;
}
int result = ES.Services.ExchangeServer.DeleteExchangeMailboxPlan(orgs[0].Id, mailboxPlanId);
if (result < 0)
{
messageBox.ShowResultMessage(result);
return;
}
ViewState["MailboxPlanID"] = null;
txtMailboxPlan.Text = string.Empty;
mailboxSize.ValueKB = -1;
maxRecipients.ValueKB = -1;
maxSendMessageSizeKB.ValueKB = -1;
maxReceiveMessageSizeKB.ValueKB = 01;
chkPOP3.Checked = false;
chkIMAP.Checked = false;
chkOWA.Checked = false;
chkMAPI.Checked = false;
chkActiveSync.Checked = false;
sizeIssueWarning.ValueKB = -1;
sizeProhibitSend.ValueKB = -1;
sizeProhibitSendReceive.ValueKB = -1;
daysKeepDeletedItems.ValueDays = -1;
chkHideFromAddressBook.Checked = false;
btnUpdateMailboxPlan.Enabled = (string.IsNullOrEmpty(txtMailboxPlan.Text)) ? false : true;
}
gvMailboxPlans.DataSource = list;
gvMailboxPlans.DataBind();
if (gvMailboxPlans.Rows.Count <= 1)
catch (Exception)
{
btnSetDefaultMailboxPlan.Enabled = false;
messageBox.ShowErrorMessage("EXCHANGE_DELETE_MAILBOXPLAN");
}
else
btnSetDefaultMailboxPlan.Enabled = true;
break;
BindMailboxPlans();
break;
case "EditItem":
foreach (ExchangeMailboxPlan p in list)
{
if (p.MailboxPlanId == mailboxPlanId)
ViewState["MailboxPlanID"] = mailboxPlanId;
if (PanelSecurity.SelectedUserId != 1)
{
PackageInfo[] Packages = ES.Services.Packages.GetPackages(PanelSecurity.SelectedUserId);
txtMailboxPlan.Text = p.MailboxPlan;
mailboxSize.ValueKB = p.MailboxSizeMB;
maxRecipients.ValueKB = p.MaxRecipients;
maxSendMessageSizeKB.ValueKB = p.MaxSendMessageSizeKB;
maxReceiveMessageSizeKB.ValueKB = p.MaxReceiveMessageSizeKB;
chkPOP3.Checked = p.EnablePOP;
chkIMAP.Checked = p.EnableIMAP;
chkOWA.Checked = p.EnableOWA;
chkMAPI.Checked = p.EnableMAPI;
chkActiveSync.Checked = p.EnableActiveSync;
sizeIssueWarning.ValueKB = p.IssueWarningPct;
sizeProhibitSend.ValueKB = p.ProhibitSendPct;
sizeProhibitSendReceive.ValueKB = p.ProhibitSendReceivePct;
daysKeepDeletedItems.ValueDays = p.KeepDeletedItemsDays;
chkHideFromAddressBook.Checked = p.HideFromAddressBook;
break;
if ((Packages != null) & (Packages.GetLength(0) > 0))
{
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Packages[0].PackageId, false);
}
}
}
else
{
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(1, false);
}
plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(orgs[0].Id, mailboxPlanId);
txtMailboxPlan.Text = plan.MailboxPlan;
if (plan.MailboxSizeMB != -1)
mailboxSize.ValueKB = plan.MailboxSizeMB;
if (plan.MaxRecipients != -1)
maxRecipients.ValueKB = plan.MaxRecipients;
if (plan.MaxSendMessageSizeKB != -1)
maxSendMessageSizeKB.ValueKB = plan.MaxSendMessageSizeKB;
if (plan.MaxReceiveMessageSizeKB != -1)
maxReceiveMessageSizeKB.ValueKB = 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;
btnUpdateMailboxPlan.Enabled = (string.IsNullOrEmpty(txtMailboxPlan.Text)) ? false : true;
break;
}
}
protected void btnSetDefaultMailboxPlan_Click(object sender, EventArgs e)
public string GetPlanType(int mailboxPlanType)
{
// get domain
int mailboxPlanId = Utils.ParseInt(Request.Form["DefaultMailboxPlan"], 0);
string imgName = string.Empty;
foreach (ExchangeMailboxPlan p in list)
ExchangeMailboxPlanType planType = (ExchangeMailboxPlanType)mailboxPlanType;
switch (planType)
{
p.IsDefault = false;
}
foreach (ExchangeMailboxPlan p in list)
{
if (p.MailboxPlanId == mailboxPlanId)
{
p.IsDefault = true;
case ExchangeMailboxPlanType.Reseller:
imgName = "company24.png";
break;
case ExchangeMailboxPlanType.Administrator:
imgName = "company24.png";
break;
default:
imgName = "admin_16.png";
break;
}
}
gvMailboxPlans.DataSource = list;
gvMailboxPlans.DataBind();
return GetThemedImage("Exchange/" + imgName);
}
public void SaveSettings(UserSettings settings)
{
XmlSerializer serializer = new XmlSerializer(list.GetType());
StringWriter writer = new StringWriter();
serializer.Serialize(writer, list);
settings[UserSettings.DEFAULT_MAILBOXPLANS] = writer.ToString();
settings["ExchangeMailboxPlansPolicy"] = "";
}
protected void btnAddMailboxPlanToOrganizations_Click(object sender, EventArgs e)
protected void btnUpdateMailboxPlan_Click(object sender, EventArgs e)
{
AddMailboxPlanToOrganizations("ServerAdmin");
}
private void AddMailboxPlanToOrganizations(string serverAdmin)
{
UserInfo ServerAdminInfo = ES.Services.Users.GetUserByUsername(serverAdmin);
if (ViewState["MailboxPlanID"] == null)
return;
if (ServerAdminInfo == null) return;
int mailboxPlanId = (int)ViewState["MailboxPlanID"];
Providers.HostedSolution.Organization[] orgs = null;
Providers.HostedSolution.ExchangeMailboxPlan plan;
UserInfo[] UsersInfo = ES.Services.Users.GetUsers(ServerAdminInfo.UserId, true);
try
if (PanelSecurity.SelectedUserId != 1)
{
foreach (UserInfo ui in UsersInfo)
PackageInfo[] Packages = ES.Services.Packages.GetPackages(PanelSecurity.SelectedUserId);
if ((Packages != null) & (Packages.GetLength(0) > 0))
{
PackageInfo[] Packages = ES.Services.Packages.GetPackages(ui.UserId);
if ((Packages != null) & (Packages.GetLength(0) > 0))
{
foreach (PackageInfo Package in Packages)
{
Providers.HostedSolution.Organization[] orgs = null;
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Package.PackageId, false);
if ((orgs != null) & (orgs.GetLength(0) > 0))
{
foreach (Organization org in orgs)
{
if (!string.IsNullOrEmpty(org.GlobalAddressList))
{
ExchangeMailboxPlan[] plans = ES.Services.ExchangeServer.GetExchangeMailboxPlans(org.Id);
foreach (ExchangeMailboxPlan p in list)
{
if (!PlanExists(p, plans)) ES.Services.ExchangeServer.AddExchangeMailboxPlan(org.Id, p);
}
}
}
}
}
}
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Packages[0].PackageId, false);
}
messageBox.ShowSuccessMessage("EXCHANGE_APPLYPLANTEMPLATE");
}
catch (Exception ex)
else
{
messageBox.ShowErrorMessage("EXCHANGE_APPLYPLANTEMPLATE", ex);
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(1, false);
}
plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(orgs[0].Id, mailboxPlanId);
if (plan.ItemId != orgs[0].Id)
{
messageBox.ShowErrorMessage("EXCHANGE_UNABLE_USE_SYSTEMPLAN");
BindMailboxPlans();
return;
}
plan = new Providers.HostedSolution.ExchangeMailboxPlan();
plan.MailboxPlanId = (int)ViewState["MailboxPlanID"];
plan.MailboxPlan = txtMailboxPlan.Text;
plan.MailboxSizeMB = mailboxSize.ValueKB;
plan.IsDefault = false;
plan.MaxRecipients = maxRecipients.ValueKB;
plan.MaxSendMessageSizeKB = maxSendMessageSizeKB.ValueKB;
plan.MaxReceiveMessageSizeKB = maxReceiveMessageSizeKB.ValueKB;
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;
if (PanelSecurity.SelectedUser.Role == UserRole.Administrator)
plan.MailboxPlanType = (int)ExchangeMailboxPlanType.Administrator;
else
if (PanelSecurity.SelectedUser.Role == UserRole.Reseller)
plan.MailboxPlanType = (int)ExchangeMailboxPlanType.Reseller;
if ((orgs != null) & (orgs.GetLength(0) > 0))
{
int result = ES.Services.ExchangeServer.UpdateExchangeMailboxPlan(orgs[0].Id, plan);
if (result < 0)
{
messageBox.ShowErrorMessage("EXCHANGE_UPDATEPLANS");
}
else
{
messageBox.ShowSuccessMessage("EXCHANGE_UPDATEPLANS");
}
}
BindMailboxPlans();
}
private bool PlanExists(ExchangeMailboxPlan plan, ExchangeMailboxPlan[] plans)
{
bool result = false;
@ -388,6 +488,13 @@ namespace WebsitePanel.Portal
ExchangeMailboxPlan p3 = null;
foreach (ExchangeMailboxPlan p2 in pl)
{
if ((p2.MailboxSizeMB == -1) & (mailbox.ProhibitSendReceiveKB == -1))
{
p3 = p2;
break;
}
if (p2.MailboxSizeMB >= (mailbox.ProhibitSendReceiveKB / 1024))
{
if (p3 == null)
@ -403,6 +510,12 @@ namespace WebsitePanel.Portal
{
foreach (ExchangeMailboxPlan p in plans)
{
if ((p.MailboxSizeMB == -1) & (mailbox.ProhibitSendReceiveKB == -1))
{
p3 = p;
break;
}
if (p.MailboxSizeMB >= (mailbox.ProhibitSendReceiveKB / 1024))
{
if (p3 == null)
@ -421,5 +534,66 @@ namespace WebsitePanel.Portal
}
}
protected void txtMailboxPlan_TextChanged(object sender, EventArgs e)
{
btnUpdateMailboxPlan.Enabled = (string.IsNullOrEmpty(txtMailboxPlan.Text)) ? false : true;
}
protected void btnStampClick(object sender, EventArgs e)
{
txtStatus.Visible = true;
try
{
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))
{
ExchangeMailboxPlan[] list = ES.Services.ExchangeServer.GetExchangeMailboxPlans(orgs[0].Id);
foreach (ExchangeMailboxPlan p in list)
{
ExchangeAccount[] Accounts = ES.Services.ExchangeServer.GetExchangeAccountByMailboxPlanId(0, p.MailboxPlanId);
foreach (ExchangeAccount a in Accounts)
{
txtStatus.Text = "Completed";
int result = ES.Services.ExchangeServer.SetExchangeMailboxPlan(a.ItemId, a.AccountId, p.MailboxPlanId);
if (result < 0)
{
BindMailboxPlans();
txtStatus.Text = "Error: " + a.AccountName;
messageBox.ShowErrorMessage("EXCHANGE_STAMPMAILBOXES");
return;
}
}
}
}
messageBox.ShowSuccessMessage("EXCHANGE_STAMPMAILBOXES");
}
catch (Exception ex)
{
messageBox.ShowErrorMessage("EXCHANGE_STAMPMAILBOXES",ex);
}
BindMailboxPlans();
}
}
}

View file

@ -39,15 +39,6 @@ namespace WebsitePanel.Portal {
/// </remarks>
protected global::System.Web.UI.WebControls.GridView gvMailboxPlans;
/// <summary>
/// btnSetDefaultMailboxPlan 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 btnSetDefaultMailboxPlan;
/// <summary>
/// secMailboxPlan control.
/// </summary>
@ -373,13 +364,49 @@ namespace WebsitePanel.Portal {
protected global::System.Web.UI.WebControls.Button btnAddMailboxPlan;
/// <summary>
/// btnAddMailboxPlanToOrganizations control.
/// btnUpdateMailboxPlan 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 btnAddMailboxPlanToOrganizations;
protected global::System.Web.UI.WebControls.Button btnUpdateMailboxPlan;
/// <summary>
/// secTools control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secTools;
/// <summary>
/// Tools 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 Tools;
/// <summary>
/// btnStamp 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 btnStamp;
/// <summary>
/// txtStatus 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.TextBox txtStatus;
/// <summary>
/// btnMatchMailboxPlanToUser control.

View file

@ -11,7 +11,7 @@
</li>
<li>
<asp:HyperLink ID="lnkExchangeMailboxPlansPolicy" runat="server" meta:resourcekey="lnkExchangeMailboxPlansPolicy"
Text="Exchange Mailboxplan Policy" NavigateUrl='<%# GetSettingsLink("ExchangeMailboxPlansPolicy", "SettingsExchangeMailboxPlansPolicy") %>'></asp:HyperLink>
Text="Global Exchange Mailbox Plans" NavigateUrl='<%# GetSettingsLink("ExchangeMailboxPlansPolicy", "SettingsExchangeMailboxPlansPolicy") %>'></asp:HyperLink>
</li>
<li>

View file

@ -1,31 +1,3 @@
// Copyright (c) 2012, 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.