From 2f5951aaaf3990d3580f00db32e17f444272b7ae Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 18 Mar 2019 14:47:41 +0300 Subject: [PATCH] [DE] create url with data for action/command --- apps/api/documents/api.js | 11 +++++++++++ apps/common/Gateway.js | 8 ++++++++ apps/documenteditor/main/app/controller/Links.js | 3 +++ apps/documenteditor/main/app/controller/Main.js | 1 + 4 files changed, 23 insertions(+) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index 3d84e1e3e..1f5b55412 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -197,6 +197,7 @@ _config.editorConfig.canRequestEditRights = _config.events && !!_config.events.onRequestEditRights; _config.editorConfig.canRequestClose = _config.events && !!_config.events.onRequestClose; _config.editorConfig.canRename = _config.events && !!_config.events.onRequestRename; + _config.editorConfig.canMakeActionLink = _config.events && !!_config.events.onMakeActionLink; _config.editorConfig.mergeFolderUrl = _config.editorConfig.mergeFolderUrl || _config.editorConfig.saveAsUrl; _config.frameEditorId = placeholderId; @@ -509,6 +510,15 @@ }); }; + var _setActionLink = function (data) { + _sendCommand({ + command: 'setActionLink', + data: { + url: data + } + }); + }; + var _processMailMerge = function(enabled, message) { _sendCommand({ command: 'processMailMerge', @@ -559,6 +569,7 @@ refreshHistory : _refreshHistory, setHistoryData : _setHistoryData, setEmailAddresses : _setEmailAddresses, + setActionLink : _setActionLink, processMailMerge : _processMailMerge, downloadAs : _downloadAs, serviceCommand : _serviceCommand, diff --git a/apps/common/Gateway.js b/apps/common/Gateway.js index fe0cc2d50..a906dedba 100644 --- a/apps/common/Gateway.js +++ b/apps/common/Gateway.js @@ -76,6 +76,10 @@ if (Common === undefined) { $me.trigger('setemailaddresses', data); }, + 'setActionLink': function (data) { + $me.trigger('setactionlink', data.url); + }, + 'processMailMerge': function(data) { $me.trigger('processmailmerge', data); }, @@ -254,6 +258,10 @@ if (Common === undefined) { _postMessage({event: 'onRequestClose'}); }, + requestMakeActionLink: function (config) { + _postMessage({event:'onMakeActionLink', data: config}) + }, + on: function(event, handler){ var localHandler = function(event, data){ handler.call(me, data) diff --git a/apps/documenteditor/main/app/controller/Links.js b/apps/documenteditor/main/app/controller/Links.js index 8afbc37cf..df5a31c8e 100644 --- a/apps/documenteditor/main/app/controller/Links.js +++ b/apps/documenteditor/main/app/controller/Links.js @@ -78,6 +78,9 @@ define([ this._state = { prcontrolsdisable:undefined }; + Common.Gateway.on('setactionlink', function (url) { + console.log('url with actions: ' + url); + }.bind(this)); }, setApi: function (api) { diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 681263051..75f9b64fb 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -332,6 +332,7 @@ define([ this.appOptions.canBack = this.appOptions.canBackToFolder === true; this.appOptions.canPlugins = false; this.plugins = this.editorConfig.plugins; + this.appOptions.canMakeActionLink = this.editorConfig.canMakeActionLink; appHeader = this.getApplication().getController('Viewport').getView('Common.Views.Header'); appHeader.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '')