Domain management optimized and simplified:

Creation of websites and pointers decoupled from Domains in order to choose
freely the hostname of a website or pointer.

Quota enforcement around domain pointers disabled, though registration is
still in place
This commit is contained in:
robvde 2012-09-04 17:34:39 +04:00
parent ba71e9b29c
commit 92133e2c20
31 changed files with 9005 additions and 10978 deletions

View file

@ -37,5 +37,7 @@
<AdminContainer>Edit.ascx</AdminContainer>
<!-- SSL Settings -->
<UseSSL>false</UseSSL>
<HideDemoCheckbox>true</HideDemoCheckbox>
<HideDemoCheckbox>false</HideDemoCheckbox>
<HideThemeAndLocale>false</HideThemeAndLocale>
<ExcludedRolesToLogin></ExcludedRolesToLogin>
</SiteSettings>

View file

@ -222,4 +222,7 @@
<data name="chkIntegratedOUProvisioning.Text" xml:space="preserve">
<value>Automated Hosted Organization Provisioning</value>
</data>
<data name="lblHostName.Text" xml:space="preserve">
<value>Hostname:</value>
</data>
</root>

View file

@ -31,10 +31,6 @@
NavigateUrl='<%# GetItemEditUrl(Eval("PackageID"), Eval("DomainID")) %>'>
<%# Eval("DomainName")%></asp:hyperlink>
</b>
<div runat="server" class="Small" style="margin-top:2px;" visible=' <%# Eval("WebSiteName") != DBNull.Value %>'>
<asp:Label ID="lblWebSite" runat="server" meta:resourcekey="lblWebSite" Text="Web:"></asp:Label>
<b><%# Eval("WebSiteName")%></b>
</div>
<div runat="server" class="Small" style="margin-top:2px;" visible=' <%# Eval("MailDomainName") != DBNull.Value %>'>
<asp:Label ID="lblMailDomain" runat="server" meta:resourcekey="lblMailDomain" Text="Mail:"></asp:Label>
<b><%# Eval("MailDomainName")%></b>
@ -107,10 +103,12 @@
<td><asp:Label ID="lblSubDomains" runat="server" meta:resourcekey="lblSubDomains" Text="Sub-Domains:" CssClass="NormalBold"></asp:Label></td>
<td><wsp:Quota ID="quotaSubDomains" runat="server" QuotaName="OS.SubDomains" /></td>
</tr>
<!--
<tr>
<td><asp:Label ID="lblDomainPointers" runat="server" meta:resourcekey="lblDomainPointers" Text="Domain Aliases:" CssClass="NormalBold"></asp:Label></td>
<td><wsp:Quota ID="quotaDomainPointers" runat="server" QuotaName="OS.DomainPointers" /></td>
</tr>
-->
</table>
</div>

View file

@ -1,10 +1,9 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4927
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

View file

@ -9,7 +9,6 @@
<div class="FormBody">
<p id="DomainPanel" runat="server" style="padding: 15px 0 15px 5px;" visible="false">
<asp:Label ID="DomainPrefix" runat="server" meta:resourcekey="DomainPrefix" Text="www." CssClass="Huge"></asp:Label>
<asp:TextBox ID="DomainName" runat="server" Width="300" CssClass="HugeTextBox"></asp:TextBox>
<asp:RequiredFieldValidator id="DomainRequiredValidator" runat="server" meta:resourcekey="DomainRequiredValidator"
ControlToValidate="DomainName" Display="Dynamic" ValidationGroup="Domain" SetFocusOnError="true"></asp:RequiredFieldValidator>
@ -42,14 +41,6 @@
</div>
</asp:Panel>
<asp:Panel id="PointWebSitePanel" runat="server" style="padding-bottom: 15px;">
<asp:CheckBox ID="PointWebSite" runat="server" meta:resourcekey="PointWebSite" Text="Point to Web Site" CssClass="Checkbox Bold"
AutoPostBack="true" /><br />
<div style="padding-left: 20px;">
<asp:DropDownList ID="WebSitesList" Runat="server" CssClass="NormalTextBox" DataTextField="Name" DataValueField="ID"></asp:DropDownList>
</div>
</asp:Panel>
<asp:Panel id="PointMailDomainPanel" runat="server" style="padding-bottom: 15px;">
<asp:CheckBox ID="PointMailDomain" runat="server" meta:resourcekey="PointMailDomain" Text="Point to Mail Domain" CssClass="Checkbox Bold"
AutoPostBack="true" /><br />
@ -65,7 +56,7 @@
<asp:Localize ID="DescribeEnableDns" runat="server" meta:resourcekey="DescribeEnableDns">Description...</asp:Localize>
</div>
</asp:Panel>
<!--
<asp:Panel id="InstantAliasPanel" runat="server" style="padding-bottom: 15px;">
<asp:CheckBox ID="CreateInstantAlias" runat="server" meta:resourcekey="CreateInstantAlias"
Text="Create Instant Alias" CssClass="Checkbox Bold" Checked="true" /><br />
@ -73,7 +64,7 @@
<asp:Localize ID="DescribeCreateInstantAlias" runat="server" meta:resourcekey="DescribeCreateInstantAlias">Description...</asp:Localize>
</div>
</asp:Panel>
-->
<asp:Panel id="AllowSubDomainsPanel" runat="server" style="padding-bottom: 15px;">
<asp:CheckBox ID="AllowSubDomains" runat="server" meta:resourcekey="AllowSubDomains" Text="Allow sub-domains" CssClass="Checkbox Bold" /><br />
<div style="padding-left: 20px;">

