diff --git a/views/default-min.handlebars b/views/default-min.handlebars index ef8d2e9c..2667d095 100644 --- a/views/default-min.handlebars +++ b/views/default-min.handlebars @@ -5163,6 +5163,7 @@ function p13renamefileEx(b, t) { t.newname = Q('p13renameinput').value; files.sendText(t); p13folderup(999); } function p13fileNameCheck(e) { var x = isFilenameValid(Q('p13renameinput').value); QE('idx_dlgOkButton', x); if ((x == true) && (e != null) && (e.keyCode == 13)) { dialogclose(1); } } function p13uploadFile() { setDialogMode(2, "Upload File", 3, p13uploadFileEx, ''); updateUploadDialogOk('p13uploadinput'); } + function updateUploadDialogOk(x) { QE('idx_dlgOkButton', Q('p13uploadinput').files.length > 0); } function p13uploadFileEx() { p13doUploadFiles(Q('p13uploadinput').files); } function p13viewfile() { var checkboxes = document.getElementsByName('fd'); @@ -6840,9 +6841,35 @@ function p5renamefileEx(b, t) { t.newname = Q('p5renameinput').value; meshserver.send(t); } function p5fileNameCheck(e) { var x = isFilenameValid(Q('p5renameinput').value); QE('idx_dlgOkButton', x); if ((x == true) && (e && e.keyCode == 13)) { dialogclose(1); } } var isFilenameValid = (function(){ var x1=/^[^\\/:\*\?"<>\|]+$/, x2=/^\./, x3=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i; return function isFilenameValid(fname){ return x1.test(fname)&&!x2.test(fname)&&!x3.test(fname)&&(fname[0] != '.'); } })(); - function p5uploadFile() { setDialogMode(2, "Upload File", 3, p5uploadFileEx, '
'); updateUploadDialogOk('p5uploadinput'); } + function p5uploadFile() { setDialogMode(2, "Upload File", 3, p5uploadFileEx, ''); p5updateUploadDialogOk('p5uploadinput'); } function p5uploadFileEx() { Q('p5loginSubmit').click(); } - function updateUploadDialogOk(x) { QE('idx_dlgOkButton', Q(x).value != ''); } + function p5updateUploadDialogOk() { + // Check if these are files we can upload, remove all folders. + var xallfiles = Q('p5uploadinput').files, files = []; + for (var i in xallfiles) { if ((xallfiles[i].size != null) && (xallfiles[i].size != 0)) { files.push(xallfiles[i]); } } + + // Check if these files are duplicates of existing files. + var filetreex = filetree, allfiles = [], overWriteCount = 0; + for (var i in filetreelocation) { + if ((filetreex.f != null) && (filetreex.f[filetreelocation[i]] != null)) { filetreex = filetreex.f[filetreelocation[i]]; } + } + QE('idx_dlgOkButton', xallfiles.length > 0); + if (xallfiles.length > 0) { + if (filetreex.f != null) { + for (var i in filetreex.f) { allfiles.push(i); } + for (var i = 0; i < xallfiles.length; i++) { + if (allfiles.indexOf(xallfiles[i].name) >= 0) { overWriteCount++; } // TODO: If the server is Windows, we need to lowercase both names. + } + } + QV('p5confirmOverwriteSpan', overWriteCount > 0); + if (overWriteCount > 0) { + QE('idx_dlgOkButton', Q('p5confirmOverwrite').checked); + } else { + Q('p5confirmOverwrite').checked = false; + QE('idx_dlgOkButton', true); + } + } + } /* function p5viewfile() { var checkboxes = document.getElementsByName('fc'); @@ -7312,8 +7339,9 @@ } function showCreateNewAccountDialogValidate(x) { - var ve = validateEmail(Q('p4email').value); + var ve = true; if (serverinfo.emailcheck) { + ve = validateEmail(Q('p4email').value); QE('p4verifiedEmail', ve); QE('p4invitationEmail', ve && Q('p4resetNextLogin').checked && Q('p4verifiedEmail').checked); if (ve == false) { Q('p4verifiedEmail').checked = false; } @@ -7580,8 +7608,8 @@ function p30showUserChangePassDialog(multiFactor) { if (xxdialogMode) return; var x = ''; - x += addHtmlValue("Password", ''); - x += addHtmlValue("Password", ''); + x += addHtmlValue("Password", ''); + x += addHtmlValue("Password", ''); if (features & 0x00010000) { x += addHtmlValue("Password hint", ''); } if (passRequirements) { diff --git a/views/default.handlebars b/views/default.handlebars index 5793477b..a044fa68 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -6145,6 +6145,7 @@ function p13renamefileEx(b, t) { t.newname = Q('p13renameinput').value; files.sendText(t); p13folderup(999); } function p13fileNameCheck(e) { var x = isFilenameValid(Q('p13renameinput').value); QE('idx_dlgOkButton', x); if ((x == true) && (e != null) && (e.keyCode == 13)) { dialogclose(1); } } function p13uploadFile() { setDialogMode(2, "Upload File", 3, p13uploadFileEx, ''); updateUploadDialogOk('p13uploadinput'); } + function updateUploadDialogOk(x) { QE('idx_dlgOkButton', Q('p13uploadinput').files.length > 0); } function p13uploadFileEx() { p13doUploadFiles(Q('p13uploadinput').files); } function p13viewfile() { var checkboxes = document.getElementsByName('fd'); @@ -7822,9 +7823,35 @@ function p5renamefileEx(b, t) { t.newname = Q('p5renameinput').value; meshserver.send(t); } function p5fileNameCheck(e) { var x = isFilenameValid(Q('p5renameinput').value); QE('idx_dlgOkButton', x); if ((x == true) && (e && e.keyCode == 13)) { dialogclose(1); } } var isFilenameValid = (function(){ var x1=/^[^\\/:\*\?"<>\|]+$/, x2=/^\./, x3=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i; return function isFilenameValid(fname){ return x1.test(fname)&&!x2.test(fname)&&!x3.test(fname)&&(fname[0] != '.'); } })(); - function p5uploadFile() { setDialogMode(2, "Upload File", 3, p5uploadFileEx, ''); updateUploadDialogOk('p5uploadinput'); } + function p5uploadFile() { setDialogMode(2, "Upload File", 3, p5uploadFileEx, ''); p5updateUploadDialogOk('p5uploadinput'); } function p5uploadFileEx() { Q('p5loginSubmit').click(); } - function updateUploadDialogOk(x) { QE('idx_dlgOkButton', Q(x).value != ''); } + function p5updateUploadDialogOk() { + // Check if these are files we can upload, remove all folders. + var xallfiles = Q('p5uploadinput').files, files = []; + for (var i in xallfiles) { if ((xallfiles[i].size != null) && (xallfiles[i].size != 0)) { files.push(xallfiles[i]); } } + + // Check if these files are duplicates of existing files. + var filetreex = filetree, allfiles = [], overWriteCount = 0; + for (var i in filetreelocation) { + if ((filetreex.f != null) && (filetreex.f[filetreelocation[i]] != null)) { filetreex = filetreex.f[filetreelocation[i]]; } + } + QE('idx_dlgOkButton', xallfiles.length > 0); + if (xallfiles.length > 0) { + if (filetreex.f != null) { + for (var i in filetreex.f) { allfiles.push(i); } + for (var i = 0; i < xallfiles.length; i++) { + if (allfiles.indexOf(xallfiles[i].name) >= 0) { overWriteCount++; } // TODO: If the server is Windows, we need to lowercase both names. + } + } + QV('p5confirmOverwriteSpan', overWriteCount > 0); + if (overWriteCount > 0) { + QE('idx_dlgOkButton', Q('p5confirmOverwrite').checked); + } else { + Q('p5confirmOverwrite').checked = false; + QE('idx_dlgOkButton', true); + } + } + } /* function p5viewfile() { var checkboxes = document.getElementsByName('fc'); @@ -8294,8 +8321,9 @@ } function showCreateNewAccountDialogValidate(x) { - var ve = validateEmail(Q('p4email').value); + var ve = true; if (serverinfo.emailcheck) { + ve = validateEmail(Q('p4email').value); QE('p4verifiedEmail', ve); QE('p4invitationEmail', ve && Q('p4resetNextLogin').checked && Q('p4verifiedEmail').checked); if (ve == false) { Q('p4verifiedEmail').checked = false; } @@ -8562,8 +8590,8 @@ function p30showUserChangePassDialog(multiFactor) { if (xxdialogMode) return; var x = ''; - x += addHtmlValue("Password", ''); - x += addHtmlValue("Password", ''); + x += addHtmlValue("Password", ''); + x += addHtmlValue("Password", ''); if (features & 0x00010000) { x += addHtmlValue("Password hint", ''); } if (passRequirements) { diff --git a/views/translations/default-min_fr.handlebars b/views/translations/default-min_fr.handlebars index d6532975..103b492d 100644 --- a/views/translations/default-min_fr.handlebars +++ b/views/translations/default-min_fr.handlebars @@ -5163,6 +5163,7 @@ function p13renamefileEx(b, t) { t.newname = Q('p13renameinput').value; files.sendText(t); p13folderup(999); } function p13fileNameCheck(e) { var x = isFilenameValid(Q('p13renameinput').value); QE('idx_dlgOkButton', x); if ((x == true) && (e != null) && (e.keyCode == 13)) { dialogclose(1); } } function p13uploadFile() { setDialogMode(2, "Upload File", 3, p13uploadFileEx, ''); updateUploadDialogOk('p13uploadinput'); } + function updateUploadDialogOk(x) { QE('idx_dlgOkButton', Q('p13uploadinput').files.length > 0); } function p13uploadFileEx() { p13doUploadFiles(Q('p13uploadinput').files); } function p13viewfile() { var checkboxes = document.getElementsByName('fd'); @@ -6840,9 +6841,35 @@ function p5renamefileEx(b, t) { t.newname = Q('p5renameinput').value; meshserver.send(t); } function p5fileNameCheck(e) { var x = isFilenameValid(Q('p5renameinput').value); QE('idx_dlgOkButton', x); if ((x == true) && (e && e.keyCode == 13)) { dialogclose(1); } } var isFilenameValid = (function(){ var x1=/^[^\\/:\*\?"<>\|]+$/, x2=/^\./, x3=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i; return function isFilenameValid(fname){ return x1.test(fname)&&!x2.test(fname)&&!x3.test(fname)&&(fname[0] != '.'); } })(); - function p5uploadFile() { setDialogMode(2, "Upload File", 3, p5uploadFileEx, ''); updateUploadDialogOk('p5uploadinput'); } + function p5uploadFile() { setDialogMode(2, "Upload File", 3, p5uploadFileEx, ''); p5updateUploadDialogOk('p5uploadinput'); } function p5uploadFileEx() { Q('p5loginSubmit').click(); } - function updateUploadDialogOk(x) { QE('idx_dlgOkButton', Q(x).value != ''); } + function p5updateUploadDialogOk() { + // Check if these are files we can upload, remove all folders. + var xallfiles = Q('p5uploadinput').files, files = []; + for (var i in xallfiles) { if ((xallfiles[i].size != null) && (xallfiles[i].size != 0)) { files.push(xallfiles[i]); } } + + // Check if these files are duplicates of existing files. + var filetreex = filetree, allfiles = [], overWriteCount = 0; + for (var i in filetreelocation) { + if ((filetreex.f != null) && (filetreex.f[filetreelocation[i]] != null)) { filetreex = filetreex.f[filetreelocation[i]]; } + } + QE('idx_dlgOkButton', xallfiles.length > 0); + if (xallfiles.length > 0) { + if (filetreex.f != null) { + for (var i in filetreex.f) { allfiles.push(i); } + for (var i = 0; i < xallfiles.length; i++) { + if (allfiles.indexOf(xallfiles[i].name) >= 0) { overWriteCount++; } // TODO: If the server is Windows, we need to lowercase both names. + } + } + QV('p5confirmOverwriteSpan', overWriteCount > 0); + if (overWriteCount > 0) { + QE('idx_dlgOkButton', Q('p5confirmOverwrite').checked); + } else { + Q('p5confirmOverwrite').checked = false; + QE('idx_dlgOkButton', true); + } + } + } /* function p5viewfile() { var checkboxes = document.getElementsByName('fc'); @@ -7312,8 +7339,9 @@ } function showCreateNewAccountDialogValidate(x) { - var ve = validateEmail(Q('p4email').value); + var ve = true; if (serverinfo.emailcheck) { + ve = validateEmail(Q('p4email').value); QE('p4verifiedEmail', ve); QE('p4invitationEmail', ve && Q('p4resetNextLogin').checked && Q('p4verifiedEmail').checked); if (ve == false) { Q('p4verifiedEmail').checked = false; } @@ -7580,8 +7608,8 @@ function p30showUserChangePassDialog(multiFactor) { if (xxdialogMode) return; var x = ''; - x += addHtmlValue("Mot de passe", ''); - x += addHtmlValue("Mot de passe", ''); + x += addHtmlValue("Mot de passe", ''); + x += addHtmlValue("Mot de passe", ''); if (features & 0x00010000) { x += addHtmlValue("Password hint", ''); } if (passRequirements) { diff --git a/views/translations/default_fr.handlebars b/views/translations/default_fr.handlebars index 979d3ab0..4d0b2a12 100644 --- a/views/translations/default_fr.handlebars +++ b/views/translations/default_fr.handlebars @@ -6143,6 +6143,7 @@ function p13renamefileEx(b, t) { t.newname = Q('p13renameinput').value; files.sendText(t); p13folderup(999); } function p13fileNameCheck(e) { var x = isFilenameValid(Q('p13renameinput').value); QE('idx_dlgOkButton', x); if ((x == true) && (e != null) && (e.keyCode == 13)) { dialogclose(1); } } function p13uploadFile() { setDialogMode(2, "Upload File", 3, p13uploadFileEx, ''); updateUploadDialogOk('p13uploadinput'); } + function updateUploadDialogOk(x) { QE('idx_dlgOkButton', Q('p13uploadinput').files.length > 0); } function p13uploadFileEx() { p13doUploadFiles(Q('p13uploadinput').files); } function p13viewfile() { var checkboxes = document.getElementsByName('fd'); @@ -7820,9 +7821,35 @@ function p5renamefileEx(b, t) { t.newname = Q('p5renameinput').value; meshserver.send(t); } function p5fileNameCheck(e) { var x = isFilenameValid(Q('p5renameinput').value); QE('idx_dlgOkButton', x); if ((x == true) && (e && e.keyCode == 13)) { dialogclose(1); } } var isFilenameValid = (function(){ var x1=/^[^\\/:\*\?"<>\|]+$/, x2=/^\./, x3=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i; return function isFilenameValid(fname){ return x1.test(fname)&&!x2.test(fname)&&!x3.test(fname)&&(fname[0] != '.'); } })(); - function p5uploadFile() { setDialogMode(2, "Upload File", 3, p5uploadFileEx, ''); updateUploadDialogOk('p5uploadinput'); } + function p5uploadFile() { setDialogMode(2, "Upload File", 3, p5uploadFileEx, ''); p5updateUploadDialogOk('p5uploadinput'); } function p5uploadFileEx() { Q('p5loginSubmit').click(); } - function updateUploadDialogOk(x) { QE('idx_dlgOkButton', Q(x).value != ''); } + function p5updateUploadDialogOk() { + // Check if these are files we can upload, remove all folders. + var xallfiles = Q('p5uploadinput').files, files = []; + for (var i in xallfiles) { if ((xallfiles[i].size != null) && (xallfiles[i].size != 0)) { files.push(xallfiles[i]); } } + + // Check if these files are duplicates of existing files. + var filetreex = filetree, allfiles = [], overWriteCount = 0; + for (var i in filetreelocation) { + if ((filetreex.f != null) && (filetreex.f[filetreelocation[i]] != null)) { filetreex = filetreex.f[filetreelocation[i]]; } + } + QE('idx_dlgOkButton', xallfiles.length > 0); + if (xallfiles.length > 0) { + if (filetreex.f != null) { + for (var i in filetreex.f) { allfiles.push(i); } + for (var i = 0; i < xallfiles.length; i++) { + if (allfiles.indexOf(xallfiles[i].name) >= 0) { overWriteCount++; } // TODO: If the server is Windows, we need to lowercase both names. + } + } + QV('p5confirmOverwriteSpan', overWriteCount > 0); + if (overWriteCount > 0) { + QE('idx_dlgOkButton', Q('p5confirmOverwrite').checked); + } else { + Q('p5confirmOverwrite').checked = false; + QE('idx_dlgOkButton', true); + } + } + } /* function p5viewfile() { var checkboxes = document.getElementsByName('fc'); @@ -8292,8 +8319,9 @@ } function showCreateNewAccountDialogValidate(x) { - var ve = validateEmail(Q('p4email').value); + var ve = true; if (serverinfo.emailcheck) { + ve = validateEmail(Q('p4email').value); QE('p4verifiedEmail', ve); QE('p4invitationEmail', ve && Q('p4resetNextLogin').checked && Q('p4verifiedEmail').checked); if (ve == false) { Q('p4verifiedEmail').checked = false; } @@ -8560,8 +8588,8 @@ function p30showUserChangePassDialog(multiFactor) { if (xxdialogMode) return; var x = ''; - x += addHtmlValue("Mot de passe", ''); - x += addHtmlValue("Mot de passe", ''); + x += addHtmlValue("Mot de passe", ''); + x += addHtmlValue("Mot de passe", ''); if (features & 0x00010000) { x += addHtmlValue("Password hint", ''); } if (passRequirements) {