This commit is contained in:
Virtuworks 2014-12-18 06:41:29 -05:00
commit f354619bb6
6 changed files with 242 additions and 213 deletions

View file

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

View file

@ -32,7 +32,7 @@ namespace WebsitePanel.EnterpriseServer
var checkedDomains = new List<int>(); var checkedDomains = new List<int>();
var expiredDomains = new List<DomainInfo>(); var expiredDomains = new List<DomainInfo>();
var nonExistenDomains = new List<DomainInfo>(); var nonExistenDomains = new List<DomainInfo>();
var subDomains = new List<DomainInfo>(); var allDomains = new List<DomainInfo>();
var allTopLevelDomains = new List<DomainInfo>(); var allTopLevelDomains = new List<DomainInfo>();
// get input parameters // get input parameters
@ -58,7 +58,7 @@ namespace WebsitePanel.EnterpriseServer
{ {
var domains = ServerController.GetDomains(package.PackageId); var domains = ServerController.GetDomains(package.PackageId);
subDomains.AddRange(domains.Where(x => x.IsSubDomain)); allDomains.AddRange(domains);
domains = domains.Where(x => !x.IsSubDomain && !x.IsDomainPointer).ToList(); //Selecting top-level domains domains = domains.Where(x => !x.IsSubDomain && !x.IsDomainPointer).ToList(); //Selecting top-level domains
@ -96,17 +96,24 @@ namespace WebsitePanel.EnterpriseServer
} }
} }
subDomains = subDomains.GroupBy(p => p.DomainId).Select(g => g.First()).ToList(); var subDomains = allDomains.Where(x => x.ExpirationDate == null || CheckDomainExpiration(x.ExpirationDate, daysBeforeNotify)).GroupBy(p => p.DomainId).Select(g => g.First()).ToList();
allTopLevelDomains = allTopLevelDomains.GroupBy(p => p.DomainId).Select(g => g.First()).ToList(); allTopLevelDomains = allTopLevelDomains.GroupBy(p => p.DomainId).Select(g => g.First()).ToList();
foreach (var subDomain in subDomains) foreach (var subDomain in subDomains)
{ {
var mainDomain = allTopLevelDomains.Where(x => subDomain.DomainName.ToLowerInvariant().Contains(x.DomainName.ToLowerInvariant())).OrderByDescending(s => s.DomainName.Length).FirstOrDefault(); ; var mainDomain = allTopLevelDomains.Where(x => subDomain.DomainId != x.DomainId && subDomain.DomainName.ToLowerInvariant().Contains(x.DomainName.ToLowerInvariant())).OrderByDescending(s => s.DomainName.Length).FirstOrDefault(); ;
if (mainDomain != null) if (mainDomain != null)
{ {
ServerController.UpdateDomainRegistrationData(subDomain, mainDomain.CreationDate, mainDomain.ExpirationDate); ServerController.UpdateDomainRegistrationData(subDomain, mainDomain.CreationDate, mainDomain.ExpirationDate);
var nonExistenDomain = nonExistenDomains.FirstOrDefault(x => subDomain.DomainId == x.DomainId);
if (nonExistenDomain != null)
{
nonExistenDomains.Remove(nonExistenDomain);
}
Thread.Sleep(100); Thread.Sleep(100);
} }
} }

View file

