summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--httemplate/edit/domain_record.html53
-rwxr-xr-xhttemplate/edit/process/domain_record.cgi17
-rw-r--r--httemplate/edit/process/svc_domain-defaultrecords.cgi6
-rw-r--r--httemplate/elements/popup_link.html2
-rwxr-xr-xhttemplate/misc/delete-domain_record.cgi2
-rw-r--r--httemplate/view/svc_domain/dns.html86
6 files changed, 122 insertions, 44 deletions
diff --git a/httemplate/edit/domain_record.html b/httemplate/edit/domain_record.html
new file mode 100644
index 000000000..3ea6c77da
--- /dev/null
+++ b/httemplate/edit/domain_record.html
@@ -0,0 +1,53 @@
+<% include('/elements/header-popup.html', 'Edit nameservice record') %>
+
+<% include('/elements/error.html') %>
+
+<FORM METHOD="POST" ACTION="process/domain_record.cgi">
+
+<INPUT TYPE="hidden" NAME="recnum" VALUE="<% $opt{'recnum'} %>">
+
+<% ntable("#cccccc", 2) %>
+
+ <tr>
+ <td>
+ <INPUT TYPE="text" NAME="reczone" VALUE="<% $domain_record->reczone %>">
+ <BR>
+ <FONT SIZE="-1"><I>Zone</I></FONT>
+ </TD>
+ <TD>
+ <INPUT TYPE="hidden" NAME="recaf" VALUE="IN">
+ <SELECT NAME="rectype">
+% foreach ( @{ FS::domain_record->rectypes } ) {
+ <OPTION VALUE="<%$_%>"
+ <% $_ eq $domain_record->rectype ? 'SELECTED' : '' %>
+ >IN <%$_%></OPTION>
+% }
+ </SELECT><BR>
+ <FONT SIZE="-1"><I>Type</I></FONT>
+ </TD>
+ <TD>
+ <INPUT TYPE="text" NAME="recdata" VALUE="<% $domain_record->recdata |h %>">
+ <BR>
+ <FONT SIZE="-1"><I>Data</I></FONT>
+ </TD>
+ <TD>
+ <INPUT TYPE="text" NAME="ttl" size="6" VALUE="<% $domain_record->ttl %>">
+ <BR>
+ <FONT SIZE="-1"><I>TTL</I></FONT>
+ </TD>
+
+</TABLE>
+
+<BR>
+<INPUT TYPE="submit" VALUE="Edit record">
+
+</FORM>
+
+<%init>
+
+my %opt = @_;
+
+my $domain_record = qsearchs('domain_record', { 'recnum' => $opt{'recnum'} } )
+ or die "unknown recnum";
+
+</%init>
diff --git a/httemplate/edit/process/domain_record.cgi b/httemplate/edit/process/domain_record.cgi
index ff0f2d414..8369f7114 100755
--- a/httemplate/edit/process/domain_record.cgi
+++ b/httemplate/edit/process/domain_record.cgi
@@ -1,8 +1,14 @@
%if ( $error ) {
% errorpage($error);
-%} else {
+%} elsif ( $recnum ) { #editing
+<% header('Nameservice record changed') %>
+ <SCRIPT TYPE="text/javascript">
+ window.top.location.reload();
+ </SCRIPT>
+ </BODY></HTML>
+%} else { #adding
% my $svcnum = $new->svcnum;
-<% $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum") %>
+<% $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum#dns") %>
%}
<%init>
@@ -21,10 +27,11 @@ my $new = new FS::domain_record ( {
my $error;
if ( $recnum ) {
- $error=$new->replace($old);
+ $new->svcnum( $old->svcnum );
+ $error = $new->replace($old);
} else {
- $error=$new->insert;
- $recnum=$new->getfield('recnum');
+ $error = $new->insert;
+ #$recnum = $new->getfield('recnum');
}
</%init>
diff --git a/httemplate/edit/process/svc_domain-defaultrecords.cgi b/httemplate/edit/process/svc_domain-defaultrecords.cgi
index feb58406c..ec3d221f3 100644
--- a/httemplate/edit/process/svc_domain-defaultrecords.cgi
+++ b/httemplate/edit/process/svc_domain-defaultrecords.cgi
@@ -1,4 +1,8 @@
-<% $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum") %>
+% if ( $error ) {
+% errorpage($error);
+% } else {
+<% $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum#dns") %>
+% }
<%init>
die "access denied"
diff --git a/httemplate/elements/popup_link.html b/httemplate/elements/popup_link.html
index 49b624c84..fbb6ce3b8 100644
--- a/httemplate/elements/popup_link.html
+++ b/httemplate/elements/popup_link.html
@@ -11,7 +11,7 @@ Example:
'label' => 'click me', # text of <A> tag
#strongly recommended
- 'actionlabel => 'You clicked', # popup title
+ 'actionlabel' => 'You clicked', # popup title
#opt
'width' => 540,
diff --git a/httemplate/misc/delete-domain_record.cgi b/httemplate/misc/delete-domain_record.cgi
index 08eedde5f..200365d2f 100755
--- a/httemplate/misc/delete-domain_record.cgi
+++ b/httemplate/misc/delete-domain_record.cgi
@@ -1,7 +1,7 @@
% if ( $error ) {
% errorpage($error);
% } else {
-<% $cgi->redirect($p. "view/svc_domain.cgi?". $domain_record->svcnum) %>
+<% $cgi->redirect($p. "view/svc_domain.cgi?". $domain_record->svcnum. '#dns') %>
% }
<%init>
diff --git a/httemplate/view/svc_domain/dns.html b/httemplate/view/svc_domain/dns.html
index 82cab068a..184286c31 100644
--- a/httemplate/view/svc_domain/dns.html
+++ b/httemplate/view/svc_domain/dns.html
@@ -7,28 +7,30 @@
return confirm("Remove all records and slave from " + document.SlaveForm.recdata.value + "?");
}
</SCRIPT>
+<% include('/elements/init_overlib.html') %>
+<A NAME="dns"></A>
<div class="fscontainer">
<div class="fsbox">
<div class="fsbox-title">
<span class="left">DNS Records</span>
</div>
-% my @records; if ( @records = $svc_domain->domain_record ) {
-
- <% include('/elements/table-grid.html') %>
+<% include('/elements/table-grid.html') %>
% my $bgcolor1 = '#eeeeee';
-% my $bgcolor2 = '#ffffff';
-% my $bgcolor = $bgcolor2;
+% my $bgcolor2 = '#ffffff';
+% my $bgcolor = $bgcolor2;
<tr>
<th CLASS="grid" BGCOLOR="#cccccc">Zone</th>
<th CLASS="grid" BGCOLOR="#cccccc">Type</th>
<th CLASS="grid" BGCOLOR="#cccccc">Data</th>
<th CLASS="grid" BGCOLOR="#cccccc">TTL</th>
+ <th CLASS="grid" BGCOLOR="#cccccc"></th>
</tr>
+% my @records = $svc_domain->domain_record;
% foreach my $domain_record ( @records ) {
% my $type = $domain_record->rectype eq '_mstr'
% ? "(slave)"
@@ -45,9 +47,20 @@
% unless ( $domain_record->rectype eq 'SOA'
% || ! $FS::CurrentUser::CurrentUser->access_right('Edit domain nameservice')
% ) {
+% my $edit_link = include('/elements/popup_link.html',
+% 'label' => 'edit',
+% 'action' => $p.'edit/domain_record.html?recnum='.
+% $domain_record->recnum,
+% 'actionlabel' => 'Edit nameservice record',
+% 'width' => 655,
+% 'height' => 176,
+% #'color' => '#ff0000',
+% );
% ( my $recdata = $domain_record->recdata ) =~ s/"/\\'\\'/g;
- (<A HREF="<%$p%>edit/domain_record.html?<%$domain_record->recnum%>">edit</A>)
- (<A HREF="javascript:areyousure('<%$p%>misc/delete-domain_record.cgi?<%$domain_record->recnum%>', 'Delete \'<% $domain_record->reczone %> <% $type %> <% $recdata %>\' ?' )">delete</A>)
+% my $delete_url= "javascript:areyousure('${p}misc/delete-domain_record.cgi?".
+% $domain_record->recnum. "', 'Delete ".
+% $domain_record->reczone. " $type $recdata ?' )";
+ <%$edit_link%>&nbsp;|&nbsp;<A HREF="<%$delete_url%>">delete</A>
% }
</td>
</tr>
@@ -61,50 +74,48 @@
% }
- </table>
-% } else {
+% if ( ! @records ) {
<FORM METHOD="POST" NAME="DefaultForm" ACTION="<%$p%>edit/process/svc_domain-defaultrecords.cgi">
+ <tr>
+ <td class="grid" BGCOLOR="#ffffff" COLSPAN=5>
<INPUT TYPE="hidden" NAME="svcnum" VALUE="<%$svcnum%>">
<INPUT TYPE="submit" VALUE="Add default records">
+ </td>
+ </tr>
</FORM>
% }
% if ( $FS::CurrentUser::CurrentUser->access_right('Edit domain nameservice') ) {
- <BR>
<FORM METHOD="POST" ACTION="<%$p%>edit/process/domain_record.cgi">
- <INPUT TYPE="hidden" NAME="svcnum" VALUE="<%$svcnum%>">
- <TABLE>
- <TR>
- <TD ALIGN="right" VALIGN="top">
- <INPUT TYPE="text" NAME="reczone"><BR>
- <FONT SIZE="-1"><I>Zone</I></FONT>
- </TD>
- <TD ALIGN="right" VALIGN="top">
- <INPUT TYPE="hidden" NAME="recaf" VALUE="IN"> IN
- </TD>
- <TD ALIGN="right" VALIGN="top">
+ <INPUT TYPE="hidden" NAME="svcnum" VALUE="<%$svcnum%>">
+ <tr>
+ <td class="grid" bgcolor="<%$bgcolor%>">
+ <INPUT TYPE="text" NAME="reczone"><BR>
+ <FONT SIZE="-1"><I>Zone</I></FONT>
+ </TD>
+ <TD class="grid" bgcolor="<%$bgcolor%>">
+ <INPUT TYPE="hidden" NAME="recaf" VALUE="IN">
<SELECT NAME="rectype">
% foreach ( @{ FS::domain_record->rectypes } ) {
- <OPTION VALUE="<%$_%>"><%$_%></OPTION>
+ <OPTION VALUE="<%$_%>">IN <%$_%></OPTION>
% }
</SELECT><BR>
<FONT SIZE="-1"><I>Type</I></FONT>
- </TD>
- <TD ALIGN="right" VALIGN="top">
- <INPUT TYPE="text" NAME="recdata"><BR>
- <FONT SIZE="-1"><I>Data</I></FONT>
- </TD>
- <TD ALIGN="right" VALIGN="top">
- <INPUT TYPE="text" NAME="ttl" size="6"><BR>
- <FONT SIZE="-1"><I>TTL</I></FONT>
- </TD>
- <TD ALIGN="right" VALIGN="top">
- <INPUT TYPE="submit" VALUE="Add record">
- </TD>
- </TR>
- </TABLE>
+ </TD>
+ <TD class="grid" bgcolor="<%$bgcolor%>">
+ <INPUT TYPE="text" NAME="recdata"><BR>
+ <FONT SIZE="-1"><I>Data</I></FONT>
+ </TD>
+ <TD class="grid" bgcolor="<%$bgcolor%>">
+ <INPUT TYPE="text" NAME="ttl" size="6"><BR>
+ <FONT SIZE="-1"><I>TTL</I></FONT>
+ </TD>
+ <TD class="grid" bgcolor="<%$bgcolor%>" VALIGN="top">
+ <INPUT TYPE="submit" VALUE="Add record">
+ </TD>
+ </TR>
</FORM>
<BR>
@@ -122,9 +133,12 @@
<INPUT TYPE="text" NAME="recdata">
<INPUT TYPE="submit" VALUE="Slave domain" onClick="return slave_areyousure()">
</FORM>
+ <BR><BR>
% }
+</table>
+
</div>
</div>
<%init>