This commit is contained in:
Virtuworks 2014-12-20 07:50:13 -05:00
commit b7db9f30cb
8 changed files with 265 additions and 204 deletions

View file

@ -6195,6 +6195,12 @@ INSERT [dbo].[ScheduleTaskParameters] ([TaskID], [ParameterID], [DataTypeID], [D
END
GO
IF NOT EXISTS (SELECT * FROM [dbo].[ScheduleTaskParameters] WHERE [TaskID] = N'SCHEDULE_TASK_DOMAIN_LOOKUP' AND [ParameterID]= N'PAUSE_BETWEEN_QUERIES' )
BEGIN
INSERT [dbo].[ScheduleTaskParameters] ([TaskID], [ParameterID], [DataTypeID], [DefaultValue], [ParameterOrder]) VALUES (N'SCHEDULE_TASK_DOMAIN_LOOKUP', N'PAUSE_BETWEEN_QUERIES', N'String', N'100', 4)
END
GO
IF EXISTS (SELECT * FROM [dbo].[ScheduleTaskParameters] WHERE [TaskID] = N'SCHEDULE_TASK_DOMAIN_LOOKUP' AND [ParameterID]= N'SERVER_NAME' )
BEGIN
UPDATE [dbo].[ScheduleTaskParameters] SET [DefaultValue] = N'' WHERE [TaskID] = N'SCHEDULE_TASK_DOMAIN_LOOKUP' AND [ParameterID]= N'SERVER_NAME'
@ -6306,91 +6312,91 @@ END
GO
IF NOT EXISTS (SELECT * FROM [dbo].[UserSettings] WHERE [UserID] = 1 AND [SettingsName]= N'DomainExpirationLetter' AND [PropertyName]= N'HtmlBody' )
BEGIN
INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'DomainExpirationLetter', N'HtmlBody', N'<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Domain Expiration Information</title>
<style type="text/css">
.Summary { background-color: ##ffffff; padding: 5px; }
.Summary .Header { padding: 10px 0px 10px 10px; font-size: 16pt; background-color: ##E5F2FF; color: ##1F4978; border-bottom: solid 2px ##86B9F7; }
.Summary A { color: ##0153A4; }
.Summary { font-family: Tahoma; font-size: 9pt; }
.Summary H1 { font-size: 1.7em; color: ##1F4978; border-bottom: dotted 3px ##efefef; }
.Summary H2 { font-size: 1.3em; color: ##1F4978; }
.Summary TABLE { border: solid 1px ##e5e5e5; }
.Summary TH,
.Summary TD.Label { padding: 5px; font-size: 8pt; font-weight: bold; background-color: ##f5f5f5; }
.Summary TD { padding: 8px; font-size: 9pt; }
.Summary UL LI { font-size: 1.1em; font-weight: bold; }
.Summary UL UL LI { font-size: 0.9em; font-weight: normal; }
</style>
</head>
<body>
<div class="Summary">
<a name="top"></a>
<div class="Header">
Domain Expiration Information
</div>
<ad:if test="#user#">
<p>
Hello #user.FirstName#,
</p>
</ad:if>
<p>
Please, find below details of your domain expiration information.
</p>
<table>
<thead>
<tr>
<th>Domain</th>
<th>Customer</th>
<th>Expiration Date</th>
</tr>
</thead>
<tbody>
<ad:foreach collection="#Domains#" var="Domain" index="i">
<tr>
<td>#Domain.DomainName#</td>
<td>#Domain.Customer#</td>
<td>#Domain.ExpirationDate#</td>
</tr>
</ad:foreach>
</tbody>
</table>
<ad:if test="#IncludeNonExistenDomains#">
<p>
Please, find below details of your non-existen domains.
</p>
<table>
<thead>
<tr>
<th>Domain</th>
<th>Customer</th>
</tr>
</thead>
<tbody>
<ad:foreach collection="#NonExistenDomains#" var="Domain" index="i">
<tr>
<td>#Domain.DomainName#</td>
<td>#Domain.Customer#</td>
</tr>
</ad:foreach>
</tbody>
</table>
</ad:if>
<p>
If you have any questions regarding your hosting account, feel free to contact our support department at any time.
</p>
<p>
Best regards
INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'DomainExpirationLetter', N'HtmlBody', N'<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Domain Expiration Information</title>
<style type="text/css">
.Summary { background-color: ##ffffff; padding: 5px; }
.Summary .Header { padding: 10px 0px 10px 10px; font-size: 16pt; background-color: ##E5F2FF; color: ##1F4978; border-bottom: solid 2px ##86B9F7; }
.Summary A { color: ##0153A4; }
.Summary { font-family: Tahoma; font-size: 9pt; }
.Summary H1 { font-size: 1.7em; color: ##1F4978; border-bottom: dotted 3px ##efefef; }
.Summary H2 { font-size: 1.3em; color: ##1F4978; }
.Summary TABLE { border: solid 1px ##e5e5e5; }
.Summary TH,
.Summary TD.Label { padding: 5px; font-size: 8pt; font-weight: bold; background-color: ##f5f5f5; }
.Summary TD { padding: 8px; font-size: 9pt; }
.Summary UL LI { font-size: 1.1em; font-weight: bold; }
.Summary UL UL LI { font-size: 0.9em; font-weight: normal; }
</style>
</head>
<body>
<div class="Summary">
<a name="top"></a>
<div class="Header">
Domain Expiration Information
</div>
<ad:if test="#user#">
<p>
Hello #user.FirstName#,
</p>
</ad:if>
<p>
Please, find below details of your domain expiration information.
</p>
<table>
<thead>
<tr>
<th>Domain</th>
<th>Customer</th>
<th>Expiration Date</th>
</tr>
</thead>
<tbody>
<ad:foreach collection="#Domains#" var="Domain" index="i">
<tr>
<td>#Domain.DomainName#</td>
<td>#Domain.Customer#</td>
<td>#Domain.ExpirationDate#</td>
</tr>
</ad:foreach>
</tbody>
</table>
<ad:if test="#IncludeNonExistenDomains#">
<p>
Please, find below details of your non-existen domains.
</p>
<table>
<thead>
<tr>
<th>Domain</th>
<th>Customer</th>
</tr>
</thead>
<tbody>
<ad:foreach collection="#NonExistenDomains#" var="Domain" index="i">
<tr>
<td>#Domain.DomainName#</td>
<td>#Domain.Customer#</td>
</tr>
</ad:foreach>
</tbody>
</table>
</ad:if>
<p>
If you have any questions regarding your hosting account, feel free to contact our support department at any time.
</p>
<p>
Best regards
</p>')
END
GO
@ -6454,76 +6460,76 @@ END
GO
IF NOT EXISTS (SELECT * FROM [dbo].[UserSettings] WHERE [UserID] = 1 AND [SettingsName]= N'DomainLookupLetter' AND [PropertyName]= N'HtmlBody' )
BEGIN
INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'DomainLookupLetter', N'HtmlBody', N'<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>MX and NS Changes Information</title>
<style type="text/css">
.Summary { background-color: ##ffffff; padding: 5px; }
.Summary .Header { padding: 10px 0px 10px 10px; font-size: 16pt; background-color: ##E5F2FF; color: ##1F4978; border-bottom: solid 2px ##86B9F7; }
.Summary A { color: ##0153A4; }
.Summary { font-family: Tahoma; font-size: 9pt; }
.Summary H1 { font-size: 1.7em; color: ##1F4978; border-bottom: dotted 3px ##efefef; }
.Summary H2 { font-size: 1.3em; color: ##1F4978; }
.Summary TABLE { border: solid 1px ##e5e5e5; }
.Summary TH,
.Summary TD.Label { padding: 5px; font-size: 8pt; font-weight: bold; background-color: ##f5f5f5; }
.Summary TD { padding: 8px; font-size: 9pt; }
.Summary UL LI { font-size: 1.1em; font-weight: bold; }
.Summary UL UL LI { font-size: 0.9em; font-weight: normal; }
</style>
</head>
<body>
<div class="Summary">
<a name="top"></a>
<div class="Header">
MX and NS Changes Information
</div>
<ad:if test="#user#">
<p>
Hello #user.FirstName#,
</p>
</ad:if>
<p>
Please, find below details of MX and NS changes.
</p>
<ad:foreach collection="#Domains#" var="Domain" index="i">
<h2>#Domain.DomainName# - #DomainUsers[Domain.PackageId].FirstName# #DomainUsers[Domain.PackageId].LastName#</h2>
<table>
<thead>
<tr>
<th>DNS</th>
<th>Type</th>
<th>Status</th>
<th>Old Value</th>
<th>New Value</th>
</tr>
</thead>
<tbody>
<ad:foreach collection="#Domain.DnsChanges#" var="DnsChange" index="j">
<tr>
<td>#DnsChange.DnsServer#</td>
<td>#DnsChange.Type#</td>
<td>#DnsChange.Status#</td>
<td>#DnsChange.OldRecord.Value#</td>
<td>#DnsChange.NewRecord.Value#</td>
</tr>
</ad:foreach>
</tbody>
</table>
</ad:foreach>
<p>
If you have any questions regarding your hosting account, feel free to contact our support department at any time.
</p>
<p>
Best regards
INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'DomainLookupLetter', N'HtmlBody', N'<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>MX and NS Changes Information</title>
<style type="text/css">
.Summary { background-color: ##ffffff; padding: 5px; }
.Summary .Header { padding: 10px 0px 10px 10px; font-size: 16pt; background-color: ##E5F2FF; color: ##1F4978; border-bottom: solid 2px ##86B9F7; }
.Summary A { color: ##0153A4; }
.Summary { font-family: Tahoma; font-size: 9pt; }
.Summary H1 { font-size: 1.7em; color: ##1F4978; border-bottom: dotted 3px ##efefef; }
.Summary H2 { font-size: 1.3em; color: ##1F4978; }
.Summary TABLE { border: solid 1px ##e5e5e5; }
.Summary TH,
.Summary TD.Label { padding: 5px; font-size: 8pt; font-weight: bold; background-color: ##f5f5f5; }
.Summary TD { padding: 8px; font-size: 9pt; }
.Summary UL LI { font-size: 1.1em; font-weight: bold; }
.Summary UL UL LI { font-size: 0.9em; font-weight: normal; }
</style>
</head>
<body>
<div class="Summary">
<a name="top"></a>
<div class="Header">
MX and NS Changes Information
</div>
<ad:if test="#user#">
<p>
Hello #user.FirstName#,
</p>
</ad:if>
<p>
Please, find below details of MX and NS changes.
</p>
<ad:foreach collection="#Domains#" var="Domain" index="i">
<h2>#Domain.DomainName# - #DomainUsers[Domain.PackageId].FirstName# #DomainUsers[Domain.PackageId].LastName#</h2>
<table>
<thead>
<tr>
<th>DNS</th>
<th>Type</th>
<th>Status</th>
<th>Old Value</th>
<th>New Value</th>
</tr>
</thead>
<tbody>
<ad:foreach collection="#Domain.DnsChanges#" var="DnsChange" index="j">
<tr>
<td>#DnsChange.DnsServer#</td>
<td>#DnsChange.Type#</td>
<td>#DnsChange.Status#</td>
<td>#DnsChange.OldRecord.Value#</td>
<td>#DnsChange.NewRecord.Value#</td>
</tr>
</ad:foreach>
</tbody>
</table>
</ad:foreach>
<p>
If you have any questions regarding your hosting account, feel free to contact our support department at any time.
</p>
<p>
Best regards
</p>')
END
GO
@ -6573,48 +6579,48 @@ END
GO
IF NOT EXISTS (SELECT * FROM [dbo].[UserSettings] WHERE [UserID] = 1 AND [SettingsName]= N'DomainLookupLetter' AND [PropertyName]= N'NoChangesHtmlBody' )
BEGIN
INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'DomainLookupLetter', N'NoChangesHtmlBody', N'<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>MX and NS Changes Information</title>
<style type="text/css">
.Summary { background-color: ##ffffff; padding: 5px; }
.Summary .Header { padding: 10px 0px 10px 10px; font-size: 16pt; background-color: ##E5F2FF; color: ##1F4978; border-bottom: solid 2px ##86B9F7; }
.Summary A { color: ##0153A4; }
.Summary { font-family: Tahoma; font-size: 9pt; }
.Summary H1 { font-size: 1.7em; color: ##1F4978; border-bottom: dotted 3px ##efefef; }
.Summary H2 { font-size: 1.3em; color: ##1F4978; }
.Summary TABLE { border: solid 1px ##e5e5e5; }
.Summary TH,
.Summary TD.Label { padding: 5px; font-size: 8pt; font-weight: bold; background-color: ##f5f5f5; }
.Summary TD { padding: 8px; font-size: 9pt; }
.Summary UL LI { font-size: 1.1em; font-weight: bold; }
.Summary UL UL LI { font-size: 0.9em; font-weight: normal; }
</style>
</head>
<body>
<div class="Summary">
<a name="top"></a>
<div class="Header">
MX and NS Changes Information
</div>
<ad:if test="#user#">
<p>
Hello #user.FirstName#,
</p>
</ad:if>
<p>
No MX and NS changes have been found.
</p>
<p>
If you have any questions regarding your hosting account, feel free to contact our support department at any time.
</p>
<p>
Best regards
INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'DomainLookupLetter', N'NoChangesHtmlBody', N'<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>MX and NS Changes Information</title>
<style type="text/css">
.Summary { background-color: ##ffffff; padding: 5px; }
.Summary .Header { padding: 10px 0px 10px 10px; font-size: 16pt; background-color: ##E5F2FF; color: ##1F4978; border-bottom: solid 2px ##86B9F7; }
.Summary A { color: ##0153A4; }
.Summary { font-family: Tahoma; font-size: 9pt; }
.Summary H1 { font-size: 1.7em; color: ##1F4978; border-bottom: dotted 3px ##efefef; }
.Summary H2 { font-size: 1.3em; color: ##1F4978; }
.Summary TABLE { border: solid 1px ##e5e5e5; }
.Summary TH,
.Summary TD.Label { padding: 5px; font-size: 8pt; font-weight: bold; background-color: ##f5f5f5; }
.Summary TD { padding: 8px; font-size: 9pt; }
.Summary UL LI { font-size: 1.1em; font-weight: bold; }
.Summary UL UL LI { font-size: 0.9em; font-weight: normal; }
</style>
</head>
<body>
<div class="Summary">
<a name="top"></a>
<div class="Header">
MX and NS Changes Information
</div>
<ad:if test="#user#">
<p>
Hello #user.FirstName#,
</p>
</ad:if>
<p>
No MX and NS changes have been found.
</p>
<p>
If you have any questions regarding your hosting account, feel free to contact our support department at any time.
</p>
<p>
Best regards
</p>')
END
GO

View file

@ -181,9 +181,11 @@ namespace WebsitePanel.EnterpriseServer
Hashtable items = new Hashtable();
items["user"] = user;
items["Domains"] = domains.Select(x => new { DomainName = x.DomainName,
ExpirationDate = x.ExpirationDate,
Customer = string.Format("{0} {1}", domainUsers[x.PackageId].FirstName, domainUsers[x.PackageId].LastName) });
Customer = string.Format("{0} {1}", domainUsers[x.PackageId].FirstName, domainUsers[x.PackageId].LastName) })
.OrderBy(x => x.ExpirationDate).ThenBy(x => x.Customer).ThenBy(x => x.DomainName);
items["IncludeNonExistenDomains"] = includeNonExistenDomains;
@ -191,7 +193,7 @@ namespace WebsitePanel.EnterpriseServer
{
DomainName = x.DomainName,
Customer = string.Format("{0} {1}", domainUsers[x.PackageId].FirstName, domainUsers[x.PackageId].LastName)
});
}).OrderBy(x => x.Customer).ThenBy(x => x.DomainName);
body = PackageController.EvaluateTemplate(body, items);

View file

@ -23,6 +23,7 @@ namespace WebsitePanel.EnterpriseServer
private static readonly string MailBodyTemplateParameter = "MAIL_BODY";
private static readonly string MailBodyDomainRecordTemplateParameter = "MAIL_DOMAIN_RECORD";
private static readonly string ServerNameParameter = "SERVER_NAME";
private static readonly string PauseBetweenQueriesParameter = "PAUSE_BETWEEN_QUERIES";
private const string MxRecordPattern = @"mail exchanger = (.+)";
private const string NsRecordPattern = @"nameserver = (.+)";
@ -40,7 +41,9 @@ namespace WebsitePanel.EnterpriseServer
string dnsServersString = (string)topTask.GetParamValue(DnsServersParameter);
string serverName = (string)topTask.GetParamValue(ServerNameParameter);
// check input parameters
int pause;
// check input parameters
if (String.IsNullOrEmpty(dnsServersString))
{
TaskManager.WriteWarning("Specify 'DNS' task parameter.");
@ -53,6 +56,13 @@ namespace WebsitePanel.EnterpriseServer
return;
}
if (!int.TryParse((string)topTask.GetParamValue(PauseBetweenQueriesParameter), out pause))
{
TaskManager.WriteWarning("The 'pause between queries' parameter is not valid.");
return;
}
// find server by name
ServerInfo server = ServerController.GetServerByName(serverName);
if (server == null)
@ -102,8 +112,8 @@ namespace WebsitePanel.EnterpriseServer
//execute server
foreach (var dnsServer in dnsServers)
{
var dnsMxRecords = GetDomainDnsRecords(winServer, domain.DomainName, dnsServer, DnsRecordType.MX) ?? dbDnsRecords.Where(x => x.RecordType == DnsRecordType.MX).ToList();
var dnsNsRecords = GetDomainDnsRecords(winServer, domain.DomainName, dnsServer, DnsRecordType.NS) ?? dbDnsRecords.Where(x => x.RecordType == DnsRecordType.NS).ToList();
var dnsMxRecords = GetDomainDnsRecords(winServer, domain.DomainName, dnsServer, DnsRecordType.MX, pause) ?? dbDnsRecords.Where(x => x.RecordType == DnsRecordType.MX).ToList();
var dnsNsRecords = GetDomainDnsRecords(winServer, domain.DomainName, dnsServer, DnsRecordType.NS, pause) ?? dbDnsRecords.Where(x => x.RecordType == DnsRecordType.NS).ToList();
FillRecordData(dnsMxRecords, domain, dnsServer);
FillRecordData(dnsNsRecords, domain, dnsServer);
@ -306,8 +316,10 @@ namespace WebsitePanel.EnterpriseServer
MailHelper.SendMessage(from, mailTo, bcc, subject, body, priority, isHtml);
}
public List<DnsRecordInfo> GetDomainDnsRecords(WindowsServer winServer, string domain, string dnsServer, DnsRecordType recordType)
public List<DnsRecordInfo> GetDomainDnsRecords(WindowsServer winServer, string domain, string dnsServer, DnsRecordType recordType, int pause)
{
Thread.Sleep(pause);
//nslookup -type=mx google.com 195.46.39.39
var command = "nslookup";
var args = string.Format("-type={0} {1} {2}", recordType, domain, dnsServer);

View file

@ -79,6 +79,15 @@ namespace WebsitePanel.Portal.ScheduleTaskControls.App_LocalResources {
}
}
/// <summary>
/// Looks up a localized string similar to Pause between queries (ms):.
/// </summary>
internal static string lblPause {
get {
return ResourceManager.GetString("lblPause", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Server Name:.
/// </summary>

View file

@ -123,6 +123,9 @@
<data name="lblDnsServersHint" xml:space="preserve">
<value>Please enter dns servers to check.</value>
</data>
<data name="lblPause" xml:space="preserve">
<value>Pause between queries (ms):</value>
</data>
<data name="lblServerName" xml:space="preserve">
<value>Server Name:</value>
</data>

View file

@ -25,4 +25,12 @@
<asp:TextBox ID="txtMailTo" runat="server" Width="95%" CssClass="NormalTextBox" MaxLength="1000"></asp:TextBox>
</td>
</tr>
<tr>
<td class="SubHead" nowrap>
<asp:Label ID="lblPause" runat="server" meta:resourcekey="lblPause" Text="Pause between queries (ms):"></asp:Label>
</td>
<td class="Normal" width="100%">
<asp:TextBox ID="txtPause" runat="server" Width="95%" CssClass="NormalTextBox" MaxLength="1000"></asp:TextBox>
</td>
</tr>
</table>

View file

@ -14,6 +14,7 @@ namespace WebsitePanel.Portal.ScheduleTaskControls
private static readonly string DnsServersParameter = "DNS_SERVERS";
private static readonly string MailToParameter = "MAIL_TO";
private static readonly string ServerNameParameter = "SERVER_NAME";
private static readonly string PauseBetweenQueriesParameter = "PAUSE_BETWEEN_QUERIES";
protected void Page_Load(object sender, EventArgs e)
{
@ -30,6 +31,7 @@ namespace WebsitePanel.Portal.ScheduleTaskControls
this.SetParameter(this.txtDnsServers, DnsServersParameter);
this.SetParameter(this.txtMailTo, MailToParameter);
this.SetParameter(this.txtPause, PauseBetweenQueriesParameter);
this.SetParameter(this.ddlServers, ServerNameParameter);
var servers = ES.Services.Servers.GetAllServers();
@ -68,8 +70,9 @@ namespace WebsitePanel.Portal.ScheduleTaskControls
ScheduleTaskParameterInfo dnsServers = this.GetParameter(this.txtDnsServers, DnsServersParameter);
ScheduleTaskParameterInfo mailTo = this.GetParameter(this.txtMailTo, MailToParameter);
ScheduleTaskParameterInfo serverName = this.GetParameter(this.ddlServers, ServerNameParameter);
ScheduleTaskParameterInfo pause = this.GetParameter(this.txtPause, PauseBetweenQueriesParameter);
return new ScheduleTaskParameterInfo[3] { dnsServers, mailTo, serverName };
return new ScheduleTaskParameterInfo[4] { dnsServers, mailTo, serverName, pause };
}
}
}

View file

@ -65,5 +65,23 @@ namespace WebsitePanel.Portal.ScheduleTaskControls {
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtMailTo;
/// <summary>
/// lblPause 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 lblPause;
/// <summary>
/// txtPause 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 txtPause;
}
}