This commit was generated by cvs2svn to compensate for changes in r10640,
[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 <% include('/elements/init_overlib.html') %>
11
12 <A NAME="dns"></A>
13 <div class="fscontainer">
14 <div class="fsbox">
15 <div class="fsbox-title">
16   <span class="left">DNS Records</span>
17 </div>
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     <th CLASS="grid" BGCOLOR="#cccccc">TTL</th>
30     <th CLASS="grid" BGCOLOR="#cccccc"></th>
31   </tr>
32
33 % my @records = $svc_domain->domain_record;
34 % foreach my $domain_record ( @records ) {
35 %       my $type = $domain_record->rectype eq '_mstr'
36 %                    ? "(slave)"
37 %                    : $domain_record->recaf. ' '. $domain_record->rectype;
38
39
40     <tr>
41       <td CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $domain_record->reczone %></td>
42       <td CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $type %></td>
43       <td CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $domain_record->recdata %></td>
44       <td CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $domain_record->ttl %></td>
45       <td CLASS="grid" BGCOLOR="<% $bgcolor %>">
46
47 % unless ( $domain_record->rectype eq 'SOA'
48 %          || ! $FS::CurrentUser::CurrentUser->access_right('Edit domain nameservice')
49 %        ) { 
50 %   my $edit_link = include('/elements/popup_link.html',
51 %                             'label'  => 'edit',                      
52 %                             'action' => $p.'edit/domain_record.html?recnum='.
53 %                                         $domain_record->recnum,
54 %                             'actionlabel' => 'Edit nameservice record',
55 %                             'width'  => 655,
56 %                             'height' => 176,
57 %                             #'color'  => '#ff0000',
58 %                   );
59 %   ( my $recdata = $domain_record->recdata ) =~ s/"/\\'\\'/g;
60 %   my $delete_url= "javascript:areyousure('${p}misc/delete-domain_record.cgi?".
61 %                   $domain_record->recnum. "', 'Delete ".
62 %                   $domain_record->reczone. " $type $recdata ?' )";
63       <%$edit_link%>&nbsp;|&nbsp;<A HREF="<%$delete_url%>">delete</A>
64 % }
65       </td>
66     </tr>
67
68
69 %   if ( $bgcolor eq $bgcolor1 ) {
70 %      $bgcolor = $bgcolor2;
71 %    } else {
72 %      $bgcolor = $bgcolor1;
73 %    }
74
75 % } 
76
77 % if ( ! @records ) {
78
79   <FORM METHOD="POST" NAME="DefaultForm" ACTION="<%$p%>edit/process/svc_domain-defaultrecords.cgi">
80   <tr>
81     <td class="grid" BGCOLOR="#ffffff" COLSPAN=5>
82       <INPUT TYPE="hidden" NAME="svcnum" VALUE="<%$svcnum%>">
83       <INPUT TYPE="submit" VALUE="Add default records">
84     </td>
85   </tr>
86   </FORM>
87
88 % }
89
90 % if ( $FS::CurrentUser::CurrentUser->access_right('Edit domain nameservice') ) {
91     <FORM METHOD="POST" ACTION="<%$p%>edit/process/domain_record.cgi">
92     <INPUT TYPE="hidden" NAME="svcnum" VALUE="<%$svcnum%>">
93     <tr>
94       <td class="grid" bgcolor="<%$bgcolor%>">
95         <INPUT TYPE="text" NAME="reczone"><BR>
96         <FONT SIZE="-1"><I>Zone</I></FONT>
97       </TD>
98       <TD class="grid" bgcolor="<%$bgcolor%>">
99         <INPUT TYPE="hidden" NAME="recaf" VALUE="IN">
100           <SELECT NAME="rectype">
101 %           foreach ( @{ FS::domain_record->rectypes } ) { 
102               <OPTION VALUE="<%$_%>">IN <%$_%></OPTION>
103 %           } 
104           </SELECT><BR>
105           <FONT SIZE="-1"><I>Type</I></FONT>
106       </TD>
107       <TD class="grid" bgcolor="<%$bgcolor%>">
108         <INPUT TYPE="text" NAME="recdata"><BR>
109         <FONT SIZE="-1"><I>Data</I></FONT>
110       </TD>
111       <TD class="grid" bgcolor="<%$bgcolor%>">
112         <INPUT TYPE="text" NAME="ttl" size="6"><BR>
113         <FONT SIZE="-1"><I>TTL</I></FONT>
114       </TD>
115       <TD class="grid" bgcolor="<%$bgcolor%>" VALIGN="top">
116         <INPUT TYPE="submit" VALUE="Add record">
117       </TD>
118     </TR>
119     </FORM>
120
121     <BR>
122     <FORM NAME="SlaveForm" METHOD="POST" ACTION="<%$p%>edit/process/domain_record.cgi">
123       <INPUT TYPE="hidden" NAME="svcnum" VALUE="<%$svcnum%>">
124       Or
125 %     if ( @records ) { 
126          delete all records and 
127 %     } 
128       slave from nameserver IP 
129       <INPUT TYPE="hidden" NAME="svcnum" VALUE="<%$svcnum%>">
130       <INPUT TYPE="hidden" NAME="reczone" VALUE="@"> 
131       <INPUT TYPE="hidden" NAME="recaf" VALUE="IN">
132       <INPUT TYPE="hidden" NAME="rectype" VALUE="_mstr">
133       <INPUT TYPE="text" NAME="recdata">
134       <INPUT TYPE="submit" VALUE="Slave domain" onClick="return slave_areyousure()">
135     </FORM>
136     <BR><BR>
137
138 % }
139
140 </table>
141
142 </div>
143 </div>
144 <%init>
145
146 my($svc_domain, %opt) = @_;
147 my $svcnum = $svc_domain->svcnum;
148
149 </%init>
150