|
1 | 1 | <?php
|
| 2 | + require_once('init.php'); |
2 | 3 |
|
3 |
| - require('init.php'); |
4 | 4 |
|
5 |
| - if (strlen($reviewhost['history_table'])) { |
6 |
| - $list = $dbh->prepare('SELECT review.checksum AS checksum, |
7 |
| - review.fingerprint AS fingerprint, |
| 5 | + $users = $dbh->query('SELECT DISTINCT IFNULL(reviewed_by, "") FROM '.$reviewhost['review_table']); |
| 6 | + $Reviewers = "[ 'None' "; |
| 7 | + while($user = $users->fetchColumn()) |
| 8 | + $Reviewers .= ",'$user' "; |
| 9 | + $Reviewers .= " ]"; |
| 10 | + unset($users); |
8 | 11 |
|
9 |
| - DATE(review.first_seen) AS first_seen, |
10 |
| - DATE(review.last_seen) AS last_seen, |
11 |
| - IFNULL(review.reviewed_by, "-") AS reviewed_by, |
12 |
| - DATE(review.reviewed_on) AS reviewed_on, |
13 |
| - review.comments AS comments, |
14 | 12 |
|
15 |
| - SUM(history.ts_cnt) AS count, |
16 |
| - ROUND(SUM(history.query_time_sum), 2) AS time, |
17 |
| - ROUND(SUM(history.query_time_sum)/SUM(history.ts_cnt), 2) AS time_avg |
18 |
| -
|
19 |
| - FROM '.$reviewhost['review_table'].' AS review |
20 |
| - LEFT JOIN '.$reviewhost['history_table'].' AS history |
21 |
| - ON history.checksum = review.checksum |
22 |
| - GROUP BY review.checksum |
23 |
| - '); |
24 |
| - } |
25 |
| - else { |
26 |
| - $list = $dbh->prepare('SELECT review.checksum AS checksum, |
27 |
| - review.fingerprint AS fingerprint, |
28 |
| -
|
29 |
| - DATE(review.first_seen) AS first_seen, |
30 |
| - DATE(review.last_seen) AS last_seen, |
31 |
| - IFNULL(review.reviewed_by, "-") AS reviewed_by, |
32 |
| - DATE(review.reviewed_on) AS reviewed_on, |
33 |
| - review.comments AS comments, |
34 |
| -
|
35 |
| - 0 AS count, |
36 |
| - 0 AS time, |
37 |
| - 0 AS time_avg |
38 |
| -
|
39 |
| - FROM '.$reviewhost['review_table'].' AS review |
40 |
| - GROUP BY review.checksum |
41 |
| - '); |
42 |
| - } |
43 |
| - $list->execute(); |
44 |
| - include('templates/header.php'); |
| 13 | + require_once('templates/header.php'); |
45 | 14 | ?>
|
46 | 15 |
|
47 | 16 | <table id="Queries">
|
|
60 | 29 | </tr>
|
61 | 30 | </thead>
|
62 | 31 | <tbody>
|
63 |
| - <?php |
64 |
| - while ($row = $list->fetch(PDO::FETCH_ASSOC)) { |
65 |
| - echo "<tr>"; |
66 |
| - echo "<td class='count number'>".$row['count']."</td>"; |
67 |
| - echo "<td class='time number'>".$row['time']."</td>"; |
68 |
| - echo "<td class='avgTime number'>".$row['time_avg']."</td>"; |
69 |
| - echo "<td class='firstSeen date'>".$row['first_seen']."</td>"; |
70 |
| - echo "<td class='lastSeen date'>".$row['last_seen']."</td>"; |
71 |
| - echo "<td class='fingerprint'>".SqlParser::htmlPreparedStatement($row['fingerprint'], true)."</td>"; |
72 |
| - //echo "<td class='fingerprint'>".$row['fingerprint']."</td>"; |
73 |
| - echo "<td class='reviewed_on'>".$row['reviewed_on']."</td>"; |
74 |
| - echo "<td class='reviewed_by'>".$row['reviewed_by']."</td>"; |
75 |
| - echo "<td class='comments'>".$row['comments']."</td>"; |
76 |
| - |
77 |
| - echo '<td class="details"><a class="details" href="review.php?checksum='.$row['checksum'].'"><img src="images/details_open.png"></a></td>'; |
78 |
| - echo "</tr>"; |
79 |
| - } |
80 |
| - ?> |
81 | 32 | </tbody>
|
82 | 33 | <tfoot>
|
83 | 34 | <tr>
|
84 |
| - <th></th> |
85 |
| - <th></th> |
86 |
| - <th></th> |
87 |
| - <th></th> |
88 |
| - <th></th> |
89 |
| - <th></th> |
90 |
| - <th></th> |
91 |
| - <th></th> |
92 |
| - <th></th> |
93 |
| - <th></th> |
| 35 | + <th class="number"></th> |
| 36 | + <th class="number"></th> |
| 37 | + <th class="number"></th> |
| 38 | + <th class="date"></th> |
| 39 | + <th class="date"></th> |
| 40 | + <th class=""></th> |
| 41 | + <th class="date"></th> |
| 42 | + <th class=""></th> |
| 43 | + <th class=""></th> |
| 44 | + <th class=""></th> |
94 | 45 | </tr>
|
95 | 46 | </tfoot>
|
96 | 47 | </table>
|
|
99 | 50 | $(function() {
|
100 | 51 |
|
101 | 52 | oTable = $('#Queries').dataTable({
|
102 |
| - "sDom": '"R<"H"rCp>t<"F"il>"', |
| 53 | + "bDeferRender": true, |
| 54 | + "bServerSide": true, |
| 55 | + "sAjaxSource": "list-ajax.php", |
| 56 | + "sDom": '"R<"H"Cpr>t<"F"il>"', |
103 | 57 | "bJQueryUI": true,
|
104 | 58 | "bStateSave": true,
|
105 | 59 | // Store the cookie for one year
|
106 | 60 | "iCookieDuration": 31556926,
|
107 |
| - "bProcessing": false, |
| 61 | + "bProcessing": true, |
108 | 62 | "aaSort": [],
|
| 63 | + "bAutoWidth": true, |
109 | 64 | "aoColumnDefs": [
|
110 |
| - { "bSearchable": false, "bVisible": true, "aTargets": [ 0 ] }, |
111 |
| - { "bSearchable": false, "bVisible": true, "aTargets": [ 1 ] }, |
112 |
| - { "bSearchable": false, "bVisible": true, "aTargets": [ 2 ] }, |
113 |
| - { "bSearchable": false, "bVisible": true, "aTargets": [ 3 ] }, |
114 |
| - { "bSearchable": false, "bVisible": true, "aTargets": [ 4 ] }, |
115 |
| - { "bSearchable": true, "bVisible": true, "aTargets": [ 5 ] }, |
116 |
| - { "bSearchable": false, "bVisible": true, "aTargets": [ 6 ] }, |
117 |
| - { "bSearchable": true, "bVisible": true, "aTargets": [ 7 ] }, |
118 |
| - { "bSearchable": true, "bVisible": true, "aTargets": [ 8 ] }, |
119 |
| - { "bSearchable": false, "bVisible": true, "aTargets": [ 9 ], "bSortable": false } |
| 65 | + { "sClass": "count number", "bSearchable": false, "bVisible": true, "aTargets": [ 0 ] }, |
| 66 | + { "sClass": "time number", "bSearchable": false, "bVisible": true, "aTargets": [ 1 ] }, |
| 67 | + { "sClass": "avgTime number", "bSearchable": false, "bVisible": true, "aTargets": [ 2 ] }, |
| 68 | + { "sClass": "firstSeen date", "bSearchable": false, "bVisible": true, "aTargets": [ 3 ] }, |
| 69 | + { "sClass": "lastSeen date", "bSearchable": false, "bVisible": true, "aTargets": [ 4 ] }, |
| 70 | + { "sClass": "fingerprint", "bSearchable": true, "bVisible": true, "aTargets": [ 5 ] }, |
| 71 | + { "sClass": "reviewed_on date", "bSearchable": false, "bVisible": true, "aTargets": [ 6 ] }, |
| 72 | + { "sClass": "reviewed_by", "bSearchable": true, "bVisible": true, "aTargets": [ 7 ] }, |
| 73 | + { "sClass": "comments", "bSearchable": true, "bVisible": true, "aTargets": [ 8 ] }, |
| 74 | + { "sClass": "details", "bSearchable": false, "bVisible": true, "aTargets": [ 9 ], "bSortable": false } |
120 | 75 | ],
|
121 | 76 | "oColVis": {
|
122 | 77 | "aiExclude": [ 9 ]
|
123 | 78 | },
|
124 |
| - "fnStateSaveParams": function(oSettings, oData) { |
| 79 | + "fnDrawCallback" : function() { |
| 80 | + $("a.details").fancybox({ |
| 81 | + type: 'iframe', |
| 82 | + width: '98%', |
| 83 | + height: '98%', |
| 84 | + centerOnScroll: true, |
| 85 | + padding: 0, |
| 86 | + margin: 10 |
| 87 | + }); |
| 88 | + return true; |
| 89 | + }, |
| 90 | + "fnStateSaveCallback": function(oSettings, oData) { |
125 | 91 | oData.aoSearchCols = [];
|
126 | 92 | oData.oFilter = [];
|
127 | 93 | oData.oSearch = [];
|
| 94 | + return true; |
128 | 95 | },
|
129 |
| - "fnStateLoadParams": function(oSettings, oData) { |
| 96 | + "fnStateLoadCallback": function(oSettings, oData) { |
130 | 97 | oData.aoSearchCols = [];
|
131 | 98 | oData.oFilter = [];
|
132 | 99 | oData.oSearch = [];
|
133 | 100 | oldVis = [];
|
134 | 101 | if (typeof oData.abVisCols == "object")
|
135 | 102 | oldVis = oData.abVisCols;
|
136 | 103 | oData.abVisCols = [];
|
| 104 | + return true; |
137 | 105 | }
|
138 | 106 | }).columnFilter({
|
139 | 107 | bUseColVis: true,
|
|
146 | 114 | { type: "date-range" },
|
147 | 115 | { type: "text" },
|
148 | 116 | { type: "date-range" },
|
149 |
| - { type: "select" }, |
| 117 | + { type: "select", values: <?php echo $Reviewers; ?> }, |
150 | 118 | { type: "text" },
|
151 | 119 | null
|
152 | 120 | ]
|
|
159 | 127 | if (oldVis.length == oTable.fnSettings().aoColumns.length)
|
160 | 128 | for (var i=0; i < oldVis.length; i++)
|
161 | 129 | oTable.fnSetColumnVis(i, oldVis[i]);
|
| 130 | + |
| 131 | + $(window).bind('resize', function () { |
| 132 | + oTable.fnAdjustColumnSizing(); |
| 133 | + } ); |
162 | 134 | });
|
163 | 135 | </script>
|
164 | 136 |
|
165 | 137 | <?php
|
166 |
| - include('templates/footer.php'); |
| 138 | + require_once('templates/footer.php'); |
0 commit comments