Update Website Pointers:

Code structured, Option Added to ignore GlobalDNSZone when creating additional
website
This commit is contained in:
robvde 2012-09-14 08:21:55 +04:00
parent c39dd51260
commit 4b0a56c3cd
12 changed files with 143 additions and 81 deletions

View file

@ -1,3 +1,31 @@
// Copyright (c) 2012, 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.
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
@ -25,6 +53,7 @@ namespace WebsitePanel.EnterpriseServer {
using WebsitePanel.Providers.Web; using WebsitePanel.Providers.Web;
using WebsitePanel.Providers.ResultObjects; using WebsitePanel.Providers.ResultObjects;
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()]
@ -808,22 +837,24 @@ namespace WebsitePanel.EnterpriseServer {
/// <remarks/> /// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/AddWebSite", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/AddWebSite", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public int AddWebSite(int packageId, string hostName, int domainId, int ipAddressId) { public int AddWebSite(int packageId, string hostName, int domainId, int ipAddressId, bool ignoreGlobalDNSZone) {
object[] results = this.Invoke("AddWebSite", new object[] { object[] results = this.Invoke("AddWebSite", new object[] {
packageId, packageId,
hostName, hostName,
domainId, domainId,
ipAddressId}); ipAddressId,
ignoreGlobalDNSZone});
return ((int)(results[0])); return ((int)(results[0]));
} }
/// <remarks/> /// <remarks/>
public System.IAsyncResult BeginAddWebSite(int packageId, string hostName, int domainId, int ipAddressId, System.AsyncCallback callback, object asyncState) { public System.IAsyncResult BeginAddWebSite(int packageId, string hostName, int domainId, int ipAddressId, bool ignoreGlobalDNSZone, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("AddWebSite", new object[] { return this.BeginInvoke("AddWebSite", new object[] {
packageId, packageId,
hostName, hostName,
domainId, domainId,
ipAddressId}, callback, asyncState); ipAddressId,
ignoreGlobalDNSZone}, callback, asyncState);
} }
/// <remarks/> /// <remarks/>
@ -833,12 +864,12 @@ namespace WebsitePanel.EnterpriseServer {
} }
/// <remarks/> /// <remarks/>
public void AddWebSiteAsync(int packageId, string hostName, int domainId, int ipAddressId) { public void AddWebSiteAsync(int packageId, string hostName, int domainId, int ipAddressId, bool ignoreGlobalDNSZone) {
this.AddWebSiteAsync(packageId, hostName, domainId, ipAddressId, null); this.AddWebSiteAsync(packageId, hostName, domainId, ipAddressId, ignoreGlobalDNSZone, null);
} }
/// <remarks/> /// <remarks/>
public void AddWebSiteAsync(int packageId, string hostName, int domainId, int ipAddressId, object userState) { public void AddWebSiteAsync(int packageId, string hostName, int domainId, int ipAddressId, bool ignoreGlobalDNSZone, object userState) {
if ((this.AddWebSiteOperationCompleted == null)) { if ((this.AddWebSiteOperationCompleted == null)) {
this.AddWebSiteOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddWebSiteOperationCompleted); this.AddWebSiteOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddWebSiteOperationCompleted);
} }
@ -846,7 +877,8 @@ namespace WebsitePanel.EnterpriseServer {
packageId, packageId,
hostName, hostName,
domainId, domainId,
ipAddressId}, this.AddWebSiteOperationCompleted, userState); ipAddressId,
ignoreGlobalDNSZone}, this.AddWebSiteOperationCompleted, userState);
} }
private void OnAddWebSiteOperationCompleted(object arg) { private void OnAddWebSiteOperationCompleted(object arg) {

View file

@ -481,7 +481,7 @@ namespace WebsitePanel.EnterpriseServer
// create web site // create web site
try try
{ {
int webSiteId = WebServerController.AddWebSite(packageId, hostName, domainId, 0, true); int webSiteId = WebServerController.AddWebSite(packageId, hostName, domainId, 0, true, false);
if (webSiteId < 0) if (webSiteId < 0)
{ {
result.Result = webSiteId; result.Result = webSiteId;

View file

@ -1729,7 +1729,7 @@ namespace WebsitePanel.EnterpriseServer
int webSiteId = 0; int webSiteId = 0;
if (webEnabled && createWebSite) if (webEnabled && createWebSite)
{ {
webSiteId = WebServerController.AddWebSite(packageId, hostName, domainId, 0, createInstantAlias); webSiteId = WebServerController.AddWebSite(packageId, hostName, domainId, 0, createInstantAlias, false);
if (webSiteId < 0) if (webSiteId < 0)
{ {

View file

@ -157,11 +157,11 @@ namespace WebsitePanel.EnterpriseServer
public static int AddWebSite(int packageId, string hostName, int domainId, int ipAddressId) public static int AddWebSite(int packageId, string hostName, int domainId, int ipAddressId)
{ {
return AddWebSite(packageId, hostName, domainId, ipAddressId, false); return AddWebSite(packageId, hostName, domainId, ipAddressId, false, true);
} }
public static int AddWebSite(int packageId, string hostName, int domainId, int packageAddressId, public static int AddWebSite(int packageId, string hostName, int domainId, int packageAddressId,
bool addInstantAlias) bool addInstantAlias, bool ignoreGlobalDNSRecords)
{ {
// check account // check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive); int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
@ -182,10 +182,14 @@ namespace WebsitePanel.EnterpriseServer
string siteName = string.IsNullOrEmpty(hostName) ? domainName : hostName + "." + domainName; string siteName = string.IsNullOrEmpty(hostName) ? domainName : hostName + "." + domainName;
// check if the web site already exists // check if the web site already exists (legacy)
if (PackageController.GetPackageItemByName(packageId, siteName, typeof(WebSite)) != null) if (PackageController.GetPackageItemByName(packageId, siteName, typeof(WebSite)) != null)
return BusinessErrorCodes.ERROR_WEB_SITE_ALREADY_EXISTS; return BusinessErrorCodes.ERROR_WEB_SITE_ALREADY_EXISTS;
if (DataProvider.CheckDomain(domain.PackageId, siteName, true) != 0)
return BusinessErrorCodes.ERROR_WEB_SITE_ALREADY_EXISTS;
// place log record // place log record
TaskManager.StartTask("WEB_SITE", "ADD", siteName); TaskManager.StartTask("WEB_SITE", "ADD", siteName);
@ -239,13 +243,7 @@ namespace WebsitePanel.EnterpriseServer
if (ip != null) if (ip != null)
ipAddr = !String.IsNullOrEmpty(ip.InternalIP) ? ip.InternalIP : ip.ExternalIP; ipAddr = !String.IsNullOrEmpty(ip.InternalIP) ? ip.InternalIP : ip.ExternalIP;
// load domain instant alias
/*
string instantAlias = ServerController.GetDomainAlias(packageId, domainName);
DomainInfo instantDomain = ServerController.GetDomain(instantAlias);
if (instantDomain == null || instantDomain.WebSiteId > 0)
instantAlias = "";
*/
// load web DNS records // load web DNS records
List<GlobalDnsRecord> dnsRecords = ServerController.GetDnsRecordsByService(serviceId); List<GlobalDnsRecord> dnsRecords = ServerController.GetDnsRecordsByService(serviceId);
@ -256,18 +254,15 @@ namespace WebsitePanel.EnterpriseServer
{ {
// SHARED IP // SHARED IP
// fill main domain bindings // fill main domain bindings
FillWebServerBindings(bindings, dnsRecords, ipAddr, hostName, domain.DomainName, false); FillWebServerBindings(bindings, dnsRecords, ipAddr, hostName, domain.DomainName, ignoreGlobalDNSRecords);
// fill alias bindings if required //double check all bindings
/* foreach (ServerBinding b in bindings)
if (addInstantAlias && !String.IsNullOrEmpty(instantAlias))
{ {
// fill bindings from DNS "A" records if (DataProvider.CheckDomain(domain.PackageId, b.Host, true) != 0)
FillWebServerBindings(bindings, dnsRecords, ipAddr, "", instantAlias); return BusinessErrorCodes.ERROR_WEB_SITE_ALREADY_EXISTS;
} }
*/
//bindings.Add(new ServerBinding(ipAddr, "80", siteName));
} }
else else
{ {
@ -391,13 +386,8 @@ namespace WebsitePanel.EnterpriseServer
// update domain // update domain
// add main pointer // add main pointer
AddWebSitePointer(siteItemId, hostName, domain.DomainId, false); AddWebSitePointer(siteItemId, hostName, domain.DomainId, false, ignoreGlobalDNSRecords);
// add instant pointer
/*
if (addInstantAlias && !String.IsNullOrEmpty(instantAlias))
AddWebSitePointer(siteItemId, "", instantDomain.DomainId, false);
*/
// add parking page // add parking page
// load package // load package
@ -722,39 +712,25 @@ namespace WebsitePanel.EnterpriseServer
if ((dnsRecord.RecordType == "A" || dnsRecord.RecordType == "AAAA" || dnsRecord.RecordType == "CNAME") && if ((dnsRecord.RecordType == "A" || dnsRecord.RecordType == "AAAA" || dnsRecord.RecordType == "CNAME") &&
dnsRecord.RecordName != "*") dnsRecord.RecordName != "*")
{ {
/* string recordData = Utils.ReplaceStringVariable(dnsRecord.RecordName, "host_name", hostName, true);
string recordData = dnsRecord.RecordName +
((dnsRecord.RecordName != "") ? "." : "") + domainName;
bindings.Add(new ServerBinding(ipAddr, "80", recordData)); if (!string.IsNullOrEmpty(domainName))
*/ recordData = recordData + ((string.IsNullOrEmpty(recordData)) ? "" : ".") + domainName;
//otherwise full recordData is supplied by hostName
string tmpName = string.Empty; if (ignoreGlobalDNSRecords)
tmpName = Utils.ReplaceStringVariable(dnsRecord.RecordName, "host_name", hostName);
if (!(tmpName== "[host_name]"))
{ {
string recordData = string.Empty; //only look for the host_nanme record, ignore all others
if (tmpName.Contains(".")) if (dnsRecord.RecordName == "[host_name]")
recordData = hostName;
else
recordData = tmpName + ((tmpName != "") ? "." : "") + domainName;
if (ignoreGlobalDNSRecords)
{
if (dnsRecord.RecordName == "[host_name]")
{
AddBinding(bindings, new ServerBinding(ipAddr, "80", recordData));
break;
}
}
else
{ {
AddBinding(bindings, new ServerBinding(ipAddr, "80", recordData)); AddBinding(bindings, new ServerBinding(ipAddr, "80", recordData));
break;
} }
} }
else
{
AddBinding(bindings, new ServerBinding(ipAddr, "80", recordData));
}
} }
} }
@ -915,8 +891,10 @@ namespace WebsitePanel.EnterpriseServer
string serviceIp = (ip != null) ? ip.ExternalIP : null; string serviceIp = (ip != null) ? ip.ExternalIP : null;
//filter initiat GlobaDNSRecords list
if (ignoreGlobalDNSRecords) if (ignoreGlobalDNSRecords)
{ {
//ignore all other except the host_name record
foreach (GlobalDnsRecord r in dnsRecords) foreach (GlobalDnsRecord r in dnsRecords)
{ {
if (r.RecordName == "[host_name]") if (r.RecordName == "[host_name]")
@ -977,6 +955,7 @@ namespace WebsitePanel.EnterpriseServer
// fill bindings // fill bindings
FillWebServerBindings(bindings, dnsRecords, ipAddr, hostName, domain.DomainName, ignoreGlobalDNSRecords); FillWebServerBindings(bindings, dnsRecords, ipAddr, hostName, domain.DomainName, ignoreGlobalDNSRecords);
//for logging purposes
foreach (ServerBinding b in bindings) foreach (ServerBinding b in bindings)
{ {
string header = string.Format("{0} {1} {2}", b.Host, b.IP, b.Port); string header = string.Format("{0} {1} {2}", b.Host, b.IP, b.Port);
@ -991,14 +970,12 @@ namespace WebsitePanel.EnterpriseServer
// update domain // update domain
domain.WebSiteId = siteItemId; domain.WebSiteId = siteItemId;
//ServerController.UpdateDomain(domain); domain.IsDomainPointer = true;
foreach (ServerBinding b in bindings) foreach (ServerBinding b in bindings)
{ {
//add new domain record
domain.DomainName = b.Host; domain.DomainName = b.Host;
domain.IsDomainPointer = true;
int domainID = ServerController.AddDomain(domain); int domainID = ServerController.AddDomain(domain);
DomainInfo domainTmp = ServerController.GetDomain(domainID); DomainInfo domainTmp = ServerController.GetDomain(domainID);
if (domainTmp != null) if (domainTmp != null)
{ {
@ -1008,7 +985,6 @@ namespace WebsitePanel.EnterpriseServer
} }
} }
return 0; return 0;
} }
catch (Exception ex) catch (Exception ex)
@ -1070,7 +1046,7 @@ namespace WebsitePanel.EnterpriseServer
{ {
foreach (GlobalDnsRecord r in dnsRecords) foreach (GlobalDnsRecord r in dnsRecords)
{ {
if (r.RecordName == "[host_name]") if ((r.RecordName == "[host_name]") | ((r.RecordName + (string.IsNullOrEmpty(r.RecordName) ? domain.ZoneName : "." + domain.ZoneName)) == domain.DomainName))
tmpDnsRecords.Add(r); tmpDnsRecords.Add(r);
} }
} }

View file

@ -199,7 +199,7 @@ namespace WebsitePanel.EnterpriseServer
try try
{ {
int webSiteId = WebServerController.AddWebSite( int webSiteId = WebServerController.AddWebSite(
createdPackageId, hostName, domainId, 0, true); createdPackageId, hostName, domainId, 0, true, false);
if (webSiteId < 0) if (webSiteId < 0)
{ {
// rollback wizard // rollback wizard

View file

@ -5,11 +5,11 @@
</configSections> </configSections>
<!-- Connection strings --> <!-- Connection strings -->
<connectionStrings> <connectionStrings>
<add name="EnterpriseServer" connectionString="Server=(local)\SQLExpress;Database=WebsitePanel;uid=WebsitePanel;pwd=Password12" providerName="System.Data.SqlClient" /> <add name="EnterpriseServer" connectionString="server=HSTPROV01;database=WebsitePanelMerge;uid=WebsitePanel;pwd=aj7ep6fyhmw3b5qeth7c;" providerName="System.Data.SqlClient" />
</connectionStrings> </connectionStrings>
<appSettings> <appSettings>
<!-- Encryption util settings --> <!-- Encryption util settings -->
<add key="WebsitePanel.CryptoKey" value="1234567890" /> <add key="WebsitePanel.CryptoKey" value="3x7eqt7zabc5n5afs6dg" />
<!-- A1D4KDHUE83NKHddF --> <!-- A1D4KDHUE83NKHddF -->
<add key="WebsitePanel.EncryptionEnabled" value="true" /> <add key="WebsitePanel.EncryptionEnabled" value="true" />
<!-- Web Applications --> <!-- Web Applications -->

View file

@ -104,9 +104,9 @@ namespace WebsitePanel.EnterpriseServer
} }
[WebMethod] [WebMethod]
public int AddWebSite(int packageId, string hostName, int domainId, int ipAddressId) public int AddWebSite(int packageId, string hostName, int domainId, int ipAddressId, bool ignoreGlobalDNSZone)
{ {
return WebServerController.AddWebSite(packageId, hostName, domainId, ipAddressId, true); return WebServerController.AddWebSite(packageId, hostName, domainId, ipAddressId, true, ignoreGlobalDNSZone);
} }
[WebMethod] [WebMethod]

View file

@ -112,10 +112,10 @@
<value>2.0</value> <value>2.0</value>
</resheader> </resheader>
<resheader name="reader"> <resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<data name="btnAdd.Text" xml:space="preserve"> <data name="btnAdd.Text" xml:space="preserve">
<value>Add Pointer</value> <value>Add Pointer</value>
@ -124,6 +124,6 @@
<value>Cancel</value> <value>Cancel</value>
</data> </data>
<data name="lblDomainName.Text" xml:space="preserve"> <data name="lblDomainName.Text" xml:space="preserve">
<value>Domain Alias:</value> <value>Web Site Pointer:</value>
</data> </data>
</root> </root>

View file

@ -112,10 +112,10 @@
<value>2.0</value> <value>2.0</value>
</resheader> </resheader>
<resheader name="reader"> <resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<data name="btnAdd.OnClientClick" xml:space="preserve"> <data name="btnAdd.OnClientClick" xml:space="preserve">
<value>ShowProgressDialog('Creating web site...');</value> <value>ShowProgressDialog('Creating web site...');</value>
@ -126,11 +126,14 @@
<data name="btnCancel.Text" xml:space="preserve"> <data name="btnCancel.Text" xml:space="preserve">
<value>Cancel</value> <value>Cancel</value>
</data> </data>
<data name="chkIgnoreGlobalDNSRecords.Text" xml:space="preserve">
<value>Ignore Zone Template</value>
</data>
<data name="lblAspNetVersion.Text" xml:space="preserve"> <data name="lblAspNetVersion.Text" xml:space="preserve">
<value>ASP.NET Version:</value> <value>ASP.NET Version:</value>
</data> </data>
<data name="lblDomainName.Text" xml:space="preserve"> <data name="lblDomainName.Text" xml:space="preserve">
<value>Domain Name:</value> <value>Site:</value>
</data> </data>
<data name="lblIPAddress.Text" xml:space="preserve"> <data name="lblIPAddress.Text" xml:space="preserve">
<value>IP address:</value> <value>IP address:</value>
@ -138,6 +141,9 @@
<data name="lblIPHelp.Text" xml:space="preserve"> <data name="lblIPHelp.Text" xml:space="preserve">
<value>If you need your web site to be accessible via dedicated IP address or you are planning to enable SSL for your site you should choose "Dedicated IP" option; otherwise leave this settings by default. In order to create IP-based site you need to purchase IP address from your host.</value> <value>If you need your web site to be accessible via dedicated IP address or you are planning to enable SSL for your site you should choose "Dedicated IP" option; otherwise leave this settings by default. In order to create IP-based site you need to purchase IP address from your host.</value>
</data> </data>
<data name="lblIPHelp2.Text" xml:space="preserve">
<value>Note: A Zone Template is often defined by your host and contains additional Web Site Pointers to create when creating a new Web Site. Static record definitions such as 'www' conflicts when creating an additional Web Site in the same Domain. &lt;/p&gt;Check this option to ignore the Zone Template and create the new Web Site with this Web Site Pointer only. </value>
</data>
<data name="rbDedicatedIP.Text" xml:space="preserve"> <data name="rbDedicatedIP.Text" xml:space="preserve">
<value>Dedicated</value> <value>Dedicated</value>
</data> </data>

View file

@ -11,7 +11,7 @@
<asp:Label ID="lblDomainName" runat="server" meta:resourcekey="lblDomainName" Text="Domain name:"></asp:Label> <asp:Label ID="lblDomainName" runat="server" meta:resourcekey="lblDomainName" Text="Domain name:"></asp:Label>
</td> </td>
<td> <td>
<asp:TextBox ID="txtHostName" runat="server" CssClass="TextBox100" MaxLength="64" Text="www"></asp:TextBox>.<uc1:DomainsSelectDomainControl ID="domainsSelectDomainControl" runat="server" HideWebSites="true" HideDomainPointers="true" /> <asp:TextBox ID="txtHostName" runat="server" CssClass="TextBox100" MaxLength="64" Text="www"></asp:TextBox> . <uc1:DomainsSelectDomainControl ID="domainsSelectDomainControl" runat="server" HideWebSites="true" HideDomainPointers="true" />
<asp:RequiredFieldValidator ID="valRequireHostName" runat="server" meta:resourcekey="valRequireHostName" ControlToValidate="txtHostName" <asp:RequiredFieldValidator ID="valRequireHostName" runat="server" meta:resourcekey="valRequireHostName" ControlToValidate="txtHostName"
ErrorMessage="Enter hostname" ValidationGroup="CreateSite" Display="Dynamic" Text="*" SetFocusOnError="True"></asp:RequiredFieldValidator> ErrorMessage="Enter hostname" ValidationGroup="CreateSite" Display="Dynamic" Text="*" SetFocusOnError="True"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="valRequireCorrectHostName" runat="server" <asp:RegularExpressionValidator ID="valRequireCorrectHostName" runat="server"
@ -19,6 +19,21 @@
meta:resourcekey="valRequireCorrectHostName" ValidationExpression="^([0-9a-zA-Z])*[0-9a-zA-Z]+$" SetFocusOnError="True"></asp:RegularExpressionValidator> meta:resourcekey="valRequireCorrectHostName" ValidationExpression="^([0-9a-zA-Z])*[0-9a-zA-Z]+$" SetFocusOnError="True"></asp:RegularExpressionValidator>
</td> </td>
</tr> </tr>
<tr>
<td class="Normal" nowrap rowspan="2"></td>
<td class="Normal">
<asp:CheckBox ID="chkIgnoreGlobalDNSRecords" runat="server" meta:resourcekey="chkIgnoreGlobalDNSRecords"
Text="This hostname only, Ignore Zone Template" Checked="True" />
</td>
</tr>
<tr>
<td class="Normal">
<div class="Small" style="padding-top: 10px;">
<asp:Label ID="lblIgnoreGlobalDNSRecords" runat="server" meta:resourcekey="lblIPHelp2" Text="If you need your site..."></asp:Label>
</div>
</td>
</tr>
<tr> <tr>
<td> <td>
<br/> <br/>

View file

@ -53,6 +53,8 @@ namespace WebsitePanel.Portal
// bind IP Addresses // bind IP Addresses
BindIPAddresses(); BindIPAddresses();
BindIgnoreZoneTemplate();
// toggle // toggle
ToggleControls(); ToggleControls();
} }
@ -63,6 +65,19 @@ namespace WebsitePanel.Portal
rowDedicatedIP.Visible = rbDedicatedIP.Checked; rowDedicatedIP.Visible = rbDedicatedIP.Checked;
} }
private void BindIgnoreZoneTemplate()
{
/*
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
if (cntx.Quotas[Quotas.WEB_SITES].QuotaUsedValue > 0)
chkIgnoreGlobalDNSRecords.Visible = chkIgnoreGlobalDNSRecords.Checked = lblIgnoreGlobalDNSRecords.Visible = true;
else
chkIgnoreGlobalDNSRecords.Visible = chkIgnoreGlobalDNSRecords.Checked = lblIgnoreGlobalDNSRecords.Visible= false;
*/
chkIgnoreGlobalDNSRecords.Checked = false;
}
private void BindIPAddresses() private void BindIPAddresses()
{ {
ddlIpAddresses.Items.Add(new ListItem("<Select IP>", "")); ddlIpAddresses.Items.Add(new ListItem("<Select IP>", ""));
@ -92,7 +107,7 @@ namespace WebsitePanel.Portal
int packageAddressId = rbDedicatedIP.Checked ? Utils.ParseInt(ddlIpAddresses.SelectedValue, 0) : 0; int packageAddressId = rbDedicatedIP.Checked ? Utils.ParseInt(ddlIpAddresses.SelectedValue, 0) : 0;
siteItemId = ES.Services.WebServers.AddWebSite(PanelSecurity.PackageId, txtHostName.Text.ToLower(), domainsSelectDomainControl.DomainId, siteItemId = ES.Services.WebServers.AddWebSite(PanelSecurity.PackageId, txtHostName.Text.ToLower(), domainsSelectDomainControl.DomainId,
packageAddressId); packageAddressId, chkIgnoreGlobalDNSRecords.Checked);
if (siteItemId < 0) if (siteItemId < 0)
{ {

View file

@ -66,6 +66,24 @@ namespace WebsitePanel.Portal {
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.RegularExpressionValidator valRequireCorrectHostName; protected global::System.Web.UI.WebControls.RegularExpressionValidator valRequireCorrectHostName;
/// <summary>
/// chkIgnoreGlobalDNSRecords 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.CheckBox chkIgnoreGlobalDNSRecords;
/// <summary>
/// lblIgnoreGlobalDNSRecords control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblIgnoreGlobalDNSRecords;
/// <summary> /// <summary>
/// rowSiteIP control. /// rowSiteIP control.
/// </summary> /// </summary>