DNS SRV Record support. Only supported with MS DNS Provider
This commit is contained in:
parent
a327e27e15
commit
452fcb7f47
28 changed files with 6890 additions and 4002 deletions
|
@ -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)
|
|
|
@ -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 ServiceItems AS Z ON D.ZoneItemID = Z.ItemID
|
||||||
LEFT OUTER JOIN Services AS S ON Z.ServiceID = S.ServiceID
|
LEFT OUTER JOIN Services AS S ON Z.ServiceID = S.ServiceID
|
||||||
LEFT OUTER JOIN Servers AS SRV ON S.ServerID = SRV.ServerID
|
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)
|
((@Recursive = 0 AND D.PackageID = @PackageID)
|
||||||
OR (@Recursive = 1 AND dbo.CheckPackageParent(@PackageID, D.PackageID) = 1))
|
OR (@Recursive = 1 AND dbo.CheckPackageParent(@PackageID, D.PackageID) = 1))
|
||||||
AND (@ServerID = 0 OR (@ServerID > 0 AND S.ServerID = @ServerID))
|
AND (@ServerID = 0 OR (@ServerID > 0 AND S.ServerID = @ServerID))
|
||||||
|
@ -3306,6 +3306,7 @@ CREATE PROCEDURE CheckDomain
|
||||||
(
|
(
|
||||||
@PackageID int,
|
@PackageID int,
|
||||||
@DomainName nvarchar(100),
|
@DomainName nvarchar(100),
|
||||||
|
@IsDomainPointer bit,
|
||||||
@Result int OUTPUT
|
@Result int OUTPUT
|
||||||
)
|
)
|
||||||
AS
|
AS
|
||||||
|
@ -3322,7 +3323,7 @@ SET @Result = 0 -- OK
|
||||||
-- check if the domain already exists
|
-- check if the domain already exists
|
||||||
IF EXISTS(
|
IF EXISTS(
|
||||||
SELECT DomainID FROM Domains
|
SELECT DomainID FROM Domains
|
||||||
WHERE DomainName = @DomainName
|
WHERE DomainName = @DomainName AND IsDomainPointer = @IsDomainPointer
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
SET @Result = -1
|
SET @Result = -1
|
||||||
|
@ -15772,6 +15773,9 @@ CREATE TABLE [dbo].[GlobalDnsRecords](
|
||||||
[ServerID] [int] NULL,
|
[ServerID] [int] NULL,
|
||||||
[PackageID] [int] NULL,
|
[PackageID] [int] NULL,
|
||||||
[IPAddressID] [int] NULL,
|
[IPAddressID] [int] NULL,
|
||||||
|
[SrvPriority] [int] NULL,
|
||||||
|
[SrvWeight] [int] NULL,
|
||||||
|
[SrvPort] [int] NULL,
|
||||||
CONSTRAINT [PK_GlobalDnsRecords] PRIMARY KEY CLUSTERED
|
CONSTRAINT [PK_GlobalDnsRecords] PRIMARY KEY CLUSTERED
|
||||||
(
|
(
|
||||||
[RecordID] ASC
|
[RecordID] ASC
|
||||||
|
@ -23347,6 +23351,9 @@ CREATE PROCEDURE UpdateDnsRecord
|
||||||
@RecordName nvarchar(50),
|
@RecordName nvarchar(50),
|
||||||
@RecordData nvarchar(500),
|
@RecordData nvarchar(500),
|
||||||
@MXPriority int,
|
@MXPriority int,
|
||||||
|
@SrvPriority int,
|
||||||
|
@SrvWeight int,
|
||||||
|
@SrvPort int,
|
||||||
@IPAddressID int
|
@IPAddressID int
|
||||||
)
|
)
|
||||||
AS
|
AS
|
||||||
|
@ -23377,6 +23384,9 @@ SET
|
||||||
RecordName = @RecordName,
|
RecordName = @RecordName,
|
||||||
RecordData = @RecordData,
|
RecordData = @RecordData,
|
||||||
MXPriority = @MXPriority,
|
MXPriority = @MXPriority,
|
||||||
|
SrvPriority = @SrvPriority,
|
||||||
|
SrvWeight = @SrvWeight,
|
||||||
|
SrvPort = @SrvPort,
|
||||||
IPAddressID = @IPAddressID
|
IPAddressID = @IPAddressID
|
||||||
WHERE
|
WHERE
|
||||||
RecordID = @RecordID
|
RecordID = @RecordID
|
||||||
|
@ -23484,6 +23494,9 @@ SELECT
|
||||||
NR.RecordName,
|
NR.RecordName,
|
||||||
NR.RecordData,
|
NR.RecordData,
|
||||||
NR.MXPriority,
|
NR.MXPriority,
|
||||||
|
NR.SrvPriority,
|
||||||
|
NR.SrvWeight,
|
||||||
|
NR.SrvPort,
|
||||||
NR.IPAddressID
|
NR.IPAddressID
|
||||||
FROM
|
FROM
|
||||||
GlobalDnsRecords AS NR
|
GlobalDnsRecords AS NR
|
||||||
|
@ -23669,6 +23682,9 @@ CREATE PROCEDURE AddDnsRecord
|
||||||
@RecordName nvarchar(50),
|
@RecordName nvarchar(50),
|
||||||
@RecordData nvarchar(500),
|
@RecordData nvarchar(500),
|
||||||
@MXPriority int,
|
@MXPriority int,
|
||||||
|
@SrvPriority int,
|
||||||
|
@SrvWeight int,
|
||||||
|
@SrvPort int,
|
||||||
@IPAddressID int
|
@IPAddressID int
|
||||||
)
|
)
|
||||||
AS
|
AS
|
||||||
|
@ -23693,8 +23709,12 @@ IF EXISTS
|
||||||
|
|
||||||
UPDATE GlobalDnsRecords
|
UPDATE GlobalDnsRecords
|
||||||
SET
|
SET
|
||||||
RecordData = RecordData,
|
RecordData = @RecordData,
|
||||||
MXPriority = MXPriority,
|
MXPriority = @MXPriority,
|
||||||
|
SrvPriority = @SrvPriority,
|
||||||
|
SrvWeight = @SrvWeight,
|
||||||
|
SrvPort = @SrvPort,
|
||||||
|
|
||||||
IPAddressID = @IPAddressID
|
IPAddressID = @IPAddressID
|
||||||
WHERE
|
WHERE
|
||||||
ServiceID = @ServiceID AND ServerID = @ServerID AND PackageID = @PackageID
|
ServiceID = @ServiceID AND ServerID = @ServerID AND PackageID = @PackageID
|
||||||
|
@ -23708,6 +23728,9 @@ ELSE
|
||||||
RecordName,
|
RecordName,
|
||||||
RecordData,
|
RecordData,
|
||||||
MXPriority,
|
MXPriority,
|
||||||
|
SrvPriority,
|
||||||
|
SrvWeight,
|
||||||
|
SrvPort,
|
||||||
IPAddressID
|
IPAddressID
|
||||||
)
|
)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -23719,6 +23742,9 @@ ELSE
|
||||||
@RecordName,
|
@RecordName,
|
||||||
@RecordData,
|
@RecordData,
|
||||||
@MXPriority,
|
@MXPriority,
|
||||||
|
@SrvPriority,
|
||||||
|
@SrvWeight,
|
||||||
|
@SrvPort,
|
||||||
@IPAddressID
|
@IPAddressID
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -35697,7 +35723,7 @@ BEGIN
|
||||||
GR.RecordName
|
GR.RecordName
|
||||||
FROM GlobalDNSRecords AS GR
|
FROM GlobalDNSRecords AS GR
|
||||||
WHERE GR.PackageID = @TmpPackageID
|
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
|
SET @ParentPackageID = NULL
|
||||||
|
|
||||||
|
@ -35725,7 +35751,7 @@ SELECT
|
||||||
GR.RecordName
|
GR.RecordName
|
||||||
FROM GlobalDNSRecords AS GR
|
FROM GlobalDNSRecords AS GR
|
||||||
WHERE GR.ServerID = @ServerID
|
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
|
-- select SERVICES DNS records
|
||||||
|
@ -35739,7 +35765,7 @@ SELECT
|
||||||
GR.RecordName
|
GR.RecordName
|
||||||
FROM GlobalDNSRecords AS GR
|
FROM GlobalDNSRecords AS GR
|
||||||
WHERE GR.ServiceID IN (SELECT ServiceID FROM PackageServices WHERE PackageID = @PackageID)
|
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
|
SELECT
|
||||||
|
@ -35751,12 +35777,16 @@ SELECT
|
||||||
NR.RecordName,
|
NR.RecordName,
|
||||||
NR.RecordData,
|
NR.RecordData,
|
||||||
NR.MXPriority,
|
NR.MXPriority,
|
||||||
|
NR.SrvPriority,
|
||||||
|
NR.SrvWeight,
|
||||||
|
NR.SrvPort,
|
||||||
NR.IPAddressID,
|
NR.IPAddressID,
|
||||||
ISNULL(IP.ExternalIP, '') AS ExternalIP,
|
ISNULL(IP.ExternalIP, '') AS ExternalIP,
|
||||||
ISNULL(IP.InternalIP, '') AS InternalIP,
|
ISNULL(IP.InternalIP, '') AS InternalIP,
|
||||||
CASE
|
CASE
|
||||||
WHEN NR.RecordType = 'A' AND NR.RecordData = '' THEN dbo.GetFullIPAddress(IP.ExternalIP, IP.InternalIP)
|
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 = 'MX' THEN CONVERT(varchar(3), NR.MXPriority) + ', ' + NR.RecordData
|
||||||
|
WHEN NR.RecordType = 'SRV' THEN CONVERT(varchar(3), NR.SrvPort) + ', ' + NR.RecordData
|
||||||
ELSE NR.RecordData
|
ELSE NR.RecordData
|
||||||
END AS FullRecordData,
|
END AS FullRecordData,
|
||||||
dbo.GetFullIPAddress(IP.ExternalIP, IP.InternalIP) AS IPAddress
|
dbo.GetFullIPAddress(IP.ExternalIP, IP.InternalIP) AS IPAddress
|
||||||
|
@ -35855,10 +35885,14 @@ SELECT
|
||||||
CASE
|
CASE
|
||||||
WHEN NR.RecordType = 'A' AND NR.RecordData = '' THEN dbo.GetFullIPAddress(IP.ExternalIP, IP.InternalIP)
|
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 = 'MX' THEN CONVERT(varchar(3), NR.MXPriority) + ', ' + NR.RecordData
|
||||||
|
WHEN NR.RecordType = 'SRV' THEN CONVERT(varchar(3), NR.SrvPort) + ', ' + NR.RecordData
|
||||||
ELSE NR.RecordData
|
ELSE NR.RecordData
|
||||||
END AS FullRecordData,
|
END AS FullRecordData,
|
||||||
NR.RecordData,
|
NR.RecordData,
|
||||||
NR.MXPriority,
|
NR.MXPriority,
|
||||||
|
NR.SrvPriority,
|
||||||
|
NR.SrvWeight,
|
||||||
|
NR.SrvPort,
|
||||||
NR.IPAddressID,
|
NR.IPAddressID,
|
||||||
dbo.GetFullIPAddress(IP.ExternalIP, IP.InternalIP) AS IPAddress,
|
dbo.GetFullIPAddress(IP.ExternalIP, IP.InternalIP) AS IPAddress,
|
||||||
IP.ExternalIP,
|
IP.ExternalIP,
|
||||||
|
@ -35958,9 +35992,13 @@ SELECT
|
||||||
CASE
|
CASE
|
||||||
WHEN NR.RecordType = 'A' AND NR.RecordData = '' THEN dbo.GetFullIPAddress(IP.ExternalIP, IP.InternalIP)
|
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 = 'MX' THEN CONVERT(varchar(3), NR.MXPriority) + ', ' + NR.RecordData
|
||||||
|
WHEN NR.RecordType = 'SRV' THEN CONVERT(varchar(3), NR.SrvPort) + ', ' + NR.RecordData
|
||||||
ELSE NR.RecordData
|
ELSE NR.RecordData
|
||||||
END AS FullRecordData,
|
END AS FullRecordData,
|
||||||
NR.MXPriority,
|
NR.MXPriority,
|
||||||
|
NR.SrvPriority,
|
||||||
|
NR.SrvWeight,
|
||||||
|
NR.SrvPort,
|
||||||
NR.IPAddressID,
|
NR.IPAddressID,
|
||||||
dbo.GetFullIPAddress(IP.ExternalIP, IP.InternalIP) AS IPAddress,
|
dbo.GetFullIPAddress(IP.ExternalIP, IP.InternalIP) AS IPAddress,
|
||||||
IP.ExternalIP,
|
IP.ExternalIP,
|
||||||
|
@ -36005,6 +36043,7 @@ RETURN
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GO
|
GO
|
||||||
|
@ -36062,10 +36101,14 @@ SELECT
|
||||||
NR.RecordName,
|
NR.RecordName,
|
||||||
NR.RecordData,
|
NR.RecordData,
|
||||||
NR.MXPriority,
|
NR.MXPriority,
|
||||||
|
NR.SrvPriority,
|
||||||
|
NR.SrvWeight,
|
||||||
|
NR.SrvPort,
|
||||||
NR.IPAddressID,
|
NR.IPAddressID,
|
||||||
CASE
|
CASE
|
||||||
WHEN NR.RecordType = 'A' AND NR.RecordData = '' THEN dbo.GetFullIPAddress(IP.ExternalIP, IP.InternalIP)
|
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 = 'MX' THEN CONVERT(varchar(3), NR.MXPriority) + ', ' + NR.RecordData
|
||||||
|
WHEN NR.RecordType = 'SRV' THEN CONVERT(varchar(3), NR.SrvPort) + ', ' + NR.RecordData
|
||||||
ELSE NR.RecordData
|
ELSE NR.RecordData
|
||||||
END AS FullRecordData,
|
END AS FullRecordData,
|
||||||
dbo.GetFullIPAddress(IP.ExternalIP, IP.InternalIP) AS IPAddress,
|
dbo.GetFullIPAddress(IP.ExternalIP, IP.InternalIP) AS IPAddress,
|
||||||
|
|
|
@ -853,4 +853,657 @@ IF NOT EXISTS (SELECT * FROM [dbo].[ServiceDefaultProperties] WHERE [ProviderID]
|
||||||
BEGIN
|
BEGIN
|
||||||
INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (63, N'AdminPassword', N'')
|
INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (63, N'AdminPassword', N'')
|
||||||
END
|
END
|
||||||
GO
|
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
|
||||||
|
|
|
@ -36,6 +36,22 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
public class GlobalDnsRecord
|
public class GlobalDnsRecord
|
||||||
{
|
{
|
||||||
private int recordId;
|
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
|
public int RecordId
|
||||||
{
|
{
|
||||||
|
@ -43,63 +59,54 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
set { recordId = value; }
|
set { recordId = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private int recordOrder;
|
|
||||||
|
|
||||||
public int RecordOrder
|
public int RecordOrder
|
||||||
{
|
{
|
||||||
get { return recordOrder; }
|
get { return recordOrder; }
|
||||||
set { recordOrder = value; }
|
set { recordOrder = value; }
|
||||||
}
|
}
|
||||||
private int groupId;
|
|
||||||
|
|
||||||
public int GroupId
|
public int GroupId
|
||||||
{
|
{
|
||||||
get { return groupId; }
|
get { return groupId; }
|
||||||
set { groupId = value; }
|
set { groupId = value; }
|
||||||
}
|
}
|
||||||
private int serviceId;
|
|
||||||
|
|
||||||
public int ServiceId
|
public int ServiceId
|
||||||
{
|
{
|
||||||
get { return serviceId; }
|
get { return serviceId; }
|
||||||
set { serviceId = value; }
|
set { serviceId = value; }
|
||||||
}
|
}
|
||||||
private int serverId;
|
|
||||||
|
|
||||||
public int ServerId
|
public int ServerId
|
||||||
{
|
{
|
||||||
get { return serverId; }
|
get { return serverId; }
|
||||||
set { serverId = value; }
|
set { serverId = value; }
|
||||||
}
|
}
|
||||||
private int packageId;
|
|
||||||
|
|
||||||
public int PackageId
|
public int PackageId
|
||||||
{
|
{
|
||||||
get { return packageId; }
|
get { return packageId; }
|
||||||
set { packageId = value; }
|
set { packageId = value; }
|
||||||
}
|
}
|
||||||
private string recordType;
|
|
||||||
|
|
||||||
public string RecordType
|
public string RecordType
|
||||||
{
|
{
|
||||||
get { return recordType; }
|
get { return recordType; }
|
||||||
set { recordType = value; }
|
set { recordType = value; }
|
||||||
}
|
}
|
||||||
private string recordName;
|
|
||||||
|
|
||||||
public string RecordName
|
public string RecordName
|
||||||
{
|
{
|
||||||
get { return recordName; }
|
get { return recordName; }
|
||||||
set { recordName = value; }
|
set { recordName = value; }
|
||||||
}
|
}
|
||||||
private string recordData;
|
|
||||||
|
|
||||||
public string RecordData
|
public string RecordData
|
||||||
{
|
{
|
||||||
get { return recordData; }
|
get { return recordData; }
|
||||||
set { recordData = value; }
|
set { recordData = value; }
|
||||||
}
|
}
|
||||||
private int mxPriority;
|
|
||||||
|
|
||||||
public int MxPriority
|
public int MxPriority
|
||||||
{
|
{
|
||||||
|
@ -107,7 +114,6 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
set { mxPriority = value; }
|
set { mxPriority = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private int ipAddressId;
|
|
||||||
|
|
||||||
public int IpAddressId
|
public int IpAddressId
|
||||||
{
|
{
|
||||||
|
@ -115,9 +121,6 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
set { ipAddressId = value; }
|
set { ipAddressId = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private string internalIP;
|
|
||||||
private string externalIP;
|
|
||||||
|
|
||||||
public GlobalDnsRecord()
|
public GlobalDnsRecord()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -133,5 +136,24 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
get { return this.externalIP; }
|
get { return this.externalIP; }
|
||||||
set { this.externalIP = value; }
|
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; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load diff
|
@ -675,7 +675,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddDnsRecord(int actorId, int serviceId, int serverId, int packageId, string recordType,
|
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,
|
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
|
||||||
ObjectQualifier + "AddDnsRecord",
|
ObjectQualifier + "AddDnsRecord",
|
||||||
|
@ -687,11 +687,14 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
new SqlParameter("@RecordName", recordName),
|
new SqlParameter("@RecordName", recordName),
|
||||||
new SqlParameter("@RecordData", recordData),
|
new SqlParameter("@RecordData", recordData),
|
||||||
new SqlParameter("@MXPriority", mxPriority),
|
new SqlParameter("@MXPriority", mxPriority),
|
||||||
|
new SqlParameter("@SrvPriority", SrvPriority),
|
||||||
|
new SqlParameter("@SrvWeight", SrvWeight),
|
||||||
|
new SqlParameter("@SrvPort", SrvPort),
|
||||||
new SqlParameter("@IpAddressId", ipAddressId));
|
new SqlParameter("@IpAddressId", ipAddressId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void UpdateDnsRecord(int actorId, int recordId, string recordType,
|
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,
|
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
|
||||||
ObjectQualifier + "UpdateDnsRecord",
|
ObjectQualifier + "UpdateDnsRecord",
|
||||||
|
@ -701,9 +704,13 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
new SqlParameter("@RecordName", recordName),
|
new SqlParameter("@RecordName", recordName),
|
||||||
new SqlParameter("@RecordData", recordData),
|
new SqlParameter("@RecordData", recordData),
|
||||||
new SqlParameter("@MXPriority", mxPriority),
|
new SqlParameter("@MXPriority", mxPriority),
|
||||||
|
new SqlParameter("@SrvPriority", SrvPriority),
|
||||||
|
new SqlParameter("@SrvWeight", SrvWeight),
|
||||||
|
new SqlParameter("@SrvPort", SrvPort),
|
||||||
new SqlParameter("@IpAddressId", ipAddressId));
|
new SqlParameter("@IpAddressId", ipAddressId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void DeleteDnsRecord(int actorId, int recordId)
|
public static void DeleteDnsRecord(int actorId, int recordId)
|
||||||
{
|
{
|
||||||
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
|
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
|
||||||
|
@ -763,7 +770,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
new SqlParameter("@domainName", domainName));
|
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);
|
SqlParameter prmId = new SqlParameter("@Result", SqlDbType.Int);
|
||||||
prmId.Direction = ParameterDirection.Output;
|
prmId.Direction = ParameterDirection.Output;
|
||||||
|
@ -772,7 +779,8 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
ObjectQualifier + "CheckDomain",
|
ObjectQualifier + "CheckDomain",
|
||||||
prmId,
|
prmId,
|
||||||
new SqlParameter("@packageId", packageId),
|
new SqlParameter("@packageId", packageId),
|
||||||
new SqlParameter("@domainName", domainName));
|
new SqlParameter("@domainName", domainName),
|
||||||
|
new SqlParameter("@isDomainPointer", isDomainPointer));
|
||||||
|
|
||||||
return Convert.ToInt32(prmId.Value);
|
return Convert.ToInt32(prmId.Value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,158 +38,157 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
{
|
{
|
||||||
public class DnsServerController : IImportController, IBackupController
|
public class DnsServerController : IImportController, IBackupController
|
||||||
{
|
{
|
||||||
private static DNSServer GetDNSServer(int serviceId)
|
private static DNSServer GetDNSServer(int serviceId)
|
||||||
{
|
{
|
||||||
DNSServer dns = new DNSServer();
|
DNSServer dns = new DNSServer();
|
||||||
ServiceProviderProxy.Init(dns, serviceId);
|
ServiceProviderProxy.Init(dns, serviceId);
|
||||||
return dns;
|
return dns;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int AddZone(int packageId, int serviceId, string zoneName)
|
public static int AddZone(int packageId, int serviceId, string zoneName)
|
||||||
{
|
{
|
||||||
return AddZone(packageId, serviceId, zoneName, true);
|
return AddZone(packageId, serviceId, zoneName, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int AddZone(int packageId, int serviceId, string zoneName, bool addPackageItem)
|
public static int AddZone(int packageId, int serviceId, string zoneName, bool addPackageItem)
|
||||||
{
|
{
|
||||||
// get DNS provider
|
// get DNS provider
|
||||||
DNSServer dns = GetDNSServer(serviceId);
|
DNSServer dns = GetDNSServer(serviceId);
|
||||||
|
|
||||||
// check if zone already exists
|
// check if zone already exists
|
||||||
if (dns.ZoneExists(zoneName))
|
if (dns.ZoneExists(zoneName))
|
||||||
return BusinessErrorCodes.ERROR_DNS_ZONE_EXISTS;
|
return BusinessErrorCodes.ERROR_DNS_ZONE_EXISTS;
|
||||||
|
|
||||||
//
|
//
|
||||||
TaskManager.StartTask("DNS_ZONE", "ADD", zoneName);
|
TaskManager.StartTask("DNS_ZONE", "ADD", zoneName);
|
||||||
//
|
//
|
||||||
int zoneItemId = default(int);
|
int zoneItemId = default(int);
|
||||||
//
|
//
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// get secondary DNS services
|
// get secondary DNS services
|
||||||
StringDictionary primSettings = ServerController.GetServiceSettings(serviceId);
|
StringDictionary primSettings = ServerController.GetServiceSettings(serviceId);
|
||||||
string[] primaryIPAddresses = GetExternalIPAddressesFromString(primSettings["ListeningIPAddresses"]);
|
string[] primaryIPAddresses = GetExternalIPAddressesFromString(primSettings["ListeningIPAddresses"]);
|
||||||
|
|
||||||
List<string> secondaryIPAddresses = new List<string>();
|
List<string> secondaryIPAddresses = new List<string>();
|
||||||
List<int> secondaryServiceIds = new List<int>();
|
List<int> secondaryServiceIds = new List<int>();
|
||||||
string strSecondaryServices = primSettings["SecondaryDNSServices"];
|
string strSecondaryServices = primSettings["SecondaryDNSServices"];
|
||||||
if (!String.IsNullOrEmpty(strSecondaryServices))
|
if (!String.IsNullOrEmpty(strSecondaryServices))
|
||||||
{
|
{
|
||||||
string[] secondaryServices = strSecondaryServices.Split(',');
|
string[] secondaryServices = strSecondaryServices.Split(',');
|
||||||
foreach (string strSecondaryId in secondaryServices)
|
foreach (string strSecondaryId in secondaryServices)
|
||||||
{
|
{
|
||||||
int secondaryId = Utils.ParseInt(strSecondaryId, 0);
|
int secondaryId = Utils.ParseInt(strSecondaryId, 0);
|
||||||
if (secondaryId == 0)
|
if (secondaryId == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
secondaryServiceIds.Add(secondaryId);
|
secondaryServiceIds.Add(secondaryId);
|
||||||
StringDictionary secondarySettings = ServerController.GetServiceSettings(secondaryId);
|
StringDictionary secondarySettings = ServerController.GetServiceSettings(secondaryId);
|
||||||
|
|
||||||
// add secondary IPs to the master array
|
// add secondary IPs to the master array
|
||||||
secondaryIPAddresses.AddRange(
|
secondaryIPAddresses.AddRange(
|
||||||
GetExternalIPAddressesFromString(secondarySettings["ListeningIPAddresses"]));
|
GetExternalIPAddressesFromString(secondarySettings["ListeningIPAddresses"]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add "Allow zone transfers"
|
// add "Allow zone transfers"
|
||||||
string allowTransfers = primSettings["AllowZoneTransfers"];
|
string allowTransfers = primSettings["AllowZoneTransfers"];
|
||||||
if (!String.IsNullOrEmpty(allowTransfers))
|
if (!String.IsNullOrEmpty(allowTransfers))
|
||||||
{
|
{
|
||||||
string[] ips = Utils.ParseDelimitedString(allowTransfers, '\n', ' ', ',', ';');
|
string[] ips = Utils.ParseDelimitedString(allowTransfers, '\n', ' ', ',', ';');
|
||||||
foreach (string ip in ips)
|
foreach (string ip in ips)
|
||||||
{
|
{
|
||||||
if (!secondaryIPAddresses.Contains(ip))
|
if (!secondaryIPAddresses.Contains(ip))
|
||||||
secondaryIPAddresses.Add(ip);
|
secondaryIPAddresses.Add(ip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add primary zone
|
// add primary zone
|
||||||
dns.AddPrimaryZone(zoneName, secondaryIPAddresses.ToArray());
|
dns.AddPrimaryZone(zoneName, secondaryIPAddresses.ToArray());
|
||||||
|
|
||||||
// get DNS zone records
|
// get DNS zone records
|
||||||
List<GlobalDnsRecord> records = ServerController.GetDnsRecordsTotal(packageId);
|
List<GlobalDnsRecord> records = ServerController.GetDnsRecordsTotal(packageId);
|
||||||
|
|
||||||
// get name servers
|
// get name servers
|
||||||
PackageSettings packageSettings = PackageController.GetPackageSettings(packageId, PackageSettings.NAME_SERVERS);
|
PackageSettings packageSettings = PackageController.GetPackageSettings(packageId, PackageSettings.NAME_SERVERS);
|
||||||
string[] nameServers = new string[] { };
|
string[] nameServers = new string[] { };
|
||||||
if (!String.IsNullOrEmpty(packageSettings["NameServers"]))
|
if (!String.IsNullOrEmpty(packageSettings["NameServers"]))
|
||||||
nameServers = packageSettings["NameServers"].Split(';');
|
nameServers = packageSettings["NameServers"].Split(';');
|
||||||
|
|
||||||
// build records list
|
// build records list
|
||||||
List<DnsRecord> zoneRecords = new List<DnsRecord>();
|
List<DnsRecord> zoneRecords = new List<DnsRecord>();
|
||||||
|
|
||||||
string primaryNameServer = "ns." + zoneName;
|
string primaryNameServer = "ns." + zoneName;
|
||||||
|
|
||||||
if (nameServers.Length > 0)
|
if (nameServers.Length > 0)
|
||||||
primaryNameServer = nameServers[0];
|
primaryNameServer = nameServers[0];
|
||||||
|
|
||||||
// update SOA record
|
// update SOA record
|
||||||
|
|
||||||
string hostmaster = primSettings["ResponsiblePerson"];
|
string hostmaster = primSettings["ResponsiblePerson"];
|
||||||
if (String.IsNullOrEmpty(hostmaster))
|
if (String.IsNullOrEmpty(hostmaster))
|
||||||
{
|
{
|
||||||
hostmaster = "hostmaster." + zoneName;
|
hostmaster = "hostmaster." + zoneName;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hostmaster = Utils.ReplaceStringVariable(hostmaster, "domain_name", zoneName);
|
hostmaster = Utils.ReplaceStringVariable(hostmaster, "domain_name", zoneName);
|
||||||
}
|
}
|
||||||
|
|
||||||
dns.UpdateSoaRecord(zoneName, "", primaryNameServer, hostmaster);
|
dns.UpdateSoaRecord(zoneName, "", primaryNameServer, hostmaster);
|
||||||
|
|
||||||
// add name servers
|
// add name servers
|
||||||
foreach (string nameServer in nameServers)
|
foreach (string nameServer in nameServers)
|
||||||
{
|
{
|
||||||
DnsRecord ns = new DnsRecord();
|
DnsRecord ns = new DnsRecord();
|
||||||
ns.RecordType = DnsRecordType.NS;
|
ns.RecordType = DnsRecordType.NS;
|
||||||
ns.RecordName = "";
|
ns.RecordName = "";
|
||||||
ns.RecordData = nameServer;
|
ns.RecordData = nameServer;
|
||||||
|
|
||||||
zoneRecords.Add(ns);
|
zoneRecords.Add(ns);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add all other records
|
// add all other records
|
||||||
zoneRecords.AddRange(
|
zoneRecords.AddRange(BuildDnsResourceRecords(records, zoneName, ""));
|
||||||
BuildDnsResourceRecords(records, zoneName, ""));
|
|
||||||
|
|
||||||
// add zone records
|
// add zone records
|
||||||
dns.AddZoneRecords(zoneName, zoneRecords.ToArray());
|
dns.AddZoneRecords(zoneName, zoneRecords.ToArray());
|
||||||
|
|
||||||
|
|
||||||
// add secondary zones
|
// add secondary zones
|
||||||
foreach (int secondaryId in secondaryServiceIds)
|
foreach (int secondaryId in secondaryServiceIds)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// add secondary zone
|
// add secondary zone
|
||||||
DNSServer secDns = GetDNSServer(secondaryId);
|
DNSServer secDns = GetDNSServer(secondaryId);
|
||||||
secDns.AddSecondaryZone(zoneName, primaryIPAddresses);
|
secDns.AddSecondaryZone(zoneName, primaryIPAddresses);
|
||||||
RegisterZoneItems(packageId, secondaryId, zoneName, false);
|
RegisterZoneItems(packageId, secondaryId, zoneName, false);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
TaskManager.WriteError(ex, "Error adding secondary zone (service ID = " + secondaryId + ")");
|
TaskManager.WriteError(ex, "Error adding secondary zone (service ID = " + secondaryId + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!addPackageItem)
|
if (!addPackageItem)
|
||||||
return 0;
|
return 0;
|
||||||
// add service item
|
// add service item
|
||||||
zoneItemId = RegisterZoneItems(packageId, serviceId, zoneName, true);
|
zoneItemId = RegisterZoneItems(packageId, serviceId, zoneName, true);
|
||||||
//
|
//
|
||||||
TaskManager.ItemId = zoneItemId;
|
TaskManager.ItemId = zoneItemId;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
TaskManager.WriteError(ex);
|
TaskManager.WriteError(ex);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
TaskManager.CompleteTask();
|
TaskManager.CompleteTask();
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
return zoneItemId;
|
return zoneItemId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static int RegisterZoneItems(int spaceId, int serviceId, string zoneName, bool primaryZone)
|
private static int RegisterZoneItems(int spaceId, int serviceId, string zoneName, bool primaryZone)
|
||||||
|
@ -202,131 +201,138 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
int zoneItemId = PackageController.AddPackageItem(zone);
|
int zoneItemId = PackageController.AddPackageItem(zone);
|
||||||
return zoneItemId;
|
return zoneItemId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int DeleteZone(int zoneItemId)
|
public static int DeleteZone(int zoneItemId)
|
||||||
{
|
{
|
||||||
// delete DNS zone if applicable
|
// delete DNS zone if applicable
|
||||||
DnsZone zoneItem = (DnsZone)PackageController.GetPackageItem(zoneItemId);
|
DnsZone zoneItem = (DnsZone)PackageController.GetPackageItem(zoneItemId);
|
||||||
//
|
//
|
||||||
if (zoneItem != null)
|
if (zoneItem != null)
|
||||||
{
|
{
|
||||||
TaskManager.StartTask("DNS_ZONE", "DELETE", zoneItem.Name);
|
TaskManager.StartTask("DNS_ZONE", "DELETE", zoneItem.Name);
|
||||||
//
|
//
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
TaskManager.ItemId = zoneItemId;
|
TaskManager.ItemId = zoneItemId;
|
||||||
// delete DNS zone
|
// delete DNS zone
|
||||||
DNSServer dns = new DNSServer();
|
DNSServer dns = new DNSServer();
|
||||||
ServiceProviderProxy.Init(dns, zoneItem.ServiceId);
|
ServiceProviderProxy.Init(dns, zoneItem.ServiceId);
|
||||||
|
|
||||||
// delete secondary zones
|
// delete secondary zones
|
||||||
StringDictionary primSettings = ServerController.GetServiceSettings(zoneItem.ServiceId);
|
StringDictionary primSettings = ServerController.GetServiceSettings(zoneItem.ServiceId);
|
||||||
string strSecondaryServices = primSettings["SecondaryDNSServices"];
|
string strSecondaryServices = primSettings["SecondaryDNSServices"];
|
||||||
if (!String.IsNullOrEmpty(strSecondaryServices))
|
if (!String.IsNullOrEmpty(strSecondaryServices))
|
||||||
{
|
{
|
||||||
string[] secondaryServices = strSecondaryServices.Split(',');
|
string[] secondaryServices = strSecondaryServices.Split(',');
|
||||||
foreach (string strSecondaryId in secondaryServices)
|
foreach (string strSecondaryId in secondaryServices)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int secondaryId = Utils.ParseInt(strSecondaryId, 0);
|
int secondaryId = Utils.ParseInt(strSecondaryId, 0);
|
||||||
if (secondaryId == 0)
|
if (secondaryId == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
DNSServer secDns = new DNSServer();
|
DNSServer secDns = new DNSServer();
|
||||||
ServiceProviderProxy.Init(secDns, secondaryId);
|
ServiceProviderProxy.Init(secDns, secondaryId);
|
||||||
|
|
||||||
secDns.DeleteZone(zoneItem.Name);
|
secDns.DeleteZone(zoneItem.Name);
|
||||||
}
|
}
|
||||||
catch (Exception ex1)
|
catch (Exception ex1)
|
||||||
{
|
{
|
||||||
// problem when deleting secondary zone
|
// problem when deleting secondary zone
|
||||||
TaskManager.WriteError(ex1, "Error deleting secondary DNS zone");
|
TaskManager.WriteError(ex1, "Error deleting secondary DNS zone");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dns.DeleteZone(zoneItem.Name);
|
dns.DeleteZone(zoneItem.Name);
|
||||||
}
|
}
|
||||||
catch (Exception ex2)
|
catch (Exception ex2)
|
||||||
{
|
{
|
||||||
TaskManager.WriteError(ex2, "Error deleting primary DNS zone");
|
TaskManager.WriteError(ex2, "Error deleting primary DNS zone");
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete service item
|
// delete service item
|
||||||
PackageController.DeletePackageItem(zoneItemId);
|
PackageController.DeletePackageItem(zoneItemId);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
TaskManager.WriteError(ex);
|
TaskManager.WriteError(ex);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
TaskManager.CompleteTask();
|
TaskManager.CompleteTask();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<DnsRecord> BuildDnsResourceRecords(List<GlobalDnsRecord> records,
|
public static List<DnsRecord> BuildDnsResourceRecords(List<GlobalDnsRecord> records, string domainName, string serviceIP)
|
||||||
string domainName, string serviceIP)
|
{
|
||||||
{
|
List<DnsRecord> zoneRecords = new List<DnsRecord>();
|
||||||
List<DnsRecord> zoneRecords = new List<DnsRecord>();
|
|
||||||
|
|
||||||
foreach (GlobalDnsRecord record in records)
|
foreach (GlobalDnsRecord record in records)
|
||||||
{
|
{
|
||||||
DnsRecord rr = new DnsRecord();
|
DnsRecord rr = new DnsRecord();
|
||||||
rr.RecordType = (DnsRecordType)Enum.Parse(typeof(DnsRecordType), record.RecordType, true);
|
rr.RecordType = (DnsRecordType)Enum.Parse(typeof(DnsRecordType), record.RecordType, true);
|
||||||
rr.RecordName = record.RecordName;
|
rr.RecordName = record.RecordName;
|
||||||
|
|
||||||
|
if (record.RecordType == "A")
|
||||||
|
{
|
||||||
|
rr.RecordData = String.IsNullOrEmpty(record.RecordData) ? record.ExternalIP : record.RecordData;
|
||||||
|
rr.RecordData = Utils.ReplaceStringVariable(rr.RecordData, "ip", record.ExternalIP);
|
||||||
|
|
||||||
if (record.RecordType == "A")
|
if (String.IsNullOrEmpty(rr.RecordData) && !String.IsNullOrEmpty(serviceIP))
|
||||||
{
|
rr.RecordData = serviceIP;
|
||||||
rr.RecordData = String.IsNullOrEmpty(record.RecordData) ? record.ExternalIP : record.RecordData;
|
}
|
||||||
rr.RecordData = Utils.ReplaceStringVariable(rr.RecordData, "ip", record.ExternalIP);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
if (String.IsNullOrEmpty(rr.RecordData) && !String.IsNullOrEmpty(serviceIP))
|
// substitute variables
|
||||||
rr.RecordData = serviceIP;
|
rr.RecordData = Utils.ReplaceStringVariable(rr.RecordData, "domain_name", domainName);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rr.RecordData = record.RecordData;
|
|
||||||
}
|
|
||||||
|
|
||||||
// substitute variables
|
// add MX priority
|
||||||
rr.RecordData = Utils.ReplaceStringVariable(rr.RecordData, "domain_name", domainName);
|
if (record.RecordType == "MX")
|
||||||
|
rr.MxPriority = record.MxPriority;
|
||||||
|
|
||||||
// add MX priority
|
if (!String.IsNullOrEmpty(rr.RecordData))
|
||||||
if (record.RecordType == "MX")
|
zoneRecords.Add(rr);
|
||||||
rr.MxPriority = record.MxPriority;
|
}
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(rr.RecordData))
|
return zoneRecords;
|
||||||
zoneRecords.Add(rr);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return zoneRecords;
|
public static string[] GetExternalIPAddressesFromString(string str)
|
||||||
}
|
{
|
||||||
|
List<string> ips = new List<string>();
|
||||||
|
|
||||||
public static string[] GetExternalIPAddressesFromString(string str)
|
if (str != null && str.Trim() != "")
|
||||||
{
|
{
|
||||||
List<string> ips = new List<string>();
|
string[] sips = str.Split(',');
|
||||||
|
foreach (string sip in sips)
|
||||||
|
{
|
||||||
|
IPAddressInfo ip = ServerController.GetIPAddress(Int32.Parse(sip));
|
||||||
|
if (ip != null)
|
||||||
|
ips.Add(ip.ExternalIP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (str != null && str.Trim() != "")
|
return ips.ToArray();
|
||||||
{
|
}
|
||||||
string[] sips = str.Split(',');
|
|
||||||
foreach (string sip in sips)
|
|
||||||
{
|
|
||||||
IPAddressInfo ip = ServerController.GetIPAddress(Int32.Parse(sip));
|
|
||||||
if (ip != null)
|
|
||||||
ips.Add(ip.ExternalIP);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ips.ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
#region IImportController Members
|
#region IImportController Members
|
||||||
|
|
||||||
|
@ -350,7 +356,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ImportItem(int packageId, int itemTypeId, Type itemType,
|
public void ImportItem(int packageId, int itemTypeId, Type itemType,
|
||||||
ResourceGroupInfo group, string itemName)
|
ResourceGroupInfo group, string itemName)
|
||||||
{
|
{
|
||||||
// get service id
|
// get service id
|
||||||
int serviceId = PackageController.GetPackageServiceId(packageId, group.GroupName);
|
int serviceId = PackageController.GetPackageServiceId(packageId, group.GroupName);
|
||||||
|
@ -395,11 +401,11 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
public int BackupItem(string tempFolder, XmlWriter writer, ServiceProviderItem item, ResourceGroupInfo group)
|
public int BackupItem(string tempFolder, XmlWriter writer, ServiceProviderItem item, ResourceGroupInfo group)
|
||||||
{
|
{
|
||||||
if (!(item is DnsZone))
|
if (!(item is DnsZone))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// DNS provider
|
// DNS provider
|
||||||
DNSServer dns = GetDNSServer(item.ServiceId);
|
DNSServer dns = GetDNSServer(item.ServiceId);
|
||||||
|
|
||||||
// zone records serialized
|
// zone records serialized
|
||||||
XmlSerializer serializer = new XmlSerializer(typeof(DnsRecord));
|
XmlSerializer serializer = new XmlSerializer(typeof(DnsRecord));
|
||||||
|
@ -424,31 +430,31 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
public int RestoreItem(string tempFolder, XmlNode itemNode, int itemId, Type itemType,
|
public int RestoreItem(string tempFolder, XmlNode itemNode, int itemId, Type itemType,
|
||||||
string itemName, int packageId, int serviceId, ResourceGroupInfo group)
|
string itemName, int packageId, int serviceId, ResourceGroupInfo group)
|
||||||
{
|
{
|
||||||
if (itemType != typeof(DnsZone))
|
if (itemType != typeof(DnsZone))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// DNS provider
|
// DNS provider
|
||||||
DNSServer dns = GetDNSServer(serviceId);
|
DNSServer dns = GetDNSServer(serviceId);
|
||||||
|
|
||||||
// check service item
|
// check service item
|
||||||
if (!dns.ZoneExists(itemName))
|
if (!dns.ZoneExists(itemName))
|
||||||
{
|
{
|
||||||
// create primary and secondary zones
|
// create primary and secondary zones
|
||||||
AddZone(packageId, serviceId, itemName, false);
|
AddZone(packageId, serviceId, itemName, false);
|
||||||
|
|
||||||
// restore records
|
// restore records
|
||||||
XmlSerializer serializer = new XmlSerializer(typeof(DnsRecord));
|
XmlSerializer serializer = new XmlSerializer(typeof(DnsRecord));
|
||||||
List<DnsRecord> records = new List<DnsRecord>();
|
List<DnsRecord> records = new List<DnsRecord>();
|
||||||
foreach (XmlNode childNode in itemNode.ChildNodes)
|
foreach (XmlNode childNode in itemNode.ChildNodes)
|
||||||
{
|
{
|
||||||
if (childNode.Name == "DnsRecord")
|
if (childNode.Name == "DnsRecord")
|
||||||
{
|
{
|
||||||
records.Add((DnsRecord)serializer.Deserialize(new XmlNodeReader(childNode)));
|
records.Add((DnsRecord)serializer.Deserialize(new XmlNodeReader(childNode)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dns.AddZoneRecords(itemName, records.ToArray());
|
dns.AddZoneRecords(itemName, records.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if meta-item exists
|
// check if meta-item exists
|
||||||
int zoneId = 0;
|
int zoneId = 0;
|
||||||
|
@ -470,7 +476,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
// restore domains
|
// restore domains
|
||||||
RestoreDomainByZone(itemName, packageId, zoneId);
|
RestoreDomainByZone(itemName, packageId, zoneId);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -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)
|
if (res != 0)
|
||||||
{
|
{
|
||||||
CompleteTask(ret, CrmErrorCodes.CANNOT_CREATE_DNS_ZONE, null,
|
CompleteTask(ret, CrmErrorCodes.CANNOT_CREATE_DNS_ZONE, null,
|
||||||
|
|
|
@ -460,7 +460,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
domain.PackageId = packageId;
|
domain.PackageId = packageId;
|
||||||
domain.DomainName = domainName;
|
domain.DomainName = domainName;
|
||||||
domain.HostingAllowed = false;
|
domain.HostingAllowed = false;
|
||||||
domainId = ServerController.AddDomain(domain, createInstantAlias);
|
domainId = ServerController.AddDomain(domain, createInstantAlias, true);
|
||||||
if (domainId < 0)
|
if (domainId < 0)
|
||||||
{
|
{
|
||||||
result.Result = domainId;
|
result.Result = domainId;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2012, Outercurve Foundation.
|
// Copyright (c) 2011, Outercurve Foundation.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without modification,
|
// Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
@ -122,20 +122,20 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// TO-DO: Check connectivity
|
// TO-DO: Check connectivity
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
catch (WebException ex)
|
catch (WebException ex)
|
||||||
{
|
{
|
||||||
HttpWebResponse response = (HttpWebResponse)ex.Response;
|
HttpWebResponse response = (HttpWebResponse)ex.Response;
|
||||||
if (response != null && response.StatusCode == HttpStatusCode.NotFound)
|
if (response != null && response.StatusCode == HttpStatusCode.NotFound)
|
||||||
return BusinessErrorCodes.ERROR_ADD_SERVER_NOT_FOUND;
|
return BusinessErrorCodes.ERROR_ADD_SERVER_NOT_FOUND;
|
||||||
else if (response != null && response.StatusCode == HttpStatusCode.BadRequest)
|
else if (response != null && response.StatusCode == HttpStatusCode.BadRequest)
|
||||||
return BusinessErrorCodes.ERROR_ADD_SERVER_BAD_REQUEST;
|
return BusinessErrorCodes.ERROR_ADD_SERVER_BAD_REQUEST;
|
||||||
else if (response != null && response.StatusCode == HttpStatusCode.InternalServerError)
|
else if (response != null && response.StatusCode == HttpStatusCode.InternalServerError)
|
||||||
return BusinessErrorCodes.ERROR_ADD_SERVER_INTERNAL_SERVER_ERROR;
|
return BusinessErrorCodes.ERROR_ADD_SERVER_INTERNAL_SERVER_ERROR;
|
||||||
else if (response != null && response.StatusCode == HttpStatusCode.ServiceUnavailable)
|
else if (response != null && response.StatusCode == HttpStatusCode.ServiceUnavailable)
|
||||||
return BusinessErrorCodes.ERROR_ADD_SERVER_SERVICE_UNAVAILABLE;
|
return BusinessErrorCodes.ERROR_ADD_SERVER_SERVICE_UNAVAILABLE;
|
||||||
else if (response != null && response.StatusCode == HttpStatusCode.Unauthorized)
|
else if (response != null && response.StatusCode == HttpStatusCode.Unauthorized)
|
||||||
return BusinessErrorCodes.ERROR_ADD_SERVER_UNAUTHORIZED;
|
return BusinessErrorCodes.ERROR_ADD_SERVER_UNAUTHORIZED;
|
||||||
if (ex.Message.Contains("The remote name could not be resolved") || ex.Message.Contains("Unable to connect"))
|
if (ex.Message.Contains("The remote name could not be resolved") || ex.Message.Contains("Unable to connect"))
|
||||||
{
|
{
|
||||||
|
@ -155,7 +155,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
{
|
{
|
||||||
TaskManager.WriteError("General Server Error");
|
TaskManager.WriteError("General Server Error");
|
||||||
TaskManager.WriteError(ex);
|
TaskManager.WriteError(ex);
|
||||||
return BusinessErrorCodes.ERROR_ADD_SERVER_APPLICATION_ERROR;
|
return BusinessErrorCodes.ERROR_ADD_SERVER_APPLICATION_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -220,7 +220,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
throw new ApplicationException("Could not find services. General error was occued.", ex);
|
throw new ApplicationException("Could not find services. General error was occued.", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int AddServer(ServerInfo server, bool autoDiscovery)
|
public static int AddServer(ServerInfo server, bool autoDiscovery)
|
||||||
{
|
{
|
||||||
// check account
|
// check account
|
||||||
|
@ -243,8 +243,8 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskManager.StartTask("SERVER", "ADD", server.ServerName);
|
TaskManager.StartTask("SERVER", "ADD", server.ServerName);
|
||||||
|
|
||||||
int serverId = DataProvider.AddServer(server.ServerName, server.ServerUrl,
|
int serverId = DataProvider.AddServer(server.ServerName, server.ServerUrl,
|
||||||
CryptoUtils.Encrypt(server.Password), server.Comments, server.VirtualServer, server.InstantDomainAlias,
|
CryptoUtils.Encrypt(server.Password), server.Comments, server.VirtualServer, server.InstantDomainAlias,
|
||||||
server.PrimaryGroupId, server.ADEnabled, server.ADRootDomain, server.ADUsername, CryptoUtils.Encrypt(server.ADPassword),
|
server.PrimaryGroupId, server.ADEnabled, server.ADRootDomain, server.ADUsername, CryptoUtils.Encrypt(server.ADPassword),
|
||||||
server.ADAuthenticationType);
|
server.ADAuthenticationType);
|
||||||
|
@ -261,7 +261,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
TaskManager.WriteError(ex);
|
TaskManager.WriteError(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskManager.ItemId = serverId;
|
TaskManager.ItemId = serverId;
|
||||||
TaskManager.CompleteTask();
|
TaskManager.CompleteTask();
|
||||||
|
|
||||||
|
@ -294,7 +294,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
return availResult;
|
return availResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
DataProvider.UpdateServer(server.ServerId, server.ServerName, server.ServerUrl,
|
DataProvider.UpdateServer(server.ServerId, server.ServerName, server.ServerUrl,
|
||||||
CryptoUtils.Encrypt(server.Password), server.Comments, server.InstantDomainAlias,
|
CryptoUtils.Encrypt(server.Password), server.Comments, server.InstantDomainAlias,
|
||||||
server.PrimaryGroupId, server.ADEnabled, server.ADRootDomain, server.ADUsername, CryptoUtils.Encrypt(server.ADPassword),
|
server.PrimaryGroupId, server.ADEnabled, server.ADRootDomain, server.ADUsername, CryptoUtils.Encrypt(server.ADPassword),
|
||||||
server.ADAuthenticationType);
|
server.ADAuthenticationType);
|
||||||
|
@ -322,7 +322,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
server.Password = password;
|
server.Password = password;
|
||||||
|
|
||||||
// update server
|
// update server
|
||||||
DataProvider.UpdateServer(server.ServerId, server.ServerName, server.ServerUrl,
|
DataProvider.UpdateServer(server.ServerId, server.ServerName, server.ServerUrl,
|
||||||
CryptoUtils.Encrypt(server.Password), server.Comments, server.InstantDomainAlias,
|
CryptoUtils.Encrypt(server.Password), server.Comments, server.InstantDomainAlias,
|
||||||
server.PrimaryGroupId, server.ADEnabled, server.ADRootDomain, server.ADUsername, CryptoUtils.Encrypt(server.ADPassword),
|
server.PrimaryGroupId, server.ADEnabled, server.ADRootDomain, server.ADUsername, CryptoUtils.Encrypt(server.ADPassword),
|
||||||
server.ADAuthenticationType);
|
server.ADAuthenticationType);
|
||||||
|
@ -350,7 +350,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
server.ADPassword = adPassword;
|
server.ADPassword = adPassword;
|
||||||
|
|
||||||
// update server
|
// update server
|
||||||
DataProvider.UpdateServer(server.ServerId, server.ServerName, server.ServerUrl,
|
DataProvider.UpdateServer(server.ServerId, server.ServerName, server.ServerUrl,
|
||||||
CryptoUtils.Encrypt(server.Password), server.Comments, server.InstantDomainAlias,
|
CryptoUtils.Encrypt(server.Password), server.Comments, server.InstantDomainAlias,
|
||||||
server.PrimaryGroupId, server.ADEnabled, server.ADRootDomain, server.ADUsername, CryptoUtils.Encrypt(server.ADPassword),
|
server.PrimaryGroupId, server.ADEnabled, server.ADRootDomain, server.ADUsername, CryptoUtils.Encrypt(server.ADPassword),
|
||||||
server.ADAuthenticationType);
|
server.ADAuthenticationType);
|
||||||
|
@ -636,12 +636,12 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
| DemandAccount.IsActive);
|
| DemandAccount.IsActive);
|
||||||
if (accountCheck < 0) return accountCheck;
|
if (accountCheck < 0) return accountCheck;
|
||||||
|
|
||||||
// load original service
|
// load original service
|
||||||
ServiceInfo origService = GetServiceInfo(service.ServiceId);
|
ServiceInfo origService = GetServiceInfo(service.ServiceId);
|
||||||
|
|
||||||
TaskManager.StartTask("SERVER", "UPDATE_SERVICE");
|
TaskManager.StartTask("SERVER", "UPDATE_SERVICE");
|
||||||
TaskManager.ItemId = origService.ServerId;
|
TaskManager.ItemId = origService.ServerId;
|
||||||
TaskManager.ItemName = GetServerByIdInternal(origService.ServerId).ServerName;
|
TaskManager.ItemName = GetServerByIdInternal(origService.ServerId).ServerName;
|
||||||
TaskManager.WriteParameter("New service name", service.ServiceName);
|
TaskManager.WriteParameter("New service name", service.ServiceName);
|
||||||
|
|
||||||
DataProvider.UpdateService(service.ServiceId, service.ServiceName,
|
DataProvider.UpdateService(service.ServiceId, service.ServiceName,
|
||||||
|
@ -839,7 +839,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
public static BoolResult IsInstalled(int serverId, int providerId)
|
public static BoolResult IsInstalled(int serverId, int providerId)
|
||||||
{
|
{
|
||||||
BoolResult res = TaskManager.StartResultTask<BoolResult>("AUTO_DISCOVERY", "IS_INSTALLED");
|
BoolResult res = TaskManager.StartResultTask<BoolResult>("AUTO_DISCOVERY", "IS_INSTALLED");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ProviderInfo provider = GetProvider(providerId);
|
ProviderInfo provider = GetProvider(providerId);
|
||||||
|
@ -848,22 +848,22 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
TaskManager.CompleteResultTask(res, ErrorCodes.CANNOT_GET_PROVIDER_INFO);
|
TaskManager.CompleteResultTask(res, ErrorCodes.CANNOT_GET_PROVIDER_INFO);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoDiscovery.AutoDiscovery ad = new AutoDiscovery.AutoDiscovery();
|
AutoDiscovery.AutoDiscovery ad = new AutoDiscovery.AutoDiscovery();
|
||||||
ServiceProviderProxy.ServerInit(ad, serverId);
|
ServiceProviderProxy.ServerInit(ad, serverId);
|
||||||
|
|
||||||
res = ad.IsInstalled(provider.ProviderType);
|
res = ad.IsInstalled(provider.ProviderType);
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
TaskManager.CompleteResultTask(res, ErrorCodes.CANNOT_CHECK_IF_PROVIDER_SOFTWARE_INSTALLED, ex);
|
TaskManager.CompleteResultTask(res, ErrorCodes.CANNOT_CHECK_IF_PROVIDER_SOFTWARE_INSTALLED, ex);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskManager.CompleteResultTask();
|
TaskManager.CompleteResultTask();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetServerVersion(int serverId)
|
public static string GetServerVersion(int serverId)
|
||||||
{
|
{
|
||||||
AutoDiscovery.AutoDiscovery ad = new AutoDiscovery.AutoDiscovery();
|
AutoDiscovery.AutoDiscovery ad = new AutoDiscovery.AutoDiscovery();
|
||||||
|
@ -871,7 +871,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
return ad.GetServerVersion();
|
return ad.GetServerVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IP Addresses
|
#region IP Addresses
|
||||||
|
@ -1400,18 +1400,18 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
private static string GetIPAddressesQuotaByResourceGroup(string groupName)
|
private static string GetIPAddressesQuotaByResourceGroup(string groupName)
|
||||||
{
|
{
|
||||||
if (String.Compare(groupName, ResourceGroups.VPS, true) == 0)
|
if (String.Compare(groupName, ResourceGroups.VPS, true) == 0)
|
||||||
{
|
{
|
||||||
return Quotas.VPS_EXTERNAL_IP_ADDRESSES_NUMBER;
|
return Quotas.VPS_EXTERNAL_IP_ADDRESSES_NUMBER;
|
||||||
}
|
}
|
||||||
else if (String.Compare(groupName, ResourceGroups.VPSForPC, true) == 0)
|
else if (String.Compare(groupName, ResourceGroups.VPSForPC, true) == 0)
|
||||||
{
|
{
|
||||||
return Quotas.VPSForPC_EXTERNAL_IP_ADDRESSES_NUMBER;
|
return Quotas.VPSForPC_EXTERNAL_IP_ADDRESSES_NUMBER;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return Quotas.WEB_IP_ADDRESSES;
|
return Quotas.WEB_IP_ADDRESSES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -1521,7 +1521,8 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
TaskManager.WriteParameter("Data", record.RecordData);
|
TaskManager.WriteParameter("Data", record.RecordData);
|
||||||
|
|
||||||
DataProvider.AddDnsRecord(SecurityContext.User.UserId, record.ServiceId, record.ServerId, record.PackageId,
|
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();
|
TaskManager.CompleteTask();
|
||||||
|
|
||||||
|
@ -1540,7 +1541,8 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
TaskManager.WriteParameter("Data", record.RecordData);
|
TaskManager.WriteParameter("Data", record.RecordData);
|
||||||
|
|
||||||
DataProvider.UpdateDnsRecord(SecurityContext.User.UserId, record.RecordId,
|
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();
|
TaskManager.CompleteTask();
|
||||||
|
|
||||||
|
@ -1571,7 +1573,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
#region Domains
|
#region Domains
|
||||||
public static int CheckDomain(string domainName)
|
public static int CheckDomain(string domainName)
|
||||||
{
|
{
|
||||||
int checkDomainResult = DataProvider.CheckDomain(-10, domainName);
|
int checkDomainResult = DataProvider.CheckDomain(-10, domainName, false);
|
||||||
|
|
||||||
if (checkDomainResult == -1)
|
if (checkDomainResult == -1)
|
||||||
return BusinessErrorCodes.ERROR_DOMAIN_ALREADY_EXISTS;
|
return BusinessErrorCodes.ERROR_DOMAIN_ALREADY_EXISTS;
|
||||||
|
@ -1677,8 +1679,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int AddDomainWithProvisioning(int packageId, string domainName, DomainType domainType,
|
public static int AddDomainWithProvisioning(int packageId, string domainName, DomainType domainType,
|
||||||
bool createWebSite, int pointWebSiteId, int pointMailDomainId,
|
bool createWebSite, int pointWebSiteId, int pointMailDomainId, bool createDnsZone, bool createInstantAlias, bool allowSubDomains)
|
||||||
bool createDnsZone, bool createInstantAlias, bool allowSubDomains)
|
|
||||||
{
|
{
|
||||||
// check account
|
// check account
|
||||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||||
|
@ -1687,7 +1688,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
// check package
|
// check package
|
||||||
int packageCheck = SecurityContext.CheckPackage(packageId, DemandPackage.IsActive);
|
int packageCheck = SecurityContext.CheckPackage(packageId, DemandPackage.IsActive);
|
||||||
if (packageCheck < 0) return packageCheck;
|
if (packageCheck < 0) return packageCheck;
|
||||||
|
|
||||||
// set flags
|
// set flags
|
||||||
bool isSubDomain = (domainType == DomainType.SubDomain || domainType == DomainType.ProviderSubDomain);
|
bool isSubDomain = (domainType == DomainType.SubDomain || domainType == DomainType.ProviderSubDomain);
|
||||||
bool isDomainPointer = (domainType == DomainType.DomainPointer);
|
bool isDomainPointer = (domainType == DomainType.DomainPointer);
|
||||||
|
@ -1748,10 +1749,10 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
public static int AddDomain(DomainInfo domain)
|
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
|
// check account
|
||||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||||
|
@ -1762,7 +1763,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (packageCheck < 0) return packageCheck;
|
if (packageCheck < 0) return packageCheck;
|
||||||
|
|
||||||
// add main domain
|
// 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);
|
domain.IsSubDomain, false, domain.IsDomainPointer, false);
|
||||||
|
|
||||||
if (domainId < 0)
|
if (domainId < 0)
|
||||||
|
@ -1805,7 +1806,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if the domain already exists
|
// check if the domain already exists
|
||||||
int checkResult = DataProvider.CheckDomain(packageId, domainName);
|
int checkResult = DataProvider.CheckDomain(packageId, domainName, isDomainPointer);
|
||||||
|
|
||||||
if (checkResult < 0)
|
if (checkResult < 0)
|
||||||
{
|
{
|
||||||
|
@ -1816,15 +1817,18 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
else
|
else
|
||||||
return checkResult;
|
return checkResult;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if (domainName.ToLower().StartsWith("www."))
|
if (domainName.ToLower().StartsWith("www."))
|
||||||
return BusinessErrorCodes.ERROR_DOMAIN_STARTS_WWW;
|
return BusinessErrorCodes.ERROR_DOMAIN_STARTS_WWW;
|
||||||
|
*/
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("DOMAIN", "ADD", domainName);
|
TaskManager.StartTask("DOMAIN", "ADD", domainName);
|
||||||
TaskManager.PackageId = packageId;
|
TaskManager.PackageId = packageId;
|
||||||
TaskManager.TaskParameters["CreateZone"] = createDnsZone;
|
TaskManager.TaskParameters["CreateZone"] = createDnsZone;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// create DNS zone
|
// create DNS zone
|
||||||
int zoneItemId = 0;
|
int zoneItemId = 0;
|
||||||
if (createDnsZone)
|
if (createDnsZone)
|
||||||
|
@ -1895,60 +1899,60 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int DetachDomain(int domainId)
|
public static int DetachDomain(int domainId)
|
||||||
{
|
{
|
||||||
// check account
|
// check account
|
||||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsAdmin);
|
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsAdmin);
|
||||||
if (accountCheck < 0) return accountCheck;
|
if (accountCheck < 0) return accountCheck;
|
||||||
|
|
||||||
// load domain
|
// load domain
|
||||||
DomainInfo domain = GetDomain(domainId);
|
DomainInfo domain = GetDomain(domainId);
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
TaskManager.StartTask("DOMAIN", "DETACH", domain.DomainName);
|
TaskManager.StartTask("DOMAIN", "DETACH", domain.DomainName);
|
||||||
TaskManager.ItemId = domain.DomainId;
|
TaskManager.ItemId = domain.DomainId;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// check if domain can be deleted
|
// check if domain can be deleted
|
||||||
if (domain.WebSiteId > 0)
|
if (domain.WebSiteId > 0)
|
||||||
{
|
{
|
||||||
TaskManager.WriteError("Domain points to the existing web site");
|
TaskManager.WriteError("Domain points to the existing web site");
|
||||||
return BusinessErrorCodes.ERROR_DOMAIN_POINTS_TO_WEB_SITE;
|
return BusinessErrorCodes.ERROR_DOMAIN_POINTS_TO_WEB_SITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (domain.MailDomainId > 0)
|
if (domain.MailDomainId > 0)
|
||||||
{
|
{
|
||||||
TaskManager.WriteError("Domain points to the existing mail domain");
|
TaskManager.WriteError("Domain points to the existing mail domain");
|
||||||
return BusinessErrorCodes.ERROR_DOMAIN_POINTS_TO_MAIL_DOMAIN;
|
return BusinessErrorCodes.ERROR_DOMAIN_POINTS_TO_MAIL_DOMAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DataProvider.ExchangeOrganizationDomainExists(domain.DomainId))
|
if (DataProvider.ExchangeOrganizationDomainExists(domain.DomainId))
|
||||||
{
|
{
|
||||||
TaskManager.WriteError("Domain points to the existing organization domain");
|
TaskManager.WriteError("Domain points to the existing organization domain");
|
||||||
return BusinessErrorCodes.ERROR_ORGANIZATION_DOMAIN_IS_IN_USE;
|
return BusinessErrorCodes.ERROR_ORGANIZATION_DOMAIN_IS_IN_USE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove DNS zone meta-item if required
|
// remove DNS zone meta-item if required
|
||||||
if (domain.ZoneItemId > 0)
|
if (domain.ZoneItemId > 0)
|
||||||
{
|
{
|
||||||
PackageController.DeletePackageItem(domain.ZoneItemId);
|
PackageController.DeletePackageItem(domain.ZoneItemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete domain
|
// delete domain
|
||||||
DataProvider.DeleteDomain(SecurityContext.User.UserId, domainId);
|
DataProvider.DeleteDomain(SecurityContext.User.UserId, domainId);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
throw TaskManager.WriteError(ex);
|
throw TaskManager.WriteError(ex);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
TaskManager.CompleteTask();
|
TaskManager.CompleteTask();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int DeleteDomain(int domainId)
|
public static int DeleteDomain(int domainId)
|
||||||
{
|
{
|
||||||
|
@ -1991,9 +1995,9 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete zone if required
|
// delete zone if required
|
||||||
DnsServerController.DeleteZone(domain.ZoneItemId);
|
DnsServerController.DeleteZone(domain.ZoneItemId);
|
||||||
|
|
||||||
// delete domain
|
// delete domain
|
||||||
DataProvider.DeleteDomain(SecurityContext.User.UserId, domainId);
|
DataProvider.DeleteDomain(SecurityContext.User.UserId, domainId);
|
||||||
|
@ -2096,7 +2100,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
}
|
}
|
||||||
|
|
||||||
// add web site DNS records
|
// add web site DNS records
|
||||||
int res = AddWebSiteZoneRecords(domainId);
|
int res = AddWebSiteZoneRecords("", domainId);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
return res;
|
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
|
// load domain
|
||||||
DomainInfo domain = GetDomainItem(domainId);
|
DomainInfo domain = GetDomainItem(domainId);
|
||||||
|
@ -2126,7 +2130,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int CreateDomainInstantAlias(int domainId)
|
public static int CreateDomainInstantAlias(string hostName, int domainId)
|
||||||
{
|
{
|
||||||
// check account
|
// check account
|
||||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo);
|
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo);
|
||||||
|
@ -2166,14 +2170,15 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (webRes < 0)
|
if (webRes < 0)
|
||||||
return webRes;
|
return webRes;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
// add mail domain pointer
|
// add mail domain pointer
|
||||||
if (domain.MailDomainId > 0 && instantAlias.MailDomainId == 0)
|
if (domain.MailDomainId > 0 && instantAlias.MailDomainId == 0)
|
||||||
{
|
{
|
||||||
int mailRes = MailServerController.AddMailDomainPointer(domain.MailDomainId, instantAliasId);
|
int mailRes = MailServerController.AddMailDomainPointer(domain.MailDomainId, instantAliasId);
|
||||||
if (mailRes < 0)
|
if (mailRes < 0)
|
||||||
return mailRes;
|
return mailRes;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2214,14 +2219,15 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (webRes < 0)
|
if (webRes < 0)
|
||||||
return webRes;
|
return webRes;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
// remove from mail domain pointers
|
// remove from mail domain pointers
|
||||||
if (instantAlias.MailDomainId > 0)
|
if (instantAlias.MailDomainId > 0)
|
||||||
{
|
{
|
||||||
int mailRes = MailServerController.DeleteMailDomainPointer(instantAlias.MailDomainId, instantAlias.DomainId);
|
int mailRes = MailServerController.DeleteMailDomainPointer(instantAlias.MailDomainId, instantAlias.DomainId);
|
||||||
if (mailRes < 0)
|
if (mailRes < 0)
|
||||||
return mailRes;
|
return mailRes;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// delete instant alias
|
// delete instant alias
|
||||||
int res = DeleteDomain(instantAlias.DomainId);
|
int res = DeleteDomain(instantAlias.DomainId);
|
||||||
|
@ -2272,12 +2278,15 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
dt.Columns.Add("RecordName", typeof(string));
|
dt.Columns.Add("RecordName", typeof(string));
|
||||||
dt.Columns.Add("RecordData", typeof(string));
|
dt.Columns.Add("RecordData", typeof(string));
|
||||||
dt.Columns.Add("MxPriority", typeof(int));
|
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
|
// add rows
|
||||||
DnsRecord[] records = GetDnsZoneRecords(domainId);
|
DnsRecord[] records = GetDnsZoneRecords(domainId);
|
||||||
foreach (DnsRecord record in records)
|
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;
|
return ds;
|
||||||
|
@ -2299,7 +2308,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int AddDnsZoneRecord(int domainId, string recordName, DnsRecordType recordType,
|
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
|
// check account
|
||||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||||
|
@ -2315,7 +2324,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
// get DNS service
|
// get DNS service
|
||||||
DnsZone zoneItem = (DnsZone)PackageController.GetPackageItem(domain.ZoneItemId);
|
DnsZone zoneItem = (DnsZone)PackageController.GetPackageItem(domain.ZoneItemId);
|
||||||
|
|
||||||
if(zoneItem == null)
|
if (zoneItem == null)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// place log record
|
// place log record
|
||||||
|
@ -2337,6 +2346,9 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
record.RecordName = recordName;
|
record.RecordName = recordName;
|
||||||
record.RecordData = recordData;
|
record.RecordData = recordData;
|
||||||
record.MxPriority = mxPriority;
|
record.MxPriority = mxPriority;
|
||||||
|
record.SrvPriority = srvPriority;
|
||||||
|
record.SrvWeight = srvWeight;
|
||||||
|
record.SrvPort = srvPort;
|
||||||
dns.AddZoneRecord(zoneItem.Name, record);
|
dns.AddZoneRecord(zoneItem.Name, record);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2353,7 +2365,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
public static int UpdateDnsZoneRecord(int domainId,
|
public static int UpdateDnsZoneRecord(int domainId,
|
||||||
string originalRecordName, string originalRecordData,
|
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
|
// place log record
|
||||||
DomainInfo domain = GetDomain(domainId);
|
DomainInfo domain = GetDomain(domainId);
|
||||||
|
@ -2367,7 +2379,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
DeleteDnsZoneRecord(domainId, originalRecordName, recordType, originalRecordData);
|
DeleteDnsZoneRecord(domainId, originalRecordName, recordType, originalRecordData);
|
||||||
|
|
||||||
// add new record
|
// add new record
|
||||||
AddDnsZoneRecord(domainId, recordName, recordType, recordData, mxPriority);
|
AddDnsZoneRecord(domainId, recordName, recordType, recordData, mxPriority, srvPriority, srvWeight, srvPortNumber);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2410,7 +2422,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
DNSServer dns = new DNSServer();
|
DNSServer dns = new DNSServer();
|
||||||
ServiceProviderProxy.Init(dns, zoneItem.ServiceId);
|
ServiceProviderProxy.Init(dns, zoneItem.ServiceId);
|
||||||
|
|
||||||
DnsRecord record = GetDnsZoneRecord(domainId, recordName, recordType, recordData);
|
DnsRecord record = GetDnsZoneRecord(domainId, recordName, recordType, recordData);
|
||||||
dns.DeleteZoneRecord(zoneItem.Name, record);
|
dns.DeleteZoneRecord(zoneItem.Name, record);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
domain.PackageId = createdPackageId;
|
domain.PackageId = createdPackageId;
|
||||||
domain.DomainName = domainName;
|
domain.DomainName = domainName;
|
||||||
domain.HostingAllowed = false;
|
domain.HostingAllowed = false;
|
||||||
domainId = ServerController.AddDomain(domain, !tempDomain);
|
domainId = ServerController.AddDomain(domain, false, !tempDomain);
|
||||||
if (domainId < 0)
|
if (domainId < 0)
|
||||||
{
|
{
|
||||||
// rollback wizard
|
// rollback wizard
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2012, Outercurve Foundation.
|
// Copyright (c) 2011, Outercurve Foundation.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without modification,
|
// Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
@ -249,7 +249,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
{
|
{
|
||||||
return ServerController.GetProviderServiceQuota(providerId);
|
return ServerController.GetProviderServiceQuota(providerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Providers
|
#region Providers
|
||||||
|
@ -301,7 +301,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
{
|
{
|
||||||
return ServerController.IsInstalled(serverId, providerId);
|
return ServerController.IsInstalled(serverId, providerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
[WebMethod]
|
[WebMethod]
|
||||||
public string GetServerVersion(int serverId)
|
public string GetServerVersion(int serverId)
|
||||||
{
|
{
|
||||||
|
@ -568,11 +568,11 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
return ServerController.DeleteDomain(domainId);
|
return ServerController.DeleteDomain(domainId);
|
||||||
}
|
}
|
||||||
|
|
||||||
[WebMethod]
|
[WebMethod]
|
||||||
public int DetachDomain(int domainId)
|
public int DetachDomain(int domainId)
|
||||||
{
|
{
|
||||||
return ServerController.DetachDomain(domainId);
|
return ServerController.DetachDomain(domainId);
|
||||||
}
|
}
|
||||||
|
|
||||||
[WebMethod]
|
[WebMethod]
|
||||||
public int EnableDomainDns(int domainId)
|
public int EnableDomainDns(int domainId)
|
||||||
|
@ -587,9 +587,9 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
}
|
}
|
||||||
|
|
||||||
[WebMethod]
|
[WebMethod]
|
||||||
public int CreateDomainInstantAlias(int domainId)
|
public int CreateDomainInstantAlias(string hostName, int domainId)
|
||||||
{
|
{
|
||||||
return ServerController.CreateDomainInstantAlias(domainId);
|
return ServerController.CreateDomainInstantAlias(hostName, domainId);
|
||||||
}
|
}
|
||||||
|
|
||||||
[WebMethod]
|
[WebMethod]
|
||||||
|
@ -614,18 +614,18 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
[WebMethod]
|
[WebMethod]
|
||||||
public int AddDnsZoneRecord(int domainId, string recordName, DnsRecordType recordType,
|
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]
|
[WebMethod]
|
||||||
public int UpdateDnsZoneRecord(int domainId,
|
public int UpdateDnsZoneRecord(int domainId,
|
||||||
string originalRecordName, string originalRecordData,
|
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,
|
return ServerController.UpdateDnsZoneRecord(domainId, originalRecordName, originalRecordData,
|
||||||
recordName, recordType, recordData, mxPriority);
|
recordName, recordType, recordData, mxPriority, srvPriority, srvWeight, srvPortNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
[WebMethod]
|
[WebMethod]
|
||||||
|
|
|
@ -39,6 +39,10 @@ namespace WebsitePanel.Providers.DNS
|
||||||
private string recordData;
|
private string recordData;
|
||||||
private int mxPriority;
|
private int mxPriority;
|
||||||
private string recordText;
|
private string recordText;
|
||||||
|
private int srvPriority;
|
||||||
|
private int srvWeight;
|
||||||
|
private int srvPort;
|
||||||
|
|
||||||
|
|
||||||
public string RecordName
|
public string RecordName
|
||||||
{
|
{
|
||||||
|
@ -69,5 +73,25 @@ namespace WebsitePanel.Providers.DNS
|
||||||
get { return this.recordText; }
|
get { return this.recordText; }
|
||||||
set { this.recordText = value; }
|
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; }
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,8 @@ namespace WebsitePanel.Providers.DNS
|
||||||
CNAME,
|
CNAME,
|
||||||
SOA,
|
SOA,
|
||||||
TXT,
|
TXT,
|
||||||
|
SRV,
|
||||||
Other
|
Other
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,15 +1,13 @@
|
||||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DnsZoneRecords.ascx.cs" Inherits="WebsitePanel.Portal.DnsZoneRecords" %>
|
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DnsZoneRecords.ascx.cs" Inherits="WebsitePanel.Portal.DnsZoneRecords" %>
|
||||||
<%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport"
|
<%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %>
|
||||||
TagPrefix="wsp" %>
|
|
||||||
|
|
||||||
<wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server" />
|
<wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server" />
|
||||||
|
|
||||||
<script type="text/javascript">
|
<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...');
|
||||||
if (!confirm('Are you sure you want to delete this DNS Zone Record?')) return false; else ShowProgressDialog('Deleting DNS Zone Record...');
|
}
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
<asp:Panel ID="pnlRecords" runat="server">
|
<asp:Panel ID="pnlRecords" runat="server">
|
||||||
<div class="FormBody">
|
<div class="FormBody">
|
||||||
|
@ -33,6 +31,9 @@ function confirmation()
|
||||||
<asp:Literal ID="litRecordName" runat="server" Text='<%# Eval("RecordName") %>' Visible="false"></asp:Literal>
|
<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="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="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>
|
</ItemTemplate>
|
||||||
<ItemStyle CssClass="NormalBold" Wrap="False" />
|
<ItemStyle CssClass="NormalBold" Wrap="False" />
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
|
@ -41,7 +42,7 @@ function confirmation()
|
||||||
<asp:TemplateField SortExpression="RecordData" HeaderText="gvRecordsData" >
|
<asp:TemplateField SortExpression="RecordData" HeaderText="gvRecordsData" >
|
||||||
<ItemStyle Width="100%" />
|
<ItemStyle Width="100%" />
|
||||||
<ItemTemplate>
|
<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>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
<asp:TemplateField>
|
<asp:TemplateField>
|
||||||
|
@ -77,6 +78,7 @@ function confirmation()
|
||||||
<asp:ListItem>NS</asp:ListItem>
|
<asp:ListItem>NS</asp:ListItem>
|
||||||
<asp:ListItem>TXT</asp:ListItem>
|
<asp:ListItem>TXT</asp:ListItem>
|
||||||
<asp:ListItem>CNAME</asp:ListItem>
|
<asp:ListItem>CNAME</asp:ListItem>
|
||||||
|
<asp:ListItem>SRV</asp:ListItem>
|
||||||
</asp:DropDownList><asp:Literal ID="litRecordType" runat="server"></asp:Literal>
|
</asp:DropDownList><asp:Literal ID="litRecordType" runat="server"></asp:Literal>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -106,10 +108,43 @@ function confirmation()
|
||||||
<asp:RegularExpressionValidator ID="valRequireCorrectPriority" runat="server" ControlToValidate="txtMXPriority"
|
<asp:RegularExpressionValidator ID="valRequireCorrectPriority" runat="server" ControlToValidate="txtMXPriority"
|
||||||
ErrorMessage="*" ValidationExpression="\d{1,3}"></asp:RegularExpressionValidator></td>
|
ErrorMessage="*" ValidationExpression="\d{1,3}"></asp:RegularExpressionValidator></td>
|
||||||
</tr>
|
</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>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="FormFooter">
|
<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="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>
|
</div>
|
||||||
</asp:Panel>
|
</asp:Panel>
|
|
@ -54,25 +54,35 @@ namespace WebsitePanel.Portal
|
||||||
// toggle panels
|
// toggle panels
|
||||||
ShowPanels(false);
|
ShowPanels(false);
|
||||||
|
|
||||||
// domain name
|
// domain name
|
||||||
DomainInfo domain = ES.Services.Servers.GetDomain(PanelRequest.DomainID);
|
DomainInfo domain = ES.Services.Servers.GetDomain(PanelRequest.DomainID);
|
||||||
litDomainName.Text = domain.DomainName;
|
litDomainName.Text = domain.DomainName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
private void GetRecordsDetails(int recordIndex)
|
||||||
{
|
{
|
||||||
GridViewRow row = gvRecords.Rows[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["MxPriority"] = ((Literal)row.Cells[0].FindControl("litMxPriority")).Text;
|
||||||
ViewState["RecordName"] = ((Literal)row.Cells[0].FindControl("litRecordName")).Text; ;
|
ViewState["RecordName"] = ((Literal)row.Cells[0].FindControl("litRecordName")).Text; ;
|
||||||
ViewState["RecordType"] = (DnsRecordType)Enum.Parse(typeof(DnsRecordType),
|
ViewState["RecordType"] = (DnsRecordType)Enum.Parse(typeof(DnsRecordType), ((Literal)row.Cells[0].FindControl("litRecordType")).Text, true);
|
||||||
((Literal)row.Cells[0].FindControl("litRecordType")).Text, true);
|
|
||||||
ViewState["RecordData"] = ((Literal)row.Cells[0].FindControl("litRecordData")).Text;
|
ViewState["RecordData"] = ((Literal)row.Cells[0].FindControl("litRecordData")).Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,6 +98,9 @@ namespace WebsitePanel.Portal
|
||||||
txtRecordName.Text = ViewState["RecordName"].ToString();
|
txtRecordName.Text = ViewState["RecordName"].ToString();
|
||||||
txtRecordData.Text = ViewState["RecordData"].ToString();
|
txtRecordData.Text = ViewState["RecordData"].ToString();
|
||||||
txtMXPriority.Text = ViewState["MxPriority"].ToString();
|
txtMXPriority.Text = ViewState["MxPriority"].ToString();
|
||||||
|
txtSRVPriority.Text = ViewState["SrvPriority"].ToString();
|
||||||
|
txtSRVWeight.Text = ViewState["SrvWeight"].ToString();
|
||||||
|
txtSRVPort.Text = ViewState["SrvPort"].ToString();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -103,24 +116,39 @@ namespace WebsitePanel.Portal
|
||||||
|
|
||||||
private void ToggleRecordControls()
|
private void ToggleRecordControls()
|
||||||
{
|
{
|
||||||
rowMXPriority.Visible = (ddlRecordType.SelectedValue == "MX");
|
rowMXPriority.Visible = false;
|
||||||
if (ddlRecordType.SelectedValue == "A")
|
rowSRVPriority.Visible = false;
|
||||||
|
rowSRVWeight.Visible = false;
|
||||||
|
rowSRVPort.Visible = false;
|
||||||
|
lblRecordData.Text = "Record Data:";
|
||||||
|
IPValidator.Enabled = false;
|
||||||
|
|
||||||
|
switch (ddlRecordType.SelectedValue)
|
||||||
{
|
{
|
||||||
lblRecordData.Text = "IP:";
|
case "A":
|
||||||
IPValidator.Enabled = true;
|
lblRecordData.Text = "IP:";
|
||||||
}
|
IPValidator.Enabled = true;
|
||||||
else
|
break;
|
||||||
{
|
case "MX":
|
||||||
lblRecordData.Text = "Record Data:";
|
rowMXPriority.Visible = true;
|
||||||
IPValidator.Enabled = false;
|
break;
|
||||||
|
case "SRV":
|
||||||
|
rowSRVPriority.Visible = true;
|
||||||
|
rowSRVWeight.Visible = true;
|
||||||
|
rowSRVPort.Visible = true;
|
||||||
|
lblRecordData.Text = "Host offering this service:";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveRecord()
|
private void SaveRecord()
|
||||||
{
|
{
|
||||||
if (Page.IsValid)
|
if (Page.IsValid)
|
||||||
{
|
{
|
||||||
bool newRecord = (bool) ViewState["NewRecord"];
|
bool newRecord = (bool)ViewState["NewRecord"];
|
||||||
|
|
||||||
if (newRecord)
|
if (newRecord)
|
||||||
{
|
{
|
||||||
|
@ -130,10 +158,13 @@ namespace WebsitePanel.Portal
|
||||||
int result = ES.Services.Servers.AddDnsZoneRecord(PanelRequest.DomainID,
|
int result = ES.Services.Servers.AddDnsZoneRecord(PanelRequest.DomainID,
|
||||||
txtRecordName.Text.Trim(),
|
txtRecordName.Text.Trim(),
|
||||||
(DnsRecordType)
|
(DnsRecordType)
|
||||||
Enum.Parse(typeof (DnsRecordType),
|
Enum.Parse(typeof(DnsRecordType),
|
||||||
ddlRecordType.SelectedValue, true),
|
ddlRecordType.SelectedValue, true),
|
||||||
txtRecordData.Text.Trim(),
|
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)
|
if (result < 0)
|
||||||
{
|
{
|
||||||
|
@ -156,9 +187,12 @@ namespace WebsitePanel.Portal
|
||||||
ViewState["RecordName"].ToString(),
|
ViewState["RecordName"].ToString(),
|
||||||
ViewState["RecordData"].ToString(),
|
ViewState["RecordData"].ToString(),
|
||||||
txtRecordName.Text.Trim(),
|
txtRecordName.Text.Trim(),
|
||||||
(DnsRecordType) ViewState["RecordType"],
|
(DnsRecordType)ViewState["RecordType"],
|
||||||
txtRecordData.Text.Trim(),
|
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)
|
if (result < 0)
|
||||||
{
|
{
|
||||||
|
@ -217,6 +251,10 @@ namespace WebsitePanel.Portal
|
||||||
txtRecordName.Text = "";
|
txtRecordName.Text = "";
|
||||||
txtRecordData.Text = "";
|
txtRecordData.Text = "";
|
||||||
txtMXPriority.Text = "1";
|
txtMXPriority.Text = "1";
|
||||||
|
txtSRVPriority.Text = "0";
|
||||||
|
txtSRVWeight.Text = "0";
|
||||||
|
txtSRVPort.Text = "0";
|
||||||
|
|
||||||
|
|
||||||
ShowPanels(true);
|
ShowPanels(true);
|
||||||
}
|
}
|
||||||
|
@ -253,7 +291,7 @@ namespace WebsitePanel.Portal
|
||||||
{
|
{
|
||||||
if (e.Exception != null)
|
if (e.Exception != null)
|
||||||
{
|
{
|
||||||
ShowErrorMessage("GDNS_GET_RECORD", e.Exception);
|
ShowErrorMessage("GDNS_GET_RECORD", e.Exception);
|
||||||
//this.DisableControls = true;
|
//this.DisableControls = true;
|
||||||
e.ExceptionHandled = true;
|
e.ExceptionHandled = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// 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
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
// the code is regenerated.
|
// the code is regenerated.
|
||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -220,6 +219,141 @@ namespace WebsitePanel.Portal {
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
protected global::System.Web.UI.WebControls.RegularExpressionValidator valRequireCorrectPriority;
|
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>
|
/// <summary>
|
||||||
/// btnSave control.
|
/// btnSave control.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -304,7 +304,7 @@ namespace WebsitePanel.Portal
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// create instant alias
|
// create instant alias
|
||||||
int result = ES.Services.Servers.CreateDomainInstantAlias(PanelRequest.DomainID);
|
int result = ES.Services.Servers.CreateDomainInstantAlias("", PanelRequest.DomainID);
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
{
|
{
|
||||||
ShowResultMessage(result);
|
ShowResultMessage(result);
|
||||||
|
|
|
@ -49,10 +49,13 @@
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
<asp:ImageButton ID="cmdEdit" runat="server" SkinID="EditSmall" CommandName="edit" AlternateText="Edit record">
|
<asp:ImageButton ID="cmdEdit" runat="server" SkinID="EditSmall" CommandName="edit" AlternateText="Edit record">
|
||||||
</asp:ImageButton>
|
</asp:ImageButton>
|
||||||
<asp:Literal ID="litMxPriority" runat="server" Text='<%# Eval("MxPriority") %>' Visible="false"></asp:Literal>
|
<asp:Literal ID="litMxPriority" runat="server" Text='<%# Eval("MxPriority") %>' Visible="false"></asp:Literal>
|
||||||
<asp:Literal ID="litRecordName" runat="server" Text='<%# Eval("RecordName") %>' Visible="false"></asp:Literal>
|
<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="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="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>
|
</ItemTemplate>
|
||||||
<ItemStyle CssClass="NormalBold" Wrap="False" />
|
<ItemStyle CssClass="NormalBold" Wrap="False" />
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
|
@ -61,7 +64,7 @@
|
||||||
<asp:TemplateField SortExpression="RecordData" HeaderText="gvRecordsData" >
|
<asp:TemplateField SortExpression="RecordData" HeaderText="gvRecordsData" >
|
||||||
<ItemStyle Width="100%" />
|
<ItemStyle Width="100%" />
|
||||||
<ItemTemplate>
|
<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>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
<asp:TemplateField>
|
<asp:TemplateField>
|
||||||
|
@ -112,11 +115,12 @@
|
||||||
<td class="SubHead" width="150" nowrap><asp:Label ID="lblRecordType" runat="server" meta:resourcekey="lblRecordType" Text="Record Type:"></asp:Label></td>
|
<td class="SubHead" width="150" nowrap><asp:Label ID="lblRecordType" runat="server" meta:resourcekey="lblRecordType" Text="Record Type:"></asp:Label></td>
|
||||||
<td class="NormalBold" width="100%">
|
<td class="NormalBold" width="100%">
|
||||||
<asp:DropDownList ID="ddlRecordType" runat="server" SelectedValue='<%# Bind("RecordType") %>' CssClass="NormalTextBox" AutoPostBack="True" OnSelectedIndexChanged="ddlRecordType_SelectedIndexChanged">
|
<asp:DropDownList ID="ddlRecordType" runat="server" SelectedValue='<%# Bind("RecordType") %>' CssClass="NormalTextBox" AutoPostBack="True" OnSelectedIndexChanged="ddlRecordType_SelectedIndexChanged">
|
||||||
<asp:ListItem>A</asp:ListItem>
|
<asp:ListItem>A</asp:ListItem>
|
||||||
<asp:ListItem>MX</asp:ListItem>
|
<asp:ListItem>MX</asp:ListItem>
|
||||||
<asp:ListItem>NS</asp:ListItem>
|
<asp:ListItem>NS</asp:ListItem>
|
||||||
<asp:ListItem>TXT</asp:ListItem>
|
<asp:ListItem>TXT</asp:ListItem>
|
||||||
<asp:ListItem>CNAME</asp:ListItem>
|
<asp:ListItem>CNAME</asp:ListItem>
|
||||||
|
<asp:ListItem>SRV</asp:ListItem>
|
||||||
</asp:DropDownList><asp:Literal ID="litRecordType" runat="server"></asp:Literal>
|
</asp:DropDownList><asp:Literal ID="litRecordType" runat="server"></asp:Literal>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -126,27 +130,60 @@
|
||||||
<asp:TextBox ID="txtRecordName" runat="server" Width="100px" CssClass="NormalTextBox"></asp:TextBox>
|
<asp:TextBox ID="txtRecordName" runat="server" Width="100px" CssClass="NormalTextBox"></asp:TextBox>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="rowData" runat="server">
|
<tr id="rowData" runat="server">
|
||||||
<td class="SubHead"><asp:Label ID="lblRecordData" runat="server" meta:resourcekey="lblRecordData" Text="Record Data:"></asp:Label></td>
|
<td class="SubHead"><asp:Label ID="lblRecordData" runat="server" meta:resourcekey="lblRecordData" Text="Record Data:"></asp:Label></td>
|
||||||
<td class="NormalBold" nowrap>
|
<td class="NormalBold" nowrap>
|
||||||
<asp:TextBox ID="txtRecordData" runat="server" Width="200px" CssClass="NormalTextBox"></asp:TextBox>
|
<asp:TextBox ID="txtRecordData" runat="server" Width="200px" CssClass="NormalTextBox"></asp:TextBox>
|
||||||
<asp:RequiredFieldValidator ID="valRequireData" runat="server" ControlToValidate="txtRecordData"
|
<asp:RequiredFieldValidator ID="valRequireData" runat="server" ControlToValidate="txtRecordData"
|
||||||
ErrorMessage="*" ValidationGroup="DnsZoneRecord" Display="Dynamic"></asp:RequiredFieldValidator>
|
ErrorMessage="*" ValidationGroup="DnsZoneRecord" Display="Dynamic"></asp:RequiredFieldValidator>
|
||||||
</td>
|
<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])$"
|
||||||
</tr>
|
Display="Dynamic" ErrorMessage="Please enter a valid IP" ValidationGroup="DnsZoneRecord" ControlToValidate="txtRecordData" CssClass="NormalBold"></asp:regularexpressionvalidator>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
<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])$"
|
<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])$"
|
||||||
Display="Dynamic" ErrorMessage="Please enter a valid IP" ValidationGroup="DnsZoneRecord" ControlToValidate="txtRecordData" CssClass="NormalBold"></asp:regularexpressionvalidator>
|
Display="Dynamic" ErrorMessage="Please enter a valid IP" ValidationGroup="DnsZoneRecord" ControlToValidate="txtRecordData" CssClass="NormalBold"></asp:regularexpressionvalidator>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="rowMXPriority" runat="server">
|
<tr id="rowMXPriority" runat="server">
|
||||||
<td class="SubHead"><asp:Label ID="lblMXPriority" runat="server" meta:resourcekey="lblMXPriority" Text="MX Priority:"></asp:Label></td>
|
<td class="SubHead"><asp:Label ID="lblMXPriority" runat="server" meta:resourcekey="lblMXPriority" Text="MX Priority:"></asp:Label></td>
|
||||||
<td class="NormalBold">
|
<td class="NormalBold">
|
||||||
<asp:TextBox ID="txtMXPriority" runat="server" Width="30" CssClass="NormalTextBox"></asp:TextBox>
|
<asp:TextBox ID="txtMXPriority" runat="server" Width="30" CssClass="NormalTextBox"></asp:TextBox>
|
||||||
<asp:RequiredFieldValidator ID="valRequireMxPriority" runat="server" ControlToValidate="txtMXPriority"
|
<asp:RequiredFieldValidator ID="valRequireMxPriority" runat="server" ControlToValidate="txtMXPriority"
|
||||||
ErrorMessage="*" ValidationGroup="DnsZoneRecord" Display="Dynamic"></asp:RequiredFieldValidator>
|
ErrorMessage="*" ValidationGroup="DnsZoneRecord" Display="Dynamic"></asp:RequiredFieldValidator>
|
||||||
<asp:RegularExpressionValidator ID="valRequireCorrectPriority" runat="server" ControlToValidate="txtMXPriority"
|
<asp:RegularExpressionValidator ID="valRequireCorrectPriority" runat="server" ControlToValidate="txtMXPriority"
|
||||||
ErrorMessage="*" ValidationExpression="\d{1,3}"></asp:RegularExpressionValidator></td>
|
ErrorMessage="*" ValidationExpression="\d{1,3}"></asp:RegularExpressionValidator></td>
|
||||||
</tr>
|
</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>
|
</table>
|
||||||
|
|
||||||
</ContentTemplate>
|
</ContentTemplate>
|
||||||
|
|
|
@ -59,44 +59,53 @@ 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)
|
switch (recordType)
|
||||||
? String.Format("[{0}], {1}", mxPriority, recordData) : recordData;
|
{
|
||||||
}
|
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)
|
private void GetRecordsDetails(int recordIndex)
|
||||||
{
|
{
|
||||||
GridViewRow row = gvRecords.Rows[recordIndex];
|
GridViewRow row = gvRecords.Rows[recordIndex];
|
||||||
ViewState["MxPriority"] = ((Literal)row.Cells[0].FindControl("litMxPriority")).Text;
|
ViewState["SrvPort"] = ((Literal)row.Cells[0].FindControl("litSrvPort")).Text;
|
||||||
ViewState["RecordName"] = ((Literal)row.Cells[0].FindControl("litRecordName")).Text; ;
|
ViewState["SrvWeight"] = ((Literal)row.Cells[0].FindControl("litSrvWeight")).Text;
|
||||||
ViewState["RecordType"] = (DnsRecordType)Enum.Parse(typeof(DnsRecordType),
|
ViewState["SrvPriority"] = ((Literal)row.Cells[0].FindControl("litSrvPriority")).Text;
|
||||||
((Literal)row.Cells[0].FindControl("litRecordType")).Text, true);
|
ViewState["MxPriority"] = ((Literal)row.Cells[0].FindControl("litMxPriority")).Text;
|
||||||
ViewState["RecordData"] = ((Literal)row.Cells[0].FindControl("litRecordData")).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["RecordData"] = ((Literal)row.Cells[0].FindControl("litRecordData")).Text;
|
||||||
|
}
|
||||||
|
|
||||||
private void BindDnsRecord(int recordIndex)
|
private void BindDnsRecord(int recordIndex)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
litRecordType.Visible = true;
|
ViewState["NewRecord"] = false;
|
||||||
ddlRecordType.Visible = false;
|
GetRecordsDetails(recordIndex);
|
||||||
|
|
||||||
GetRecordsDetails(recordIndex);
|
ddlRecordType.SelectedValue = ViewState["RecordType"].ToString();
|
||||||
|
litRecordType.Text = ViewState["RecordType"].ToString();
|
||||||
ddlRecordType.SelectedValue = ViewState["RecordType"].ToString();
|
txtRecordName.Text = ViewState["RecordName"].ToString();
|
||||||
litRecordType.Text = ViewState["RecordType"].ToString();
|
txtRecordData.Text = ViewState["RecordData"].ToString();
|
||||||
txtRecordName.Text = ViewState["RecordName"].ToString();
|
txtMXPriority.Text = ViewState["MxPriority"].ToString();
|
||||||
txtRecordData.Text = ViewState["RecordData"].ToString();
|
txtSRVPriority.Text = ViewState["SrvPriority"].ToString();
|
||||||
txtMXPriority.Text = ViewState["MxPriority"].ToString();
|
txtSRVWeight.Text = ViewState["SrvWeight"].ToString();
|
||||||
ToggleRecordControls();
|
txtSRVPort.Text = ViewState["SrvPort"].ToString();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
messageBox.ShowErrorMessage("GDNS_GET_RECORD", ex);
|
ShowErrorMessage("GDNS_GET_RECORD", ex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void ddlRecordType_SelectedIndexChanged(object sender, EventArgs e)
|
protected void ddlRecordType_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -105,19 +114,32 @@ namespace WebsitePanel.Portal.ExchangeServer
|
||||||
|
|
||||||
private void ToggleRecordControls()
|
private void ToggleRecordControls()
|
||||||
{
|
{
|
||||||
rowMXPriority.Visible = (ddlRecordType.SelectedValue == "MX");
|
rowMXPriority.Visible = false;
|
||||||
|
rowSRVPriority.Visible = false;
|
||||||
if (ddlRecordType.SelectedValue == "A")
|
rowSRVWeight.Visible = false;
|
||||||
|
rowSRVPort.Visible = false;
|
||||||
|
lblRecordData.Text = "Record Data:";
|
||||||
|
IPValidator.Enabled = false;
|
||||||
|
|
||||||
|
switch (ddlRecordType.SelectedValue)
|
||||||
{
|
{
|
||||||
lblRecordData.Text = "IP:";
|
case "A":
|
||||||
IPValidator1.Enabled = true;
|
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;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
|
||||||
lblRecordData.Text = "Record Data:";
|
|
||||||
IPValidator1.Enabled = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SaveRecord()
|
private void SaveRecord()
|
||||||
{
|
{
|
||||||
|
@ -131,11 +153,16 @@ namespace WebsitePanel.Portal.ExchangeServer
|
||||||
// add record
|
// add record
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int result = ES.Services.Servers.AddDnsZoneRecord(PanelRequest.DomainID,
|
int result = ES.Services.Servers.AddDnsZoneRecord(PanelRequest.DomainID,
|
||||||
txtRecordName.Text.Trim(),
|
txtRecordName.Text.Trim(),
|
||||||
(DnsRecordType)Enum.Parse(typeof(DnsRecordType), ddlRecordType.SelectedValue, true),
|
(DnsRecordType)
|
||||||
txtRecordData.Text.Trim(),
|
Enum.Parse(typeof(DnsRecordType),
|
||||||
Utils.ParseInt(txtMXPriority.Text.Trim(), 0));
|
ddlRecordType.SelectedValue, true),
|
||||||
|
txtRecordData.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)
|
if (result < 0)
|
||||||
{
|
{
|
||||||
|
@ -154,13 +181,16 @@ namespace WebsitePanel.Portal.ExchangeServer
|
||||||
// update record
|
// update record
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int result = ES.Services.Servers.UpdateDnsZoneRecord(PanelRequest.DomainID,
|
int result = ES.Services.Servers.UpdateDnsZoneRecord(PanelRequest.DomainID,
|
||||||
ViewState["RecordName"].ToString(),
|
ViewState["RecordName"].ToString(),
|
||||||
ViewState["RecordData"].ToString(),
|
ViewState["RecordData"].ToString(),
|
||||||
txtRecordName.Text.Trim(),
|
txtRecordName.Text.Trim(),
|
||||||
(DnsRecordType)ViewState["RecordType"],
|
(DnsRecordType)ViewState["RecordType"],
|
||||||
txtRecordData.Text.Trim(),
|
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)
|
if (result < 0)
|
||||||
{
|
{
|
||||||
|
@ -220,18 +250,21 @@ namespace WebsitePanel.Portal.ExchangeServer
|
||||||
|
|
||||||
private void ResetPopup()
|
private void ResetPopup()
|
||||||
{
|
{
|
||||||
EditRecordModal.Hide();
|
EditRecordModal.Hide();
|
||||||
ViewState["ExistingRecord"] = null;
|
ViewState["ExistingRecord"] = null;
|
||||||
|
|
||||||
// erase fields
|
// erase fields
|
||||||
litRecordType.Visible = false;
|
litRecordType.Visible = false;
|
||||||
ddlRecordType.Visible = true;
|
ddlRecordType.Visible = true;
|
||||||
ddlRecordType.SelectedIndex = 0;
|
ddlRecordType.SelectedIndex = 0;
|
||||||
txtRecordName.Text = "";
|
txtRecordName.Text = "";
|
||||||
txtRecordData.Text = "";
|
txtRecordData.Text = "";
|
||||||
txtMXPriority.Text = "1";
|
txtMXPriority.Text = "1";
|
||||||
ToggleRecordControls();
|
txtSRVPriority.Text = "0";
|
||||||
}
|
txtSRVWeight.Text = "0";
|
||||||
|
txtSRVPort.Text = "0";
|
||||||
|
ToggleRecordControls();
|
||||||
|
}
|
||||||
|
|
||||||
protected void gvRecords_RowEditing(object sender, GridViewEditEventArgs e)
|
protected void gvRecords_RowEditing(object sender, GridViewEditEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// 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
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
// the code is regenerated.
|
// the code is regenerated.
|
||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -229,6 +228,15 @@ namespace WebsitePanel.Portal.ExchangeServer {
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
protected global::System.Web.UI.WebControls.RequiredFieldValidator valRequireData;
|
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>
|
/// <summary>
|
||||||
/// IPValidator1 control.
|
/// IPValidator1 control.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -283,6 +291,141 @@ namespace WebsitePanel.Portal.ExchangeServer {
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
protected global::System.Web.UI.WebControls.RegularExpressionValidator valRequireCorrectPriority;
|
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>
|
/// <summary>
|
||||||
/// btnSave control.
|
/// btnSave control.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
<asp:ListItem>NS</asp:ListItem>
|
<asp:ListItem>NS</asp:ListItem>
|
||||||
<asp:ListItem>TXT</asp:ListItem>
|
<asp:ListItem>TXT</asp:ListItem>
|
||||||
<asp:ListItem>CNAME</asp:ListItem>
|
<asp:ListItem>CNAME</asp:ListItem>
|
||||||
|
<asp:ListItem>SRV</asp:ListItem>
|
||||||
</asp:DropDownList>
|
</asp:DropDownList>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -60,6 +61,28 @@
|
||||||
<asp:TextBox ID="txtMXPriority" runat="server" Width="30" CssClass="NormalTextBox"></asp:TextBox>
|
<asp:TextBox ID="txtMXPriority" runat="server" Width="30" CssClass="NormalTextBox"></asp:TextBox>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</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>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<asp:Button ID="btnSave" runat="server" meta:resourcekey="btnSave" Text="Save" CssClass="Button1" OnClick="btnSave_Click" ValidationGroup="DnsRecord" />
|
<asp:Button ID="btnSave" runat="server" meta:resourcekey="btnSave" Text="Save" CssClass="Button1" OnClick="btnSave_Click" ValidationGroup="DnsRecord" />
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2012, Outercurve Foundation.
|
// Copyright (c) 2011, Outercurve Foundation.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without modification,
|
// Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
@ -86,6 +86,7 @@ namespace WebsitePanel.Portal
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BindDnsRecords()
|
private void BindDnsRecords()
|
||||||
|
@ -104,6 +105,8 @@ namespace WebsitePanel.Portal
|
||||||
gvRecords.DataSource = ds;
|
gvRecords.DataSource = ds;
|
||||||
gvRecords.DataBind();
|
gvRecords.DataBind();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ToggleRecordControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BindDnsRecord(int recordId)
|
private void BindDnsRecord(int recordId)
|
||||||
|
@ -119,6 +122,9 @@ namespace WebsitePanel.Portal
|
||||||
txtRecordName.Text = record.RecordName;
|
txtRecordName.Text = record.RecordName;
|
||||||
txtRecordData.Text = record.RecordData;
|
txtRecordData.Text = record.RecordData;
|
||||||
txtMXPriority.Text = record.MxPriority.ToString();
|
txtMXPriority.Text = record.MxPriority.ToString();
|
||||||
|
txtSRVPriority.Text = record.SrvPriority.ToString();
|
||||||
|
txtSRVWeight.Text = record.SrvWeight.ToString();
|
||||||
|
txtSRVPort.Text = record.SrvPort.ToString();
|
||||||
ipAddress.AddressId = record.IpAddressId;
|
ipAddress.AddressId = record.IpAddressId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,9 +144,32 @@ namespace WebsitePanel.Portal
|
||||||
|
|
||||||
private void ToggleRecordControls()
|
private void ToggleRecordControls()
|
||||||
{
|
{
|
||||||
ipAddress.Visible = (ddlRecordType.SelectedValue == "A");
|
|
||||||
//rowData.Visible = (ddlRecordType.SelectedValue != "A");
|
rowMXPriority.Visible = false;
|
||||||
rowMXPriority.Visible = (ddlRecordType.SelectedValue == "MX");
|
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()
|
private void SaveRecord()
|
||||||
|
@ -151,6 +180,9 @@ namespace WebsitePanel.Portal
|
||||||
record.RecordName = txtRecordName.Text.Trim();
|
record.RecordName = txtRecordName.Text.Trim();
|
||||||
record.RecordData = txtRecordData.Text.Trim();
|
record.RecordData = txtRecordData.Text.Trim();
|
||||||
record.MxPriority = Utils.ParseInt(txtMXPriority.Text, 0);
|
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;
|
record.IpAddressId = ipAddress.AddressId;
|
||||||
|
|
||||||
if (ServiceIdParam != null)
|
if (ServiceIdParam != null)
|
||||||
|
@ -230,6 +262,11 @@ namespace WebsitePanel.Portal
|
||||||
txtRecordName.Text = "";
|
txtRecordName.Text = "";
|
||||||
txtRecordData.Text = "";
|
txtRecordData.Text = "";
|
||||||
txtMXPriority.Text = "0";
|
txtMXPriority.Text = "0";
|
||||||
|
txtSRVPriority.Text = "0";
|
||||||
|
txtSRVWeight.Text = "0";
|
||||||
|
txtSRVPort.Text = "0";
|
||||||
|
|
||||||
|
ToggleRecordControls();
|
||||||
|
|
||||||
ShowPanels(true);
|
ShowPanels(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +1,249 @@
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// 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
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
// the code is regenerated.
|
// the code is regenerated.
|
||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace WebsitePanel.Portal {
|
namespace WebsitePanel.Portal {
|
||||||
|
|
||||||
|
|
||||||
public partial class GlobalDnsRecordsControl {
|
public partial class GlobalDnsRecordsControl {
|
||||||
protected System.Web.UI.WebControls.Panel pnlRecords;
|
|
||||||
protected System.Web.UI.WebControls.Button btnAdd;
|
/// <summary>
|
||||||
protected System.Web.UI.WebControls.GridView gvRecords;
|
/// pnlRecords control.
|
||||||
protected System.Web.UI.WebControls.Panel pnlEdit;
|
/// </summary>
|
||||||
protected System.Web.UI.WebControls.Label lblRecordType;
|
/// <remarks>
|
||||||
protected System.Web.UI.WebControls.DropDownList ddlRecordType;
|
/// Auto-generated field.
|
||||||
protected System.Web.UI.WebControls.Label lblRecordName;
|
/// To modify move field declaration from designer file to code-behind file.
|
||||||
protected System.Web.UI.WebControls.TextBox txtRecordName;
|
/// </remarks>
|
||||||
protected System.Web.UI.HtmlControls.HtmlTableRow rowData;
|
protected global::System.Web.UI.WebControls.Panel pnlRecords;
|
||||||
protected System.Web.UI.WebControls.Label lblRecordData;
|
|
||||||
protected System.Web.UI.WebControls.TextBox txtRecordData;
|
/// <summary>
|
||||||
protected WebsitePanel.Portal.SelectIPAddress ipAddress;
|
/// btnAdd control.
|
||||||
protected System.Web.UI.HtmlControls.HtmlTableRow rowMXPriority;
|
/// </summary>
|
||||||
protected System.Web.UI.WebControls.Label lblMXPriority;
|
/// <remarks>
|
||||||
protected System.Web.UI.WebControls.TextBox txtMXPriority;
|
/// Auto-generated field.
|
||||||
protected System.Web.UI.WebControls.Button btnSave;
|
/// To modify move field declaration from designer file to code-behind file.
|
||||||
protected System.Web.UI.WebControls.Button btnCancel;
|
/// </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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011, Outercurve Foundation.
|
// Copyright (c) 2012, Outercurve Foundation.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without modification,
|
// 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)
|
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)
|
if (result < 0)
|
||||||
{
|
{
|
||||||
ShowResultMessage(result);
|
ShowResultMessage(result);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue