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