Plugin system update

Added multi remove ability on Plugins page
This commit is contained in:
bergware
2022-06-26 12:04:11 +02:00
parent 0ff9958e4f
commit 09c0c54866
2 changed files with 11 additions and 5 deletions
+10 -4
View File
@@ -65,6 +65,14 @@ function resize(bind) {
}
}
<?endif;?>
function multiRemove() {
if ($('input.remove:checked').length > 1) $('#removeall').show(); else $('#removeall').hide();
}
function removeList() {
let list = [];
$('input.remove:checked').each(function(){list.push($(this).attr('data'));});
openPlugin("multiplugin remove "+list.join('*'),"_(Remove Selected Plugins)_","","refresh");
}
function updateInfo(data) {
var updates = data.split('\n');
for (var n=0,update; update=updates[n]; n++) {
@@ -75,9 +83,6 @@ function updateInfo(data) {
}
}
}
function disableButton() {
$('#plugin_list').find('input[type=button]').prop('disabled',true);
}
function initlist() {
timers.plugins = setTimeout(function(){$('div.spinner.fixed').show('slow');},500);
$.get('/plugins/dynamix.plugin.manager/include/ShowPlugins.php',{init:true,check:<?=$check?>},function(data) {
@@ -122,7 +127,8 @@ function loadlist(id,check) {
$(function() {
initlist();
$('#plugin_tree').fileTree({root:'/boot/',top:'/boot/',filter:'plg'}, function(file) {$('#plugin_file').val(file);});
$('.tabs').append("<span id='updateall' class='status vhshift' style='display:none;margin-left:12px'><input type='button' value=\"_(Update All Plugins)_\" onclick='disableButton();openPlugin(\"plugin updateall\",\"_(Update All Plugins)_\",\":return\")'></span>");
$('.tabs').append("<span id='removeall' class='status vhshift' style='display:none;margin-left:12px'><input type='button' value=\"_(Remove Selected Plugins)_\" onclick='removeList()'></span>");
$('.tabs').append("<span id='updateall' class='status vhshift' style='display:none;margin-left:12px'><input type='button' value=\"_(Update All Plugins)_\" onclick='openPlugin(\"plugin updateall\",\"_(Update All Plugins)_\",\":return\")'></span>");
$('.tabs').append("<span id='checkall' class='status vhshift'><input type='button' value=\"_(Check For Updates)_\" onclick='openPlugin(\"checkall\",\"_(Plugin Update Check)_\",\":return\")' disabled></span>");
});
</script>
@@ -34,7 +34,7 @@ function check_plugin($arg, &$ncsi) {
function make_link($method, $arg, $extra='') {
$plg = basename($arg,'.plg').':'.$method;
$id = str_replace(['.',' ','_'],'',$plg);
$check = $method=='remove' ? "<input type='checkbox' onClick='document.getElementById(\"$id\").disabled=!this.checked'>" : "";
$check = $method=='remove' ? "<input type='checkbox' data='$arg' class='remove' onClick='document.getElementById(\"$id\").disabled=!this.checked;multiRemove()'>" : "";
$disabled = $check ? ' disabled' : '';
if ($method == 'delete') {
$cmd = "plugin_rm $arg"; $plg = "";