Skip to content
Snippets Groups Projects
Commit eba78455 authored by Steinwender, Tamara's avatar Steinwender, Tamara
Browse files

Status text adaption, translation, small bugfixes, changed permission checks

parent 3a522127
No related branches found
No related tags found
1 merge request!1Filehandling overwrite dialog
Pipeline #12666 passed
...@@ -46,6 +46,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -46,6 +46,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
this.activeDirectoryRights = 'SGDNVCK'; this.activeDirectoryRights = 'SGDNVCK';
this.activeDirectoryACL = ''; this.activeDirectoryACL = '';
this.forAll = false; this.forAll = false;
this.uploadCount = 0;
} }
static get scopedElements() { static get scopedElements() {
...@@ -151,8 +152,8 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -151,8 +152,8 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
const minutes = ("0" + timestamp.getMinutes()).slice(-2); const minutes = ("0" + timestamp.getMinutes()).slice(-2);
return date + "." + month + "." + year + " " + hours + ":" + minutes; return date + "." + month + "." + year + " " + hours + ":" + minutes;
}}, }},
{title: "rights", field: "props.permissions"}, {title: "rights", field: "props.permissions"},//, visible:false},
{title: "acl", field: "props.acl-list.acl.acl-permissions"} {title: "acl", field: "props.acl-list.acl.acl-permissions"}//, visible:false}
], ],
initialSort:[ initialSort:[
{column:"basename", dir:"asc"}, {column:"basename", dir:"asc"},
...@@ -226,7 +227,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -226,7 +227,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
} }
if (typeof this.directoriesOnly !== 'undefined' && this.directoriesOnly) if (typeof this.directoriesOnly !== 'undefined' && this.directoriesOnly)
{ {
console.log("filter " + this.directoriesOnly); //console.log("filter " + this.directoriesOnly);
this.tabulatorTable.setFilter([ this.tabulatorTable.setFilter([
{field:"type", type:"=", value:"directory"}, {field:"type", type:"=", value:"directory"},
]); ]);
...@@ -264,7 +265,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -264,7 +265,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
} }
const apiUrl = this.webDavUrl + "/" + data.loginName; const apiUrl = this.webDavUrl + "/" + data.loginName;
console.log("url: ", this.webDavUrl); //console.log("url: ", this.webDavUrl);
// see https://github.com/perry-mitchell/webdav-client/blob/master/API.md#module_WebDAV.createClient // see https://github.com/perry-mitchell/webdav-client/blob/master/API.md#module_WebDAV.createClient
this.webDavClient = createClient( this.webDavClient = createClient(
...@@ -296,8 +297,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -296,8 +297,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
// client is broken reload try to reset & reconnect // client is broken reload try to reset & reconnect
this.tabulatorTable.clearData(); this.tabulatorTable.clearData();
this.webDavClient = null; this.webDavClient = null;
// TODO Übersetzung let reloadButton = html`${i18n.t('nextcloud-file-picker.something-went-wrong')} <button class="button"
let reloadButton = html`Something went wrong. Please reload <button class="button"
title="${i18n.t('nextcloud-file-picker.refresh-nextcloud-file-picker')}" title="${i18n.t('nextcloud-file-picker.refresh-nextcloud-file-picker')}"
@click="${async () => { this.openFilePicker(); } }"><dbp-icon name="reload"></button>`; @click="${async () => { this.openFilePicker(); } }"><dbp-icon name="reload"></button>`;
this.loading = false; this.loading = false;
...@@ -326,6 +326,12 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -326,6 +326,12 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
this.tabulatorTable.setData(contents.data); this.tabulatorTable.setData(contents.data);
console.log("!!!!!!!!!!!!!!!!!!!!!!!!", contents.data) console.log("!!!!!!!!!!!!!!!!!!!!!!!!", contents.data)
this.isPickerActive = true; this.isPickerActive = true;
if(!this.activeDirectoryRights.includes("CK") && !this.activeDirectoryRights.includes("NV")) {
this._("#download-button").setAttribute("disabled", "true");
}
else {
this._("#download-button").removeAttribute("disabled");
}
}).catch(error => { }).catch(error => {
console.error(error.message); console.error(error.message);
...@@ -339,8 +345,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -339,8 +345,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
this.isPickerActive = false; this.isPickerActive = false;
this.tabulatorTable.clearData(); this.tabulatorTable.clearData();
this.webDavClient = null; this.webDavClient = null;
// TODO Übersetzung let reloadButton = html`${i18n.t('nextcloud-file-picker.something-went-wrong')} <button class="button"
let reloadButton = html`Something went wrong. Please reload <button class="button"
title="${i18n.t('nextcloud-file-picker.refresh-nextcloud-file-picker')}" title="${i18n.t('nextcloud-file-picker.refresh-nextcloud-file-picker')}"
@click="${async () => { this.openFilePicker(); } }"><dbp-icon name="reload"></button>`; @click="${async () => { this.openFilePicker(); } }"><dbp-icon name="reload"></button>`;
this.loading = false; this.loading = false;
...@@ -351,6 +356,12 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -351,6 +356,12 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
}); });
} }
/**
* Event Triggered when a directory in tabulator table is clicked
*
* @param event
* @param file
*/
directoryClicked(event, file) { directoryClicked(event, file) {
// save rights of clicked directory // save rights of clicked directory
this.activeDirectoryRights = file.props.permissions; this.activeDirectoryRights = file.props.permissions;
...@@ -365,12 +376,21 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -365,12 +376,21 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
event.preventDefault(); event.preventDefault();
} }
/**
* Download all files
*
* @param files
*/
downloadFiles(files) { downloadFiles(files) {
this.tabulatorTable.deselectRow(); this.tabulatorTable.deselectRow();
files.forEach((fileData) => this.downloadFile(fileData)); files.forEach((fileData) => this.downloadFile(fileData));
} }
/**
* Download a single file
*
* @param fileData
*/
downloadFile(fileData) { downloadFile(fileData) {
this.loading = true; this.loading = true;
this.statusText = "Loading " + fileData.filename + "..."; this.statusText = "Loading " + fileData.filename + "...";
...@@ -381,8 +401,6 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -381,8 +401,6 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
.then(contents => { .then(contents => {
// create file to send via event // create file to send via event
const file = new File([contents], fileData.basename, { type: fileData.mime }); const file = new File([contents], fileData.basename, { type: fileData.mime });
console.log("binaryFile", file);
// send event // send event
const data = {"file": file, "data": fileData}; const data = {"file": file, "data": fileData};
const event = new CustomEvent("dbp-nextcloud-file-picker-file-downloaded", const event = new CustomEvent("dbp-nextcloud-file-picker-file-downloaded",
...@@ -397,6 +415,11 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -397,6 +415,11 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
}); });
} }
/**
* Send the directory to filesink
*
* @param directory
*/
sendDirectory(directory) { sendDirectory(directory) {
this.tabulatorTable.deselectRow(); this.tabulatorTable.deselectRow();
let path; let path;
...@@ -409,20 +432,32 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -409,20 +432,32 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
path = directory[0].filename; path = directory[0].filename;
} }
this.loading = true; this.loading = true;
this.statusText = "Uploading to " + path + " ..."; this.statusText = i18n.t('nextcloud-file-picker.upload-to', {path: path});
const event = new CustomEvent("dbp-nextcloud-file-picker-file-uploaded", const event = new CustomEvent("dbp-nextcloud-file-picker-file-uploaded",
{ "detail": path, bubbles: true, composed: true }); { "detail": path, bubbles: true, composed: true });
this.dispatchEvent(event); this.dispatchEvent(event);
} }
/**
* Upload Files to a directory
*
* @param files
* @param directory
*/
uploadFiles(files, directory) { uploadFiles(files, directory) {
this.loading = true;
this.statusText = i18n.t('nextcloud-file-picker.upload-to', {path: directory});
this.fileList = files; this.fileList = files;
this.forAll = false; this.forAll = false;
this.uploadFile(directory); this.uploadFile(directory);
} }
/**
* Upload a single file from this.filelist to given directory
*
* @param directory
*/
async uploadFile(directory) { async uploadFile(directory) {
if(this.fileList.length !== 0) { if(this.fileList.length !== 0) {
let file = this.fileList[0]; let file = this.fileList[0];
...@@ -430,19 +465,16 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -430,19 +465,16 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
let path = directory + "/" + file.name; let path = directory + "/" + file.name;
// https://github.com/perry-mitchell/webdav-client#putfilecontents // https://github.com/perry-mitchell/webdav-client#putfilecontents
let that = this; let that = this;
this.loading = true;
this.statusText = i18n.t('nextcloud-file-picker.upload-to', {path: path});
let contents = await this.webDavClient let contents = await this.webDavClient
.putFileContents(path, file, { overwrite: false, onUploadProgress: progress => { .putFileContents(path, file, { overwrite: false, onUploadProgress: progress => {
console.log(`Uploaded ${progress.loaded} bytes of ${progress.total}`); console.log(`Uploaded ${progress.loaded} bytes of ${progress.total}`);
}}).then(function() { }}).then(function() {
that.loading = false; that.uploadCount += 1;
that.statusText = "";
that.fileList.shift(); that.fileList.shift();
that.uploadFile(directory); that.uploadFile(directory);
}).catch(error => { }).catch(error => {
console.error(error.message);
//this.loading = false;
//this.statusText = error.message;
console.log("--- h-", error.message);
if(error.message.search("412") !== -1 || error.message.search("403") !== -1) { if(error.message.search("412") !== -1 || error.message.search("403") !== -1) {
this.generatedFilename = this.getNextFilename(); this.generatedFilename = this.getNextFilename();
this._("#replace-filename").value = this.generatedFilename; this._("#replace-filename").value = this.generatedFilename;
...@@ -458,17 +490,24 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -458,17 +490,24 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
}); });
} }
else { else {
this.loadDirectory(this.directoryPath);
this.loading = false; this.loading = false;
this.statusText = ""; this.statusText = "";
this._("#replace_mode_all").checked = false; this._("#replace_mode_all").checked = false;
this.forAll = false; this.forAll = false;
this.customFilename = ''; this.customFilename = '';
const event = new CustomEvent("dbp-nextcloud-file-picker-file-uploaded-finished", const event = new CustomEvent("dbp-nextcloud-file-picker-file-uploaded-finished",
{ bubbles: true, composed: true }); { bubbles: true, composed: true , detail: this.uploadCount});
this.uploadCount = 0;
this.dispatchEvent(event); this.dispatchEvent(event);
} }
} }
/**
* Upload a file after a conflict happens on webdav side
*
*/
async uploadFileAfterConflict() { async uploadFileAfterConflict() {
let path = ""; let path = "";
let overwrite = false; let overwrite = false;
...@@ -489,9 +528,11 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -489,9 +528,11 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
} else { } else {
path = directory + "/" + this.uploadFileObject.name; path = directory + "/" + this.uploadFileObject.name;
overwrite = true; overwrite = true;
//console.log("uploadFileAfterConflict called for file ", this.uploadFileObject.name);
} }
this.loading = true;
this.statusText = i18n.t('nextcloud-file-picker.upload-to', {path: path});
let that = this; let that = this;
// https://github.com/perry-mitchell/webdav-client#putfilecontents // https://github.com/perry-mitchell/webdav-client#putfilecontents
let contents = await this.webDavClient let contents = await this.webDavClient
...@@ -500,15 +541,11 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -500,15 +541,11 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
console.log(`Uploaded ${progress.loaded} bytes of ${progress.total}`); console.log(`Uploaded ${progress.loaded} bytes of ${progress.total}`);
} }
}).then(content => { }).then(content => {
that.loading = false;
that.statusText = "";
MicroModal.close(this._("#replace-modal")); MicroModal.close(this._("#replace-modal"));
this.uploadCount += 1;
that.fileList.shift(); that.fileList.shift();
that.uploadFile(directory); that.uploadFile(directory);
}).catch(error => { }).catch(error => {
//console.error(error.message);
//that.loading = false;
//that.statusText = error.message;
if (error.message.search("412") !== -1) { if (error.message.search("412") !== -1) {
MicroModal.close(that._("#replace-modal")); MicroModal.close(that._("#replace-modal"));
this.generatedFilename = this.getNextFilename(); this.generatedFilename = this.getNextFilename();
...@@ -527,30 +564,30 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -527,30 +564,30 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
this.fileNameCounter = 1; this.fileNameCounter = 1;
} }
/**
* Check permissions of a given file in the active directory
* no rename: if you dont have create permissions
* no replace: if you dont have write permissions
*
* R = Share, S = Shared Folder, M = Group folder or external source, G = Read, D = Delete, NV / NVW = Write, CK = Create
*
* @param file
* @return number
*/
checkRights(file) { checkRights(file) {
// Todo check rights after an conflict and return which should be grayed out (the options rename or replace)
// no rename: if you dont have create permissions
// no replace if you dont have write permissions
// nextcloud permissions // nextcloud permissions
let perm = 0; let file_perm = 0;
let active_directory_perm = this.activeDirectoryRights; let active_directory_perm = this.activeDirectoryRights;
let rows = this.tabulatorTable.searchRows("basename", "=", this.replaceFilename); let rows = this.tabulatorTable.searchRows("basename", "=", this.replaceFilename);
if(typeof rows[0] !== 'undefined' && rows[0]) { if(typeof rows[0] !== 'undefined' && rows[0]) {
perm = rows[0].getData().props.permissions; file_perm = rows[0].getData().props.permissions;
} }
else { else {
perm = ""; file_perm = "";
} }
console.log("RIGHTS IN THIS FOLDER:", this.activeDirectoryRights); /* ACL permissions: If ACL > permssions comment this in
console.log("RIGHT OF FILE:", perm);
console.log("RIGHTS IN THIS FOLDER:", this.activeDirectoryRights);
console.log("RIGHT OF FILE:", perm);
/* ACL TODO Check if ACL > Permissions
// if I'm in an group or external folder take the acl permissions
if(this.activeDirectoryACL !== '') if(this.activeDirectoryACL !== '')
{ {
console.log("ACL SET"); console.log("ACL SET");
...@@ -573,86 +610,74 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -573,86 +610,74 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
rows[0].getData().props['acl-list']['acl']['acl-permissions'] !== '') rows[0].getData().props['acl-list']['acl']['acl-permissions'] !== '')
{ {
console.log("FILE HAS ACL"); console.log("FILE HAS ACL");
perm = "MG"; file_perm = "MG";
if(rows[0].getData().props['acl-list']['acl']['acl-permissions'] & (1 << (3 - 1))) if(rows[0].getData().props['acl-list']['acl']['acl-permissions'] & (1 << (3 - 1)))
{ {
perm = "CK"; file_perm = "CK";
console.log("FILE ACL CREATE"); console.log("FILE ACL CREATE");
} }
if(rows[0].getData().props['acl-list']['acl']['acl-permissions'] & (1 << (2 - 1))) if(rows[0].getData().props['acl-list']['acl']['acl-permissions'] & (1 << (2 - 1)))
{ {
perm += "NV"; file_perm += "NV";
console.log("FILE ACL WRITE"); console.log("FILE ACL WRITE");
} }
} }
*/ */
// all allowed
// read only directory if(active_directory_perm.includes("CK") && file_perm.includes("NV"))
if(active_directory_perm === "MG" || active_directory_perm === "SG" || (active_directory_perm === "RMGD" && perm === ""))
{ {
console.log("0"); return -1;
return 0;
}
// read only file
if((perm === 'SG' || perm === 'MG' || perm === 'MG'|| perm === 'RMGD' || perm === 'SGD') && !active_directory_perm.includes("CK") )
{
console.log("0");
return 0;
} }
// read only file // read only file but you can write to directory = only create and no edit
if((perm === 'SG' || perm === 'MG'|| perm === 'RMGD' || perm === 'SGD') && active_directory_perm.includes("CK") ) if(active_directory_perm.includes("CK") && !file_perm.includes("NV"))
{ {
console.log("1");
return 1;
}
// only create and no edit
if((active_directory_perm.includes("CK") && !active_directory_perm.includes("NV") && !perm.includes("NV")) || (active_directory_perm.includes("CK") && !perm.includes("NV"))) {
console.log("1");
return 1; return 1;
} }
// only edit and no create // only edit and no create
if(perm.includes("NV") && !active_directory_perm.includes("CK")) { if(!active_directory_perm.includes("CK") && file_perm.includes("NV"))
console.log("2"); {
return 2; return 2;
} }
console.log("-1"); // read only directory and read only file
return -1; return 0;
} }
/** /**
* Open the replace Modal Dialog with gui where forbidden actions are disabled
* *
* @param file, directory
*/ */
replaceModalDialog(file, directory) { replaceModalDialog(file, directory) {
this.uploadFileObject = file; this.uploadFileObject = file;
this.uploadFileDirectory = directory; this.uploadFileDirectory = directory;
let rights = this.checkRights(file); let rights = this.checkRights(file);
// read only directory or read only file
if(rights === 0) { if(rights === 0) {
// TODO Übersetzen
this.loading = false; this.loading = false;
this.statusText = "readonly: Du darfst in diesem ordner nichts schreiben"; this.statusText = i18n.t('nextcloud-file-picker.readonly');
return; return;
} }
// read only file but you can write to directory = only create and no edit
else if(rights === 1) { else if(rights === 1) {
this.loading = false; this.loading = false;
this.statusText = "Du darfst hier nur erstellen"; this.statusText = i18n.t('nextcloud-file-picker.onlycreate');
this._("#replace-replace").setAttribute("disabled", "true"); this._("#replace-replace").setAttribute("disabled", "true");
this._("#replace-new-name").removeAttribute("disabled"); this._("#replace-new-name").removeAttribute("disabled");
this._("#replace-replace").checked = false; this._("#replace-replace").checked = false;
this._("#replace-new-name").checked = true; this._("#replace-new-name").checked = true;
this.setInputFieldVisibility(); this.setInputFieldVisibility();
this._("#replace-new-name").focus(); this._("#replace-new-name").focus();
} }
// only edit and no create
else if(rights === 2) { else if(rights === 2) {
this.loading = false; this.loading = false;
this.statusText = "Du darfst hier nur bearbeiten"; this.statusText = i18n.t('nextcloud-file-picker.onlyedit');
this._("#replace-new-name").setAttribute("disabled", "true"); this._("#replace-new-name").setAttribute("disabled", "true");
this._("#replace-replace").removeAttribute("disabled"); this._("#replace-replace").removeAttribute("disabled");
this._("#replace-new-name").checked = false; this._("#replace-new-name").checked = false;
...@@ -660,6 +685,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -660,6 +685,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
this.setInputFieldVisibility(); this.setInputFieldVisibility();
this._("#replace-replace").focus(); this._("#replace-replace").focus();
} }
// all allowed
else { else {
this._("#replace-new-name").removeAttribute("disabled"); this._("#replace-new-name").removeAttribute("disabled");
this._("#replace-replace").removeAttribute("disabled"); this._("#replace-replace").removeAttribute("disabled");
...@@ -668,7 +694,11 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -668,7 +694,11 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
this.setInputFieldVisibility(); this.setInputFieldVisibility();
this._("#replace-new-name").focus(); this._("#replace-new-name").focus();
} }
MicroModal.show(this._('#replace-modal')); MicroModal.show(this._('#replace-modal'), {
onClose: modal => {
this.statusText = "";
this.loading = false;},
});
} }
/** /**
...@@ -748,7 +778,6 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -748,7 +778,6 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
/** /**
* Add new folder with webdav * Add new folder with webdav
* *
*
*/ */
addFolder() { addFolder() {
if(this._('#new-folder').value !== "") { if(this._('#new-folder').value !== "") {
...@@ -1133,8 +1162,6 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -1133,8 +1162,6 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
margin-bottom: 0px; margin-bottom: 0px;
} }
.nextcloud-content, .nextcloud-intro{ .nextcloud-content, .nextcloud-intro{
grid-area: content; grid-area: content;
} }
...@@ -1228,7 +1255,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -1228,7 +1255,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
<div class="nextcloud-footer ${classMap({hidden: !this.isPickerActive})}"> <div class="nextcloud-footer ${classMap({hidden: !this.isPickerActive})}">
<div class="nextcloud-footer-grid"> <div class="nextcloud-footer-grid">
<button class="button select-button is-primary ${classMap({hidden: !this.directoriesOnly})}" <button id="download-button" class="button select-button is-primary ${classMap({hidden: !this.directoriesOnly})}"
@click="${() => { this.sendDirectory(this.tabulatorTable.getSelectedData()); }}">${this.folderIsSelected}</button> @click="${() => { this.sendDirectory(this.tabulatorTable.getSelectedData()); }}">${this.folderIsSelected}</button>
<button class="button select-button is-primary ${classMap({hidden: this.directoriesOnly})}" <button class="button select-button is-primary ${classMap({hidden: this.directoriesOnly})}"
@click="${() => { this.downloadFiles(this.tabulatorTable.getSelectedData()); }}">${i18n.t('nextcloud-file-picker.select-files')}</button> @click="${() => { this.downloadFiles(this.tabulatorTable.getSelectedData()); }}">${i18n.t('nextcloud-file-picker.select-files')}</button>
......
...@@ -127,16 +127,18 @@ export class FileSink extends ScopedElementsMixin(DBPLitElement) { ...@@ -127,16 +127,18 @@ export class FileSink extends ScopedElementsMixin(DBPLitElement) {
await element.uploadFiles(that.files, directory); await element.uploadFiles(that.files, directory);
} }
finishedFileUpload() { finishedFileUpload(event) {
MicroModal.close(this._('#modal-picker')); MicroModal.close(this._('#modal-picker'));
console.log("close"); if(event.detail > 0)
{
send({ send({
"summary": i18n.t('file-sink.upload-success-title'), "summary": i18n.t('file-sink.upload-success-title'),
"body": i18n.t('file-sink.upload-success-body', {name: this.nextcloudName}), "body": i18n.t('file-sink.upload-success-body', {name: this.nextcloudName, count: event.detail}),
"type": "success", "type": "success",
"timeout": 5, "timeout": 5,
}); });
} }
}
preventDefaults (e) { preventDefaults (e) {
e.preventDefault(); e.preventDefault();
...@@ -235,7 +237,7 @@ export class FileSink extends ScopedElementsMixin(DBPLitElement) { ...@@ -235,7 +237,7 @@ export class FileSink extends ScopedElementsMixin(DBPLitElement) {
this.uploadToNextcloud(event.detail); this.uploadToNextcloud(event.detail);
}}" }}"
@dbp-nextcloud-file-picker-file-uploaded-finished="${(event) => { @dbp-nextcloud-file-picker-file-uploaded-finished="${(event) => {
this.finishedFileUpload(); this.finishedFileUpload(event);
}}"></dbp-nextcloud-file-picker> }}"></dbp-nextcloud-file-picker>
</div> </div>
</main> </main>
......
...@@ -23,7 +23,8 @@ ...@@ -23,7 +23,8 @@
"modal-close": "Dialog schließen", "modal-close": "Dialog schließen",
"nav-local": "Lokaler Computer", "nav-local": "Lokaler Computer",
"upload-success-title": "Erfolgreich hochgeladen", "upload-success-title": "Erfolgreich hochgeladen",
"upload-success-body": "Sie haben Ihre Dateien erfolgreich in {{name}} hochgeladen." "upload-success-body": "Sie haben {{count}} Datei erfolgreich in {{name}} hochgeladen.",
"upload-success-body_plural": "Sie haben {{count}} Dateien erfolgreich in {{name}} hochgeladen."
}, },
"nextcloud-file-picker": { "nextcloud-file-picker": {
"open": "Nextcloud", "open": "Nextcloud",
...@@ -60,6 +61,11 @@ ...@@ -60,6 +61,11 @@
"replace-skip": "Überspringen", "replace-skip": "Überspringen",
"replace-cancel": "Abbrechen", "replace-cancel": "Abbrechen",
"replace-cancel-all": "Alle abbrechen", "replace-cancel-all": "Alle abbrechen",
"replace-mode-all": "Für alle zukünftigen Konflikte übernehmen" "replace-mode-all": "Für alle zukünftigen Konflikte übernehmen",
"something-went-wrong": "Etwas ist schief gelaufen. Bitte verbinden Sie sich erneut",
"upload-to": "Es wird nach {{- path}} hochgeladen ...",
"readonly": "Sie dürfen in diesem Ordner nichts hochladen.",
"onlycreate": "Sie dürfen in diesem Ordner nur neue Dateien erstellen.",
"onlyedit": "Sie dürfen in diesem Ordner nur Dateien bearbeiten."
} }
} }
...@@ -23,7 +23,8 @@ ...@@ -23,7 +23,8 @@
"modal-close": "Close dialog", "modal-close": "Close dialog",
"nav-local": "My device", "nav-local": "My device",
"upload-success-title": "Successful uploaded", "upload-success-title": "Successful uploaded",
"upload-success-body": "You have successfully uploaded your files to {{name}}." "upload-success-body": "You have successfully uploaded {{count}} file to {{name}}.",
"upload-success-body_plural": "You have successfully uploaded {{count}} files to {{name}}."
}, },
"nextcloud-file-picker": { "nextcloud-file-picker": {
"open": "Nextcloud", "open": "Nextcloud",
...@@ -60,6 +61,12 @@ ...@@ -60,6 +61,12 @@
"replace-skip": "Ignore", "replace-skip": "Ignore",
"replace-cancel": "Cancel", "replace-cancel": "Cancel",
"replace-cancel-all": "Cancel all", "replace-cancel-all": "Cancel all",
"replace-mode-all": "Do this for the next conflicts" "replace-mode-all": "Do this for the next conflicts",
"something-went-wrong": "Something went wrong. Please reload",
"upload-to": "Uploading to {{path}} ...",
"readonly": "You are not allowed to uploade files in this directory.",
"onlycreate": "You are only allowed to create new files in this directory.",
"onlyedit": "You are only allowed to edit files in this directory."
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment