Skip to content
Snippets Groups Projects
Unverified Commit c5b4c413 authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire:
Browse files

Add nextcloud-file-url support (dbp/apps/signature#32)

parent b6f0083b
No related branches found
No related tags found
No related merge requests found
Pipeline #15712 passed
......@@ -71,6 +71,8 @@ files from a [Nextcloud](https://nextcloud.com/) instance.
- `nextcloud-web-dav-url` (optional): Nextcloud WebDav Url to use with the Nextcloud file picker
- example `<dbp-file-source nextcloud-web-dav-url="http://localhost:8081/remote.php/dav/files"></dbp-file-source>`
- `nextcloud-auth-url` also needs to be set for the Nextcloud file picker to be active
- `nextcloud-file-url` (optional): Nextcloud File Url to use with the Nextcloud file picker
- example `<dbp-file-source nextcloud-file-url="http://localhost:8081/apps/files/?dir="></dbp-file-source>`
- `dialog-open` (optional): if this attribute is set at runtime the dialog for selecting local or Nextcloud files will open
- example `document.querySelector("dbp-file-source").setAttribute("dialog-open", "")`
- `text` (optional): the text that is shown above the button to select files
......@@ -112,6 +114,8 @@ files to a [Nextcloud](https://nextcloud.com/) instance.
- `nextcloud-web-dav-url` (optional): Nextcloud WebDav Url to use with the Nextcloud file picker
- example `<dbp-file-sink nextcloud-web-dav-url="http://localhost:8081/remote.php/dav/files"></dbp-file-sink>`
- `nextcloud-auth-url` also needs to be set for the Nextcloud file picker to be active
- `nextcloud-file-url` (optional): Nextcloud File Url to use with the Nextcloud file picker
- example `<dbp-file-source nextcloud-file-url="http://localhost:8081/apps/files/?dir="></dbp-file-source>`
- `text` (optional): the text that is shown above the button to download the zip file
- example `<dbp-file-sink text="Download files as ZIP-file"></dbp-file-sink>`
- `button-label` (optional): the text that is shown on the button to download the zip file
......
......@@ -9,7 +9,6 @@ import {createClient} from 'webdav/web';
import {classMap} from 'lit-html/directives/class-map.js';
import {humanFileSize} from '@dbp-toolkit/common/i18next';
import Tabulator from 'tabulator-tables';
import nextcloudFileURL from 'consts:nextcloudFileURL';
import MicroModal from './micromodal.es';
import {name as pkgName} from './../package.json';
......@@ -23,6 +22,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
this.authUrl = '';
this.webDavUrl = '';
this.nextcloudName = 'Nextcloud';
this.nextcloudFileURL = '';
this.loginWindow = null;
this.isPickerActive = false;
this.statusText = '';
......@@ -68,6 +68,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
lang: { type: String },
authUrl: { type: String, attribute: 'auth-url' },
webDavUrl: { type: String, attribute: 'web-dav-url' },
nextcloudFileURL: { type: String, attribute: 'nextcloud-file-url' },
nextcloudName: { type: String, attribute: 'nextcloud-name' },
isPickerActive: { type: Boolean, attribute: false },
statusText: { type: String, attribute: false },
......@@ -944,8 +945,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
* @returns {string} actual directory Nextcloud link
*/
getNextCloudLink() {
let link = nextcloudFileURL + this.directoryPath;
return link;
return this.nextcloudFileURL + this.directoryPath;
}
getCloudLogo() {
......
......@@ -24,6 +24,7 @@ export class FileSink extends ScopedElementsMixin(DBPLitElement) {
this.nextcloudAuthUrl = '';
this.nextcloudWebDavUrl = '';
this.nextcloudName ='Nextcloud';
this.nextcloudFileURL = '';
this.text = '';
this.buttonLabel = '';
this.filename = "files.zip";
......@@ -54,6 +55,7 @@ export class FileSink extends ScopedElementsMixin(DBPLitElement) {
nextcloudAuthUrl: { type: String, attribute: 'nextcloud-auth-url' },
nextcloudWebDavUrl: { type: String, attribute: 'nextcloud-web-dav-url' },
nextcloudName: { type: String, attribute: 'nextcloud-name' },
nextcloudFileURL: { type: String, attribute: 'nextcloud-file-url' },
text: { type: String },
buttonLabel: { type: String, attribute: 'button-label' },
isDialogOpen: { type: Boolean, attribute: false },
......@@ -239,6 +241,7 @@ export class FileSink extends ScopedElementsMixin(DBPLitElement) {
auth-url="${this.nextcloudAuthUrl}"
web-dav-url="${this.nextcloudWebDavUrl}"
nextcloud-name="${this.nextcloudName}"
nextcloud-file-url="${this.nextcloudFileURL}"
@dbp-nextcloud-file-picker-file-uploaded="${(event) => {
this.uploadToNextcloud(event.detail);
}}"
......
......@@ -39,6 +39,7 @@ export class FileSource extends ScopedElementsMixin(DBPLitElement) {
this.nextcloudAuthUrl = '';
this.nextcloudName ='Nextcloud';
this.nextcloudWebDavUrl = '';
this.nextcloudFileURL = '';
this.dropArea = null;
this.allowedMimeTypes = '*/*';
this.enabledSources = 'local';
......@@ -71,6 +72,7 @@ export class FileSource extends ScopedElementsMixin(DBPLitElement) {
nextcloudAuthUrl: { type: String, attribute: 'nextcloud-auth-url' },
nextcloudWebDavUrl: { type: String, attribute: 'nextcloud-web-dav-url' },
nextcloudName: { type: String, attribute: 'nextcloud-name' },
nextcloudFileURL: { type: String, attribute: 'nextcloud-file-url' },
text: { type: String },
buttonLabel: { type: String, attribute: 'button-label' },
disabled: { type: Boolean },
......@@ -456,6 +458,7 @@ export class FileSource extends ScopedElementsMixin(DBPLitElement) {
auth-url="${this.nextcloudAuthUrl}"
web-dav-url="${this.nextcloudWebDavUrl}"
nextcloud-name="${this.nextcloudName}"
nextcloud-file-url="${this.nextcloudFileURL}"
allowed-mime-types="${this.allowedMimeTypes}"
@dbp-nextcloud-file-picker-file-downloaded="${(event) => {
this.sendFileEvent(event.detail.file);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment