Added global phone list
This commit is contained in:
parent
f17301bfc1
commit
7e8b3cce52
46 changed files with 3667 additions and 169 deletions
|
@ -0,0 +1,71 @@
|
|||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AllocatePackagePhoneNumbers.ascx.cs" Inherits="WebsitePanel.Portal.UserControls.AllocatePackagePhoneNumbers" %>
|
||||
<%@ Register Src="SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %>
|
||||
|
||||
|
||||
<wsp:SimpleMessageBox id="messageBox" runat="server" />
|
||||
|
||||
<asp:ValidationSummary ID="validatorsSummary" runat="server"
|
||||
ValidationGroup="AddAddress" ShowMessageBox="True" ShowSummary="False" />
|
||||
|
||||
<ul id="ErrorMessagesList" runat="server" visible="false">
|
||||
<li id="EmptyAddressesMessage" runat="server">
|
||||
<asp:Localize ID="locNotEnoughAddresses" runat="server" Text="Not enough..." meta:resourcekey="locNotEnoughAddresses"></asp:Localize>
|
||||
</li>
|
||||
<li id="QuotaReachedMessage" runat="server">
|
||||
<asp:Localize ID="locQuotaReached" runat="server" Text="Quota reached..." meta:resourcekey="locQuotaReached"></asp:Localize>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<asp:UpdatePanel runat="server" ID="AddressesTable" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<table cellspacing="5" style="width: 100%;">
|
||||
<tr>
|
||||
<td>
|
||||
<asp:RadioButton ID="radioExternalRandom" runat="server" AutoPostBack="true"
|
||||
meta:resourcekey="radioExternalRandom" Text="Randomly select phone Numbers from the pool"
|
||||
Checked="True" GroupName="ExternalAddress"
|
||||
oncheckedchanged="radioExternalRandom_CheckedChanged" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="AddressesNumberRow" runat="server">
|
||||
<td style="padding-left: 30px;">
|
||||
<asp:Localize ID="locExternalAddresses" runat="server"
|
||||
meta:resourcekey="locExternalAddresses" Text="Number of Phone Numbers:"></asp:Localize>
|
||||
|
||||
<asp:TextBox ID="txtExternalAddressesNumber" runat="server" CssClass="NormalTextBox" Width="50"></asp:TextBox>
|
||||
|
||||
<asp:RequiredFieldValidator ID="ExternalAddressesValidator" runat="server" Text="*" Display="Dynamic"
|
||||
ControlToValidate="txtExternalAddressesNumber" meta:resourcekey="ExternalAddressesValidator" SetFocusOnError="true"
|
||||
ValidationGroup="AddAddress">*</asp:RequiredFieldValidator>
|
||||
|
||||
<asp:Literal ID="litMaxAddresses" runat="server"></asp:Literal>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<asp:RadioButton ID="radioExternalSelected" runat="server" AutoPostBack="true"
|
||||
meta:resourcekey="radioExternalSelected" Text="Select PHone Number from the list"
|
||||
GroupName="ExternalAddress"
|
||||
oncheckedchanged="radioExternalSelected_CheckedChanged" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="AddressesListRow" runat="server">
|
||||
<td style="padding-left: 30px;">
|
||||
<asp:ListBox ID="listExternalAddresses" SelectionMode="Multiple" runat="server" Rows="8"
|
||||
CssClass="NormalTextBox" Width="220" style="height:100px;" ></asp:ListBox>
|
||||
<br />
|
||||
<asp:Localize ID="locHoldCtrl" runat="server"
|
||||
meta:resourcekey="locHoldCtrl" Text="* Hold CTRL key to select multiple phone numbers" ></asp:Localize>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
<p>
|
||||
<asp:Button ID="btnAdd" runat="server" meta:resourcekey="btnAdd"
|
||||
ValidationGroup="AddAddress" Text="Add" CssClass="Button1"
|
||||
onclick="btnAdd_Click" />
|
||||
<asp:Button ID="btnCancel" runat="server" meta:resourcekey="btnCancel"
|
||||
CausesValidation="false" Text="Cancel" CssClass="Button1"
|
||||
onclick="btnCancel_Click" />
|
||||
</p>
|
|
@ -0,0 +1,174 @@
|
|||
// 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.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using WebsitePanel.EnterpriseServer;
|
||||
using WebsitePanel.Providers.Common;
|
||||
|
||||
namespace WebsitePanel.Portal.UserControls
|
||||
{
|
||||
public partial class AllocatePackagePhoneNumbers : WebsitePanelControlBase
|
||||
{
|
||||
private IPAddressPool pool;
|
||||
public IPAddressPool Pool
|
||||
{
|
||||
get { return pool; }
|
||||
set { pool = value; }
|
||||
}
|
||||
|
||||
private string listAddressesControl;
|
||||
public string ListAddressesControl
|
||||
{
|
||||
get { return listAddressesControl; }
|
||||
set { listAddressesControl = value; }
|
||||
}
|
||||
|
||||
private string resourceGroup;
|
||||
public string ResourceGroup
|
||||
{
|
||||
get { return resourceGroup; }
|
||||
set { resourceGroup = value; }
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
BindIPAddresses();
|
||||
ToggleControls();
|
||||
}
|
||||
}
|
||||
|
||||
private void BindIPAddresses()
|
||||
{
|
||||
bool vps = (Pool == IPAddressPool.VpsExternalNetwork || Pool == IPAddressPool.VpsManagementNetwork);
|
||||
|
||||
// bind list
|
||||
IPAddressInfo[] ips = ES.Services.Servers.GetUnallottedIPAddresses(PanelSecurity.PackageId, ResourceGroup, Pool);
|
||||
foreach (IPAddressInfo ip in ips)
|
||||
{
|
||||
string txt = ip.ExternalIP;
|
||||
|
||||
// web sites - NAT Address
|
||||
if (!vps && !String.IsNullOrEmpty(ip.InternalIP))
|
||||
txt += "/" + ip.InternalIP;
|
||||
|
||||
// VPS - Gateway Address
|
||||
else if (vps && !String.IsNullOrEmpty(ip.DefaultGateway))
|
||||
txt += "/" + ip.DefaultGateway;
|
||||
|
||||
listExternalAddresses.Items.Add(new ListItem(txt, ip.AddressId.ToString()));
|
||||
}
|
||||
|
||||
int quotaAllowed = -1;
|
||||
string quotaName = (String.Compare(ResourceGroup, ResourceGroups.VPS, true) == 0) ? Quotas.VPS_EXTERNAL_IP_ADDRESSES_NUMBER : Quotas.WEB_IP_ADDRESSES;
|
||||
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
|
||||
if (cntx.Quotas.ContainsKey(quotaName))
|
||||
{
|
||||
int quotaAllocated = cntx.Quotas[quotaName].QuotaAllocatedValue;
|
||||
int quotaUsed = cntx.Quotas[quotaName].QuotaUsedValue;
|
||||
|
||||
if (quotaAllocated != -1)
|
||||
quotaAllowed = quotaAllocated - quotaUsed;
|
||||
}
|
||||
|
||||
// bind controls
|
||||
int max = quotaAllowed == -1 ? listExternalAddresses.Items.Count : quotaAllowed;
|
||||
|
||||
txtExternalAddressesNumber.Text = max.ToString();
|
||||
litMaxAddresses.Text = String.Format(GetLocalizedString("litMaxAddresses.Text"), max);
|
||||
|
||||
if (max == 0)
|
||||
{
|
||||
AddressesTable.Visible = false;
|
||||
ErrorMessagesList.Visible = true;
|
||||
EmptyAddressesMessage.Visible = (listExternalAddresses.Items.Count == 0);
|
||||
QuotaReachedMessage.Visible = (quotaAllowed == 0);
|
||||
btnAdd.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<int> ids = new List<int>();
|
||||
foreach (ListItem item in listExternalAddresses.Items)
|
||||
{
|
||||
if (item.Selected)
|
||||
ids.Add(Utils.ParseInt(item.Value));
|
||||
}
|
||||
|
||||
ResultObject res = ES.Services.Servers.AllocatePackageIPAddresses(PanelSecurity.PackageId,
|
||||
ResourceGroup, Pool,
|
||||
radioExternalRandom.Checked,
|
||||
Utils.ParseInt(txtExternalAddressesNumber.Text),
|
||||
ids.ToArray());
|
||||
if (res.IsSuccess)
|
||||
{
|
||||
// return back
|
||||
Response.Redirect(HostModule.EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), ListAddressesControl));
|
||||
}
|
||||
else
|
||||
{
|
||||
// show message
|
||||
messageBox.ShowMessage(res, "VPS_ALLOCATE_EXTERNAL_ADDRESSES_ERROR", "VPS");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
messageBox.ShowErrorMessage("VPS_ALLOCATE_EXTERNAL_ADDRESSES_ERROR", ex);
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Response.Redirect(HostModule.EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), ListAddressesControl));
|
||||
}
|
||||
|
||||
protected void radioExternalSelected_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
ToggleControls();
|
||||
}
|
||||
|
||||
private void ToggleControls()
|
||||
{
|
||||
AddressesNumberRow.Visible = radioExternalRandom.Checked;
|
||||
AddressesListRow.Visible = radioExternalSelected.Checked;
|
||||
}
|
||||
|
||||
protected void radioExternalRandom_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
ToggleControls();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,215 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WebsitePanel.Portal.UserControls {
|
||||
|
||||
|
||||
public partial class AllocatePackagePhoneNumbers {
|
||||
|
||||
/// <summary>
|
||||
/// messageBox control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
|
||||
/// </remarks>
|
||||
protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox;
|
||||
|
||||
/// <summary>
|
||||
/// validatorsSummary 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.ValidationSummary validatorsSummary;
|
||||
|
||||
/// <summary>
|
||||
/// ErrorMessagesList control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlGenericControl ErrorMessagesList;
|
||||
|
||||
/// <summary>
|
||||
/// EmptyAddressesMessage control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlGenericControl EmptyAddressesMessage;
|
||||
|
||||
/// <summary>
|
||||
/// locNotEnoughAddresses 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 locNotEnoughAddresses;
|
||||
|
||||
/// <summary>
|
||||
/// QuotaReachedMessage control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlGenericControl QuotaReachedMessage;
|
||||
|
||||
/// <summary>
|
||||
/// locQuotaReached 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 locQuotaReached;
|
||||
|
||||
/// <summary>
|
||||
/// AddressesTable control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.UpdatePanel AddressesTable;
|
||||
|
||||
/// <summary>
|
||||
/// radioExternalRandom 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.RadioButton radioExternalRandom;
|
||||
|
||||
/// <summary>
|
||||
/// AddressesNumberRow control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlTableRow AddressesNumberRow;
|
||||
|
||||
/// <summary>
|
||||
/// locExternalAddresses 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 locExternalAddresses;
|
||||
|
||||
/// <summary>
|
||||
/// txtExternalAddressesNumber 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 txtExternalAddressesNumber;
|
||||
|
||||
/// <summary>
|
||||
/// ExternalAddressesValidator 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 ExternalAddressesValidator;
|
||||
|
||||
/// <summary>
|
||||
/// litMaxAddresses 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.Literal litMaxAddresses;
|
||||
|
||||
/// <summary>
|
||||
/// radioExternalSelected 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.RadioButton radioExternalSelected;
|
||||
|
||||
/// <summary>
|
||||
/// AddressesListRow control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlTableRow AddressesListRow;
|
||||
|
||||
/// <summary>
|
||||
/// listExternalAddresses 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.ListBox listExternalAddresses;
|
||||
|
||||
/// <summary>
|
||||
/// locHoldCtrl 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 locHoldCtrl;
|
||||
|
||||
/// <summary>
|
||||
/// btnAdd 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.Button btnAdd;
|
||||
|
||||
/// <summary>
|
||||
/// btnCancel 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.Button btnCancel;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,153 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="btnAdd.Text" xml:space="preserve">
|
||||
<value>Add</value>
|
||||
</data>
|
||||
<data name="btnCancel.Text" xml:space="preserve">
|
||||
<value>Cancel</value>
|
||||
</data>
|
||||
<data name="ExternalAddressesValidator.ErrorMessage" xml:space="preserve">
|
||||
<value>Enter the number of Phone Numbers</value>
|
||||
</data>
|
||||
<data name="litMaxAddresses.Text" xml:space="preserve">
|
||||
<value>({0} max)</value>
|
||||
</data>
|
||||
<data name="locExternalAddresses.Text" xml:space="preserve">
|
||||
<value>Number of Phone Numbers:</value>
|
||||
</data>
|
||||
<data name="locHoldCtrl.Text" xml:space="preserve">
|
||||
<value>* Hold CTRL key to select multiple phone numbers</value>
|
||||
</data>
|
||||
<data name="locNotEnoughAddresses.Text" xml:space="preserve">
|
||||
<value>The pool of Phone Numbers is empty.<br/>Allocate more Phone Numbers on reseller level. If the current hosting space is nested within "System" space then add more server Phone Numbers to the appropriate pool on "Configuration -> Phone Numbers" page.</value>
|
||||
</data>
|
||||
<data name="locTitle.Text" xml:space="preserve">
|
||||
<value>Allocate Phone Numbers</value>
|
||||
</data>
|
||||
<data name="radioExternalRandom.Text" xml:space="preserve">
|
||||
<value>Randomly select Phone Numbers from the pool</value>
|
||||
</data>
|
||||
<data name="radioExternalSelected.Text" xml:space="preserve">
|
||||
<value>Select Phone Numbers from the list</value>
|
||||
</data>
|
||||
<data name="locQuotaReached.Text" xml:space="preserve">
|
||||
<value>Phone Numbers quota has been reached.</value>
|
||||
</data>
|
||||
</root>
|
|
@ -0,0 +1,165 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="btnAllocateAddress.Text" xml:space="preserve">
|
||||
<value>Allocate...</value>
|
||||
</data>
|
||||
<data name="btnDeallocateAddresses.Text" xml:space="preserve">
|
||||
<value>Deallocate Selected</value>
|
||||
</data>
|
||||
<data name="gvAddresses.Empty" xml:space="preserve">
|
||||
<value>No Phone Numbers have been allocated to this hosting space.</value>
|
||||
</data>
|
||||
<data name="gvAddressesDefaultGateway.HeaderText" xml:space="preserve">
|
||||
<value>Gateway</value>
|
||||
</data>
|
||||
<data name="gvAddressesIPAddress.HeaderText" xml:space="preserve">
|
||||
<value>Phone Numbers</value>
|
||||
</data>
|
||||
<data name="gvAddressesItemName.HeaderText" xml:space="preserve">
|
||||
<value>Item Name</value>
|
||||
</data>
|
||||
<data name="gvAddressesPrimary.HeaderText" xml:space="preserve">
|
||||
<value>Primary</value>
|
||||
</data>
|
||||
<data name="gvAddressesSpace.HeaderText" xml:space="preserve">
|
||||
<value>Space</value>
|
||||
</data>
|
||||
<data name="gvAddressesSubnetMask.HeaderText" xml:space="preserve">
|
||||
<value>Subnet Mask</value>
|
||||
</data>
|
||||
<data name="gvAddressesUser.HeaderText" xml:space="preserve">
|
||||
<value>User</value>
|
||||
</data>
|
||||
<data name="SearchField.DefaultGateway" xml:space="preserve">
|
||||
<value>Default Gateway</value>
|
||||
</data>
|
||||
<data name="SearchField.IPAddress" xml:space="preserve">
|
||||
<value>Phone Numbers</value>
|
||||
</data>
|
||||
<data name="SearchField.ItemName" xml:space="preserve">
|
||||
<value>Item Name</value>
|
||||
</data>
|
||||
<data name="SearchField.Username" xml:space="preserve">
|
||||
<value>User Name</value>
|
||||
</data>
|
||||
<data name="btnDeallocateAddresses.OnClientClick" xml:space="preserve">
|
||||
<value>return confirm('Deallocate selected Phone Numbers from hosting space?');</value>
|
||||
</data>
|
||||
</root>
|
|
@ -0,0 +1,87 @@
|
|||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="PackagePhoneNumbers.ascx.cs" Inherits="WebsitePanel.Portal.UserControls.PackagePhoneNumbers" %>
|
||||
<%@ Register Src="SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %>
|
||||
<%@ Register Src="SearchBox.ascx" TagName="SearchBox" TagPrefix="wsp" %>
|
||||
|
||||
|
||||
<script language="javascript">
|
||||
function SelectAllCheckboxes(box) {
|
||||
var state = box.checked;
|
||||
var elm = box.parentElement.parentElement.parentElement.parentElement.getElementsByTagName("INPUT");
|
||||
for (i = 0; i < elm.length; i++)
|
||||
if (elm[i].type == "checkbox" && elm[i].id != box.id && elm[i].checked != state && !elm[i].disabled)
|
||||
elm[i].checked = state;
|
||||
}
|
||||
</script>
|
||||
|
||||
<wsp:SimpleMessageBox id="messageBox" runat="server" />
|
||||
|
||||
<div class="FormButtonsBarClean">
|
||||
<div class="FormButtonsBarCleanLeft">
|
||||
<asp:Button ID="btnAllocateAddress" runat="server" meta:resourcekey="btnAllocateAddress"
|
||||
Text="Allocate IP Addresses" CssClass="Button1" CausesValidation="False"
|
||||
onclick="btnAllocateAddress_Click" />
|
||||
</div>
|
||||
<div class="FormButtonsBarCleanRight">
|
||||
<wsp:SearchBox ID="searchBox" runat="server" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<asp:GridView ID="gvAddresses" runat="server" AutoGenerateColumns="False"
|
||||
Width="100%" EmptyDataText="gvAddresses" CssSelectorClass="NormalGridView"
|
||||
AllowPaging="True" AllowSorting="True" DataSourceID="odsExternalAddressesPaged"
|
||||
onrowdatabound="gvAddresses_RowDataBound" DataKeyNames="PackageAddressID" >
|
||||
<Columns>
|
||||
<asp:TemplateField>
|
||||
<HeaderTemplate>
|
||||
<asp:CheckBox ID="chkSelectAll" runat="server" onclick="javascript:SelectAllCheckboxes(this);" />
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:CheckBox ID="chkSelect" runat="server" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
<asp:BoundField HeaderText="gvAddressesIPAddress" meta:resourcekey="gvAddressesIPAddress"
|
||||
DataField="ExternalIP" SortExpression="ExternalIP" />
|
||||
|
||||
<asp:TemplateField HeaderText="gvAddressesItemName" meta:resourcekey="gvAddressesItemName" SortExpression="ItemName">
|
||||
<ItemTemplate>
|
||||
<asp:hyperlink id="lnkEdit" runat="server" NavigateUrl='<%# GetItemEditUrl(Eval("ItemID").ToString()) %>'>
|
||||
<%# Eval("ItemName") %>
|
||||
</asp:hyperlink>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
<asp:TemplateField HeaderText="gvAddressesSpace" meta:resourcekey="gvAddressesSpace" SortExpression="PackageName" >
|
||||
<ItemTemplate>
|
||||
<asp:hyperlink id="lnkSpace" runat="server" NavigateUrl='<%# GetSpaceHomeUrl(Eval("PackageID").ToString()) %>'>
|
||||
<%# Eval("PackageName") %>
|
||||
</asp:hyperlink>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="gvAddressesUser" meta:resourcekey="gvAddressesUser" SortExpression="Username" >
|
||||
<ItemTemplate>
|
||||
<%# Eval("UserName") %>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
<asp:ObjectDataSource ID="odsExternalAddressesPaged" runat="server" EnablePaging="True"
|
||||
SelectCountMethod="GetPackageIPAddressesCount"
|
||||
SelectMethod="GetPackageIPAddresses"
|
||||
SortParameterName="sortColumn"
|
||||
TypeName="WebsitePanel.Portal.VirtualMachinesHelper"
|
||||
OnSelected="odsExternalAddressesPaged_Selected"
|
||||
onselecting="odsExternalAddressesPaged_Selecting">
|
||||
<SelectParameters>
|
||||
<asp:QueryStringParameter Name="packageId" QueryStringField="SpaceID" DefaultValue="0" />
|
||||
<asp:Parameter Name="pool" DefaultValue="0" />
|
||||
<asp:ControlParameter Name="filterColumn" ControlID="searchBox" PropertyName="FilterColumn" />
|
||||
<asp:ControlParameter Name="filterValue" ControlID="searchBox" PropertyName="FilterValue" />
|
||||
</SelectParameters>
|
||||
</asp:ObjectDataSource>
|
||||
|
||||
<div style="margin-top:4px;">
|
||||
<asp:Button ID="btnDeallocateAddresses" runat="server" meta:resourcekey="btnDeallocateAddresses"
|
||||
Text="Deallocate selected" CssClass="SmallButton" CausesValidation="False"
|
||||
onclick="btnDeallocateAddresses_Click" />
|
||||
</div>
|
|
@ -0,0 +1,172 @@
|
|||
// 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.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using WebsitePanel.EnterpriseServer;
|
||||
using WebsitePanel.Providers.Common;
|
||||
|
||||
namespace WebsitePanel.Portal.UserControls
|
||||
{
|
||||
public partial class PackagePhoneNumbers : WebsitePanelControlBase
|
||||
{
|
||||
private bool spaceOwner;
|
||||
|
||||
private IPAddressPool pool;
|
||||
public IPAddressPool Pool
|
||||
{
|
||||
get { return pool; }
|
||||
set { pool = value; }
|
||||
}
|
||||
|
||||
private string editItemControl;
|
||||
public string EditItemControl
|
||||
{
|
||||
get { return editItemControl; }
|
||||
set { editItemControl = value; }
|
||||
}
|
||||
|
||||
private string spaceHomeControl;
|
||||
public string SpaceHomeControl
|
||||
{
|
||||
get { return spaceHomeControl; }
|
||||
set { spaceHomeControl = value; }
|
||||
}
|
||||
|
||||
private string allocateAddressesControl;
|
||||
public string AllocateAddressesControl
|
||||
{
|
||||
get { return allocateAddressesControl; }
|
||||
set { allocateAddressesControl = value; }
|
||||
}
|
||||
|
||||
public bool ManageAllowed
|
||||
{
|
||||
get { return ViewState["ManageAllowed"] != null ? (bool)ViewState["ManageAllowed"] : false; }
|
||||
set { ViewState["ManageAllowed"] = value; }
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
searchBox.AddCriteria("ExternalIP", GetLocalizedString("SearchField.IPAddress"));
|
||||
searchBox.AddCriteria("ItemName", GetLocalizedString("SearchField.ItemName"));
|
||||
searchBox.AddCriteria("Username", GetLocalizedString("SearchField.Username"));
|
||||
}
|
||||
|
||||
bool isUserSelected = PanelSecurity.SelectedUser.Role == WebsitePanel.EnterpriseServer.UserRole.User;
|
||||
bool isUserLogged = PanelSecurity.EffectiveUser.Role == WebsitePanel.EnterpriseServer.UserRole.User;
|
||||
spaceOwner = PanelSecurity.EffectiveUserId == PanelSecurity.SelectedUserId;
|
||||
|
||||
gvAddresses.Columns[3].Visible = !isUserSelected; // space
|
||||
gvAddresses.Columns[4].Visible = !isUserSelected; // user
|
||||
|
||||
// managing external network permissions
|
||||
gvAddresses.Columns[0].Visible = !isUserLogged && ManageAllowed;
|
||||
btnAllocateAddress.Visible = !isUserLogged && !spaceOwner && ManageAllowed && !String.IsNullOrEmpty(AllocateAddressesControl);
|
||||
btnDeallocateAddresses.Visible = !isUserLogged && ManageAllowed;
|
||||
}
|
||||
|
||||
public string GetItemEditUrl(string itemID)
|
||||
{
|
||||
return HostModule.EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), EditItemControl,
|
||||
"ItemID=" + itemID);
|
||||
}
|
||||
|
||||
public string GetSpaceHomeUrl(string spaceId)
|
||||
{
|
||||
return HostModule.EditUrl("SpaceID", spaceId, SpaceHomeControl);
|
||||
}
|
||||
|
||||
protected void odsExternalAddressesPaged_Selected(object sender, ObjectDataSourceStatusEventArgs e)
|
||||
{
|
||||
if (e.Exception != null)
|
||||
{
|
||||
messageBox.ShowErrorMessage("EXCHANGE_GET_MAILBOXES", e.Exception);
|
||||
e.ExceptionHandled = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnAllocateAddress_Click(object sender, EventArgs e)
|
||||
{
|
||||
Response.Redirect(HostModule.EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), AllocateAddressesControl));
|
||||
}
|
||||
|
||||
protected void gvAddresses_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
PackageIPAddress item = e.Row.DataItem as PackageIPAddress;
|
||||
if (item != null)
|
||||
{
|
||||
// checkbox
|
||||
CheckBox chkSelect = e.Row.FindControl("chkSelect") as CheckBox;
|
||||
chkSelect.Enabled = (!spaceOwner || (PanelSecurity.PackageId != item.PackageId)) && item.ItemId == 0;
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnDeallocateAddresses_Click(object sender, EventArgs e)
|
||||
{
|
||||
List<int> ids = new List<int>();
|
||||
|
||||
try
|
||||
{
|
||||
List<int> items = new List<int>();
|
||||
for (int i = 0; i < gvAddresses.Rows.Count; i++)
|
||||
{
|
||||
GridViewRow row = gvAddresses.Rows[i];
|
||||
CheckBox chkSelect = (CheckBox)row.FindControl("chkSelect");
|
||||
if (chkSelect.Checked)
|
||||
items.Add((int)gvAddresses.DataKeys[i].Value);
|
||||
}
|
||||
|
||||
// check if at least one is selected
|
||||
if (items.Count == 0)
|
||||
{
|
||||
messageBox.ShowWarningMessage("PHONE_EDIT_LIST_EMPTY_ERROR");
|
||||
return;
|
||||
}
|
||||
|
||||
ResultObject res = ES.Services.Servers.DeallocatePackageIPAddresses(PanelSecurity.PackageId, items.ToArray());
|
||||
messageBox.ShowMessage(res, "DEALLOCATE_SPACE_PHONE_NUMBER", "VPS");
|
||||
gvAddresses.DataBind();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
messageBox.ShowErrorMessage("DEALLOCATE_SPACE_PHONE_NUMBER", ex);
|
||||
}
|
||||
}
|
||||
|
||||
protected void odsExternalAddressesPaged_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
|
||||
{
|
||||
e.InputParameters["pool"] = Pool;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WebsitePanel.Portal.UserControls {
|
||||
|
||||
|
||||
public partial class PackagePhoneNumbers {
|
||||
|
||||
/// <summary>
|
||||
/// messageBox control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
|
||||
/// </remarks>
|
||||
protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox;
|
||||
|
||||
/// <summary>
|
||||
/// btnAllocateAddress 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.Button btnAllocateAddress;
|
||||
|
||||
/// <summary>
|
||||
/// searchBox control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
|
||||
/// </remarks>
|
||||
protected global::WebsitePanel.Portal.SearchBox searchBox;
|
||||
|
||||
/// <summary>
|
||||
/// gvAddresses 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.GridView gvAddresses;
|
||||
|
||||
/// <summary>
|
||||
/// odsExternalAddressesPaged 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.ObjectDataSource odsExternalAddressesPaged;
|
||||
|
||||
/// <summary>
|
||||
/// btnDeallocateAddresses 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.Button btnDeallocateAddresses;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue