DNS SRV Record support. Only supported with MS DNS Provider

This commit is contained in:
robvde 2012-07-04 13:18:58 +04:00
parent a327e27e15
commit 452fcb7f47
28 changed files with 6890 additions and 4002 deletions

View file

@ -1 +0,0 @@
INSERT INTO Quotas (QuotaID, GroupID, QuotaOrder, QuotaName,QuotaDescription, QuotaTypeID, ServiceQuota) VALUES (400, 20, 3, 'HostedSharePoint.UseSharedSSL' ,'Use shared SSL Root', 1, 0)

View file

@ -1174,7 +1174,7 @@ INNER JOIN UsersDetailed AS U ON P.UserID = U.UserID
LEFT OUTER JOIN ServiceItems AS Z ON D.ZoneItemID = Z.ItemID
LEFT OUTER JOIN Services AS S ON Z.ServiceID = S.ServiceID
LEFT OUTER JOIN Servers AS SRV ON S.ServerID = SRV.ServerID
WHERE D.IsInstantAlias = 0 AND
WHERE (D.IsInstantAlias = 0 AND D.IsDomainPointer = 0) AND
((@Recursive = 0 AND D.PackageID = @PackageID)
OR (@Recursive = 1 AND dbo.CheckPackageParent(@PackageID, D.PackageID) = 1))
AND (@ServerID = 0 OR (@ServerID > 0 AND S.ServerID = @ServerID))
@ -3306,6 +3306,7 @@ CREATE PROCEDURE CheckDomain
(
@PackageID int,
@DomainName nvarchar(100),
@IsDomainPointer bit,
@Result int OUTPUT
)
AS
@ -3322,7 +3323,7 @@ SET @Result = 0 -- OK
-- check if the domain already exists
IF EXISTS(
SELECT DomainID FROM Domains
WHERE DomainName = @DomainName
WHERE DomainName = @DomainName AND IsDomainPointer = @IsDomainPointer
)
BEGIN
SET @Result = -1
@ -15772,6 +15773,9 @@ CREATE TABLE [dbo].[GlobalDnsRecords](
[ServerID] [int] NULL,
[PackageID] [int] NULL,
[IPAddressID] [int] NULL,
[SrvPriority] [int] NULL,
[SrvWeight] [int] NULL,
[SrvPort] [int] NULL,
CONSTRAINT [PK_GlobalDnsRecords] PRIMARY KEY CLUSTERED
(
[RecordID] ASC
@ -23347,6 +23351,9 @@ CREATE PROCEDURE UpdateDnsRecord
@RecordName nvarchar(50),
@RecordData nvarchar(500),
@MXPriority int,
@SrvPriority int,
@SrvWeight int,
@SrvPort int,
@IPAddressID int
)
AS
@ -23377,6 +23384,9 @@ SET
RecordName = @RecordName,
RecordData = @RecordData,
MXPriority = @MXPriority,
SrvPriority = @SrvPriority,
SrvWeight = @SrvWeight,
SrvPort = @SrvPort,
IPAddressID = @IPAddressID
WHERE
RecordID = @RecordID
@ -23484,6 +23494,9 @@ SELECT
NR.RecordName,
NR.RecordData,
NR.MXPriority,
NR.SrvPriority,
NR.SrvWeight,
NR.SrvPort,
NR.IPAddressID
FROM
GlobalDnsRecords AS NR
@ -23669,6 +23682,9 @@ CREATE PROCEDURE AddDnsRecord
@RecordName nvarchar(50),
@RecordData nvarchar(500),
@MXPriority int,
@SrvPriority int,
@SrvWeight int,
@SrvPort int,
@IPAddressID int
)
AS
@ -23693,8 +23709,12 @@ IF EXISTS
UPDATE GlobalDnsRecords
SET
RecordData = RecordData,
MXPriority = MXPriority,
RecordData = @RecordData,
MXPriority = @MXPriority,
SrvPriority = @SrvPriority,
SrvWeight = @SrvWeight,
SrvPort = @SrvPort,
IPAddressID = @IPAddressID
WHERE
ServiceID = @ServiceID AND ServerID = @ServerID AND PackageID = @PackageID
@ -23708,6 +23728,9 @@ ELSE
RecordName,
RecordData,
MXPriority,
SrvPriority,
SrvWeight,
SrvPort,
IPAddressID
)
VALUES
@ -23719,6 +23742,9 @@ ELSE
@RecordName,
@RecordData,
@MXPriority,
@SrvPriority,
@SrvWeight,
@SrvPort,
@IPAddressID
)
@ -35697,7 +35723,7 @@ BEGIN
GR.RecordName
FROM GlobalDNSRecords AS GR
WHERE GR.PackageID = @TmpPackageID
AND GR.RecordType COLLATE DATABASE_DEFAULT + GR.RecordName COLLATE DATABASE_DEFAULT NOT IN (SELECT RecordType + RecordName FROM @Records)
AND GR.RecordType + GR.RecordName NOT IN (SELECT RecordType + RecordName FROM @Records)
SET @ParentPackageID = NULL
@ -35725,7 +35751,7 @@ SELECT
GR.RecordName
FROM GlobalDNSRecords AS GR
WHERE GR.ServerID = @ServerID
AND GR.RecordType COLLATE DATABASE_DEFAULT + GR.RecordName COLLATE DATABASE_DEFAULT NOT IN (SELECT RecordType + RecordName FROM @Records)
AND GR.RecordType + GR.RecordName NOT IN (SELECT RecordType + RecordName FROM @Records)
-- select SERVICES DNS records
@ -35739,7 +35765,7 @@ SELECT
GR.RecordName
FROM GlobalDNSRecords AS GR
WHERE GR.ServiceID IN (SELECT ServiceID FROM PackageServices WHERE PackageID = @PackageID)
AND GR.RecordType COLLATE DATABASE_DEFAULT + GR.RecordName COLLATE DATABASE_DEFAULT NOT IN (SELECT RecordType + RecordName FROM @Records)
AND GR.RecordType + GR.RecordName NOT IN (SELECT RecordType + RecordName FROM @Records)
SELECT
@ -35751,12 +35777,16 @@ SELECT
NR.RecordName,
NR.RecordData,
NR.MXPriority,
NR.SrvPriority,
NR.SrvWeight,
NR.SrvPort,
NR.IPAddressID,
ISNULL(IP.ExternalIP, '') AS ExternalIP,
ISNULL(IP.InternalIP, '') AS InternalIP,
CASE
WHEN NR.RecordType = 'A' AND NR.RecordData = '' THEN dbo.GetFullIPAddress(IP.ExternalIP, IP.InternalIP)
WHEN NR.RecordType = 'MX' THEN CONVERT(varchar(3), NR.MXPriority) + ', ' + NR.RecordData
WHEN NR.RecordType = 'SRV' THEN CONVERT(varchar(3), NR.SrvPort) + ', ' + NR.RecordData
ELSE NR.RecordData
END AS FullRecordData,
dbo.GetFullIPAddress(IP.ExternalIP, IP.InternalIP) AS IPAddress
@ -35855,10 +35885,14 @@ SELECT
CASE
WHEN NR.RecordType = 'A' AND NR.RecordData = '' THEN dbo.GetFullIPAddress(IP.ExternalIP, IP.InternalIP)
WHEN NR.RecordType = 'MX' THEN CONVERT(varchar(3), NR.MXPriority) + ', ' + NR.RecordData
WHEN NR.RecordType = 'SRV' THEN CONVERT(varchar(3), NR.SrvPort) + ', ' + NR.RecordData
ELSE NR.RecordData
END AS FullRecordData,
NR.RecordData,
NR.MXPriority,
NR.SrvPriority,
NR.SrvWeight,
NR.SrvPort,
NR.IPAddressID,
dbo.GetFullIPAddress(IP.ExternalIP, IP.InternalIP) AS IPAddress,
IP.ExternalIP,
@ -35958,9 +35992,13 @@ SELECT
CASE
WHEN NR.RecordType = 'A' AND NR.RecordData = '' THEN dbo.GetFullIPAddress(IP.ExternalIP, IP.InternalIP)
WHEN NR.RecordType = 'MX' THEN CONVERT(varchar(3), NR.MXPriority) + ', ' + NR.RecordData
WHEN NR.RecordType = 'SRV' THEN CONVERT(varchar(3), NR.SrvPort) + ', ' + NR.RecordData
ELSE NR.RecordData
END AS FullRecordData,
NR.MXPriority,
NR.SrvPriority,
NR.SrvWeight,
NR.SrvPort,
NR.IPAddressID,
dbo.GetFullIPAddress(IP.ExternalIP, IP.InternalIP) AS IPAddress,
IP.ExternalIP,
@ -36005,6 +36043,7 @@ RETURN
GO
@ -36062,10 +36101,14 @@ SELECT
NR.RecordName,
NR.RecordData,
NR.MXPriority,
NR.SrvPriority,
NR.SrvWeight,
NR.SrvPort,
NR.IPAddressID,
CASE
WHEN NR.RecordType = 'A' AND NR.RecordData = '' THEN dbo.GetFullIPAddress(IP.ExternalIP, IP.InternalIP)
WHEN NR.RecordType = 'MX' THEN CONVERT(varchar(3), NR.MXPriority) + ', ' + NR.RecordData
WHEN NR.RecordType = 'SRV' THEN CONVERT(varchar(3), NR.SrvPort) + ', ' + NR.RecordData
ELSE NR.RecordData
END AS FullRecordData,
dbo.GetFullIPAddress(IP.ExternalIP, IP.InternalIP) AS IPAddress,

View file

