This commit is contained in:
vfedosevich 2014-12-31 03:17:43 -08:00
commit 0b55ae40a3
32 changed files with 2923 additions and 2272 deletions

View file

@ -6346,6 +6346,7 @@ Please, find below details of your domain expiration information.
<thead>
<tr>
<th>Domain</th>
<th>Registrar</th>
<th>Customer</th>
<th>Expiration Date</th>
</tr>
@ -6354,8 +6355,9 @@ Please, find below details of your domain expiration information.
<ad:foreach collection="#Domains#" var="Domain" index="i">
<tr>
<td>#Domain.DomainName#</td>
<td>#iif(isnull(Domain.Registrar), "", Domain.Registrar)#</td>
<td>#Domain.Customer#</td>
<td>#Domain.ExpirationDate#</td>
<td>#iif(isnull(Domain.ExpirationDate), "", Domain.ExpirationDate)#</td>
</tr>
</ad:foreach>
</tbody>
@ -6418,8 +6420,9 @@ Please, find below details of your domain expiration information.
<ad:foreach collection="#Domains#" var="Domain" index="i">
Domain: #Domain.DomainName#
Registrar: #iif(isnull(Domain.Registrar), "", Domain.Registrar)#
Customer: #Domain.Customer#
Expiration Date: #Domain.ExpirationDate#
Expiration Date: #iif(isnull(Domain.ExpirationDate), "", Domain.ExpirationDate)#
</ad:foreach>
@ -6464,6 +6467,7 @@ INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [Property
.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 H3 { font-size: 1em; color: ##1F4978; }
.Summary TABLE { border: solid 1px ##e5e5e5; }
.Summary TH,
.Summary TD.Label { padding: 5px; font-size: 8pt; font-weight: bold; background-color: ##f5f5f5; }
@ -6492,6 +6496,7 @@ Please, find below details of MX and NS changes.
<ad:foreach collection="#Domains#" var="Domain" index="i">
<h2>#Domain.DomainName# - #DomainUsers[Domain.PackageId].FirstName# #DomainUsers[Domain.PackageId].LastName#</h2>
<h3>#iif(isnull(Domain.Registrar), "", Domain.Registrar)# #iif(isnull(Domain.ExpirationDate), "", Domain.ExpirationDate)#</h3>
<table>
<thead>
@ -6552,6 +6557,8 @@ Please, find below details of MX and NS changes.
<ad:foreach collection="#Domains#" var="Domain" index="i">
#Domain.DomainName# - #DomainUsers[Domain.PackageId].FirstName# #DomainUsers[Domain.PackageId].LastName#
Registrar: #iif(isnull(Domain.Registrar), "", Domain.Registrar)#
ExpirationDate: #iif(isnull(Domain.ExpirationDate), "", Domain.ExpirationDate)#
<ad:foreach collection="#Domain.DnsChanges#" var="DnsChange" index="j">
DNS: #DnsChange.DnsServer#
@ -6959,7 +6966,6 @@ exec sp_executesql @sql, N'@StartRow int, @MaximumRows int, @PackageID int, @Fil
RETURN
GO
@ -7089,3 +7095,234 @@ AS
RETURN @Result
GO
-- check domain used by hosted organization
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetOrganizationObjectsByDomain')
DROP PROCEDURE GetOrganizationObjectsByDomain
GO
CREATE PROCEDURE [dbo].[GetOrganizationObjectsByDomain]
(
@ItemID int,
@DomainName nvarchar(100)
)
AS
SELECT
'ExchangeAccounts' as ObjectName,
AccountID as ObjectID,
AccountType as ObjectType,
DisplayName as DisplayName,
0 as OwnerID
FROM
ExchangeAccounts
WHERE
UserPrincipalName LIKE '%@'+ @DomainName AND AccountType!=2
UNION
SELECT
'ExchangeAccountEmailAddresses' as ObjectName,
eam.AddressID as ObjectID,
ea.AccountType as ObjectType,
eam.EmailAddress as DisplayName,
eam.AccountID as OwnerID
FROM
ExchangeAccountEmailAddresses as eam
INNER JOIN
ExchangeAccounts ea
ON
ea.AccountID = eam.AccountID
WHERE
(ea.PrimaryEmailAddress != eam.EmailAddress)
AND (ea.UserPrincipalName != eam.EmailAddress)
AND (eam.EmailAddress LIKE '%@'+ @DomainName)
UNION
SELECT
'LyncUsers' as ObjectName,
ea.AccountID as ObjectID,
ea.AccountType as ObjectType,
ea.DisplayName as DisplayName,
0 as OwnerID
FROM
ExchangeAccounts ea
INNER JOIN
LyncUsers ou
ON
ea.AccountID = ou.AccountID
WHERE
ou.SipAddress LIKE '%@'+ @DomainName
ORDER BY
DisplayName
RETURN
GO
IF NOT EXISTS(SELECT * FROM sys.columns
WHERE [name] = N'RegistrarName' AND [object_id] = OBJECT_ID(N'Domains'))
BEGIN
ALTER TABLE [dbo].[Domains] ADD RegistrarName nvarchar(max);
END
GO
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'UpdateWhoisDomainInfo')
DROP PROCEDURE UpdateWhoisDomainInfo
GO
CREATE PROCEDURE [dbo].UpdateWhoisDomainInfo
(
@DomainId INT,
@DomainCreationDate DateTime,
@DomainExpirationDate DateTime,
@DomainLastUpdateDate DateTime,
@DomainRegistrarName nvarchar(max)
)
AS
UPDATE [dbo].[Domains] SET [CreationDate] = @DomainCreationDate, [ExpirationDate] = @DomainExpirationDate, [LastUpdateDate] = @DomainLastUpdateDate, [RegistrarName] = @DomainRegistrarName WHERE [DomainID] = @DomainId
GO
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetDomainsPaged')
DROP PROCEDURE GetDomainsPaged
GO
CREATE 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(2500)
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.DomainItemID,
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,
D.ExpirationDate,
D.LastUpdateDate,
D.RegistrarName,
P.PackageName,
ISNULL(SRV.ServerID, 0) AS ServerID,
ISNULL(SRV.ServerName, '''') AS ServerName,
ISNULL(SRV.Comments, '''') AS ServerComments,
ISNULL(SRV.VirtualServer, 0) AS VirtualServer,
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
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetDomains')
DROP PROCEDURE GetDomains
GO
CREATE PROCEDURE [dbo].[GetDomains]
(
@ActorID int,
@PackageID int,
@Recursive bit = 1
)
AS
-- check rights
IF dbo.CheckActorPackageRights(@ActorID, @PackageID) = 0
RAISERROR('You are not allowed to access this package', 16, 1)
SELECT
D.DomainID,
D.PackageID,
D.ZoneItemID,
D.DomainItemID,
D.DomainName,
D.HostingAllowed,
ISNULL(WS.ItemID, 0) AS WebSiteID,
WS.ItemName AS WebSiteName,
ISNULL(MD.ItemID, 0) AS MailDomainID,
MD.ItemName AS MailDomainName,
Z.ItemName AS ZoneName,
D.IsSubDomain,
D.IsInstantAlias,
D.CreationDate,
D.ExpirationDate,
D.LastUpdateDate,
D.IsDomainPointer,
D.RegistrarName
FROM Domains AS D
INNER JOIN PackagesTree(@PackageID, @Recursive) AS PT ON D.PackageID = PT.PackageID
LEFT OUTER JOIN ServiceItems AS WS ON D.WebSiteID = WS.ItemID
LEFT OUTER JOIN ServiceItems AS MD ON D.MailDomainID = MD.ItemID
LEFT OUTER JOIN ServiceItems AS Z ON D.ZoneItemID = Z.ItemID
RETURN
GO

View file

@ -151,5 +151,6 @@ namespace WebsitePanel.EnterpriseServer
public DateTime? CreationDate { get; set; }
public DateTime? ExpirationDate { get; set; }
public DateTime? LastUpdateDate { get; set; }
public string RegistrarName { get; set; }
}
}

View file

@ -3256,6 +3256,18 @@ namespace WebsitePanel.EnterpriseServer
);
}
public static DataSet GetOrganizationObjectsByDomain(int itemId, string domainName)
{
return SqlHelper.ExecuteDataset(
ConnectionString,
CommandType.StoredProcedure,
"GetOrganizationObjectsByDomain",
new SqlParameter("@ItemID", itemId),
new SqlParameter("@DomainName", domainName)
);
}
#endregion
#region CRM
@ -4827,6 +4839,20 @@ namespace WebsitePanel.EnterpriseServer
);
}
public static void UpdateWhoisDomainInfo(int domainId, DateTime? domainCreationDate, DateTime? domainExpirationDate, DateTime? domainLastUpdateDate, string registrarName)
{
SqlHelper.ExecuteNonQuery(
ConnectionString,
CommandType.StoredProcedure,
"UpdateWhoisDomainInfo",
new SqlParameter("@DomainId", domainId),
new SqlParameter("@DomainCreationDate", domainCreationDate),
new SqlParameter("@DomainExpirationDate", domainExpirationDate),
new SqlParameter("@DomainLastUpdateDate", domainLastUpdateDate),
new SqlParameter("@DomainRegistrarName", registrarName)
);
}
#endregion
}

View file

@ -507,6 +507,15 @@ namespace WebsitePanel.EnterpriseServer
}
}
public static bool CheckDomainUsedByHostedOrganization(int itemId, int domainId)
{
DomainInfo domain = ServerController.GetDomain(domainId);
if (domain == null)
return false;
return (DataProvider.CheckDomainUsedByHostedOrganization(domain.DomainName) == 1);
}
private static void DeleteOCSUsers(int itemId, ref bool successful)
{
try
@ -3080,5 +3089,10 @@ namespace WebsitePanel.EnterpriseServer
}
#endregion
public static DataSet GetOrganizationObjectsByDomain(int itemId, string domainName)
{
return DataProvider.GetOrganizationObjectsByDomain(itemId, domainName);
}
}
}

View file

@ -1505,6 +1505,13 @@ namespace WebsitePanel.EnterpriseServer
/// <returns>True if quota will exceed. Otherwise, false.</returns>
protected bool VerifyIfQuotaWillBeExceeded(int packageId, string quotaName, int numberOfItemsToAdd)
{
// Don't bother to check quota if the number of items to add is zero or less otherwise IsQuotasWillExceed
// will fail when quota is set to 0 on lists or groups and still thera are no items to import
if (numberOfItemsToAdd <= 0)
{
return false;
}
bool result = false;
QuotaValueInfo quotaInfo = PackageController.GetPackageQuota(packageId, quotaName);

View file

@ -200,11 +200,14 @@ namespace WebsitePanel.EnterpriseServer
//TaskManager.Write(String.Format("{0} - Invoke GetServiceItemsDiskSpace method ('{1}' items) - {2} attempt",
// DateTime.Now, objItems.Count, attempt));
ServiceProvider prov = new ServiceProvider();
ServiceProviderProxy.Init(prov, serviceId);
ServiceProviderItemDiskSpace[] itemsDiskSpace = prov.GetServiceItemsDiskSpace(objItems.ToArray());
if (itemsDiskSpace != null && itemsDiskSpace.Length > 0)
organizationDiskSpaces.AddRange(itemsDiskSpace);
if (objItems.Count > 0)
{
ServiceProvider prov = new ServiceProvider();
ServiceProviderProxy.Init(prov, serviceId);
ServiceProviderItemDiskSpace[] itemsDiskSpace = prov.GetServiceItemsDiskSpace(objItems.ToArray());
if (itemsDiskSpace != null && itemsDiskSpace.Length > 0)
organizationDiskSpaces.AddRange(itemsDiskSpace);
}
return organizationDiskSpaces.ToArray();
}

