1
|
|
|
var { |
2
|
|
|
resetObject |
3
|
|
|
} = require('../../common/resetobj.js'); |
4
|
|
|
|
5
|
|
|
// Reset table |
6
|
|
|
function tableReset(dLength = 0, tLength = 0) { |
7
|
|
|
$('#bwTableProcessingProcessed').text(0); |
8
|
|
|
$('#bwTableProcessingWaiting').text(0); |
9
|
|
|
$('#bwTableProcessingTotal').text(dLength * tLength); |
10
|
|
|
|
11
|
|
|
$('#bwTableProcessingDomAvail').text(0); |
12
|
|
|
$('#bwTableProcessingDomUnavail').text(0); |
13
|
|
|
$('#bwTableProcessingDomError').text(0); |
14
|
|
|
} |
15
|
|
|
|
16
|
|
|
// Get export options from the form |
17
|
|
|
function getExportOptions() { |
18
|
|
|
var options = {}; |
|
|
|
|
19
|
|
|
options = { |
20
|
|
|
'filetype': $('#bweSelectFiletype').val(), |
21
|
|
|
'domains': $('#bweSelectDomains').val(), |
22
|
|
|
'errors': $('#bweSelectErrors').val(), |
23
|
|
|
'information': $('#bweSelectInformation').val(), |
24
|
|
|
'whoisreply': $('#bweSelectWhoisreply').val() |
25
|
|
|
} |
26
|
|
|
return options; |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
function setExportOptions(preset) { |
30
|
|
|
switch (preset) { |
31
|
|
|
case ('none'): |
32
|
|
|
unlockFields(); |
33
|
|
|
break; |
34
|
|
|
case ('availableonly'): |
35
|
|
|
unlockFields(); |
36
|
|
|
//$('#bweSelectFiletype').val('csv'); |
37
|
|
|
$('#bweSelectDomains').val('available'); |
38
|
|
|
$('#bweSelectErrors').val('no'); |
39
|
|
|
$('#bweSelectInformation').val('domain'); |
40
|
|
|
$('#bweSelectWhoisreply').val('no'); |
41
|
|
|
break; |
42
|
|
|
case ('allbutnoreply'): |
43
|
|
|
unlockFields(); |
44
|
|
|
//$('#bweSelectFiletype').val('csv'); |
45
|
|
|
$('#bweSelectDomains').val('both'); |
46
|
|
|
$('#bweSelectErrors').val('yes'); |
47
|
|
|
$('#bweSelectInformation').val('domain+basic'); |
48
|
|
|
$('#bweSelectWhoisreply').val('no'); |
49
|
|
|
break; |
50
|
|
|
case ('import'): |
51
|
|
|
lockFields(); |
52
|
|
|
$('#bweSelectFiletype').val('csv'); |
53
|
|
|
$('#bweSelectDomains').val('both'); |
54
|
|
|
$('#bweSelectErrors').val('yes'); |
55
|
|
|
$('#bweSelectInformation').val('domain+basic+debug'); |
56
|
|
|
$('#bweSelectWhoisreply').val('yes+block'); |
57
|
|
|
break; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
function setExportOptionsEx(filetype) { |
63
|
|
|
switch (filetype) { |
64
|
|
|
case 'txt': |
65
|
|
|
lockFields(true); |
66
|
|
|
break; |
67
|
|
|
case 'csv': |
68
|
|
|
unlockFields(true); |
69
|
|
|
break; |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
function lockFields(isTxt = false) { |
74
|
|
|
if (isTxt === false) { |
75
|
|
|
$('#bweSelectFiletype').prop("disabled", true); |
76
|
|
|
$('#bweSelectDomains').prop("disabled", true); |
77
|
|
|
$('#bweSelectErrors').prop("disabled", true); |
78
|
|
|
} |
79
|
|
|
if ($('#bweSelectWhoisreply').prop("disabled") === false) { |
80
|
|
|
$('#bweSelectInformation').prop("disabled", true); |
81
|
|
|
$('#bweSelectWhoisreply').prop("disabled", true); |
82
|
|
|
} |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
function unlockFields(isTxt = false) { |
86
|
|
|
if (isTxt === true) { |
87
|
|
|
$('#bweSelectFiletype').prop("disabled", false); |
88
|
|
|
} |
89
|
|
|
if ($('#bweSelectWhoisreply').prop("disabled") === true && $('#bweSelectFiletype').val() == 'csv') { |
90
|
|
|
$('#bweSelectFiletype').prop("disabled", false); |
91
|
|
|
$('#bweSelectDomains').prop("disabled", false); |
92
|
|
|
$('#bweSelectErrors').prop("disabled", false); |
93
|
|
|
$('#bweSelectInformation').prop("disabled", false); |
94
|
|
|
$('#bweSelectWhoisreply').prop("disabled", false); |
95
|
|
|
} |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
module.exports = { |
99
|
|
|
tableReset: tableReset, |
100
|
|
|
tblReset: tableReset, |
101
|
|
|
getExportOptions: getExportOptions, |
102
|
|
|
getExprtOptns: getExportOptions, |
103
|
|
|
setExportOptions: setExportOptions, |
104
|
|
|
setExprtOptns: setExportOptions, |
105
|
|
|
setExportOptionsEx: setExportOptionsEx |
106
|
|
|
} |
107
|
|
|
|