@ -854,3 +854,656 @@ BEGIN
INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (63, N'AdminPassword', N'')
END
GO
ALTER TABLE [dbo].[GlobalDnsRecords] ADD
[SrvPriority] [int] NULL,
[SrvWeight] [int] NULL,
[SrvPort] [int] NULL
GO
ALTER PROCEDURE [dbo].[AddDnsRecord]
(
@ActorID int,
@ServiceID int,
@ServerID int,
@PackageID int,
@RecordType nvarchar(10),
@RecordName nvarchar(50),
@RecordData nvarchar(500),
@MXPriority int,
@SrvPriority int,
@SrvWeight int,
@SrvPort int,
@IPAddressID int
)
AS
IF (@ServiceID > 0 OR @ServerID > 0) AND dbo.CheckIsUserAdmin(@ActorID) = 0
RAISERROR('You should have administrator role to perform such operation', 16, 1)
IF (@PackageID > 0) AND dbo.CheckActorPackageRights(@ActorID, @PackageID) = 0
RAISERROR('You are not allowed to access this package', 16, 1)
IF @ServiceID = 0 SET @ServiceID = NULL
IF @ServerID = 0 SET @ServerID = NULL
IF @PackageID = 0 SET @PackageID = NULL
IF @IPAddressID = 0 SET @IPAddressID = NULL
IF EXISTS
(
SELECT RecordID FROM GlobalDnsRecords WHERE
ServiceID = @ServiceID AND ServerID = @ServerID AND PackageID = @PackageID
AND RecordName = @RecordName AND RecordType = @RecordType
)
UPDATE GlobalDnsRecords
SET
RecordData = RecordData,
MXPriority = MXPriority,
SrvPriority = SrvPriority,
SrvWeight = SrvWeight,
SrvPort = SrvPort,
IPAddressID = @IPAddressID
WHERE
ServiceID = @ServiceID AND ServerID = @ServerID AND PackageID = @PackageID
ELSE
INSERT INTO GlobalDnsRecords
(
ServiceID,
ServerID,
PackageID,
RecordType,
RecordName,
RecordData,
MXPriority,
SrvPriority,
SrvWeight,
SrvPort,
IPAddressID
)
VALUES
(
@ServiceID,
@ServerID,
@PackageID,
@RecordType,
@RecordName,
@RecordData,
@MXPriority,
@SrvPriority,
@SrvWeight,
@SrvPort,
@IPAddressID
)
RETURN
GO
ALTER PROCEDURE [dbo].[CheckDomain]
(
@PackageID int,
@DomainName nvarchar(100),
@IsDomainPointer bit,
@Result int OUTPUT
)
AS
/*
@Result values:
0 - OK
-1 - already exists
-2 - sub-domain of prohibited domain
*/
SET @Result = 0 -- OK
-- check if the domain already exists
IF EXISTS(
SELECT DomainID FROM Domains
WHERE DomainName = @DomainName AND IsDomainPointer = @IsDomainPointer
)
BEGIN
SET @Result = -1
RETURN
END
-- check if this is a sub-domain of other domain
-- that is not allowed for 3rd level hosting
DECLARE @UserID int
SELECT @UserID = UserID FROM Packages
WHERE PackageID = @PackageID
-- find sub-domains
DECLARE @DomainUserID int, @HostingAllowed bit
SELECT
@DomainUserID = P.UserID,
@HostingAllowed = D.HostingAllowed
FROM Domains AS D
INNER JOIN Packages AS P ON D.PackageID = P.PackageID
WHERE CHARINDEX('.' + DomainName, @DomainName) > 0
AND (CHARINDEX('.' + DomainName, @DomainName) + LEN('.' + DomainName)) = LEN(@DomainName) + 1
-- this is a domain of other user
IF @UserID <> @DomainUserID AND @HostingAllowed = 0
BEGIN
SET @Result = -2
RETURN
END
RETURN
GO
ALTER PROCEDURE [dbo].[GetDnsRecord]
(
@ActorID int,
@RecordID int
)
AS
-- check rights
DECLARE @ServiceID int, @ServerID int, @PackageID int
SELECT
@ServiceID = ServiceID,
@ServerID = ServerID,
@PackageID = PackageID
FROM GlobalDnsRecords
WHERE
RecordID = @RecordID
IF (@ServiceID > 0 OR @ServerID > 0) AND dbo.CheckIsUserAdmin(@ActorID) = 0
RAISERROR('You are not allowed to perform this operation', 16, 1)
IF (@PackageID > 0) AND dbo.CheckActorPackageRights(@ActorID, @PackageID) = 0
RAISERROR('You are not allowed to access this package', 16, 1)
SELECT
NR.RecordID,
NR.ServiceID,
NR.ServerID,
NR.PackageID,
NR.RecordType,
NR.RecordName,
NR.RecordData,
NR.MXPriority,
NR.SrvPriority,
NR.SrvWeight,
NR.SrvPort,
NR.IPAddressID
FROM
GlobalDnsRecords AS NR
WHERE NR.RecordID = @RecordID
RETURN
GO
ALTER PROCEDURE [dbo].[GetDnsRecordsByPackage]
(
@ActorID int,
@PackageID int
)
AS
-- check rights
IF dbo.CheckActorPackageRights(@ActorID, @PackageID) = 0
RAISERROR('You are not allowed to access this package', 16, 1)
SELECT
NR.RecordID,
NR.ServiceID,
NR.ServerID,
NR.PackageID,
NR.RecordType,
NR.RecordName,
NR.RecordData,
NR.MXPriority,
NR.SrvPriority,
NR.SrvWeight,
NR.SrvPort,
NR.IPAddressID,
CASE
WHEN NR.RecordType = 'A' AND NR.RecordData = '' THEN dbo.GetFullIPAddress(IP.ExternalIP, IP.InternalIP)
WHEN NR.RecordType = 'MX' THEN CONVERT(varchar(3), NR.MXPriority) + ', ' + NR.RecordData
WHEN NR.RecordType = 'SRV' THEN CONVERT(varchar(3), NR.SrvPort) + ', ' + NR.RecordData
ELSE NR.RecordData
END AS FullRecordData,
dbo.GetFullIPAddress(IP.ExternalIP, IP.InternalIP) AS IPAddress,
IP.ExternalIP,
IP.InternalIP
FROM
GlobalDnsRecords AS NR
LEFT OUTER JOIN IPAddresses AS IP ON NR.IPAddressID = IP.AddressID
WHERE NR.PackageID = @PackageID
RETURN
GO
USE [WebsitePanel]
GO
/****** Object: StoredProcedure [dbo].[GetDnsRecordsByServer] Script Date: 06/01/2011 23:42:41 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[GetDnsRecordsByServer]
(
@ActorID int,
@ServerID int
)
AS
SELECT
NR.RecordID,
NR.ServiceID,
NR.ServerID,
NR.PackageID,
NR.RecordType,
NR.RecordName,
NR.RecordData,
CASE
WHEN NR.RecordType = 'A' AND NR.RecordData = '' THEN dbo.GetFullIPAddress(IP.ExternalIP, IP.InternalIP)
WHEN NR.RecordType = 'MX' THEN CONVERT(varchar(3), NR.MXPriority) + ', ' + NR.RecordData
WHEN NR.RecordType = 'SRV' THEN CONVERT(varchar(3), NR.SrvPort) + ', ' + NR.RecordData
ELSE NR.RecordData
END AS FullRecordData,
NR.MXPriority,
NR.SrvPriority,
NR.SrvWeight,
NR.SrvPort,
NR.IPAddressID,
dbo.GetFullIPAddress(IP.ExternalIP, IP.InternalIP) AS IPAddress,
IP.ExternalIP,
IP.InternalIP
FROM
GlobalDnsRecords AS NR
LEFT OUTER JOIN IPAddresses AS IP ON NR.IPAddressID = IP.AddressID
WHERE
NR.ServerID = @ServerID
RETURN
GO
ALTER PROCEDURE [dbo].[GetDnsRecordsByService]
(
@ActorID int,
@ServiceID int
)
AS
SELECT
NR.RecordID,
NR.ServiceID,
NR.ServerID,
NR.PackageID,
NR.RecordType,
NR.RecordName,
CASE
WHEN NR.RecordType = 'A' AND NR.RecordData = '' THEN dbo.GetFullIPAddress(IP.ExternalIP, IP.InternalIP)
WHEN NR.RecordType = 'MX' THEN CONVERT(varchar(3), NR.MXPriority) + ', ' + NR.RecordData
WHEN NR.RecordType = 'SRV' THEN CONVERT(varchar(3), NR.SrvPort) + ', ' + NR.RecordData
ELSE NR.RecordData
END AS FullRecordData,
NR.RecordData,
NR.MXPriority,
NR.SrvPriority,
NR.SrvWeight,
NR.SrvPort,
NR.IPAddressID,
dbo.GetFullIPAddress(IP.ExternalIP, IP.InternalIP) AS IPAddress,
IP.ExternalIP,
IP.InternalIP
FROM
GlobalDnsRecords AS NR
LEFT OUTER JOIN IPAddresses AS IP ON NR.IPAddressID = IP.AddressID
WHERE
NR.ServiceID = @ServiceID
RETURN
GO
ALTER PROCEDURE [dbo].[GetDnsRecordsTotal]
(
@ActorID int,
@PackageID int
)
AS
-- check rights
IF dbo.CheckActorPackageRights(@ActorID, @PackageID) = 0
RAISERROR('You are not allowed to access this package', 16, 1)
-- create temp table for DNS records
DECLARE @Records TABLE
(
RecordID int,
RecordType nvarchar(10) COLLATE DATABASE_DEFAULT,
RecordName nvarchar(50) COLLATE DATABASE_DEFAULT
)
-- select PACKAGES DNS records
DECLARE @ParentPackageID int, @TmpPackageID int
SET @TmpPackageID = @PackageID
WHILE 10 = 10
BEGIN
-- get DNS records for the current package
INSERT INTO @Records (RecordID, RecordType, RecordName)
SELECT
GR.RecordID,
GR.RecordType,
GR.RecordName
FROM GlobalDNSRecords AS GR
WHERE GR.PackageID = @TmpPackageID
AND GR.RecordType + GR.RecordName NOT IN (SELECT RecordType + RecordName FROM @Records)
SET @ParentPackageID = NULL
-- get parent package
SELECT
@ParentPackageID = ParentPackageID
FROM Packages
WHERE PackageID = @TmpPackageID
IF @ParentPackageID IS NULL -- the last parent
BREAK
SET @TmpPackageID = @ParentPackageID
END
-- select SERVER DNS records
DECLARE @ServerID int
SELECT @ServerID = ServerID FROM Packages
WHERE PackageID = @PackageID
INSERT INTO @Records (RecordID, RecordType, RecordName)
SELECT
GR.RecordID,
GR.RecordType,
GR.RecordName
FROM GlobalDNSRecords AS GR
WHERE GR.ServerID = @ServerID
AND GR.RecordType + GR.RecordName NOT IN (SELECT RecordType + RecordName FROM @Records)
-- select SERVICES DNS records
-- re-distribute package services
EXEC DistributePackageServices @ActorID, @PackageID
INSERT INTO @Records (RecordID, RecordType, RecordName)
SELECT
GR.RecordID,
GR.RecordType,
GR.RecordName
FROM GlobalDNSRecords AS GR
WHERE GR.ServiceID IN (SELECT ServiceID FROM PackageServices WHERE PackageID = @PackageID)
AND GR.RecordType + GR.RecordName NOT IN (SELECT RecordType + RecordName FROM @Records)
SELECT
NR.RecordID,
NR.ServiceID,
NR.ServerID,
NR.PackageID,
NR.RecordType,
NR.RecordName,
NR.RecordData,
NR.MXPriority,
NR.SrvPriority,
NR.SrvWeight,
NR.SrvPort,
NR.IPAddressID,
ISNULL(IP.ExternalIP, '') AS ExternalIP,
ISNULL(IP.InternalIP, '') AS InternalIP,
CASE
WHEN NR.RecordType = 'A' AND NR.RecordData = '' THEN dbo.GetFullIPAddress(IP.ExternalIP, IP.InternalIP)
WHEN NR.RecordType = 'MX' THEN CONVERT(varchar(3), NR.MXPriority) + ', ' + NR.RecordData
WHEN NR.RecordType = 'SRV' THEN CONVERT(varchar(3), NR.SrvPort) + ', ' + NR.RecordData
ELSE NR.RecordData
END AS FullRecordData,
dbo.GetFullIPAddress(IP.ExternalIP, IP.InternalIP) AS IPAddress
FROM @Records AS TR
INNER JOIN GlobalDnsRecords AS NR ON TR.RecordID = NR.RecordID
LEFT OUTER JOIN IPAddresses AS IP ON NR.IPAddressID = IP.AddressID
RETURN
GO
ALTER PROCEDURE [dbo].[GetDomainsPaged]
(
@ActorID int,
@PackageID int,
@ServerID int,
@Recursive bit,
@FilterColumn nvarchar(50) = '',
@FilterValue nvarchar(50) = '',
@SortColumn nvarchar(50),
@StartRow int,
@MaximumRows int
)
AS
SET NOCOUNT ON
-- check rights
IF dbo.CheckActorPackageRights(@ActorID, @PackageID) = 0
RAISERROR('You are not allowed to access this package', 16, 1)
-- build query and run it to the temporary table
DECLARE @sql nvarchar(2000)
IF @SortColumn = '' OR @SortColumn IS NULL
SET @SortColumn = 'DomainName'
SET @sql = '
DECLARE @Domains TABLE
(
ItemPosition int IDENTITY(1,1),
DomainID int
)
INSERT INTO @Domains (DomainID)
SELECT
D.DomainID
FROM Domains AS D
INNER JOIN Packages AS P ON D.PackageID = P.PackageID
INNER JOIN UsersDetailed AS U ON P.UserID = U.UserID
LEFT OUTER JOIN ServiceItems AS Z ON D.ZoneItemID = Z.ItemID
LEFT OUTER JOIN Services AS S ON Z.ServiceID = S.ServiceID
LEFT OUTER JOIN Servers AS SRV ON S.ServerID = SRV.ServerID
WHERE (D.IsInstantAlias = 0 AND D.IsDomainPointer = 0) AND
((@Recursive = 0 AND D.PackageID = @PackageID)
OR (@Recursive = 1 AND dbo.CheckPackageParent(@PackageID, D.PackageID) = 1))
AND (@ServerID = 0 OR (@ServerID > 0 AND S.ServerID = @ServerID))
'
IF @FilterColumn <> '' AND @FilterValue <> ''
SET @sql = @sql + ' AND ' + @FilterColumn + ' LIKE @FilterValue '
IF @SortColumn <> '' AND @SortColumn IS NOT NULL
SET @sql = @sql + ' ORDER BY ' + @SortColumn + ' '
SET @sql = @sql + ' SELECT COUNT(DomainID) FROM @Domains;SELECT
D.DomainID,
D.PackageID,
D.ZoneItemID,
D.DomainName,
D.HostingAllowed,
ISNULL(WS.ItemID, 0) AS WebSiteID,
WS.ItemName AS WebSiteName,
ISNULL(MD.ItemID, 0) AS MailDomainID,
MD.ItemName AS MailDomainName,
D.IsSubDomain,
D.IsInstantAlias,
D.IsDomainPointer,
-- packages
P.PackageName,
-- server
ISNULL(SRV.ServerID, 0) AS ServerID,
ISNULL(SRV.ServerName, '''') AS ServerName,
ISNULL(SRV.Comments, '''') AS ServerComments,
ISNULL(SRV.VirtualServer, 0) AS VirtualServer,
-- user
P.UserID,
U.Username,
U.FirstName,
U.LastName,
U.FullName,
U.RoleID,
U.Email
FROM @Domains AS SD
INNER JOIN Domains AS D ON SD.DomainID = D.DomainID
INNER JOIN Packages AS P ON D.PackageID = P.PackageID
INNER JOIN UsersDetailed AS U ON P.UserID = U.UserID
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
LEFT OUTER JOIN Services AS S ON Z.ServiceID = S.ServiceID
LEFT OUTER JOIN Servers AS SRV ON S.ServerID = SRV.ServerID
WHERE SD.ItemPosition BETWEEN @StartRow + 1 AND @StartRow + @MaximumRows'
exec sp_executesql @sql, N'@StartRow int, @MaximumRows int, @PackageID int, @FilterValue nvarchar(50), @ServerID int, @Recursive bit',
@StartRow, @MaximumRows, @PackageID, @FilterValue, @ServerID, @Recursive
RETURN
GO
ALTER PROCEDURE [dbo].[UpdateDnsRecord]
(
@ActorID int,
@RecordID int,
@RecordType nvarchar(10),
@RecordName nvarchar(50),
@RecordData nvarchar(500),
@MXPriority int,
@SrvPriority int,
@SrvWeight int,
@SrvPort int,
@IPAddressID int
)
AS
IF @IPAddressID = 0 SET @IPAddressID = NULL
-- check rights
DECLARE @ServiceID int, @ServerID int, @PackageID int
SELECT
@ServiceID = ServiceID,
@ServerID = ServerID,
@PackageID = PackageID
FROM GlobalDnsRecords
WHERE
RecordID = @RecordID
IF (@ServiceID > 0 OR @ServerID > 0) AND dbo.CheckIsUserAdmin(@ActorID) = 0
RAISERROR('You are not allowed to perform this operation', 16, 1)
IF (@PackageID > 0) AND dbo.CheckActorPackageRights(@ActorID, @PackageID) = 0
RAISERROR('You are not allowed to access this package', 16, 1)
-- update record
UPDATE GlobalDnsRecords
SET
RecordType = @RecordType,
RecordName = @RecordName,
RecordData = @RecordData,
MXPriority = @MXPriority,
SrvPriority = @SrvPriority,
SrvWeight = @SrvWeight,
SrvPort = @SrvPort,
IPAddressID = @IPAddressID
WHERE
RecordID = @RecordID
RETURN
GO

View file

@ -36,6 +36,22 @@ namespace WebsitePanel.EnterpriseServer
public class GlobalDnsRecord
{
private int recordId;
private string internalIP;
private string externalIP;
private int recordOrder;
private int groupId;
private int serviceId;
private int serverId;
private int packageId;
private string recordType;
private string recordName;
private string recordData;
private int mxPriority;
private int ipAddressId;
private int srvPriority;
private int srvWeight;
private int srvPort;
public int RecordId
{
@ -43,63 +59,54 @@ namespace WebsitePanel.EnterpriseServer
set { recordId = value; }
}
private int recordOrder;
public int RecordOrder
{
get { return recordOrder; }
set { recordOrder = value; }
}
private int groupId;
public int GroupId
{
get { return groupId; }
set { groupId = value; }
}
private int serviceId;
public int ServiceId
{
get { return serviceId; }
set { serviceId = value; }
}
private int serverId;
public int ServerId
{
get { return serverId; }
set { serverId = value; }
}
private int packageId;
public int PackageId
{
get { return packageId; }
set { packageId = value; }
}
private string recordType;
public string RecordType
{
get { return recordType; }
set { recordType = value; }
}
private string recordName;
public string RecordName
{
get { return recordName; }
set { recordName = value; }
}
private string recordData;
public string RecordData
{
get { return recordData; }
set { recordData = value; }
}
private int mxPriority;
public int MxPriority
{
@ -107,7 +114,6 @@ namespace WebsitePanel.EnterpriseServer
set { mxPriority = value; }
}
private int ipAddressId;
public int IpAddressId
{
@ -115,9 +121,6 @@ namespace WebsitePanel.EnterpriseServer
set { ipAddressId = value; }
}
private string internalIP;
private string externalIP;
public GlobalDnsRecord()
{
}
@ -133,5 +136,24 @@ namespace WebsitePanel.EnterpriseServer
get { return this.externalIP; }
set { this.externalIP = value; }
}
public int SrvPriority
{
get { return srvPriority; }
set { srvPriority = value; }
}
public int SrvWeight
{
get { return srvWeight; }
set { srvWeight = value; }
}
public int SrvPort
{
get { return srvPort; }
set { srvPort = value; }
}
}
}

View file

@ -675,7 +675,7 @@ namespace WebsitePanel.EnterpriseServer
}
public static void AddDnsRecord(int actorId, int serviceId, int serverId, int packageId, string recordType,
string recordName, string recordData, int mxPriority, int ipAddressId)
string recordName, string recordData, int mxPriority, int SrvPriority, int SrvWeight, int SrvPort, int ipAddressId)
{
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
ObjectQualifier + "AddDnsRecord",
@ -687,11 +687,14 @@ namespace WebsitePanel.EnterpriseServer
new SqlParameter("@RecordName", recordName),
new SqlParameter("@RecordData", recordData),
new SqlParameter("@MXPriority", mxPriority),
new SqlParameter("@SrvPriority", SrvPriority),
new SqlParameter("@SrvWeight", SrvWeight),
new SqlParameter("@SrvPort", SrvPort),
new SqlParameter("@IpAddressId", ipAddressId));
}
public static void UpdateDnsRecord(int actorId, int recordId, string recordType,
string recordName, string recordData, int mxPriority, int ipAddressId)
string recordName, string recordData, int mxPriority, int SrvPriority, int SrvWeight, int SrvPort, int ipAddressId)
{
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
ObjectQualifier + "UpdateDnsRecord",
@ -701,9 +704,13 @@ namespace WebsitePanel.EnterpriseServer
new SqlParameter("@RecordName", recordName),
new SqlParameter("@RecordData", recordData),
new SqlParameter("@MXPriority", mxPriority),
new SqlParameter("@SrvPriority", SrvPriority),
new SqlParameter("@SrvWeight", SrvWeight),
new SqlParameter("@SrvPort", SrvPort),
new SqlParameter("@IpAddressId", ipAddressId));
}
public static void DeleteDnsRecord(int actorId, int recordId)
{
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
@ -763,7 +770,7 @@ namespace WebsitePanel.EnterpriseServer
new SqlParameter("@domainName", domainName));
}
public static int CheckDomain(int packageId, string domainName)
public static int CheckDomain(int packageId, string domainName, bool isDomainPointer)
{
SqlParameter prmId = new SqlParameter("@Result", SqlDbType.Int);
prmId.Direction = ParameterDirection.Output;
@ -772,7 +779,8 @@ namespace WebsitePanel.EnterpriseServer
ObjectQualifier + "CheckDomain",
prmId,
new SqlParameter("@packageId", packageId),
new SqlParameter("@domainName", domainName));
new SqlParameter("@domainName", domainName),
new SqlParameter("@isDomainPointer", isDomainPointer));
return Convert.ToInt32(prmId.Value);
}

View file

@ -149,8 +149,7 @@ namespace WebsitePanel.EnterpriseServer
}
// add all other records
zoneRecords.AddRange(
BuildDnsResourceRecords(records, zoneName, ""));
zoneRecords.AddRange(BuildDnsResourceRecords(records, zoneName, ""));
// add zone records
dns.AddZoneRecords(zoneName, zoneRecords.ToArray());
@ -272,8 +271,7 @@ namespace WebsitePanel.EnterpriseServer
return 0;
}
public static List<DnsRecord> BuildDnsResourceRecords(List<GlobalDnsRecord> records,
string domainName, string serviceIP)
public static List<DnsRecord> BuildDnsResourceRecords(List<GlobalDnsRecord> records, string domainName, string serviceIP)
{
List<DnsRecord> zoneRecords = new List<DnsRecord>();
@ -291,6 +289,14 @@ namespace WebsitePanel.EnterpriseServer
if (String.IsNullOrEmpty(rr.RecordData) && !String.IsNullOrEmpty(serviceIP))
rr.RecordData = serviceIP;
}
else if (record.RecordType == "SRV")
{
rr.SrvPriority = record.SrvPriority;
rr.SrvWeight = record.SrvWeight;
rr.SrvPort = record.SrvPort;
rr.RecordText = record.RecordData;
rr.RecordData = record.RecordData;
}
else
{
rr.RecordData = record.RecordData;

View file

@ -74,7 +74,7 @@ namespace WebsitePanel.EnterpriseServer
}
}
int res = ServerController.AddDnsZoneRecord(domainId, recordName, DnsRecordType.A, ip, 0);
int res = ServerController.AddDnsZoneRecord(domainId, recordName, DnsRecordType.A, ip, 0, 0, 0, 0);
if (res != 0)
{
CompleteTask(ret, CrmErrorCodes.CANNOT_CREATE_DNS_ZONE, null,

View file

@ -460,7 +460,7 @@ namespace WebsitePanel.EnterpriseServer
domain.PackageId = packageId;
domain.DomainName = domainName;
domain.HostingAllowed = false;
domainId = ServerController.AddDomain(domain, createInstantAlias);
domainId = ServerController.AddDomain(domain, createInstantAlias, true);
if (domainId < 0)
{
result.Result = domainId;

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012, Outercurve Foundation.
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
@ -1521,7 +1521,8 @@ namespace WebsitePanel.EnterpriseServer
TaskManager.WriteParameter("Data", record.RecordData);
DataProvider.AddDnsRecord(SecurityContext.User.UserId, record.ServiceId, record.ServerId, record.PackageId,
record.RecordType, record.RecordName, record.RecordData, record.MxPriority, record.IpAddressId);
record.RecordType, record.RecordName, record.RecordData, record.MxPriority,
record.SrvPriority, record.SrvWeight, record.SrvPort, record.IpAddressId);
TaskManager.CompleteTask();
@ -1540,7 +1541,8 @@ namespace WebsitePanel.EnterpriseServer
TaskManager.WriteParameter("Data", record.RecordData);
DataProvider.UpdateDnsRecord(SecurityContext.User.UserId, record.RecordId,
record.RecordType, record.RecordName, record.RecordData, record.MxPriority, record.IpAddressId);
record.RecordType, record.RecordName, record.RecordData, record.MxPriority,
record.SrvPriority, record.SrvWeight, record.SrvPort, record.IpAddressId);
TaskManager.CompleteTask();
@ -1571,7 +1573,7 @@ namespace WebsitePanel.EnterpriseServer
#region Domains
public static int CheckDomain(string domainName)
{
int checkDomainResult = DataProvider.CheckDomain(-10, domainName);
int checkDomainResult = DataProvider.CheckDomain(-10, domainName, false);
if (checkDomainResult == -1)
return BusinessErrorCodes.ERROR_DOMAIN_ALREADY_EXISTS;
@ -1677,8 +1679,7 @@ namespace WebsitePanel.EnterpriseServer
}
public static int AddDomainWithProvisioning(int packageId, string domainName, DomainType domainType,
bool createWebSite, int pointWebSiteId, int pointMailDomainId,
bool createDnsZone, bool createInstantAlias, bool allowSubDomains)
bool createWebSite, int pointWebSiteId, int pointMailDomainId, bool createDnsZone, bool createInstantAlias, bool allowSubDomains)
{
// check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
@ -1748,10 +1749,10 @@ namespace WebsitePanel.EnterpriseServer
public static int AddDomain(DomainInfo domain)
{
return AddDomain(domain, false);
return AddDomain(domain, false, false);
}
public static int AddDomain(DomainInfo domain, bool createInstantAlias)
public static int AddDomain(DomainInfo domain, bool createInstantAlias, bool createZone)
{
// check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
@ -1762,7 +1763,7 @@ namespace WebsitePanel.EnterpriseServer
if (packageCheck < 0) return packageCheck;
// add main domain
int domainId = AddDomainInternal(domain.PackageId, domain.DomainName, true,
int domainId = AddDomainInternal(domain.PackageId, domain.DomainName, createZone,
domain.IsSubDomain, false, domain.IsDomainPointer, false);
if (domainId < 0)
@ -1805,7 +1806,7 @@ namespace WebsitePanel.EnterpriseServer
}
// check if the domain already exists
int checkResult = DataProvider.CheckDomain(packageId, domainName);
int checkResult = DataProvider.CheckDomain(packageId, domainName, isDomainPointer);
if (checkResult < 0)
{
@ -1816,15 +1817,18 @@ namespace WebsitePanel.EnterpriseServer
else
return checkResult;
}
/*
if (domainName.ToLower().StartsWith("www."))
return BusinessErrorCodes.ERROR_DOMAIN_STARTS_WWW;
*/
// place log record
TaskManager.StartTask("DOMAIN", "ADD", domainName);
TaskManager.PackageId = packageId;
TaskManager.TaskParameters["CreateZone"] = createDnsZone;
// create DNS zone
int zoneItemId = 0;
if (createDnsZone)
@ -2096,7 +2100,7 @@ namespace WebsitePanel.EnterpriseServer
}
// add web site DNS records
int res = AddWebSiteZoneRecords(domainId);
int res = AddWebSiteZoneRecords("", domainId);
if (res < 0)
return res;
@ -2112,7 +2116,7 @@ namespace WebsitePanel.EnterpriseServer
}
}
private static int AddWebSiteZoneRecords(int domainId)
private static int AddWebSiteZoneRecords(string hostName, int domainId)
{
// load domain
DomainInfo domain = GetDomainItem(domainId);
@ -2126,7 +2130,7 @@ namespace WebsitePanel.EnterpriseServer
return res;
}
public static int CreateDomainInstantAlias(int domainId)
public static int CreateDomainInstantAlias(string hostName, int domainId)
{
// check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo);
@ -2166,7 +2170,7 @@ namespace WebsitePanel.EnterpriseServer
if (webRes < 0)
return webRes;
}
/*
// add mail domain pointer
if (domain.MailDomainId > 0 && instantAlias.MailDomainId == 0)
{
@ -2174,6 +2178,7 @@ namespace WebsitePanel.EnterpriseServer
if (mailRes < 0)
return mailRes;
}
*/
return 0;
}
@ -2214,7 +2219,7 @@ namespace WebsitePanel.EnterpriseServer
if (webRes < 0)
return webRes;
}
/*
// remove from mail domain pointers
if (instantAlias.MailDomainId > 0)
{
@ -2222,6 +2227,7 @@ namespace WebsitePanel.EnterpriseServer
if (mailRes < 0)
return mailRes;
}
*/
// delete instant alias
int res = DeleteDomain(instantAlias.DomainId);
@ -2272,12 +2278,15 @@ namespace WebsitePanel.EnterpriseServer
dt.Columns.Add("RecordName", typeof(string));
dt.Columns.Add("RecordData", typeof(string));
dt.Columns.Add("MxPriority", typeof(int));
dt.Columns.Add("SrvPriority", typeof(int));
dt.Columns.Add("SrvWeight", typeof(int));
dt.Columns.Add("SrvPort", typeof(int));
// add rows
DnsRecord[] records = GetDnsZoneRecords(domainId);
foreach (DnsRecord record in records)
{
dt.Rows.Add(record.RecordType, record.RecordName, record.RecordData, record.MxPriority);
dt.Rows.Add(record.RecordType, record.RecordName, record.RecordData, record.MxPriority, record.SrvPriority, record.SrvWeight, record.SrvPort);
}
return ds;
@ -2299,7 +2308,7 @@ namespace WebsitePanel.EnterpriseServer
}
public static int AddDnsZoneRecord(int domainId, string recordName, DnsRecordType recordType,
string recordData, int mxPriority)
string recordData, int mxPriority, int srvPriority, int srvWeight, int srvPort)
{
// check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
@ -2337,6 +2346,9 @@ namespace WebsitePanel.EnterpriseServer
record.RecordName = recordName;
record.RecordData = recordData;
record.MxPriority = mxPriority;
record.SrvPriority = srvPriority;
record.SrvWeight = srvWeight;
record.SrvPort = srvPort;
dns.AddZoneRecord(zoneItem.Name, record);
return 0;
@ -2353,7 +2365,7 @@ namespace WebsitePanel.EnterpriseServer
public static int UpdateDnsZoneRecord(int domainId,
string originalRecordName, string originalRecordData,
string recordName, DnsRecordType recordType, string recordData, int mxPriority)
string recordName, DnsRecordType recordType, string recordData, int mxPriority, int srvPriority, int srvWeight, int srvPortNumber)
{
// place log record
DomainInfo domain = GetDomain(domainId);
@ -2367,7 +2379,7 @@ namespace WebsitePanel.EnterpriseServer
DeleteDnsZoneRecord(domainId, originalRecordName, recordType, originalRecordData);
// add new record
AddDnsZoneRecord(domainId, recordName, recordType, recordData, mxPriority);
AddDnsZoneRecord(domainId, recordName, recordType, recordData, mxPriority, srvPriority, srvWeight, srvPortNumber);
return 0;
}

