Browse Source

on liste aussi les streams + wipe pour ceux ci

master
Cabillot Julien 6 years ago
parent
commit
d8bebe63d6
3 changed files with 98 additions and 18 deletions
  1. 19
      controller/status.php
  2. 5
      root/js/my.js
  3. 92
      templates/status.php

19
controller/status.php

@ -24,6 +24,16 @@ function getStatus()
foreach ($coll->find(['cstate' => 'dupp']) as $element) {
$listDupp[] = $element;
}
$coll = $db->stream;
foreach ($coll->find(['cstate' => 'finished']) as $element) {
$streamFinished[] = $element;
}
foreach ($coll->find(['cstate' => 'begin']) as $element) {
$streamBegin[] = $element;
}
$infos = PremiumizeMe::getStatus();
include dirname(__FILE__).'/../templates/status.php';
@ -31,13 +41,20 @@ function getStatus()
function cleanList()
{
// TODO : plus de verif
if (!isset($_GET['type']) || empty($_GET['type'])) {
echo json_encode('pas de type, exit');
exit();
}
// TODO : plus de verif
if (!isset($_GET['state']) || empty($_GET['state'])) {
echo json_encode('pas de state, exit');
exit();
}
$db = DbMongo::get();
$coll = $db->download;
$coll = $db->$_GET['type'];
$coll->remove(['cstate' => $_GET['state']]);

5
root/js/my.js

@ -33,13 +33,14 @@ function subURL() {
}
}
function wipe(type)
function wipe(type, status)
{
$.ajax({
url: "/cleanList/",
type: 'get',
data: {
state: type
type: type,
state: status
},
dataType: 'json',
async: false,

92
templates/status.php

@ -26,9 +26,9 @@ if (!empty($listAdded)) {
<table>
<thead>
<tr>
<th>Date</td>
<th>Filename</td>
<th>IP</td>
<th>Date</th>
<th>Filename</th>
<th>IP</th>
</tr>
</thead>
<tbody>
@ -45,7 +45,7 @@ if (!empty($listAdded)) {
?>
</tbody>
</table>
<input type="button" value="Wipe" onClick="javascript:wipe('added'); ">
<input type="button" value="Wipe" onClick="javascript:wipe('dl', 'added'); ">
</div>
<?php
}
@ -57,9 +57,9 @@ if (!empty($listDownloading)) {
<table>
<thead>
<tr>
<th>Date</td>
<th>Filename</td>
<th>IP</td>
<th>Date</th>
<th>Filename</th>
<th>IP</th>
</tr>
</thead>
<tbody>
@ -87,9 +87,9 @@ if (!empty($listDownloaded)) {
<table>
<thead>
<tr>
<th>Date</td>
<th>Filename</td>
<th>IP</td>
<th>Date</th>
<th>Filename</th>
<th>IP</th>
</tr>
</thead>
<tbody>
@ -106,7 +106,7 @@ if (!empty($listDownloaded)) {
?>
</tbody>
</table>
<input type="button" value="Wipe" onClick="javascript:wipe('downloaded');">
<input type="button" value="Wipe" onClick="javascript:wipe('dl', 'downloaded');">
</div>
<?php
}
@ -118,9 +118,9 @@ if (!empty($listDupp)) {
<table>
<thead>
<tr>
<th>Date</td>
<th>Filename</td>
<th>IP</td>
<th>Date</th>
<th>Filename</th>
<th>IP</th>
</tr>
</thead>
<tbody>
@ -137,10 +137,72 @@ if (!empty($listDupp)) {
?>
</tbody>
</table>
<input type="button" value="Wipe" onClick="javascript:wipe('dupp');">
<input type="button" value="Wipe" onClick="javascript:wipe('dl', 'dupp');">
</div>
<?php
}
if (!empty($streamBegin)) {
?>
<div class="$streamBegin">
Stream en cours : <br>
<table>
<thead>
<tr>
<th>Date</th>
<th>Filename</th>
<th>IP</th>
</tr>
</thead>
<tbody>
<?php
foreach ($streamBegin as $result) {
?>
<tr>
<td><?= $result['timestamp']; ?></td>
<td><?= $result['filename']; ?></td>
<td><?= $result['ip']; ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
<input type="button" value="Wipe" onClick="javascript:wipe('stream', 'begin');">
</div>
<?php
}
if (!empty($streamFinished)) {
?>
<div class="streamFinished">
Stream fini : <br>
<table>
<thead>
<tr>
<th>Date</th>
<th>Filename</th>
<th>IP</th>
</tr>
</thead>
<tbody>
<?php
foreach ($streamFinished as $result) {
?>
<tr>
<td><?= $result['timestamp']; ?></td>
<td><?= $result['filename']; ?></td>
<td><?= $result['ip']; ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
<input type="button" value="Wipe" onClick="javascript:wipe('stream', 'finished');">
</div>
<?php
}
?>
</div>
</body>

Loading…
Cancel
Save