diff --git a/packages/file-handling/README.md b/packages/file-handling/README.md index 1a8f48c918e38cfea331e7cbcc6181f8ad824bec..0521df16753bdf4894a7a67bbbc9d1f2b0ec43ee 100644 --- a/packages/file-handling/README.md +++ b/packages/file-handling/README.md @@ -73,6 +73,8 @@ files from a [Nextcloud](https://nextcloud.com/) instance. - `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>` +- `nextcloud-auth-info` (optional): Additional authentication information text that is shown in the Nextcloud file picker + - example `<dbp-file-source nextcloud-auth-info="You need special permissions for this function"></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 @@ -135,7 +137,9 @@ files to a [Nextcloud](https://nextcloud.com/) instance. - 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-sink nextcloud-file-url="http://localhost:8081/apps/files/?dir="></dbp-file-sink>` + - example `<dbp-file-sink nextcloud-file-url="http://localhost:8081/apps/files/?dir="></dbp-file-sink>` +- `nextcloud-auth-info` (optional): Additional authentication information text that is shown in the Nextcloud file picker + - example `<dbp-file-sink nextcloud-auth-info="You need special permissions for this function"></dbp-file-sink>` - `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 e03267ecf558d10296ef806ec57984ec0ad324aa..8cbaf987ed75d687860313ff8f9c975f080693d5 100644 --- a/packages/file-handling/src/dbp-nextcloud-file-picker.js +++ b/packages/file-handling/src/dbp-nextcloud-file-picker.js @@ -53,6 +53,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { this.abortUploadButton = false; this.abortUpload = false; this.isSelected = false; + this.authInfo = ''; } static get scopedElements() { @@ -76,6 +77,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { isPickerActive: { type: Boolean, attribute: false }, statusText: { type: String, attribute: false }, folderIsSelected: { type: String, attribute: false }, + authInfo: { type: String, attribute: 'auth-info' }, directoryPath: { type: String, attribute: 'directory-path' }, allowedMimeTypes: { type: String, attribute: 'allowed-mime-types' }, directoriesOnly: { type: Boolean, attribute: 'directories-only' }, @@ -1469,7 +1471,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { </div> <div class="block text-center m-inherit ${classMap({hidden: this.isPickerActive})}"> <p class="m-inherit"><br> - ${i18n.t('nextcloud-file-picker.auth-info')}<br>${i18n.t('nextcloud-file-picker.auth-info-2')} + ${i18n.t('nextcloud-file-picker.auth-info')}<br>${this.authInfo} </p> </div> </div> diff --git a/packages/file-handling/src/file-sink.js b/packages/file-handling/src/file-sink.js index cc38a6ec0f6bf8ffd1f0900dc9036b69ee27b0b5..9326d6d95aae5ce0c9b3ae6230e3262db1f737ba 100644 --- a/packages/file-handling/src/file-sink.js +++ b/packages/file-handling/src/file-sink.js @@ -36,6 +36,7 @@ export class FileSink extends ScopedElementsMixin(DBPLitElement) { this.enabledTargets = 'local'; this.firstOpen = true; this.fullsizeModal = false; + this.nextcloudAuthInfo = ''; this.initialFileHandlingState = {target: '', path: ''}; } @@ -64,6 +65,7 @@ export class FileSink extends ScopedElementsMixin(DBPLitElement) { nextcloudWebDavUrl: {type: String, attribute: 'nextcloud-web-dav-url'}, nextcloudName: {type: String, attribute: 'nextcloud-name'}, nextcloudFileURL: {type: String, attribute: 'nextcloud-file-url'}, + nextcloudAuthInfo: {type: String, attribute: 'nextcloud-auth-info'}, text: {type: String}, buttonLabel: {type: String, attribute: 'button-label'}, isDialogOpen: {type: Boolean, attribute: false}, @@ -71,9 +73,7 @@ export class FileSink extends ScopedElementsMixin(DBPLitElement) { firstOpen: {type: Boolean, attribute: false}, nextcloudPath: {type: String, attribute: false}, fullsizeModal: { type: Boolean, attribute: 'fullsize-modal' }, - initialFileHandlingState: {type: Object, attribute: 'initial-file-handling-state'}, - }; } @@ -266,6 +266,7 @@ export class FileSink extends ScopedElementsMixin(DBPLitElement) { auth-url="${this.nextcloudAuthUrl}" web-dav-url="${this.nextcloudWebDavUrl}" nextcloud-name="${this.nextcloudName}" + auth-info="${this.nextcloudAuthInfo}" directory-path="${this.nextcloudPath}" nextcloud-file-url="${this.nextcloudFileURL}" @dbp-nextcloud-file-picker-file-uploaded="${(event) => { diff --git a/packages/file-handling/src/file-source.js b/packages/file-handling/src/file-source.js index ba4b48ef6ff0bbbb02019a9a97f7faf49a7e5b4c..9101c4fdc2104907af575e3d94a14db980d331c2 100644 --- a/packages/file-handling/src/file-source.js +++ b/packages/file-handling/src/file-source.js @@ -54,10 +54,9 @@ export class FileSource extends ScopedElementsMixin(DBPLitElement) { this.activeTarget = 'local'; this.isDialogOpen = false; this.firstOpen = true; + this.nextcloudAuthInfo = ''; this.initialFileHandlingState = {target: '', path: ''}; - - } static get scopedElements() { @@ -83,6 +82,7 @@ export class FileSource extends ScopedElementsMixin(DBPLitElement) { nextcloudWebDavUrl: { type: String, attribute: 'nextcloud-web-dav-url' }, nextcloudName: { type: String, attribute: 'nextcloud-name' }, nextcloudFileURL: { type: String, attribute: 'nextcloud-file-url' }, + nextcloudAuthInfo: {type: String, attribute: 'nextcloud-auth-info'}, text: { type: String }, buttonLabel: { type: String, attribute: 'button-label' }, disabled: { type: Boolean }, @@ -451,6 +451,7 @@ export class FileSource extends ScopedElementsMixin(DBPLitElement) { web-dav-url="${this.nextcloudWebDavUrl}" nextcloud-name="${this.nextcloudName}" nextcloud-file-url="${this.nextcloudFileURL}" + auth-info="${this.nextcloudAuthInfo}" allowed-mime-types="${this.allowedMimeTypes}" @dbp-nextcloud-file-picker-file-downloaded="${(event) => { this.sendFileEvent(event.detail.file);}}"> diff --git a/packages/file-handling/src/i18n/de/translation.json b/packages/file-handling/src/i18n/de/translation.json index 9fdbb0795052c007132959742e51489a0cbf1358..b06a615194e8fc7d3894c80fac9c4070de5e952b 100644 --- a/packages/file-handling/src/i18n/de/translation.json +++ b/packages/file-handling/src/i18n/de/translation.json @@ -63,7 +63,6 @@ "init-text-1": "Wählen Sie Ihre Dateien von {{name}}.", "init-text-2": "Sie müssen sich zuerst authentifizieren.", "auth-info": "Eine neue Seite wird geöffnet, um Ihr Konto zu verbinden.", - "auth-info-2": "Für diese Funktion ist ein TU Graz Bediensteten Account nötig!", "connect-nextcloud": "{{name}} verbinden", "open-in-nextcloud": "In {{name}} öffnen", "no-data": "In diesem Ordner befinden sich keine Dateien.", diff --git a/packages/file-handling/src/i18n/en/translation.json b/packages/file-handling/src/i18n/en/translation.json index 5d6afd364db92c8af5596499baa679d03adf057b..1769455670a3b5e98dbd82de64cd7098aa0adb76 100644 --- a/packages/file-handling/src/i18n/en/translation.json +++ b/packages/file-handling/src/i18n/en/translation.json @@ -63,7 +63,6 @@ "init-text-1": "Chose your files from {{name}}.", "init-text-2": "You need to authenticate first.", "auth-info": "A new page will open to connect your account.", - "auth-info-2": "A TU Graz employee account is required for this function!", "connect-nextcloud": "Connect {{name}}", "open-in-nextcloud": "Open in {{name}}", "no-data": "No data avaible in this folder.",