View file

@ -346,7 +346,7 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint
}
}
ServerController.AddDnsZoneRecord(domain.DomainId, hostName, DnsRecordType.A, hostedSharePointSettings["RootWebApplicationIpAddress"], 0);
ServerController.AddDnsZoneRecord(domain.DomainId, hostName, DnsRecordType.A, hostedSharePointSettings["RootWebApplicationIpAddress"], 0, 0, 0, 0);
}
}

View file

@ -173,7 +173,7 @@ namespace WebsitePanel.EnterpriseServer
domain.PackageId = createdPackageId;
domain.DomainName = domainName;
domain.HostingAllowed = false;
domainId = ServerController.AddDomain(domain, !tempDomain);
domainId = ServerController.AddDomain(domain, false, !tempDomain);
if (domainId < 0)
{
// rollback wizard

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012, Outercurve Foundation.
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
@ -587,9 +587,9 @@ namespace WebsitePanel.EnterpriseServer
}
[WebMethod]
public int CreateDomainInstantAlias(int domainId)
public int CreateDomainInstantAlias(string hostName, int domainId)
{
return ServerController.CreateDomainInstantAlias(domainId);
return ServerController.CreateDomainInstantAlias(hostName, domainId);
}
[WebMethod]
@ -614,18 +614,18 @@ namespace WebsitePanel.EnterpriseServer
[WebMethod]
public int AddDnsZoneRecord(int domainId, string recordName, DnsRecordType recordType,
string recordData, int mxPriority)
string recordData, int mxPriority, int srvPriority, int srvWeight, int srvPortNumber)
{
return ServerController.AddDnsZoneRecord(domainId, recordName, recordType, recordData, mxPriority);
return ServerController.AddDnsZoneRecord(domainId, recordName, recordType, recordData, mxPriority, srvPriority, srvWeight, srvPortNumber);
}
[WebMethod]
public int UpdateDnsZoneRecord(int domainId,
string originalRecordName, string originalRecordData,
string recordName, DnsRecordType recordType, string recordData, int mxPriority)
string recordName, DnsRecordType recordType, string recordData, int mxPriority, int srvPriority, int srvWeight, int srvPortNumber)
{
return ServerController.UpdateDnsZoneRecord(domainId, originalRecordName, originalRecordData,
recordName, recordType, recordData, mxPriority);
recordName, recordType, recordData, mxPriority, srvPriority, srvWeight, srvPortNumber);
}
[WebMethod]

