DNS SRV Record support. Only supported with MS DNS Provider
This commit is contained in:
parent
a327e27e15
commit
452fcb7f47
28 changed files with 6890 additions and 4002 deletions
|
@ -1,15 +1,13 @@
|
|||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DnsZoneRecords.ascx.cs" Inherits="WebsitePanel.Portal.DnsZoneRecords" %>
|
||||
<%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport"
|
||||
TagPrefix="wsp" %>
|
||||
<%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %>
|
||||
|
||||
<wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server" />
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function confirmation()
|
||||
{
|
||||
if (!confirm('Are you sure you want to delete this DNS Zone Record?')) return false; else ShowProgressDialog('Deleting DNS Zone Record...');
|
||||
}
|
||||
function confirmation() {
|
||||
if (!confirm('Are you sure you want to delete this DNS Zone Record?')) return false; else ShowProgressDialog('Deleting DNS Zone Record...');
|
||||
}
|
||||
</script>
|
||||
<asp:Panel ID="pnlRecords" runat="server">
|
||||
<div class="FormBody">
|
||||
|
@ -33,6 +31,9 @@ function confirmation()
|
|||
<asp:Literal ID="litRecordName" runat="server" Text='<%# Eval("RecordName") %>' Visible="false"></asp:Literal>
|
||||
<asp:Literal ID="litRecordType" runat="server" Text='<%# Eval("RecordType") %>' Visible="false"></asp:Literal>
|
||||
<asp:Literal ID="litRecordData" runat="server" Text='<%# Eval("RecordData") %>' Visible="false"></asp:Literal>
|
||||
<asp:Literal ID="litSrvPriority" runat="server" Text='<%# Eval("SrvPriority") %>' Visible="false"></asp:Literal>
|
||||
<asp:Literal ID="litSrvWeight" runat="server" Text='<%# Eval("SrvWeight") %>' Visible="false"></asp:Literal>
|
||||
<asp:Literal ID="litSrvPort" runat="server" Text='<%# Eval("SrvPort") %>' Visible="false"></asp:Literal>
|
||||
</ItemTemplate>
|
||||
<ItemStyle CssClass="NormalBold" Wrap="False" />
|
||||
</asp:TemplateField>
|
||||
|
@ -41,7 +42,7 @@ function confirmation()
|
|||
<asp:TemplateField SortExpression="RecordData" HeaderText="gvRecordsData" >
|
||||
<ItemStyle Width="100%" />
|
||||
<ItemTemplate>
|
||||
<%# GetRecordFullData((string)Eval("RecordType"), (string)Eval("RecordData"), (int)Eval("MxPriority")) %>
|
||||
<%# GetRecordFullData((string)Eval("RecordType"), (string)Eval("RecordData"), (int)Eval("MxPriority"), (int)Eval("SrvPort"))%>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField>
|
||||
|
@ -77,6 +78,7 @@ function confirmation()
|
|||
<asp:ListItem>NS</asp:ListItem>
|
||||
<asp:ListItem>TXT</asp:ListItem>
|
||||
<asp:ListItem>CNAME</asp:ListItem>
|
||||
<asp:ListItem>SRV</asp:ListItem>
|
||||
</asp:DropDownList><asp:Literal ID="litRecordType" runat="server"></asp:Literal>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -106,10 +108,43 @@ function confirmation()
|
|||
<asp:RegularExpressionValidator ID="valRequireCorrectPriority" runat="server" ControlToValidate="txtMXPriority"
|
||||
ErrorMessage="*" ValidationExpression="\d{1,3}"></asp:RegularExpressionValidator></td>
|
||||
</tr>
|
||||
|
||||
<tr id="rowSRVPriority" runat="server">
|
||||
<td class="SubHead"><asp:Label ID="lblSRVPriority" runat="server" meta:resourcekey="lblSRVPriority" Text="Priority:"></asp:Label></td>
|
||||
<td class="NormalBold">
|
||||
<asp:TextBox ID="txtSRVPriority" runat="server" Width="30" CssClass="NormalTextBox"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="valRequireSrvPriority" runat="server" ControlToValidate="txtSRVPriority"
|
||||
ErrorMessage="*" ValidationGroup="DnsZoneRecord" Display="Dynamic"></asp:RequiredFieldValidator>
|
||||
<asp:RegularExpressionValidator ID="valRequireCorrectSrvPriority" runat="server" ControlToValidate="txtSRVPriority"
|
||||
ErrorMessage="*" ValidationExpression="\d{1,3}"></asp:RegularExpressionValidator></td>
|
||||
</tr>
|
||||
|
||||
<tr id="rowSRVWeight" runat="server">
|
||||
<td class="SubHead"><asp:Label ID="lblSRVWeight" runat="server" meta:resourcekey="lblSRVWeight" Text="Weight:"></asp:Label></td>
|
||||
<td class="NormalBold">
|
||||
<asp:TextBox ID="txtSRVWeight" runat="server" Width="30" CssClass="NormalTextBox"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="valRequireSrvWeight" runat="server" ControlToValidate="txtSRVWeight"
|
||||
ErrorMessage="*" ValidationGroup="DnsZoneRecord" Display="Dynamic"></asp:RequiredFieldValidator>
|
||||
<asp:RegularExpressionValidator ID="valRequireCorrectSrvWeight" runat="server" ControlToValidate="txtSRVWeight"
|
||||
ErrorMessage="*" ValidationExpression="\d{1,3}"></asp:RegularExpressionValidator></td>
|
||||
</tr>
|
||||
|
||||
<tr id="rowSRVPort" runat="server">
|
||||
<td class="SubHead"><asp:Label ID="lblSRVPort" runat="server" meta:resourcekey="lblSRVPort" Text="Port Number:"></asp:Label></td>
|
||||
<td class="NormalBold">
|
||||
<asp:TextBox ID="txtSRVPort" runat="server" Width="30" CssClass="NormalTextBox"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="valRequireSrvPort" runat="server" ControlToValidate="txtSRVPort"
|
||||
ErrorMessage="*" ValidationGroup="DnsZoneRecord" Display="Dynamic"></asp:RequiredFieldValidator>
|
||||
<asp:RegularExpressionValidator ID="valRequireCorrectSrvPort" runat="server" ControlToValidate="txtSRVPort"
|
||||
ErrorMessage="*" ValidationExpression="\d{1,3}"></asp:RegularExpressionValidator></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<div class="FormFooter">
|
||||
<asp:Button ID="btnSave" runat="server" meta:resourcekey="btnSave" Text="Save" CssClass="Button1" OnClick="btnSave_Click" OnClientClick = "ShowProgressDialog('Saving DNS Zone Record ...');" ValidationGroup="DnsZoneRecord" />
|
||||
<asp:Button ID="btnCancel" runat="server" meta:resourcekey="btnCancel" Text="Cancel" CssClass="Button1" OnClick="btnCancel_Click" CausesValidation="False" /></td>
|
||||
<asp:Button ID="btnCancel" runat="server" meta:resourcekey="btnCancel" Text="Cancel" CssClass="Button1" OnClick="btnCancel_Click" CausesValidation="False" />
|
||||
</div>
|
||||
</asp:Panel>
|
|
@ -54,25 +54,35 @@ namespace WebsitePanel.Portal
|
|||
// toggle panels
|
||||
ShowPanels(false);
|
||||
|
||||
// domain name
|
||||
DomainInfo domain = ES.Services.Servers.GetDomain(PanelRequest.DomainID);
|
||||
litDomainName.Text = domain.DomainName;
|
||||
// domain name
|
||||
DomainInfo domain = ES.Services.Servers.GetDomain(PanelRequest.DomainID);
|
||||
litDomainName.Text = domain.DomainName;
|
||||
}
|
||||
}
|
||||
|
||||
public string GetRecordFullData(string recordType, string recordData, int mxPriority)
|
||||
public string GetRecordFullData(string recordType, string recordData, int mxPriority, int port)
|
||||
{
|
||||
return (String.Compare(recordType, "mx", true) == 0)
|
||||
? String.Format("[{0}], {1}", mxPriority, recordData) : recordData;
|
||||
|
||||
switch (recordType)
|
||||
{
|
||||
case "MX":
|
||||
return String.Format("[{0}], {1}", mxPriority, recordData);
|
||||
case "SRV":
|
||||
return String.Format("[{0}], {1}", port, recordData);
|
||||
default:
|
||||
return recordData;
|
||||
}
|
||||
}
|
||||
|
||||
private void GetRecordsDetails(int recordIndex)
|
||||
{
|
||||
GridViewRow row = gvRecords.Rows[recordIndex];
|
||||
ViewState["SrvPort"] = ((Literal)row.Cells[0].FindControl("litSrvPort")).Text;
|
||||
ViewState["SrvWeight"] = ((Literal)row.Cells[0].FindControl("litSrvWeight")).Text;
|
||||
ViewState["SrvPriority"] = ((Literal)row.Cells[0].FindControl("litSrvPriority")).Text;
|
||||
ViewState["MxPriority"] = ((Literal)row.Cells[0].FindControl("litMxPriority")).Text;
|
||||
ViewState["RecordName"] = ((Literal)row.Cells[0].FindControl("litRecordName")).Text; ;
|
||||
ViewState["RecordType"] = (DnsRecordType)Enum.Parse(typeof(DnsRecordType),
|
||||
((Literal)row.Cells[0].FindControl("litRecordType")).Text, true);
|
||||
ViewState["RecordType"] = (DnsRecordType)Enum.Parse(typeof(DnsRecordType), ((Literal)row.Cells[0].FindControl("litRecordType")).Text, true);
|
||||
ViewState["RecordData"] = ((Literal)row.Cells[0].FindControl("litRecordData")).Text;
|
||||
}
|
||||
|
||||
|
@ -88,6 +98,9 @@ namespace WebsitePanel.Portal
|
|||
txtRecordName.Text = ViewState["RecordName"].ToString();
|
||||
txtRecordData.Text = ViewState["RecordData"].ToString();
|
||||
txtMXPriority.Text = ViewState["MxPriority"].ToString();
|
||||
txtSRVPriority.Text = ViewState["SrvPriority"].ToString();
|
||||
txtSRVWeight.Text = ViewState["SrvWeight"].ToString();
|
||||
txtSRVPort.Text = ViewState["SrvPort"].ToString();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -103,24 +116,39 @@ namespace WebsitePanel.Portal
|
|||
|
||||
private void ToggleRecordControls()
|
||||
{
|
||||
rowMXPriority.Visible = (ddlRecordType.SelectedValue == "MX");
|
||||
if (ddlRecordType.SelectedValue == "A")
|
||||
rowMXPriority.Visible = false;
|
||||
rowSRVPriority.Visible = false;
|
||||
rowSRVWeight.Visible = false;
|
||||
rowSRVPort.Visible = false;
|
||||
lblRecordData.Text = "Record Data:";
|
||||
IPValidator.Enabled = false;
|
||||
|
||||
switch (ddlRecordType.SelectedValue)
|
||||
{
|
||||
lblRecordData.Text = "IP:";
|
||||
IPValidator.Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
lblRecordData.Text = "Record Data:";
|
||||
IPValidator.Enabled = false;
|
||||
case "A":
|
||||
lblRecordData.Text = "IP:";
|
||||
IPValidator.Enabled = true;
|
||||
break;
|
||||
case "MX":
|
||||
rowMXPriority.Visible = true;
|
||||
break;
|
||||
case "SRV":
|
||||
rowSRVPriority.Visible = true;
|
||||
rowSRVWeight.Visible = true;
|
||||
rowSRVPort.Visible = true;
|
||||
lblRecordData.Text = "Host offering this service:";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void SaveRecord()
|
||||
{
|
||||
if (Page.IsValid)
|
||||
{
|
||||
bool newRecord = (bool) ViewState["NewRecord"];
|
||||
bool newRecord = (bool)ViewState["NewRecord"];
|
||||
|
||||
if (newRecord)
|
||||
{
|
||||
|
@ -130,10 +158,13 @@ namespace WebsitePanel.Portal
|
|||
int result = ES.Services.Servers.AddDnsZoneRecord(PanelRequest.DomainID,
|
||||
txtRecordName.Text.Trim(),
|
||||
(DnsRecordType)
|
||||
Enum.Parse(typeof (DnsRecordType),
|
||||
Enum.Parse(typeof(DnsRecordType),
|
||||
ddlRecordType.SelectedValue, true),
|
||||
txtRecordData.Text.Trim(),
|
||||
Int32.Parse(txtMXPriority.Text.Trim()));
|
||||
Int32.Parse(txtMXPriority.Text.Trim()),
|
||||
Int32.Parse(txtSRVPriority.Text.Trim()),
|
||||
Int32.Parse(txtSRVWeight.Text.Trim()),
|
||||
Int32.Parse(txtSRVPort.Text.Trim()));
|
||||
|
||||
if (result < 0)
|
||||
{
|
||||
|
@ -156,9 +187,12 @@ namespace WebsitePanel.Portal
|
|||
ViewState["RecordName"].ToString(),
|
||||
ViewState["RecordData"].ToString(),
|
||||
txtRecordName.Text.Trim(),
|
||||
(DnsRecordType) ViewState["RecordType"],
|
||||
(DnsRecordType)ViewState["RecordType"],
|
||||
txtRecordData.Text.Trim(),
|
||||
Int32.Parse(txtMXPriority.Text.Trim()));
|
||||
Int32.Parse(txtMXPriority.Text.Trim()),
|
||||
Int32.Parse(txtSRVPriority.Text.Trim()),
|
||||
Int32.Parse(txtSRVWeight.Text.Trim()),
|
||||
Int32.Parse(txtSRVPort.Text.Trim()));
|
||||
|
||||
if (result < 0)
|
||||
{
|
||||
|
@ -217,6 +251,10 @@ namespace WebsitePanel.Portal
|
|||
txtRecordName.Text = "";
|
||||
txtRecordData.Text = "";
|
||||
txtMXPriority.Text = "1";
|
||||
txtSRVPriority.Text = "0";
|
||||
txtSRVWeight.Text = "0";
|
||||
txtSRVPort.Text = "0";
|
||||
|
||||
|
||||
ShowPanels(true);
|
||||
}
|
||||
|
@ -253,7 +291,7 @@ namespace WebsitePanel.Portal
|
|||
{
|
||||
if (e.Exception != null)
|
||||
{
|
||||
ShowErrorMessage("GDNS_GET_RECORD", e.Exception);
|
||||
ShowErrorMessage("GDNS_GET_RECORD", e.Exception);
|
||||
//this.DisableControls = true;
|
||||
e.ExceptionHandled = true;
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
@ -220,6 +219,141 @@ namespace WebsitePanel.Portal {
|
|||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.RegularExpressionValidator valRequireCorrectPriority;
|
||||
|
||||
/// <summary>
|
||||
/// rowSRVPriority 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 rowSRVPriority;
|
||||
|
||||
/// <summary>
|
||||
/// lblSRVPriority 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 lblSRVPriority;
|
||||
|
||||
/// <summary>
|
||||
/// txtSRVPriority 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 txtSRVPriority;
|
||||
|
||||
/// <summary>
|
||||
/// valRequireSrvPriority 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 valRequireSrvPriority;
|
||||
|
||||
/// <summary>
|
||||
/// valRequireCorrectSrvPriority 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 valRequireCorrectSrvPriority;
|
||||
|
||||
/// <summary>
|
||||
/// rowSRVWeight 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 rowSRVWeight;
|
||||
|
||||
/// <summary>
|
||||
/// lblSRVWeight 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 lblSRVWeight;
|
||||
|
||||
/// <summary>
|
||||
/// txtSRVWeight 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 txtSRVWeight;
|
||||
|
||||
/// <summary>
|
||||
/// valRequireSrvWeight 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 valRequireSrvWeight;
|
||||
|
||||
/// <summary>
|
||||
/// valRequireCorrectSrvWeight 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 valRequireCorrectSrvWeight;
|
||||
|
||||
/// <summary>
|
||||
/// rowSRVPort 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 rowSRVPort;
|
||||
|
||||
/// <summary>
|
||||
/// lblSRVPort 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 lblSRVPort;
|
||||
|
||||
/// <summary>
|
||||
/// txtSRVPort 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 txtSRVPort;
|
||||
|
||||
/// <summary>
|
||||
/// valRequireSrvPort 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 valRequireSrvPort;
|
||||
|
||||
/// <summary>
|
||||
/// valRequireCorrectSrvPort 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 valRequireCorrectSrvPort;
|
||||
|
||||
/// <summary>
|
||||
/// btnSave control.
|
||||
/// </summary>
|
||||
|
|
|
@ -304,7 +304,7 @@ namespace WebsitePanel.Portal
|
|||
try
|
||||
{
|
||||
// create instant alias
|
||||
int result = ES.Services.Servers.CreateDomainInstantAlias(PanelRequest.DomainID);
|
||||
int result = ES.Services.Servers.CreateDomainInstantAlias("", PanelRequest.DomainID);
|
||||
if (result < 0)
|
||||
{
|
||||
ShowResultMessage(result);
|
||||
|
|
|
@ -49,10 +49,13 @@
|
|||
<ItemTemplate>
|
||||
<asp:ImageButton ID="cmdEdit" runat="server" SkinID="EditSmall" CommandName="edit" AlternateText="Edit record">
|
||||
</asp:ImageButton>
|
||||
<asp:Literal ID="litMxPriority" runat="server" Text='<%# Eval("MxPriority") %>' Visible="false"></asp:Literal>
|
||||
<asp:Literal ID="litRecordName" runat="server" Text='<%# Eval("RecordName") %>' Visible="false"></asp:Literal>
|
||||
<asp:Literal ID="litRecordType" runat="server" Text='<%# Eval("RecordType") %>' Visible="false"></asp:Literal>
|
||||
<asp:Literal ID="litRecordData" runat="server" Text='<%# Eval("RecordData") %>' Visible="false"></asp:Literal>
|
||||
<asp:Literal ID="litMxPriority" runat="server" Text='<%# Eval("MxPriority") %>' Visible="false"></asp:Literal>
|
||||
<asp:Literal ID="litRecordName" runat="server" Text='<%# Eval("RecordName") %>' Visible="false"></asp:Literal>
|
||||
<asp:Literal ID="litRecordType" runat="server" Text='<%# Eval("RecordType") %>' Visible="false"></asp:Literal>
|
||||
<asp:Literal ID="litRecordData" runat="server" Text='<%# Eval("RecordData") %>' Visible="false"></asp:Literal>
|
||||
<asp:Literal ID="litSrvPriority" runat="server" Text='<%# Eval("SrvPriority") %>' Visible="false"></asp:Literal>
|
||||
<asp:Literal ID="litSrvWeight" runat="server" Text='<%# Eval("SrvWeight") %>' Visible="false"></asp:Literal>
|
||||
<asp:Literal ID="litSrvPort" runat="server" Text='<%# Eval("SrvPort") %>' Visible="false"></asp:Literal>
|
||||
</ItemTemplate>
|
||||
<ItemStyle CssClass="NormalBold" Wrap="False" />
|
||||
</asp:TemplateField>
|
||||
|
@ -61,7 +64,7 @@
|
|||
<asp:TemplateField SortExpression="RecordData" HeaderText="gvRecordsData" >
|
||||
<ItemStyle Width="100%" />
|
||||
<ItemTemplate>
|
||||
<%# GetRecordFullData((string)Eval("RecordType"), (string)Eval("RecordData"), (int)Eval("MxPriority")) %>
|
||||
<%# GetRecordFullData((string)Eval("RecordType"), (string)Eval("RecordData"), (int)Eval("MxPriority"), (int)Eval("SrvPort"))%>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField>
|
||||
|
@ -112,11 +115,12 @@
|
|||
<td class="SubHead" width="150" nowrap><asp:Label ID="lblRecordType" runat="server" meta:resourcekey="lblRecordType" Text="Record Type:"></asp:Label></td>
|
||||
<td class="NormalBold" width="100%">
|
||||
<asp:DropDownList ID="ddlRecordType" runat="server" SelectedValue='<%# Bind("RecordType") %>' CssClass="NormalTextBox" AutoPostBack="True" OnSelectedIndexChanged="ddlRecordType_SelectedIndexChanged">
|
||||
<asp:ListItem>A</asp:ListItem>
|
||||
<asp:ListItem>MX</asp:ListItem>
|
||||
<asp:ListItem>NS</asp:ListItem>
|
||||
<asp:ListItem>TXT</asp:ListItem>
|
||||
<asp:ListItem>CNAME</asp:ListItem>
|
||||
<asp:ListItem>A</asp:ListItem>
|
||||
<asp:ListItem>MX</asp:ListItem>
|
||||
<asp:ListItem>NS</asp:ListItem>
|
||||
<asp:ListItem>TXT</asp:ListItem>
|
||||
<asp:ListItem>CNAME</asp:ListItem>
|
||||
<asp:ListItem>SRV</asp:ListItem>
|
||||
</asp:DropDownList><asp:Literal ID="litRecordType" runat="server"></asp:Literal>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -126,27 +130,60 @@
|
|||
<asp:TextBox ID="txtRecordName" runat="server" Width="100px" CssClass="NormalTextBox"></asp:TextBox>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="rowData" runat="server">
|
||||
<td class="SubHead"><asp:Label ID="lblRecordData" runat="server" meta:resourcekey="lblRecordData" Text="Record Data:"></asp:Label></td>
|
||||
<td class="NormalBold" nowrap>
|
||||
<asp:TextBox ID="txtRecordData" runat="server" Width="200px" CssClass="NormalTextBox"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="valRequireData" runat="server" ControlToValidate="txtRecordData"
|
||||
ErrorMessage="*" ValidationGroup="DnsZoneRecord" Display="Dynamic"></asp:RequiredFieldValidator>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="rowData" runat="server">
|
||||
<td class="SubHead"><asp:Label ID="lblRecordData" runat="server" meta:resourcekey="lblRecordData" Text="Record Data:"></asp:Label></td>
|
||||
<td class="NormalBold" nowrap>
|
||||
<asp:TextBox ID="txtRecordData" runat="server" Width="200px" CssClass="NormalTextBox"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="valRequireData" runat="server" ControlToValidate="txtRecordData"
|
||||
ErrorMessage="*" ValidationGroup="DnsZoneRecord" Display="Dynamic"></asp:RequiredFieldValidator>
|
||||
<asp:regularexpressionvalidator id="IPValidator" runat="server" ValidationExpression="^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$"
|
||||
Display="Dynamic" ErrorMessage="Please enter a valid IP" ValidationGroup="DnsZoneRecord" ControlToValidate="txtRecordData" CssClass="NormalBold"></asp:regularexpressionvalidator>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<asp:regularexpressionvalidator id="IPValidator1" runat="server" ValidationExpression="^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$"
|
||||
Display="Dynamic" ErrorMessage="Please enter a valid IP" ValidationGroup="DnsZoneRecord" ControlToValidate="txtRecordData" CssClass="NormalBold"></asp:regularexpressionvalidator>
|
||||
</tr>
|
||||
<tr id="rowMXPriority" runat="server">
|
||||
<td class="SubHead"><asp:Label ID="lblMXPriority" runat="server" meta:resourcekey="lblMXPriority" Text="MX Priority:"></asp:Label></td>
|
||||
<td class="NormalBold">
|
||||
<asp:TextBox ID="txtMXPriority" runat="server" Width="30" CssClass="NormalTextBox"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="valRequireMxPriority" runat="server" ControlToValidate="txtMXPriority"
|
||||
ErrorMessage="*" ValidationGroup="DnsZoneRecord" Display="Dynamic"></asp:RequiredFieldValidator>
|
||||
<asp:RegularExpressionValidator ID="valRequireCorrectPriority" runat="server" ControlToValidate="txtMXPriority"
|
||||
ErrorMessage="*" ValidationExpression="\d{1,3}"></asp:RegularExpressionValidator></td>
|
||||
</tr>
|
||||
<tr id="rowMXPriority" runat="server">
|
||||
<td class="SubHead"><asp:Label ID="lblMXPriority" runat="server" meta:resourcekey="lblMXPriority" Text="MX Priority:"></asp:Label></td>
|
||||
<td class="NormalBold">
|
||||
<asp:TextBox ID="txtMXPriority" runat="server" Width="30" CssClass="NormalTextBox"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="valRequireMxPriority" runat="server" ControlToValidate="txtMXPriority"
|
||||
ErrorMessage="*" ValidationGroup="DnsZoneRecord" Display="Dynamic"></asp:RequiredFieldValidator>
|
||||
<asp:RegularExpressionValidator ID="valRequireCorrectPriority" runat="server" ControlToValidate="txtMXPriority"
|
||||
ErrorMessage="*" ValidationExpression="\d{1,3}"></asp:RegularExpressionValidator></td>
|
||||
</tr>
|
||||
|
||||
<tr id="rowSRVPriority" runat="server">
|
||||
<td class="SubHead"><asp:Label ID="lblSRVPriority" runat="server" meta:resourcekey="lblSRVPriority" Text="Priority:"></asp:Label></td>
|
||||
<td class="NormalBold">
|
||||
<asp:TextBox ID="txtSRVPriority" runat="server" Width="30" CssClass="NormalTextBox"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="valRequireSrvPriority" runat="server" ControlToValidate="txtSRVPriority"
|
||||
ErrorMessage="*" ValidationGroup="DnsZoneRecord" Display="Dynamic"></asp:RequiredFieldValidator>
|
||||
<asp:RegularExpressionValidator ID="valRequireCorrectSrvPriority" runat="server" ControlToValidate="txtSRVPriority"
|
||||
ErrorMessage="*" ValidationExpression="\d{1,3}"></asp:RegularExpressionValidator></td>
|
||||
</tr>
|
||||
|
||||
<tr id="rowSRVWeight" runat="server">
|
||||
<td class="SubHead"><asp:Label ID="lblSRVWeight" runat="server" meta:resourcekey="lblSRVWeight" Text="Weight:"></asp:Label></td>
|
||||
<td class="NormalBold">
|
||||
<asp:TextBox ID="txtSRVWeight" runat="server" Width="30" CssClass="NormalTextBox"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="valRequireSrvWeight" runat="server" ControlToValidate="txtSRVWeight"
|
||||
ErrorMessage="*" ValidationGroup="DnsZoneRecord" Display="Dynamic"></asp:RequiredFieldValidator>
|
||||
<asp:RegularExpressionValidator ID="valRequireCorrectSrvWeight" runat="server" ControlToValidate="txtSRVWeight"
|
||||
ErrorMessage="*" ValidationExpression="\d{1,3}"></asp:RegularExpressionValidator></td>
|
||||
</tr>
|
||||
|
||||
<tr id="rowSRVPort" runat="server">
|
||||
<td class="SubHead"><asp:Label ID="lblSRVPort" runat="server" meta:resourcekey="lblSRVPort" Text="Port Number:"></asp:Label></td>
|
||||
<td class="NormalBold">
|
||||
<asp:TextBox ID="txtSRVPort" runat="server" Width="30" CssClass="NormalTextBox"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="valRequireSrvPort" runat="server" ControlToValidate="txtSRVPort"
|
||||
ErrorMessage="*" ValidationGroup="DnsZoneRecord" Display="Dynamic"></asp:RequiredFieldValidator>
|
||||
<asp:RegularExpressionValidator ID="valRequireCorrectSrvPort" runat="server" ControlToValidate="txtSRVPort"
|
||||
ErrorMessage="*" ValidationExpression="\d{1,3}"></asp:RegularExpressionValidator></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</ContentTemplate>
|
||||
|
|
|
@ -59,44 +59,53 @@ namespace WebsitePanel.Portal.ExchangeServer
|
|||
}
|
||||
}
|
||||
|
||||
public string GetRecordFullData(string recordType, string recordData, int mxPriority)
|
||||
public string GetRecordFullData(string recordType, string recordData, int mxPriority, int port)
|
||||
{
|
||||
return (String.Compare(recordType, "mx", true) == 0)
|
||||
? String.Format("[{0}], {1}", mxPriority, recordData) : recordData;
|
||||
}
|
||||
switch (recordType)
|
||||
{
|
||||
case "MX":
|
||||
return String.Format("[{0}], {1}", mxPriority, recordData);
|
||||
case "SRV":
|
||||
return String.Format("[{0}], {1}", port, recordData);
|
||||
default:
|
||||
return recordData;
|
||||
}
|
||||
}
|
||||
|
||||
private void GetRecordsDetails(int recordIndex)
|
||||
{
|
||||
GridViewRow row = gvRecords.Rows[recordIndex];
|
||||
ViewState["MxPriority"] = ((Literal)row.Cells[0].FindControl("litMxPriority")).Text;
|
||||
ViewState["RecordName"] = ((Literal)row.Cells[0].FindControl("litRecordName")).Text; ;
|
||||
ViewState["RecordType"] = (DnsRecordType)Enum.Parse(typeof(DnsRecordType),
|
||||
((Literal)row.Cells[0].FindControl("litRecordType")).Text, true);
|
||||
ViewState["RecordData"] = ((Literal)row.Cells[0].FindControl("litRecordData")).Text;
|
||||
}
|
||||
GridViewRow row = gvRecords.Rows[recordIndex];
|
||||
ViewState["SrvPort"] = ((Literal)row.Cells[0].FindControl("litSrvPort")).Text;
|
||||
ViewState["SrvWeight"] = ((Literal)row.Cells[0].FindControl("litSrvWeight")).Text;
|
||||
ViewState["SrvPriority"] = ((Literal)row.Cells[0].FindControl("litSrvPriority")).Text;
|
||||
ViewState["MxPriority"] = ((Literal)row.Cells[0].FindControl("litMxPriority")).Text;
|
||||
ViewState["RecordName"] = ((Literal)row.Cells[0].FindControl("litRecordName")).Text; ;
|
||||
ViewState["RecordType"] = (DnsRecordType)Enum.Parse(typeof(DnsRecordType), ((Literal)row.Cells[0].FindControl("litRecordType")).Text, true);
|
||||
ViewState["RecordData"] = ((Literal)row.Cells[0].FindControl("litRecordData")).Text;
|
||||
}
|
||||
|
||||
private void BindDnsRecord(int recordIndex)
|
||||
{
|
||||
try
|
||||
{
|
||||
litRecordType.Visible = true;
|
||||
ddlRecordType.Visible = false;
|
||||
try
|
||||
{
|
||||
ViewState["NewRecord"] = false;
|
||||
GetRecordsDetails(recordIndex);
|
||||
|
||||
GetRecordsDetails(recordIndex);
|
||||
|
||||
ddlRecordType.SelectedValue = ViewState["RecordType"].ToString();
|
||||
litRecordType.Text = ViewState["RecordType"].ToString();
|
||||
txtRecordName.Text = ViewState["RecordName"].ToString();
|
||||
txtRecordData.Text = ViewState["RecordData"].ToString();
|
||||
txtMXPriority.Text = ViewState["MxPriority"].ToString();
|
||||
ToggleRecordControls();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
messageBox.ShowErrorMessage("GDNS_GET_RECORD", ex);
|
||||
return;
|
||||
}
|
||||
}
|
||||
ddlRecordType.SelectedValue = ViewState["RecordType"].ToString();
|
||||
litRecordType.Text = ViewState["RecordType"].ToString();
|
||||
txtRecordName.Text = ViewState["RecordName"].ToString();
|
||||
txtRecordData.Text = ViewState["RecordData"].ToString();
|
||||
txtMXPriority.Text = ViewState["MxPriority"].ToString();
|
||||
txtSRVPriority.Text = ViewState["SrvPriority"].ToString();
|
||||
txtSRVWeight.Text = ViewState["SrvWeight"].ToString();
|
||||
txtSRVPort.Text = ViewState["SrvPort"].ToString();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ShowErrorMessage("GDNS_GET_RECORD", ex);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
protected void ddlRecordType_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
@ -105,19 +114,32 @@ namespace WebsitePanel.Portal.ExchangeServer
|
|||
|
||||
private void ToggleRecordControls()
|
||||
{
|
||||
rowMXPriority.Visible = (ddlRecordType.SelectedValue == "MX");
|
||||
|
||||
if (ddlRecordType.SelectedValue == "A")
|
||||
rowMXPriority.Visible = false;
|
||||
rowSRVPriority.Visible = false;
|
||||
rowSRVWeight.Visible = false;
|
||||
rowSRVPort.Visible = false;
|
||||
lblRecordData.Text = "Record Data:";
|
||||
IPValidator.Enabled = false;
|
||||
|
||||
switch (ddlRecordType.SelectedValue)
|
||||
{
|
||||
lblRecordData.Text = "IP:";
|
||||
IPValidator1.Enabled = true;
|
||||
case "A":
|
||||
lblRecordData.Text = "IP:";
|
||||
IPValidator.Enabled = true;
|
||||
break;
|
||||
case "MX":
|
||||
rowMXPriority.Visible = true;
|
||||
break;
|
||||
case "SRV":
|
||||
rowSRVPriority.Visible = true;
|
||||
rowSRVWeight.Visible = true;
|
||||
rowSRVPort.Visible = true;
|
||||
lblRecordData.Text = "Host offering this service:";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
lblRecordData.Text = "Record Data:";
|
||||
IPValidator1.Enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveRecord()
|
||||
{
|
||||
|
@ -131,11 +153,16 @@ namespace WebsitePanel.Portal.ExchangeServer
|
|||
// add record
|
||||
try
|
||||
{
|
||||
int result = ES.Services.Servers.AddDnsZoneRecord(PanelRequest.DomainID,
|
||||
txtRecordName.Text.Trim(),
|
||||
(DnsRecordType)Enum.Parse(typeof(DnsRecordType), ddlRecordType.SelectedValue, true),
|
||||
txtRecordData.Text.Trim(),
|
||||
Utils.ParseInt(txtMXPriority.Text.Trim(), 0));
|
||||
int result = ES.Services.Servers.AddDnsZoneRecord(PanelRequest.DomainID,
|
||||
txtRecordName.Text.Trim(),
|
||||
(DnsRecordType)
|
||||
Enum.Parse(typeof(DnsRecordType),
|
||||
ddlRecordType.SelectedValue, true),
|
||||
txtRecordData.Text.Trim(),
|
||||
Int32.Parse(txtMXPriority.Text.Trim()),
|
||||
Int32.Parse(txtSRVPriority.Text.Trim()),
|
||||
Int32.Parse(txtSRVWeight.Text.Trim()),
|
||||
Int32.Parse(txtSRVPort.Text.Trim()));
|
||||
|
||||
if (result < 0)
|
||||
{
|
||||
|
@ -154,13 +181,16 @@ namespace WebsitePanel.Portal.ExchangeServer
|
|||
// update record
|
||||
try
|
||||
{
|
||||
int result = ES.Services.Servers.UpdateDnsZoneRecord(PanelRequest.DomainID,
|
||||
ViewState["RecordName"].ToString(),
|
||||
ViewState["RecordData"].ToString(),
|
||||
txtRecordName.Text.Trim(),
|
||||
(DnsRecordType)ViewState["RecordType"],
|
||||
txtRecordData.Text.Trim(),
|
||||
Utils.ParseInt(txtMXPriority.Text.Trim(), 0));
|
||||
int result = ES.Services.Servers.UpdateDnsZoneRecord(PanelRequest.DomainID,
|
||||
ViewState["RecordName"].ToString(),
|
||||
ViewState["RecordData"].ToString(),
|
||||
txtRecordName.Text.Trim(),
|
||||
(DnsRecordType)ViewState["RecordType"],
|
||||
txtRecordData.Text.Trim(),
|
||||
Int32.Parse(txtMXPriority.Text.Trim()),
|
||||
Int32.Parse(txtSRVPriority.Text.Trim()),
|
||||
Int32.Parse(txtSRVWeight.Text.Trim()),
|
||||
Int32.Parse(txtSRVPort.Text.Trim()));
|
||||
|
||||
if (result < 0)
|
||||
{
|
||||
|
@ -220,18 +250,21 @@ namespace WebsitePanel.Portal.ExchangeServer
|
|||
|
||||
private void ResetPopup()
|
||||
{
|
||||
EditRecordModal.Hide();
|
||||
ViewState["ExistingRecord"] = null;
|
||||
EditRecordModal.Hide();
|
||||
ViewState["ExistingRecord"] = null;
|
||||
|
||||
// erase fields
|
||||
litRecordType.Visible = false;
|
||||
ddlRecordType.Visible = true;
|
||||
ddlRecordType.SelectedIndex = 0;
|
||||
txtRecordName.Text = "";
|
||||
txtRecordData.Text = "";
|
||||
txtMXPriority.Text = "1";
|
||||
ToggleRecordControls();
|
||||
}
|
||||
// erase fields
|
||||
litRecordType.Visible = false;
|
||||
ddlRecordType.Visible = true;
|
||||
ddlRecordType.SelectedIndex = 0;
|
||||
txtRecordName.Text = "";
|
||||
txtRecordData.Text = "";
|
||||
txtMXPriority.Text = "1";
|
||||
txtSRVPriority.Text = "0";
|
||||
txtSRVWeight.Text = "0";
|
||||
txtSRVPort.Text = "0";
|
||||
ToggleRecordControls();
|
||||
}
|
||||
|
||||
protected void gvRecords_RowEditing(object sender, GridViewEditEventArgs e)
|
||||
{
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:2.0.50727.1433
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
@ -229,6 +228,15 @@ namespace WebsitePanel.Portal.ExchangeServer {
|
|||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.RequiredFieldValidator valRequireData;
|
||||
|
||||
/// <summary>
|
||||
/// IPValidator 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 IPValidator;
|
||||
|
||||
/// <summary>
|
||||
/// IPValidator1 control.
|
||||
/// </summary>
|
||||
|
@ -283,6 +291,141 @@ namespace WebsitePanel.Portal.ExchangeServer {
|
|||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.RegularExpressionValidator valRequireCorrectPriority;
|
||||
|
||||
/// <summary>
|
||||
/// rowSRVPriority 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 rowSRVPriority;
|
||||
|
||||
/// <summary>
|
||||
/// lblSRVPriority 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 lblSRVPriority;
|
||||
|
||||
/// <summary>
|
||||
/// txtSRVPriority 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 txtSRVPriority;
|
||||
|
||||
/// <summary>
|
||||
/// valRequireSrvPriority 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 valRequireSrvPriority;
|
||||
|
||||
/// <summary>
|
||||
/// valRequireCorrectSrvPriority 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 valRequireCorrectSrvPriority;
|
||||
|
||||
/// <summary>
|
||||
/// rowSRVWeight 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 rowSRVWeight;
|
||||
|
||||
/// <summary>
|
||||
/// lblSRVWeight 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 lblSRVWeight;
|
||||
|
||||
/// <summary>
|
||||
/// txtSRVWeight 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 txtSRVWeight;
|
||||
|
||||
/// <summary>
|
||||
/// valRequireSrvWeight 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 valRequireSrvWeight;
|
||||
|
||||
/// <summary>
|
||||
/// valRequireCorrectSrvWeight 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 valRequireCorrectSrvWeight;
|
||||
|
||||
/// <summary>
|
||||
/// rowSRVPort 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 rowSRVPort;
|
||||
|
||||
/// <summary>
|
||||
/// lblSRVPort 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 lblSRVPort;
|
||||
|
||||
/// <summary>
|
||||
/// txtSRVPort 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 txtSRVPort;
|
||||
|
||||
/// <summary>
|
||||
/// valRequireSrvPort 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 valRequireSrvPort;
|
||||
|
||||
/// <summary>
|
||||
/// valRequireCorrectSrvPort 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 valRequireCorrectSrvPort;
|
||||
|
||||
/// <summary>
|
||||
/// btnSave control.
|
||||
/// </summary>
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
<asp:ListItem>NS</asp:ListItem>
|
||||
<asp:ListItem>TXT</asp:ListItem>
|
||||
<asp:ListItem>CNAME</asp:ListItem>
|
||||
<asp:ListItem>SRV</asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -60,6 +61,28 @@
|
|||
<asp:TextBox ID="txtMXPriority" runat="server" Width="30" CssClass="NormalTextBox"></asp:TextBox>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="rowSRVPriority" runat="server">
|
||||
<td class="SubHead"><asp:Label ID="lblSRVPriority" runat="server" meta:resourcekey="lblSRVPriority" Text="SRV Priority:"></asp:Label></td>
|
||||
<td class="Normal">
|
||||
<asp:TextBox ID="txtSRVPriority" runat="server" Width="30" CssClass="NormalTextBox"></asp:TextBox>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="rowSRVWeight" runat="server">
|
||||
<td class="SubHead"><asp:Label ID="lblSRVWeight" runat="server" meta:resourcekey="lblSRVWeight" Text="Weight:"></asp:Label></td>
|
||||
<td class="Normal">
|
||||
<asp:TextBox ID="txtSRVWeight" runat="server" Width="30" CssClass="NormalTextBox"></asp:TextBox>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="rowSRVPort" runat="server">
|
||||
<td class="SubHead"><asp:Label ID="lblSRVPort" runat="server" meta:resourcekey="lblSRVPort" Text="Port Number:"></asp:Label></td>
|
||||
<td class="Normal">
|
||||
<asp:TextBox ID="txtSRVPort" runat="server" Width="30" CssClass="NormalTextBox"></asp:TextBox>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<asp:Button ID="btnSave" runat="server" meta:resourcekey="btnSave" Text="Save" CssClass="Button1" OnClick="btnSave_Click" ValidationGroup="DnsRecord" />
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2012, Outercurve Foundation.
|
||||
// Copyright (c) 2011, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
|
@ -86,6 +86,7 @@ namespace WebsitePanel.Portal
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void BindDnsRecords()
|
||||
|
@ -104,6 +105,8 @@ namespace WebsitePanel.Portal
|
|||
gvRecords.DataSource = ds;
|
||||
gvRecords.DataBind();
|
||||
}
|
||||
|
||||
ToggleRecordControls();
|
||||
}
|
||||
|
||||
private void BindDnsRecord(int recordId)
|
||||
|
@ -119,6 +122,9 @@ namespace WebsitePanel.Portal
|
|||
txtRecordName.Text = record.RecordName;
|
||||
txtRecordData.Text = record.RecordData;
|
||||
txtMXPriority.Text = record.MxPriority.ToString();
|
||||
txtSRVPriority.Text = record.SrvPriority.ToString();
|
||||
txtSRVWeight.Text = record.SrvWeight.ToString();
|
||||
txtSRVPort.Text = record.SrvPort.ToString();
|
||||
ipAddress.AddressId = record.IpAddressId;
|
||||
}
|
||||
|
||||
|
@ -138,9 +144,32 @@ namespace WebsitePanel.Portal
|
|||
|
||||
private void ToggleRecordControls()
|
||||
{
|
||||
ipAddress.Visible = (ddlRecordType.SelectedValue == "A");
|
||||
//rowData.Visible = (ddlRecordType.SelectedValue != "A");
|
||||
rowMXPriority.Visible = (ddlRecordType.SelectedValue == "MX");
|
||||
|
||||
rowMXPriority.Visible = false;
|
||||
rowSRVPriority.Visible = false;
|
||||
rowSRVWeight.Visible = false;
|
||||
rowSRVPort.Visible = false;
|
||||
lblRecordData.Text = "Record Data:";
|
||||
ipAddress.Visible = false;
|
||||
|
||||
switch (ddlRecordType.SelectedValue)
|
||||
{
|
||||
case "A":
|
||||
lblRecordData.Text = "IP:";
|
||||
ipAddress.Visible = true;
|
||||
break;
|
||||
case "MX":
|
||||
rowMXPriority.Visible = true;
|
||||
break;
|
||||
case "SRV":
|
||||
rowSRVPriority.Visible = true;
|
||||
rowSRVWeight.Visible = true;
|
||||
rowSRVPort.Visible = true;
|
||||
lblRecordData.Text = "Host offering this service:";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveRecord()
|
||||
|
@ -151,6 +180,9 @@ namespace WebsitePanel.Portal
|
|||
record.RecordName = txtRecordName.Text.Trim();
|
||||
record.RecordData = txtRecordData.Text.Trim();
|
||||
record.MxPriority = Utils.ParseInt(txtMXPriority.Text, 0);
|
||||
record.SrvPriority = Utils.ParseInt(txtSRVPriority.Text, 0);
|
||||
record.SrvWeight = Utils.ParseInt(txtSRVWeight.Text, 0);
|
||||
record.SrvPort = Utils.ParseInt(txtSRVPort.Text, 0);
|
||||
record.IpAddressId = ipAddress.AddressId;
|
||||
|
||||
if (ServiceIdParam != null)
|
||||
|
@ -230,6 +262,11 @@ namespace WebsitePanel.Portal
|
|||
txtRecordName.Text = "";
|
||||
txtRecordData.Text = "";
|
||||
txtMXPriority.Text = "0";
|
||||
txtSRVPriority.Text = "0";
|
||||
txtSRVWeight.Text = "0";
|
||||
txtSRVPort.Text = "0";
|
||||
|
||||
ToggleRecordControls();
|
||||
|
||||
ShowPanels(true);
|
||||
}
|
||||
|
|
|
@ -1,32 +1,249 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:2.0.50727.42
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WebsitePanel.Portal {
|
||||
|
||||
|
||||
public partial class GlobalDnsRecordsControl {
|
||||
protected System.Web.UI.WebControls.Panel pnlRecords;
|
||||
protected System.Web.UI.WebControls.Button btnAdd;
|
||||
protected System.Web.UI.WebControls.GridView gvRecords;
|
||||
protected System.Web.UI.WebControls.Panel pnlEdit;
|
||||
protected System.Web.UI.WebControls.Label lblRecordType;
|
||||
protected System.Web.UI.WebControls.DropDownList ddlRecordType;
|
||||
protected System.Web.UI.WebControls.Label lblRecordName;
|
||||
protected System.Web.UI.WebControls.TextBox txtRecordName;
|
||||
protected System.Web.UI.HtmlControls.HtmlTableRow rowData;
|
||||
protected System.Web.UI.WebControls.Label lblRecordData;
|
||||
protected System.Web.UI.WebControls.TextBox txtRecordData;
|
||||
protected WebsitePanel.Portal.SelectIPAddress ipAddress;
|
||||
protected System.Web.UI.HtmlControls.HtmlTableRow rowMXPriority;
|
||||
protected System.Web.UI.WebControls.Label lblMXPriority;
|
||||
protected System.Web.UI.WebControls.TextBox txtMXPriority;
|
||||
protected System.Web.UI.WebControls.Button btnSave;
|
||||
protected System.Web.UI.WebControls.Button btnCancel;
|
||||
|
||||
/// <summary>
|
||||
/// pnlRecords 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 pnlRecords;
|
||||
|
||||
/// <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>
|
||||
/// gvRecords 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 gvRecords;
|
||||
|
||||
/// <summary>
|
||||
/// pnlEdit 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 pnlEdit;
|
||||
|
||||
/// <summary>
|
||||
/// lblRecordType 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 lblRecordType;
|
||||
|
||||
/// <summary>
|
||||
/// ddlRecordType 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 ddlRecordType;
|
||||
|
||||
/// <summary>
|
||||
/// lblRecordName 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 lblRecordName;
|
||||
|
||||
/// <summary>
|
||||
/// txtRecordName 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 txtRecordName;
|
||||
|
||||
/// <summary>
|
||||
/// rowData 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 rowData;
|
||||
|
||||
/// <summary>
|
||||
/// lblRecordData 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 lblRecordData;
|
||||
|
||||
/// <summary>
|
||||
/// txtRecordData 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 txtRecordData;
|
||||
|
||||
/// <summary>
|
||||
/// ipAddress control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::WebsitePanel.Portal.SelectIPAddress ipAddress;
|
||||
|
||||
/// <summary>
|
||||
/// rowMXPriority 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 rowMXPriority;
|
||||
|
||||
/// <summary>
|
||||
/// lblMXPriority 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 lblMXPriority;
|
||||
|
||||
/// <summary>
|
||||
/// txtMXPriority 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 txtMXPriority;
|
||||
|
||||
/// <summary>
|
||||
/// rowSRVPriority 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 rowSRVPriority;
|
||||
|
||||
/// <summary>
|
||||
/// lblSRVPriority 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 lblSRVPriority;
|
||||
|
||||
/// <summary>
|
||||
/// txtSRVPriority 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 txtSRVPriority;
|
||||
|
||||
/// <summary>
|
||||
/// rowSRVWeight 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 rowSRVWeight;
|
||||
|
||||
/// <summary>
|
||||
/// lblSRVWeight 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 lblSRVWeight;
|
||||
|
||||
/// <summary>
|
||||
/// txtSRVWeight 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 txtSRVWeight;
|
||||
|
||||
/// <summary>
|
||||
/// rowSRVPort 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 rowSRVPort;
|
||||
|
||||
/// <summary>
|
||||
/// lblSRVPort 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 lblSRVPort;
|
||||
|
||||
/// <summary>
|
||||
/// txtSRVPort 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 txtSRVPort;
|
||||
|
||||
/// <summary>
|
||||
/// btnSave 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 btnSave;
|
||||
|
||||
/// <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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2011, Outercurve Foundation.
|
||||
// Copyright (c) 2012, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
|
@ -273,7 +273,7 @@ namespace WebsitePanel.Portal
|
|||
|
||||
private void AddDnsRecord(int domainId, string recordName, string recordData)
|
||||
{
|
||||
int result = ES.Services.Servers.AddDnsZoneRecord(domainId, recordName, DnsRecordType.A, recordData, 0);
|
||||
int result = ES.Services.Servers.AddDnsZoneRecord(domainId, recordName, DnsRecordType.A, recordData, 0, 0, 0, 0);
|
||||
if (result < 0)
|
||||
{
|
||||
ShowResultMessage(result);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue