Add onRequestMailMergeRecipients event, setMailMergeRecipients method for mail merge
This commit is contained in:
parent
9d451b93e9
commit
2652e09372
|
@ -204,6 +204,7 @@
|
|||
_config.editorConfig.mergeFolderUrl = _config.editorConfig.mergeFolderUrl || _config.editorConfig.saveAsUrl;
|
||||
_config.editorConfig.canRequestSaveAs = _config.events && !!_config.events.onRequestSaveAs;
|
||||
_config.editorConfig.canRequestInsertImage = _config.events && !!_config.events.onRequestInsertImage;
|
||||
_config.editorConfig.canRequestMailMergeRecipients = _config.events && !!_config.events.onRequestMailMergeRecipients;
|
||||
_config.frameEditorId = placeholderId;
|
||||
|
||||
_config.events && !!_config.events.onReady && console.log("Obsolete: The onReady event is deprecated. Please use onAppReady instead.");
|
||||
|
@ -569,6 +570,13 @@
|
|||
});
|
||||
};
|
||||
|
||||
var _setMailMergeRecipients = function(data) {
|
||||
_sendCommand({
|
||||
command: 'setMailMergeRecipients',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
var _processMouse = function(evt) {
|
||||
var r = iframe.getBoundingClientRect();
|
||||
var data = {
|
||||
|
@ -612,7 +620,8 @@
|
|||
setUsers : _setUsers,
|
||||
showSharingSettings : _showSharingSettings,
|
||||
setSharingSettings : _setSharingSettings,
|
||||
insertImage : _insertImage
|
||||
insertImage : _insertImage,
|
||||
setMailMergeRecipients: _setMailMergeRecipients
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -114,6 +114,10 @@ if (Common === undefined) {
|
|||
|
||||
'insertImage': function(data) {
|
||||
$me.trigger('insertimage', data);
|
||||
},
|
||||
|
||||
'setMailMergeRecipients': function(data) {
|
||||
$me.trigger('setmailmergerecipients', data);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -300,6 +304,10 @@ if (Common === undefined) {
|
|||
_postMessage({event:'onRequestInsertImage'})
|
||||
},
|
||||
|
||||
requestMailMergeRecipients: function () {
|
||||
_postMessage({event:'onRequestMailMergeRecipients'})
|
||||
},
|
||||
|
||||
on: function(event, handler){
|
||||
var localHandler = function(event, data){
|
||||
handler.call(me, data)
|
||||
|
|
|
@ -351,6 +351,7 @@ define([
|
|||
this.appOptions.canRequestSendNotify = this.editorConfig.canRequestSendNotify;
|
||||
this.appOptions.canRequestSaveAs = this.editorConfig.canRequestSaveAs;
|
||||
this.appOptions.canRequestInsertImage = this.editorConfig.canRequestInsertImage;
|
||||
this.appOptions.canRequestMailMergeRecipients = this.editorConfig.canRequestMailMergeRecipients;
|
||||
|
||||
appHeader = this.getApplication().getController('Viewport').getView('Common.Views.Header');
|
||||
appHeader.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '')
|
||||
|
|
|
@ -324,6 +324,7 @@ define([
|
|||
toolbar.mnuNoControlsColor.on('click', _.bind(this.onNoControlsColor, this));
|
||||
toolbar.mnuControlsColorPicker.on('select', _.bind(this.onSelectControlsColor, this));
|
||||
Common.Gateway.on('insertimage', _.bind(this.insertImage, this));
|
||||
Common.Gateway.on('setmailmergerecipients', _.bind(this.setMailMergeRecipients, this));
|
||||
$('#id-toolbar-menu-new-control-color').on('click', _.bind(this.onNewControlsColor, this));
|
||||
|
||||
$('#id-save-style-plus, #id-save-style-link', toolbar.$el).on('click', this.onMenuSaveStyle.bind(this));
|
||||
|
@ -2605,7 +2606,7 @@ define([
|
|||
this.toolbar.btnRedo.setDisabled(this._state.can_redo!==true);
|
||||
this.toolbar.btnCopy.setDisabled(this._state.can_copycut!==true);
|
||||
this.toolbar.btnPrint.setDisabled(!this.toolbar.mode.canPrint);
|
||||
if (this.toolbar.mode.fileChoiceUrl)
|
||||
if (this.toolbar.mode.fileChoiceUrl || this.toolbar.mode.canRequestMailMergeRecipients)
|
||||
this.toolbar.btnMailRecepients.setDisabled(false);
|
||||
this._state.activated = true;
|
||||
|
||||
|
@ -2803,22 +2804,28 @@ define([
|
|||
onSelectRecepientsClick: function() {
|
||||
if (this._mailMergeDlg) return;
|
||||
|
||||
if (this.toolbar.mode.canRequestMailMergeRecipients) {
|
||||
Common.Gateway.requestMailMergeRecipients();
|
||||
} else {
|
||||
var me = this;
|
||||
me._mailMergeDlg = new Common.Views.SelectFileDlg({
|
||||
fileChoiceUrl: this.toolbar.mode.fileChoiceUrl.replace("{fileExt}", "xlsx").replace("{documentType}", "")
|
||||
});
|
||||
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');
|
||||
if (me.mergeEditor)
|
||||
me.mergeEditor.setEditMode(false);
|
||||
|
||||
me.setMailMergeRecipients(recepients);
|
||||
}).on('close', function(obj){
|
||||
me._mailMergeDlg = undefined;
|
||||
});
|
||||
|
||||
me._mailMergeDlg.show();
|
||||
}
|
||||
},
|
||||
|
||||
setMailMergeRecipients: function(recepients) {
|
||||
this.api.asc_StartMailMerge(recepients);
|
||||
if (!this.mergeEditor)
|
||||
this.mergeEditor = this.getApplication().getController('Common.Controllers.ExternalMergeEditor').getView('Common.Views.ExternalMergeEditor');
|
||||
if (this.mergeEditor)
|
||||
this.mergeEditor.setEditMode(false);
|
||||
},
|
||||
|
||||
createDelayedElements: function() {
|
||||
|
|
Loading…
Reference in a new issue