diff --git a/remote-server/control-panel/index.html b/remote-server/control-panel/index.html index 8763f24d..e3132594 100644 --- a/remote-server/control-panel/index.html +++ b/remote-server/control-panel/index.html @@ -118,10 +118,8 @@ document.getElementById("max_photos_value").checked = true; // Set the value of the toggle button document.getElementById("max_photos_value").value = value; - // Write the value in the label too - document.getElementById("max_photos_label").innerHTML = value; // Display the input to change the value - document.getElementById("max_photos_input").style.display = "block"; + document.getElementById("max_photos_block").style.display = "block"; // Set the initial value to the config file value document.getElementById("max_photos_input").value = value; } @@ -179,6 +177,9 @@ * ready to be sent to the server or returned to the user. */ function formdataToJson(formData){ + console.log("Last loaded data: "); + console.log(last_loaded_data); + var object = {}; const form = document.getElementById('config'); Array.from(form.elements).forEach((field) => { @@ -202,9 +203,21 @@ value = field.checked ? true: false; } // This is a file that has not been changed. - // Be sure to re-send the old value, or it will clear the field. - if (value===null && field.type === "file"){ + // Be sure to re-send the old value, or it will clear the field. + if (field.type === "file"){ + console.log("File field detected with value "+ value); + } + if ((value===null || value==="") && field.type === "file"){ + // Firefox value = deepGet(key, last_loaded_data); + } else if (Object.prototype.toString.call(value) == '[object File]'){ + // Chrome + if(field.files.length > 0){ + value = field.files[0].name; + } else { + value = deepGet(key, last_loaded_data); + } + } if (value !== null && value !== "" && typeof value !== 'undefined'){ // Get the proper value from filepickers @@ -216,6 +229,7 @@ } }); filtered_object = object + console.log(filtered_object); return filtered_object; } @@ -500,30 +514,7 @@

Server:

-
- - -
-
-
-
-
-
-
-
-
- -
-
+
@@ -608,6 +599,33 @@

Foto:

NOTA: non utilizzare un doppio underscore ( __ ) nel nome della foto.

+ + + +
+
+
+
+
+
+
+
+ +