[DE] Replace MailMergeSaveDlg by SaveAsDlg from common

This commit is contained in:
Julia Radzhabova 2018-09-27 13:52:15 +03:00
parent 29dfa2b83d
commit 8dc82501ef
5 changed files with 30 additions and 29 deletions

View file

@ -31,9 +31,8 @@
*
*/
/**
* User: Julia.Radzhabova
* Date: 15.04.15
* Time: 13:56
* Created by Julia.Radzhabova on 9/27/18
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*/
define([
@ -41,7 +40,7 @@ define([
'common/main/lib/component/LoadMask'
], function () { 'use strict';
DE.Views.MailMergeSaveDlg = Common.UI.Window.extend(_.extend({
Common.Views.SaveAsDlg = Common.UI.Window.extend(_.extend({
initialize : function(options) {
var _options = {};
_.extend(_options, {
@ -52,15 +51,15 @@ define([
}, options);
this.template = [
'<div id="id-mail-merge-folder-placeholder"></div>'
'<div id="id-saveas-folder-placeholder"></div>'
].join('');
_options.tpl = _.template(this.template)(_options);
this.mergeFolderUrl = options.mergeFolderUrl || '';
this.mergedFileUrl = options.mergedFileUrl || '';
this.saveFolderUrl = options.saveFolderUrl || '';
this.saveFileUrl = options.saveFileUrl || '';
this.defFileName = options.defFileName || '';
this.mergeFolderUrl = this.mergeFolderUrl.replace("{title}", encodeURIComponent(this.defFileName)).replace("{fileuri}", encodeURIComponent(this.mergedFileUrl));
this.saveFolderUrl = this.saveFolderUrl.replace("{title}", encodeURIComponent(this.defFileName)).replace("{fileuri}", encodeURIComponent(this.saveFileUrl));
Common.UI.Window.prototype.initialize.call(this, _options);
},
@ -75,13 +74,13 @@ define([
iframe.frameBorder = 0;
iframe.scrolling = "no";
iframe.onload = _.bind(this._onLoad,this);
$('#id-mail-merge-folder-placeholder').append(iframe);
$('#id-saveas-folder-placeholder').append(iframe);
this.loadMask = new Common.UI.LoadMask({owner: $('#id-mail-merge-folder-placeholder')});
this.loadMask = new Common.UI.LoadMask({owner: $('#id-saveas-folder-placeholder')});
this.loadMask.setTitle(this.textLoading);
this.loadMask.show();
iframe.src = this.mergeFolderUrl;
iframe.src = this.saveFolderUrl;
var me = this;
this._eventfunc = function(msg) {
@ -122,10 +121,10 @@ define([
_onMessage: function(msg) {
if (msg && msg.Referer == "onlyoffice") {
if ( !_.isEmpty(msg.error) ) {
this.trigger('mailmergeerror', this, msg.error);
this.trigger('saveaserror', this, msg.error);
}
// if ( !_.isEmpty(msg.folder) ) {
// this.trigger('mailmergefolder', this, msg.folder); // save last folder url
// this.trigger('saveasfolder', this, msg.folder); // save last folder url
// }
Common.NotificationCenter.trigger('window:close', this);
}
@ -138,6 +137,6 @@ define([
textTitle : 'Folder for save',
textLoading : 'Loading'
}, DE.Views.MailMergeSaveDlg || {}));
}, Common.Views.SaveAsDlg || {}));
});

View file

@ -43,9 +43,9 @@
define([
'core',
'common/main/lib/util/Shortcuts',
'common/main/lib/view/SaveAsDlg',
'documenteditor/main/app/view/LeftMenu',
'documenteditor/main/app/view/FileMenu',
'documenteditor/main/app/view/MailMergeSaveDlg'
'documenteditor/main/app/view/FileMenu'
], function () {
'use strict';
@ -353,12 +353,12 @@ define([
defFileName = defFileName.substring(0, idx) + this.isFromFileDownloadAs;
}
me._saveCopyDlg = new DE.Views.MailMergeSaveDlg({
mergeFolderUrl: me.mode.saveAsUrl,
mergedFileUrl: url,
me._saveCopyDlg = new Common.Views.SaveAsDlg({
saveFolderUrl: me.mode.saveAsUrl,
saveFileUrl: url,
defFileName: defFileName
});
me._saveCopyDlg.on('mailmergeerror', function(obj, err){
me._saveCopyDlg.on('saveaserror', function(obj, err){
var config = {
closable: false,
title: this.notcriticalErrorTitle,

View file

@ -171,7 +171,7 @@ define([ 'text!documenteditor/main/app/template/MailMergeEmailDlg.template',
_onMessage: function(msg) {
if (msg && msg.Referer == "onlyoffice") {
// if ( !_.isEmpty(msg.folder) ) {
// this.trigger('mailmergefolder', this, msg.folder); // save last folder url
// this.trigger('saveasfolder', this, msg.folder); // save last folder url
// }
}
},

View file

@ -42,8 +42,8 @@ define([
'backbone',
'common/main/lib/component/Button',
'common/main/lib/component/Switcher',
'common/main/lib/view/SaveAsDlg',
'documenteditor/main/app/view/MailMergeRecepients',
'documenteditor/main/app/view/MailMergeSaveDlg',
'documenteditor/main/app/view/MailMergeEmailDlg'
], function (menuTemplate, $, _, Backbone) {
'use strict';
@ -544,13 +544,13 @@ define([
if (this._mailMergeDlg) return;
var me = this;
if (this.cmbMergeTo.getValue() != Asc.c_oAscFileType.HTML) {
me._mailMergeDlg = new DE.Views.MailMergeSaveDlg({
mergeFolderUrl: me.mode.mergeFolderUrl,
mergedFileUrl: url,
me._mailMergeDlg = new Common.Views.SaveAsDlg({
saveFolderUrl: me.mode.mergeFolderUrl,
savedFileUrl: url,
defFileName: me.defFileName + ((this.cmbMergeTo.getValue() == Asc.c_oAscFileType.PDF) ? '.pdf' : '.docx')
});
me._mailMergeDlg.on('mailmergefolder', function(obj, folder){ // save last folder
}).on('mailmergeerror', function(obj, err){ // save last folder
me._mailMergeDlg.on('saveasfolder', function(obj, folder){ // save last folder
}).on('saveaserror', function(obj, err){ // save last folder
var config = {
closable: false,
title: this.notcriticalErrorTitle,

View file

@ -279,6 +279,8 @@
"Common.Views.ReviewPopover.textOpenAgain": "Open Again",
"Common.Views.ReviewPopover.textReply": "Reply",
"Common.Views.ReviewPopover.textResolve": "Resolve",
"Common.Views.SaveAsDlg.textLoading": "Loading",
"Common.Views.SaveAsDlg.textTitle": "Folder for save",
"Common.Views.SignDialog.cancelButtonText": "Cancel",
"Common.Views.SignDialog.okButtonText": "Ok",
"Common.Views.SignDialog.textBold": "Bold",
@ -1361,8 +1363,8 @@
"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",
"DE.Views.MailMergeSaveDlg.textLoading": "Loading",
"DE.Views.MailMergeSaveDlg.textTitle": "Folder for save",
"del_DE.Views.MailMergeSaveDlg.textLoading": "Loading",
"del_DE.Views.MailMergeSaveDlg.textTitle": "Folder for save",
"DE.Views.MailMergeSettings.downloadMergeTitle": "Merging",
"DE.Views.MailMergeSettings.errorMailMergeSaveFile": "Merge failed.",
"DE.Views.MailMergeSettings.notcriticalErrorTitle": "Warning",