View file

@ -80,7 +80,7 @@ namespace WebsitePanel.EnterpriseServer
checkedDomains.Add(domain.DomainId);
ServerController.UpdateDomainRegistrationData(domain);
ServerController.UpdateDomainWhoisData(domain);
if (CheckDomainExpiration(domain.ExpirationDate, daysBeforeNotify))
{
@ -105,7 +105,7 @@ namespace WebsitePanel.EnterpriseServer
if (mainDomain != null)
{
ServerController.UpdateDomainRegistrationData(subDomain, mainDomain.CreationDate, mainDomain.ExpirationDate);
ServerController.UpdateDomainWhoisData(subDomain, mainDomain.CreationDate, mainDomain.ExpirationDate, mainDomain.RegistrarName);
var nonExistenDomain = nonExistenDomains.FirstOrDefault(x => subDomain.DomainId == x.DomainId);
@ -185,6 +185,7 @@ namespace WebsitePanel.EnterpriseServer
items["Domains"] = domains.Select(x => new { DomainName = x.DomainName,
ExpirationDate = x.ExpirationDate < DateTime.Now ? "Expired" : x.ExpirationDate.ToString(),
ExpirationDateOrdering = x.ExpirationDate,
Registrar = x.RegistrarName,
Customer = string.Format("{0} {1}", domainUsers[x.PackageId].FirstName, domainUsers[x.PackageId].LastName) })
.OrderBy(x => x.ExpirationDateOrdering).ThenBy(x => x.Customer).ThenBy(x => x.DomainName);

View file

@ -106,6 +106,8 @@ namespace WebsitePanel.EnterpriseServer
DomainDnsChanges domainChanges = new DomainDnsChanges();
domainChanges.DomainName = domain.DomainName;
domainChanges.PackageId = domain.PackageId;
domainChanges.Registrar = domain.RegistrarName;
domainChanges.ExpirationDate = domain.ExpirationDate;
var dbDnsRecords = ObjectUtils.CreateListFromDataReader<DnsRecordInfo>(DataProvider.GetDomainAllDnsRecords(domain.DomainId));

View file

@ -75,6 +75,12 @@ namespace WebsitePanel.EnterpriseServer
@"expires:(.+)" //.fi
};
private static List<string> _registrarNamePatterns = new List<string> {
@"Created by Registrar:(.+)",
@"Registrar:(.+)",
@"Registrant Name:(.+)"
};
private static List<string> _datePatterns = new List<string> { @"ddd MMM dd HH:mm:ss G\MT yyyy"
};
@ -1837,7 +1843,7 @@ namespace WebsitePanel.EnterpriseServer
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.VPSForPC, domain, "");
}
UpdateDomainRegistrationData(domain);
UpdateDomainWhoisData(domain);
}
// add instant alias
@ -2691,22 +2697,20 @@ namespace WebsitePanel.EnterpriseServer
}
}
public static DomainInfo UpdateDomainRegistrationData(DomainInfo domain)
public static DomainInfo UpdateDomainWhoisData(DomainInfo domain)
{
DateTime? createdDate = null;
DateTime? expiredDate = null;
try
{
var whoisResult = WhoisClient.Query(domain.DomainName.ToLowerInvariant());
createdDate = GetDomainInfoDate(whoisResult.Raw, _createdDatePatterns);
expiredDate = GetDomainInfoDate(whoisResult.Raw, _expiredDatePatterns);
string creationDateString = ParseWhoisDomainInfo(whoisResult.Raw, _createdDatePatterns);
string expirationDateString = ParseWhoisDomainInfo(whoisResult.Raw, _expiredDatePatterns);
domain.CreationDate = createdDate;
domain.ExpirationDate = expiredDate;
domain.CreationDate = ParseDate(creationDateString);
domain.ExpirationDate = ParseDate(expirationDateString);
domain.RegistrarName = ParseWhoisDomainInfo(whoisResult.Raw, _registrarNamePatterns);
DataProvider.UpdateDomainDates(domain.DomainId, createdDate, expiredDate, DateTime.Now);
DataProvider.UpdateWhoisDomainInfo(domain.DomainId, domain.CreationDate, domain.ExpirationDate, DateTime.Now, domain.RegistrarName);
}
catch (Exception e)
{
@ -2716,17 +2720,18 @@ namespace WebsitePanel.EnterpriseServer
return domain;
}
public static DomainInfo UpdateDomainRegistrationData(DomainInfo domain, DateTime? creationDate, DateTime? expirationDate)
public static DomainInfo UpdateDomainWhoisData(DomainInfo domain, DateTime? creationDate, DateTime? expirationDate, string registrarName)
{
DataProvider.UpdateDomainDates(domain.DomainId, creationDate, expirationDate, DateTime.Now);
DataProvider.UpdateWhoisDomainInfo(domain.DomainId, creationDate, expirationDate, DateTime.Now, registrarName);
domain.CreationDate = creationDate;
domain.ExpirationDate = expirationDate;
domain.RegistrarName = registrarName;
return domain;
}
private static DateTime? GetDomainInfoDate(string raw, IEnumerable<string> patterns)
private static string ParseWhoisDomainInfo(string raw, IEnumerable<string> patterns)
{
foreach (var createdRegex in patterns)
{
@ -2736,7 +2741,7 @@ namespace WebsitePanel.EnterpriseServer
{
if (match.Success && match.Groups.Count == 2)
{
return ParseDate(match.Groups[1].ToString().Trim());
return match.Groups[1].ToString().Trim();
}
}
}
@ -2746,6 +2751,11 @@ namespace WebsitePanel.EnterpriseServer
private static DateTime? ParseDate(string dateString)
{
if (string.IsNullOrEmpty(dateString))
{
return null;
}
var result = DateTime.MinValue;
foreach (var datePattern in _datePatterns)

View file

@ -158,6 +158,18 @@ namespace WebsitePanel.EnterpriseServer
return OrganizationController.SetOrganizationDefaultDomain(itemId, domainId);
}
[WebMethod]
public DataSet GetOrganizationObjectsByDomain(int itemId, string domainName)
{
return OrganizationController.GetOrganizationObjectsByDomain(itemId, domainName);
}
[WebMethod]
public bool CheckDomainUsedByHostedOrganization(int itemId, int domainId)
{
return OrganizationController.CheckDomainUsedByHostedOrganization(itemId, domainId);
}
#endregion
#region Users

View file

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

View file

@ -106,9 +106,6 @@ namespace WebsitePanel.Providers.DNS
public virtual void AddSecondaryZone( string zoneName, string[] masterServers )
{
ps.Add_DnsServerSecondaryZone( zoneName, masterServers );
// remove ns records
ps.Remove_DnsServerResourceRecords(zoneName, "NS");
}
public virtual void DeleteZone( string zoneName )

View file

@ -160,6 +160,8 @@ namespace WebsitePanel.Server
try
{
Log.WriteStart("'{0}' GetServiceItemsDiskSpace", ProviderSettings.ProviderName);
if (items.Length == 0) return new ServiceProviderItemDiskSpace[] {};
return Provider.GetServiceItemsDiskSpace(UnwrapServiceProviderItems(items));
}
catch (Exception ex)

View file

@ -64,6 +64,7 @@
<Control key="domains" />
<Control key="add_domain" general_key="domains" />
<Control key="domain_records" general_key="domains" />
<Control key="check_domain" general_key="domains" />
<Control key="storage_usage" />
<Control key="storage_usage_details" general_key="storage_usage" />

View file

@ -513,6 +513,7 @@
<Control key="org_domains" src="WebsitePanel/ExchangeServer/OrganizationDomainNames.ascx" title="OrganizationDomainNames" type="View" />
<Control key="org_add_domain" src="WebsitePanel/ExchangeServer/OrganizationAddDomainName.ascx" title="OrganizationAddDomainName" type="View" />
<Control key="add_domain" src="WebsitePanel/ExchangeServer/ExchangeAddDomainName.ascx" title="ExchangeAddDomainName" type="View" />
<Control key="check_domain" src="WebsitePanel/ExchangeServer/ExchangeCheckDomainName.ascx" title="ExchangeCheckDomainName" type="View" />
<Control key="domain_records" src="WebsitePanel/ExchangeServer/ExchangeDomainRecords.ascx" title="ExchangeDomainRecords" type="View" />
<Control key="storage_usage" src="WebsitePanel/ExchangeServer/ExchangeStorageUsage.ascx" title="ExchangeStorageUsage" type="View" />
<Control key="storage_usage_details" src="WebsitePanel/ExchangeServer/ExchangeStorageUsageBreakdown.ascx" title="ExchangeStorageUsageBreakdown" type="View" />

View file

@ -5620,8 +5620,10 @@
<data name="SchedulerTask.SCHEDULE_TASK_DOMAIN_EXPIRATION" xml:space="preserve">
<value>Check domain expiration date</value>
</data>
<data name="Error.REMOTE_DESKTOP_SERVICES_ADD_RDS_SERVER" xml:space="preserve">
<value>Unable to add RDS Server</value>
<data name="ERROR.IDNDOMAIN_NO_MAIL" xml:space="preserve">
<value>You cannot use a IDN domain name for mail</value>
</data>
<data name="ERROR.IDNDOMAIN_NO_ORGANIZATION" xml:space="preserve">
<value>You cannot use a IDN domain name for organizations</value>
</data>
</root>

View file

@ -216,4 +216,7 @@
<data name="DomainLookup.TooltipHeader" xml:space="preserve">
<value>Current Real DNS Values</value>
</data>
<data name="DomainLookup.TooltipHeader.Registrar" xml:space="preserve">
<value>Registrar:</value>
</data>
</root>

View file

@ -38,12 +38,16 @@
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="gvDomainsExpirationDate">
<ItemStyle Width="15%"></ItemStyle>
<ItemStyle Width="11%"></ItemStyle>
<ItemTemplate>
<%# GetDomainExpirationDate(Eval("ExpirationDate"), Eval("LastUpdateDate"))%>
<div style="display:inline-block" runat="server" Visible='<%# ShowDomainDnsInfo(Eval("ExpirationDate"), Eval("LastUpdateDate"), !(bool)Eval("IsSubDomain") && !(bool)Eval("IsInstantAlias") && !(bool)Eval("IsDomainPointer")) && !string.IsNullOrEmpty(GetDomainDnsRecords((int)Eval("DomainId"))) %>'>
<img style="border-width: 0px;" src="App_Themes/Default/Images/information_icon_small.gif" title="<%# GetDomainDnsRecords((int)Eval("DomainId")) %>">
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="">
<ItemStyle Width="5%"></ItemStyle>
<ItemTemplate>
<div style="display:inline-block" runat="server" Visible='<%# ShowDomainDnsInfo(Eval("ExpirationDate"), Eval("LastUpdateDate"), !(bool)Eval("IsSubDomain") && !(bool)Eval("IsInstantAlias") && !(bool)Eval("IsDomainPointer")) && !string.IsNullOrEmpty(GetDomainDnsRecords((int)Eval("DomainId"))) %>'>
<img style="border-width: 0px;" src="App_Themes/Default/Images/information_icon_small.gif" title="<%# GetDomainTooltip((int)Eval("DomainId"), Eval("RegistrarName") != DBNull.Value ? (string)Eval("RegistrarName"):string.Empty) %>">
</div>
</ItemTemplate>
</asp:TemplateField>

View file

@ -55,10 +55,10 @@ namespace WebsitePanel.Portal
// visibility
chkRecursive.Visible = (PanelSecurity.SelectedUser.Role != UserRole.User);
gvDomains.Columns[3].Visible = gvDomains.Columns[3].Visible =
gvDomains.Columns[4].Visible = gvDomains.Columns[5].Visible =
(PanelSecurity.SelectedUser.Role != UserRole.User) && chkRecursive.Checked;
gvDomains.Columns[5].Visible = (PanelSecurity.SelectedUser.Role == UserRole.Administrator);
gvDomains.Columns[6].Visible = (PanelSecurity.EffectiveUser.Role == UserRole.Administrator);
gvDomains.Columns[6].Visible = (PanelSecurity.SelectedUser.Role == UserRole.Administrator);
gvDomains.Columns[7].Visible = (PanelSecurity.EffectiveUser.Role == UserRole.Administrator);
if (!IsPostBack)
{
@ -185,6 +185,22 @@ namespace WebsitePanel.Portal
return dnsRecords[domainId];
}
public string GetDomainTooltip(int domainId, string registrar)
{
var dnsString = GetDomainDnsRecords(domainId);
var tooltipLines = new List<string>();
if (!string.IsNullOrEmpty(registrar))
{
var header = GetLocalizedString("DomainLookup.TooltipHeader.Registrar");
tooltipLines.Add(header + " " + registrar);
tooltipLines.Add("\r\n");
}
return string.Join("\r\n", tooltipLines) + dnsString;
}
protected void odsDomainsPaged_Selected(object sender, ObjectDataSourceStatusEventArgs e)
{
if (e.Exception != null)

View file

@ -10,12 +10,8 @@
<div class="FormBody">
<p id="DomainPanel" runat="server" style="padding: 15px 0 15px 5px;">
<wsp:DomainControl ID="DomainName" runat="server" RequiredEnabled="True" ValidationGroup="Domain" AutoPostBack="True" OnTextChanged="DomainName_TextChanged"></wsp:DomainControl>
<wsp:DomainControl ID="DomainName" runat="server" RequiredEnabled="True" ValidationGroup="Domain" OnTextChanged="DomainName_TextChanged"></wsp:DomainControl>
</p>
<%--
<p id="SubDomainPanel" runat="server" style="padding: 15px 0 15px 5px;" visible="false">
<wsp:DomainControl ID="SubDomainName" runat="server" RequiredEnabled="True" IsSubDomain="True" ValidationGroup="Domain"></wsp:DomainControl>
</p>--%>
<wsp:CollapsiblePanel id="OptionsPanelHeader" runat="server"
TargetControlID="OptionsPanel" resourcekey="OptionsPanelHeader" Text="Provisioning options">

View file

@ -157,6 +157,8 @@ namespace WebsitePanel.Portal
// allow sub-domains
AllowSubDomainsPanel.Visible = (type == DomainType.Domain) && PanelSecurity.EffectiveUser.Role != UserRole.User;
CheckForCorrectIdnDomainUsage(DomainName.Text);
}
private DomainType GetDomainType(string typeName)
@ -260,15 +262,27 @@ namespace WebsitePanel.Portal
}
protected void btnAdd_Click(object sender, EventArgs e)
{
AddDomain();
if (CheckForCorrectIdnDomainUsage(DomainName.Text))
{
AddDomain();
}
}
private bool CheckForCorrectIdnDomainUsage(string domainName)
{
// If the choosen domain is a idn domain, don't allow to create mail
if (Utils.IsIdnDomain(domainName) && PointMailDomain.Checked)
{
ShowErrorMessage("IDNDOMAIN_NO_MAIL");
return false;
}
return true;
}
protected void DomainName_TextChanged(object sender, DomainControl.DomainNameEventArgs e)
{
// If the choosen domain is a idn domain, don't allow to create mail
var isIdn = Utils.IsIdnDomain(e.DomainName);
PointMailDomainPanel.Enabled = !isIdn;
PointMailDomain.Checked = !isIdn;
CheckForCorrectIdnDomainUsage(e.DomainName);
}
}
}

