1 | <?php |
||
2 | |||
3 | if (! (Auth::user()->hasGlobalAdmin())) { |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
4 | exit('ERROR: You need to be admin'); |
||
5 | } |
||
6 | |||
7 | ?> |
||
8 | |||
9 | <div class="modal fade" id="delete-oid-form" tabindex="-1" role="dialog" aria-labelledby="Delete" aria-hidden="true"> |
||
10 | <div class="modal-dialog modal-sm"> |
||
11 | <div class="modal-content"> |
||
12 | <div class="modal-header"> |
||
13 | <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> |
||
14 | <h5 class="modal-title" id="Delete">Confirm Delete</h5> |
||
15 | </div> |
||
16 | <div class="modal-body"> |
||
17 | <p>If you would like to remove this OID then please click Delete.</p> |
||
18 | </div> |
||
19 | <div class="modal-footer"> |
||
20 | <form role="form" class="remove_oid_form"> |
||
21 | <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> |
||
22 | <button type="submit" class="btn btn-danger danger" id="delete-oid-button" data-target="delete-oid-button">Delete</button> |
||
23 | <input type="hidden" name="dcustomoid_id" id="dcustomoid_id" value=""> |
||
24 | <input type="hidden" name="confirm" id="confirm" value="yes"> |
||
25 | </form> |
||
26 | </div> |
||
27 | </div> |
||
28 | </div> |
||
29 | </div> |
||
30 | |||
31 | <script> |
||
32 | $('#delete-oid-form').on('show.bs.modal', function(event) { |
||
33 | customoid_id = $(event.relatedTarget).data('customoid_id'); |
||
34 | $("#dcustomoid_id").val(customoid_id); |
||
35 | }); |
||
36 | |||
37 | $('#delete-oid-button').on('click', function(event) { |
||
38 | event.preventDefault(); |
||
39 | var customoid_id = $("#dcustomoid_id").val(); |
||
40 | $.ajax({ |
||
41 | type: 'POST', |
||
42 | url: 'ajax_form.php', |
||
43 | data: { type: "delete-customoid", customoid_id: customoid_id }, |
||
44 | dataType: "html", |
||
45 | success: function(msg) { |
||
46 | if(msg.indexOf("ERROR:") <= -1) { |
||
47 | $("#row_"+customoid_id).remove(); |
||
48 | } |
||
49 | $("#message").html('<div class="alert alert-info">'+msg+'</div>'); |
||
50 | $("#delete-oid-form").modal('hide'); |
||
51 | }, |
||
52 | error: function() { |
||
53 | $("#message").html('<div class="alert alert-info">This OID could not be deleted.</div>'); |
||
54 | $("#delete-oid-form").modal('hide'); |
||
55 | } |
||
56 | }); |
||
57 | }); |
||
58 | </script> |
||
59 |