This repository has been archived by the owner on Mar 5, 2020. It is now read-only.
/
show.html.haml
238 lines (228 loc) · 7.85 KB
/
show.html.haml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
- @page_title = @domain.name
%div{ :style => "display: none;" }
#record-template-new
Create a new record for this domain
#soa-record-edit
Edit the SOA record's details
#zone-edit
Edit this domain's details
#note-new
Adds a note with miscellaneous info to the domain
#note-edit
Edit the domains's current note
#delete-zone
Permantly remove this domain from the system
#audits
Views the audits/history for this domain
#change-owner
Change or remove the owner of this domain
#help-primary-ns
This is the fully qualified domain name (FQDN) of the primary name server
of the domain.
#help-contact
The primary contact of the domain, usualy the DNS administrator's email
address would be entered here.
#help-refresh
Indicates the time when the slave will try to refresh the zone from the
master. RFC 1912 recommends 1200 to 43200 seconds, low (1200) if the data is
volatile or 43200 (12 hours) if it's not. If you are using NOTIFY you can
set for much higher values e.g. 1 or more days > 86400.
#help-retry
It defines the time between retries if the slave (secondary) fails to
contact the master when refresh (above) has expired. Typical values would be
180 (3 minutes) to 900 (15 minutes) or higher.
#help-expire
Indicates when the zone data is no longer authoritative. Applies to Slaves
or Secondaries servers only. BIND9 slaves stop responding to queries for the
zone when this time has expired and no contact has been made with the
master.
#help-minimum
RFC 2308 (implemented by BIND 9) redefined this value to be the negative
caching time - the time a NAME ERROR = NXDOMAIN record is cached. The
maximum value allowed by BIND 9 for this parameter is 3 hours (10800
seconds).
%h1.underline
= @domain.name
#domain-name.padded
%table.grid
%tr
%td Domain
%td= @domain.name
%td
= link_to prototip_info_icon('report_magnify.png', 'audits'), audits_path(:action => :domain, :id => @domain)
= link_to prototip_info_icon('database_delete.png', 'delete-zone'), domain_path( @domain ), :method => :delete, :confirm => "Are you sure you want to remove #{@domain.name}?"
- if current_user.admin?
%tr
%td Owner
%td
#owner-info
- if @domain.user
= @domain.user.login
- else
\-
#owner-edit{ :style => 'display: none' }
- remote_form_for( :domain, @domain, :url => formatted_change_owner_domain_path( @domain, :js ), :html => { :method => :put } ) do |f|
= f.collection_select "user_id", @users, :id, :login, :include_blank => true
= submit_tag "Save"
%td= link_to_function prototip_info_icon('user_edit.png', 'change-owner'), "changeOwner()"
%tr
%td{ :valign => 'top' } Notes
%td{ :colspan => 2 }
#note-row
= @domain.notes
%br
= link_to_function prototip_info_icon('note_edit.png', 'note-edit'), "showNote()"
#note{ :style => "display: none;" }
- remote_form_for( :domain, @domain, :url => formatted_update_note_domain_path( @domain, :js ), :html => { :method => :put } ) do |f|
= f.text_area :notes, :rows => 5, :cols => 17
%br/
= link_to_function "Cancel", "hideNote()"
= submit_tag "Update note"
#domain-soa.padded
%h2.underline
SOA Record
= link_to_function prototip_info_icon('database_edit.png', 'soa-record-edit'), "showSOAEdit()"
= render :partial => '/domains/soa_record', :object => @domain.soa_record
#soa-edit-form{ :style => "display: none;" }
- remote_form_for( @domain.soa_record, :url => formatted_update_soa_record_path( @domain.soa_record, :js, :domain_id => @domain.id ), :html => { :method => :put } ) do |f|
%table.grid
%tr
%td Primary name server
%td= f.text_field :primary_ns
%td= prototip_help_icon('help-primary-ns')
%tr
%td Contact
%td= f.text_field :contact
%td= prototip_help_icon('help-contact')
%tr
%td Refresh
%td
= f.text_field :refresh, :size => 6
= prototip_help_icon('help-refresh')
%td
%tr
%td Retry
%td
= f.text_field :retry, :size => 6
= prototip_help_icon('help-retry')
%td
%tr
%td Expire
%td
= f.text_field :expire, :size => 6
= prototip_help_icon('help-expire')
%td
%tr
%td Minimum
%td
= f.text_field :minimum, :size => 6
= prototip_help_icon('help-minimum')
%td
%tr
%td.right= link_to_function "Cancel", "showSOAForm()"
%td= submit_tag "Update"
%td
#domain-records.padded
%h2.underline Domain RR's
%table.gridwide#record-table
%tr
%td.small Hostname
%td.small TTL
%td.small Type
%td.small Priority
%td.small Data
%td
= render :partial => 'record', :collection => @domain.records_without_soa
= link_to_function prototip_info_icon('database_add.png', 'record-template-new'), "displayRecordForm()"
= link_to_function "New record", "displayRecordForm()"
#record-form-div{ :style => "display: none;" }
- remote_form_for( :record, @record, :url => formatted_domain_records_path( @domain, :js ), :html => { :id => 'record-form' } ) do |f|
%table
%tr
%td Type
%td
= f.select( :type, RecordTemplate.record_types.map{ |t| [t,t] } - [["SOA", "SOA"]])
= observe_field "record_type", :function => "toggleRecordFields(element,value)"
%tr
%td Host
%td= f.text_field :name
%tr
%td TTL
%td= f.text_field :ttl, :size => 6
%tr.rt-mx{ :style => 'display :none' }
%td Priority
%td= f.text_field :prio, :size => 6
%tr
%td Data
%td= f.text_field :content
%tr.rt-soa{ :style => 'display :none' }
%td Primary Name Server
%td= f.text_field :primary_ns
%tr.rt-soa{ :style => 'display :none' }
%td Contact
%td= f.text_field :contact
%tr.rt-soa{ :style => 'display :none' }
%td Refresh
%td= f.text_field :refresh, :size => 6
%tr.rt-soa{ :style => 'display :none' }
%td Retry
%td= f.text_field :retry, :size => 6
%tr.rt-soa{ :style => 'display :none' }
%td Expire
%td= f.text_field :expire, :size => 6
%tr.rt-soa{ :style => 'display :none' }
%td Minimum
%td= f.text_field :minimum, :size => 6
%tr
%td
%td
= link_to_function "Cancel", "hideRecordForm()"
= submit_tag "Create"
:javascript
function editRecord(id, type) {
$('show_' + type + '_' + id).hide();
$('edit_' + type + '_' + id).show();
}
function hideRecord(id, type) {
$('edit_' + type + '_' + id).hide();
$('show_' + type + '_' + id).show();
}
function displayRecordForm() {
$('record-form-div').show();
}
function hideRecordForm() {
$('record-form-div').hide();
}
function resetRecordForm() {
$('record-form').reset();
}
function toggleRecordFields(e,v){
t = 'rt-' + v.toLowerCase();
$('record-form-div').select('tr').each(function(r){
if(r.className && r.className != t)
r.hide();
else
r.show();
});
}
function showNote() {
$('note-row').hide();
$('note').show();
}
function hideNote() {
$('note').hide();
$('note-row').show();
}
function showSOAEdit() {
$('soa-form').hide();
$('soa-edit-form').show();
}
function showSOAForm() {
$('soa-edit-form').hide();
$('soa-form').show();
}
function changeOwner() {
$('owner-info').toggle();
$('owner-edit').toggle();
}