Added: add a new domain to an existing website, not just create a new website.

This commit is contained in:
robvde 2012-10-20 11:52:34 +04:00
parent b9161581b0
commit adb06fc905
5 changed files with 81 additions and 22 deletions

View file

@ -139,7 +139,7 @@
<value>Tick this checkbox if you need to access your web site or mailboxes before DNS propagation takes places. DNS propagation is the time required to spread the information about DNS zone all over the Internet. It could take up to 72 hours.</value> <value>Tick this checkbox if you need to access your web site or mailboxes before DNS propagation takes places. DNS propagation is the time required to spread the information about DNS zone all over the Internet. It could take up to 72 hours.</value>
</data> </data>
<data name="DescribeCreateWebSite.Text" xml:space="preserve"> <data name="DescribeCreateWebSite.Text" xml:space="preserve">
<value>Create a new web site and park this domain to the created web site.</value> <value>Create a new web site.</value>
</data> </data>
<data name="DescribeEnableDns.Text" xml:space="preserve"> <data name="DescribeEnableDns.Text" xml:space="preserve">
<value>Tick this checkbox if DNS zone for this domain will be located on name servers of your hosting provider. Make sure you changed name servers in the domain registrar control panel.</value> <value>Tick this checkbox if DNS zone for this domain will be located on name servers of your hosting provider. Make sure you changed name servers in the domain registrar control panel.</value>

View file

@ -112,16 +112,16 @@
<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="btnCancel.Text" xml:space="preserve"> <data name="btnCancel.Text" xml:space="preserve">
<value>Cancel</value> <value>Cancel</value>
</data> </data>
<data name="DomainDescription.Text" xml:space="preserve"> <data name="DomainDescription.Text" xml:space="preserve">
<value>Create a Top-Level Domain (TLD). This domain could be parked to a new web site.</value> <value>Create a Top-Level Domain (TLD).</value>
</data> </data>
<data name="DomainLink.Text" xml:space="preserve"> <data name="DomainLink.Text" xml:space="preserve">
<value>Domain</value> <value>Domain</value>

View file

@ -40,15 +40,18 @@
<div style="padding-left: 20px;"> <div style="padding-left: 20px;">
<asp:Localize ID="DescribeCreateWebSite" runat="server" meta:resourcekey="DescribeCreateWebSite">Description...</asp:Localize> <asp:Localize ID="DescribeCreateWebSite" runat="server" meta:resourcekey="DescribeCreateWebSite">Description...</asp:Localize>
</div> </div>
<div style="padding-left: 20px;">
<asp:Label ID="lblHostName" runat="server" meta:resourcekey="lblHostName" Text="Host name:"></asp:Label>
<asp:TextBox ID="txtHostName" runat="server" CssClass="TextBox100" MaxLength="64" Text="www"></asp:TextBox>
</div>
</asp:Panel>
<table> <asp:Panel id="PointWebSitePanel" runat="server" style="padding-bottom: 15px;">
<tr> <asp:CheckBox ID="PointWebSite" runat="server" meta:resourcekey="PointWebSite" Text="Point to Web Site" CssClass="Checkbox Bold"
<td class="SubHead"> AutoPostBack="true" /><br />
<asp:Label ID="lblHostName" runat="server" meta:resourcekey="lblHostName" Text="Host name:"></asp:Label> <div style="padding-left: 20px;">
<asp:TextBox ID="txtHostName" runat="server" CssClass="TextBox100" MaxLength="64" Text="www"></asp:TextBox> <asp:DropDownList ID="WebSitesList" Runat="server" CssClass="NormalTextBox" DataTextField="Name" DataValueField="ID"></asp:DropDownList>
</td> </div>
</tr>
</table>
</asp:Panel> </asp:Panel>
<asp:Panel id="PointMailDomainPanel" runat="server" style="padding-bottom: 15px;"> <asp:Panel id="PointMailDomainPanel" runat="server" style="padding-bottom: 15px;">

View file

