Add event onRequestSharingSettings: use instead editorConfig.sharingSettingsUrl.

This commit is contained in:
Julia Radzhabova 2019-11-28 16:54:14 +03:00
parent 12400295fd
commit 019dffbceb
14 changed files with 45 additions and 28 deletions

View file

@ -209,6 +209,7 @@
_config.editorConfig.canRequestInsertImage = _config.events && !!_config.events.onRequestInsertImage;
_config.editorConfig.canRequestMailMergeRecipients = _config.events && !!_config.events.onRequestMailMergeRecipients;
_config.editorConfig.canRequestCompareFile = _config.events && !!_config.events.onRequestCompareFile;
_config.editorConfig.canRequestSharingSettings = _config.events && !!_config.events.onRequestSharingSettings;
_config.frameEditorId = placeholderId;
var onMouseUp = function (evt) {

View file

@ -293,27 +293,31 @@ if (Common === undefined) {
},
requestMakeActionLink: function (config) {
_postMessage({event:'onMakeActionLink', data: config})
_postMessage({event:'onMakeActionLink', data: config});
},
requestUsers: function () {
_postMessage({event:'onRequestUsers'})
_postMessage({event:'onRequestUsers'});
},
requestSendNotify: function (emails) {
_postMessage({event:'onRequestSendNotify', data: emails})
_postMessage({event:'onRequestSendNotify', data: emails});
},
requestInsertImage: function () {
_postMessage({event:'onRequestInsertImage'})
_postMessage({event:'onRequestInsertImage'});
},
requestMailMergeRecipients: function () {
_postMessage({event:'onRequestMailMergeRecipients'})
_postMessage({event:'onRequestMailMergeRecipients'});
},
requestCompareFile: function () {
_postMessage({event:'onRequestCompareFile'})
_postMessage({event:'onRequestCompareFile'});
},
requestSharingSettings: function () {
_postMessage({event:'onRequestSharingSettings'});
},
on: function(event, handler){

View file

@ -143,8 +143,10 @@ define([
this.popoverChanges = new Common.Collections.ReviewChanges();
this.view = this.createView('Common.Views.ReviewChanges', { mode: mode });
!!this.appConfig.sharingSettingsUrl && this.appConfig.sharingSettingsUrl.length && Common.Gateway.on('showsharingsettings', _.bind(this.changeAccessRights, this));
!!this.appConfig.sharingSettingsUrl && this.appConfig.sharingSettingsUrl.length && Common.Gateway.on('setsharingsettings', _.bind(this.setSharingSettings, this));
if (!!this.appConfig.sharingSettingsUrl && this.appConfig.sharingSettingsUrl.length || this.appConfig.canRequestSharingSettings) {
Common.Gateway.on('showsharingsettings', _.bind(this.changeAccessRights, this));
Common.Gateway.on('setsharingsettings', _.bind(this.setSharingSettings, this));
}
return this;
},
@ -831,17 +833,21 @@ define([
changeAccessRights: function(btn,event,opts) {
if (this._docAccessDlg || this._readonlyRights) return;
var me = this;
me._docAccessDlg = new Common.Views.DocumentAccessDialog({
settingsurl: this.appConfig.sharingSettingsUrl
});
me._docAccessDlg.on('accessrights', function(obj, rights){
me.setSharingSettings({sharingSettings: rights});
}).on('close', function(obj){
me._docAccessDlg = undefined;
});
if (this.appConfig.canRequestSharingSettings) {
Common.Gateway.requestSharingSettings();
} else {
var me = this;
me._docAccessDlg = new Common.Views.DocumentAccessDialog({
settingsurl: this.appConfig.sharingSettingsUrl
});
me._docAccessDlg.on('accessrights', function(obj, rights){
me.setSharingSettings({sharingSettings: rights});
}).on('close', function(obj){
me._docAccessDlg = undefined;
});
me._docAccessDlg.show();
me._docAccessDlg.show();
}
},
setSharingSettings: function(data) {

View file

@ -166,7 +166,7 @@ define([
.removeClass('dropdown-toggle')
.menu = false;
$panelUsers[(!_readonlyRights && appConfig && !appConfig.isReviewOnly && appConfig.sharingSettingsUrl && appConfig.sharingSettingsUrl.length) ? 'show' : 'hide']();
$panelUsers[(!_readonlyRights && appConfig && !appConfig.isReviewOnly && (appConfig.sharingSettingsUrl && appConfig.sharingSettingsUrl.length || appConfig.canRequestSharingSettings)) ? 'show' : 'hide']();
}
$btnUsers.find('.caption')
@ -248,8 +248,8 @@ define([
Common.NotificationCenter.trigger('collaboration:sharing');
});
$labelChangeRights[(!mode.isOffline && !mode.isReviewOnly && mode.sharingSettingsUrl && mode.sharingSettingsUrl.length)?'show':'hide']();
$panelUsers[(editingUsers > 1 || editingUsers > 0 && !appConfig.isEdit && !appConfig.isRestrictedEdit || !mode.isOffline && !mode.isReviewOnly && mode.sharingSettingsUrl && mode.sharingSettingsUrl.length) ? 'show' : 'hide']();
$labelChangeRights[(!mode.isOffline && !mode.isReviewOnly && (mode.sharingSettingsUrl && mode.sharingSettingsUrl.length || mode.canRequestSharingSettings))?'show':'hide']();
$panelUsers[(editingUsers > 1 || editingUsers > 0 && !appConfig.isEdit && !appConfig.isRestrictedEdit || !mode.isOffline && !mode.isReviewOnly && (mode.sharingSettingsUrl && mode.sharingSettingsUrl.length || mode.canRequestSharingSettings)) ? 'show' : 'hide']();
if ( $saveStatus ) {
$saveStatus.attr('data-width', me.textSaveExpander);

View file

@ -287,7 +287,7 @@ define([
}
}
if (!!this.appConfig.sharingSettingsUrl && this.appConfig.sharingSettingsUrl.length && this._readonlyRights!==true) {
if ((!!this.appConfig.sharingSettingsUrl && this.appConfig.sharingSettingsUrl.length || this.appConfig.canRequestSharingSettings) && this._readonlyRights!==true) {
this.btnSharing = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-ic-sharing',

View file

@ -354,6 +354,7 @@ define([
this.appOptions.canRequestInsertImage = this.editorConfig.canRequestInsertImage;
this.appOptions.canRequestCompareFile = this.editorConfig.canRequestCompareFile;
this.appOptions.canRequestMailMergeRecipients = this.editorConfig.canRequestMailMergeRecipients;
this.appOptions.canRequestSharingSettings = this.editorConfig.canRequestSharingSettings;
this.appOptions.compatibleFeatures = (typeof (this.appOptions.customization) == 'object') && !!this.appOptions.customization.compatibleFeatures;
this.appOptions.canFeatureComparison = !!this.api.asc_isSupportFeature("comparison");

View file

@ -297,7 +297,7 @@ define([
this.miAccess[(!this.mode.isOffline && !this.mode.isReviewOnly && this.document&&this.document.info &&
(this.document.info.sharingSettings&&this.document.info.sharingSettings.length>0 ||
this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length))?'show':'hide']();
(this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length || this.mode.canRequestSharingSettings)))?'show':'hide']();
this.miHelp[this.mode.canHelp ?'show':'hide']();
this.miHelp.$el.prev()[this.mode.canHelp ?'show':'hide']();

View file

@ -1231,7 +1231,7 @@ define([
if (doc.info.sharingSettings)
this.cntRights.html(this.templateRights({users: doc.info.sharingSettings}));
this._ShowHideInfoItem('rights', doc.info.sharingSettings!==undefined && doc.info.sharingSettings!==null && doc.info.sharingSettings.length>0);
this._ShowHideInfoItem('edit-rights', !!this.sharingSettingsUrl && this.sharingSettingsUrl.length && this._readonlyRights!==true);
this._ShowHideInfoItem('edit-rights', (!!this.sharingSettingsUrl && this.sharingSettingsUrl.length || this.mode.canRequestSharingSettings) && this._readonlyRights!==true);
} else
this._ShowHideDocInfo(false);
},
@ -1251,6 +1251,7 @@ define([
},
setMode: function(mode) {
this.mode = mode;
this.sharingSettingsUrl = mode.sharingSettingsUrl;
return this;
},

View file

@ -321,6 +321,7 @@ define([
this.appOptions.canRequestSaveAs = this.editorConfig.canRequestSaveAs;
this.appOptions.canRequestInsertImage = this.editorConfig.canRequestInsertImage;
this.appOptions.compatibleFeatures = (typeof (this.appOptions.customization) == 'object') && !!this.appOptions.customization.compatibleFeatures;
this.appOptions.canRequestSharingSettings = this.editorConfig.canRequestSharingSettings;
appHeader = this.getApplication().getController('Viewport').getView('Common.Views.Header');
appHeader.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '')

View file

@ -280,7 +280,7 @@ define([
this.miNew.$el.find('+.devider')[this.mode.canCreateNew?'show':'hide']();
this.miAccess[(!this.mode.isOffline && this.document&&this.document.info&&(this.document.info.sharingSettings&&this.document.info.sharingSettings.length>0 ||
this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length))?'show':'hide']();
(this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length || this.mode.canRequestSharingSettings)))?'show':'hide']();
this.mode.canBack ? this.$el.find('#fm-btn-back').show().prev().show() :
this.$el.find('#fm-btn-back').hide().prev().hide();

View file

@ -1042,7 +1042,7 @@ define([
if (doc.info.sharingSettings)
this.cntRights.html(this.templateRights({users: doc.info.sharingSettings}));
this._ShowHideInfoItem('rights', doc.info.sharingSettings!==undefined && doc.info.sharingSettings!==null && doc.info.sharingSettings.length>0);
this._ShowHideInfoItem('edit-rights', !!this.sharingSettingsUrl && this.sharingSettingsUrl.length && this._readonlyRights!==true);
this._ShowHideInfoItem('edit-rights', (!!this.sharingSettingsUrl && this.sharingSettingsUrl.length || this.mode.canRequestSharingSettings) && this._readonlyRights!==true);
} else
this._ShowHideDocInfo(false);
},
@ -1057,6 +1057,7 @@ define([
},
setMode: function(mode) {
this.mode = mode;
this.sharingSettingsUrl = mode.sharingSettingsUrl;
return this;
},

View file

@ -337,6 +337,7 @@ define([
this.appOptions.canRequestSaveAs = this.editorConfig.canRequestSaveAs;
this.appOptions.canRequestInsertImage = this.editorConfig.canRequestInsertImage;
this.appOptions.compatibleFeatures = (typeof (this.appOptions.customization) == 'object') && !!this.appOptions.customization.compatibleFeatures;
this.appOptions.canRequestSharingSettings = this.editorConfig.canRequestSharingSettings;
this.headerView = this.getApplication().getController('Viewport').getView('Common.Views.Header');
this.headerView.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '')

View file

@ -271,7 +271,7 @@ define([
this.miNew.$el.find('+.devider')[this.mode.canCreateNew?'show':'hide']();
this.miAccess[(!this.mode.isOffline && this.document&&this.document.info&&(this.document.info.sharingSettings&&this.document.info.sharingSettings.length>0 ||
this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length))?'show':'hide']();
(this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length || this.mode.canRequestSharingSettings)))?'show':'hide']();
this.mode.canBack ? this.$el.find('#fm-btn-back').show().prev().show() :
this.$el.find('#fm-btn-back').hide().prev().hide();

View file

@ -1523,7 +1523,7 @@ define([
if (doc.info.sharingSettings)
this.cntRights.html(this.templateRights({users: doc.info.sharingSettings}));
this._ShowHideInfoItem('rights', doc.info.sharingSettings!==undefined && doc.info.sharingSettings!==null && doc.info.sharingSettings.length>0);
this._ShowHideInfoItem('edit-rights', !!this.sharingSettingsUrl && this.sharingSettingsUrl.length && this._readonlyRights!==true);
this._ShowHideInfoItem('edit-rights', (!!this.sharingSettingsUrl && this.sharingSettingsUrl.length || this.mode.canRequestSharingSettings) && this._readonlyRights!==true);
} else
this._ShowHideDocInfo(false);
},
@ -1538,6 +1538,7 @@ define([
},
setMode: function(mode) {
this.mode = mode;
this.sharingSettingsUrl = mode.sharingSettingsUrl;
return this;
},