This commit is contained in:
feodor_fitsner 2012-09-12 09:49:57 -07:00
commit dba235771e
9 changed files with 535 additions and 92 deletions

View file

@ -1,59 +1,3 @@
// 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.
// 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>
// This code was generated by a tool.
@ -81,7 +25,6 @@ namespace WebsitePanel.EnterpriseServer {
using WebsitePanel.Providers.Web;
using WebsitePanel.Providers.ResultObjects;
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
@ -124,6 +67,10 @@ namespace WebsitePanel.EnterpriseServer {
private System.Threading.SendOrPostCallback DeleteWebSiteOperationCompleted;
private System.Threading.SendOrPostCallback SwitchWebSiteToDedicatedIPOperationCompleted;
private System.Threading.SendOrPostCallback SwitchWebSiteToSharedIPOperationCompleted;
private System.Threading.SendOrPostCallback DeleteVirtualDirectoryOperationCompleted;
private System.Threading.SendOrPostCallback ChangeSiteStateOperationCompleted;
@ -306,6 +253,12 @@ namespace WebsitePanel.EnterpriseServer {
/// <remarks/>
public event DeleteWebSiteCompletedEventHandler DeleteWebSiteCompleted;
/// <remarks/>
public event SwitchWebSiteToDedicatedIPCompletedEventHandler SwitchWebSiteToDedicatedIPCompleted;
/// <remarks/>
public event SwitchWebSiteToSharedIPCompletedEventHandler SwitchWebSiteToSharedIPCompleted;
/// <remarks/>
public event DeleteVirtualDirectoryCompletedEventHandler DeleteVirtualDirectoryCompleted;
@ -1252,6 +1205,91 @@ namespace WebsitePanel.EnterpriseServer {
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SwitchWebSiteToDedicatedIP", 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 SwitchWebSiteToDedicatedIP(int siteItemId, int ipAddressId) {
object[] results = this.Invoke("SwitchWebSiteToDedicatedIP", new object[] {
siteItemId,
ipAddressId});
return ((int)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginSwitchWebSiteToDedicatedIP(int siteItemId, int ipAddressId, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("SwitchWebSiteToDedicatedIP", new object[] {
siteItemId,
ipAddressId}, callback, asyncState);
}
/// <remarks/>
public int EndSwitchWebSiteToDedicatedIP(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((int)(results[0]));
}
/// <remarks/>
public void SwitchWebSiteToDedicatedIPAsync(int siteItemId, int ipAddressId) {
this.SwitchWebSiteToDedicatedIPAsync(siteItemId, ipAddressId, null);
}
/// <remarks/>
public void SwitchWebSiteToDedicatedIPAsync(int siteItemId, int ipAddressId, object userState) {
if ((this.SwitchWebSiteToDedicatedIPOperationCompleted == null)) {
this.SwitchWebSiteToDedicatedIPOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSwitchWebSiteToDedicatedIPOperationCompleted);
}
this.InvokeAsync("SwitchWebSiteToDedicatedIP", new object[] {
siteItemId,
ipAddressId}, this.SwitchWebSiteToDedicatedIPOperationCompleted, userState);
}
private void OnSwitchWebSiteToDedicatedIPOperationCompleted(object arg) {
if ((this.SwitchWebSiteToDedicatedIPCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.SwitchWebSiteToDedicatedIPCompleted(this, new SwitchWebSiteToDedicatedIPCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SwitchWebSiteToSharedIP", 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 SwitchWebSiteToSharedIP(int siteItemId) {
object[] results = this.Invoke("SwitchWebSiteToSharedIP", new object[] {
siteItemId});
return ((int)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginSwitchWebSiteToSharedIP(int siteItemId, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("SwitchWebSiteToSharedIP", new object[] {
siteItemId}, callback, asyncState);
}
/// <remarks/>
public int EndSwitchWebSiteToSharedIP(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((int)(results[0]));
}
/// <remarks/>
public void SwitchWebSiteToSharedIPAsync(int siteItemId) {
this.SwitchWebSiteToSharedIPAsync(siteItemId, null);
}
/// <remarks/>
public void SwitchWebSiteToSharedIPAsync(int siteItemId, object userState) {
if ((this.SwitchWebSiteToSharedIPOperationCompleted == null)) {
this.SwitchWebSiteToSharedIPOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSwitchWebSiteToSharedIPOperationCompleted);
}
this.InvokeAsync("SwitchWebSiteToSharedIP", new object[] {
siteItemId}, this.SwitchWebSiteToSharedIPOperationCompleted, userState);
}
private void OnSwitchWebSiteToSharedIPOperationCompleted(object arg) {
if ((this.SwitchWebSiteToSharedIPCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.SwitchWebSiteToSharedIPCompleted(this, new SwitchWebSiteToSharedIPCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/DeleteVirtualDirectory", 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 DeleteVirtualDirectory(int siteItemId, string vdirName) {
@ -4422,6 +4460,58 @@ namespace WebsitePanel.EnterpriseServer {
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void SwitchWebSiteToDedicatedIPCompletedEventHandler(object sender, SwitchWebSiteToDedicatedIPCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class SwitchWebSiteToDedicatedIPCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal SwitchWebSiteToDedicatedIPCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public int Result {
get {
this.RaiseExceptionIfNecessary();
return ((int)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void SwitchWebSiteToSharedIPCompletedEventHandler(object sender, SwitchWebSiteToSharedIPCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class SwitchWebSiteToSharedIPCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal SwitchWebSiteToSharedIPCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public int Result {
get {
this.RaiseExceptionIfNecessary();
return ((int)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void DeleteVirtualDirectoryCompletedEventHandler(object sender, DeleteVirtualDirectoryCompletedEventArgs e);

View file

@ -610,6 +610,107 @@ namespace WebsitePanel.EnterpriseServer
}
}
public static int SwitchWebSiteToDedicatedIP(int siteItemId, int ipAddressId)
{
// check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
if (accountCheck < 0) return accountCheck;
// load web site item
WebSite siteItem = (WebSite)PackageController.GetPackageItem(siteItemId);
if (siteItem == null)
return BusinessErrorCodes.ERROR_WEB_SITE_PACKAGE_ITEM_NOT_FOUND;
// load assigned IP address
IPAddressInfo ip = ServerController.GetIPAddress(ipAddressId);
if (ip == null)
return BusinessErrorCodes.ERROR_WEB_SITE_IP_ADDRESS_NOT_SPECIFIED;
string ipAddr = !String.IsNullOrEmpty(ip.InternalIP) ? ip.InternalIP : ip.ExternalIP;
// place log record
TaskManager.StartTask("WEB_SITE", "SWITCH_TO_DEDICATED_IP", siteItem.Name);
TaskManager.ItemId = siteItemId;
try
{
// get web site pointers
var sitePointers = GetWebSitePointers(siteItemId);
// get existing web site bindings
WebServer web = new WebServer();
ServiceProviderProxy.Init(web, siteItem.ServiceId);
var bindings = web.GetSiteBindings(siteItem.SiteId);
// update site bindings
web.UpdateSiteBindings(siteItem.SiteId, new ServerBinding[] { new ServerBinding(ipAddr, "80", "") });
// update site item
siteItem.SiteIPAddressId = ipAddressId;
PackageController.UpdatePackageItem(siteItem);
// associate IP with web site
if (ipAddressId != 0)
ServerController.AddItemIPAddress(siteItemId, ipAddressId);
// re-create pointers
foreach (var pointer in sitePointers)
DeleteWebSitePointer(siteItemId, pointer.DomainId, false);
foreach (var pointer in sitePointers)
AddWebSitePointer(siteItemId, null, pointer.DomainId, false);
return 0;
}
catch (Exception ex)
{
throw TaskManager.WriteError(ex);
}
finally
{
TaskManager.CompleteTask();
}
}
public static int SwitchWebSiteToSharedIP(int siteItemId)
{
// check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
if (accountCheck < 0) return accountCheck;
// load web site item
WebSite siteItem = (WebSite)PackageController.GetPackageItem(siteItemId);
if (siteItem == null)
return BusinessErrorCodes.ERROR_WEB_SITE_PACKAGE_ITEM_NOT_FOUND;
// place log record
TaskManager.StartTask("WEB_SITE", "SWITCH_TO_SHARED_IP", siteItem.Name);
TaskManager.ItemId = siteItemId;
try
{
// get web site pointers
var sitePointers = GetWebSitePointers(siteItemId);
// get existing web site bindings
WebServer web = new WebServer();
ServiceProviderProxy.Init(web, siteItem.ServiceId);
var bindings = web.GetSiteBindings(siteItem.SiteId);
// TODO
return 0;
}
catch (Exception ex)
{
throw TaskManager.WriteError(ex);
}
finally
{
TaskManager.CompleteTask();
}
}
private static void FillWebServerBindings(List<ServerBinding> bindings, List<GlobalDnsRecord> dnsRecords,
string ipAddr, string hostName, string domainName)
// TODO test if IPv6 works

View file

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

View file

@ -157,6 +157,18 @@ namespace WebsitePanel.EnterpriseServer
return WebServerController.DeleteWebSite(siteItemId);
}
[WebMethod]
public int SwitchWebSiteToDedicatedIP(int siteItemId, int ipAddressId)
{
return WebServerController.SwitchWebSiteToDedicatedIP(siteItemId, ipAddressId);
}
[WebMethod]
public int SwitchWebSiteToSharedIP(int siteItemId)
{
return WebServerController.SwitchWebSiteToSharedIP(siteItemId);
}
[WebMethod]
public int DeleteVirtualDirectory(int siteItemId, string vdirName)
{

View file

@ -5125,9 +5125,6 @@
<data name="ResourceGroup.Lync" xml:space="preserve">
<value>Lync Server</value>
</data>
<data name="Success.UPDATE_LYNC_USER" xml:space="preserve">
<value>General Lync User settings have been successfully updated.</value>
</data>
<data name="Warning.CREATE_LYNC_USER" xml:space="preserve">
<value>Lync User has been successfully created but the following errors have been occured:</value>
</data>
@ -5191,14 +5188,12 @@
<data name="Success.EXCHANGE_STAMPMAILBOXES" xml:space="preserve">
<value>Succesfully stamp mailboxes</value>
</data>
<data name="Error.EXCHANGE_UPDATEPLANS" xml:space="preserve">
<value>Mailbox plan update failed</value>
</data>
<data name="Success.EXCHANGE_UPDATEPLANS" xml:space="preserve">
<value>Mailbox plan updated</value>
</data>
<data name="Error.LYNC_APPLYPLANTEMPLATE" xml:space="preserve">
<value>Failed to apply plans template</value>
</data>
@ -5208,7 +5203,16 @@
<data name="Success.REQUEST_COMPLETED_SUCCESFULLY" xml:space="preserve">
<value>Request Completed Succesfully</value>
</data>
<data name="Error.WEB_SWITCH_TO_DEDICATED_IP" xml:space="preserve">
<value>Error updating web site to dedicated IP</value>
</data>
<data name="Error.WEB_SWITCH_TO_SHARED_IP" xml:space="preserve">
<value>Error updating web site to shared IP</value>
</data>
<data name="Success.WEB_SWITCH_TO_DEDICATED_IP" xml:space="preserve">
<value>Web site has been updated to dedicated IP</value>
</data>
<data name="Success.WEB_SWITCH_TO_SHARED_IP" xml:space="preserve">
<value>Web site has been updated to shared IP</value>
</data>
</root>

View file

@ -112,10 +112,10 @@
<value>2.0</value>
</resheader>
<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 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>
<data name="btnAddFolder.Text" xml:space="preserve">
<value>Add Folder</value>
@ -243,7 +243,7 @@
<data name="gvHeliconApeGroupsName.Header" xml:space="preserve">
<value>.htaccess Groups</value>
</data>
<data name="gvMimeTypes.Empty" xml:space="preserve">
<data name="gvMimeTypes.Empty" xml:space="preserve">
<value>Custom MIME types are not defined</value>
</data>
<data name="gvMimeTypesExtension.Header" xml:space="preserve">
@ -459,4 +459,31 @@ To connect to web site management service please use username and password provi
<data name="WebPublishing.ChooseFtpAccountPrompt" xml:space="preserve">
<value>Choose FTP account...</value>
</data>
<data name="cmdApplyDedicatedIP.OnClientClick" xml:space="preserve">
<value>ShowProgressDialog('Applying changes...');</value>
</data>
<data name="cmdApplyDedicatedIP.Text" xml:space="preserve">
<value>Apply</value>
</data>
<data name="cmdCancelDedicatedIP.Text" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="cmdSwitchToDedicatedIP.Text" xml:space="preserve">
<value>Switch to dedicated IP</value>
</data>
<data name="cmdSwitchToSharedIP.OnClientClick" xml:space="preserve">
<value>if(!confirm('Do you really want to switch this web site to shared IP?')) return false;ShowProgressDialog('Applying changes...');</value>
</data>
<data name="cmdSwitchToSharedIP.Text" xml:space="preserve">
<value>Switch to shared IP</value>
</data>
<data name="locDedicatedIPAddress.Text" xml:space="preserve">
<value>IP address:</value>
</data>
<data name="locSelectIPAddress.Text" xml:space="preserve">
<value>Select IP address:</value>
</data>
<data name="locSharedIPAddress.Text" xml:space="preserve">
<value>IP address: Shared</value>
</data>
</root>

View file

@ -115,18 +115,38 @@
BackgroundCssClass="modalBackground" DropShadow="false" CancelControlID="PubProfileWizardCancelButton" />
<div class="FormBody">
<wsp:SimpleMessageBox id="messageBox" runat="server" EnableViewState="false" />
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<table style="width:100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td valign="top">
<table cellpadding="7" border="0">
<tr>
<td class="Big">
<asp:HyperLink ID="lnkSiteName" runat="server" NavigateUrl="#" Target="_blank">domain.com</asp:HyperLink>
</td>
<td>
<asp:Panel ID="sharedIP" runat="server">
<asp:Localize ID="locSharedIPAddress" runat="server" meta:resourcekey="locSharedIPAddress" Text="IP address: Shared" />
&nbsp;&nbsp;&nbsp;
<asp:LinkButton ID="cmdSwitchToDedicatedIP" meta:resourcekey="cmdSwitchToDedicatedIP" runat="server" Text="Switch to dedicated IP" OnClick="cmdSwitchToDedicatedIP_Click"></asp:LinkButton>
</asp:Panel>
<asp:Panel ID="dedicatedIP" runat="server">
<asp:Localize ID="locDedicatedIPAddress" runat="server" meta:resourcekey="locDedicatedIPAddress" Text="IP address:" />
<asp:Literal ID="litIPAddress" runat="server"></asp:Literal>
&nbsp;&nbsp;&nbsp;
<asp:LinkButton ID="cmdSwitchToSharedIP" meta:resourcekey="cmdSwitchToSharedIP" runat="server" Text="Switch to shared IP" OnClick="cmdSwitchToSharedIP_Click"></asp:LinkButton>
</asp:Panel>
<asp:Panel ID="switchToDedicatedIP" runat="server" Visible="false">
<asp:Localize ID="locSelectIPAddress" runat="server" meta:resourcekey="locSelectIPAddress" Text="Select IP address:" />
<asp:dropdownlist id="ddlIpAddresses" Runat="server" CssClass="NormalTextBox"></asp:dropdownlist>
&nbsp;
<asp:LinkButton ID="cmdApplyDedicatedIP" meta:resourcekey="cmdApplyDedicatedIP" runat="server" Text="Apply" OnClick="cmdApplyDedicatedIP_Click"></asp:LinkButton>
&nbsp;
<asp:LinkButton ID="cmdCancelDedicatedIP" meta:resourcekey="cmdCancelDedicatedIP" runat="server" Text="Cancel" OnClick="cmdCancelDedicatedIP_Click"></asp:LinkButton>
</asp:Panel>
</td>
</tr>
<tr>
<td>
<td colspan="2">
<div class="FormButtonsBar">
<asp:Button ID="btnAddPointer" runat="server" Text="Add Pointer" CssClass="Button2"
meta:resourcekey="btnAddPointer" OnClick="btnAddPointer_Click" />

View file

@ -163,8 +163,29 @@ namespace WebsitePanel.Portal
lnkSiteName.Text = site.Name;
lnkSiteName.NavigateUrl = "http://" + site.Name;
// bind unassigned IP addresses
PackageIPAddress[] ips = ES.Services.Servers.GetPackageUnassignedIPAddresses(site.PackageId, IPAddressPool.WebSites);
foreach (PackageIPAddress ip in ips)
{
string fullIP = ip.ExternalIP;
if (ip.InternalIP != null &&
ip.InternalIP != "" &&
ip.InternalIP != ip.ExternalIP)
fullIP += " (" + ip.InternalIP + ")";
ddlIpAddresses.Items.Add(new ListItem(fullIP, ip.PackageAddressID.ToString()));
}
bool isDedicatedIP = false;
if (!String.IsNullOrEmpty(site.SiteIPAddress))
litIPAddress.Text = String.Format("({0})", site.SiteIPAddress);
{
litIPAddress.Text = site.SiteIPAddress;
isDedicatedIP = true;
}
dedicatedIP.Visible = isDedicatedIP;
sharedIP.Visible = !isDedicatedIP;
cmdSwitchToDedicatedIP.Visible = (ddlIpAddresses.Items.Count > 0);
litFrontPageUnavailable.Visible = false;
@ -981,5 +1002,74 @@ namespace WebsitePanel.Portal
PortalUtils.SPACE_ID_PARAM + "=" + PanelSecurity.PackageId.ToString()));
}
#endregion
protected void cmdSwitchToDedicatedIP_Click(object sender, EventArgs e)
{
sharedIP.Visible = false;
switchToDedicatedIP.Visible = true;
}
protected void cmdSwitchToSharedIP_Click(object sender, EventArgs e)
{
// call web service
try
{
int result = ES.Services.WebServers.SwitchWebSiteToSharedIP(PanelRequest.ItemID);
if (result < 0)
{
ShowResultMessage(result);
return;
}
ShowSuccessMessage("WEB_SWITCH_TO_SHARED_IP");
}
catch (Exception ex)
{
ShowErrorMessage("WEB_SWITCH_TO_SHARED_IP", ex);
return;
}
// rebind
BindWebSite();
}
protected void cmdApplyDedicatedIP_Click(object sender, EventArgs e)
{
// call web service
try
{
int addressId = Int32.Parse(ddlIpAddresses.SelectedValue);
int result = ES.Services.WebServers.SwitchWebSiteToDedicatedIP(PanelRequest.ItemID, addressId);
if (result < 0)
{
ShowResultMessage(result);
return;
}
ShowSuccessMessage("WEB_SWITCH_TO_DEDICATED_IP");
}
catch (Exception ex)
{
ShowErrorMessage("WEB_SWITCH_TO_DEDICATED_IP", ex);
return;
}
// rebind
HideDedicatedIPPanel();
BindWebSite();
}
protected void cmdCancelDedicatedIP_Click(object sender, EventArgs e)
{
HideDedicatedIPPanel();
}
private void HideDedicatedIPPanel()
{
switchToDedicatedIP.Visible = false;
sharedIP.Visible = true;
}
}
}

View file

@ -192,6 +192,51 @@ namespace WebsitePanel.Portal {
/// </remarks>
protected global::System.Web.UI.WebControls.HyperLink lnkSiteName;
/// <summary>
/// sharedIP 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 sharedIP;
/// <summary>
/// locSharedIPAddress 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.Localize locSharedIPAddress;
/// <summary>
/// cmdSwitchToDedicatedIP 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.LinkButton cmdSwitchToDedicatedIP;
/// <summary>
/// dedicatedIP 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 dedicatedIP;
/// <summary>
/// locDedicatedIPAddress 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.Localize locDedicatedIPAddress;
/// <summary>
/// litIPAddress control.
/// </summary>
@ -201,6 +246,60 @@ namespace WebsitePanel.Portal {
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litIPAddress;
/// <summary>
/// cmdSwitchToSharedIP 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.LinkButton cmdSwitchToSharedIP;
/// <summary>
/// switchToDedicatedIP 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 switchToDedicatedIP;
/// <summary>
/// locSelectIPAddress 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.Localize locSelectIPAddress;
/// <summary>
/// ddlIpAddresses 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 ddlIpAddresses;
/// <summary>
/// cmdApplyDedicatedIP 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.LinkButton cmdApplyDedicatedIP;
/// <summary>
/// cmdCancelDedicatedIP 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.LinkButton cmdCancelDedicatedIP;
/// <summary>
/// btnAddPointer control.
/// </summary>