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

@ -99,19 +99,40 @@ namespace WebsitePanel.Portal
// load package context
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
MailDomainsList.DataSource = ES.Services.MailServers.GetMailDomains(PanelSecurity.PackageId, false);
MailDomainsList.DataBind();
// bind web sites
WebSitesList.DataSource = ES.Services.WebServers.GetWebSites(PanelSecurity.PackageId, false);
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
CreateWebSitePanel.Visible = (type == DomainType.Domain || type == DomainType.SubDomain)
&& cntx.Groups.ContainsKey(ResourceGroups.Web);
CreateWebSite.Enabled = true;
CreateWebSite.Checked &= CreateWebSitePanel.Visible;
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].QuotaExhausted))
&& cntx.Groups.ContainsKey(ResourceGroups.Web) && WebSitesList.Items.Count > 0;
WebSitesList.Enabled = PointWebSite.Checked;
// point mail domain
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
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
int domainId = 0;
try
{
domainId = ES.Services.Servers.AddDomainWithProvisioning(PanelSecurity.PackageId,
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)
{