Browse Source

ajout de l'option pour wiper les listes

master
Cabillot Julien 6 years ago
parent
commit
295125595c
3 changed files with 27 additions and 4 deletions
  1. 4
      controller/status.php
  2. 21
      root/js/my.js
  3. 6
      templates/status.php

4
controller/status.php

@ -32,7 +32,7 @@ function getStatus()
function cleanList()
{
if (!isset($_GET['state']) || empty($_GET['state'])) {
echo 'pas de state, exit';
echo json_encode('pas de state, exit');
exit();
}
@ -40,4 +40,6 @@ function cleanList()
$coll = $db->download;
$coll->remove(['cstate' => $_GET['state']]);
echo json_encode('ok');
}

21
root/js/my.js

@ -32,3 +32,24 @@ function subURL() {
$("body").css("cursor", "auto");
}
}
function wipe(type)
{
$.ajax({
url: "/cleanList/",
type: 'get',
data: {
state: type
},
dataType: 'json',
async: false,
success: function(data) {
$("body").css("cursor", "auto");
location.reload();
},
error: function(xhr, err) {
$("body").css("cursor", "auto");
alert('ERR');
}
});
}

6
templates/status.php

@ -45,7 +45,7 @@ if (!empty($listAdded)) {
?>
</tbody>
</table>
<input type="button" value="Wipe">
<input type="button" value="Wipe" onClick="javascript:wipe('added'); ">
</div>
<?php
}
@ -106,7 +106,7 @@ if (!empty($listDownloaded)) {
?>
</tbody>
</table>
<input type="button" value="Wipe"><br>
<input type="button" value="Wipe" onClick="javascript:wipe('downloaded');">
</div>
<?php
}
@ -137,7 +137,7 @@ if (!empty($listDupp)) {
?>
</tbody>
</table>
<input type="button" value="Wipe"><br>
<input type="button" value="Wipe" onClick="javascript:wipe('dupp');">
</div>
<?php
}

Loading…
Cancel
Save