forked from Seitanas/kvm-vdi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
add_ad_group.php
104 lines (98 loc) · 2.86 KB
/
add_ad_group.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
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
<?php
/*
KVM-VDI
Tadas Ustinavičius
Vilnius University.
Center of Information Technology Development.
Vilnius,Lithuania.
2016-07-21
*/
include ('functions/config.php');
require_once('functions/functions.php');
if (!check_session()){
header ("Location: $serviceurl/?error=1");
exit;
}
slash_vars();
set_lang();
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title"><?php echo _("Add ActiveDirectory group");?></h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-2">
</div>
<div class="col-md-8">
<input type="text" class="form-control col-md-1" placeholder="<?php echo _("Name");?>" name="groupname" id="groupname">
</div>
<div class="col-md-2">
</div>
</div>
<div class="row">
<div class="col-md-2">
</div>
<div class="col-md-8">
<div class="alert alert-info hide" id="progress"></div>
</div>
<div class="col-md-2">
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo _("Close");?></button>
<button type="button" class="btn btn-primary" id="submit"><?php echo _("Save changes");?></button>
</div>
</div>
</body>
<script>
$(document).ready(function(){
function paint_danger(){
$("#progress").removeClass('alert-info');
$("#progress").addClass('alert-danger');
}
$('#submit').click(function() {
$("#progress").removeClass('alert-danger');
$("#progress").addClass('alert-info');
$("#progress").removeClass('hide');
$.ajax({
type : 'POST',
url : 'update_ad_groups.php',
data: {
type : 'new',
groupname : $('#groupname').val(),
},
success:function (data) {
if (data=='EXISTS'){
$("#progress").html("<i class=\"fa fa-minus-circle fa-fw\"></i><?php echo _("Grpup already exists.");?>");
paint_danger();
}
if (data=='EMPTY_GROUP'){
$("#progress").html("<i class=\"fa fa-minus-circle fa-fw\"></i><?php echo _("Groupname field is empty.");?>");
paint_danger();
}
if (data=='SUCCESS'){
setTimeout(function() {
$("#progress").addClass('hide');;
}, 2000);
$("#progress").removeClass('alert-danger');
$("#progress").removeClass('alert-info');
$("#progress").addClass('alert-success');
$("#username").val("");
$("#password").val("");
$("#progress").html("<i class=\"fa fa-thumbs-o-up fa-fw\"></i><?php echo _("Success");?>");
}
}
});
});
});
</script>
</html>