diff --git a/README.md b/README.md index 842e3c96e63eff89c22705d8d2ad8ccbc480383f..2d5c15e65cecae30c0253ca56c90aabe52e0f437 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 1e2e734dbefc2b9a104f3e91fa2a7dcc6753b3a7..751986ae7862fb19cd5f937f19c76b238f961d1b 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 b19a5747ffa8e0a541a2779df4db1ccc9cc01016..5210ed220fb89392497dc651177b9d77d813984e 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 0dbf543ee0ad8539d4e6e2499108cb35aef4292c..3704c2b4bd34d14a2a6a243279f790f625bc7e85 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 ae9ac3a5644d25b3cae2dfd34118ecd8849fafba..852b6920dd1cc7a93a36b82528d73c87a4bd9e44 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 e14ba4f7bd1f7276f85129c17e68ad73a696608b..70d177e459fd81f45a989c74b5d81ebb74de6cd4 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 75310877c99231c25b61ec0745b9171c8766220e..f50d7a69f32109557b72a19abe8112a5b5485651 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 d88d5dc7f7c4cf5c8c76994f34aa40529141edf3..8ce6b818135419613ee116ac6a39afd16d11ca85 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 a1303986872d06d9746dd8d522886efe88dd335d..52103d5fd9a2f30096e8f5a316d197e6e19e129e 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 736ad1ee2e384fd0520c4bb81644ce5067d55755..313cce1eb7a953291cdd376829f18b7b52ef593d 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 cce2bd72e484b68db8fde7f64f3066b5d6b771dd..3e5a5f0d4307b38a7c87ff72816152cb8042a9b2 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" }