@ -99,19 +99,40 @@ namespace WebsitePanel.Portal
// load package context // load package context
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
if ((type == DomainType.DomainPointer || (type == DomainType.Domain && cntx.Quotas[Quotas.OS_DOMAINPOINTERS].QuotaAllocatedValue == 0)) && !IsPostBack) if ((type == DomainType.DomainPointer || (type == DomainType.Domain && !cntx.Quotas[Quotas.OS_DOMAINPOINTERS].QuotaExhausted)) && !IsPostBack)
{ {
// bind mail domains // bind web sites
MailDomainsList.DataSource = ES.Services.MailServers.GetMailDomains(PanelSecurity.PackageId, false); WebSitesList.DataSource = ES.Services.WebServers.GetWebSites(PanelSecurity.PackageId, false);
MailDomainsList.DataBind(); WebSitesList.DataBind();
} }
if ((type == DomainType.DomainPointer || (type == DomainType.Domain && cntx.Quotas[Quotas.OS_DOMAINPOINTERS].QuotaAllocatedValue == 0)) && !IsPostBack)
{
// bind mail domains
MailDomainsList.DataSource = ES.Services.MailServers.GetMailDomains(PanelSecurity.PackageId, false);
MailDomainsList.DataBind();
}
// create web site option // create web site option
CreateWebSitePanel.Visible = (type == DomainType.Domain || type == DomainType.SubDomain) CreateWebSitePanel.Visible = (type == DomainType.Domain || type == DomainType.SubDomain)
&& cntx.Groups.ContainsKey(ResourceGroups.Web); && cntx.Groups.ContainsKey(ResourceGroups.Web);
CreateWebSite.Enabled = true; if (PointWebSite.Checked)
CreateWebSite.Checked &= CreateWebSitePanel.Visible; {
CreateWebSite.Checked = false;
CreateWebSite.Enabled = false;
}
else
{
CreateWebSite.Enabled = true;
CreateWebSite.Checked &= CreateWebSitePanel.Visible;
}
// point Web site
PointWebSitePanel.Visible = (type == DomainType.DomainPointer || (type == DomainType.Domain && !cntx.Quotas[Quotas.OS_DOMAINPOINTERS].QuotaExhausted))
&& cntx.Groups.ContainsKey(ResourceGroups.Web) && WebSitesList.Items.Count > 0;
WebSitesList.Enabled = PointWebSite.Checked;
// point mail domain // point mail domain
PointMailDomainPanel.Visible = (type == DomainType.DomainPointer || (type == DomainType.Domain && cntx.Quotas[Quotas.OS_DOMAINPOINTERS].QuotaAllocatedValue == 0)) PointMailDomainPanel.Visible = (type == DomainType.DomainPointer || (type == DomainType.Domain && cntx.Quotas[Quotas.OS_DOMAINPOINTERS].QuotaAllocatedValue == 0))
@ -184,19 +205,27 @@ namespace WebsitePanel.Portal
// load package context // load package context
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
if (type == DomainType.DomainPointer || (type == DomainType.Domain && cntx.Quotas[Quotas.OS_DOMAINPOINTERS].QuotaAllocatedValue == 0)) if (type == DomainType.DomainPointer || (type == DomainType.Domain && !cntx.Quotas[Quotas.OS_DOMAINPOINTERS].QuotaExhausted))
{ {
if (PointMailDomain.Checked && MailDomainsList.Items.Count > 0)
pointMailDomainId = Utils.ParseInt(MailDomainsList.SelectedValue, 0); if (PointWebSite.Checked && WebSitesList.Items.Count > 0)
pointWebSiteId = Utils.ParseInt(WebSitesList.SelectedValue, 0);
} }
if (type == DomainType.DomainPointer || (type == DomainType.Domain && cntx.Quotas[Quotas.OS_DOMAINPOINTERS].QuotaAllocatedValue == 0))
{
if (PointMailDomain.Checked && MailDomainsList.Items.Count > 0)
pointMailDomainId = Utils.ParseInt(MailDomainsList.SelectedValue, 0);
}
// add domain // add domain
int domainId = 0; int domainId = 0;
try try
{ {
domainId = ES.Services.Servers.AddDomainWithProvisioning(PanelSecurity.PackageId, domainId = ES.Services.Servers.AddDomainWithProvisioning(PanelSecurity.PackageId,
domainName.ToLower(), type, CreateWebSite.Checked, pointWebSiteId, pointMailDomainId, domainName.ToLower(), type, CreateWebSite.Checked, pointWebSiteId, pointMailDomainId,
EnableDns.Checked, CreateInstantAlias.Checked, AllowSubDomains.Checked, txtHostName.Text); EnableDns.Checked, CreateInstantAlias.Checked, AllowSubDomains.Checked, (PointWebSite.Checked && WebSitesList.Items.Count > 0) ? string.Empty : txtHostName.Text);
if (domainId < 0) if (domainId < 0)
{ {

View file

@ -174,6 +174,33 @@ namespace WebsitePanel.Portal {
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtHostName; protected global::System.Web.UI.WebControls.TextBox txtHostName;
/// <summary>
/// PointWebSitePanel 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.Panel PointWebSitePanel;
/// <summary>
/// PointWebSite 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 PointWebSite;
/// <summary>
/// WebSitesList 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.DropDownList WebSitesList;
/// <summary> /// <summary>
/// PointMailDomainPanel control. /// PointMailDomainPanel control.
/// </summary> /// </summary>