clear config by clearing keys every apply

enable apply button if update ready
This commit is contained in:
Derek Macias 2016-03-14 14:26:21 -06:00
parent f64f61427b
commit ab9d587670
3 changed files with 11 additions and 2 deletions

View File

@ -8,6 +8,7 @@ Title="Nerd Pack"
<link type="text/css" rel="stylesheet" href="/plugins/NerdPack/css/NerdPack.css"> <link type="text/css" rel="stylesheet" href="/plugins/NerdPack/css/NerdPack.css">
<form markdown="1" id="package_form" name="package_settings" method="POST" action="/update.php" target="progressFrame"> <form markdown="1" id="package_form" name="package_settings" method="POST" action="/update.php" target="progressFrame">
<input type="hidden" id="include" name="#include" value="/plugins/NerdPack/include/ClearConfig.php"/>
<table class="tablesorter hover-highlight" id="tblPackages"> <table class="tablesorter hover-highlight" id="tblPackages">
<thead> <thead>

View File

@ -0,0 +1,3 @@
<?php
$keys = [];
?>

View File

@ -81,13 +81,16 @@ function packageQuery(force) {
$('#tblPackages tbody').html("<tr><td colspan='6'><br><i class='fa fa-spinner fa-spin icon'></i><em>Please wait, retrieving plugin information ...</em></td><tr>"); $('#tblPackages tbody').html("<tr><td colspan='6'><br><i class='fa fa-spinner fa-spin icon'></i><em>Please wait, retrieving plugin information ...</em></td><tr>");
$.getJSON('/plugins/NerdPack/include/PackageQuery.php', {force: force}, function(packages) { $.getJSON('/plugins/NerdPack/include/PackageQuery.php', {force: force}, function(packages) {
$('#tblPackages tbody').empty(); $('#tblPackages tbody').empty();
var Ready;
var len = packages.length, i = 0; var len = packages.length, i = 0;
for (i; i < len; i++) { for (i; i < len; i++) {
var Update; var Update;
if (packages[i].downloadeq == packages[i].downloaded && packages[i].installeq == packages[i].installed) if (packages[i].downloadeq == packages[i].downloaded && packages[i].installeq == packages[i].installed){
Update = "<span><i class='uptodate fa fa-check'></i> up-to-date </span>"; Update = "<span><i class='uptodate fa fa-check'></i> up-to-date </span>";
else }else{
Update = "<span ><a><i class='updateready fa fa-cloud-download'></i> update ready </a></span>"; Update = "<span ><a><i class='updateready fa fa-cloud-download'></i> update ready </a></span>";
Ready = true;
}
var Downloaded = packages[i].downloaded; var Downloaded = packages[i].downloaded;
if (packages[i].downloadeq != packages[i].downloaded) if (packages[i].downloadeq != packages[i].downloaded)
@ -108,6 +111,8 @@ function packageQuery(force) {
"<input class='pkgvalue' type='hidden' id='"+packages[i].pkgname+"_value' name='"+packages[i].pkgnver+"' value='"+packages[i].config+"'></td>"+ "<input class='pkgvalue' type='hidden' id='"+packages[i].pkgname+"_value' name='"+packages[i].pkgnver+"' value='"+packages[i].config+"'></td>"+
"</tr>"); "</tr>");
} }
if (Ready)
$('#btnApply').prop('disabled', false);
// attach switch buttons to every package checkbox all at once // attach switch buttons to every package checkbox all at once
$('.pkgcheckbox') $('.pkgcheckbox')