View file

@ -0,0 +1,183 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="locTitle.Text" xml:space="preserve">
<value>Domain Dependencies</value>
</data>
<data name="Text.PageName" xml:space="preserve">
<value>Domain Dependencies</value>
</data>
<data name="gvObjectsDisplayName.Header" xml:space="preserve">
<value>Display Name</value>
</data>
<data name="TopComments.Text" xml:space="preserve">
<value>Objects listed Below are dependent on this domain and must be removed prior to domain</value>
</data>
<data name="Contact.Text" xml:space="preserve">
<value>Contact</value>
</data>
<data name="DefaultSecurityGroup.Text" xml:space="preserve">
<value>Security group</value>
</data>
<data name="DistributionList.Text" xml:space="preserve">
<value>Distribution list</value>
</data>
<data name="Equipment.Text" xml:space="preserve">
<value>Equipment</value>
</data>
<data name="ExchangeAccountEmailAddresses.Text" xml:space="preserve">
<value>Email address</value>
</data>
<data name="gvObjectsDelete.Header" xml:space="preserve">
<value>Delete</value>
</data>
<data name="gvObjectsObjectType.Header" xml:space="preserve">
<value>Object Type</value>
</data>
<data name="gvObjectsView.Header" xml:space="preserve">
<value>View</value>
</data>
<data name="lnkDelete.Text" xml:space="preserve">
<value>Delete</value>
</data>
<data name="lnkView.Text" xml:space="preserve">
<value>View</value>
</data>
<data name="Mailbox.Text" xml:space="preserve">
<value>Mailbox</value>
</data>
<data name="PublicFolder.Text" xml:space="preserve">
<value>Public folder</value>
</data>
<data name="Room.Text" xml:space="preserve">
<value>Room</value>
</data>
<data name="SecurityGroup.Text" xml:space="preserve">
<value>Security group</value>
</data>
<data name="SharedMailbox.Text" xml:space="preserve">
<value>Shared mailbox</value>
</data>
<data name="User.Text" xml:space="preserve">
<value>Organization user</value>
</data>
<data name="LyncUsers.Text" xml:space="preserve">
<value>Lync User</value>
</data>
</root>

