mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Fix minor bugs with uploads import
This commit is contained in:
parent
5f8c0dab4c
commit
352a3e12e7
@ -673,6 +673,9 @@ class TasksManager:
|
||||
user.id, {"pfp": self.helper.get_gravatar_image(user.email)}
|
||||
)
|
||||
# Search for old files in imports
|
||||
self.helper.ensure_dir_exists(
|
||||
os.path.join(self.controller.project_root, "imports")
|
||||
)
|
||||
for file in os.listdir(os.path.join(self.controller.project_root, "imports")):
|
||||
if self.helper.is_file_older_than_x_days(
|
||||
os.path.join(self.controller.project_root, "imports", file)
|
||||
|
@ -313,7 +313,8 @@
|
||||
<button id="zip_submit" type="submit" title="You must select server root dir first" disabled
|
||||
class="btn btn-primary mr-2">{{ translate('serverWizard', 'importServerButton', data['lang'])
|
||||
}}</button>
|
||||
<button type="reset" class="btn btn-danger mr-2">{{ translate('serverWizard', 'resetForm', data['lang'])
|
||||
<button type="button" class="btn btn-danger mr-2 tree-reset">{{ translate('serverWizard', 'resetForm',
|
||||
data['lang'])
|
||||
}}</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -460,7 +461,8 @@
|
||||
<button id="upload_submit" type="submit" title="You must select server root dir first" disabled
|
||||
class="btn btn-primary mr-2">{{ translate('serverWizard', 'importServerButton', data['lang'])
|
||||
}}</button>
|
||||
<button type="reset" class="btn btn-danger mr-2">{{ translate('serverWizard', 'resetForm', data['lang'])
|
||||
<button type="button" class="btn btn-danger mr-2 tree-reset">{{ translate('serverWizard', 'resetForm',
|
||||
data['lang'])
|
||||
}}</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -641,6 +643,9 @@
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
$(".tree-reset").on("click", function () {
|
||||
location.href = "/server/bedrock_step1";
|
||||
});
|
||||
document.getElementById("root_files_button").addEventListener("click", function () {
|
||||
if (document.forms["zip"]["server_path"].value != "") {
|
||||
if (document.getElementById('root_files_button').classList.contains('clicked')) {
|
||||
@ -792,6 +797,8 @@
|
||||
document.getElementById('main-tree-input-upload').setAttribute('value', data.path)
|
||||
getTreeView(data.path);
|
||||
show_file_tree();
|
||||
$("#root_files_button").attr("disabled", "disabled");
|
||||
$("#root_upload_button").attr("disabled", "disabled");
|
||||
|
||||
}, 5000);
|
||||
});
|
||||
|
@ -423,7 +423,8 @@
|
||||
<button id="zip_submit" type="submit" title="You must select server root dir first" disabled
|
||||
class="btn btn-primary mr-2">{{ translate('serverWizard', 'importServerButton', data['lang'])
|
||||
}}</button>
|
||||
<button type="reset" class="btn btn-danger mr-2">{{ translate('serverWizard', 'resetForm', data['lang'])
|
||||
<button type="button" class="btn btn-danger mr-2 tree-reset">{{ translate('serverWizard', 'resetForm',
|
||||
data['lang'])
|
||||
}}</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -588,7 +589,8 @@
|
||||
<button id="upload_submit" type="submit" title="You must select server root dir first" disabled
|
||||
class="btn btn-primary mr-2">{{ translate('serverWizard', 'importServerButton', data['lang'])
|
||||
}}</button>
|
||||
<button type="reset" class="btn btn-danger mr-2">{{ translate('serverWizard', 'resetForm', data['lang'])
|
||||
<button type="button" class="btn btn-danger mr-2 tree-reset">{{ translate('serverWizard', 'resetForm',
|
||||
data['lang'])
|
||||
}}</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -712,24 +714,24 @@
|
||||
}
|
||||
|
||||
.scroll {
|
||||
max-height: 12em;
|
||||
overflow-y: auto;
|
||||
max - height: 12em;
|
||||
overflow - y: auto;
|
||||
}
|
||||
|
||||
.menu-btn {
|
||||
font-size: 0.9em;
|
||||
.menu - btn {
|
||||
font - size: 0.9em;
|
||||
padding: 2px 10px;
|
||||
}
|
||||
|
||||
.menu {
|
||||
padding-top: 10px;
|
||||
z-index: 200;
|
||||
margin-top: 4px;
|
||||
padding - top: 10px;
|
||||
z - index: 200;
|
||||
margin - top: 4px;
|
||||
position: absolute;
|
||||
background-color: #2a2c44;
|
||||
background - color: #2a2c44;
|
||||
}
|
||||
|
||||
.menu-option {
|
||||
.menu - option {
|
||||
padding: 6px 20px 6px;
|
||||
color: white;
|
||||
}
|
||||
@ -738,66 +740,66 @@
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 100;
|
||||
width: 100 %;
|
||||
height: 100 %;
|
||||
z - index: 100;
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
</style >
|
||||
<style>
|
||||
/* Remove default bullets */
|
||||
.tree-view,
|
||||
.tree-nested {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
margin-left: 10px;
|
||||
.tree-view,
|
||||
.tree-nested {
|
||||
list - style - type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
/* Style the items */
|
||||
.tree-item,
|
||||
.files-tree-title {
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
/* Style the items */
|
||||
.tree-item,
|
||||
.files-tree-title {
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
/* Prevent text selection */
|
||||
}
|
||||
|
||||
/* Create the caret/arrow with a unicode, and style it */
|
||||
.tree-caret .fa-folder {
|
||||
display: inline-block;
|
||||
/* Create the caret/arrow with a unicode, and style it */
|
||||
.tree-caret .fa-folder {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.tree-caret .fa-folder-open {
|
||||
display: none;
|
||||
.tree-caret .fa-folder-open {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Rotate the caret/arrow icon when clicked on (using JavaScript) */
|
||||
.tree-caret-down .fa-folder {
|
||||
display: none;
|
||||
/* Rotate the caret/arrow icon when clicked on (using JavaScript) */
|
||||
.tree-caret-down .fa-folder {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.tree-caret-down .fa-folder-open {
|
||||
display: inline-block;
|
||||
.tree-caret-down .fa-folder-open {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/* Hide the nested list */
|
||||
.tree-nested {
|
||||
display: none;
|
||||
/* Hide the nested list */
|
||||
.tree-nested {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#op_logo {
|
||||
position: relative;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
#op_logo {
|
||||
position: relative;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
{% end %}
|
||||
{% end %}
|
||||
|
||||
{% block js%}
|
||||
<script>
|
||||
var file;
|
||||
function sendFile() {
|
||||
file = $("#file")[0].files[0]
|
||||
{% block js %}
|
||||
<script>
|
||||
var file;
|
||||
function sendFile() {
|
||||
file = $("#file")[0].files[0]
|
||||
document.getElementById("upload_input").innerHTML = '<div class="progress"><div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%"> <i class="fa-solid fa-spinner"></i></div></div>'
|
||||
let xmlHttpRequest = new XMLHttpRequest();
|
||||
let token = getCookie("_xsrf")
|
||||
@ -816,13 +818,13 @@
|
||||
xmlHttpRequest.setRequestHeader('X-FileName', fileName);
|
||||
xmlHttpRequest.addEventListener('load', (event) => {
|
||||
if (event.target.responseText == 'success') {
|
||||
console.log('Upload for file', file.name, 'was successful!')
|
||||
console.log('Upload for file', file.name, 'was successful!')
|
||||
document.getElementById("upload_input").innerHTML = '<div class="card-header header-sm d-flex justify-content-between align-items-center"><span id="file-uploaded" style="color: gray;">' + fileName + '</span> 🔒</div>';
|
||||
document.getElementById("lower_half").style.visibility = "visible";
|
||||
document.getElementById("lower_half").style.visibility = "visible";
|
||||
}
|
||||
else {
|
||||
alert('Upload failed with response: ' + event.target.responseText);
|
||||
doUpload = false;
|
||||
else {
|
||||
alert('Upload failed with response: ' + event.target.responseText);
|
||||
doUpload = false;
|
||||
}
|
||||
}, false);
|
||||
xmlHttpRequest.addEventListener('error', (e) => {
|
||||
@ -832,60 +834,63 @@
|
||||
}
|
||||
|
||||
|
||||
document.getElementById("root_files_button").addEventListener("click", function () {
|
||||
document.getElementById("root_files_button").addEventListener("click", function () {
|
||||
if (document.forms["zip"]["server_path"].value != "") {
|
||||
if (document.getElementById('root_files_button').classList.contains('clicked')) {
|
||||
document.getElementById('main-tree-div').innerHTML = '<input type="radio" id="main-tree-input" 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>'
|
||||
} else {
|
||||
document.getElementById('root_files_button').classList.add('clicked')
|
||||
}
|
||||
path = document.forms["zip"]["server_path"].value;
|
||||
console.log(document.forms["zip"]["server_path"].value)
|
||||
var token = getCookie("_xsrf");
|
||||
var dialog = bootbox.dialog({
|
||||
message: '<p class="text-center mb-0"><i class="fa fa-spin fa-cog"></i> Please wait while we gather your files...</p>',
|
||||
closeButton: false
|
||||
document.getElementById('main-tree-div').innerHTML = '<input type="radio" id="main-tree-input" 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>'
|
||||
} else {
|
||||
document.getElementById('root_files_button').classList.add('clicked')
|
||||
}
|
||||
path = document.forms["zip"]["server_path"].value;
|
||||
console.log(document.forms["zip"]["server_path"].value)
|
||||
var token = getCookie("_xsrf");
|
||||
var dialog = bootbox.dialog({
|
||||
message: '<p class="text-center mb-0"><i class="fa fa-spin fa-cog"></i> Please wait while we gather your files...</p>',
|
||||
closeButton: false
|
||||
});
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
headers: { 'X-XSRFToken': token },
|
||||
url: '/ajax/unzip_server?id=-1&path=' + path,
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
headers: {'X-XSRFToken': token },
|
||||
url: '/ajax/unzip_server?id=-1&path=' + path,
|
||||
});
|
||||
} else {
|
||||
bootbox.alert("You must input a path before selecting this button");
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById("root_upload_button").addEventListener("click", function () {
|
||||
document.getElementById("root_upload_button").addEventListener("click", function () {
|
||||
if (file) {
|
||||
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>'
|
||||
} else {
|
||||
document.getElementById('root_upload_button').classList.add('clicked')
|
||||
}
|
||||
var token = getCookie("_xsrf");
|
||||
var dialog = bootbox.dialog({
|
||||
message: '<p class="text-center mb-0"><i class="fa fa-spin fa-cog"></i> Please wait while we gather your files...</p>',
|
||||
closeButton: false
|
||||
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>'
|
||||
} else {
|
||||
document.getElementById('root_upload_button').classList.add('clicked')
|
||||
}
|
||||
var token = getCookie("_xsrf");
|
||||
var dialog = bootbox.dialog({
|
||||
message: '<p class="text-center mb-0"><i class="fa fa-spin fa-cog"></i> Please wait while we gather your files...</p>',
|
||||
closeButton: false
|
||||
});
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
headers: { 'X-XSRFToken': token },
|
||||
url: '/ajax/unzip_server?id=-1&file=' + file.name,
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
headers: {'X-XSRFToken': token },
|
||||
url: '/ajax/unzip_server?id=-1&file=' + file.name,
|
||||
});
|
||||
} else {
|
||||
bootbox.alert("You must input a path before selecting this button");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
function dropDown(event) {
|
||||
event.target.parentElement.children[1].classList.remove("d-none");
|
||||
<script>
|
||||
$(".tree-reset").on("click", function () {
|
||||
location.href = "/server/step1";
|
||||
});
|
||||
function dropDown(event) {
|
||||
event.target.parentElement.children[1].classList.remove("d-none");
|
||||
document.getElementById("overlay").classList.remove("d-none");
|
||||
}
|
||||
|
||||
function hide(event) {
|
||||
function hide(event) {
|
||||
var items = document.getElementsByClassName('menu');
|
||||
items.forEach(item => {
|
||||
item.classList.add("d-none");
|
||||
@ -894,36 +899,36 @@
|
||||
document.getElementById("overlay").classList.add("d-none");
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
console.log('ready');
|
||||
$(document).ready(function () {
|
||||
console.log('ready');
|
||||
var forms = $('form.server-wizard');
|
||||
forms.each(function (i, formEl) {
|
||||
var form = $(formEl);
|
||||
var min = form.find('[name=min_memory]');
|
||||
var max = form.find('[name=max_memory]');
|
||||
console.log(form, min, max)
|
||||
min.change(function () {
|
||||
check_sizes(max, min, 'min');
|
||||
var min = form.find('[name=min_memory]');
|
||||
var max = form.find('[name=max_memory]');
|
||||
console.log(form, min, max)
|
||||
min.change(function () {
|
||||
check_sizes(max, min, 'min');
|
||||
});
|
||||
max.change(function () {
|
||||
check_sizes(max, min, 'max');
|
||||
max.change(function () {
|
||||
check_sizes(max, min, 'max');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function wait_msg(importing) {
|
||||
bootbox.alert({
|
||||
title: importing ? '{% raw translate("serverWizard", "importing", data["lang"]) %}' : '{% raw translate("serverWizard", "downloading", data["lang"]) %}',
|
||||
message: '<i class="fas fa-cloud-download"></i> {% raw translate("serverWizard", "bePatient", data["lang"]) %}',
|
||||
});
|
||||
function wait_msg(importing) {
|
||||
bootbox.alert({
|
||||
title: importing ? '{% raw translate("serverWizard", "importing", data["lang"]) %}' : '{% raw translate("serverWizard", "downloading", data["lang"]) %}',
|
||||
message: '<i class="fas fa-cloud-download"></i> {% raw translate("serverWizard", "bePatient", data["lang"]) %}',
|
||||
});
|
||||
}
|
||||
|
||||
function show_file_tree() {
|
||||
$("#dir_select").modal();
|
||||
function show_file_tree() {
|
||||
$("#dir_select").modal();
|
||||
}
|
||||
|
||||
function check_sizes(a, b, changed) {
|
||||
max_mem = parseFloat(a.val());
|
||||
function check_sizes(a, b, changed) {
|
||||
max_mem = parseFloat(a.val());
|
||||
min_mem = parseFloat(b.val());
|
||||
if (max_mem < min_mem && changed === 'min') {
|
||||
a.val(min_mem)
|
||||
@ -933,7 +938,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
function getTreeView(path) {
|
||||
function getTreeView(path) {
|
||||
//If this value is still hidden we know the user is executing a zip import and not an upload
|
||||
if (document.getElementById("lower_half").visibility == "hidden") {
|
||||
document.getElementById('zip_submit').disabled = false;
|
||||
@ -944,51 +949,51 @@
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/ajax/get_zip_tree?id=-1&path=' + path,
|
||||
dataType: 'text',
|
||||
success: function (data) {
|
||||
console.log("got response:");
|
||||
console.log(data);
|
||||
url: '/ajax/get_zip_tree?id=-1&path=' + path,
|
||||
dataType: 'text',
|
||||
success: function (data) {
|
||||
console.log("got response:");
|
||||
console.log(data);
|
||||
|
||||
dataArr = data.split('\n');
|
||||
serverDir = dataArr.shift(); // Remove & return first element (server directory)
|
||||
text = dataArr.join('\n');
|
||||
dataArr = data.split('\n');
|
||||
serverDir = dataArr.shift(); // Remove & return first element (server directory)
|
||||
text = dataArr.join('\n');
|
||||
|
||||
try {
|
||||
document.getElementById('main-tree-div').innerHTML += text;
|
||||
document.getElementById('main-tree').parentElement.classList.add("clicked");
|
||||
try {
|
||||
document.getElementById('main-tree-div').innerHTML += text;
|
||||
document.getElementById('main-tree').parentElement.classList.add("clicked");
|
||||
} catch {
|
||||
document.getElementById('files-tree').innerHTML = text;
|
||||
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');
|
||||
document.getElementsByClassName('files-tree-title')[0].setAttribute('data-path', serverDir);
|
||||
document.getElementsByClassName('files-tree-title')[0].setAttribute('data-name', 'Files');
|
||||
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function getToggleMain(event) {
|
||||
path = event.target.parentElement.getAttribute('data-path');
|
||||
function getToggleMain(event) {
|
||||
path = event.target.parentElement.getAttribute('data-path');
|
||||
document.getElementById("files-tree").classList.toggle("d-block");
|
||||
document.getElementById(path + "span").classList.toggle("tree-caret-down");
|
||||
document.getElementById(path + "span").classList.toggle("tree-caret");
|
||||
}
|
||||
|
||||
|
||||
function getDirView(event) {
|
||||
path = event.target.parentElement.getAttribute('data-path');
|
||||
function getDirView(event) {
|
||||
path = event.target.parentElement.getAttribute('data-path');
|
||||
|
||||
if (document.getElementById(path).classList.contains('clicked')) {
|
||||
|
||||
var toggler = document.getElementById(path + "span");
|
||||
|
||||
if (toggler.classList.contains('files-tree-title')) {
|
||||
document.getElementById(path + "ul").classList.toggle("d-block");
|
||||
document.getElementById(path + "span").classList.toggle("tree-caret-down");
|
||||
if (toggler.classList.contains('files-tree-title')) {
|
||||
document.getElementById(path + "ul").classList.toggle("d-block");
|
||||
document.getElementById(path + "span").classList.toggle("tree-caret-down");
|
||||
}
|
||||
return;
|
||||
return;
|
||||
} else {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
@ -1021,53 +1026,56 @@
|
||||
});
|
||||
}
|
||||
}
|
||||
if (webSocket) {
|
||||
webSocket.on('send_temp_path', function (data) {
|
||||
setTimeout(function () {
|
||||
var x = document.querySelector('.bootbox');
|
||||
if (x) {
|
||||
x.remove()
|
||||
}
|
||||
var x = document.querySelector('.modal-backdrop');
|
||||
if (x) {
|
||||
x.remove()
|
||||
}
|
||||
document.getElementById('main-tree-input').setAttribute('value', data.path)
|
||||
document.getElementById('main-tree-input-upload').setAttribute('value', data.path)
|
||||
getTreeView(data.path);
|
||||
show_file_tree();
|
||||
if (webSocket) {
|
||||
webSocket.on('send_temp_path', function (data) {
|
||||
setTimeout(function () {
|
||||
var x = document.querySelector('.bootbox');
|
||||
if (x) {
|
||||
x.remove()
|
||||
}
|
||||
var x = document.querySelector('.modal-backdrop');
|
||||
if (x) {
|
||||
x.remove()
|
||||
}
|
||||
document.getElementById('main-tree-input').setAttribute('value', data.path)
|
||||
document.getElementById('main-tree-input-upload').setAttribute('value', data.path)
|
||||
getTreeView(data.path);
|
||||
show_file_tree();
|
||||
|
||||
}, 5000);
|
||||
});
|
||||
$("#root_files_button").attr("disabled", "disabled");
|
||||
$("#root_upload_button").attr("disabled", "disabled");
|
||||
|
||||
}, 5000);
|
||||
});
|
||||
}
|
||||
|
||||
function refreshCache() {
|
||||
function refreshCache() {
|
||||
var token = getCookie("_xsrf")
|
||||
document.getElementById("refresh-cache").classList.add("fa-spin")
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
headers: { 'X-XSRFToken': token },
|
||||
url: '/ajax/jar_cache',
|
||||
success: function () {
|
||||
document.getElementById("refresh-cache").classList.remove("fa-sync");
|
||||
document.getElementById("refresh-cache").classList.remove("fa-spin");
|
||||
document.getElementById("refresh-cache").classList.add("fa-check");
|
||||
headers: {'X-XSRFToken': token },
|
||||
url: '/ajax/jar_cache',
|
||||
success: function () {
|
||||
document.getElementById("refresh-cache").classList.remove("fa-sync");
|
||||
document.getElementById("refresh-cache").classList.remove("fa-spin");
|
||||
document.getElementById("refresh-cache").classList.add("fa-check");
|
||||
|
||||
setTimeout(function () {
|
||||
location.reload();
|
||||
setTimeout(function () {
|
||||
location.reload();
|
||||
}, 2000);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
var text = '{% raw data["js_server_types"] %}';
|
||||
var serverTypesLists = JSON.parse(text);
|
||||
/* CountryChange() is called from the onchange event of a select element.
|
||||
* param selectObj - the select object which fired the on change event.
|
||||
*/
|
||||
function serverTypeChange(selectObj) {
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
var text = '{% raw data["js_server_types"] %}';
|
||||
var serverTypesLists = JSON.parse(text);
|
||||
/* CountryChange() is called from the onchange event of a select element.
|
||||
* param selectObj - the select object which fired the on change event.
|
||||
*/
|
||||
function serverTypeChange(selectObj) {
|
||||
// get the index of the selected option
|
||||
var idx = document.getElementById('server_type').selectedIndex;
|
||||
// get the value of the selected option
|
||||
@ -1076,9 +1084,9 @@
|
||||
var which = document.getElementById('server_type').options[idx].value;
|
||||
} catch {
|
||||
while (cSelect.options.length > 0) {
|
||||
cSelect.remove(0);
|
||||
cSelect.remove(0);
|
||||
}
|
||||
return;
|
||||
return;
|
||||
}
|
||||
let server_type = which.split('|')[0];
|
||||
let server = which.split('|')[1];
|
||||
@ -1095,29 +1103,29 @@
|
||||
// create new options ordered by ascending
|
||||
cList[server].forEach(type => {
|
||||
newOption = document.createElement("option");
|
||||
newOption.value = which + "|" + type; // assumes option string and value are the same
|
||||
newOption.text = type;
|
||||
// add the new option
|
||||
try {
|
||||
cSelect.add(newOption); // this will fail in DOM browsers but is needed for IE
|
||||
newOption.value = which + "|" + type; // assumes option string and value are the same
|
||||
newOption.text = type;
|
||||
// add the new option
|
||||
try {
|
||||
cSelect.add(newOption); // this will fail in DOM browsers but is needed for IE
|
||||
}
|
||||
catch (e) {
|
||||
cSelect.appendChild(newOption);
|
||||
catch (e) {
|
||||
cSelect.appendChild(newOption);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function serverJarChange(selectObj) {
|
||||
let type_select = document.getElementById('server_jar')
|
||||
function serverJarChange(selectObj) {
|
||||
let type_select = document.getElementById('server_jar')
|
||||
let tidx = type_select.selectedIndex;
|
||||
let val = type_select.options[tidx].value;
|
||||
if (val == 'None') {
|
||||
var jcSelect = document.getElementById("server_type");
|
||||
while (jcSelect.options.length > 0) {
|
||||
jcSelect.remove(0);
|
||||
jcSelect.remove(0);
|
||||
}
|
||||
serverTypeChange(selectObj);
|
||||
return;
|
||||
serverTypeChange(selectObj);
|
||||
return;
|
||||
}
|
||||
// get the index of the selected option
|
||||
var jidx = selectObj.selectedIndex;
|
||||
@ -1136,17 +1144,17 @@
|
||||
// create new options ordered by ascending
|
||||
jcList.forEach(type => {
|
||||
jnewOption = document.createElement("option");
|
||||
jnewOption.value = jwhich + "|" + type; // assumes option string and value are the same
|
||||
jnewOption.text = type;
|
||||
// add the new option
|
||||
try {
|
||||
jcSelect.add(jnewOption); // this will fail in DOM browsers but is needed for IE
|
||||
jnewOption.value = jwhich + "|" + type; // assumes option string and value are the same
|
||||
jnewOption.text = type;
|
||||
// add the new option
|
||||
try {
|
||||
jcSelect.add(jnewOption); // this will fail in DOM browsers but is needed for IE
|
||||
}
|
||||
catch (e) {
|
||||
jcSelect.appendChild(jnewOption);
|
||||
catch (e) {
|
||||
jcSelect.appendChild(jnewOption);
|
||||
}
|
||||
})
|
||||
serverTypeChange(selectObj);
|
||||
}
|
||||
</script>
|
||||
{% end %}
|
||||
</script>
|
||||
{% end %}
|
Loading…
Reference in New Issue
Block a user