Add new Page for OrganizationDomainNames and remove exchange related items.

This commit is contained in:
Virtuworks 2012-11-14 21:26:20 -05:00
parent 016382b739
commit 3725799d3d
6 changed files with 378 additions and 3 deletions

View file

@ -481,7 +481,8 @@
<Control key="public_folder_mailflow" src="WebsitePanel/ExchangeServer/ExchangePublicFolderMailFlowSettings.ascx" title="ExchangePublicFolderMailFlowSettings" type="View" />
<Control key="public_folder_mailenable" src="WebsitePanel/ExchangeServer/ExchangePublicFolderMailEnable.ascx" title="ExchangePublicFolderMailEnable" type="View" />
<Control key="domains" src="WebsitePanel/ExchangeServer/ExchangeDomainNames.ascx" title="ExchangeDomainNames" type="View" />
<Control key="add_domain" src="WebsitePanel/ExchangeServer/ExchangeAddDomainName.ascx" title="ExchangeAddDomainName" type="View" />
<Control key="org_domains" src="WebsitePanel/ExchangeServer/OrganizationDomainNames.ascx" title="OrganizationDomainNames" type="View" />
<Control key="add_domain" src="WebsitePanel/ExchangeServer/ExchangeAddDomainName.ascx" title="ExchangeAddDomainName" type="View" />
<Control key="domain_records" src="WebsitePanel/ExchangeServer/ExchangeDomainRecords.ascx" title="ExchangeDomainRecords" type="View" />
<Control key="storage_usage" src="WebsitePanel/ExchangeServer/ExchangeStorageUsage.ascx" title="ExchangeStorageUsage" type="View" />
<Control key="storage_usage_details" src="WebsitePanel/ExchangeServer/ExchangeStorageUsageBreakdown.ascx" title="ExchangeStorageUsageBreakdown" type="View" />

View file

@ -0,0 +1,76 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OrganizationDomainNames.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.ExchangeDomainNames" %>
<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %>
<%@ Register Src="UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %>
<%@ Register Src="UserControls/Breadcrumb.ascx" TagName="Breadcrumb" TagPrefix="wsp" %>
<%@ Register Src="../UserControls/QuotaViewer.ascx" TagName="QuotaViewer" TagPrefix="wsp" %>
<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %>
<wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server"/>
<div id="ExchangeContainer">
<div class="Module">
<div class="Header">
<wsp:Breadcrumb id="breadcrumb" runat="server" PageName="Text.PageName" />
</div>
<div class="Left">
<wsp:Menu id="menu" runat="server" SelectedItem="domains" />
</div>
<div class="Content">
<div class="Center">
<div class="Title">
<asp:Image ID="Image1" SkinID="ExchangeDomainName48" runat="server" />
<asp:Localize ID="locTitle" runat="server" meta:resourcekey="locTitle" Text="Domain Names"></asp:Localize>
</div>
<div class="FormBody">
<wsp:SimpleMessageBox id="messageBox" runat="server" />
<div class="FormButtonsBarClean">
<asp:Button ID="btnAddDomain" runat="server" meta:resourcekey="btnAddDomain"
Text="Add New Domain" CssClass="Button1" OnClick="btnAddDomain_Click" />
</div>
<asp:GridView ID="gvDomains" runat="server" AutoGenerateColumns="False"
Width="100%" EmptyDataText="gvDomains" CssSelectorClass="NormalGridView" OnRowCommand="gvDomains_RowCommand">
<Columns>
<asp:TemplateField HeaderText="gvDomainsName">
<ItemStyle Width="50%"></ItemStyle>
<ItemTemplate>
<asp:hyperlink id="lnkEditZone" runat="server" EnableViewState="false"
NavigateUrl='<%# GetDomainRecordsEditUrl(Eval("DomainID").ToString()) %>' Enabled='<%# !(bool)Eval("IsHost") %>'>
<%# Eval("DomainName") %>
</asp:hyperlink>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="gvDomainsDefault">
<ItemTemplate>
<div style="text-align:center">
<input type="radio" name="DefaultDomain" value='<%# Eval("DomainId") %>' <%# IsChecked((bool)Eval("IsDefault")) %> />
</div>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
&nbsp;<asp:ImageButton ID="imgDelDomain" runat="server" Text="Delete" SkinID="ExchangeDelete"
CommandName="DeleteItem" CommandArgument='<%# Eval("DomainId") %>' Visible='<%# !((bool)Eval("IsHost") || (bool)Eval("IsDefault")) %>'
meta:resourcekey="cmdDelete" OnClientClick="return confirm('Are you sure you want to delete selected domain?')"></asp:ImageButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<br />
<div style="text-align: center">
<asp:Button ID="btnSetDefaultDomain" runat="server" meta:resourcekey="btnSetDefaultDomain"
Text="Set Default Domain" CssClass="Button1" OnClick="btnSetDefaultDomain_Click" />
</div>
<br />
<asp:Localize ID="locQuota" runat="server" meta:resourcekey="locQuota" Text="Total Domains Used:"></asp:Localize>
&nbsp;&nbsp;&nbsp;
<wsp:QuotaViewer ID="domainsQuota" runat="server" QuotaTypeId="2" />
</div>
</div>
</div>
</div>
</div>

View file

@ -0,0 +1,148 @@
// 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.
using System;
using System.Web.UI.WebControls;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.Providers.HostedSolution;
namespace WebsitePanel.Portal.ExchangeServer
{
public partial class OrganizationDomainNames : WebsitePanelModuleBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindStats();
// bind domain names
BindDomainNames();
}
}
private void BindStats()
{
// set quotas
OrganizationStatistics stats = ES.Services.Organizations.GetOrganizationStatisticsByOrganization(PanelRequest.ItemID);
OrganizationStatistics tenantStats = ES.Services.Organizations.GetOrganizationStatistics(PanelRequest.ItemID);
domainsQuota.QuotaUsedValue = stats.CreatedDomains;
domainsQuota.QuotaValue = stats.AllocatedDomains;
if (stats.AllocatedDomains != -1) domainsQuota.QuotaAvailable = tenantStats.AllocatedDomains - tenantStats.CreatedDomains;
}
public string GetDomainRecordsEditUrl(string domainId)
{
return EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "domain_records",
"DomainID=" + domainId,
"ItemID=" + PanelRequest.ItemID);
}
private void BindDomainNames()
{
OrganizationDomainName[] list = ES.Services.Organizations.GetOrganizationDomains(PanelRequest.ItemID);
gvDomains.DataSource = list;
gvDomains.DataBind();
//check if organization has only one default domain
if (gvDomains.Rows.Count == 1)
{
btnSetDefaultDomain.Enabled = false;
}
}
public string IsChecked(bool val)
{
return val ? "checked" : "";
}
protected void btnAddDomain_Click(object sender, EventArgs e)
{
btnSetDefaultDomain.Enabled = true;
Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "add_domain",
"SpaceID=" + PanelSecurity.PackageId));
}
protected void gvDomains_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "DeleteItem")
{
// delete domain
int domainId = Utils.ParseInt(e.CommandArgument.ToString(), 0);
try
{
int result = ES.Services.Organizations.DeleteOrganizationDomain(PanelRequest.ItemID, domainId);
if (result < 0)
{
messageBox.ShowResultMessage(result);
return;
}
// rebind domains
BindDomainNames();
BindStats();
}
catch (Exception ex)
{
ShowErrorMessage("EXCHANGE_DELETE_DOMAIN", ex);
}
}
}
protected void btnSetDefaultDomain_Click(object sender, EventArgs e)
{
// get domain
int domainId = Utils.ParseInt(Request.Form["DefaultDomain"], 0);
try
{
int result = ES.Services.Organizations.SetOrganizationDefaultDomain(PanelRequest.ItemID, domainId);
if (result < 0)
{
messageBox.ShowResultMessage(result);
if (BusinessErrorCodes.ERROR_USER_ACCOUNT_DEMO == result)
BindDomainNames();
return;
}
// rebind domains
BindDomainNames();
}
catch (Exception ex)
{
ShowErrorMessage("EXCHANGE_SET_DEFAULT_DOMAIN", ex);
}
}
}
}

View file

@ -0,0 +1,142 @@
// 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.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.Portal.ExchangeServer {
public partial class ExchangeDomainNames {
/// <summary>
/// asyncTasks control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks;
/// <summary>
/// breadcrumb control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Breadcrumb breadcrumb;
/// <summary>
/// menu control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Menu menu;
/// <summary>
/// Image1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// 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>
/// <remarks>
/// Auto-generated field.
/// 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>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox;
/// <summary>
/// btnAddDomain 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 btnAddDomain;
/// <summary>
/// gvDomains 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 gvDomains;
/// <summary>
/// btnSetDefaultDomain 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 btnSetDefaultDomain;
/// <summary>
/// locQuota 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 locQuota;
/// <summary>
/// domainsQuota control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.QuotaViewer domainsQuota;
}
}

View file

@ -168,8 +168,8 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
if (Utils.CheckQouta(Quotas.EXCHANGE2007_MAILBOXES, cntx) == false)
{
if (Utils.CheckQouta(Quotas.ORGANIZATION_DOMAINS, cntx))
organizationGroup.MenuItems.Add(CreateMenuItem("DomainNames", "domains"));
if (CheckQouta(Quotas.ORGANIZATION_DOMAINS, cntx))
organizationGroup.MenuItems.Add(CreateMenuItem("DomainNames", "org_domains"));
}
if (Utils.CheckQouta(Quotas.ORGANIZATION_USERS, cntx))
organizationGroup.MenuItems.Add(CreateMenuItem("Users", "users"));

View file

@ -202,6 +202,13 @@
<Compile Include="Code\ReportingServices\IResourceStorage.cs" />
<Compile Include="Code\ReportingServices\ReportingServicesUtils.cs" />
<Compile Include="Code\UserControls\Tab.cs" />
<Compile Include="ExchangeServer\OrganizationDomainNames.ascx.cs">
<DependentUpon>OrganizationDomainNames.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="ExchangeServer\OrganizationDomainNames.ascx.designer.cs">
<DependentUpon>OrganizationDomainNames.ascx</DependentUpon>
</Compile>
<Compile Include="ExchangeServer\ExchangeAddMailboxPlan.ascx.cs">
<DependentUpon>ExchangeAddMailboxPlan.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@ -3790,6 +3797,7 @@
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="ExchangeServer\OrganizationDomainNames.ascx" />
<Content Include="ExchangeServer\ExchangeAddMailboxPlan.ascx" />
<Content Include="ServersEditWebPlatformInstaller.ascx" />
<Content Include="ExchangeServer\ExchangeMailboxPlans.ascx" />