Add setSharingSettings api method: update sharing settings when add mention for users
This commit is contained in:
parent
3f985b6622
commit
04b3651fd0
|
@ -554,6 +554,15 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var _setSharingSettings = function(data) {
|
||||||
|
_sendCommand({
|
||||||
|
command: 'setSharingSettings',
|
||||||
|
data: {
|
||||||
|
data: data
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
var _processMouse = function(evt) {
|
var _processMouse = function(evt) {
|
||||||
var r = iframe.getBoundingClientRect();
|
var r = iframe.getBoundingClientRect();
|
||||||
var data = {
|
var data = {
|
||||||
|
@ -595,7 +604,8 @@
|
||||||
detachMouseEvents : _detachMouseEvents,
|
detachMouseEvents : _detachMouseEvents,
|
||||||
destroyEditor : _destroyEditor,
|
destroyEditor : _destroyEditor,
|
||||||
setUsers : _setUsers,
|
setUsers : _setUsers,
|
||||||
showSharingSettings : _showSharingSettings
|
showSharingSettings : _showSharingSettings,
|
||||||
|
setSharingSettings : _setSharingSettings
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -106,6 +106,10 @@ if (Common === undefined) {
|
||||||
|
|
||||||
'showSharingSettings': function(data) {
|
'showSharingSettings': function(data) {
|
||||||
$me.trigger('showsharingsettings', data);
|
$me.trigger('showsharingsettings', data);
|
||||||
|
},
|
||||||
|
|
||||||
|
'setSharingSettings': function(data) {
|
||||||
|
$me.trigger('setsharingsettings', data);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,6 @@ define([
|
||||||
if (msg && msg.Referer == "onlyoffice") {
|
if (msg && msg.Referer == "onlyoffice") {
|
||||||
if (msg.needUpdate) {
|
if (msg.needUpdate) {
|
||||||
this.trigger('accessrights', this, msg.sharingSettings);
|
this.trigger('accessrights', this, msg.sharingSettings);
|
||||||
Common.NotificationCenter.trigger('mentions:clearusers', this);
|
|
||||||
}
|
}
|
||||||
Common.NotificationCenter.trigger('window:close', this);
|
Common.NotificationCenter.trigger('window:close', this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -989,6 +989,7 @@ define([
|
||||||
setMode: function(mode) {
|
setMode: function(mode) {
|
||||||
this.sharingSettingsUrl = mode.sharingSettingsUrl;
|
this.sharingSettingsUrl = mode.sharingSettingsUrl;
|
||||||
!!this.sharingSettingsUrl && this.sharingSettingsUrl.length && Common.Gateway.on('showsharingsettings', _.bind(this.changeAccessRights, this));
|
!!this.sharingSettingsUrl && this.sharingSettingsUrl.length && Common.Gateway.on('showsharingsettings', _.bind(this.changeAccessRights, this));
|
||||||
|
!!this.sharingSettingsUrl && this.sharingSettingsUrl.length && Common.Gateway.on('setsharingsettings', _.bind(this.setSharingSettings, this));
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1000,9 +1001,7 @@ define([
|
||||||
settingsurl: this.sharingSettingsUrl
|
settingsurl: this.sharingSettingsUrl
|
||||||
});
|
});
|
||||||
me._docAccessDlg.on('accessrights', function(obj, rights){
|
me._docAccessDlg.on('accessrights', function(obj, rights){
|
||||||
me.doc.info.sharingSettings = rights;
|
me.updateSharingSettings(rights);
|
||||||
me._ShowHideInfoItem('rights', me.doc.info.sharingSettings!==undefined && me.doc.info.sharingSettings!==null && me.doc.info.sharingSettings.length>0);
|
|
||||||
me.cntRights.html(me.templateRights({users: me.doc.info.sharingSettings}));
|
|
||||||
}).on('close', function(obj){
|
}).on('close', function(obj){
|
||||||
me._docAccessDlg = undefined;
|
me._docAccessDlg = undefined;
|
||||||
});
|
});
|
||||||
|
@ -1010,6 +1009,17 @@ define([
|
||||||
me._docAccessDlg.show();
|
me._docAccessDlg.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setSharingSettings: function(data) {
|
||||||
|
data && data.data && this.updateSharingSettings(data.data);
|
||||||
|
},
|
||||||
|
|
||||||
|
updateSharingSettings: function(rights) {
|
||||||
|
this.doc.info.sharingSettings = rights;
|
||||||
|
this._ShowHideInfoItem('rights', this.doc.info.sharingSettings!==undefined && this.doc.info.sharingSettings!==null && this.doc.info.sharingSettings.length>0);
|
||||||
|
this.cntRights.html(this.templateRights({users: this.doc.info.sharingSettings}));
|
||||||
|
Common.NotificationCenter.trigger('mentions:clearusers', this);
|
||||||
|
},
|
||||||
|
|
||||||
onLostEditRights: function() {
|
onLostEditRights: function() {
|
||||||
this._readonlyRights = true;
|
this._readonlyRights = true;
|
||||||
if (!this.rendered)
|
if (!this.rendered)
|
||||||
|
|
|
@ -802,6 +802,7 @@ define([
|
||||||
setMode: function(mode) {
|
setMode: function(mode) {
|
||||||
this.sharingSettingsUrl = mode.sharingSettingsUrl;
|
this.sharingSettingsUrl = mode.sharingSettingsUrl;
|
||||||
!!this.sharingSettingsUrl && this.sharingSettingsUrl.length && Common.Gateway.on('showsharingsettings', _.bind(this.changeAccessRights, this));
|
!!this.sharingSettingsUrl && this.sharingSettingsUrl.length && Common.Gateway.on('showsharingsettings', _.bind(this.changeAccessRights, this));
|
||||||
|
!!this.sharingSettingsUrl && this.sharingSettingsUrl.length && Common.Gateway.on('setsharingsettings', _.bind(this.setSharingSettings, this));
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -813,9 +814,7 @@ define([
|
||||||
settingsurl: this.sharingSettingsUrl
|
settingsurl: this.sharingSettingsUrl
|
||||||
});
|
});
|
||||||
me._docAccessDlg.on('accessrights', function(obj, rights){
|
me._docAccessDlg.on('accessrights', function(obj, rights){
|
||||||
me.doc.info.sharingSettings = rights;
|
me.updateSharingSettings(rights);
|
||||||
me._ShowHideInfoItem('rights', me.doc.info.sharingSettings!==undefined && me.doc.info.sharingSettings!==null && me.doc.info.sharingSettings.length>0);
|
|
||||||
me.cntRights.html(me.templateRights({users: me.doc.info.sharingSettings}));
|
|
||||||
}).on('close', function(obj){
|
}).on('close', function(obj){
|
||||||
me._docAccessDlg = undefined;
|
me._docAccessDlg = undefined;
|
||||||
});
|
});
|
||||||
|
@ -823,6 +822,17 @@ define([
|
||||||
me._docAccessDlg.show();
|
me._docAccessDlg.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setSharingSettings: function(data) {
|
||||||
|
data && data.data && this.updateSharingSettings(data.data);
|
||||||
|
},
|
||||||
|
|
||||||
|
updateSharingSettings: function(rights) {
|
||||||
|
this.doc.info.sharingSettings = rights;
|
||||||
|
this._ShowHideInfoItem('rights', this.doc.info.sharingSettings!==undefined && this.doc.info.sharingSettings!==null && this.doc.info.sharingSettings.length>0);
|
||||||
|
this.cntRights.html(this.templateRights({users: this.doc.info.sharingSettings}));
|
||||||
|
Common.NotificationCenter.trigger('mentions:clearusers', this);
|
||||||
|
},
|
||||||
|
|
||||||
onLostEditRights: function() {
|
onLostEditRights: function() {
|
||||||
this._readonlyRights = true;
|
this._readonlyRights = true;
|
||||||
if (!this.rendered)
|
if (!this.rendered)
|
||||||
|
|
|
@ -1256,6 +1256,7 @@ define([
|
||||||
setMode: function(mode) {
|
setMode: function(mode) {
|
||||||
this.sharingSettingsUrl = mode.sharingSettingsUrl;
|
this.sharingSettingsUrl = mode.sharingSettingsUrl;
|
||||||
!!this.sharingSettingsUrl && this.sharingSettingsUrl.length && Common.Gateway.on('showsharingsettings', _.bind(this.changeAccessRights, this));
|
!!this.sharingSettingsUrl && this.sharingSettingsUrl.length && Common.Gateway.on('showsharingsettings', _.bind(this.changeAccessRights, this));
|
||||||
|
!!this.sharingSettingsUrl && this.sharingSettingsUrl.length && Common.Gateway.on('setsharingsettings', _.bind(this.setSharingSettings, this));
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1267,9 +1268,7 @@ define([
|
||||||
settingsurl: this.sharingSettingsUrl
|
settingsurl: this.sharingSettingsUrl
|
||||||
});
|
});
|
||||||
me._docAccessDlg.on('accessrights', function(obj, rights){
|
me._docAccessDlg.on('accessrights', function(obj, rights){
|
||||||
me.doc.info.sharingSettings = rights;
|
me.updateSharingSettings(rights);
|
||||||
me._ShowHideInfoItem('rights', me.doc.info.sharingSettings!==undefined && me.doc.info.sharingSettings!==null && me.doc.info.sharingSettings.length>0);
|
|
||||||
me.cntRights.html(me.templateRights({users: me.doc.info.sharingSettings}));
|
|
||||||
}).on('close', function(obj){
|
}).on('close', function(obj){
|
||||||
me._docAccessDlg = undefined;
|
me._docAccessDlg = undefined;
|
||||||
});
|
});
|
||||||
|
@ -1277,6 +1276,17 @@ define([
|
||||||
me._docAccessDlg.show();
|
me._docAccessDlg.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setSharingSettings: function(data) {
|
||||||
|
data && data.data && this.updateSharingSettings(data.data);
|
||||||
|
},
|
||||||
|
|
||||||
|
updateSharingSettings: function(rights) {
|
||||||
|
this.doc.info.sharingSettings = rights;
|
||||||
|
this._ShowHideInfoItem('rights', this.doc.info.sharingSettings!==undefined && this.doc.info.sharingSettings!==null && this.doc.info.sharingSettings.length>0);
|
||||||
|
this.cntRights.html(this.templateRights({users: this.doc.info.sharingSettings}));
|
||||||
|
Common.NotificationCenter.trigger('mentions:clearusers', this);
|
||||||
|
},
|
||||||
|
|
||||||
onLostEditRights: function() {
|
onLostEditRights: function() {
|
||||||
this._readonlyRights = true;
|
this._readonlyRights = true;
|
||||||
if (!this.rendered)
|
if (!this.rendered)
|
||||||
|
|
Loading…
Reference in a new issue