diff --git a/CHANGELOG.md b/CHANGELOG.md index aeb74caf7c..74eb9bbeec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Save to pdfa format * Add rotation and flip to image and shape settings (bug #19378) * Save file copy to selected folder (bug #23603, bug #32790) +* Load image from storage ### Document Editor diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index dd11935199..a7eb14f2b5 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -57,7 +57,7 @@ canBackToFolder: - deprecated. use "customization.goback" parameter, createUrl: 'create document url', sharingSettingsUrl: 'document sharing settings url', - fileChoiceUrl: 'mail merge sources url', + fileChoiceUrl: 'source url', // for mail merge or image from storage callbackUrl: , mergeFolderUrl: 'folder for saving merged file', // must be deprecated, use saveAsUrl instead saveAsUrl: 'folder for saving files' diff --git a/apps/documenteditor/main/app/view/MailMergeRecepients.js b/apps/common/main/lib/view/SelectFileDlg.js similarity index 92% rename from apps/documenteditor/main/app/view/MailMergeRecepients.js rename to apps/common/main/lib/view/SelectFileDlg.js index 38f4d6ef7d..9d2bf2be5d 100644 --- a/apps/documenteditor/main/app/view/MailMergeRecepients.js +++ b/apps/common/main/lib/view/SelectFileDlg.js @@ -40,7 +40,7 @@ define([ 'common/main/lib/component/LoadMask' ], function () { 'use strict'; - DE.Views.MailMergeRecepients = Common.UI.Window.extend(_.extend({ + Common.Views.SelectFileDlg = Common.UI.Window.extend(_.extend({ initialize : function(options) { var _options = {}; _.extend(_options, { @@ -51,7 +51,7 @@ define([ }, options); this.template = [ - '
' + '
' ].join(''); _options.tpl = _.template(this.template)(_options); @@ -71,9 +71,9 @@ define([ iframe.frameBorder = 0; iframe.scrolling = "no"; iframe.onload = _.bind(this._onLoad,this); - $('#id-mail-recepients-placeholder').append(iframe); + $('#id-select-file-placeholder').append(iframe); - this.loadMask = new Common.UI.LoadMask({owner: $('#id-mail-recepients-placeholder')}); + this.loadMask = new Common.UI.LoadMask({owner: $('#id-select-file-placeholder')}); this.loadMask.setTitle(this.textLoading); this.loadMask.show(); @@ -121,7 +121,7 @@ define([ var me = this; setTimeout(function() { if ( !_.isEmpty(msg.file) ) { - me.trigger('mailmergerecepients', me, msg.file); + me.trigger('selectfile', me, msg.file); } }, 50); } @@ -134,5 +134,5 @@ define([ textTitle : 'Select Data Source', textLoading : 'Loading' - }, DE.Views.MailMergeRecepients || {})); + }, Common.Views.SelectFileDlg || {})); }); diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 6f2a5a9681..3fe3a3b606 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -46,10 +46,10 @@ define([ 'common/main/lib/view/CopyWarningDialog', 'common/main/lib/view/ImageFromUrlDialog', 'common/main/lib/view/InsertTableDialog', + 'common/main/lib/view/SelectFileDlg', 'common/main/lib/util/define', 'documenteditor/main/app/view/Toolbar', 'documenteditor/main/app/view/DropcapSettingsAdvanced', - 'documenteditor/main/app/view/MailMergeRecepients', 'documenteditor/main/app/view/StyleTitleDialog', 'documenteditor/main/app/view/PageMarginsDialog', 'documenteditor/main/app/view/PageSizeDialog', @@ -1359,7 +1359,7 @@ define([ Common.NotificationCenter.trigger('edit:complete', me.toolbar); Common.component.Analytics.trackEvent('ToolBar', 'Image'); - } else { + } else if (item.value === 'url') { (new Common.Views.ImageFromUrlDialog({ handler: function(result, value) { if (result == 'ok') { @@ -1381,6 +1381,14 @@ define([ } } })).show(); + } else if (item.value === 'storage') { + (new Common.Views.SelectFileDlg({ + fileChoiceUrl: this.toolbar.mode.fileChoiceUrl.replace("{fileExt}", "").replace("{documentType}", "ImagesOnly") + })).on('selectfile', function(obj, file){ + me.toolbar.fireEvent('insertimage', me.toolbar); + me.api.AddImageUrl(file.url); + Common.component.Analytics.trackEvent('ToolBar', 'Image'); + }).show(); } }, @@ -2713,10 +2721,10 @@ define([ if (this._mailMergeDlg) return; var me = this; - me._mailMergeDlg = new DE.Views.MailMergeRecepients({ - fileChoiceUrl: this.toolbar.mode.fileChoiceUrl + me._mailMergeDlg = new Common.Views.SelectFileDlg({ + fileChoiceUrl: this.toolbar.mode.fileChoiceUrl.replace("{fileExt}", "xlsx").replace("{documentType}", "") }); - me._mailMergeDlg.on('mailmergerecepients', function(obj, recepients){ + me._mailMergeDlg.on('selectfile', function(obj, recepients){ me.api.asc_StartMailMerge(recepients); if (!me.mergeEditor) me.mergeEditor = me.getApplication().getController('Common.Controllers.ExternalMergeEditor').getView('Common.Views.ExternalMergeEditor'); diff --git a/apps/documenteditor/main/app/view/MailMergeSettings.js b/apps/documenteditor/main/app/view/MailMergeSettings.js index 02d1e21b0b..8f42f11f9e 100644 --- a/apps/documenteditor/main/app/view/MailMergeSettings.js +++ b/apps/documenteditor/main/app/view/MailMergeSettings.js @@ -43,7 +43,7 @@ define([ 'common/main/lib/component/Button', 'common/main/lib/component/Switcher', 'common/main/lib/view/SaveAsDlg', - 'documenteditor/main/app/view/MailMergeRecepients', + 'common/main/lib/view/SelectFileDlg', 'documenteditor/main/app/view/MailMergeEmailDlg' ], function (menuTemplate, $, _, Backbone) { 'use strict'; diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index e07d276a94..eb61254723 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -494,7 +494,8 @@ define([ menu: new Common.UI.Menu({ items: [ {caption: this.mniImageFromFile, value: 'file'}, - {caption: this.mniImageFromUrl, value: 'url'} + {caption: this.mniImageFromUrl, value: 'url'}, + {caption: this.mniImageFromStorage, value: 'storage'} ] }) }); @@ -2012,6 +2013,7 @@ define([ this.listStylesAdditionalMenuItem.setVisible(mode.canEditStyles); this.btnContentControls.menu.items[4].setVisible(mode.canEditContentControl); this.btnContentControls.menu.items[5].setVisible(mode.canEditContentControl); + this.mnuInsertImage.items[2].setVisible(this.mode.fileChoiceUrl && this.mode.fileChoiceUrl.indexOf("{documentType}")>-1); }, onSendThemeColorSchemes: function (schemas) { @@ -2368,7 +2370,8 @@ define([ mniEditControls: 'Settings', tipControls: 'Insert content control', mniHighlightControls: 'Highlight settings', - textNoHighlight: 'No highlighting' + textNoHighlight: 'No highlighting', + mniImageFromStorage: 'Image from Storage' } })(), DE.Views.Toolbar || {})); }); diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 643edf796d..f1836b55c3 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -282,6 +282,8 @@ "Common.Views.ReviewPopover.textResolve": "Resolve", "Common.Views.SaveAsDlg.textLoading": "Loading", "Common.Views.SaveAsDlg.textTitle": "Folder for save", + "Common.Views.SelectFileDlg.textLoading": "Loading", + "Common.Views.SelectFileDlg.textTitle": "Select Data Source", "Common.Views.SignDialog.cancelButtonText": "Cancel", "Common.Views.SignDialog.okButtonText": "Ok", "Common.Views.SignDialog.textBold": "Bold", @@ -1380,8 +1382,8 @@ "DE.Views.MailMergeEmailDlg.textTo": "To", "DE.Views.MailMergeEmailDlg.textWarning": "Warning!", "DE.Views.MailMergeEmailDlg.textWarningMsg": "Please note that mailing cannot be stopped once your click the 'Send' button.", - "DE.Views.MailMergeRecepients.textLoading": "Loading", - "DE.Views.MailMergeRecepients.textTitle": "Select Data Source", + "del_DE.Views.MailMergeRecepients.textLoading": "Loading", + "del_DE.Views.MailMergeRecepients.textTitle": "Select Data Source", "del_DE.Views.MailMergeSaveDlg.textLoading": "Loading", "del_DE.Views.MailMergeSaveDlg.textTitle": "Folder for save", "DE.Views.MailMergeSettings.downloadMergeTitle": "Merging", @@ -1968,5 +1970,6 @@ "DE.Views.Toolbar.txtScheme6": "Concourse", "DE.Views.Toolbar.txtScheme7": "Equity", "DE.Views.Toolbar.txtScheme8": "Flow", - "DE.Views.Toolbar.txtScheme9": "Foundry" + "DE.Views.Toolbar.txtScheme9": "Foundry", + "DE.Views.Toolbar.mniImageFromStorage": "Image from Storage" } \ No newline at end of file diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index a02f3714de..631d6ed8a6 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -291,6 +291,7 @@ define([ this.appOptions.location = (typeof (this.editorConfig.location) == 'string') ? this.editorConfig.location.toLowerCase() : ''; this.appOptions.sharingSettingsUrl = this.editorConfig.sharingSettingsUrl; this.appOptions.saveAsUrl = this.editorConfig.saveAsUrl; + this.appOptions.fileChoiceUrl = this.editorConfig.fileChoiceUrl; this.appOptions.canAnalytics = false; this.appOptions.customization = this.editorConfig.customization; this.appOptions.canBackToFolder = (this.editorConfig.canBackToFolder!==false) && (typeof (this.editorConfig.customization) == 'object') diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index 831ffeadca..a31a5aa9ca 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -47,6 +47,7 @@ define([ 'common/main/lib/view/CopyWarningDialog', 'common/main/lib/view/ImageFromUrlDialog', 'common/main/lib/view/InsertTableDialog', + 'common/main/lib/view/SelectFileDlg', 'common/main/lib/util/define', 'presentationeditor/main/app/collection/SlideThemes', 'presentationeditor/main/app/view/Toolbar', @@ -1340,7 +1341,7 @@ define([ Common.NotificationCenter.trigger('edit:complete', this.toolbar); Common.component.Analytics.trackEvent('ToolBar', 'Image'); - } else { + } else if (opts === 'url') { (new Common.Views.ImageFromUrlDialog({ handler: function(result, value) { if (result == 'ok') { @@ -1362,6 +1363,14 @@ define([ } } })).show(); + } else if (opts === 'storage') { + (new Common.Views.SelectFileDlg({ + fileChoiceUrl: me.toolbar.mode.fileChoiceUrl.replace("{fileExt}", "").replace("{documentType}", "ImagesOnly") + })).on('selectfile', function(obj, file){ + me.toolbar.fireEvent('insertimage', me.toolbar); + me.api.AddImageUrl(file.url); + Common.component.Analytics.trackEvent('ToolBar', 'Image'); + }).show(); } }, diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js index 7bb1b41bed..8b282243d5 100644 --- a/apps/presentationeditor/main/app/view/Toolbar.js +++ b/apps/presentationeditor/main/app/view/Toolbar.js @@ -1027,12 +1027,14 @@ define([ new Common.UI.Menu({ items: [ {caption: me.mniImageFromFile, value: 'file'}, - {caption: me.mniImageFromUrl, value: 'url'} + {caption: me.mniImageFromUrl, value: 'url'}, + {caption: me.mniImageFromStorage, value: 'storage'} ] }).on('item:click', function (menu, item, e) { me.fireEvent('insert:image', [item.value]); }) ); + btn.menu.items[2].setVisible(config.fileChoiceUrl && config.fileChoiceUrl.indexOf("{documentType}")>-1); }); me.btnsInsertText.forEach(function (btn) { @@ -1731,7 +1733,8 @@ define([ textSurface: 'Surface', textShowPresenterView: 'Show presenter view', textTabCollaboration: 'Collaboration', - textTabProtect: 'Protection' + textTabProtect: 'Protection', + mniImageFromStorage: 'Image from Storage' } }()), PE.Views.Toolbar || {})); }); \ No newline at end of file diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index 17b690ed67..6203e16886 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -204,6 +204,8 @@ "Common.Views.ReviewPopover.textResolve": "Resolve", "Common.Views.SaveAsDlg.textLoading": "Loading", "Common.Views.SaveAsDlg.textTitle": "Folder for save", + "Common.Views.SelectFileDlg.textLoading": "Loading", + "Common.Views.SelectFileDlg.textTitle": "Select Data Source", "Common.Views.SignDialog.cancelButtonText": "Cancel", "Common.Views.SignDialog.okButtonText": "Ok", "Common.Views.SignDialog.textBold": "Bold", @@ -1567,5 +1569,6 @@ "PE.Views.Toolbar.txtScheme7": "Equity", "PE.Views.Toolbar.txtScheme8": "Flow", "PE.Views.Toolbar.txtScheme9": "Foundry", - "PE.Views.Toolbar.txtUngroup": "Ungroup" + "PE.Views.Toolbar.txtUngroup": "Ungroup", + "PE.Views.Toolbar.mniImageFromStorage": "Image from Storage" } \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index eacd230c37..2b64d94b12 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -298,6 +298,7 @@ define([ this.appOptions.canAnalytics = false; this.appOptions.sharingSettingsUrl = this.editorConfig.sharingSettingsUrl; this.appOptions.saveAsUrl = this.editorConfig.saveAsUrl; + this.appOptions.fileChoiceUrl = this.editorConfig.fileChoiceUrl; this.appOptions.isEditDiagram = this.editorConfig.mode == 'editdiagram'; this.appOptions.isEditMailMerge = this.editorConfig.mode == 'editmerge'; this.appOptions.customization = this.editorConfig.customization; diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 4ecf5edca8..95d1d24de8 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -43,6 +43,7 @@ define([ 'common/main/lib/component/Window', 'common/main/lib/view/CopyWarningDialog', 'common/main/lib/view/ImageFromUrlDialog', + 'common/main/lib/view/SelectFileDlg', 'common/main/lib/util/define', 'spreadsheeteditor/main/app/view/Toolbar', 'spreadsheeteditor/main/app/collection/TableTemplates', @@ -822,7 +823,7 @@ define([ Common.NotificationCenter.trigger('edit:complete', this.toolbar); Common.component.Analytics.trackEvent('ToolBar', 'Image'); - } else { + } else if (item.value === 'url') { var me = this; (new Common.Views.ImageFromUrlDialog({ @@ -846,6 +847,15 @@ define([ } } })).show(); + } else if (item.value === 'storage') { + var me = this; + (new Common.Views.SelectFileDlg({ + fileChoiceUrl: me.toolbar.mode.fileChoiceUrl.replace("{fileExt}", "").replace("{documentType}", "ImagesOnly") + })).on('selectfile', function(obj, file){ + me.toolbar.fireEvent('insertimage', me.toolbar); + me.api.asc_addImageDrawingObject(file.url); + Common.component.Analytics.trackEvent('ToolBar', 'Image'); + }).show(); } }, diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index fca067ed89..3667ec0eb1 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -675,7 +675,8 @@ define([ menu : new Common.UI.Menu({ items: [ { caption: me.mniImageFromFile, value: 'file' }, - { caption: me.mniImageFromUrl, value: 'url' } + { caption: me.mniImageFromUrl, value: 'url' }, + { caption: me.mniImageFromStorage, value: 'storage'} ] }) }); @@ -1537,6 +1538,7 @@ define([ $(mnu.el).html(mnu.template({id: Common.UI.getId(), caption : mnu.caption, options : mnu.options})); } else this.btnPageMargins.menu.items[0].setVisible(false); + this.btnInsertImage.menu.items[2].setVisible(mode.fileChoiceUrl && mode.fileChoiceUrl.indexOf("{documentType}")>-1); } me.setTab('home'); @@ -2412,6 +2414,7 @@ define([ textBottom: 'Bottom: ', textRight: 'Right: ', textPortrait: 'Portrait', - textLandscape: 'Landscape' + textLandscape: 'Landscape', + mniImageFromStorage: 'Image from Storage' }, SSE.Views.Toolbar || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 679275a58a..84b35ec0a8 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -194,6 +194,8 @@ "Common.Views.ReviewPopover.textResolve": "Resolve", "Common.Views.SaveAsDlg.textLoading": "Loading", "Common.Views.SaveAsDlg.textTitle": "Folder for save", + "Common.Views.SelectFileDlg.textLoading": "Loading", + "Common.Views.SelectFileDlg.textTitle": "Select Data Source", "Common.Views.SignDialog.cancelButtonText": "Cancel", "Common.Views.SignDialog.okButtonText": "Ok", "Common.Views.SignDialog.textBold": "Bold", @@ -2081,6 +2083,7 @@ "SSE.Views.Toolbar.txtTime": "Time", "SSE.Views.Toolbar.txtUnmerge": "Unmerge Cells", "SSE.Views.Toolbar.txtYen": "¥ Yen", + "SSE.Views.Toolbar.mniImageFromStorage": "Image from Storage", "SSE.Views.Top10FilterDialog.cancelButtonText": "Cancel", "SSE.Views.Top10FilterDialog.okButtonText": "OK", "SSE.Views.Top10FilterDialog.textType": "Show",