This repository was archived by the owner on Dec 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdomain_add.php
More file actions
68 lines (58 loc) · 2.02 KB
/
domain_add.php
File metadata and controls
68 lines (58 loc) · 2.02 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
<?php
require_once('base.php');
require_once($class_root . 'Domain.php');
print $display->header();
?>
<script type="text/javascript">
document.observe("dom:loaded", function() { Form.focusFirstElement($('addform')); });
function queue_domain_add(id) {
var myhash = new Hash();
['name', 'type'].each(function(k) {
if($(id)[k] !== undefined) {
myhash.set(k, $(id)[k].getValue());
}
});
var params = myhash.toJSON();
//window.params = params;
new Ajax.Request('api/jsonrpc.php', {
method: 'post',
parameters: {"jsonrpc": "2.0", "method": 'queue_domain_add', "params": params , "id": 1},
onSuccess: function(r) {
var json = r.responseText.evalJSON();
if(json.error) {
$('feedback').update(json.error.message + ' (' + json.error.code + ')').
setStyle({color: 'red', display: 'block'});
} else {
$('feedback').update('Request added to queue').setStyle({color: 'black', display: 'block'});
window.location = 'record_add.php?domain_name=' + myhash.get('name') + '&template=new_domain';
}
}});
}
</script>
<div id="feedback" style="display: none;"></div>
<form name="addform" id="addform" onSubmit="queue_domain_add(this.id); return false;">
<table>
<tr class="domain">
<td><div class="header">Name</div></td>
<td><input type="text" name="name" value="<?php echo isSet($_POST['name']) ? $_POST['name'] : ''; ?>"></td>
</tr>
<tr class="domain">
<td><div class="header">Type</div></td>
<td>
<select name="type">
<?php foreach(Domain::valid_types() as $type) {
print '<option value="'.$type.'"'.( $type == $_POST['type'] ? ' SELECTED' : '').'>'.$type.'</option>'."\n";
} ?>
</select>
</td>
</tr>
<tr>
<td colspan="2" style="text-align: right;">
<input type="submit" name="submit" value="Submit">
</td>
</tr>
</table>
</form>
<?php
print $display->footer();
?>