From fdd528b1007b1cc3c7fa248bc880469fd400c00f Mon Sep 17 00:00:00 2001 From: bergware Date: Fri, 10 Feb 2023 13:52:59 +0100 Subject: [PATCH] Docker: filetree corrections --- .../include/CreateDocker.php | 22 ++++++-------- plugins/dynamix/include/FileTree.php | 30 ++++++++++--------- plugins/dynamix/styles/jquery.filetree.css | 2 +- 3 files changed, 26 insertions(+), 28 deletions(-) diff --git a/plugins/dynamix.docker.manager/include/CreateDocker.php b/plugins/dynamix.docker.manager/include/CreateDocker.php index 487909a28..d6537f605 100644 --- a/plugins/dynamix.docker.manager/include/CreateDocker.php +++ b/plugins/dynamix.docker.manager/include/CreateDocker.php @@ -341,7 +341,7 @@ function makeConfig(opts) { if (opts.Type == "Path") { value.attr("onclick", "openFileBrowser(this,$(this).val(),$(this).val(),'',true,false);"); } else if (opts.Type == "Device") { - value.attr("onclick", "openFileBrowser(this,'/dev','/dev','',false,true);") + value.attr("onclick", "openFileBrowser(this,'/dev','/dev','',true,true);") } else if (opts.Type == "Variable" && opts.Default.split("|").length > 1) { var valueOpts = opts.Default.split("|"); var newValue = ""); - value.bind("click", function(){openFileBrowser(this, $(this).val(), $(this).val(), 'sh', true, false);}); + value.bind("click", function(){openFileBrowser(this,$(this).val(),$(this).val(),'',true,false);}); targetDiv.find('#dt1').text("_(Container Path)_"); valueDiv.find('#dt2').text("_(Host Path)_"); break; @@ -605,7 +605,7 @@ function toggleMode(el,disabled) { targetDiv.hide(); defaultDiv.hide(); valueDiv.find('#dt2').text("_(Value)_"); - value.bind("click", function(){openFileBrowser(this, '/dev', '/dev', '', true, true);}); + value.bind("click", function(){openFileBrowser(this,'/dev','/dev','',true,true);}); break; } reloadTriggers(); @@ -630,21 +630,17 @@ function openFileBrowser(el, top, root, filter, on_folders, on_files, close_on_s if (!filter && !on_files) filter = 'HIDE_FILES_FILTER'; if (!root.trim()) {root = "/mnt/user/"; top = "/mnt/";} p = $(el); - // Skip is fileTree is already open + // Skip if fileTree is already open if (p.next().hasClass('fileTree')) return null; // create a random id - var r = Math.floor((Math.random()*1000)+1); + var r = Math.floor((Math.random()*10000)+1); // Add a new span and load fileTree p.after(""); var ft = $('#fileTree'+r); - ft.fileTree({ - top: top, - root: root, - filter: filter, - allowBrowsing: true - }, - function(file){if(on_files){p.val(file);p.trigger('change');if(close_on_select){ft.slideUp('fast',function(){ft.remove();});}}}, - function(folder){if(on_folders){p.val(folder.replace(/\/\/+/g,'/'));p.trigger('change');if(close_on_select){$(ft).slideUp('fast',function(){$(ft).remove();});}}}); + ft.fileTree({top:top, root:root, filter:filter, allowBrowsing:true}, + function(file){if(on_files){p.val(file);p.trigger('change');if(close_on_select){ft.slideUp('fast',function(){ft.remove();});}}}, + function(folder){if(on_folders){p.val(folder.replace(/\/\/+/g,'/'));p.trigger('change');if(close_on_select){$(ft).slideUp('fast',function(){$(ft).remove();});}}} + ); // Format fileTree according to parent position, height and width ft.css({'left':p.position().left,'top':(p.position().top+p.outerHeight()),'width':(p.width())}); // close if click elsewhere diff --git a/plugins/dynamix/include/FileTree.php b/plugins/dynamix/include/FileTree.php index 4f09c0955..f2e06a358 100644 --- a/plugins/dynamix/include/FileTree.php +++ b/plugins/dynamix/include/FileTree.php @@ -52,21 +52,23 @@ echo "