From e1ac6a39e6e1583b9a48283612d006eeca3565e2 Mon Sep 17 00:00:00 2001 From: Tamara Steinwender <tamara.steinwender@tugraz.at> Date: Tue, 13 Jul 2021 15:08:04 +0200 Subject: [PATCH] Change show-clipboard attribute to file-handling-enabled-targets attribute --- README.md | 14 ++++++++------ assets/dbp-signature.html.ejs | 3 +-- .../dbp-official-signature-pdf-upload/index.html | 2 +- examples/dbp-signature/index.html | 3 +-- src/dbp-official-signature-pdf-upload.js | 8 ++++---- ...dbp-official-signature-pdf-upload.metadata.json | 2 +- src/dbp-qualified-signature-pdf-upload.js | 7 ++++--- ...bp-qualified-signature-pdf-upload.metadata.json | 2 +- src/dbp-signature-lit-element.js | 2 -- src/dbp-signature-verification-full.js | 5 ++++- src/dbp-signature-verification-full.metadata.json | 2 +- 11 files changed, 26 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 842e3c9..2d5c15e 100644 --- a/README.md +++ b/README.md @@ -59,8 +59,6 @@ Note that you will need a Keycloak server along with a client id for the domain - `auth` object: you need to set that object property for the auth token - example auth property: `{token: "THE_BEARER_TOKEN"}` - note: most often this should be an attribute that is not set directly, but subscribed at a provider -- `show-nextcloud-file-picker` (optional): Needs to be set for the Nextcloud file picker to be shown - - example `show-nextcloud-file-picker` - `nextcloud-web-app-password-url` (optional): Nextcloud Auth Url to use with the Nextcloud file picker - example `nextcloud-web-app-password-url="http://localhost:8081/index.php/apps/webapppassword"` - `nextcloud-web-dav-url` also needs to be set for the Nextcloud file picker to be active @@ -75,6 +73,10 @@ Note that you will need a Keycloak server along with a client id for the domain - example `nextcloud-auth-info="You need special permissions for this function"` - `allow-annotating` (optional): Needs to be set to allow annotating the PDFs - example `allow-annotating` +- `file-handling-enabled-targets` (optional, default: `local`): Needs to be set to allow using other filehandling + targets than local, comma seperated list + actual supported: `local`, `clipboard`, `nextcloud` + - example `file-handling-enabled-targets="local,nextcloud,clipboard"` #### Exposed CSS variables @@ -97,8 +99,6 @@ Note that you will need a Keycloak server along with a client id for the domain - `auth` object: you need to set that object property for the auth token - example auth property: `{token: "THE_BEARER_TOKEN"}` - note: most often this should be an attribute that is not set directly, but subscribed at a provider -- `show-nextcloud-file-picker` (optional): Needs to be set for the Nextcloud file picker to be shown - - example `show-nextcloud-file-picker` - `nextcloud-web-app-password-url` (optional): Nextcloud Auth Url to use with the Nextcloud file picker - example `nextcloud-web-app-password-url="http://localhost:8081/index.php/apps/webapppassword"` - `nextcloud-web-dav-url` also needs to be set for the Nextcloud file picker to be active @@ -113,8 +113,10 @@ Note that you will need a Keycloak server along with a client id for the domain - example `nextcloud-auth-info="You need special permissions for this function"` - `allow-annotating` (optional): Needs to be set to allow annotating the PDFs - example `allow-annotating` -- `show-clipboard` (optional): Needs to be set to allow using the clipboard in the file picker dialog - - example `show-clipboard` +- `file-handling-enabled-targets` (optional, default: `local`): Needs to be set to allow using other filehandling + targets than local, comma seperated list + actual supported: `local`, `clipboard`, `nextcloud` + - example `file-handling-enabled-targets="local,nextcloud,clipboard"` #### Exposed CSS variables diff --git a/assets/dbp-signature.html.ejs b/assets/dbp-signature.html.ejs index 1e2e734..751986a 100644 --- a/assets/dbp-signature.html.ejs +++ b/assets/dbp-signature.html.ejs @@ -67,8 +67,7 @@ provider-root id="app" lang="de" entry-point-url="<%= entryPointURL %>" - show-nextcloud-file-picker - <%= buildInfo.env !== 'production' ? 'show-clipboard' : '' %> + file-handling-enabled-targets="local,nextcloud" <%= buildInfo.env !== 'production' ? 'allow-annotating' : '' %> nextcloud-web-app-password-url="<%= nextcloudWebAppPasswordURL %>" nextcloud-webdav-url="<%= nextcloudWebDavURL %>" diff --git a/examples/dbp-official-signature-pdf-upload/index.html b/examples/dbp-official-signature-pdf-upload/index.html index b19a574..5210ed2 100644 --- a/examples/dbp-official-signature-pdf-upload/index.html +++ b/examples/dbp-official-signature-pdf-upload/index.html @@ -52,7 +52,7 @@ url="https://auth-dev.tugraz.at/auth" ></dbp-auth-keycloak> <dbp-login-button subscribe="auth,lang"></dbp-login-button> - <dbp-official-signature-pdf-upload subscribe="lang,entry-point-url,auth" show-clipboard></dbp-official-signature-pdf-upload> + <dbp-official-signature-pdf-upload subscribe="lang,entry-point-url,auth"></dbp-official-signature-pdf-upload> </dbp-provider> </body> diff --git a/examples/dbp-signature/index.html b/examples/dbp-signature/index.html index 0dbf543..3704c2b 100644 --- a/examples/dbp-signature/index.html +++ b/examples/dbp-signature/index.html @@ -83,8 +83,7 @@ <body> <dbp-signature lang="de" entry-point-url="https://mw-dev.tugraz.at" - show-nextcloud-file-picker - show-clipboard + file-handling-enabled-targets="local,nextcloud" allow-annotating nextcloud-web-app-password-url="http://localhost:8081/index.php/apps/webapppassword" nextcloud-webdav-url="http://localhost:8081/remote.php/dav/files" diff --git a/src/dbp-official-signature-pdf-upload.js b/src/dbp-official-signature-pdf-upload.js index ae9ac3a..852b692 100644 --- a/src/dbp-official-signature-pdf-upload.js +++ b/src/dbp-official-signature-pdf-upload.js @@ -61,7 +61,7 @@ class OfficialSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitElem this.isAnnotationViewVisible = false; this.addAnnotationInProgress = false; this.activity = new Activity(metadata); - this.showClipboard = false; + this.fileHandlingEnabledTargets = "local"; } static get scopedElements() { @@ -112,7 +112,7 @@ class OfficialSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitElem addAnnotationInProgress: { type: Boolean, attribute: false }, queuedFilesAnnotationModes: { type: Array, attribute: false }, queuedFilesAnnotationSaved: { type: Array, attribute: false }, - showClipboard: { type: Boolean, attribute: 'show-clipboard' }, + fileHandlingEnabledTargets: { type: String, attribute: 'file-handling-enabled-targets' }, }; } @@ -469,7 +469,7 @@ class OfficialSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitElem id="file-source" context="${i18n.t('official-pdf-upload.file-picker-context')}" allowed-mime-types="application/pdf" - enabled-targets="local${this.showNextcloudFilePicker ? ",nextcloud" : ""}${this.showClipboard ? ",clipboard" : ""}" + enabled-targets="${this.fileHandlingEnabledTargets}" nextcloud-auth-url="${this.nextcloudWebAppPasswordURL}" nextcloud-web-dav-url="${this.nextcloudWebDavURL}" nextcloud-name="${this.nextcloudName}" @@ -627,7 +627,7 @@ class OfficialSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitElem context="${i18n.t('qualified-pdf-upload.save-field-label', {count: this.signedFilesToDownload})}" filename="signed-documents.zip" subscribe="initial-file-handling-state:initial-file-handling-state,clipboard-files:clipboard-files" - enabled-targets="local${this.showNextcloudFilePicker ? ",nextcloud" : ""}${this.showClipboard ? ",clipboard" : ""}" + enabled-targets="${this.fileHandlingEnabledTargets}" nextcloud-auth-url="${this.nextcloudWebAppPasswordURL}" nextcloud-web-dav-url="${this.nextcloudWebDavURL}" nextcloud-name="${this.nextcloudName}" diff --git a/src/dbp-official-signature-pdf-upload.metadata.json b/src/dbp-official-signature-pdf-upload.metadata.json index e14ba4f..70d177e 100644 --- a/src/dbp-official-signature-pdf-upload.metadata.json +++ b/src/dbp-official-signature-pdf-upload.metadata.json @@ -14,6 +14,6 @@ "de": "Erlaubt das Hochladen von PDF-Dokumenten, um sie mit einer Amtssignatur zu versehen", "en": "Allows upload of PDF-documents to officially sign them" }, - "subscribe": "lang,entry-point-url,nextcloud-web-app-password-url,nextcloud-webdav-url,nextcloud-name,nextcloud-auth-info,nextcloud-file-url,show-nextcloud-file-picker,auth,allow-annotating,show-clipboard", + "subscribe": "lang,entry-point-url,nextcloud-web-app-password-url,nextcloud-webdav-url,nextcloud-name,nextcloud-auth-info,nextcloud-file-url,auth,allow-annotating,file-handling-enabled-targets", "required_roles": ["ROLE_SCOPE_OFFICIAL-SIGNATURE"] } diff --git a/src/dbp-qualified-signature-pdf-upload.js b/src/dbp-qualified-signature-pdf-upload.js index 7531087..f50d7a6 100644 --- a/src/dbp-qualified-signature-pdf-upload.js +++ b/src/dbp-qualified-signature-pdf-upload.js @@ -62,7 +62,7 @@ class QualifiedSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitEle this.isAnnotationViewVisible = false; this.addAnnotationInProgress = false; this.activity = new Activity(metadata); - + this.fileHandlingEnabledTargets = "local"; this._onReceiveBeforeUnload = this.onReceiveBeforeUnload.bind(this); } @@ -115,6 +115,7 @@ class QualifiedSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitEle addAnnotationInProgress: { type: Boolean, attribute: false }, queuedFilesAnnotationModes: { type: Array, attribute: false }, queuedFilesAnnotationSaved: { type: Array, attribute: false }, + fileHandlingEnabledTargets: {type: String, attribute: 'file-handling-enabled-targets'} }; } @@ -597,7 +598,7 @@ class QualifiedSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitEle id="file-source" context="${i18n.t('qualified-pdf-upload.file-picker-context')}" allowed-mime-types="application/pdf" - enabled-targets="local${this.showNextcloudFilePicker ? ",nextcloud" : ""}" + enabled-targets="${this.fileHandlingEnabledTargets}" nextcloud-auth-url="${this.nextcloudWebAppPasswordURL}" nextcloud-web-dav-url="${this.nextcloudWebDavURL}" nextcloud-name="${this.nextcloudName}" @@ -770,7 +771,7 @@ class QualifiedSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitEle context="${i18n.t('qualified-pdf-upload.save-field-label', {count: this.signedFilesToDownload})}" filename="signed-documents.zip" subscribe="initial-file-handling-state:initial-file-handling-state" - enabled-targets="local${this.showNextcloudFilePicker ? ",nextcloud" : ""}" + enabled-targets="${this.fileHandlingEnabledTargets}" nextcloud-auth-url="${this.nextcloudWebAppPasswordURL}" nextcloud-web-dav-url="${this.nextcloudWebDavURL}" nextcloud-name="${this.nextcloudName}" diff --git a/src/dbp-qualified-signature-pdf-upload.metadata.json b/src/dbp-qualified-signature-pdf-upload.metadata.json index d88d5dc..8ce6b81 100644 --- a/src/dbp-qualified-signature-pdf-upload.metadata.json +++ b/src/dbp-qualified-signature-pdf-upload.metadata.json @@ -14,5 +14,5 @@ "de": "Erlaubt das Hochladen von PDF-Dokumenten, um sie mit einer persönlichen elektronischen Signatur zu versehen", "en": "Allows upload of PDF-documents to personally sign them" }, - "subscribe": "lang,entry-point-url,nextcloud-web-app-password-url,nextcloud-webdav-url,nextcloud-name,nextcloud-auth-info,nextcloud-file-url,show-nextcloud-file-picker,auth,allow-annotating" + "subscribe": "lang,entry-point-url,nextcloud-web-app-password-url,nextcloud-webdav-url,nextcloud-name,nextcloud-auth-info,nextcloud-file-url,file-handling-enabled-targets,auth,allow-annotating" } diff --git a/src/dbp-signature-lit-element.js b/src/dbp-signature-lit-element.js index a130398..52103d5 100644 --- a/src/dbp-signature-lit-element.js +++ b/src/dbp-signature-lit-element.js @@ -12,7 +12,6 @@ export default class DBPSignatureLitElement extends BaseLitElement { this.uploadInProgress = false; this.queueBlockEnabled = false; this._queueKey = 0; - this.showNextcloudFilePicker = false; // will be set in function update this.fileSourceUrl = ""; @@ -24,7 +23,6 @@ export default class DBPSignatureLitElement extends BaseLitElement { static get properties() { return { ...super.properties, - showNextcloudFilePicker: { type: Boolean, attribute: 'show-nextcloud-file-picker' }, }; } diff --git a/src/dbp-signature-verification-full.js b/src/dbp-signature-verification-full.js index 736ad1e..313cce1 100644 --- a/src/dbp-signature-verification-full.js +++ b/src/dbp-signature-verification-full.js @@ -41,6 +41,8 @@ class SignatureVerificationFull extends ScopedElementsMixin(DBPSignatureLitEleme this.previewInProgress = false; this.currentPreviewQueueKey = ''; + this.fileHandlingEnabledTargets="local"; + // will be set in function update this.verificationUrl = ""; } @@ -79,6 +81,7 @@ class SignatureVerificationFull extends ScopedElementsMixin(DBPSignatureLitEleme currentFileName: { type: String, attribute: false }, previewInProgress: { type: Boolean, attribute: false }, isSignaturePlacement: { type: Boolean, attribute: false }, + fileHandlingEnabledTargets: { type: String, attribute: 'file-handling-enabled-targets'} }; } @@ -491,7 +494,7 @@ class SignatureVerificationFull extends ScopedElementsMixin(DBPSignatureLitEleme <dbp-file-source id="file-source" allowed-mime-types="application/pdf" - enabled-targets="local${this.showNextcloudFilePicker ? ",nextcloud" : ""}" + enabled-targets="${this.fileHandlingEnabledTargets}" nextcloud-auth-url="${this.nextcloudWebAppPasswordURL}" nextcloud-web-dav-url="${this.nextcloudWebDavURL}" nextcloud-name="${this.nextcloudName}" diff --git a/src/dbp-signature-verification-full.metadata.json b/src/dbp-signature-verification-full.metadata.json index cce2bd7..3e5a5f0 100644 --- a/src/dbp-signature-verification-full.metadata.json +++ b/src/dbp-signature-verification-full.metadata.json @@ -14,5 +14,5 @@ "de": "Erlaubt das Verifizieren von signierten PDF-Dokumenten", "en": "Allows verification of signed PDF-documents" }, - "subscribe": "lang,entry-point-url,nextcloud-web-app-password-url,nextcloud-webdav-url,nextcloud-name,nextcloud-file-url,show-nextcloud-file-picker,auth" + "subscribe": "lang,entry-point-url,nextcloud-web-app-password-url,nextcloud-webdav-url,nextcloud-name,nextcloud-file-url,file-handling-enabled-targets,auth" } -- GitLab