@ -32,6 +32,7 @@ namespace WebsitePanel.EnterpriseServer
BackgroundTask topTask = TaskManager.TopTask; BackgroundTask topTask = TaskManager.TopTask;
List<DomainDnsChanges> domainsChanges = new List<DomainDnsChanges>(); List<DomainDnsChanges> domainsChanges = new List<DomainDnsChanges>();
var domainUsers = new Dictionary<int, UserInfo>();
// get input parameters // get input parameters
string dnsServersString = (string)topTask.GetParamValue(DnsServersParameter); string dnsServersString = (string)topTask.GetParamValue(DnsServersParameter);
@ -83,8 +84,16 @@ namespace WebsitePanel.EnterpriseServer
continue; continue;
} }
if (!domainUsers.ContainsKey(domain.PackageId))
{
var domainUser = UserController.GetUser(packages.First(x=>x.PackageId == domain.PackageId).UserId);
domainUsers.Add(domain.PackageId, domainUser);
}
DomainDnsChanges domainChanges = new DomainDnsChanges(); DomainDnsChanges domainChanges = new DomainDnsChanges();
domainChanges.DomainName = domain.DomainName; domainChanges.DomainName = domain.DomainName;
domainChanges.PackageId = domain.PackageId;
var dbDnsRecords = ObjectUtils.CreateListFromDataReader<DnsRecordInfo>(DataProvider.GetDomainAllDnsRecords(domain.DomainId)); var dbDnsRecords = ObjectUtils.CreateListFromDataReader<DnsRecordInfo>(DataProvider.GetDomainAllDnsRecords(domain.DomainId));
@ -109,7 +118,7 @@ namespace WebsitePanel.EnterpriseServer
var changedDomains = FindDomainsWithChangedRecords(domainsChanges); var changedDomains = FindDomainsWithChangedRecords(domainsChanges);
SendMailMessage(user, changedDomains); SendMailMessage(user, changedDomains, domainUsers);
} }
@ -252,7 +261,7 @@ namespace WebsitePanel.EnterpriseServer
Thread.Sleep(100); Thread.Sleep(100);
} }
private void SendMailMessage(UserInfo user, IEnumerable<DomainDnsChanges> domainsChanges) private void SendMailMessage(UserInfo user, IEnumerable<DomainDnsChanges> domainsChanges, Dictionary<int, UserInfo> domainUsers)
{ {
BackgroundTask topTask = TaskManager.TopTask; BackgroundTask topTask = TaskManager.TopTask;
@ -286,6 +295,7 @@ namespace WebsitePanel.EnterpriseServer
Hashtable items = new Hashtable(); Hashtable items = new Hashtable();
items["user"] = user; items["user"] = user;
items["DomainUsers"] = domainUsers;
items["Domains"] = domainsChanges; items["Domains"] = domainsChanges;
body = PackageController.EvaluateTemplate(body, items); body = PackageController.EvaluateTemplate(body, items);

View file

@ -8,6 +8,7 @@ namespace WebsitePanel.Providers.DomainLookup
public class DomainDnsChanges public class DomainDnsChanges
{ {
public string DomainName { get; set; } public string DomainName { get; set; }
public int PackageId { get; set; }
public List<DnsRecordInfoChange> DnsChanges { get; set; } public List<DnsRecordInfoChange> DnsChanges { get; set; }

View file

@ -213,4 +213,7 @@
<data name="DomainExpirationDate.NotExist" xml:space="preserve"> <data name="DomainExpirationDate.NotExist" xml:space="preserve">
<value>Non-Existent</value> <value>Non-Existent</value>
</data> </data>
<data name="DomainLookup.TooltipHeader" xml:space="preserve">
<value>Current Real DNS Values</value>
</data>
</root> </root>

View file

@ -39,6 +39,7 @@ using System.Web.UI.HtmlControls;
using System.Linq; using System.Linq;
using WebsitePanel.EnterpriseServer; using WebsitePanel.EnterpriseServer;
using System.Collections.Generic;
namespace WebsitePanel.Portal namespace WebsitePanel.Portal
{ {
@ -160,7 +161,15 @@ namespace WebsitePanel.Portal
return "No Dns Records"; return "No Dns Records";
} }
return string.Join("\r\n", records.Select(x=>string.Format("{0}: {1}", x.RecordType, x.Value))); var header = GetLocalizedString("DomainLookup.TooltipHeader");
var tooltipLines = new List<string>();
tooltipLines.Add(header);
tooltipLines.Add(" ");
tooltipLines.AddRange( records.Select(x=>string.Format("{0}: {1}", x.RecordType, x.Value)));
return string.Join("\r\n", tooltipLines);
} }
protected void odsDomainsPaged_Selected(object sender, ObjectDataSourceStatusEventArgs e) protected void odsDomainsPaged_Selected(object sender, ObjectDataSourceStatusEventArgs e)