[Mobile] Use and update guest name
This commit is contained in:
parent
2784812084
commit
45a69f5192
|
@ -119,7 +119,7 @@ define([
|
|||
if (mode && mode.canUseReviewPermissions) {
|
||||
var permissions = mode.customization.reviewPermissions,
|
||||
arr = [],
|
||||
groups = Common.Utils.UserInfoParser.getParsedGroups(mode.user.fullname);
|
||||
groups = Common.Utils.UserInfoParser.getParsedGroups(Common.Utils.UserInfoParser.getCurrentName());
|
||||
groups && groups.forEach(function(group) {
|
||||
var item = permissions[group.trim()];
|
||||
item && (arr = arr.concat(item));
|
||||
|
@ -264,14 +264,11 @@ define([
|
|||
},
|
||||
|
||||
getUsersInfo: function() {
|
||||
var me = this;
|
||||
var usersArray = [];
|
||||
_.each(editUsers, function(item){
|
||||
var name = Common.Utils.UserInfoParser.getParsedName(item.asc_getUserName());
|
||||
var fio = name.split(' ');
|
||||
var initials = fio[0].substring(0, 1).toUpperCase();
|
||||
if (fio.length > 1) {
|
||||
initials += fio[fio.length - 1].substring(0, 1).toUpperCase();
|
||||
}
|
||||
var initials = me.getInitials(name);
|
||||
if((item.asc_getState()!==false) && !item.asc_getView()) {
|
||||
var userAttr = {
|
||||
color: item.asc_getColor(),
|
||||
|
@ -791,8 +788,11 @@ define([
|
|||
getInitials: function(name) {
|
||||
var fio = Common.Utils.UserInfoParser.getParsedName(name).split(' ');
|
||||
var initials = fio[0].substring(0, 1).toUpperCase();
|
||||
if (fio.length > 1) {
|
||||
initials += fio[fio.length - 1].substring(0, 1).toUpperCase();
|
||||
for (var i=fio.length-1; i>0; i--) {
|
||||
if (fio[i][0]!=='(' && fio[i][0]!==')') {
|
||||
initials += fio[i].substring(0, 1).toUpperCase();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return initials;
|
||||
},
|
||||
|
|
|
@ -198,8 +198,11 @@ define([
|
|||
|
||||
me.editorConfig = $.extend(me.editorConfig, data.config);
|
||||
|
||||
var value = Common.localStorage.getItem("guest-username");
|
||||
Common.Utils.InternalSettings.set("guest-username", value);
|
||||
Common.Utils.InternalSettings.set("save-guest-username", !!value);
|
||||
me.editorConfig.user =
|
||||
me.appOptions.user = Common.Utils.fillUserInfo(me.editorConfig.user, me.editorConfig.lang, me.textAnonymous);
|
||||
me.appOptions.user = Common.Utils.fillUserInfo(me.editorConfig.user, me.editorConfig.lang, value ? (value + ' (' + me.textGuest + ')' ) : me.textAnonymous);
|
||||
me.appOptions.isDesktopApp = me.editorConfig.targetApp == 'desktop';
|
||||
me.appOptions.canCreateNew = !_.isEmpty(me.editorConfig.createUrl) && !me.appOptions.isDesktopApp;
|
||||
me.appOptions.canOpenRecent = me.editorConfig.recent !== undefined && !me.appOptions.isDesktopApp;
|
||||
|
@ -226,7 +229,7 @@ define([
|
|||
if (!me.editorConfig.customization || !(me.editorConfig.customization.loaderName || me.editorConfig.customization.loaderLogo))
|
||||
$('#editor-container').append('<div class="doc-placeholder"><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div></div>');
|
||||
|
||||
var value = Common.localStorage.getItem("de-mobile-macros-mode");
|
||||
value = Common.localStorage.getItem("de-mobile-macros-mode");
|
||||
if (value === null) {
|
||||
value = this.editorConfig.customization ? this.editorConfig.customization.macrosMode : 'warn';
|
||||
value = (value == 'enable') ? 1 : (value == 'disable' ? 2 : 0);
|
||||
|
@ -818,6 +821,8 @@ define([
|
|||
|
||||
me.appOptions.canUseReviewPermissions = me.appOptions.canLicense && me.editorConfig.customization && me.editorConfig.customization.reviewPermissions && (typeof (me.editorConfig.customization.reviewPermissions) == 'object');
|
||||
Common.Utils.UserInfoParser.setParser(me.appOptions.canUseReviewPermissions);
|
||||
Common.Utils.UserInfoParser.setCurrentName(me.appOptions.user.fullname);
|
||||
me.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(this.editorConfig.customization.reviewPermissions);
|
||||
|
||||
me.applyModeCommonElements();
|
||||
me.applyModeEditorElements();
|
||||
|
@ -855,6 +860,7 @@ define([
|
|||
me.api.asc_registerCallback('asc_onDownloadUrl', _.bind(me.onDownloadUrl, me));
|
||||
me.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(me.onAuthParticipantsChanged, me));
|
||||
me.api.asc_registerCallback('asc_onParticipantsChanged', _.bind(me.onAuthParticipantsChanged, me));
|
||||
me.api.asc_registerCallback('asc_onConnectionStateChanged', _.bind(me.onUserConnection, me));
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -1355,6 +1361,15 @@ define([
|
|||
this._state.usersCount = length;
|
||||
},
|
||||
|
||||
onUserConnection: function(change){
|
||||
if (change && this.appOptions.user.guest && (change.asc_getIdOriginal() == this.appOptions.user.id)) { // change name of the current user
|
||||
var name = change.asc_getUserName();
|
||||
if (name && name !== Common.Utils.UserInfoParser.getCurrentName() ) {
|
||||
Common.Utils.UserInfoParser.setCurrentName(name);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onDocumentName: function(name) {
|
||||
// this.getApplication().getController('Viewport').getView('Common.Views.Header').setDocumentCaption(name);
|
||||
this.updateWindowTitle(true);
|
||||
|
@ -1595,7 +1610,8 @@ define([
|
|||
errorSessionIdle: 'The document has not been edited for quite a long time. Please reload the page.',
|
||||
errorSessionToken: 'The connection to the server has been interrupted. Please reload the page.',
|
||||
warnLicenseLimitedRenewed: 'License needs to be renewed.<br>You have a limited access to document editing functionality.<br>Please contact your administrator to get full access',
|
||||
warnLicenseLimitedNoAccess: 'License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.'
|
||||
warnLicenseLimitedNoAccess: 'License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.',
|
||||
textGuest: 'Guest'
|
||||
}
|
||||
})(), DE.Controllers.Main || {}))
|
||||
});
|
|
@ -201,8 +201,11 @@ define([
|
|||
|
||||
me.editorConfig = $.extend(me.editorConfig, data.config);
|
||||
|
||||
var value = Common.localStorage.getItem("guest-username");
|
||||
Common.Utils.InternalSettings.set("guest-username", value);
|
||||
Common.Utils.InternalSettings.set("save-guest-username", !!value);
|
||||
me.editorConfig.user =
|
||||
me.appOptions.user = Common.Utils.fillUserInfo(me.editorConfig.user, me.editorConfig.lang, me.textAnonymous);
|
||||
me.appOptions.user = Common.Utils.fillUserInfo(me.editorConfig.user, me.editorConfig.lang, value ? (value + ' (' + me.textGuest + ')' ) : me.textAnonymous);
|
||||
me.appOptions.isDesktopApp = me.editorConfig.targetApp == 'desktop';
|
||||
me.appOptions.canCreateNew = !_.isEmpty(me.editorConfig.createUrl) && !me.appOptions.isDesktopApp;
|
||||
me.appOptions.canOpenRecent = me.editorConfig.recent !== undefined && !me.appOptions.isDesktopApp;
|
||||
|
@ -229,7 +232,7 @@ define([
|
|||
if (!me.editorConfig.customization || !(me.editorConfig.customization.loaderName || me.editorConfig.customization.loaderLogo))
|
||||
$('#editor_sdk').append('<div class="doc-placeholder"><div class="slide-h"><div class="slide-v"><div class="slide-container"><div class="line"></div><div class="line empty"></div><div class="line"></div></div></div></div></div>');
|
||||
|
||||
var value = Common.localStorage.getItem("pe-mobile-macros-mode");
|
||||
value = Common.localStorage.getItem("pe-mobile-macros-mode");
|
||||
if (value === null) {
|
||||
value = this.editorConfig.customization ? this.editorConfig.customization.macrosMode : 'warn';
|
||||
value = (value == 'enable') ? 1 : (value == 'disable' ? 2 : 0);
|
||||
|
@ -744,6 +747,8 @@ define([
|
|||
|
||||
me.appOptions.canUseReviewPermissions = me.appOptions.canLicense && me.editorConfig.customization && me.editorConfig.customization.reviewPermissions && (typeof (me.editorConfig.customization.reviewPermissions) == 'object');
|
||||
Common.Utils.UserInfoParser.setParser(me.appOptions.canUseReviewPermissions);
|
||||
Common.Utils.UserInfoParser.setCurrentName(me.appOptions.user.fullname);
|
||||
me.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(me.editorConfig.customization.reviewPermissions);
|
||||
|
||||
me.applyModeCommonElements();
|
||||
me.applyModeEditorElements();
|
||||
|
@ -781,6 +786,7 @@ define([
|
|||
me.api.asc_registerCallback('asc_onDownloadUrl', _.bind(me.onDownloadUrl, me));
|
||||
me.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(me.onAuthParticipantsChanged, me));
|
||||
me.api.asc_registerCallback('asc_onParticipantsChanged', _.bind(me.onAuthParticipantsChanged, me));
|
||||
me.api.asc_registerCallback('asc_onConnectionStateChanged', _.bind(me.onUserConnection, me));
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -1248,6 +1254,15 @@ define([
|
|||
this._state.usersCount = length;
|
||||
},
|
||||
|
||||
onUserConnection: function(change){
|
||||
if (change && this.appOptions.user.guest && (change.asc_getIdOriginal() == this.appOptions.user.id)) { // change name of the current user
|
||||
var name = change.asc_getUserName();
|
||||
if (name && name !== Common.Utils.UserInfoParser.getCurrentName() ) {
|
||||
Common.Utils.UserInfoParser.setCurrentName(name);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onDocumentName: function(name) {
|
||||
// this.getApplication().getController('Viewport').getView('Common.Views.Header').setDocumentCaption(name);
|
||||
this.updateWindowTitle(true);
|
||||
|
@ -1536,7 +1551,8 @@ define([
|
|||
errorSessionIdle: 'The document has not been edited for quite a long time. Please reload the page.',
|
||||
errorSessionToken: 'The connection to the server has been interrupted. Please reload the page.',
|
||||
warnLicenseLimitedRenewed: 'License needs to be renewed.<br>You have a limited access to document editing functionality.<br>Please contact your administrator to get full access',
|
||||
warnLicenseLimitedNoAccess: 'License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.'
|
||||
warnLicenseLimitedNoAccess: 'License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.',
|
||||
textGuest: 'Guest'
|
||||
}
|
||||
})(), PE.Controllers.Main || {}))
|
||||
});
|
|
@ -204,8 +204,11 @@ define([
|
|||
|
||||
me.editorConfig = $.extend(me.editorConfig, data.config);
|
||||
|
||||
var value = Common.localStorage.getItem("guest-username");
|
||||
Common.Utils.InternalSettings.set("guest-username", value);
|
||||
Common.Utils.InternalSettings.set("save-guest-username", !!value);
|
||||
me.editorConfig.user =
|
||||
me.appOptions.user = Common.Utils.fillUserInfo(me.editorConfig.user, me.editorConfig.lang, me.textAnonymous);
|
||||
me.appOptions.user = Common.Utils.fillUserInfo(me.editorConfig.user, me.editorConfig.lang, value ? (value + ' (' + me.textGuest + ')' ) : me.textAnonymous);
|
||||
me.appOptions.isDesktopApp = me.editorConfig.targetApp == 'desktop';
|
||||
me.appOptions.canCreateNew = !_.isEmpty(me.editorConfig.createUrl) && !me.appOptions.isDesktopApp;
|
||||
me.appOptions.canOpenRecent = me.editorConfig.recent !== undefined && !me.appOptions.isDesktopApp;
|
||||
|
@ -227,7 +230,7 @@ define([
|
|||
me.appOptions.canPlugins = false;
|
||||
me.plugins = me.editorConfig.plugins;
|
||||
|
||||
var value = Common.localStorage.getItem("sse-settings-regional");
|
||||
value = Common.localStorage.getItem("sse-settings-regional");
|
||||
if (value!==null)
|
||||
this.api.asc_setLocale(parseInt(value));
|
||||
else {
|
||||
|
@ -756,6 +759,8 @@ define([
|
|||
|
||||
me.appOptions.canUseReviewPermissions = me.appOptions.canLicense && me.editorConfig.customization && me.editorConfig.customization.reviewPermissions && (typeof (me.editorConfig.customization.reviewPermissions) == 'object');
|
||||
Common.Utils.UserInfoParser.setParser(me.appOptions.canUseReviewPermissions);
|
||||
Common.Utils.UserInfoParser.setCurrentName(me.appOptions.user.fullname);
|
||||
me.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(me.editorConfig.customization.reviewPermissions);
|
||||
}
|
||||
|
||||
me.appOptions.canRequestEditRights = me.editorConfig.canRequestEditRights;
|
||||
|
@ -803,6 +808,7 @@ define([
|
|||
}
|
||||
me.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(me.onAuthParticipantsChanged, me));
|
||||
me.api.asc_registerCallback('asc_onParticipantsChanged', _.bind(me.onAuthParticipantsChanged, me));
|
||||
me.api.asc_registerCallback('asc_onConnectionStateChanged', _.bind(me.onUserConnection, me));
|
||||
},
|
||||
|
||||
applyModeEditorElements: function() {
|
||||
|
@ -1455,6 +1461,15 @@ define([
|
|||
this._state.usersCount = length;
|
||||
},
|
||||
|
||||
onUserConnection: function(change){
|
||||
if (change && this.appOptions.user.guest && (change.asc_getIdOriginal() == this.appOptions.user.id)) { // change name of the current user
|
||||
var name = change.asc_getUserName();
|
||||
if (name && name !== Common.Utils.UserInfoParser.getCurrentName() ) {
|
||||
Common.Utils.UserInfoParser.setCurrentName(name);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
applySettings: function() {
|
||||
if (this.appOptions.isEdit && this.appOptions.canLicense && !this.appOptions.isOffline && this.appOptions.canCoAuthoring) {
|
||||
var value = Common.localStorage.getItem("sse-settings-coauthmode"),
|
||||
|
@ -1754,7 +1769,8 @@ define([
|
|||
errorFrmlMaxLength: 'You cannot add this formula as its length exceeded the allowed number of characters.<br>Please edit it and try again.',
|
||||
errorFrmlMaxReference: 'You cannot enter this formula because it has too many values,<br>cell references, and/or names.',
|
||||
warnLicenseLimitedRenewed: 'License needs to be renewed.<br>You have a limited access to document editing functionality.<br>Please contact your administrator to get full access',
|
||||
warnLicenseLimitedNoAccess: 'License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.'
|
||||
warnLicenseLimitedNoAccess: 'License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.',
|
||||
textGuest: 'Guest'
|
||||
}
|
||||
})(), SSE.Controllers.Main || {}))
|
||||
});
|
Loading…
Reference in a new issue