View file

@ -0,0 +1,81 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ExchangeCheckDomainName.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.ExchangeCheckDomainName" %>
<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %>
<%@ Register Src="../UserControls/QuotaViewer.ascx" TagName="QuotaViewer" TagPrefix="wsp" %>
<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %>
<wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server"/>
<div id="ExchangeContainer">
<div class="Module">
<div class="Left">
</div>
<div class="Content">
<div class="Center">
<div class="Title">
<asp:Image ID="Image1" SkinID="ExchangeDomainName48" runat="server" />
<asp:Localize ID="locTitle" runat="server" meta:resourcekey="locTitle" Text="Domain Names"></asp:Localize>
-
<asp:Literal ID="litDomainName" runat="server"></asp:Literal>
</div>
<asp:Literal ID="TopComments" runat="server" meta:resourcekey="TopComments"></asp:Literal>
<div class="FormBody">
<wsp:SimpleMessageBox id="messageBox" runat="server" />
<br />
<asp:GridView ID="gvObjects" runat="server" AutoGenerateColumns="False" EnableViewState="true"
Width="100%" CssSelectorClass="NormalGridView" OnRowCommand="gvObjects_RowCommand">
<Columns>
<asp:TemplateField HeaderText="gvObjectsDisplayName">
<ItemStyle Width="40%"></ItemStyle>
<ItemTemplate>
<asp:Image ID="img1" runat="server" ImageUrl='<%# GetObjectImage(Eval("ObjectName").ToString(),(int)Eval("ObjectType")) %>' ImageAlign="AbsMiddle" />
<asp:hyperlink id="lnk1" runat="server"
NavigateUrl='<%# GetEditUrl(Eval("ObjectName").ToString(),(int)Eval("ObjectType"),Eval("ObjectID").ToString(),Eval("OwnerID").ToString()) %>'>
<%# Eval("DisplayName") %>
</asp:hyperlink>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="gvObjectsObjectType">
<ItemStyle Width="40%"></ItemStyle>
<ItemTemplate>
<%# GetObjectType(Eval("ObjectName").ToString(),(int)Eval("ObjectType")) %>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="gvObjectsView">
<ItemStyle Width="10%"></ItemStyle>
<ItemTemplate>
<asp:hyperlink id="lnk2" runat="server"
NavigateUrl='<%# GetEditUrl(Eval("ObjectName").ToString(),(int)Eval("ObjectType"),Eval("ObjectID").ToString(),Eval("OwnerID").ToString()) %>'>
<asp:Literal id="lnkView" runat="server" Text="View" meta:resourcekey="lnkView" />
</asp:hyperlink>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="gvObjectsDelete">
<ItemStyle Width="10%"></ItemStyle>
<ItemTemplate>
<asp:LinkButton id="lnkDelete" runat="server" Text="Delete" meta:resourcekey="lnkDelete"
OnClientClick="if(!confirm('Are you sure you want to delete ?')) return false; else ShowProgressDialog('Deleting ...');"
CommandName="DeleteItem" CommandArgument='<%# Eval("OwnerID").ToString() + "," + Eval("ObjectType").ToString() + "," + Eval("DisplayName") %>'
Visible='<%# AllowDelete(Eval("ObjectName").ToString(), (int)Eval("ObjectType")) %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<br />
<asp:Button id="btnBack" runat="server" Text="Back" CssClass="Button1" meta:resourcekey="btnBack"
OnClick="btnBack_Click" ></asp:Button>
</div>
</div>
</div>
</div>
</div>

