forked from hestiacp/hestiacp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpages.js
More file actions
134 lines (115 loc) · 3.47 KB
/
pages.js
File metadata and controls
134 lines (115 loc) · 3.47 KB
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
App.Pages.init = function(){
App.Ajax.request('MAIN.getInitial', {}, function(reply){
App.Env.initialParams = reply.data;
//App.Helpers.updateInitial();
});
App.Pages.prepareHTML();
$('.section.active').removeClass('active');
$('#'+App.Env.world).addClass('active');
}
App.Pages.prepareHTML = function()
{
if ('undefined' != typeof App.Pages[App.Env.world].prepareHTML) {
App.Pages.prepareHTML();
}
else {
App.Model[App.Env.world].loadList();
}
}
App.Pages.DNS.showSubform = function(ref)
{
App.Helpers.showLoading();
var data = ref.find('.source:first').val();
App.Ajax.request('DNS.getListRecords', {
spell: data
}, function(reply) {
var tpl = App.Templates.get('SUBFORM', 'dns');
var tpl_records = App.HTML.Build.dns_records(reply.data);
tpl.set(':SUBRECORDS', tpl_records);
$(ref).find('.show-records').addClass('hidden');
$(ref).after(tpl.finalize());
App.Helpers.updateScreen();
});
}
App.Pages.DNS.edit = function(elm) {
var options = elm.find('.source').val();
fb.warn(elm);
fb.warn(options);
var tpl = App.HTML.Build.dns_form(options);
elm.replaceWith(tpl);
}
/*
//
// DNS
App.Pages.DNS.saveForm = function(evt, params){
var elm = $(evt.target);
elm = elm.parents('.b-new-entry');
if (elm.attr('id') == App.Constants.DNS_FORM_ID) {
var values = App.Helpers.getFormValues(elm);
if(App.Validate.dnsForm(values)) {
App.Model.DNS.update(values, source);
var tpl = App.HTML.Build.dns_entry(values);
$('#' + App.Constants.DNS_FORM_ID).replaceWith(tpl);
}
}
else {
var source = $(elm).find('.source').val();
var values = App.Helpers.getFormValues(elm);
if(App.Validate.dnsForm(values)) {
App.Model.DNS.update(values, source);
var tpl = App.HTML.Build.dns_entry(values);
elm.replaceWith(tpl);
}
}
App.Helpers.updateScreen();
}
//
// IP
App.Pages.IP.prepareHTML = function(){
App.Model.IP.loadList();
}
App.Pages.IP.saveForm = function(evt, params){
var elm = $(evt.target);
elm = elm.parents('.b-new-entry');
if (elm.attr('id') == App.Constants.IP_FORM_ID) {
var values = App.Helpers.getFormValues(elm);
if(App.Validate.ipForm(values)) {
App.Model.IP.update(values, source);
var tpl = App.HTML.Build.ip_entry(values);
$('#' + App.Constants.IP_FORM_ID).replaceWith(tpl);
}
}
else {
var source = $(elm).find('.source').val();
var values = App.Helpers.getFormValues(elm);
if(App.Validate.ipForm(values)) {
App.Model.IP.update(values, source);
var tpl = App.HTML.Build.ip_entry(values);
elm.replaceWith(tpl);
}
}
App.Helpers.updateScreen();
}
*/
/*
App.Pages.IP.edit = function(elm) {
var options = elm.find('.source').val();
fb.warn(elm);
fb.warn(options);
var tpl = App.HTML.Build.ip_form(options);
elm.replaceWith(tpl);
}
App.Pages.IP.ipNotSaved = function(reply) {
return App.Helpers.alert(reply.message);
}
App.Pages.IP.remove = function(evt) {
var confirmed = confirm('Are you sure?');
if (!confirmed) {
return;
}
var elm = $(evt.target);
elm.parents('.ip-details-row');
var values = elm.find('.source').val();
App.Model.IP.remove(values, elm);
}
*/