Fixed: @hostName is required to create website - removed this requirement

Fixed: Temporary URL / Instant alias is not properly created / assigned to the
created website
Added: New @createZoneRecord parameter on "CreateUserWizard" to allow WHMCS
module to determine if a DNS Zone is to be created or not.
This commit is contained in:
Christopher York 2012-12-11 16:45:17 -06:00
parent da9aafcb26
commit 701d58049b
3 changed files with 35 additions and 25 deletions

View file

@ -2743,7 +2743,8 @@ namespace WebsitePanel.EnterpriseServer {
bool createFtpAccount,
string ftpAccountName,
bool createMailAccount,
string hostName) {
string hostName,
bool createZoneRecord) {
object[] results = this.Invoke("CreateUserWizard", new object[] {
parentPackageId,
username,
@ -2764,7 +2765,8 @@ namespace WebsitePanel.EnterpriseServer {
createFtpAccount,
ftpAccountName,
createMailAccount,
hostName});
hostName,
createZoneRecord});
return ((int)(results[0]));
}
@ -2790,6 +2792,7 @@ namespace WebsitePanel.EnterpriseServer {
string ftpAccountName,
bool createMailAccount,
string hostName,
bool createZoneRecord,
System.AsyncCallback callback,
object asyncState) {
return this.BeginInvoke("CreateUserWizard", new object[] {
@ -2812,7 +2815,8 @@ namespace WebsitePanel.EnterpriseServer {
createFtpAccount,
ftpAccountName,
createMailAccount,
hostName}, callback, asyncState);
hostName,
createZoneRecord}, callback, asyncState);
}
/// <remarks/>
@ -2842,8 +2846,9 @@ namespace WebsitePanel.EnterpriseServer {
bool createFtpAccount,
string ftpAccountName,
bool createMailAccount,
string hostName) {
this.CreateUserWizardAsync(parentPackageId, username, password, roleId, firstName, lastName, email, secondaryEmail, htmlMail, sendAccountLetter, createPackage, planId, sendPackageLetter, domainName, tempDomain, createWebSite, createFtpAccount, ftpAccountName, createMailAccount, hostName, null);
string hostName,
bool createZoneRecord) {
this.CreateUserWizardAsync(parentPackageId, username, password, roleId, firstName, lastName, email, secondaryEmail, htmlMail, sendAccountLetter, createPackage, planId, sendPackageLetter, domainName, tempDomain, createWebSite, createFtpAccount, ftpAccountName, createMailAccount, hostName, createZoneRecord, null);
}
/// <remarks/>
@ -2868,6 +2873,7 @@ namespace WebsitePanel.EnterpriseServer {
string ftpAccountName,
bool createMailAccount,
string hostName,
bool createZoneRecord,
object userState) {
if ((this.CreateUserWizardOperationCompleted == null)) {
this.CreateUserWizardOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateUserWizardOperationCompleted);
@ -2892,7 +2898,8 @@ namespace WebsitePanel.EnterpriseServer {
createFtpAccount,
ftpAccountName,
createMailAccount,
hostName}, this.CreateUserWizardOperationCompleted, userState);
hostName,
createZoneRecord}, this.CreateUserWizardOperationCompleted, userState);
}
private void OnCreateUserWizardOperationCompleted(object arg) {

View file

@ -50,7 +50,7 @@ namespace WebsitePanel.EnterpriseServer
bool sendAccountLetter,
bool createPackage, int planId, bool sendPackageLetter,
string domainName, bool tempDomain, bool createWebSite,
bool createFtpAccount, string ftpAccountName, bool createMailAccount, string hostName)
bool createFtpAccount, string ftpAccountName, bool createMailAccount, string hostName, bool createZoneRecord)
{
UserCreationWizard wizard = new UserCreationWizard();
@ -59,7 +59,7 @@ namespace WebsitePanel.EnterpriseServer
sendAccountLetter,
createPackage, planId, sendPackageLetter,
domainName, tempDomain, createWebSite,
createFtpAccount, ftpAccountName, createMailAccount, hostName);
createFtpAccount, ftpAccountName, createMailAccount, hostName, createZoneRecord);
}
// private fields
@ -72,7 +72,7 @@ namespace WebsitePanel.EnterpriseServer
bool sendAccountLetter,
bool createPackage, int planId, bool sendPackageLetter,
string domainName, bool tempDomain, bool createWebSite,
bool createFtpAccount, string ftpAccountName, bool createMailAccount, string hostName)
bool createFtpAccount, string ftpAccountName, bool createMailAccount, string hostName, bool createZoneRecord)
{
// check account
@ -173,7 +173,7 @@ namespace WebsitePanel.EnterpriseServer
domain.PackageId = createdPackageId;
domain.DomainName = domainName;
domain.HostingAllowed = false;
domainId = ServerController.AddDomain(domain, false, !tempDomain);
domainId = ServerController.AddDomain(domain, false, createZoneRecord);
if (domainId < 0)
{
// rollback wizard
@ -193,7 +193,7 @@ namespace WebsitePanel.EnterpriseServer
}
}
if (createWebSite && !String.IsNullOrEmpty(domainName) && !String.IsNullOrEmpty(hostName))
if (createWebSite && !String.IsNullOrEmpty(domainName))
{
// create web site
try
@ -301,16 +301,6 @@ namespace WebsitePanel.EnterpriseServer
MailServerController.UpdateMailDomain(mailDomain);
int mailDomainId = mailDomain.Id;
// set mail domain pointer
// load domain instant alias
string instantAlias = ServerController.GetDomainAlias(createdPackageId, domainName);
DomainInfo instantDomain = ServerController.GetDomain(instantAlias);
if (instantDomain == null || instantDomain.MailDomainId > 0)
instantAlias = "";
if (!String.IsNullOrEmpty(instantAlias))
MailServerController.AddMailDomainPointer(mailDomainId, instantDomain.DomainId);
}
catch (Exception ex)
{
@ -320,6 +310,19 @@ namespace WebsitePanel.EnterpriseServer
// error while creating mail account
throw new Exception("Could not create mail account", ex);
}
// Instant Alias / Temporary URL
if (tempDomain && (domainId > 0))
{
int instantAliasId = ServerController.CreateDomainInstantAlias("", domainId);
if (instantAliasId < 0)
{
// rollback wizard
Rollback();
return instantAliasId;
}
}
}
}

View file

@ -436,13 +436,13 @@ namespace WebsitePanel.EnterpriseServer
bool sendAccountLetter,
bool createPackage, int planId, bool sendPackageLetter,
string domainName, bool tempDomain, bool createWebSite,
bool createFtpAccount, string ftpAccountName, bool createMailAccount, string hostName)
bool createFtpAccount, string ftpAccountName, bool createMailAccount, string hostName, bool createZoneRecord)
{
return UserCreationWizard.CreateUserAccount(parentPackageId, username, password,
roleId, firstName, lastName, email, secondaryEmail, htmlMail, sendAccountLetter,
createPackage, planId,
sendPackageLetter, domainName, tempDomain, createWebSite, createFtpAccount, ftpAccountName,
createMailAccount, hostName);
createMailAccount, hostName, createZoneRecord);
}
#endregion