This repository has been 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
/
queue_list.php
96 lines (75 loc) · 2.34 KB
/
queue_list.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
<?php
require_once('base.php');
require_once($class_root . 'Queue.php');
print $display->header();
if(! preg_match('/^\d+$/',$_GET['id'])) {
print $display->error("You hacker!");
print $display->footer();
exit(1);
}
try {
$q = Queue::find($_GET['id']);
$qdomain = $q->queue_item_domains;
$qrecord = $q->queue_item_records;
} catch (Exception $e) {
print $e->getMessage();
print $display->footer();
exit(0);
}
?>
<script type="text/javascript">
function queueItem_delete(id, method) {
new Ajax.Request('api/jsonrpc.php', {
method: 'post',
parameters: {"jsonrpc": "2.0", "method": method, "params": id , "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 {
$('tr_entry' + id).toggleClassName('queue_commited');
$('action_entry' + id).update('Removed from queue');
$('feedback').update('Request deleted').setStyle({color: 'black', display: 'block'});
}
}});
}
function queueItem_commit(id, method) {
new Ajax.Request('api/jsonrpc.php', {
method: 'post',
parameters: {"jsonrpc": "2.0", "method": method, "params": id , "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 {
$('tr_entry' + id).toggleClassName('queue_commited');
$('action_entry' + id).update('Commited item');
$('feedback').update('Request comitted').setStyle({color: 'black', display: 'block'});
}
}});
}
</script>
<div id="feedback" style="display: none;"></div>
<br>
<?php
//$amount = count($qid
print '<div class="header">'.$q->count_pendingItems().' items found in queue for domain: "'.$q->domain_name.'"</div><br>';
if (count($qdomain) > 0) {
print $display->queue_domain_header();
foreach($qdomain as $domain) {
print $display->queue_domain($domain);
}
print $display->queue_domain_footer();
}
print "<br>";
if (count($qrecord) > 0) {
print $display->queue_record_header();
foreach($qrecord as $record) {
print $display->queue_record($record);
}
print $display->queue_record_footer();
}
print $display->footer();
?>