Fixed: Create InstantAlias creates pointer records for all websites, Create

InstantAlias only crate pointer records for sites within the specific domain

Fixed: delete instant alias to be ran twice to remove alias

Fixed: Webhosting: Hostname support not enabled: only to show unallocated
domains
This commit is contained in:
robvde 2012-10-17 09:15:11 +04:00
parent 01cab2916a
commit 97e4dce0e5
7 changed files with 111 additions and 48 deletions

View file

@ -5855,6 +5855,61 @@ END
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE type_desc = N'SQL_STORED_PROCEDURE' AND name = N'GetExchangeOrganization')
BEGIN
EXEC sp_executesql N'CREATE PROCEDURE [dbo].[GetDomainByNameByPointer]
(
@ActorID int,
@DomainName nvarchar(100),
@IsDomainPointer bit
)
AS
SELECT
D.DomainID,
D.PackageID,
D.ZoneItemID,
D.DomainName,
D.HostingAllowed,
ISNULL(D.WebSiteID, 0) AS WebSiteID,
WS.ItemName AS WebSiteName,
ISNULL(D.MailDomainID, 0) AS MailDomainID,
MD.ItemName AS MailDomainName,
Z.ItemName AS ZoneName,
D.IsSubDomain,
D.IsInstantAlias,
D.IsDomainPointer
FROM Domains AS D
INNER JOIN Packages AS P ON D.PackageID = P.PackageID
LEFT OUTER JOIN ServiceItems AS WS ON D.WebSiteID = WS.ItemID
LEFT OUTER JOIN ServiceItems AS MD ON D.MailDomainID = MD.ItemID
LEFT OUTER JOIN ServiceItems AS Z ON D.ZoneItemID = Z.ItemID
WHERE
D.DomainName = @DomainName
AND D.IsDomainPointer = @IsDomainPointer
AND dbo.CheckActorPackageRights(@ActorID, P.PackageID) = 1
RETURN'
END
GO

View file

@ -793,6 +793,16 @@ namespace WebsitePanel.EnterpriseServer
new SqlParameter("@domainName", domainName));
}
public static IDataReader GetDomainByNameByPointer(int actorId, string domainName, bool isDomainPointer)
{
return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure,
ObjectQualifier + "GetDomainByNameByPointer",
new SqlParameter("@ActorId", actorId),
new SqlParameter("@domainName", domainName),
new SqlParameter("@isDomainPointer", isDomainPointer));
}
public static DataSet GetDomainsByZoneId(int actorId, int zoneId)
{
return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure,

View file

@ -1677,6 +1677,13 @@ namespace WebsitePanel.EnterpriseServer
DataProvider.GetDomainByName(SecurityContext.User.UserId, domainName));
}
public static DomainInfo GetDomainItem(string domainName, bool IsDomainPointer)
{
return ObjectUtils.FillObjectFromDataReader<DomainInfo>(
DataProvider.GetDomainByNameByPointer(SecurityContext.User.UserId, domainName, IsDomainPointer));
}
public static string GetDomainAlias(int packageId, string domainName)
{
// load package settings
@ -2212,14 +2219,19 @@ namespace WebsitePanel.EnterpriseServer
}
// add web site pointer if required
List<WebSite> sites = WebServerController.GetWebSites(domain.PackageId, false);
foreach (WebSite w in sites)
List<DomainInfo> domains = GetDomainsByZoneId(domain.ZoneItemId);
foreach (DomainInfo d in domains)
{
WebServerController.AddWebSitePointer( w.Id,
if (d.WebSiteId > 0)
{
WebSite w = WebServerController.GetWebSite(d.WebSiteId);
WebServerController.AddWebSitePointer(d.WebSiteId,
(w.Name.Replace("." + domain.ZoneName, "") == domain.ZoneName) ? "" : w.Name.Replace("." + domain.ZoneName, ""),
instantAlias.DomainId);
}
}
}
// add mail domain pointer
if (domain.MailDomainId > 0 && instantAlias.MailDomainId == 0)
@ -2259,7 +2271,7 @@ namespace WebsitePanel.EnterpriseServer
try
{
// load instant alias domain
DomainInfo instantAlias = GetDomainItem(domain.InstantAliasName);
DomainInfo instantAlias = GetDomainItem(domain.InstantAliasName, false);
if (instantAlias == null)
return 0;

View file

@ -5,12 +5,18 @@
</configSections>
<!-- Connection strings -->
<connectionStrings>
<add name="EnterpriseServer" connectionString="Server=(local)\SQLExpress;Database=WebsitePanel;uid=sa;pwd=Password12" providerName="System.Data.SqlClient" />
<!--
<add name="EnterpriseServer" connectionString="server=HSTPROV01;database=WebsitePanelMerge;uid=WebsitePanel;pwd=aj7ep6fyhmw3b5qeth7c;" />
<add name="EnterpriseServer" connectionString="server=HSTWSP01;database=WebsitePanelMerge;uid=WebsitePanel;pwd=pserxfbnlc6hwmdedbp0;" providerName="System.Data.SqlClient" />
-->
<add name="EnterpriseServer" connectionString="server=HSTWSP01;database=WebsitePanelMerge;uid=WebsitePanel;pwd=pserxfbnlc6hwmdedbp0;" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<!-- Encryption util settings -->
<add key="WebsitePanel.CryptoKey" value="1234567890" />
<!-- A1D4KDHUE83NKHddF -->
<!--
<add key="WebsitePanel.CryptoKey" value="3x7eqt7zabc5n5afs6dg" />
<add key="WebsitePanel.CryptoKey" value="fr2ym4wn2gmbrj7dz336" />
-->
<add key="WebsitePanel.CryptoKey" value="fr2ym4wn2gmbrj7dz336" />
<add key="WebsitePanel.EncryptionEnabled" value="true" />
<!-- Web Applications -->
<add key="WebsitePanel.EnterpriseServer.WebApplicationsPath" value="~/WebApplications" />

View file

@ -19,7 +19,7 @@
</p>
<p id="SubDomainPanel" runat="server" style="padding: 15px 0 15px 5px;" visible="false">
<asp:TextBox ID="SubDomainName" runat="server" Width="150" CssClass="HugeTextBox"></asp:TextBox>
<asp:TextBox ID="SubDomainName" runat="server" Width="150" CssClass="TextBox100"></asp:TextBox>
.
<asp:DropDownList ID="DomainsList" Runat="server" CssClass="NormalTextBox" DataTextField="DomainName" DataValueField="DomainName"></asp:DropDownList>
<asp:RequiredFieldValidator id="SubDomainRequiredValidator" runat="server" meta:resourcekey="SubDomainRequiredValidator"

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.

View file

@ -110,9 +110,23 @@ namespace WebsitePanel.Portal
DomainInfo[] domains = ES.Services.Servers.GetMyDomains(PackageId);
WebSite[] sites = null;
Hashtable htSites = new Hashtable();
if (HideWebSites)
{
sites = ES.Services.WebServers.GetWebSites(PackageId, false);
foreach (WebSite w in sites)
{
if (htSites[w.Name.ToLower()] == null) htSites.Add(w.Name.ToLower(), 1);
DomainInfo[] pointers = ES.Services.WebServers.GetWebSitePointers(w.Id);
foreach (DomainInfo p in pointers)
{
if (htSites[p.DomainName.ToLower()] == null) htSites.Add(p.DomainName.ToLower(), 1);
}
}
}
ddlDomains.Items.Clear();
// add "select" item
@ -128,17 +142,11 @@ namespace WebsitePanel.Portal
}
else
{
bool bFound = false;
foreach (WebSite w in sites)
if (htSites != null)
{
if (w.Name.ToLower() == domain.DomainName.ToLower())
{
bFound = true;
break;
if (htSites[domain.DomainName.ToLower()] != null) continue;
}
}
if (bFound) continue;
}
}
else if (HideInstantAlias && domain.IsInstantAlias)
continue;