[Libreoffice-commits] online.git: loleaflet/src

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Dec 19 06:44:11 UTC 2018


 loleaflet/src/control/Signing.js |   69 ++++++++++++++++++++++++++-------------
 1 file changed, 47 insertions(+), 22 deletions(-)

New commits:
commit 7fcc48cd5176e32ef826e10649018c494560d163
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed Dec 19 07:02:50 2018 +0100
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Wed Dec 19 07:43:49 2018 +0100

    select what format to upload to vereign
    
    Change-Id: I058b2ccd07664c6c4aa00f10f1cd0ac9d8b4dc8c

diff --git a/loleaflet/src/control/Signing.js b/loleaflet/src/control/Signing.js
index 0f0a8036f..9f1b51a9c 100644
--- a/loleaflet/src/control/Signing.js
+++ b/loleaflet/src/control/Signing.js
@@ -308,31 +308,56 @@ L.Map.include({
 		if (library == null) {
 			return;
 		}
+
 		var map = this;
-		var filename = 'fileId'; // need to read the filename
 
-		library.getPassports(filename).then(function(result) {
-			var vereignURL = window.documentSigningURL == null ? '' : window.documentSigningURL;
-			if (isSuccess(result)) {
-				var resultArray = result.data;
-				for (var i = 0; i < resultArray.length; i++) {
-					if (currentPassport.uuid == resultArray[i].PassportUUID) {
-						var jsonRequest = {
-							filename: filename,
-							wopiUrl: vereignURL + '/wopi/files',
-							token: resultArray[i].AccessToken,
-							type: 'pdf'
-						};
-						var blob = new Blob(['uploadsigneddocument\n', JSON.stringify(jsonRequest)]);
-						map._socket.sendMessage(blob);
-						// Let the user know that we're done.
-						map.fire('infobar', {
-							msg: _('Document uploaded.'),
-							action: null,
-							actionLabel: null
-						});
-					}
+		vex.dialog.open({
+			message: _('Select document tpye to push to Vereign:'),
+			input: 'Type: <select name="selection"><option value="ODT">ODT</option><option value="DOCX">DOCX</option><option value="PDF">PDF</option></select>',
+			callback: function(data) {
+				var documentType = null;
+
+				switch (data.selection) {
+				case 'ODT':
+					documentType = 'odt';
+					break;
+				case 'DOCX':
+					documentType = 'docx';
+					break;
+				case 'PDF':
+					documentType = 'pdf';
+					break;
 				}
+
+				if (documentType == null)
+					return;
+
+				var filename = 'fileId.' + documentType; // need to read the filename
+
+				library.getPassports(filename).then(function(result) {
+					var vereignURL = window.documentSigningURL == null ? '' : window.documentSigningURL;
+					if (isSuccess(result)) {
+						var resultArray = result.data;
+						for (var i = 0; i < resultArray.length; i++) {
+							if (currentPassport.uuid == resultArray[i].PassportUUID) {
+								var jsonRequest = {
+									filename: filename,
+									wopiUrl: vereignURL + '/wopi/files',
+									token: resultArray[i].AccessToken,
+									type: documentType
+								};
+								var blob = new Blob(['uploadsigneddocument\n', JSON.stringify(jsonRequest)]);
+								map._socket.sendMessage(blob);
+								// Let the user know that we're done.
+								map.fire('infobar', {
+									msg: _('Document uploaded.'),
+									action: null,
+									actionLabel: null
+								});
+							}
+						}
+					}
+				});
 			}
 		});
 	},


More information about the Libreoffice-commits mailing list