View file

@ -0,0 +1,282 @@
// Copyright (c) 2014, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Web.UI.WebControls;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.Providers.HostedSolution;
namespace WebsitePanel.Portal.ExchangeServer
{
public partial class ExchangeCheckDomainName : WebsitePanelModuleBase
{
private static string EXCHANGEACCOUNTEMAILADDRESSES = "ExchangeAccountEmailAddresses";
private static string EXCHANGEACCOUNTS = "ExchangeAccounts";
private static string LYNCUSERS = "LyncUsers";
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
// save return URL
if (Request.UrlReferrer!=null)
ViewState["ReturnUrl"] = Request.UrlReferrer.ToString();
// domain name
DomainInfo domain = ES.Services.Servers.GetDomain(PanelRequest.DomainID);
litDomainName.Text = domain.DomainName;
Bind();
}
}
public string GetObjectType(string objectName, int objectType)
{
if (objectName == EXCHANGEACCOUNTS)
{
ExchangeAccountType accountType = (ExchangeAccountType)objectType;
objectName = accountType.ToString();
}
string res = GetLocalizedString(objectName+".Text");
if (string.IsNullOrEmpty(res))
res = objectName;
return res;
}
public bool AllowDelete(string objectName, int objectType)
{
if (objectName == EXCHANGEACCOUNTEMAILADDRESSES)
{
ExchangeAccountType accountType = (ExchangeAccountType)objectType;
switch (accountType)
{
case ExchangeAccountType.Room:
case ExchangeAccountType.Equipment:
case ExchangeAccountType.SharedMailbox:
case ExchangeAccountType.Mailbox:
case ExchangeAccountType.DistributionList:
case ExchangeAccountType.PublicFolder:
return true;
}
}
return false;
}
public string GetObjectImage(string objectName, int objectType)
{
string imgName = "blank16.gif";
if (objectName == EXCHANGEACCOUNTS)
{
ExchangeAccountType accountType = (ExchangeAccountType)objectType;
imgName = "mailbox_16.gif";
switch(accountType)
{
case ExchangeAccountType.Contact:
imgName = "contact_16.gif";
break;
case ExchangeAccountType.DistributionList:
imgName = "dlist_16.gif";
break;
case ExchangeAccountType.Room:
imgName = "room_16.gif";
break;
case ExchangeAccountType.Equipment:
imgName = "equipment_16.gif";
break;
case ExchangeAccountType.SharedMailbox:
imgName = "shared_16.gif";
break;
}
}
else if (objectName == EXCHANGEACCOUNTEMAILADDRESSES)
{
imgName = "mailbox_16.gif";
}
return GetThemedImage("Exchange/" + imgName);
}
public string GetEditUrl(string objectName, int objectType, string objectId, string ownerId)
{
if (objectName == EXCHANGEACCOUNTS)
{
string key = "";
ExchangeAccountType accountType = (ExchangeAccountType)objectType;
switch (accountType)
{
case ExchangeAccountType.User:
key = "edit_user";
return EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), key,
"AccountID=" + objectId,
"ItemID=" + PanelRequest.ItemID, "context=user");
case ExchangeAccountType.Mailbox:
case ExchangeAccountType.Room:
case ExchangeAccountType.Equipment:
case ExchangeAccountType.SharedMailbox:
key = "mailbox_settings";
break;
case ExchangeAccountType.DistributionList:
key = "dlist_settings";
break;
case ExchangeAccountType.PublicFolder:
key = "public_folder_settings";
break;
case ExchangeAccountType.SecurityGroup:
case ExchangeAccountType.DefaultSecurityGroup:
key = "secur_group_settings";
break;
}
if (!string.IsNullOrEmpty(key))
{
return EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), key,
"AccountID=" + objectId,
"ItemID=" + PanelRequest.ItemID);
}
}
if (objectName == EXCHANGEACCOUNTEMAILADDRESSES)
{
string key = "";
ExchangeAccountType accountType = (ExchangeAccountType)objectType;
switch (accountType)
{
case ExchangeAccountType.Mailbox:
case ExchangeAccountType.Room:
case ExchangeAccountType.Equipment:
case ExchangeAccountType.SharedMailbox:
key = "mailbox_addresses";
break;
case ExchangeAccountType.DistributionList:
key = "dlist_addresses";
break;
case ExchangeAccountType.PublicFolder:
key = "public_folder_addresses";
break;
}
if (!string.IsNullOrEmpty(key))
{
return EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), key,
"AccountID=" + ownerId,
"ItemID=" + PanelRequest.ItemID);
}
}
if (objectName == LYNCUSERS)
{
return EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "edit_lync_user",
"AccountID=" + objectId,
"ItemID=" + PanelRequest.ItemID);
}
return "";
}
private void Bind()
{
DomainInfo domain = ES.Services.Servers.GetDomain(PanelRequest.DomainID);
gvObjects.DataSource =
ES.Services.Organizations.GetOrganizationObjectsByDomain(PanelRequest.ItemID, domain.DomainName);
gvObjects.DataBind();
}
protected void btnBack_Click(object sender, EventArgs e)
{
if (ViewState["ReturnUrl"] != null)
Response.Redirect((string)ViewState["ReturnUrl"]);
}
protected void gvObjects_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "DeleteItem")
{
try
{
string[] arg = e.CommandArgument.ToString().Split(',');
if (arg.Length != 3) return;
string[] emails = { arg[2] };
int accountID = 0;
if (!int.TryParse(arg[0], out accountID))
return;
int accountTypeID = 0;
if (!int.TryParse(arg[1], out accountTypeID))
return;
ExchangeAccountType accountType = (ExchangeAccountType)accountTypeID;
int result;
switch(accountType)
{
case ExchangeAccountType.Room:
case ExchangeAccountType.Equipment:
case ExchangeAccountType.SharedMailbox:
case ExchangeAccountType.Mailbox:
result = ES.Services.ExchangeServer.DeleteMailboxEmailAddresses(
PanelRequest.ItemID, accountID, emails);
break;
case ExchangeAccountType.DistributionList:
result = ES.Services.ExchangeServer.DeleteDistributionListEmailAddresses(
PanelRequest.ItemID, accountID, emails);
break;
case ExchangeAccountType.PublicFolder:
result = ES.Services.ExchangeServer.DeletePublicFolderEmailAddresses(
PanelRequest.ItemID, accountID, emails);
break;
}
Bind();
}
catch (Exception ex)
{
}
}
}
}
}

