mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Fix id mismatch zip upload import
This commit is contained in:
parent
551020f738
commit
c74aeb5dde
@ -424,8 +424,8 @@
|
||||
<input type="text" class="form-control" id="zip_root_path" name="zip_root_path">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="dir_select" tabindex="-1" role="dialog" aria-labelledby="dir_select"
|
||||
aria-hidden="true">
|
||||
<div class="modal fade" id="dir_upload_select" tabindex="-1" role="dialog"
|
||||
aria-labelledby="dir_select" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@ -436,7 +436,7 @@
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="tree-ctx-item" id="main-tree-div" data-path=""
|
||||
<div class="tree-ctx-item" id="main-tree-div-upload" data-path=""
|
||||
style="overflow: scroll; max-height:75%;">
|
||||
<input type="radio" id="main-tree-input-upload" name="root_path" value="" checked>
|
||||
<span id="main-tree" class="files-tree-title tree-caret-down root-dir" data-path="">
|
||||
@ -558,7 +558,7 @@
|
||||
|
||||
{% block js%}
|
||||
<script>
|
||||
|
||||
var upload;
|
||||
var file;
|
||||
function sendFile() {
|
||||
file = $("#file")[0].files[0]
|
||||
@ -597,8 +597,9 @@
|
||||
|
||||
document.getElementById("root_upload_button").addEventListener("click", function () {
|
||||
if (file) {
|
||||
upload = true;
|
||||
if (document.getElementById('root_upload_button').classList.contains('clicked')) {
|
||||
document.getElementById('main-tree-div').innerHTML = '<input type="radio" id="main-tree-input-upload" name="root_path" value="" checked><span id="main-tree" class="files-tree-title tree-caret-down root-dir" data-path=""><i class="far fa-folder"></i><i class="far fa-folder-open"></i>{{ translate("serverFiles", "files", data["lang"]) }}</span></input>'
|
||||
document.getElementById('main-tree-div-upload').innerHTML = '<input type="radio" id="main-tree-input-upload" name="root_path" value="" checked><span id="main-tree-upload" class="files-tree-title tree-caret-down root-dir" data-path=""><i class="far fa-folder"></i><i class="far fa-folder-open"></i>{{ translate("serverFiles", "files", data["lang"]) }}</span></input>'
|
||||
} else {
|
||||
document.getElementById('root_upload_button').classList.add('clicked')
|
||||
}
|
||||
@ -692,8 +693,12 @@
|
||||
}
|
||||
|
||||
function show_file_tree() {
|
||||
if (upload) {
|
||||
$("#dir_upload_select").modal();
|
||||
} else {
|
||||
$("#dir_select").modal();
|
||||
}
|
||||
}
|
||||
|
||||
function getTreeView(path) {
|
||||
const styles = window.getComputedStyle(document.getElementById("lower_half"));
|
||||
@ -716,13 +721,21 @@
|
||||
dataArr = data.split('\n');
|
||||
serverDir = dataArr.shift(); // Remove & return first element (server directory)
|
||||
text = dataArr.join('\n');
|
||||
|
||||
if (styles.visibility === "hidden") {
|
||||
try {
|
||||
document.getElementById('main-tree-div').innerHTML += text;
|
||||
document.getElementById('main-tree').parentElement.classList.add("clicked");
|
||||
} catch {
|
||||
document.getElementById('files-tree').innerHTML = text;
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
document.getElementById('main-tree-div-upload').innerHTML += text;
|
||||
document.getElementById('main-tree-upload').parentElement.classList.add("clicked");
|
||||
} catch {
|
||||
document.getElementById('files-tree').innerHTML = text;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
document.getElementsByClassName('files-tree-title')[0].setAttribute('data-path', serverDir);
|
||||
|
@ -552,8 +552,8 @@
|
||||
<input type="text" class="form-control" id="zip_root_path" name="zip_root_path">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="dir_select" tabindex="-1" role="dialog" aria-labelledby="dir_select"
|
||||
aria-hidden="true">
|
||||
<div class="modal fade" id="dir_upload_select" tabindex="-1" role="dialog"
|
||||
aria-labelledby="dir_select" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@ -564,10 +564,11 @@
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="tree-ctx-item" id="main-tree-div" data-path=""
|
||||
<div class="tree-ctx-item" id="main-tree-div-upload" data-path=""
|
||||
style="overflow: scroll; max-height:75%;">
|
||||
<input type="radio" id="main-tree-input-upload" name="root_path" value="" checked>
|
||||
<span id="main-tree" class="files-tree-title tree-caret-down root-dir" data-path="">
|
||||
<span id="main-tree-upload" class="files-tree-title tree-caret-down root-dir"
|
||||
data-path="">
|
||||
<i class="far fa-folder"></i>
|
||||
<i class="far fa-folder-open"></i>
|
||||
{{ translate('serverFiles', 'files', data['lang']) }}
|
||||
@ -799,6 +800,7 @@
|
||||
|
||||
{% block js %}
|
||||
<script>
|
||||
var upload = false;
|
||||
var file;
|
||||
function sendFile() {
|
||||
file = $("#file")[0].files[0]
|
||||
@ -862,8 +864,9 @@
|
||||
|
||||
document.getElementById("root_upload_button").addEventListener("click", function () {
|
||||
if (file) {
|
||||
upload = true;
|
||||
if (document.getElementById('root_upload_button').classList.contains('clicked')) {
|
||||
document.getElementById('main-tree-div').innerHTML = '<input type="radio" id="main-tree-input-upload" name="root_path" value="" checked><span id="main-tree" class="files-tree-title tree-caret-down root-dir" data-path=""><i class="far fa-folder"></i><i class="far fa-folder-open"></i>{{ translate("serverFiles", "files", data["lang"]) }}</span></input>'
|
||||
document.getElementById('main-tree-div-upload').innerHTML = '<input type="radio" id="main-tree-input-upload" name="root_path" value="" checked><span id="main-tree-upload" class="files-tree-title tree-caret-down root-dir" data-path=""><i class="far fa-folder"></i><i class="far fa-folder-open"></i>{{ translate("serverFiles", "files", data["lang"]) }}</span></input>'
|
||||
} else {
|
||||
document.getElementById('root_upload_button').classList.add('clicked')
|
||||
}
|
||||
@ -926,8 +929,12 @@
|
||||
}
|
||||
|
||||
function show_file_tree() {
|
||||
if (upload) {
|
||||
$("#dir_upload_select").modal();
|
||||
} else {
|
||||
$("#dir_select").modal();
|
||||
}
|
||||
}
|
||||
|
||||
function check_sizes(a, b, changed) {
|
||||
max_mem = parseFloat(a.val());
|
||||
@ -961,14 +968,21 @@
|
||||
dataArr = data.split('\n');
|
||||
serverDir = dataArr.shift(); // Remove & return first element (server directory)
|
||||
text = dataArr.join('\n');
|
||||
|
||||
if (styles.visibility === "hidden") {
|
||||
try {
|
||||
document.getElementById('main-tree-div').innerHTML += text;
|
||||
document.getElementById('main-tree').parentElement.classList.add("clicked");
|
||||
} catch {
|
||||
document.getElementById('files-tree').innerHTML = text;
|
||||
}
|
||||
|
||||
} else {
|
||||
try {
|
||||
document.getElementById('main-tree-div-upload').innerHTML += text;
|
||||
document.getElementById('main-tree-upload').parentElement.classList.add("clicked");
|
||||
} catch {
|
||||
document.getElementById('files-tree').innerHTML = text;
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementsByClassName('files-tree-title')[0].setAttribute('data-path', serverDir);
|
||||
document.getElementsByClassName('files-tree-title')[0].setAttribute('data-name', 'Files');
|
||||
|
Loading…
Reference in New Issue
Block a user