remove depreciated code
This commit is contained in:
parent
99fb631974
commit
4584e5d39b
|
@ -1,14 +1,13 @@
|
|||
$(function(){
|
||||
//Shadowbox.init({onClose:packageQuery});
|
||||
//tablesorter options
|
||||
$('#tblPackages').tablesorter({headers:{5:{sorter:false}}});
|
||||
|
||||
// "uninstall package" switch and cookie
|
||||
$('#removepkg')
|
||||
.switchButton({
|
||||
labels_placement: "right",
|
||||
on_label: 'uninstall packages On',
|
||||
off_label: 'uninstall packages Off',
|
||||
labels_placement: "left",
|
||||
on_label: 'unInstall Packages',
|
||||
off_label: 'unInstall Packages',
|
||||
checked: $.cookie('nerdpack_packages') == 'remove'
|
||||
})
|
||||
.change(function () {
|
||||
|
@ -19,8 +18,8 @@ $(function(){
|
|||
$('#checkall')
|
||||
.switchButton({
|
||||
labels_placement: "right",
|
||||
on_label: 'select all',
|
||||
off_label: ' select all',
|
||||
on_label: 'Select All',
|
||||
off_label: 'Select All',
|
||||
checked: $.cookie('nerdpack_checkall') == 'yes'
|
||||
})
|
||||
.change(function() { //on change
|
||||
|
@ -55,8 +54,9 @@ function packageManager() {
|
|||
type : "POST",
|
||||
url : "/update.php",
|
||||
data : $('#package_form').serializeArray(),
|
||||
complete: function() {
|
||||
openBox('/plugins/NerdPack/scripts/packagemanager&arg1=webgui&arg2='+$.cookie('nerdpack_packages'),'Manage Packages',600,900,true);
|
||||
success: function() {
|
||||
openBox('/plugins/NerdPack/scripts/packagemanager&arg1=download&arg2='+
|
||||
$.cookie('nerdpack_packages'),'Manage Packages',600,900,true);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -69,18 +69,27 @@ function packageQuery() {
|
|||
dataType: "json",
|
||||
url: "/plugins/NerdPack/include/PackageQuery.php",
|
||||
success: function(data) {
|
||||
if (data.length > 1){
|
||||
for( i in data ) {
|
||||
var Update;
|
||||
if (data[i].downloadeq == data[i].downloaded && data[i].installeq == data[i].installed )
|
||||
Update = "<span style=\"color:#44B012;white-space:nowrap;\"><i class=\"fa fa-check\"></i> up-to-date</span>";
|
||||
else
|
||||
Update = "<span style=\"white-space:nowrap;\"><i class=\"fa fa-cloud-download\"></i><a> update ready<a></span>";
|
||||
|
||||
$("#tblPackages tbody").append(
|
||||
"<tr>"+
|
||||
"<td>"+data[i].name+"</td>"+ //package name
|
||||
"<td></td>"+ //package status
|
||||
"<td>"+Update+"</td>"+ //package status
|
||||
"<td>"+(data[i].size / 1000).toFixed(0)+"</td>"+ //package size
|
||||
"<td>"+data[i].downloaded+"</td>"+ //package installed
|
||||
"<td>"+data[i].installed+"</td>"+ //package installed
|
||||
"<td><input class='pkgcheckbox' id='"+data[i].pkgname+"' type='checkbox'>"+
|
||||
"<input class='pkgvalue' type='hidden' id='"+data[i].pkgname+"_value' name='"+data[i].pkgnver+"' value='"+data[i].config+"'>"+
|
||||
"</td></tr>");
|
||||
"<input class='pkgvalue' type='hidden' id='"+data[i].pkgname+"_value' name='"+
|
||||
data[i].pkgnver+"' value='"+data[i].config+"'></td>"+
|
||||
"<td><img src='/plugins/dynamix/images/close.png' width='24' height='24' "+
|
||||
"class='btnRemove' title='remove package from flash drive'/></td>"+
|
||||
"</tr>");
|
||||
$(".btnRemove").unbind("click", Remove).bind("click", Remove);
|
||||
$('#'+data[i].pkgname)
|
||||
.switchButton({
|
||||
labels_placement: 'right',
|
||||
|
@ -98,52 +107,6 @@ function packageQuery() {
|
|||
checkDepends();
|
||||
});
|
||||
}
|
||||
}else {
|
||||
$("#tblPackages tbody").append(
|
||||
"<tr>"+
|
||||
"<td><input type='button' value='Download Packages' onclick='downloadPackages();'></td>"+
|
||||
"</tr>");
|
||||
|
||||
}
|
||||
},
|
||||
complete : function () {
|
||||
$("#tblPackages").trigger("update");
|
||||
packageCheck()
|
||||
},
|
||||
error: function () {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// check github for newer package and report status
|
||||
function packageCheck() {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/boot/config/plugins/NerdPack/packages.json",
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
$('#tblPackages tbody tr').each(function(row, tr) {
|
||||
var tblPackage = $(tr).children("td:nth-child(1)").html();
|
||||
var tblName = $(tr).children("td:nth-child(6)").find('.pkgcheckbox').attr("id");
|
||||
for( i in data ) {
|
||||
var Package = data[i].name;
|
||||
var pkgNameArray = Package.split('-');
|
||||
var pkgName = pkgNameArray[0];
|
||||
if (pkgNameArray.length > 4){
|
||||
for( var ii = 1; ii < pkgNameArray.length-3; ii++ ) {
|
||||
pkgName = pkgName+"-"+pkgNameArray[ii];
|
||||
}
|
||||
}
|
||||
if ( tblName == pkgName){
|
||||
if (tblPackage == Package)
|
||||
var Update = "<span style=\"color:#44B012;white-space:nowrap;\"><i class=\"fa fa-check\"></i> up-to-date</span>";
|
||||
else
|
||||
var Update = "<span style=\"white-space:nowrap;\"><i class=\"fa fa-cloud-download\"></i><a href='#' onclick='packageUpdate(\""+tblName+"\",\""+tblPackage+"\",\""+Package+"\",\""+data[i].sha+"\");'> update ready<a></span>";
|
||||
}
|
||||
}
|
||||
$(tr).children("td:nth-child(2)").html(Update);
|
||||
});
|
||||
|
||||
},
|
||||
complete : function () {
|
||||
$("#tblPackages").trigger("update");
|
||||
|
@ -153,43 +116,6 @@ function packageCheck() {
|
|||
});
|
||||
};
|
||||
|
||||
// update packages
|
||||
function packageUpdate(pkgName, pkgOld, pkgNew, pkgSha) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
url: "/plugins/NerdPack/include/PackageUpdate.php",
|
||||
data: {pkgname: pkgName, pkgold: pkgOld, pkgnew: pkgNew, pkgsha: pkgSha},
|
||||
success: function(data) {
|
||||
alert(data);
|
||||
},
|
||||
complete : function () {
|
||||
//location.reload();
|
||||
},
|
||||
error: function () {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function downloadPackages() {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/plugins/NerdPack/include/PackageDownload.php",
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
for( i in data ) {
|
||||
packageUpdate(null,null,data[i].name,data[i].sha);
|
||||
}
|
||||
},
|
||||
complete : function () {
|
||||
$("#tblPackages").trigger("update");
|
||||
},
|
||||
error: function () {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
function checkDepends() {
|
||||
if ($('#screen').prop('checked') == true){
|
||||
$('#utempter').switchButton({checked: true});
|
||||
|
@ -200,3 +126,22 @@ function checkDepends() {
|
|||
$('#python','.pkgvalue').val('yes');
|
||||
}
|
||||
};
|
||||
|
||||
function Remove(){
|
||||
var par = $(this).parent().parent();
|
||||
if (par.children("td:nth-child(4)").html() == "yes"){
|
||||
var Package = par.children("td:nth-child(1)").html();
|
||||
var Downloaded = par.children("td:nth-child(4)").html();
|
||||
var Confirm = confirm("Remove package "+Package+" from flash drive?")
|
||||
if (Confirm) {
|
||||
par.children("td:nth-child(4)").html("no");
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url: '/plugins/NerdPack/include/PackageRemove.php',
|
||||
data : {pkg:Package},
|
||||
success: function() {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user