This commit is contained in:
dev_amdtel 2015-01-05 23:40:06 +03:00
commit c5f9f76d51
30 changed files with 566 additions and 129 deletions

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

@ -4839,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

@ -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

@ -284,6 +284,7 @@ namespace WebsitePanel.EnterpriseServer
catch (Exception ex)
{
result.AddError("REMOTE_DESKTOP_SERVICES_ADD_RDS_COLLECTION", ex);
throw TaskManager.WriteError(ex);
}
finally
{
@ -599,19 +600,26 @@ namespace WebsitePanel.EnterpriseServer
try
{
if (1 == 1)//(CheckRDSServerAvaliable(rdsServer.FqdName))
if (CheckRDSServerAvaliable(rdsServer.FqdName))
{
rdsServer.Id = DataProvider.AddRDSServer(rdsServer.Name, rdsServer.FqdName, rdsServer.Description);
}
else
{
result.AddError("", new Exception("The server that you are adding, is not available"));
result.AddError("REMOTE_DESKTOP_SERVICES_ADD_RDS_SERVER", new Exception("The server that you are adding, is not available"));
return result;
}
}
catch (Exception ex)
{
result.AddError("REMOTE_DESKTOP_SERVICES_ADD_RDS_SERVER", ex);
if (ex.InnerException != null)
{
result.AddError("Unable to add RDS Server", ex.InnerException);
}
else
{
result.AddError("Unable to add RDS Server", ex);
}
}
finally
{
@ -1167,18 +1175,12 @@ namespace WebsitePanel.EnterpriseServer
private static bool CheckRDSServerAvaliable(string hostname)
{
bool result = false;
var ping = new Ping();
var reply = ping.Send(hostname, 1000);
try
if (reply.Status == IPStatus.Success)
{
var ping = new Ping();
var reply = ping.Send(hostname, 1000); // 1 second time out (in ms)
if (reply.Status == IPStatus.Success)
result = true;
}
catch (Exception)
{
result = false;
result = true;
}
return result;

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);
@ -183,9 +183,11 @@ namespace WebsitePanel.EnterpriseServer
items["user"] = user;
items["Domains"] = domains.Select(x => new { DomainName = x.DomainName,
ExpirationDate = x.ExpirationDate,
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.ExpirationDate).ThenBy(x => x.Customer).ThenBy(x => x.DomainName);
.OrderBy(x => x.ExpirationDateOrdering).ThenBy(x => x.Customer).ThenBy(x => x.DomainName);
items["IncludeNonExistenDomains"] = includeNonExistenDomains;

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

@ -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

@ -63,5 +63,6 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
bool CheckServerAvailability(string hostName);
string[] GetApplicationUsers(string collectionName, string applicationName);
bool SetApplicationUsers(string collectionName, RemoteApplication remoteApp, string[] users);
bool CheckRDSServerAvaliable(string hostname);
}
}

View file

@ -377,11 +377,9 @@ namespace WebsitePanel.Providers.FTP
{
CanRead = permission.Read,
CanWrite = permission.Write,
CreatedDate = user.CreatedDate,
Enabled = !user.AccountDisabled,
Folder = path,
GroupName = user.GroupName,
Name = user.Name
Name = accountName
};
return account;

View file

@ -165,6 +165,20 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
return new string[]{};
}
public bool CheckRDSServerAvaliable(string hostname)
{
bool result = false;
var ping = new Ping();
var reply = ping.Send(hostname, 1000);
if (reply.Status == IPStatus.Success)
{
result = true;
}
return result;
}
#endregion
#region RDS Collections
@ -199,26 +213,26 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
}
public bool CreateCollection(string organizationId, RdsCollection collection)
{
{
var result = true;
Runspace runSpace = null;
try
{
runSpace = OpenRunspace();
{
runSpace = OpenRunspace();
foreach (var server in collection.Servers)
{
//If server will restart it will not be added to collection
//Do not install feature here
//Do not install feature here
if (!ExistRdsServerInDeployment(runSpace, server))
{
AddRdsServerToDeployment(runSpace, server);
{
AddRdsServerToDeployment(runSpace, server);
}
}
Command cmd = new Command("New-RDSessionCollection");
cmd.Parameters.Add("CollectionName", collection.Name);
cmd.Parameters.Add("SessionHost", collection.Servers.Select(x => x.FqdName).ToArray());
@ -229,7 +243,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
cmd.Parameters.Add("CollectionDescription", collection.Description);
}
var collectionPs = ExecuteShellCommand(runSpace, cmd, false).FirstOrDefault();
var collectionPs = ExecuteShellCommand(runSpace, cmd, false).FirstOrDefault();
if (collectionPs == null)
{
@ -279,11 +293,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
{
AddComputerToCollectionAdComputerGroup(organizationId, collection.Name, rdsServer);
}
}
catch (Exception e)
{
result = false;
}
}
finally
{
CloseRunspace(runSpace);
@ -695,15 +705,22 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
var showCmd = new Command("netsh nps show np");
var showResult = ExecuteRemoteShellCommand(runSpace, centralNpshost, showCmd);
var processingOrders = showResult.Where(x => Convert.ToString(x).ToLower().Contains("processing order")).Select(x => Convert.ToString(x));
var count = 0;
var count = showResult.Count(x => Convert.ToString(x).Contains("policy conf")) + 1001;
foreach(var processingOrder in processingOrders)
{
var order = Convert.ToInt32(processingOrder.Remove(0, processingOrder.LastIndexOf("=") + 1).Replace(" ", ""));
if (order > count)
{
count = order;
}
}
var userGroupAd = ActiveDirectoryUtils.GetADObject(GetUsersGroupPath(organizationId, collectionName));
var userGroupSid = (byte[])ActiveDirectoryUtils.GetADObjectProperty(userGroupAd, "objectSid");
var addCmdString = string.Format(AddNpsString, policyName.Replace(" ", "_"), count, ConvertByteToStringSid(userGroupSid));
var addCmdString = string.Format(AddNpsString, policyName.Replace(" ", "_"), count + 1, ConvertByteToStringSid(userGroupSid));
Command addCmd = new Command(addCmdString);
var result = ExecuteRemoteShellCommand(runSpace, centralNpshost, addCmd);
@ -920,7 +937,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
runSpace = OpenRunspace();
var feature = AddFeature(runSpace, hostName, "RDS-RD-Server", true, true);
installationResult = (bool)GetPSObjectProperty(feature, "Success");
}
}
finally
{
CloseRunspace(runSpace);
@ -1411,10 +1428,10 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
if (pipeLine.Error != null && pipeLine.Error.Count > 0)
{
foreach (object item in pipeLine.Error.ReadToEnd())
{
{
errorList.Add(item);
string errorMessage = string.Format("Invoke error: {0}", item);
Log.WriteWarning(errorMessage);
Log.WriteWarning(errorMessage);
}
}
}

View file

@ -69,6 +69,8 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
private System.Threading.SendOrPostCallback SetApplicationUsersOperationCompleted;
private System.Threading.SendOrPostCallback CheckRDSServerAvaliableOperationCompleted;
/// <remarks/>
public RemoteDesktopServices() {
this.Url = "http://localhost:9003/RemoteDesktopServices.asmx";
@ -134,6 +136,9 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
/// <remarks/>
public event SetApplicationUsersCompletedEventHandler SetApplicationUsersCompleted;
/// <remarks/>
public event CheckRDSServerAvaliableCompletedEventHandler CheckRDSServerAvaliableCompleted;
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/CreateCollection", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
@ -1021,6 +1026,48 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/CheckRDSServerAvaliable", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public bool CheckRDSServerAvaliable(string hostname) {
object[] results = this.Invoke("CheckRDSServerAvaliable", new object[] {
hostname});
return ((bool)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginCheckRDSServerAvaliable(string hostname, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("CheckRDSServerAvaliable", new object[] {
hostname}, callback, asyncState);
}
/// <remarks/>
public bool EndCheckRDSServerAvaliable(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((bool)(results[0]));
}
/// <remarks/>
public void CheckRDSServerAvaliableAsync(string hostname) {
this.CheckRDSServerAvaliableAsync(hostname, null);
}
/// <remarks/>
public void CheckRDSServerAvaliableAsync(string hostname, object userState) {
if ((this.CheckRDSServerAvaliableOperationCompleted == null)) {
this.CheckRDSServerAvaliableOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCheckRDSServerAvaliableOperationCompleted);
}
this.InvokeAsync("CheckRDSServerAvaliable", new object[] {
hostname}, this.CheckRDSServerAvaliableOperationCompleted, userState);
}
private void OnCheckRDSServerAvaliableOperationCompleted(object arg) {
if ((this.CheckRDSServerAvaliableCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.CheckRDSServerAvaliableCompleted(this, new CheckRDSServerAvaliableCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
public new void CancelAsync(object userState) {
base.CancelAsync(userState);
@ -1436,4 +1483,30 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void CheckRDSServerAvaliableCompletedEventHandler(object sender, CheckRDSServerAvaliableCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class CheckRDSServerAvaliableCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal CheckRDSServerAvaliableCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public bool Result {
get {
this.RaiseExceptionIfNecessary();
return ((bool)(this.results[0]));
}
}
}
}

View file

@ -503,8 +503,8 @@ namespace WebsitePanel.Providers.Utils
// fill user
SystemUser user = new SystemUser();
user.Name = GetObjectProperty(objUser, "cn").ToString();
user.FullName = GetObjectProperty(objUser, "givenName").ToString() + " " +
GetObjectProperty(objUser, "sn").ToString();
user.FullName = (GetObjectProperty(objUser, "givenName").ToString() + " " +
GetObjectProperty(objUser, "sn").ToString()).Trim();
user.Description = GetObjectProperty(objUser, "description").ToString();
ADAccountOptions userFlags = (ADAccountOptions)objUser.Properties["userAccountControl"].Value;

View file

@ -393,5 +393,22 @@ namespace WebsitePanel.Server
throw;
}
}
[WebMethod, SoapHeader("settings")]
public bool CheckRDSServerAvaliable(string hostname)
{
try
{
Log.WriteStart("'{0}' CheckRDSServerAvaliable", ProviderSettings.ProviderName);
var result = RDSProvider.CheckRDSServerAvaliable(hostname);
Log.WriteEnd("'{0}' CheckRDSServerAvaliable", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' CheckRDSServerAvaliable", ProviderSettings.ProviderName), ex);
throw;
}
}
}
}

View file

@ -5620,5 +5620,10 @@
<data name="SchedulerTask.SCHEDULE_TASK_DOMAIN_EXPIRATION" xml:space="preserve">
<value>Check domain expiration date</value>
</data>
<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")) %>'>
<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

@ -45,16 +45,20 @@ namespace WebsitePanel.Portal
{
public partial class Domains : WebsitePanelModuleBase
{
public Dictionary<int, string> dnsRecords;
protected void Page_Load(object sender, EventArgs e)
{
dnsRecords = new Dictionary<int, string>();
gvDomains.PageSize = UsersHelper.GetDisplayItemsPerPage();
// 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)
{
@ -154,11 +158,18 @@ namespace WebsitePanel.Portal
public string GetDomainDnsRecords(int domainId)
{
if(dnsRecords.ContainsKey(domainId))
{
return dnsRecords[domainId];
}
var records = ES.Services.Servers.GetDomainDnsRecords(domainId);
if (!records.Any())
{
return "No Dns Records";
dnsRecords.Add(domainId, string.Empty);
return string.Empty;
}
var header = GetLocalizedString("DomainLookup.TooltipHeader");
@ -169,7 +180,25 @@ namespace WebsitePanel.Portal
tooltipLines.Add(" ");
tooltipLines.AddRange( records.Select(x=>string.Format("{0}: {1}", x.RecordType, x.Value)));
return string.Join("\r\n", tooltipLines);
dnsRecords.Add(domainId, string.Join("\r\n", tooltipLines));
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)

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

@ -28,7 +28,7 @@
</table>
<div class="FormFooterClean">
<asp:Button id="btnAdd" runat="server" Text="Add" CssClass="Button1" meta:resourcekey="btnAdd" ValidationGroup="AddRDSServer" OnClick="btnAdd_Click"></asp:Button>
<asp:Button id="btnAdd" runat="server" Text="Add" CssClass="Button1" meta:resourcekey="btnAdd" ValidationGroup="AddRDSServer" OnClick="btnAdd_Click" OnClientClick="ShowProgressDialog('Adding server...');"></asp:Button>
<asp:ValidationSummary ID="valSummary" runat="server" ShowMessageBox="True" ShowSummary="False" ValidationGroup="AddRDSServer" />
</div>
</div>

View file

@ -67,8 +67,7 @@
<ItemTemplate>
<asp:LinkButton ID="imgRemove1" runat="server" Text="Remove" Visible='<%# Eval("RdsCollectionId") == null %>'
CommandName="DeleteItem" CommandArgument='<%# Eval("Id") %>'
meta:resourcekey="cmdDelete" OnClientClick="return confirm('Are you sure you want to remove selected server?')"></asp:LinkButton>
<asp:Label ID="lbRemove" Text="Remove" runat="server" Visible='<%# Eval("RdsCollectionId") != null %>'></asp:Label>
meta:resourcekey="cmdDelete" OnClientClick="return confirm('Are you sure you want to remove selected server?')"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>

View file

@ -37,7 +37,7 @@
</fieldset>
<div class="FormFooter">
<asp:Button id="btnSave" runat="server" Text="Save" CssClass="Button1" meta:resourcekey="btnSave" OnClick="btnSave_Click" ValidationGroup="SaveRDSCollection"></asp:Button>
<asp:Button id="btnSave" runat="server" Text="Save" CssClass="Button1" meta:resourcekey="btnSave" OnClick="btnSave_Click" OnClientClick="ShowProgressDialog('Adding collection...');" ValidationGroup="SaveRDSCollection"></asp:Button>
</div>
</div>
</div>

View file

@ -41,6 +41,8 @@ namespace WebsitePanel.Portal.RDS
protected void Page_Load(object sender, EventArgs e)
{
remoreApps.Module = Module;
if (!IsPostBack)
{
RdsCollection collection = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID);
@ -48,8 +50,8 @@ namespace WebsitePanel.Portal.RDS
locCName.Text = collection.Name;
remoreApps.SetApps(collectionApps, Module);
}
remoreApps.SetApps(collectionApps);
}
}
protected void btnSave_Click(object sender, EventArgs e)

View file

@ -43,16 +43,16 @@
<Columns>
<asp:BoundField DataField="Name" HtmlEncode="true" SortExpression="Name" HeaderText="Server name">
<HeaderStyle Wrap="false" />
<ItemStyle Wrap="False" Width="35%"/>
<ItemStyle Wrap="False" Width="25%"/>
</asp:BoundField>
<asp:BoundField DataField="Address" HeaderText="IP Address"><ItemStyle Width="20%"/></asp:BoundField>
<asp:BoundField DataField="ItemName" HeaderText="Organization"><ItemStyle Width="35%"/></asp:BoundField>
<asp:BoundField DataField="Address" HeaderText="IP Address"><ItemStyle Width="15%"/></asp:BoundField>
<asp:BoundField DataField="ItemName" HeaderText="Organization"><ItemStyle Width="20%"/></asp:BoundField>
<asp:BoundField DataField="Description" HeaderText="Comments"><ItemStyle Width="30%"/></asp:BoundField>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="lnkRemove" runat="server" Text="Remove" Visible='<%# Eval("ItemId") == null %>'
CommandName="DeleteItem" CommandArgument='<%# Eval("Id") %>'
meta:resourcekey="cmdDelete" OnClientClick="return confirm('Are you sure you want to delete selected rds server?')"></asp:LinkButton>
<asp:Label ID="lbRemove" Text="Remove" runat="server" Visible='<%# Eval("ItemId") != null %>'></asp:Label>
meta:resourcekey="cmdDelete" OnClientClick="return confirm('Are you sure you want to delete selected rds server?')"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>

View file

@ -20,8 +20,7 @@
<tr>
<td class="FormLabel150"><asp:Localize ID="locServerComments" runat="server" meta:resourcekey="locServerComments" Text="Server Comments:"></asp:Localize></td>
<td>
<asp:TextBox ID="txtServerComments" runat="server" CssClass="NormalTextBox" Width="145px"></asp:TextBox>
<asp:RequiredFieldValidator ID="valServerComments" runat="server" ErrorMessage="*" ControlToValidate="txtServerComments"></asp:RequiredFieldValidator>
<asp:TextBox ID="txtServerComments" runat="server" CssClass="NormalTextBox" Width="145px"></asp:TextBox>
</td>
</tr>
</table>

View file

@ -75,15 +75,6 @@ namespace WebsitePanel.Portal {
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtServerComments;
/// <summary>
/// valServerComments 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 valServerComments;
/// <summary>
/// btnAdd control.
/// </summary>

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"></wsp:DomainControl>
<wsp:DomainControl ID="txtDomainName" runat="server" RequiredEnabled="True" ValidationGroup="CreateSpace" OnTextChanged="txtDomainName_OnTextChanged"></wsp:DomainControl>
</td>
</tr>
</table>

View file

@ -31,6 +31,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Web.UI.WebControls;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.Portal.UserControls;
using WebsitePanel.Providers.HostedSolution;
namespace WebsitePanel.Portal
@ -249,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)
@ -266,5 +270,30 @@ namespace WebsitePanel.Portal
{
BindHostingPlan();
}
private bool CheckForCorrectIdnDomainUsage()
{
if (Utils.IsIdnDomain(txtDomainName.Text))
{
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();
}
}
}