View file

@ -46,6 +46,12 @@ namespace WebsitePanel.Portal
{
ShowErrorMessage("DOMAIN_GET_DOMAIN", ex);
}
if (PanelSecurity.LoggedUser.Role == UserRole.User)
{
if (!PackagesHelper.CheckGroupQuotaEnabled(PanelSecurity.PackageId, ResourceGroups.Dns, Quotas.DNS_EDITOR))
this.DisableControls = true;
}
}
private void BindControls()
@ -78,10 +84,6 @@ namespace WebsitePanel.Portal
if ((type == DomainType.DomainPointer || (type == DomainType.Domain && cntx.Quotas[Quotas.OS_DOMAINPOINTERS].QuotaAllocatedValue == 0)) && !IsPostBack)
{
// bind web sites
WebSitesList.DataSource = ES.Services.WebServers.GetWebSites(PanelSecurity.PackageId, false);
WebSitesList.DataBind();
// bind mail domains
MailDomainsList.DataSource = ES.Services.MailServers.GetMailDomains(PanelSecurity.PackageId, false);
MailDomainsList.DataBind();
@ -90,21 +92,9 @@ namespace WebsitePanel.Portal
// create web site option
CreateWebSitePanel.Visible = (type == DomainType.Domain || type == DomainType.SubDomain)
&& cntx.Groups.ContainsKey(ResourceGroups.Web);
if (PointWebSite.Checked)
{
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].QuotaAllocatedValue == 0))
&& cntx.Groups.ContainsKey(ResourceGroups.Web) && WebSitesList.Items.Count > 0;
WebSitesList.Enabled = PointWebSite.Checked;
CreateWebSite.Enabled = true;
CreateWebSite.Checked &= CreateWebSitePanel.Visible;
// point mail domain
PointMailDomainPanel.Visible = (type == DomainType.DomainPointer || (type == DomainType.Domain && cntx.Quotas[Quotas.OS_DOMAINPOINTERS].QuotaAllocatedValue == 0))
@ -179,9 +169,6 @@ namespace WebsitePanel.Portal
if (type == DomainType.DomainPointer || (type == DomainType.Domain && cntx.Quotas[Quotas.OS_DOMAINPOINTERS].QuotaAllocatedValue == 0))
{
if (PointWebSite.Checked && WebSitesList.Items.Count > 0)
pointWebSiteId = Utils.ParseInt(WebSitesList.SelectedValue, 0);
if (PointMailDomain.Checked && MailDomainsList.Items.Count > 0)
pointMailDomainId = Utils.ParseInt(MailDomainsList.SelectedValue, 0);
}
@ -192,7 +179,7 @@ namespace WebsitePanel.Portal
{
domainId = ES.Services.Servers.AddDomainWithProvisioning(PanelSecurity.PackageId,
domainName, type, CreateWebSite.Checked, pointWebSiteId, pointMailDomainId,
EnableDns.Checked, CreateInstantAlias.Checked, AllowSubDomains.Checked);
EnableDns.Checked, CreateInstantAlias.Checked, AllowSubDomains.Checked, "");
if (domainId < 0)
{

View file

@ -1,10 +1,9 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4927
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
@ -40,15 +39,6 @@ namespace WebsitePanel.Portal {
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl DomainPanel;
/// <summary>
/// DomainPrefix 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 DomainPrefix;
/// <summary>
/// DomainName control.
/// </summary>
@ -166,33 +156,6 @@ namespace WebsitePanel.Portal {
/// </remarks>
protected global::System.Web.UI.WebControls.Localize DescribeCreateWebSite;
/// <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>
/// PointMailDomainPanel control.
/// </summary>

View file

@ -20,12 +20,12 @@
<b><asp:HyperLink ID="ProviderSubDomainLink" runat="server" meta:resourcekey="ProviderSubDomainLink">Provider Sub-domain</asp:HyperLink></b><br />
<asp:Localize ID="ProviderSubDomainDescription" runat="server" meta:resourcekey="ProviderSubDomainDescription" /><br /><br />
</p>
<!--
<p>
<b><asp:HyperLink ID="DomainPointerLink" runat="server" meta:resourcekey="DomainPointerLink">Domain Alias</asp:HyperLink></b><br />
<asp:Localize ID="DomainPointerDescription" runat="server" meta:resourcekey="DomainPointerDescription" />
</p>
-->
</div>
<div class="FormFooter">

View file

@ -1,10 +1,9 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.3074
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

View file

@ -97,6 +97,19 @@
Text="Create Web Site" Checked="True" />
</td>
</tr>
<tr>
<td class="SubHead">
<asp:Label ID="lblHostName" runat="server" meta:resourcekey="lblHostName" Text="Host name:"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtHostName" runat="server" CssClass="TextBox100" MaxLength="64"></asp:TextBox>
<asp:RequiredFieldValidator ID="valRequireHostName" runat="server" meta:resourcekey="valRequireHostName" ControlToValidate="txtHostName"
ErrorMessage="Enter hostname" ValidationGroup="CreateSite" Display="Dynamic" Text="*" SetFocusOnError="True"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="valRequireCorrectHostName" runat="server"
ErrorMessage="Enter valid hostname" ControlToValidate="txtHostName" Display="Dynamic"
meta:resourcekey="valRequireCorrectHostName" ValidationExpression="^([0-9a-zA-Z])*[0-9a-zA-Z]+$" SetFocusOnError="True"></asp:RegularExpressionValidator>
</td>
</tr>
</table>
</fieldset>

View file

@ -124,6 +124,8 @@ namespace WebsitePanel.Portal
string ftpAccount = (rbFtpAccountName.SelectedIndex == 0) ? null : ftpAccountName.Text;
string domainName = txtDomainName.Text.Trim();
string hostName = txtHostName.Text.Trim();
PackageResult result = null;
try
@ -134,7 +136,7 @@ namespace WebsitePanel.Portal
Utils.ParseInt(ddlStatus.SelectedValue, 0),
chkPackageLetter.Checked,
chkCreateResources.Checked, domainName, true, chkCreateWebSite.Checked,
chkCreateFtpAccount.Checked, ftpAccount, chkCreateMailAccount.Checked);
chkCreateFtpAccount.Checked, ftpAccount, chkCreateMailAccount.Checked, hostName);
if (result.Result < 0)
{

View file

@ -210,6 +210,42 @@ namespace WebsitePanel.Portal {
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkCreateWebSite;
/// <summary>
/// lblHostName 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 lblHostName;
/// <summary>
/// txtHostName 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.TextBox txtHostName;
/// <summary>
/// valRequireHostName 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 valRequireHostName;
/// <summary>
/// valRequireCorrectHostName 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.RegularExpressionValidator valRequireCorrectHostName;
/// <summary>
/// fsFtp control.
/// </summary>

View file

@ -7,8 +7,12 @@
<asp:Label ID="lblDomainName" runat="server" meta:resourcekey="lblDomainName" Text="Domain name:"></asp:Label>
</td>
<td>
<uc1:DomainsSelectDomainControl ID="domainsSelectDomainControl" runat="server"
HideWebSites="true" HideDomainsSubDomains="false" />
<asp:TextBox ID="txtHostName" runat="server" CssClass="TextBox100" MaxLength="64"></asp:TextBox>.<uc1:DomainsSelectDomainControl ID="domainsSelectDomainControl" runat="server" HideWebSites="true" HideDomainPointers="true" />
<asp:RequiredFieldValidator ID="valRequireHostName" runat="server" meta:resourcekey="valRequireHostName" ControlToValidate="txtHostName"
ErrorMessage="Enter hostname" ValidationGroup="CreateSite" Display="Dynamic" Text="*" SetFocusOnError="True"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="valRequireCorrectHostName" runat="server"
ErrorMessage="Enter valid hostname" ControlToValidate="txtHostName" Display="Dynamic"
meta:resourcekey="valRequireCorrectHostName" ValidationExpression="^([0-9a-zA-Z])*[0-9a-zA-Z]+$" SetFocusOnError="True"></asp:RegularExpressionValidator>
</td>
</tr>
</table>

View file

@ -50,7 +50,7 @@ namespace WebsitePanel.Portal
{
try
{
int result = ES.Services.WebServers.AddWebSitePointer(PanelRequest.ItemID, domainsSelectDomainControl.DomainId);
int result = ES.Services.WebServers.AddWebSitePointer(PanelRequest.ItemID, txtHostName.Text, domainsSelectDomainControl.DomainId);
if (result < 0)
{
ShowResultMessage(result);

View file

@ -1,10 +1,9 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.3074
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
@ -22,6 +21,15 @@ namespace WebsitePanel.Portal {
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblDomainName;
/// <summary>
/// txtHostName 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.TextBox txtHostName;
/// <summary>
/// domainsSelectDomainControl control.
/// </summary>
@ -31,6 +39,24 @@ namespace WebsitePanel.Portal {
/// </remarks>
protected global::WebsitePanel.Portal.DomainsSelectDomainControl domainsSelectDomainControl;
/// <summary>
/// valRequireHostName 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 valRequireHostName;
/// <summary>
/// valRequireCorrectHostName 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.RegularExpressionValidator valRequireCorrectHostName;
/// <summary>
/// btnAdd control.
/// </summary>

View file

@ -11,8 +11,12 @@
<asp:Label ID="lblDomainName" runat="server" meta:resourcekey="lblDomainName" Text="Domain name:"></asp:Label>
</td>
<td>
<uc1:DomainsSelectDomainControl ID="domainsSelectDomainControl" runat="server"
HideWebSites="true" HideDomainPointers="true" />
<asp:TextBox ID="txtHostName" runat="server" CssClass="TextBox100" MaxLength="64"></asp:TextBox>.<uc1:DomainsSelectDomainControl ID="domainsSelectDomainControl" runat="server" HideWebSites="true" HideDomainPointers="true" />
<asp:RequiredFieldValidator ID="valRequireHostName" runat="server" meta:resourcekey="valRequireHostName" ControlToValidate="txtHostName"
ErrorMessage="Enter hostname" ValidationGroup="CreateSite" Display="Dynamic" Text="*" SetFocusOnError="True"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="valRequireCorrectHostName" runat="server"
ErrorMessage="Enter valid hostname" ControlToValidate="txtHostName" Display="Dynamic"
meta:resourcekey="valRequireCorrectHostName" ValidationExpression="^([0-9a-zA-Z])*[0-9a-zA-Z]+$" SetFocusOnError="True"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>

View file

@ -91,7 +91,7 @@ namespace WebsitePanel.Portal
{
int packageAddressId = rbDedicatedIP.Checked ? Utils.ParseInt(ddlIpAddresses.SelectedValue, 0) : 0;
siteItemId = ES.Services.WebServers.AddWebSite(PanelSecurity.PackageId, domainsSelectDomainControl.DomainId,
siteItemId = ES.Services.WebServers.AddWebSite(PanelSecurity.PackageId, txtHostName.Text.ToLower(), domainsSelectDomainControl.DomainId,
packageAddressId);
if (siteItemId < 0)

View file

@ -1,10 +1,9 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.3074
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
@ -31,6 +30,15 @@ namespace WebsitePanel.Portal {
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblDomainName;
/// <summary>
/// txtHostName 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.TextBox txtHostName;
/// <summary>
/// domainsSelectDomainControl control.
/// </summary>
@ -40,6 +48,24 @@ namespace WebsitePanel.Portal {
/// </remarks>
protected global::WebsitePanel.Portal.DomainsSelectDomainControl domainsSelectDomainControl;
/// <summary>
/// valRequireHostName 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 valRequireHostName;
/// <summary>
/// valRequireCorrectHostName 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.RegularExpressionValidator valRequireCorrectHostName;
/// <summary>
/// rowSiteIP control.
/// </summary>