a73a27e57425719354e6eb820eb9dac6c0246714
[freeside.git] / httemplate / view / svc_domain / dns.html
1 <SCRIPT>
2   function areyousure(href, message) {
3     if ( confirm(message) == true )
4       window.location.href = href;
5   }
6   function slave_areyousure() {
7     return confirm("Remove all records and slave from " + document.SlaveForm.recdata.value + "?");
8   }
9 </SCRIPT>
10
11 <div class="fscontainer">
12 <div class="fsbox">
13 <div class="fsbox-title">
14   <span class="left">DNS Records</span>
15 </div>
16
17 % my @records; if ( @records = $svc_domain->domain_record ) { 
18
19   <% include('/elements/table-grid.html') %>
20
21 % my $bgcolor1 = '#eeeeee';
22 %     my $bgcolor2 = '#ffffff';
23 %     my $bgcolor = $bgcolor2;
24
25   <tr>
26     <th CLASS="grid" BGCOLOR="#cccccc">Zone</th>
27     <th CLASS="grid" BGCOLOR="#cccccc">Type</th>
28     <th CLASS="grid" BGCOLOR="#cccccc">Data</th>
29   </tr>
30
31 % foreach my $domain_record ( @records ) {
32 %       my $type = $domain_record->rectype eq '_mstr'
33 %                    ? "(slave)"
34 %                    : $domain_record->recaf. ' '. $domain_record->rectype;
35
36
37     <tr>
38       <td CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $domain_record->reczone %></td>
39       <td CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $type %></td>
40       <td CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $domain_record->recdata %>
41
42 % unless ( $domain_record->rectype eq 'SOA'
43 %          || ! $FS::CurrentUser::CurrentUser->access_right('Edit domain nameservice')
44 %        ) { 
45 %   ( my $recdata = $domain_record->recdata ) =~ s/"/\\'\\'/g;
46       (<A HREF="<%$p%>edit/domain_record.html?<%$domain_record->recnum%>">edit</A>)
47       (<A HREF="javascript:areyousure('<%$p%>misc/delete-domain_record.cgi?<%$domain_record->recnum%>', 'Delete \'<% $domain_record->reczone %> <% $type %> <% $recdata %>\' ?' )">delete</A>)
48 % }
49       </td>
50     </tr>
51
52
53 %   if ( $bgcolor eq $bgcolor1 ) {
54 %      $bgcolor = $bgcolor2;
55 %    } else {
56 %      $bgcolor = $bgcolor1;
57 %    }
58
59 % } 
60
61   </table>
62 % } else {
63
64   <FORM METHOD="POST" NAME="DefaultForm" ACTION="<%$p%>edit/process/svc_domain-defaultrecords.cgi">
65       <INPUT TYPE="hidden" NAME="svcnum" VALUE="<%$svcnum%>">
66       <INPUT TYPE="submit" VALUE="Add default records">
67   </FORM>
68
69 % }
70
71 % if ( $FS::CurrentUser::CurrentUser->access_right('Edit domain nameservice') ) {
72     <BR>
73     <FORM METHOD="POST" ACTION="<%$p%>edit/process/domain_record.cgi">
74       <INPUT TYPE="hidden" NAME="svcnum" VALUE="<%$svcnum%>">
75       <INPUT TYPE="text" NAME="reczone"> 
76       <INPUT TYPE="hidden" NAME="recaf" VALUE="IN"> IN 
77       <SELECT NAME="rectype">
78 %       foreach ( @{ FS::domain_record->rectypes } ) { 
79           <OPTION VALUE="<%$_%>"><%$_%></OPTION>
80 %       } 
81       </SELECT>
82       <INPUT TYPE="text" NAME="recdata">
83       <INPUT TYPE="submit" VALUE="Add record">
84     </FORM>
85
86     <BR>
87     <FORM NAME="SlaveForm" METHOD="POST" ACTION="<%$p%>edit/process/domain_record.cgi">
88       <INPUT TYPE="hidden" NAME="svcnum" VALUE="<%$svcnum%>">
89       Or
90 %     if ( @records ) { 
91          delete all records and 
92 %     } 
93       slave from nameserver IP 
94       <INPUT TYPE="hidden" NAME="svcnum" VALUE="<%$svcnum%>">
95       <INPUT TYPE="hidden" NAME="reczone" VALUE="@"> 
96       <INPUT TYPE="hidden" NAME="recaf" VALUE="IN">
97       <INPUT TYPE="hidden" NAME="rectype" VALUE="_mstr">
98       <INPUT TYPE="text" NAME="recdata">
99       <INPUT TYPE="submit" VALUE="Slave domain" onClick="return slave_areyousure()">
100     </FORM>
101
102 % }
103
104 </div>
105 </div>
106 <%init>
107
108 my($svc_domain, %opt) = @_;
109 my $svcnum = $svc_domain->svcnum;
110
111 </%init>
112