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/common/main/lib/controller/Comments.js b/apps/common/main/lib/controller/Comments.js index 2dc8790b3..47d095e8b 100644 --- a/apps/common/main/lib/controller/Comments.js +++ b/apps/common/main/lib/controller/Comments.js @@ -777,7 +777,6 @@ define([ })); } - replies.sort(function (a,b) { return a.get('time') - b.get('time');}); comment.set('replys', replies); if (!silentUpdate) { @@ -1246,10 +1245,6 @@ define([ editable : this.mode.canEditComments || (data.asc_getReply(i).asc_getUserId() == this.currentUserId) })); } - - replies.sort(function (a, b) { - return a.get('time') - b.get('time'); - }); } return replies; diff --git a/apps/common/main/lib/template/Comments.template b/apps/common/main/lib/template/Comments.template index cf458d5e3..8fac3d9ad 100644 --- a/apps/common/main/lib/template/Comments.template +++ b/apps/common/main/lib/template/Comments.template @@ -36,8 +36,8 @@
<% if (item.get("editable")) { %>
">
+
">
<% } %> -
">
<%}%> <% } else { %> @@ -67,8 +67,8 @@
<% if (editable) { %>
+
<% } %> -
<% if (resolved) { %>
<% } else { %> diff --git a/apps/common/main/lib/template/CommentsPopover.template b/apps/common/main/lib/template/CommentsPopover.template index 7eb3b8933..b08d83abd 100644 --- a/apps/common/main/lib/template/CommentsPopover.template +++ b/apps/common/main/lib/template/CommentsPopover.template @@ -36,8 +36,8 @@
<% if (item.get("editable")) { %>
">
+
">
<%}%> -
">
<%}%> <% } else { %> @@ -68,8 +68,8 @@
<% if (editable) { %>
+
<% } %> -
<% if (resolved) { %>
<% } else { %> diff --git a/apps/documenteditor/main/app/controller/Links.js b/apps/documenteditor/main/app/controller/Links.js index 8afbc37cf..02f4b27cf 100644 --- a/apps/documenteditor/main/app/controller/Links.js +++ b/apps/documenteditor/main/app/controller/Links.js @@ -78,6 +78,16 @@ define([ this._state = { prcontrolsdisable:undefined }; + Common.Gateway.on('setactionlink', function (url) { + var copytext = document.createElement('input'); + copytext.value = url; + document.body.appendChild(copytext); + copytext.select(); + try { + document.execCommand("copy"); + } catch (err) {} + document.body.removeChild(copytext); + }); }, setApi: function (api) { @@ -325,6 +335,7 @@ define([ var me = this; (new DE.Views.BookmarksDialog({ api: me.api, + appOptions: me.toolbar.appOptions, props: me.api.asc_GetBookmarksManager(), handler: function (result, settings) { if (settings) { diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 681263051..0c1043fd5 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 : '') @@ -356,7 +357,9 @@ define([ this.permissions = $.extend(this.permissions, data.doc.permissions); var _permissions = $.extend({}, data.doc.permissions), - _user = new Asc.asc_CUserInfo(); + _options = $.extend({}, data.doc.options, {actions: this.editorConfig.actionLink || {}}); + + var _user = new Asc.asc_CUserInfo(); _user.put_Id(this.appOptions.user.id); _user.put_FullName(this.appOptions.user.fullname); @@ -366,7 +369,7 @@ define([ docInfo.put_Title(data.doc.title); docInfo.put_Format(data.doc.fileType); docInfo.put_VKey(data.doc.vkey); - docInfo.put_Options(data.doc.options); + docInfo.put_Options(_options); docInfo.put_UserInfo(_user); docInfo.put_CallbackUrl(this.editorConfig.callbackUrl); docInfo.put_Token(data.doc.token); diff --git a/apps/documenteditor/main/app/view/BookmarksDialog.js b/apps/documenteditor/main/app/view/BookmarksDialog.js index 203b1e80c..8d74d61b2 100644 --- a/apps/documenteditor/main/app/view/BookmarksDialog.js +++ b/apps/documenteditor/main/app/view/BookmarksDialog.js @@ -90,7 +90,8 @@ define([ '', '', '', - '', + '', + '', '', '', '', @@ -111,6 +112,7 @@ define([ this.api = options.api; this.handler = options.handler; this.props = options.props; + this.appOptions = options.appOptions; Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); }, @@ -137,6 +139,7 @@ define([ me.btnAdd.setDisabled(!check && !exist); me.btnGoto.setDisabled(!exist); me.btnDelete.setDisabled(!exist); + me.btnGetLink.setDisabled(!exist); return (check || _.isEmpty(value)) ? true : me.txtInvalidName; } @@ -187,6 +190,12 @@ define([ }); this.btnDelete.on('click', _.bind(this.deleteBookmark, this)); + this.btnGetLink = new Common.UI.Button({ + el: $('#bookmarks-btn-link'), + disabled: true + }); + this.btnGetLink.on('click', _.bind(this.getBookmarkLink, this)); + this.chHidden = new Common.UI.CheckBox({ el: $('#bookmarks-checkbox-hidden'), labelText: this.textHidden, @@ -220,6 +229,7 @@ define([ _setDefaults: function (props) { this.refreshBookmarks(); this.bookmarksList.scrollToRecord(this.bookmarksList.selectByIndex(0)); + this.btnGetLink.setVisible(this.appOptions.canMakeActionLink); }, getSettings: function () { @@ -266,6 +276,7 @@ define([ this.btnAdd.setDisabled(false); this.btnGoto.setDisabled(false); this.btnDelete.setDisabled(false); + this.btnGetLink.setDisabled(false); }, gotoBookmark: function(btn, eOpts){ @@ -290,6 +301,14 @@ define([ this.btnAdd.setDisabled(true); this.btnGoto.setDisabled(true); this.btnDelete.setDisabled(true); + this.btnGetLink.setDisabled(true); + } + }, + + getBookmarkLink: function() { + var rec = this.bookmarksList.getSelectedRec(); + if (rec.length>0) { + Common.Gateway.requestMakeActionLink({action: "bookmark", data: rec[0].get('value')}); } }, @@ -314,7 +333,8 @@ define([ textDelete: 'Delete', textClose: 'Close', textHidden: 'Hidden bookmarks', - txtInvalidName: 'Bookmark name can only contain letters, digits and underscores, and should begin with the letter' + txtInvalidName: 'Bookmark name can only contain letters, digits and underscores, and should begin with the letter', + textGetLink: 'Get link' }, DE.Views.BookmarksDialog || {})) }); \ No newline at end of file diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index a3e3265e7..01aca3261 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -1009,6 +1009,7 @@ "DE.Views.BookmarksDialog.textName": "Name", "DE.Views.BookmarksDialog.textSort": "Sort by", "DE.Views.BookmarksDialog.textTitle": "Bookmarks", + "DE.Views.BookmarksDialog.textGetLink": "Get link", "DE.Views.BookmarksDialog.txtInvalidName": "Bookmark name can only contain letters, digits and underscores, and should begin with the letter", "DE.Views.ChartSettings.textAdvanced": "Show advanced settings", "DE.Views.ChartSettings.textArea": "Area", diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index ee133ee34..ffc4a2955 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -336,7 +336,9 @@ define([ this.permissions = $.extend(this.permissions, data.doc.permissions); var _permissions = $.extend({}, data.doc.permissions), - _user = new Asc.asc_CUserInfo(); + _options = $.extend({}, data.doc.options, {actions: this.editorConfig.actionLink || {}}); + + var _user = new Asc.asc_CUserInfo(); _user.put_Id(this.appOptions.user.id); _user.put_FullName(this.appOptions.user.fullname); @@ -346,7 +348,7 @@ define([ docInfo.put_Title(data.doc.title); docInfo.put_Format(data.doc.fileType); docInfo.put_VKey(data.doc.vkey); - docInfo.put_Options(data.doc.options); + docInfo.put_Options(_options); docInfo.put_UserInfo(_user); docInfo.put_CallbackUrl(this.editorConfig.callbackUrl); docInfo.put_Token(data.doc.token); diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index d40a23278..2ff2b7636 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -362,7 +362,9 @@ define([ this.permissions = _.extend(this.permissions, data.doc.permissions); var _permissions = $.extend({}, data.doc.permissions), - _user = new Asc.asc_CUserInfo(); + _options = $.extend({}, data.doc.options, {actions: this.editorConfig.actionLink || {}}); + + var _user = new Asc.asc_CUserInfo(); _user.put_Id(this.appOptions.user.id); _user.put_FullName(this.appOptions.user.fullname); @@ -372,7 +374,7 @@ define([ docInfo.put_Title(data.doc.title); docInfo.put_Format(data.doc.fileType); docInfo.put_VKey(data.doc.vkey); - docInfo.put_Options(data.doc.options); + docInfo.put_Options(_options); docInfo.put_UserInfo(_user); docInfo.put_CallbackUrl(this.editorConfig.callbackUrl); docInfo.put_Token(data.doc.token);