WebClient: propose to add files for empty dirs

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino 2023-12-26 19:07:50 +01:00
parent a65e7782de
commit e35e07acdb
No known key found for this signature in database
GPG key ID: 935D2952DEC4EECF
5 changed files with 76 additions and 26 deletions

View file

@ -1,6 +1,6 @@
#!/bin/bash
NFPM_VERSION=2.35.0
NFPM_VERSION=2.35.1
NFPM_ARCH=${NFPM_ARCH:-amd64}
if [ -z ${SFTPGO_VERSION} ]
then

View file

@ -78,7 +78,6 @@
"invalid_token": "Invalid permissions",
"confirm_logout": "Are you sure you want to sign out?",
"wait": "Please wait...",
"or": "or",
"ok": "OK",
"none": "None",
"cancel": "No, back",
@ -224,6 +223,7 @@
"text": "Upload Files",
"success": "Files uploaded successfully",
"message": "Drop files here or click to upload.",
"message_empty": "This directory is empty. $t(fs.upload.message)",
"err_generic": "Error uploading files",
"err_403": "$t(fs.upload.err_generic). $t(fs.err_403)",
"err_429": "$t(fs.upload.err_generic). $t(fs.err_429)"
@ -287,7 +287,7 @@
"save_err": "Failed to save configuration",
"auth_code_required": "The authentication code is required",
"no_protocol": "Please select at least a protocol",
"required_protocols": "The security policy configured for your account requires two-factor authentication for the following protocols: {{val}}",
"required_protocols": "Unable to disable two-factor authentication. The security policy configured for your account requires two-factor authentication for the following protocols: {{val}}",
"recovery_codes_generate": "Generate new recovery codes",
"recovery_codes_view": "View recovery codes"
},

View file

@ -78,7 +78,6 @@
"invalid_token": "Permessi non validi",
"confirm_logout": "Sei sicuro di volerti disconnettere?",
"wait": "Attendere prego...",
"or": "o",
"ok": "OK",
"none": "Nessuna",
"cancel": "No, indietro",
@ -224,6 +223,7 @@
"text": "Carica file",
"success": "File caricati correttamente",
"message": "Rilascia i file qui o fai clic per caricarli.",
"message_empty": "Questa cartella è vuota. $t(fs.upload.message)",
"err_generic": "Errore caricamento file",
"err_403": "$t(fs.upload.err_generic). $t(fs.err_403)",
"err_429": "$t(fs.upload.err_generic). $t(fs.err_429)"
@ -287,7 +287,7 @@
"save_err": "Impossibile salvare la configurazione",
"auth_code_required": "Il codice di autenticazione è obbligatorio",
"no_protocol": "Seleziona almeno un protocollo",
"required_protocols": "La politica di sicurezza configurata per il tuo account richiede l'autenticazione a due fattori per i seguenti protocolli: {{val}}",
"required_protocols": "Impossibile disabilitare l'autenticazione a due fattori. La politica di sicurezza configurata per il tuo account richiede l'autenticazione a due fattori per i seguenti protocolli: {{val}}",
"recovery_codes_generate": "Genera nuovi codici di ripristino",
"recovery_codes_view": "Visualizza codici di ripristino"
},

View file

@ -145,6 +145,28 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
<div class="new_folder_divider py-2 d-none">
<hr>
</div>
<div id="upload_files_empty_container" class="d-none mt-10">
<form id="upload_files_empty_form" action="{{.FilesURL}}?path={{.CurrentDir}}" method="POST" enctype="multipart/form-data">
<div class="fv-row">
<div class="dropzone" id="upload_files_empty">
<div class="dz-message needsclick align-items-center">
<i class="ki-duotone ki-file-up fs-3x text-primary">
<span class="path1"></span>
<span class="path2"></span>
</i>
<div class="ms-4">
<h3 data-i18n="fs.upload.message_empty" class="fs-5 fw-bold text-gray-900 mb-1"></h3>
<!-- <span class="fs-7 fw-semibold text-gray-500">Upload up to 30 files</span> -->
</div>
</div>
</div>
</div>
</form>
<div class="d-flex justify-content-end mt-5">
<button data-i18n="general.submit" type="button" id="upload_files_empty_button" class="btn btn-primary">Submit</button>
</div>
</div>
<div id="file_manager_list_container">
<table id="file_manager_list" class="table align-middle table-row-dashed fs-6 gy-5">
<thead>
<tr class="text-start text-muted fw-bold fs-6 gs-0 text-gray-500">
@ -165,6 +187,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
</table>
</div>
</div>
</div>
{{- end}}
@ -720,6 +743,15 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
//table = dt.$;
dt.on('draw', function () {
//{{- if .CanAddFiles}}
if (dt.rows().count() === 0) {
$('#file_manager_list_container').addClass("d-none");
$('#upload_files_empty_container').removeClass("d-none");
return;
}
$('#upload_files_empty_container').addClass("d-none");
$('#file_manager_list_container').removeClass("d-none");
//{{- end}}
lightbox.reload();
KTMenu.createInstances();
@ -1690,6 +1722,27 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
file.previewElement.querySelector(".dz-progress").style.display = 'none';
});
var dropzoneEmpty = new Dropzone("#upload_files_empty", {
url: "{{.FilesURL}}?path={{.CurrentDir}}",
paramName: "filenames",
maxFiles: 250,
maxFilesize: null,
autoQueue: false,
addRemoveLinks: true,
autoProcessQueue: false,
filesizeBase: 1000,
init: function() {
var dropzoneEmpty = this;
$("#upload_files_empty_button").click(function(){
uploadFiles(dropzoneEmpty.getAcceptedFiles());
});
}
});
dropzoneEmpty.on("addedfile", file => {
file.previewElement.querySelector(".dz-progress").style.display = 'none';
});
$('#modal_video_player').on('hide.bs.modal', function () {
$("#video_player").get(0).pause();
if (playerKeepAlive != null) {

View file

@ -70,10 +70,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
</button>
{{- end}}
{{- if .OpenIDLoginURL}}
{{- if not .FormDisabled}}
<div data-i18n="general.or" class="text-center text-muted text-uppercase fw-bold mb-5">or</div>
{{- end}}
<a href="{{.OpenIDLoginURL}}" class="btn btn-flex btn-outline flex-center btn-active-color-primary bg-state-light btn-lg w-100 mb-5">
<a href="{{.OpenIDLoginURL}}" class="btn btn-flex btn-outline flex-center {{if .FormDisabled}}btn-primary{{else}}btn-active-color-primary bg-state-light{{end}} btn-lg w-100 my-5">
<img alt="Logo" src="{{.StaticURL}}/img/openid-logo.png" class="h-20px me-3" />
<span data-i18n="login.signin_openid">Sign in with OpenID</span>
</a>