View file

@ -0,0 +1,87 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.Portal.ExchangeServer {
public partial class ExchangeCheckDomainName {
/// <summary>
/// asyncTasks control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks;
/// <summary>
/// Image1 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.Image Image1;
/// <summary>
/// locTitle 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.Localize locTitle;
/// <summary>
/// litDomainName 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.Literal litDomainName;
/// <summary>
/// TopComments 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.Literal TopComments;
/// <summary>
/// messageBox control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox;
/// <summary>
/// gvObjects 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 gvObjects;
/// <summary>
/// btnBack 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 btnBack;
}
}

View file

@ -59,8 +59,12 @@
<asp:TemplateField>
<ItemTemplate>
&nbsp;<asp:ImageButton ID="imgDelDomain" runat="server" Text="Delete" SkinID="ExchangeDelete"
CommandName="DeleteItem" CommandArgument='<%# Eval("DomainId") %>' Visible='<%# !((bool)Eval("IsDefault")) %>'
meta:resourcekey="cmdDelete" OnClientClick="return confirm('Are you sure you want to delete selected domain?')"></asp:ImageButton>
CommandName="DeleteItem" CommandArgument='<%# Eval("DomainId") %>' Visible='<%# ((!(bool)Eval("IsDefault"))) && (!CheckDomainUsedByHostedOrganization(Eval("DomainID").ToString())) %>'
meta:resourcekey="cmdDelete" OnClientClick="return confirm('Are you sure you want to delete selected domain?')"
/>
&nbsp;<asp:LinkButton ID="lnkViewUsage" runat="server" Text="View Usage" Visible='<%# CheckDomainUsedByHostedOrganization(Eval("DomainID").ToString()) %>'
CommandName="ViewUsage" CommandArgument='<%# Eval("DomainId") %>'
/>
</ItemTemplate>
</asp:TemplateField>
</Columns>

