diff --git a/packages/file-handling/README.md b/packages/file-handling/README.md index 4bbc3b8d40846fde08d27cc4284d32a8fde031b9..cbf852612cc1c53ec2100d2f844c0bdf6ef654e5 100644 --- a/packages/file-handling/README.md +++ b/packages/file-handling/README.md @@ -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 diff --git a/packages/file-handling/src/dbp-nextcloud-file-picker.js b/packages/file-handling/src/dbp-nextcloud-file-picker.js index 0a7e5da6f9cbddccb14402c3f4c7ae8595042c30..a1b56bc26ea1d6bbbbe3debd9c96983dad3f19c0 100644 --- a/packages/file-handling/src/dbp-nextcloud-file-picker.js +++ b/packages/file-handling/src/dbp-nextcloud-file-picker.js @@ -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() { diff --git a/packages/file-handling/src/file-sink.js b/packages/file-handling/src/file-sink.js index 90875ee64e8cea7f44727327a51d448bd36d9c7e..3fb3619219ba0d0a5d9e08f595ab51c4aaabb5ff 100644 --- a/packages/file-handling/src/file-sink.js +++ b/packages/file-handling/src/file-sink.js @@ -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); }}" diff --git a/packages/file-handling/src/file-source.js b/packages/file-handling/src/file-source.js index f9e93def30555979144aa766f4e9530a161fb2f6..59dc64b67c9bb0c6293d60f276da32401ca05e3a 100644 --- a/packages/file-handling/src/file-source.js +++ b/packages/file-handling/src/file-source.js @@ -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);