View file

@ -39,6 +39,10 @@ namespace WebsitePanel.Providers.DNS
private string recordData;
private int mxPriority;
private string recordText;
private int srvPriority;
private int srvWeight;
private int srvPort;
public string RecordName
{
@ -69,5 +73,25 @@ namespace WebsitePanel.Providers.DNS
get { return this.recordText; }
set { this.recordText = value; }
}
public int SrvPriority
{
get { return this.srvPriority; }
set { this.srvPriority = value; }
}
public int SrvWeight
{
get { return this.srvWeight; }
set { this.srvWeight = value; }
}
public int SrvPort
{
get { return this.srvPort; }
set { this.srvPort = value; }
}
}
}

View file

@ -40,6 +40,8 @@ namespace WebsitePanel.Providers.DNS
CNAME,
SOA,
TXT,
SRV,
Other
}
}

View file

@ -138,6 +138,14 @@ namespace WebsitePanel.Providers.DNS
ManagementObjectCollection rrsTXT = wmi.GetWmiObjects("MicrosoftDNS_TXTType", "DomainName='{0}'", zoneName);
ManagementObjectCollection rrsSRV = wmi.GetWmiObjects("MicrosoftDNS_SRVType", "DomainName='{0}'", zoneName);
ManagementObjectCollection rrsSRV_tcp = wmi.GetWmiObjects("MicrosoftDNS_SRVType", "DomainName='_tcp.{0}'", zoneName);
ManagementObjectCollection rrsSRV_udp = wmi.GetWmiObjects("MicrosoftDNS_SRVType", "DomainName='_udp.{0}'", zoneName);
ManagementObjectCollection rrsSRV_tls = wmi.GetWmiObjects("MicrosoftDNS_SRVType", "DomainName='_tls.{0}'", zoneName);
List<DnsRecord> records = new List<DnsRecord>();
DnsRecord record = new DnsRecord();
@ -188,8 +196,58 @@ namespace WebsitePanel.Providers.DNS
records.Add(record);
}
return records.ToArray();
foreach (ManagementObject rr in rrsSRV)
{
record = new DnsRecord();
record.RecordType = DnsRecordType.SRV;
record.RecordName = CorrectHost(zoneName, (string)rr.Properties["OwnerName"].Value);
record.SrvPriority = Convert.ToInt32(rr.Properties["Priority"].Value);
record.SrvWeight = Convert.ToInt32(rr.Properties["Weight"].Value);
record.SrvPort = Convert.ToInt32(rr.Properties["Port"].Value);
record.RecordData = RemoveTrailingDot((string)rr.Properties["SRVDomainName"].Value);
records.Add(record);
}
foreach (ManagementObject rr in rrsSRV_tcp)
{
record = new DnsRecord();
record.RecordType = DnsRecordType.SRV;
record.RecordName = CorrectHost(zoneName, (string)rr.Properties["OwnerName"].Value);
record.SrvPriority = Convert.ToInt32(rr.Properties["Priority"].Value);
record.SrvWeight = Convert.ToInt32(rr.Properties["Weight"].Value);
record.SrvPort = Convert.ToInt32(rr.Properties["Port"].Value);
record.RecordData = RemoveTrailingDot((string)rr.Properties["SRVDomainName"].Value);
records.Add(record);
}
foreach (ManagementObject rr in rrsSRV_udp)
{
record = new DnsRecord();
record.RecordType = DnsRecordType.SRV;
record.RecordName = CorrectHost(zoneName, (string)rr.Properties["OwnerName"].Value);
record.SrvPriority = Convert.ToInt32(rr.Properties["Priority"].Value);
record.SrvWeight = Convert.ToInt32(rr.Properties["Weight"].Value);
record.SrvPort = Convert.ToInt32(rr.Properties["Port"].Value);
record.RecordData = RemoveTrailingDot((string)rr.Properties["SRVDomainName"].Value);
records.Add(record);
}
foreach (ManagementObject rr in rrsSRV_tls)
{
record = new DnsRecord();
record.RecordType = DnsRecordType.SRV;
record.RecordName = CorrectHost(zoneName, (string)rr.Properties["OwnerName"].Value);
record.SrvPriority = Convert.ToInt32(rr.Properties["Priority"].Value);
record.SrvWeight = Convert.ToInt32(rr.Properties["Weight"].Value);
record.SrvPort = Convert.ToInt32(rr.Properties["Port"].Value);
record.RecordData = RemoveTrailingDot((string)rr.Properties["SRVDomainName"].Value);
records.Add(record);
}
return records.ToArray();
}
@ -398,6 +456,9 @@ namespace WebsitePanel.Providers.DNS
AddNsRecord(zoneName, record.RecordName, record.RecordData);
else if (record.RecordType == DnsRecordType.TXT)
AddTxtRecord(zoneName, record.RecordName, record.RecordData);
else if (record.RecordType == DnsRecordType.SRV)
AddSrvRecord(zoneName, record.RecordName, record.SrvPriority, record.SrvWeight, record.SrvPort, record.RecordData);
}
catch (Exception ex)
{
@ -428,6 +489,9 @@ namespace WebsitePanel.Providers.DNS
DeleteNsRecord(zoneName, record.RecordName, record.RecordData);
else if (record.RecordType == DnsRecordType.TXT)
DeleteTxtRecord(zoneName, record.RecordName, record.RecordData);
else if (record.RecordType == DnsRecordType.SRV)
DeleteSrvRecord(zoneName, record.RecordName, record.RecordData);
}
catch (Exception ex)
{
@ -864,6 +928,78 @@ namespace WebsitePanel.Providers.DNS
}
#endregion
#region SRV Record
/// <summary>
///
/// </summary>
/// <param name="zoneName"></param>
/// <param name="host"></param>
/// <param name="mailServer"></param>
/// <param name="mailServerPriority"></param>
/// <remarks>Supports managed resources disposal</remarks>
private void AddSrvRecord(string zoneName, string host, int priority, int weight, int port, string domainName)
{
// add record
using (ManagementClass clsRR = wmi.GetClass("MicrosoftDNS_SRVType"))
{
clsRR.InvokeMethod("CreateInstanceFromPropertyData", new object[] {
GetDnsServerName(),
zoneName,
CorrectHostName(zoneName, host),
1,
MinimumTTL,
priority,
weight,
port,
domainName
});
}
// update SOA record
if (bulkRecords) return;
UpdateSoaRecord(zoneName);
}
/// <summary>
/// Supports managed resources disposal
/// </summary>
/// <param name="zoneName"></param>
/// <param name="host"></param>
/// <param name="mailServer"></param>
private void DeleteSrvRecord(string zoneName, string host, string domainName)
{
string query = string.Empty;
if ((host.Contains("._tcp")) | (host.Contains("._udp")) | (host.Contains("._tls")))
{
query = String.Format("SELECT * FROM MicrosoftDNS_SRVType " +
"WHERE ContainerName = '{0}' AND OwnerName ='{1}.{0}'",
zoneName, CorrectHostName(zoneName, host));
}
else
{
query = String.Format("SELECT * FROM MicrosoftDNS_SRVType " +
"WHERE ContainerName = '{0}' AND OwnerName ='{1}'",
zoneName, CorrectHostName(zoneName, host));
}
if (domainName != null)
query += String.Format(" AND SRVDomainName = '{0}.'", domainName);
using (ManagementObjectCollection objRRs = wmi.ExecuteQuery(query))
{
foreach (ManagementObject objRR in objRRs) using (objRR)
objRR.Delete();
}
// update SOA record
UpdateSoaRecord(zoneName);
}
#endregion
#region private helper methods
/// <summary>
/// Supports managed resources disposal

View file

@ -39,7 +39,8 @@
//
// This source code was auto-generated by wsdl, Version=2.0.50727.42.
//
namespace WebsitePanel.Providers.DNS {
namespace WebsitePanel.Providers.DNS
{
using System.Diagnostics;
using System.Web.Services;
using System.ComponentModel;
@ -53,7 +54,8 @@ namespace WebsitePanel.Providers.DNS {
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name = "DNSServerSoap", Namespace = "http://smbsaas/websitepanel/server/")]
public partial class DNSServer : Microsoft.Web.Services3.WebServicesClientProtocol {
public partial class DNSServer : Microsoft.Web.Services3.WebServicesClientProtocol
{
public ServiceProviderSettingsSoapHeader ServiceProviderSettingsSoapHeaderValue;
@ -80,7 +82,8 @@ namespace WebsitePanel.Providers.DNS {
private System.Threading.SendOrPostCallback DeleteZoneRecordsOperationCompleted;
/// <remarks/>
public DNSServer() {
public DNSServer()
{
this.Url = "http://localhost/WebsitePanelServer11/DnsServer.asmx";
}
@ -120,40 +123,48 @@ namespace WebsitePanel.Providers.DNS {
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/ZoneExists", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public bool ZoneExists(string zoneName) {
public bool ZoneExists(string zoneName)
{
object[] results = this.Invoke("ZoneExists", new object[] {
zoneName});
return ((bool)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginZoneExists(string zoneName, System.AsyncCallback callback, object asyncState) {
public System.IAsyncResult BeginZoneExists(string zoneName, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("ZoneExists", new object[] {
zoneName}, callback, asyncState);
}
/// <remarks/>
public bool EndZoneExists(System.IAsyncResult asyncResult) {
public bool EndZoneExists(System.IAsyncResult asyncResult)
{
object[] results = this.EndInvoke(asyncResult);
return ((bool)(results[0]));
}
/// <remarks/>
public void ZoneExistsAsync(string zoneName) {
public void ZoneExistsAsync(string zoneName)
{
this.ZoneExistsAsync(zoneName, null);
}
/// <remarks/>
public void ZoneExistsAsync(string zoneName, object userState) {
if ((this.ZoneExistsOperationCompleted == null)) {
public void ZoneExistsAsync(string zoneName, object userState)
{
if ((this.ZoneExistsOperationCompleted == null))
{
this.ZoneExistsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnZoneExistsOperationCompleted);
}
this.InvokeAsync("ZoneExists", new object[] {
zoneName}, this.ZoneExistsOperationCompleted, userState);
}
private void OnZoneExistsOperationCompleted(object arg) {
if ((this.ZoneExistsCompleted != null)) {
private void OnZoneExistsOperationCompleted(object arg)
{
if ((this.ZoneExistsCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.ZoneExistsCompleted(this, new ZoneExistsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
@ -162,37 +173,45 @@ namespace WebsitePanel.Providers.DNS {
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetZones", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public string[] GetZones() {
public string[] GetZones()
{
object[] results = this.Invoke("GetZones", new object[0]);
return ((string[])(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginGetZones(System.AsyncCallback callback, object asyncState) {
public System.IAsyncResult BeginGetZones(System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("GetZones", new object[0], callback, asyncState);
}
/// <remarks/>
public string[] EndGetZones(System.IAsyncResult asyncResult) {
public string[] EndGetZones(System.IAsyncResult asyncResult)
{
object[] results = this.EndInvoke(asyncResult);
return ((string[])(results[0]));
}
/// <remarks/>
public void GetZonesAsync() {
public void GetZonesAsync()
{
this.GetZonesAsync(null);
}
/// <remarks/>
public void GetZonesAsync(object userState) {
if ((this.GetZonesOperationCompleted == null)) {
public void GetZonesAsync(object userState)
{
if ((this.GetZonesOperationCompleted == null))
{
this.GetZonesOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetZonesOperationCompleted);
}
this.InvokeAsync("GetZones", new object[0], this.GetZonesOperationCompleted, userState);
}
private void OnGetZonesOperationCompleted(object arg) {
if ((this.GetZonesCompleted != null)) {
private void OnGetZonesOperationCompleted(object arg)
{
if ((this.GetZonesCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetZonesCompleted(this, new GetZonesCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
@ -201,32 +220,38 @@ namespace WebsitePanel.Providers.DNS {
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/AddPrimaryZone", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void AddPrimaryZone(string zoneName, string[] secondaryServers) {
public void AddPrimaryZone(string zoneName, string[] secondaryServers)
{
this.Invoke("AddPrimaryZone", new object[] {
zoneName,
secondaryServers});
}
/// <remarks/>
public System.IAsyncResult BeginAddPrimaryZone(string zoneName, string[] secondaryServers, System.AsyncCallback callback, object asyncState) {
public System.IAsyncResult BeginAddPrimaryZone(string zoneName, string[] secondaryServers, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("AddPrimaryZone", new object[] {
zoneName,
secondaryServers}, callback, asyncState);
}
/// <remarks/>
public void EndAddPrimaryZone(System.IAsyncResult asyncResult) {
public void EndAddPrimaryZone(System.IAsyncResult asyncResult)
{
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void AddPrimaryZoneAsync(string zoneName, string[] secondaryServers) {
public void AddPrimaryZoneAsync(string zoneName, string[] secondaryServers)
{
this.AddPrimaryZoneAsync(zoneName, secondaryServers, null);
}
/// <remarks/>
public void AddPrimaryZoneAsync(string zoneName, string[] secondaryServers, object userState) {
if ((this.AddPrimaryZoneOperationCompleted == null)) {
public void AddPrimaryZoneAsync(string zoneName, string[] secondaryServers, object userState)
{
if ((this.AddPrimaryZoneOperationCompleted == null))
{
this.AddPrimaryZoneOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddPrimaryZoneOperationCompleted);
}
this.InvokeAsync("AddPrimaryZone", new object[] {
@ -234,8 +259,10 @@ namespace WebsitePanel.Providers.DNS {
secondaryServers}, this.AddPrimaryZoneOperationCompleted, userState);
}
private void OnAddPrimaryZoneOperationCompleted(object arg) {
if ((this.AddPrimaryZoneCompleted != null)) {
private void OnAddPrimaryZoneOperationCompleted(object arg)
{
if ((this.AddPrimaryZoneCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.AddPrimaryZoneCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
@ -244,32 +271,38 @@ namespace WebsitePanel.Providers.DNS {
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/AddSecondaryZone", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void AddSecondaryZone(string zoneName, string[] masterServers) {
public void AddSecondaryZone(string zoneName, string[] masterServers)
{
this.Invoke("AddSecondaryZone", new object[] {
zoneName,
masterServers});
}
/// <remarks/>
public System.IAsyncResult BeginAddSecondaryZone(string zoneName, string[] masterServers, System.AsyncCallback callback, object asyncState) {
public System.IAsyncResult BeginAddSecondaryZone(string zoneName, string[] masterServers, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("AddSecondaryZone", new object[] {
zoneName,
masterServers}, callback, asyncState);
}
/// <remarks/>
public void EndAddSecondaryZone(System.IAsyncResult asyncResult) {
public void EndAddSecondaryZone(System.IAsyncResult asyncResult)
{
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void AddSecondaryZoneAsync(string zoneName, string[] masterServers) {
public void AddSecondaryZoneAsync(string zoneName, string[] masterServers)
{
this.AddSecondaryZoneAsync(zoneName, masterServers, null);
}
/// <remarks/>
public void AddSecondaryZoneAsync(string zoneName, string[] masterServers, object userState) {
if ((this.AddSecondaryZoneOperationCompleted == null)) {
public void AddSecondaryZoneAsync(string zoneName, string[] masterServers, object userState)
{
if ((this.AddSecondaryZoneOperationCompleted == null))
{
this.AddSecondaryZoneOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddSecondaryZoneOperationCompleted);
}
this.InvokeAsync("AddSecondaryZone", new object[] {
@ -277,8 +310,10 @@ namespace WebsitePanel.Providers.DNS {
masterServers}, this.AddSecondaryZoneOperationCompleted, userState);
}
private void OnAddSecondaryZoneOperationCompleted(object arg) {
if ((this.AddSecondaryZoneCompleted != null)) {
private void OnAddSecondaryZoneOperationCompleted(object arg)
{
if ((this.AddSecondaryZoneCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.AddSecondaryZoneCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
@ -287,38 +322,46 @@ namespace WebsitePanel.Providers.DNS {
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/DeleteZone", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void DeleteZone(string zoneName) {
public void DeleteZone(string zoneName)
{
this.Invoke("DeleteZone", new object[] {
zoneName});
}
/// <remarks/>
public System.IAsyncResult BeginDeleteZone(string zoneName, System.AsyncCallback callback, object asyncState) {
public System.IAsyncResult BeginDeleteZone(string zoneName, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("DeleteZone", new object[] {
zoneName}, callback, asyncState);
}
/// <remarks/>
public void EndDeleteZone(System.IAsyncResult asyncResult) {
public void EndDeleteZone(System.IAsyncResult asyncResult)
{
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void DeleteZoneAsync(string zoneName) {
public void DeleteZoneAsync(string zoneName)
{
this.DeleteZoneAsync(zoneName, null);
}
/// <remarks/>
public void DeleteZoneAsync(string zoneName, object userState) {
if ((this.DeleteZoneOperationCompleted == null)) {
public void DeleteZoneAsync(string zoneName, object userState)
{
if ((this.DeleteZoneOperationCompleted == null))
{
this.DeleteZoneOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDeleteZoneOperationCompleted);
}
this.InvokeAsync("DeleteZone", new object[] {
zoneName}, this.DeleteZoneOperationCompleted, userState);
}
private void OnDeleteZoneOperationCompleted(object arg) {
if ((this.DeleteZoneCompleted != null)) {
private void OnDeleteZoneOperationCompleted(object arg)
{
if ((this.DeleteZoneCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.DeleteZoneCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
@ -327,7 +370,8 @@ namespace WebsitePanel.Providers.DNS {
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/UpdateSoaRecord", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void UpdateSoaRecord(string zoneName, string host, string primaryNsServer, string primaryPerson) {
public void UpdateSoaRecord(string zoneName, string host, string primaryNsServer, string primaryPerson)
{
this.Invoke("UpdateSoaRecord", new object[] {
zoneName,
host,
@ -336,7 +380,8 @@ namespace WebsitePanel.Providers.DNS {
}
/// <remarks/>
public System.IAsyncResult BeginUpdateSoaRecord(string zoneName, string host, string primaryNsServer, string primaryPerson, System.AsyncCallback callback, object asyncState) {
public System.IAsyncResult BeginUpdateSoaRecord(string zoneName, string host, string primaryNsServer, string primaryPerson, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("UpdateSoaRecord", new object[] {
zoneName,
host,
@ -345,18 +390,22 @@ namespace WebsitePanel.Providers.DNS {
}
/// <remarks/>
public void EndUpdateSoaRecord(System.IAsyncResult asyncResult) {
public void EndUpdateSoaRecord(System.IAsyncResult asyncResult)
{
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void UpdateSoaRecordAsync(string zoneName, string host, string primaryNsServer, string primaryPerson) {
public void UpdateSoaRecordAsync(string zoneName, string host, string primaryNsServer, string primaryPerson)
{
this.UpdateSoaRecordAsync(zoneName, host, primaryNsServer, primaryPerson, null);
}
/// <remarks/>
public void UpdateSoaRecordAsync(string zoneName, string host, string primaryNsServer, string primaryPerson, object userState) {
if ((this.UpdateSoaRecordOperationCompleted == null)) {
public void UpdateSoaRecordAsync(string zoneName, string host, string primaryNsServer, string primaryPerson, object userState)
{
if ((this.UpdateSoaRecordOperationCompleted == null))
{
this.UpdateSoaRecordOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUpdateSoaRecordOperationCompleted);
}
this.InvokeAsync("UpdateSoaRecord", new object[] {
@ -366,8 +415,10 @@ namespace WebsitePanel.Providers.DNS {
primaryPerson}, this.UpdateSoaRecordOperationCompleted, userState);
}
private void OnUpdateSoaRecordOperationCompleted(object arg) {
if ((this.UpdateSoaRecordCompleted != null)) {
private void OnUpdateSoaRecordOperationCompleted(object arg)
{
if ((this.UpdateSoaRecordCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.UpdateSoaRecordCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
@ -376,40 +427,48 @@ namespace WebsitePanel.Providers.DNS {
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetZoneRecords", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public DnsRecord[] GetZoneRecords(string zoneName) {
public DnsRecord[] GetZoneRecords(string zoneName)
{
object[] results = this.Invoke("GetZoneRecords", new object[] {
zoneName});
return ((DnsRecord[])(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginGetZoneRecords(string zoneName, System.AsyncCallback callback, object asyncState) {
public System.IAsyncResult BeginGetZoneRecords(string zoneName, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("GetZoneRecords", new object[] {
zoneName}, callback, asyncState);
}
/// <remarks/>
public DnsRecord[] EndGetZoneRecords(System.IAsyncResult asyncResult) {
public DnsRecord[] EndGetZoneRecords(System.IAsyncResult asyncResult)
{
object[] results = this.EndInvoke(asyncResult);
return ((DnsRecord[])(results[0]));
}
/// <remarks/>
public void GetZoneRecordsAsync(string zoneName) {
public void GetZoneRecordsAsync(string zoneName)
{
this.GetZoneRecordsAsync(zoneName, null);
}
/// <remarks/>
public void GetZoneRecordsAsync(string zoneName, object userState) {
if ((this.GetZoneRecordsOperationCompleted == null)) {
public void GetZoneRecordsAsync(string zoneName, object userState)
{
if ((this.GetZoneRecordsOperationCompleted == null))
{
this.GetZoneRecordsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetZoneRecordsOperationCompleted);
}
this.InvokeAsync("GetZoneRecords", new object[] {
zoneName}, this.GetZoneRecordsOperationCompleted, userState);
}
private void OnGetZoneRecordsOperationCompleted(object arg) {
if ((this.GetZoneRecordsCompleted != null)) {
private void OnGetZoneRecordsOperationCompleted(object arg)
{
if ((this.GetZoneRecordsCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetZoneRecordsCompleted(this, new GetZoneRecordsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
@ -418,32 +477,38 @@ namespace WebsitePanel.Providers.DNS {
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/AddZoneRecord", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void AddZoneRecord(string zoneName, DnsRecord record) {
public void AddZoneRecord(string zoneName, DnsRecord record)
{
this.Invoke("AddZoneRecord", new object[] {
zoneName,
record});
}
/// <remarks/>
public System.IAsyncResult BeginAddZoneRecord(string zoneName, DnsRecord record, System.AsyncCallback callback, object asyncState) {
public System.IAsyncResult BeginAddZoneRecord(string zoneName, DnsRecord record, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("AddZoneRecord", new object[] {
zoneName,
record}, callback, asyncState);
}
/// <remarks/>
public void EndAddZoneRecord(System.IAsyncResult asyncResult) {
public void EndAddZoneRecord(System.IAsyncResult asyncResult)
{
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void AddZoneRecordAsync(string zoneName, DnsRecord record) {
public void AddZoneRecordAsync(string zoneName, DnsRecord record)
{
this.AddZoneRecordAsync(zoneName, record, null);
}
/// <remarks/>
public void AddZoneRecordAsync(string zoneName, DnsRecord record, object userState) {
if ((this.AddZoneRecordOperationCompleted == null)) {
public void AddZoneRecordAsync(string zoneName, DnsRecord record, object userState)
{
if ((this.AddZoneRecordOperationCompleted == null))
{
this.AddZoneRecordOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddZoneRecordOperationCompleted);
}
this.InvokeAsync("AddZoneRecord", new object[] {
@ -451,8 +516,10 @@ namespace WebsitePanel.Providers.DNS {
record}, this.AddZoneRecordOperationCompleted, userState);
}
private void OnAddZoneRecordOperationCompleted(object arg) {
if ((this.AddZoneRecordCompleted != null)) {
private void OnAddZoneRecordOperationCompleted(object arg)
{
if ((this.AddZoneRecordCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.AddZoneRecordCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
@ -461,32 +528,38 @@ namespace WebsitePanel.Providers.DNS {
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/DeleteZoneRecord", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void DeleteZoneRecord(string zoneName, DnsRecord record) {
public void DeleteZoneRecord(string zoneName, DnsRecord record)
{
this.Invoke("DeleteZoneRecord", new object[] {
zoneName,
record});
}
/// <remarks/>
public System.IAsyncResult BeginDeleteZoneRecord(string zoneName, DnsRecord record, System.AsyncCallback callback, object asyncState) {
public System.IAsyncResult BeginDeleteZoneRecord(string zoneName, DnsRecord record, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("DeleteZoneRecord", new object[] {
zoneName,
record}, callback, asyncState);
}
/// <remarks/>
public void EndDeleteZoneRecord(System.IAsyncResult asyncResult) {
public void EndDeleteZoneRecord(System.IAsyncResult asyncResult)
{
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void DeleteZoneRecordAsync(string zoneName, DnsRecord record) {
public void DeleteZoneRecordAsync(string zoneName, DnsRecord record)
{
this.DeleteZoneRecordAsync(zoneName, record, null);
}
/// <remarks/>
public void DeleteZoneRecordAsync(string zoneName, DnsRecord record, object userState) {
if ((this.DeleteZoneRecordOperationCompleted == null)) {
public void DeleteZoneRecordAsync(string zoneName, DnsRecord record, object userState)
{
if ((this.DeleteZoneRecordOperationCompleted == null))
{
this.DeleteZoneRecordOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDeleteZoneRecordOperationCompleted);
}
this.InvokeAsync("DeleteZoneRecord", new object[] {
@ -494,8 +567,10 @@ namespace WebsitePanel.Providers.DNS {
record}, this.DeleteZoneRecordOperationCompleted, userState);
}
private void OnDeleteZoneRecordOperationCompleted(object arg) {
if ((this.DeleteZoneRecordCompleted != null)) {
private void OnDeleteZoneRecordOperationCompleted(object arg)
{
if ((this.DeleteZoneRecordCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.DeleteZoneRecordCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
@ -504,32 +579,38 @@ namespace WebsitePanel.Providers.DNS {
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/AddZoneRecords", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void AddZoneRecords(string zoneName, DnsRecord[] records) {
public void AddZoneRecords(string zoneName, DnsRecord[] records)
{
this.Invoke("AddZoneRecords", new object[] {
zoneName,
records});
}
/// <remarks/>
public System.IAsyncResult BeginAddZoneRecords(string zoneName, DnsRecord[] records, System.AsyncCallback callback, object asyncState) {
public System.IAsyncResult BeginAddZoneRecords(string zoneName, DnsRecord[] records, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("AddZoneRecords", new object[] {
zoneName,
records}, callback, asyncState);
}
/// <remarks/>
public void EndAddZoneRecords(System.IAsyncResult asyncResult) {
public void EndAddZoneRecords(System.IAsyncResult asyncResult)
{
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void AddZoneRecordsAsync(string zoneName, DnsRecord[] records) {
public void AddZoneRecordsAsync(string zoneName, DnsRecord[] records)
{
this.AddZoneRecordsAsync(zoneName, records, null);
}
/// <remarks/>
public void AddZoneRecordsAsync(string zoneName, DnsRecord[] records, object userState) {
if ((this.AddZoneRecordsOperationCompleted == null)) {
public void AddZoneRecordsAsync(string zoneName, DnsRecord[] records, object userState)
{
if ((this.AddZoneRecordsOperationCompleted == null))
{
this.AddZoneRecordsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddZoneRecordsOperationCompleted);
}
this.InvokeAsync("AddZoneRecords", new object[] {
@ -537,8 +618,10 @@ namespace WebsitePanel.Providers.DNS {
records}, this.AddZoneRecordsOperationCompleted, userState);
}
private void OnAddZoneRecordsOperationCompleted(object arg) {
if ((this.AddZoneRecordsCompleted != null)) {
private void OnAddZoneRecordsOperationCompleted(object arg)
{
if ((this.AddZoneRecordsCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.AddZoneRecordsCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
@ -547,32 +630,38 @@ namespace WebsitePanel.Providers.DNS {
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/DeleteZoneRecords", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void DeleteZoneRecords(string zoneName, DnsRecord[] records) {
public void DeleteZoneRecords(string zoneName, DnsRecord[] records)
{
this.Invoke("DeleteZoneRecords", new object[] {
zoneName,
records});
}
/// <remarks/>
public System.IAsyncResult BeginDeleteZoneRecords(string zoneName, DnsRecord[] records, System.AsyncCallback callback, object asyncState) {
public System.IAsyncResult BeginDeleteZoneRecords(string zoneName, DnsRecord[] records, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("DeleteZoneRecords", new object[] {
zoneName,
records}, callback, asyncState);
}
/// <remarks/>
public void EndDeleteZoneRecords(System.IAsyncResult asyncResult) {
public void EndDeleteZoneRecords(System.IAsyncResult asyncResult)
{
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void DeleteZoneRecordsAsync(string zoneName, DnsRecord[] records) {
public void DeleteZoneRecordsAsync(string zoneName, DnsRecord[] records)
{
this.DeleteZoneRecordsAsync(zoneName, records, null);
}
/// <remarks/>
public void DeleteZoneRecordsAsync(string zoneName, DnsRecord[] records, object userState) {
if ((this.DeleteZoneRecordsOperationCompleted == null)) {
public void DeleteZoneRecordsAsync(string zoneName, DnsRecord[] records, object userState)
{
if ((this.DeleteZoneRecordsOperationCompleted == null))
{
this.DeleteZoneRecordsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDeleteZoneRecordsOperationCompleted);
}
this.InvokeAsync("DeleteZoneRecords", new object[] {
@ -580,15 +669,18 @@ namespace WebsitePanel.Providers.DNS {
records}, this.DeleteZoneRecordsOperationCompleted, userState);
}
private void OnDeleteZoneRecordsOperationCompleted(object arg) {
if ((this.DeleteZoneRecordsCompleted != null)) {
private void OnDeleteZoneRecordsOperationCompleted(object arg)
{
if ((this.DeleteZoneRecordsCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.DeleteZoneRecordsCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
public new void CancelAsync(object userState) {
public new void CancelAsync(object userState)
{
base.CancelAsync(userState);
}
}
@ -601,18 +693,22 @@ namespace WebsitePanel.Providers.DNS {
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class ZoneExistsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
public partial class ZoneExistsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
private object[] results;
internal ZoneExistsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
base(exception, cancelled, userState)
{
this.results = results;
}
/// <remarks/>
public bool Result {
get {
public bool Result
{
get
{
this.RaiseExceptionIfNecessary();
return ((bool)(this.results[0]));
}
@ -627,18 +723,22 @@ namespace WebsitePanel.Providers.DNS {
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetZonesCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
public partial class GetZonesCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
private object[] results;
internal GetZonesCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
base(exception, cancelled, userState)
{
this.results = results;
}
/// <remarks/>
public string[] Result {
get {
public string[] Result
{
get
{
this.RaiseExceptionIfNecessary();
return ((string[])(this.results[0]));
}
@ -669,18 +769,22 @@ namespace WebsitePanel.Providers.DNS {
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetZoneRecordsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
public partial class GetZoneRecordsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
private object[] results;
internal GetZoneRecordsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
base(exception, cancelled, userState)
{
this.results = results;
}
/// <remarks/>
public DnsRecord[] Result {
get {
public DnsRecord[] Result
{
get
{
this.RaiseExceptionIfNecessary();
return ((DnsRecord[])(this.results[0]));
}

View file

@ -1,13 +1,11 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DnsZoneRecords.ascx.cs" Inherits="WebsitePanel.Portal.DnsZoneRecords" %>
<%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport"
TagPrefix="wsp" %>
<%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %>
<wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server" />
<script type="text/javascript">
function confirmation()
{
function confirmation() {
if (!confirm('Are you sure you want to delete this DNS Zone Record?')) return false; else ShowProgressDialog('Deleting DNS Zone Record...');
}
</script>
@ -33,6 +31,9 @@ function confirmation()
<asp:Literal ID="litRecordName" runat="server" Text='<%# Eval("RecordName") %>' Visible="false"></asp:Literal>
<asp:Literal ID="litRecordType" runat="server" Text='<%# Eval("RecordType") %>' Visible="false"></asp:Literal>
<asp:Literal ID="litRecordData" runat="server" Text='<%# Eval("RecordData") %>' Visible="false"></asp:Literal>
<asp:Literal ID="litSrvPriority" runat="server" Text='<%# Eval("SrvPriority") %>' Visible="false"></asp:Literal>
<asp:Literal ID="litSrvWeight" runat="server" Text='<%# Eval("SrvWeight") %>' Visible="false"></asp:Literal>
<asp:Literal ID="litSrvPort" runat="server" Text='<%# Eval("SrvPort") %>' Visible="false"></asp:Literal>
</ItemTemplate>
<ItemStyle CssClass="NormalBold" Wrap="False" />
</asp:TemplateField>
@ -41,7 +42,7 @@ function confirmation()
<asp:TemplateField SortExpression="RecordData" HeaderText="gvRecordsData" >
<ItemStyle Width="100%" />
<ItemTemplate>
<%# GetRecordFullData((string)Eval("RecordType"), (string)Eval("RecordData"), (int)Eval("MxPriority")) %>
<%# GetRecordFullData((string)Eval("RecordType"), (string)Eval("RecordData"), (int)Eval("MxPriority"), (int)Eval("SrvPort"))%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
@ -77,6 +78,7 @@ function confirmation()
<asp:ListItem>NS</asp:ListItem>
<asp:ListItem>TXT</asp:ListItem>
<asp:ListItem>CNAME</asp:ListItem>
<asp:ListItem>SRV</asp:ListItem>
</asp:DropDownList><asp:Literal ID="litRecordType" runat="server"></asp:Literal>
</td>
</tr>
@ -106,10 +108,43 @@ function confirmation()
<asp:RegularExpressionValidator ID="valRequireCorrectPriority" runat="server" ControlToValidate="txtMXPriority"
ErrorMessage="*" ValidationExpression="\d{1,3}"></asp:RegularExpressionValidator></td>
</tr>
<tr id="rowSRVPriority" runat="server">
<td class="SubHead"><asp:Label ID="lblSRVPriority" runat="server" meta:resourcekey="lblSRVPriority" Text="Priority:"></asp:Label></td>
<td class="NormalBold">
<asp:TextBox ID="txtSRVPriority" runat="server" Width="30" CssClass="NormalTextBox"></asp:TextBox>
<asp:RequiredFieldValidator ID="valRequireSrvPriority" runat="server" ControlToValidate="txtSRVPriority"
ErrorMessage="*" ValidationGroup="DnsZoneRecord" Display="Dynamic"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="valRequireCorrectSrvPriority" runat="server" ControlToValidate="txtSRVPriority"
ErrorMessage="*" ValidationExpression="\d{1,3}"></asp:RegularExpressionValidator></td>
</tr>
<tr id="rowSRVWeight" runat="server">
<td class="SubHead"><asp:Label ID="lblSRVWeight" runat="server" meta:resourcekey="lblSRVWeight" Text="Weight:"></asp:Label></td>
<td class="NormalBold">
<asp:TextBox ID="txtSRVWeight" runat="server" Width="30" CssClass="NormalTextBox"></asp:TextBox>
<asp:RequiredFieldValidator ID="valRequireSrvWeight" runat="server" ControlToValidate="txtSRVWeight"
ErrorMessage="*" ValidationGroup="DnsZoneRecord" Display="Dynamic"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="valRequireCorrectSrvWeight" runat="server" ControlToValidate="txtSRVWeight"
ErrorMessage="*" ValidationExpression="\d{1,3}"></asp:RegularExpressionValidator></td>
</tr>
<tr id="rowSRVPort" runat="server">
<td class="SubHead"><asp:Label ID="lblSRVPort" runat="server" meta:resourcekey="lblSRVPort" Text="Port Number:"></asp:Label></td>
<td class="NormalBold">
<asp:TextBox ID="txtSRVPort" runat="server" Width="30" CssClass="NormalTextBox"></asp:TextBox>
<asp:RequiredFieldValidator ID="valRequireSrvPort" runat="server" ControlToValidate="txtSRVPort"
ErrorMessage="*" ValidationGroup="DnsZoneRecord" Display="Dynamic"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="valRequireCorrectSrvPort" runat="server" ControlToValidate="txtSRVPort"
ErrorMessage="*" ValidationExpression="\d{1,3}"></asp:RegularExpressionValidator></td>
</tr>
</table>
</div>
<div class="FormFooter">
<asp:Button ID="btnSave" runat="server" meta:resourcekey="btnSave" Text="Save" CssClass="Button1" OnClick="btnSave_Click" OnClientClick = "ShowProgressDialog('Saving DNS Zone Record ...');" ValidationGroup="DnsZoneRecord" />
<asp:Button ID="btnCancel" runat="server" meta:resourcekey="btnCancel" Text="Cancel" CssClass="Button1" OnClick="btnCancel_Click" CausesValidation="False" /></td>
<asp:Button ID="btnCancel" runat="server" meta:resourcekey="btnCancel" Text="Cancel" CssClass="Button1" OnClick="btnCancel_Click" CausesValidation="False" />
</div>
</asp:Panel>

View file

@ -60,19 +60,29 @@ namespace WebsitePanel.Portal
}
}
public string GetRecordFullData(string recordType, string recordData, int mxPriority)
public string GetRecordFullData(string recordType, string recordData, int mxPriority, int port)
{
return (String.Compare(recordType, "mx", true) == 0)
? String.Format("[{0}], {1}", mxPriority, recordData) : recordData;
switch (recordType)
{
case "MX":
return String.Format("[{0}], {1}", mxPriority, recordData);
case "SRV":
return String.Format("[{0}], {1}", port, recordData);
default:
return recordData;
}
}
private void GetRecordsDetails(int recordIndex)
{
GridViewRow row = gvRecords.Rows[recordIndex];
ViewState["SrvPort"] = ((Literal)row.Cells[0].FindControl("litSrvPort")).Text;
ViewState["SrvWeight"] = ((Literal)row.Cells[0].FindControl("litSrvWeight")).Text;
ViewState["SrvPriority"] = ((Literal)row.Cells[0].FindControl("litSrvPriority")).Text;
ViewState["MxPriority"] = ((Literal)row.Cells[0].FindControl("litMxPriority")).Text;
ViewState["RecordName"] = ((Literal)row.Cells[0].FindControl("litRecordName")).Text; ;
ViewState["RecordType"] = (DnsRecordType)Enum.Parse(typeof(DnsRecordType),
((Literal)row.Cells[0].FindControl("litRecordType")).Text, true);
ViewState["RecordType"] = (DnsRecordType)Enum.Parse(typeof(DnsRecordType), ((Literal)row.Cells[0].FindControl("litRecordType")).Text, true);
ViewState["RecordData"] = ((Literal)row.Cells[0].FindControl("litRecordData")).Text;
}
@ -88,6 +98,9 @@ namespace WebsitePanel.Portal
txtRecordName.Text = ViewState["RecordName"].ToString();
txtRecordData.Text = ViewState["RecordData"].ToString();
txtMXPriority.Text = ViewState["MxPriority"].ToString();
txtSRVPriority.Text = ViewState["SrvPriority"].ToString();
txtSRVWeight.Text = ViewState["SrvWeight"].ToString();
txtSRVPort.Text = ViewState["SrvPort"].ToString();
}
catch (Exception ex)
{
@ -103,17 +116,32 @@ namespace WebsitePanel.Portal
private void ToggleRecordControls()
{
rowMXPriority.Visible = (ddlRecordType.SelectedValue == "MX");
if (ddlRecordType.SelectedValue == "A")
{
lblRecordData.Text = "IP:";
IPValidator.Enabled = true;
}
else
{
rowMXPriority.Visible = false;
rowSRVPriority.Visible = false;
rowSRVWeight.Visible = false;
rowSRVPort.Visible = false;
lblRecordData.Text = "Record Data:";
IPValidator.Enabled = false;
switch (ddlRecordType.SelectedValue)
{
case "A":
lblRecordData.Text = "IP:";
IPValidator.Enabled = true;
break;
case "MX":
rowMXPriority.Visible = true;
break;
case "SRV":
rowSRVPriority.Visible = true;
rowSRVWeight.Visible = true;
rowSRVPort.Visible = true;
lblRecordData.Text = "Host offering this service:";
break;
default:
break;
}
}
private void SaveRecord()
@ -133,7 +161,10 @@ namespace WebsitePanel.Portal
Enum.Parse(typeof(DnsRecordType),
ddlRecordType.SelectedValue, true),
txtRecordData.Text.Trim(),
Int32.Parse(txtMXPriority.Text.Trim()));
Int32.Parse(txtMXPriority.Text.Trim()),
Int32.Parse(txtSRVPriority.Text.Trim()),
Int32.Parse(txtSRVWeight.Text.Trim()),
Int32.Parse(txtSRVPort.Text.Trim()));
if (result < 0)
{
@ -158,7 +189,10 @@ namespace WebsitePanel.Portal
txtRecordName.Text.Trim(),
(DnsRecordType)ViewState["RecordType"],
txtRecordData.Text.Trim(),
Int32.Parse(txtMXPriority.Text.Trim()));
Int32.Parse(txtMXPriority.Text.Trim()),
Int32.Parse(txtSRVPriority.Text.Trim()),
Int32.Parse(txtSRVWeight.Text.Trim()),
Int32.Parse(txtSRVPort.Text.Trim()));
if (result < 0)
{
@ -217,6 +251,10 @@ namespace WebsitePanel.Portal
txtRecordName.Text = "";
txtRecordData.Text = "";
txtMXPriority.Text = "1";
txtSRVPriority.Text = "0";
txtSRVWeight.Text = "0";
txtSRVPort.Text = "0";
ShowPanels(true);
}

View file

@ -1,7 +1,6 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.3074
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -220,6 +219,141 @@ namespace WebsitePanel.Portal {
/// </remarks>
protected global::System.Web.UI.WebControls.RegularExpressionValidator valRequireCorrectPriority;
/// <summary>
/// rowSRVPriority 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 rowSRVPriority;
/// <summary>
/// lblSRVPriority 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.Label lblSRVPriority;
/// <summary>
/// txtSRVPriority 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 txtSRVPriority;
/// <summary>
/// valRequireSrvPriority 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.RequiredFieldValidator valRequireSrvPriority;
/// <summary>
/// valRequireCorrectSrvPriority 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.RegularExpressionValidator valRequireCorrectSrvPriority;
/// <summary>
/// rowSRVWeight 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 rowSRVWeight;
/// <summary>
/// lblSRVWeight 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.Label lblSRVWeight;
/// <summary>
/// txtSRVWeight 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 txtSRVWeight;
/// <summary>
/// valRequireSrvWeight 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.RequiredFieldValidator valRequireSrvWeight;
/// <summary>
/// valRequireCorrectSrvWeight 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.RegularExpressionValidator valRequireCorrectSrvWeight;
/// <summary>
/// rowSRVPort 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 rowSRVPort;
/// <summary>
/// lblSRVPort 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.Label lblSRVPort;
/// <summary>
/// txtSRVPort 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 txtSRVPort;
/// <summary>
/// valRequireSrvPort 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.RequiredFieldValidator valRequireSrvPort;
/// <summary>
/// valRequireCorrectSrvPort 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.RegularExpressionValidator valRequireCorrectSrvPort;
/// <summary>
/// btnSave control.
/// </summary>

View file

@ -304,7 +304,7 @@ namespace WebsitePanel.Portal
try
{
// create instant alias
int result = ES.Services.Servers.CreateDomainInstantAlias(PanelRequest.DomainID);
int result = ES.Services.Servers.CreateDomainInstantAlias("", PanelRequest.DomainID);
if (result < 0)
{
ShowResultMessage(result);

View file

@ -53,6 +53,9 @@
<asp:Literal ID="litRecordName" runat="server" Text='<%# Eval("RecordName") %>' Visible="false"></asp:Literal>
<asp:Literal ID="litRecordType" runat="server" Text='<%# Eval("RecordType") %>' Visible="false"></asp:Literal>
<asp:Literal ID="litRecordData" runat="server" Text='<%# Eval("RecordData") %>' Visible="false"></asp:Literal>
<asp:Literal ID="litSrvPriority" runat="server" Text='<%# Eval("SrvPriority") %>' Visible="false"></asp:Literal>
<asp:Literal ID="litSrvWeight" runat="server" Text='<%# Eval("SrvWeight") %>' Visible="false"></asp:Literal>
<asp:Literal ID="litSrvPort" runat="server" Text='<%# Eval("SrvPort") %>' Visible="false"></asp:Literal>
</ItemTemplate>
<ItemStyle CssClass="NormalBold" Wrap="False" />
</asp:TemplateField>
@ -61,7 +64,7 @@
<asp:TemplateField SortExpression="RecordData" HeaderText="gvRecordsData" >
<ItemStyle Width="100%" />
<ItemTemplate>
<%# GetRecordFullData((string)Eval("RecordType"), (string)Eval("RecordData"), (int)Eval("MxPriority")) %>
<%# GetRecordFullData((string)Eval("RecordType"), (string)Eval("RecordData"), (int)Eval("MxPriority"), (int)Eval("SrvPort"))%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
@ -117,6 +120,7 @@
<asp:ListItem>NS</asp:ListItem>
<asp:ListItem>TXT</asp:ListItem>
<asp:ListItem>CNAME</asp:ListItem>
<asp:ListItem>SRV</asp:ListItem>
</asp:DropDownList><asp:Literal ID="litRecordType" runat="server"></asp:Literal>
</td>
</tr>
@ -132,7 +136,10 @@
<asp:TextBox ID="txtRecordData" runat="server" Width="200px" CssClass="NormalTextBox"></asp:TextBox>
<asp:RequiredFieldValidator ID="valRequireData" runat="server" ControlToValidate="txtRecordData"
ErrorMessage="*" ValidationGroup="DnsZoneRecord" Display="Dynamic"></asp:RequiredFieldValidator>
<asp:regularexpressionvalidator id="IPValidator" runat="server" ValidationExpression="^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$"
Display="Dynamic" ErrorMessage="Please enter a valid IP" ValidationGroup="DnsZoneRecord" ControlToValidate="txtRecordData" CssClass="NormalBold"></asp:regularexpressionvalidator>
</td>
</tr>
<tr>
<asp:regularexpressionvalidator id="IPValidator1" runat="server" ValidationExpression="^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$"
@ -147,6 +154,36 @@
<asp:RegularExpressionValidator ID="valRequireCorrectPriority" runat="server" ControlToValidate="txtMXPriority"
ErrorMessage="*" ValidationExpression="\d{1,3}"></asp:RegularExpressionValidator></td>
</tr>
<tr id="rowSRVPriority" runat="server">
<td class="SubHead"><asp:Label ID="lblSRVPriority" runat="server" meta:resourcekey="lblSRVPriority" Text="Priority:"></asp:Label></td>
<td class="NormalBold">
<asp:TextBox ID="txtSRVPriority" runat="server" Width="30" CssClass="NormalTextBox"></asp:TextBox>
<asp:RequiredFieldValidator ID="valRequireSrvPriority" runat="server" ControlToValidate="txtSRVPriority"
ErrorMessage="*" ValidationGroup="DnsZoneRecord" Display="Dynamic"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="valRequireCorrectSrvPriority" runat="server" ControlToValidate="txtSRVPriority"
ErrorMessage="*" ValidationExpression="\d{1,3}"></asp:RegularExpressionValidator></td>
</tr>
<tr id="rowSRVWeight" runat="server">
<td class="SubHead"><asp:Label ID="lblSRVWeight" runat="server" meta:resourcekey="lblSRVWeight" Text="Weight:"></asp:Label></td>
<td class="NormalBold">
<asp:TextBox ID="txtSRVWeight" runat="server" Width="30" CssClass="NormalTextBox"></asp:TextBox>
<asp:RequiredFieldValidator ID="valRequireSrvWeight" runat="server" ControlToValidate="txtSRVWeight"
ErrorMessage="*" ValidationGroup="DnsZoneRecord" Display="Dynamic"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="valRequireCorrectSrvWeight" runat="server" ControlToValidate="txtSRVWeight"
ErrorMessage="*" ValidationExpression="\d{1,3}"></asp:RegularExpressionValidator></td>
</tr>
<tr id="rowSRVPort" runat="server">
<td class="SubHead"><asp:Label ID="lblSRVPort" runat="server" meta:resourcekey="lblSRVPort" Text="Port Number:"></asp:Label></td>
<td class="NormalBold">
<asp:TextBox ID="txtSRVPort" runat="server" Width="30" CssClass="NormalTextBox"></asp:TextBox>
<asp:RequiredFieldValidator ID="valRequireSrvPort" runat="server" ControlToValidate="txtSRVPort"
ErrorMessage="*" ValidationGroup="DnsZoneRecord" Display="Dynamic"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="valRequireCorrectSrvPort" runat="server" ControlToValidate="txtSRVPort"
ErrorMessage="*" ValidationExpression="\d{1,3}"></asp:RegularExpressionValidator></td>
</tr>
</table>
</ContentTemplate>

View file

@ -59,19 +59,28 @@ namespace WebsitePanel.Portal.ExchangeServer
}
}
public string GetRecordFullData(string recordType, string recordData, int mxPriority)
public string GetRecordFullData(string recordType, string recordData, int mxPriority, int port)
{
return (String.Compare(recordType, "mx", true) == 0)
? String.Format("[{0}], {1}", mxPriority, recordData) : recordData;
switch (recordType)
{
case "MX":
return String.Format("[{0}], {1}", mxPriority, recordData);
case "SRV":
return String.Format("[{0}], {1}", port, recordData);
default:
return recordData;
}
}
private void GetRecordsDetails(int recordIndex)
{
GridViewRow row = gvRecords.Rows[recordIndex];
ViewState["SrvPort"] = ((Literal)row.Cells[0].FindControl("litSrvPort")).Text;
ViewState["SrvWeight"] = ((Literal)row.Cells[0].FindControl("litSrvWeight")).Text;
ViewState["SrvPriority"] = ((Literal)row.Cells[0].FindControl("litSrvPriority")).Text;
ViewState["MxPriority"] = ((Literal)row.Cells[0].FindControl("litMxPriority")).Text;
ViewState["RecordName"] = ((Literal)row.Cells[0].FindControl("litRecordName")).Text; ;
ViewState["RecordType"] = (DnsRecordType)Enum.Parse(typeof(DnsRecordType),
((Literal)row.Cells[0].FindControl("litRecordType")).Text, true);
ViewState["RecordType"] = (DnsRecordType)Enum.Parse(typeof(DnsRecordType), ((Literal)row.Cells[0].FindControl("litRecordType")).Text, true);
ViewState["RecordData"] = ((Literal)row.Cells[0].FindControl("litRecordData")).Text;
}
@ -79,9 +88,7 @@ namespace WebsitePanel.Portal.ExchangeServer
{
try
{
litRecordType.Visible = true;
ddlRecordType.Visible = false;
ViewState["NewRecord"] = false;
GetRecordsDetails(recordIndex);
ddlRecordType.SelectedValue = ViewState["RecordType"].ToString();
@ -89,11 +96,13 @@ namespace WebsitePanel.Portal.ExchangeServer
txtRecordName.Text = ViewState["RecordName"].ToString();
txtRecordData.Text = ViewState["RecordData"].ToString();
txtMXPriority.Text = ViewState["MxPriority"].ToString();
ToggleRecordControls();
txtSRVPriority.Text = ViewState["SrvPriority"].ToString();
txtSRVWeight.Text = ViewState["SrvWeight"].ToString();
txtSRVPort.Text = ViewState["SrvPort"].ToString();
}
catch (Exception ex)
{
messageBox.ShowErrorMessage("GDNS_GET_RECORD", ex);
ShowErrorMessage("GDNS_GET_RECORD", ex);
return;
}
}
@ -105,17 +114,30 @@ namespace WebsitePanel.Portal.ExchangeServer
private void ToggleRecordControls()
{
rowMXPriority.Visible = (ddlRecordType.SelectedValue == "MX");
if (ddlRecordType.SelectedValue == "A")
{
lblRecordData.Text = "IP:";
IPValidator1.Enabled = true;
}
else
{
rowMXPriority.Visible = false;
rowSRVPriority.Visible = false;
rowSRVWeight.Visible = false;
rowSRVPort.Visible = false;
lblRecordData.Text = "Record Data:";
IPValidator1.Enabled = false;
IPValidator.Enabled = false;
switch (ddlRecordType.SelectedValue)
{
case "A":
lblRecordData.Text = "IP:";
IPValidator.Enabled = true;
break;
case "MX":
rowMXPriority.Visible = true;
break;
case "SRV":
rowSRVPriority.Visible = true;
rowSRVWeight.Visible = true;
rowSRVPort.Visible = true;
lblRecordData.Text = "Host offering this service:";
break;
default:
break;
}
}
@ -133,9 +155,14 @@ namespace WebsitePanel.Portal.ExchangeServer
{
int result = ES.Services.Servers.AddDnsZoneRecord(PanelRequest.DomainID,
txtRecordName.Text.Trim(),
(DnsRecordType)Enum.Parse(typeof(DnsRecordType), ddlRecordType.SelectedValue, true),
(DnsRecordType)
Enum.Parse(typeof(DnsRecordType),
ddlRecordType.SelectedValue, true),
txtRecordData.Text.Trim(),
Utils.ParseInt(txtMXPriority.Text.Trim(), 0));
Int32.Parse(txtMXPriority.Text.Trim()),
Int32.Parse(txtSRVPriority.Text.Trim()),
Int32.Parse(txtSRVWeight.Text.Trim()),
Int32.Parse(txtSRVPort.Text.Trim()));
if (result < 0)
{
@ -160,7 +187,10 @@ namespace WebsitePanel.Portal.ExchangeServer
txtRecordName.Text.Trim(),
(DnsRecordType)ViewState["RecordType"],
txtRecordData.Text.Trim(),
Utils.ParseInt(txtMXPriority.Text.Trim(), 0));
Int32.Parse(txtMXPriority.Text.Trim()),
Int32.Parse(txtSRVPriority.Text.Trim()),
Int32.Parse(txtSRVWeight.Text.Trim()),
Int32.Parse(txtSRVPort.Text.Trim()));
if (result < 0)
{
@ -230,6 +260,9 @@ namespace WebsitePanel.Portal.ExchangeServer
txtRecordName.Text = "";
txtRecordData.Text = "";
txtMXPriority.Text = "1";
txtSRVPriority.Text = "0";
txtSRVWeight.Text = "0";
txtSRVPort.Text = "0";
ToggleRecordControls();
}

View file

@ -1,7 +1,6 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -229,6 +228,15 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// </remarks>
protected global::System.Web.UI.WebControls.RequiredFieldValidator valRequireData;
/// <summary>
/// IPValidator 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.RegularExpressionValidator IPValidator;
/// <summary>
/// IPValidator1 control.
/// </summary>
@ -283,6 +291,141 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// </remarks>
protected global::System.Web.UI.WebControls.RegularExpressionValidator valRequireCorrectPriority;
/// <summary>
/// rowSRVPriority 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 rowSRVPriority;
/// <summary>
/// lblSRVPriority 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.Label lblSRVPriority;
/// <summary>
/// txtSRVPriority 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 txtSRVPriority;
/// <summary>
/// valRequireSrvPriority 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.RequiredFieldValidator valRequireSrvPriority;
/// <summary>
/// valRequireCorrectSrvPriority 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.RegularExpressionValidator valRequireCorrectSrvPriority;
/// <summary>
/// rowSRVWeight 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 rowSRVWeight;
/// <summary>
/// lblSRVWeight 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.Label lblSRVWeight;
/// <summary>
/// txtSRVWeight 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 txtSRVWeight;
/// <summary>
/// valRequireSrvWeight 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.RequiredFieldValidator valRequireSrvWeight;
/// <summary>
/// valRequireCorrectSrvWeight 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.RegularExpressionValidator valRequireCorrectSrvWeight;
/// <summary>
/// rowSRVPort 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 rowSRVPort;
/// <summary>
/// lblSRVPort 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.Label lblSRVPort;
/// <summary>
/// txtSRVPort 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 txtSRVPort;
/// <summary>
/// valRequireSrvPort 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.RequiredFieldValidator valRequireSrvPort;
/// <summary>
/// valRequireCorrectSrvPort 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.RegularExpressionValidator valRequireCorrectSrvPort;
/// <summary>
/// btnSave control.
/// </summary>

View file

@ -39,6 +39,7 @@
<asp:ListItem>NS</asp:ListItem>
<asp:ListItem>TXT</asp:ListItem>
<asp:ListItem>CNAME</asp:ListItem>
<asp:ListItem>SRV</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
@ -60,6 +61,28 @@
<asp:TextBox ID="txtMXPriority" runat="server" Width="30" CssClass="NormalTextBox"></asp:TextBox>
</td>
</tr>
<tr id="rowSRVPriority" runat="server">
<td class="SubHead"><asp:Label ID="lblSRVPriority" runat="server" meta:resourcekey="lblSRVPriority" Text="SRV Priority:"></asp:Label></td>
<td class="Normal">
<asp:TextBox ID="txtSRVPriority" runat="server" Width="30" CssClass="NormalTextBox"></asp:TextBox>
</td>
</tr>
<tr id="rowSRVWeight" runat="server">
<td class="SubHead"><asp:Label ID="lblSRVWeight" runat="server" meta:resourcekey="lblSRVWeight" Text="Weight:"></asp:Label></td>
<td class="Normal">
<asp:TextBox ID="txtSRVWeight" runat="server" Width="30" CssClass="NormalTextBox"></asp:TextBox>
</td>
</tr>
<tr id="rowSRVPort" runat="server">
<td class="SubHead"><asp:Label ID="lblSRVPort" runat="server" meta:resourcekey="lblSRVPort" Text="Port Number:"></asp:Label></td>
<td class="Normal">
<asp:TextBox ID="txtSRVPort" runat="server" Width="30" CssClass="NormalTextBox"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2">
<asp:Button ID="btnSave" runat="server" meta:resourcekey="btnSave" Text="Save" CssClass="Button1" OnClick="btnSave_Click" ValidationGroup="DnsRecord" />

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012, Outercurve Foundation.
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
@ -86,6 +86,7 @@ namespace WebsitePanel.Portal
return;
}
}
}
private void BindDnsRecords()
@ -104,6 +105,8 @@ namespace WebsitePanel.Portal
gvRecords.DataSource = ds;
gvRecords.DataBind();
}
ToggleRecordControls();
}
private void BindDnsRecord(int recordId)
@ -119,6 +122,9 @@ namespace WebsitePanel.Portal
txtRecordName.Text = record.RecordName;
txtRecordData.Text = record.RecordData;
txtMXPriority.Text = record.MxPriority.ToString();
txtSRVPriority.Text = record.SrvPriority.ToString();
txtSRVWeight.Text = record.SrvWeight.ToString();
txtSRVPort.Text = record.SrvPort.ToString();
ipAddress.AddressId = record.IpAddressId;
}
@ -138,9 +144,32 @@ namespace WebsitePanel.Portal
private void ToggleRecordControls()
{
ipAddress.Visible = (ddlRecordType.SelectedValue == "A");
//rowData.Visible = (ddlRecordType.SelectedValue != "A");
rowMXPriority.Visible = (ddlRecordType.SelectedValue == "MX");
rowMXPriority.Visible = false;
rowSRVPriority.Visible = false;
rowSRVWeight.Visible = false;
rowSRVPort.Visible = false;
lblRecordData.Text = "Record Data:";
ipAddress.Visible = false;
switch (ddlRecordType.SelectedValue)
{
case "A":
lblRecordData.Text = "IP:";
ipAddress.Visible = true;
break;
case "MX":
rowMXPriority.Visible = true;
break;
case "SRV":
rowSRVPriority.Visible = true;
rowSRVWeight.Visible = true;
rowSRVPort.Visible = true;
lblRecordData.Text = "Host offering this service:";
break;
default:
break;
}
}
private void SaveRecord()
@ -151,6 +180,9 @@ namespace WebsitePanel.Portal
record.RecordName = txtRecordName.Text.Trim();
record.RecordData = txtRecordData.Text.Trim();
record.MxPriority = Utils.ParseInt(txtMXPriority.Text, 0);
record.SrvPriority = Utils.ParseInt(txtSRVPriority.Text, 0);
record.SrvWeight = Utils.ParseInt(txtSRVWeight.Text, 0);
record.SrvPort = Utils.ParseInt(txtSRVPort.Text, 0);
record.IpAddressId = ipAddress.AddressId;
if (ServiceIdParam != null)
@ -230,6 +262,11 @@ namespace WebsitePanel.Portal
txtRecordName.Text = "";
txtRecordData.Text = "";
txtMXPriority.Text = "0";
txtSRVPriority.Text = "0";
txtSRVWeight.Text = "0";
txtSRVPort.Text = "0";
ToggleRecordControls();
ShowPanels(true);
}

View file

@ -1,7 +1,6 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.42
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -10,23 +9,241 @@
namespace WebsitePanel.Portal {
public partial class GlobalDnsRecordsControl {
protected System.Web.UI.WebControls.Panel pnlRecords;
protected System.Web.UI.WebControls.Button btnAdd;
protected System.Web.UI.WebControls.GridView gvRecords;
protected System.Web.UI.WebControls.Panel pnlEdit;
protected System.Web.UI.WebControls.Label lblRecordType;
protected System.Web.UI.WebControls.DropDownList ddlRecordType;
protected System.Web.UI.WebControls.Label lblRecordName;
protected System.Web.UI.WebControls.TextBox txtRecordName;
protected System.Web.UI.HtmlControls.HtmlTableRow rowData;
protected System.Web.UI.WebControls.Label lblRecordData;
protected System.Web.UI.WebControls.TextBox txtRecordData;
protected WebsitePanel.Portal.SelectIPAddress ipAddress;
protected System.Web.UI.HtmlControls.HtmlTableRow rowMXPriority;
protected System.Web.UI.WebControls.Label lblMXPriority;
protected System.Web.UI.WebControls.TextBox txtMXPriority;
protected System.Web.UI.WebControls.Button btnSave;
protected System.Web.UI.WebControls.Button btnCancel;
/// <summary>
/// pnlRecords 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 pnlRecords;
/// <summary>
/// btnAdd 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 btnAdd;
/// <summary>
/// gvRecords 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 gvRecords;
/// <summary>
/// pnlEdit 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 pnlEdit;
/// <summary>
/// lblRecordType 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.Label lblRecordType;
/// <summary>
/// ddlRecordType 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 ddlRecordType;
/// <summary>
/// lblRecordName 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.Label lblRecordName;
/// <summary>
/// txtRecordName 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 txtRecordName;
/// <summary>
/// rowData 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 rowData;
/// <summary>
/// lblRecordData 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.Label lblRecordData;
/// <summary>
/// txtRecordData 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 txtRecordData;
/// <summary>
/// ipAddress control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.SelectIPAddress ipAddress;
/// <summary>
/// rowMXPriority 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 rowMXPriority;
/// <summary>
/// lblMXPriority 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.Label lblMXPriority;
/// <summary>
/// txtMXPriority 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 txtMXPriority;
/// <summary>
/// rowSRVPriority 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 rowSRVPriority;
/// <summary>
/// lblSRVPriority 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.Label lblSRVPriority;
/// <summary>
/// txtSRVPriority 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 txtSRVPriority;
/// <summary>
/// rowSRVWeight 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 rowSRVWeight;
/// <summary>
/// lblSRVWeight 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.Label lblSRVWeight;
/// <summary>
/// txtSRVWeight 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 txtSRVWeight;
/// <summary>
/// rowSRVPort 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 rowSRVPort;
/// <summary>
/// lblSRVPort 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.Label lblSRVPort;
/// <summary>
/// txtSRVPort 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 txtSRVPort;
/// <summary>
/// btnSave 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 btnSave;
/// <summary>
/// btnCancel 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 btnCancel;
}
}

View file

@ -1,4 +1,4 @@
// Copyright (c) 2011, Outercurve Foundation.
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
@ -273,7 +273,7 @@ namespace WebsitePanel.Portal
private void AddDnsRecord(int domainId, string recordName, string recordData)
{
int result = ES.Services.Servers.AddDnsZoneRecord(domainId, recordName, DnsRecordType.A, recordData, 0);
int result = ES.Services.Servers.AddDnsZoneRecord(domainId, recordName, DnsRecordType.A, recordData, 0, 0, 0, 0);
if (result < 0)
{
ShowResultMessage(result);