View file

@ -65,6 +65,14 @@ namespace WebsitePanel.Portal.ExchangeServer
"ItemID=" + PanelRequest.ItemID);
}
public bool CheckDomainUsedByHostedOrganization(string domainId)
{
int id;
if (!int.TryParse(domainId, out id)) return false;
return ES.Services.Organizations.CheckDomainUsedByHostedOrganization(PanelRequest.ItemID, id);
}
private void BindDomainNames()
{
OrganizationDomainName[] list = ES.Services.Organizations.GetOrganizationDomains(PanelRequest.ItemID);
@ -103,7 +111,9 @@ namespace WebsitePanel.Portal.ExchangeServer
int result = ES.Services.Organizations.DeleteOrganizationDomain(PanelRequest.ItemID, domainId);
if (result < 0)
{
messageBox.ShowErrorMessage("EXCHANGE_UNABLE_TO_DELETE_DOMAIN");
Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "check_domain",
"SpaceID=" + PanelSecurity.PackageId, "DomainID=" + domainId));
return;
}
// rebind domains
@ -147,6 +157,14 @@ namespace WebsitePanel.Portal.ExchangeServer
ShowErrorMessage("EXCHANGE_CHANGE_DOMAIN", ex);
}
}
if (e.CommandName == "ViewUsage")
{
int domainId = Utils.ParseInt(e.CommandArgument.ToString(), 0);
Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "check_domain",
"SpaceID=" + PanelSecurity.PackageId, "DomainID=" + domainId));
return;
}
}
protected void btnSetDefaultDomain_Click(object sender, EventArgs e)

View file

@ -103,7 +103,9 @@ namespace WebsitePanel.Portal.ExchangeServer
int result = ES.Services.Organizations.DeleteOrganizationDomain(PanelRequest.ItemID, domainId);
if (result < 0)
{
messageBox.ShowErrorMessage("EXCHANGE_UNABLE_TO_DELETE_DOMAIN");
Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "check_domain",
"SpaceID=" + PanelSecurity.PackageId, "DomainID=" + domainId));
return;
}
// rebind domains

View file

@ -73,7 +73,7 @@
<asp:Localize ID="locDomainName" runat="server" meta:resourcekey="locDomainName" Text="Domain name:"></asp:Localize>
</td>
<td class="Normal" width="100%">
<wsp:DomainControl ID="txtDomainName" runat="server" RequiredEnabled="True" ValidationGroup="CreateSpace" AutoPostBack="True" OnTextChanged="txtDomainName_OnTextChanged"></wsp:DomainControl>
<wsp:DomainControl ID="txtDomainName" runat="server" RequiredEnabled="True" ValidationGroup="CreateSpace" OnTextChanged="txtDomainName_OnTextChanged"></wsp:DomainControl>
</td>
</tr>
</table>

View file

@ -250,7 +250,10 @@ namespace WebsitePanel.Portal
protected void btnCreate_Click(object sender, EventArgs e)
{
CreateHostingSpace();
if (CheckForCorrectIdnDomainUsage())
{
CreateHostingSpace();
}
}
protected void rbFtpAccountName_SelectedIndexChanged(object sender, EventArgs e)
@ -268,19 +271,29 @@ namespace WebsitePanel.Portal
BindHostingPlan();
}
protected void txtDomainName_OnTextChanged(object sender, DomainControl.DomainNameEventArgs e)
private bool CheckForCorrectIdnDomainUsage()
{
if (Utils.IsIdnDomain(txtDomainName.Text))
{
fsMail.Disabled = true;
chkIntegratedOUProvisioning.Checked = false;
chkIntegratedOUProvisioning.Enabled = false;
}
else
{
fsMail.Disabled = false;
BindHostingPlan();
if (chkIntegratedOUProvisioning.Checked)
{
ShowErrorMessage("IDNDOMAIN_NO_ORGANIZATION");
return false;
}
if (chkCreateMailAccount.Checked)
{
ShowErrorMessage("IDNDOMAIN_NO_MAIL");
return false;
}
}
return true;
}
protected void txtDomainName_OnTextChanged(object sender, DomainControl.DomainNameEventArgs e)
{
CheckForCorrectIdnDomainUsage();
}
}
}

View file

@ -211,6 +211,13 @@
<Compile Include="Code\ReportingServices\IResourceStorage.cs" />
<Compile Include="Code\ReportingServices\ReportingServicesUtils.cs" />
<Compile Include="Code\UserControls\Tab.cs" />
<Compile Include="ExchangeServer\ExchangeCheckDomainName.ascx.cs">
<DependentUpon>ExchangeCheckDomainName.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="ExchangeServer\ExchangeCheckDomainName.ascx.designer.cs">
<DependentUpon>ExchangeCheckDomainName.ascx</DependentUpon>
</Compile>
<Compile Include="ProviderControls\Windows2012_Settings.ascx.cs">
<DependentUpon>Windows2012_Settings.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@ -4291,6 +4298,7 @@
</ItemGroup>
<ItemGroup>
<Content Include="ApplyEnableHardQuotaFeature.ascx" />
<Content Include="ExchangeServer\ExchangeCheckDomainName.ascx" />
<Content Include="ProviderControls\Windows2012_Settings.ascx" />
<Content Include="RDSServersAddserver.ascx" />
<Content Include="RDSServers.ascx" />
@ -4315,6 +4323,9 @@
<Content Include="RDS\App_LocalResources\RDSEditApplicationUsers.ascx.resx">
<SubType>Designer</SubType>
</Content>
<Content Include="ExchangeServer\App_LocalResources\ExchangeCheckDomainName.ascx.resx">
<SubType>Designer</SubType>
</Content>
<EmbeddedResource Include="ScheduleTaskControls\App_LocalResources\DomainLookupView.ascx.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>DomainLookupView.ascx.Designer.cs</LastGenOutput>