/
test.php
75 lines (70 loc) · 2.57 KB
/
test.php
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
<?php
?>
<html>
<head>
<meta charset="utf-8">
<title>FreeSwitch XML Curl/Cdr test page</title>
<style>
fieldset {
width: 50%;
}
input, textarea, select {
display: block;
margin-bottom: 10px;
width: 50%;
}
.dialplan, .chatplan {
display: none;
}
</style>
</head>
<body>
<div style="display: flex">
<fieldset>
<legend>XML Curl</legend>
<form method="post" action="/index.php" id="curl-form">
<select name="section" id="section">
<option value="directory" selected>directory</option>
<option value="dialplan">dialplan</option>
<option value="chatplan">chatplan</option>
<option value="configuration">configuration</option>
</select>
<input name="domain" type="text" class="directory field" placeholder="domain" required>
<input name="user" type="text" class="directory field" placeholder="user">
<input name="key" type="text" class="directory field" placeholder="key" value="id" required>
<input name="group" type="text" class="directory field" placeholder="group">
<input name="Hunt-Context" type="text" class="dialplan field" placeholder="context" disabled required>
<input name="context" type="text" class="chatplan field" placeholder="context" disabled required>
<button type="submit">Send</button>
</form>
</fieldset>
<fieldset>
<legend>XML Cdr</legend>
<form method="post" action="/index.php">
<input name="uuid" type="text" placeholder="uuid">
<textarea name="cdr" placeholder="cdr xml" rows="10"></textarea>
<button type="submit">Send</button>
</form>
</fieldset>
</div>
<script>
document.getElementById('section').onchange = function () {
Array.prototype.forEach.call(document.getElementsByClassName('field'), function (input) {
input.style.display = 'none';
input.disabled = true;
});
Array.prototype.forEach.call(document.getElementsByClassName(this.value), function (input) {
input.style.display = 'block';
input.disabled = false;
});
};
document.getElementById('curl-form').onsubmit = function () {
Array.prototype.forEach.call(this.getElementsByTagName('input'), function (input) {
if (input.value == '') {
input.disabled = true;
}
});
};
</script>
</body>
</html>