Merge branch 'feature/guest-name' into develop
This commit is contained in:
commit
64f81a2984
|
@ -125,6 +125,10 @@
|
|||
"Group2": ["Group1", "Group2"] // users from Group2 can accept/reject review changes made by users from Group1 and Group2
|
||||
"Group3": [""] // users from Group3 can accept/reject review changes made by users without a group
|
||||
},
|
||||
anonymous: { // set name for anonymous user
|
||||
request: bool (default: true), // enable set name
|
||||
label: string (default: "Guest") // postfix for user name
|
||||
}
|
||||
chat: true,
|
||||
comments: true,
|
||||
zoom: 100,
|
||||
|
|
|
@ -169,6 +169,7 @@ define([
|
|||
}));
|
||||
} else {
|
||||
user.set({online: change.asc_getState()});
|
||||
user.set({username: change.asc_getUserName()});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -169,7 +169,6 @@ define([
|
|||
|
||||
if (data) {
|
||||
this.currentUserId = data.config.user.id;
|
||||
this.currentUserName = data.config.user.fullname;
|
||||
this.sdkViewName = data['sdkviewname'] || this.sdkViewName;
|
||||
this.hintmode = data['hintmode'] || false;
|
||||
this.viewmode = data['viewmode'] || false;
|
||||
|
@ -217,7 +216,7 @@ define([
|
|||
comment.asc_putTime(this.utcDateToString(new Date()));
|
||||
comment.asc_putOnlyOfficeTime(this.ooDateToString(new Date()));
|
||||
comment.asc_putUserId(this.currentUserId);
|
||||
comment.asc_putUserName(this.currentUserName);
|
||||
comment.asc_putUserName(Common.Utils.UserInfoParser.getCurrentName());
|
||||
comment.asc_putSolved(false);
|
||||
|
||||
if (!_.isUndefined(comment.asc_putDocumentFlag)) {
|
||||
|
@ -355,7 +354,7 @@ define([
|
|||
ascComment.asc_putTime(t.utcDateToString(new Date(comment.get('time'))));
|
||||
ascComment.asc_putOnlyOfficeTime(t.ooDateToString(new Date(comment.get('time'))));
|
||||
ascComment.asc_putUserId(t.currentUserId);
|
||||
ascComment.asc_putUserName(t.currentUserName);
|
||||
ascComment.asc_putUserName(Common.Utils.UserInfoParser.getCurrentName());
|
||||
ascComment.asc_putSolved(comment.get('resolved'));
|
||||
ascComment.asc_putGuid(comment.get('guid'));
|
||||
ascComment.asc_putUserData(comment.get('userdata'));
|
||||
|
@ -432,7 +431,7 @@ define([
|
|||
if (reply.get('id') === replyId && !_.isUndefined(replyVal)) {
|
||||
addReply.asc_putText(replyVal);
|
||||
addReply.asc_putUserId(me.currentUserId);
|
||||
addReply.asc_putUserName(me.currentUserName);
|
||||
addReply.asc_putUserName(Common.Utils.UserInfoParser.getCurrentName());
|
||||
} else {
|
||||
addReply.asc_putText(reply.get('reply'));
|
||||
addReply.asc_putUserId(reply.get('userid'));
|
||||
|
@ -512,7 +511,7 @@ define([
|
|||
addReply.asc_putTime(me.utcDateToString(new Date()));
|
||||
addReply.asc_putOnlyOfficeTime(me.ooDateToString(new Date()));
|
||||
addReply.asc_putUserId(me.currentUserId);
|
||||
addReply.asc_putUserName(me.currentUserName);
|
||||
addReply.asc_putUserName(Common.Utils.UserInfoParser.getCurrentName());
|
||||
|
||||
ascComment.asc_addReply(addReply);
|
||||
|
||||
|
@ -1308,7 +1307,7 @@ define([
|
|||
time: date.getTime(),
|
||||
date: this.dateToLocaleTimeString(date),
|
||||
userid: this.currentUserId,
|
||||
username: this.currentUserName,
|
||||
username: Common.Utils.UserInfoParser.getCurrentName(),
|
||||
usercolor: (user) ? user.get('color') : null,
|
||||
editTextInPopover: true,
|
||||
showReplyInPopover: false,
|
||||
|
@ -1372,7 +1371,7 @@ define([
|
|||
comment.asc_putTime(this.utcDateToString(new Date()));
|
||||
comment.asc_putOnlyOfficeTime(this.ooDateToString(new Date()));
|
||||
comment.asc_putUserId(this.currentUserId);
|
||||
comment.asc_putUserName(this.currentUserName);
|
||||
comment.asc_putUserName(Common.Utils.UserInfoParser.getCurrentName());
|
||||
comment.asc_putSolved(false);
|
||||
|
||||
if (!_.isUndefined(comment.asc_putDocumentFlag))
|
||||
|
|
|
@ -118,16 +118,6 @@ define([
|
|||
|
||||
if (data) {
|
||||
this.currentUserId = data.config.user.id;
|
||||
if (this.appConfig && this.appConfig.canUseReviewPermissions) {
|
||||
var permissions = this.appConfig.customization.reviewPermissions,
|
||||
arr = [],
|
||||
groups = Common.Utils.UserInfoParser.getParsedGroups(data.config.user.fullname);
|
||||
groups && groups.forEach(function(group) {
|
||||
var item = permissions[group.trim()];
|
||||
item && (arr = arr.concat(item));
|
||||
});
|
||||
this.currentUserGroups = arr;
|
||||
}
|
||||
this.sdkViewName = data['sdkviewname'] || this.sdkViewName;
|
||||
}
|
||||
return this;
|
||||
|
@ -482,7 +472,7 @@ define([
|
|||
|
||||
checkUserGroups: function(username) {
|
||||
var groups = Common.Utils.UserInfoParser.getParsedGroups(username);
|
||||
return this.currentUserGroups && groups && (_.intersection(this.currentUserGroups, (groups.length>0) ? groups : [""]).length>0);
|
||||
return Common.Utils.UserInfoParser.getCurrentGroups() && groups && (_.intersection(Common.Utils.UserInfoParser.getCurrentGroups(), (groups.length>0) ? groups : [""]).length>0);
|
||||
},
|
||||
|
||||
getUserName: function(id){
|
||||
|
|
|
@ -98,12 +98,19 @@ define(['gateway'], function () {
|
|||
var value = _getItem(name);
|
||||
defValue = defValue || false;
|
||||
return (value!==null) ? (parseInt(value) != 0) : defValue;
|
||||
}
|
||||
};
|
||||
|
||||
var _getItemExists = function (name) {
|
||||
var value = _getItem(name);
|
||||
return value !== null;
|
||||
}
|
||||
};
|
||||
|
||||
var _removeItem = function(name) {
|
||||
if (_lsAllowed)
|
||||
localStorage.removeItem(name);
|
||||
else
|
||||
delete _store[name];
|
||||
};
|
||||
|
||||
try {
|
||||
var _lsAllowed = !!window.localStorage;
|
||||
|
@ -122,6 +129,7 @@ define(['gateway'], function () {
|
|||
getBool: _getItemAsBool,
|
||||
setBool: _setItemAsBool,
|
||||
setItem: _setItem,
|
||||
removeItem: _removeItem,
|
||||
setKeysFilter: function(value) {
|
||||
_filter = value;
|
||||
},
|
||||
|
|
|
@ -714,6 +714,7 @@ Common.Utils.fillUserInfo = function(info, lang, defname) {
|
|||
!_user.id && (_user.id = ('uid-' + Date.now()));
|
||||
_user.fullname = _.isEmpty(_user.name) ? defname : _user.name;
|
||||
_user.group && (_user.fullname = (_user.group).toString() + Common.Utils.UserInfoParser.getSeparator() + _user.fullname);
|
||||
_user.guest = _.isEmpty(_user.name);
|
||||
return _user;
|
||||
};
|
||||
|
||||
|
@ -967,8 +968,11 @@ Common.Utils.ModalWindow = new(function() {
|
|||
})();
|
||||
|
||||
Common.Utils.UserInfoParser = new(function() {
|
||||
var parse = false;
|
||||
var separator = String.fromCharCode(160);
|
||||
var parse = false,
|
||||
separator = String.fromCharCode(160),
|
||||
username = '',
|
||||
usergroups,
|
||||
permissions;
|
||||
return {
|
||||
setParser: function(value) {
|
||||
parse = !!value;
|
||||
|
@ -994,6 +998,32 @@ Common.Utils.UserInfoParser = new(function() {
|
|||
return groups;
|
||||
} else
|
||||
return undefined;
|
||||
},
|
||||
|
||||
setCurrentName: function(name) {
|
||||
username = name;
|
||||
this.setReviewPermissions(permissions);
|
||||
},
|
||||
|
||||
getCurrentName: function() {
|
||||
return username;
|
||||
},
|
||||
|
||||
setReviewPermissions: function(reviewPermissions) {
|
||||
if (reviewPermissions) {
|
||||
var arr = [],
|
||||
groups = this.getParsedGroups(username);
|
||||
groups && groups.forEach(function(group) {
|
||||
var item = reviewPermissions[group.trim()];
|
||||
item && (arr = arr.concat(item));
|
||||
});
|
||||
usergroups = arr;
|
||||
permissions = reviewPermissions;
|
||||
}
|
||||
},
|
||||
|
||||
getCurrentGroups: function() {
|
||||
return usergroups;
|
||||
}
|
||||
}
|
||||
})();
|
|
@ -101,6 +101,12 @@ define([
|
|||
'<div class="btn-slot" id="slot-btn-favorite"></div>' +
|
||||
'<div class="btn-slot" id="slot-btn-options"></div>' +
|
||||
'</div>' +
|
||||
'<div class="hedset">' +
|
||||
'<div class="btn-slot" id="slot-btn-user-name"></div>' +
|
||||
'<div class="btn-current-user hidden">' +
|
||||
'<i class="icon toolbar__icon icon--inverse btn-user"></i>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</section>' +
|
||||
'</section>';
|
||||
|
||||
|
@ -119,7 +125,7 @@ define([
|
|||
'<div class="lr-separator" id="id-box-doc-name">' +
|
||||
'<label id="title-doc-name" />' +
|
||||
'</div>' +
|
||||
'<label id="title-user-name" style="pointer-events: none;"></label>' +
|
||||
'<label id="title-user-name"></label>' +
|
||||
'</section>';
|
||||
|
||||
function onResetUsers(collection, opts) {
|
||||
|
@ -282,6 +288,20 @@ define([
|
|||
$panelUsers[(editingUsers > 1 || editingUsers > 0 && !appConfig.isEdit && !appConfig.isRestrictedEdit || !mode.isOffline && (mode.sharingSettingsUrl && mode.sharingSettingsUrl.length || mode.canRequestSharingSettings)) ? 'show' : 'hide']();
|
||||
}
|
||||
|
||||
|
||||
if (appConfig.user.guest && appConfig.canRenameAnonymous) {
|
||||
if (me.labelUserName) {
|
||||
me.labelUserName.addClass('clickable');
|
||||
me.labelUserName.on('click', function (e) {
|
||||
Common.NotificationCenter.trigger('user:rename');
|
||||
});
|
||||
} else if (me.btnUserName) {
|
||||
me.btnUserName.on('click', function (e) {
|
||||
Common.NotificationCenter.trigger('user:rename');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if ( me.btnPrint ) {
|
||||
me.btnPrint.updateHint(me.tipPrint + Common.Utils.String.platformKey('Ctrl+P'));
|
||||
me.btnPrint.on('click', function (e) {
|
||||
|
@ -498,6 +518,16 @@ define([
|
|||
}
|
||||
me.btnOptions.render($html.find('#slot-btn-options'));
|
||||
|
||||
if (!config.isEdit || config.customization && !!config.customization.compactHeader) {
|
||||
if (config.user.guest && config.canRenameAnonymous)
|
||||
me.btnUserName = createTitleButton('toolbar__icon icon--inverse btn-user', $html.findById('#slot-btn-user-name'));
|
||||
else {
|
||||
me.elUserName = $html.find('.btn-current-user');
|
||||
me.elUserName.removeClass('hidden');
|
||||
}
|
||||
me.setUserName(me.options.userName);
|
||||
}
|
||||
|
||||
$userList = $html.find('.cousers-list');
|
||||
$panelUsers = $html.find('.box-cousers');
|
||||
$btnUsers = $html.find('.btn-users');
|
||||
|
@ -658,6 +688,15 @@ define([
|
|||
} else this.labelUserName.hide();
|
||||
} else {
|
||||
this.options.userName = name;
|
||||
if ( this.btnUserName ) {
|
||||
this.btnUserName.updateHint(name);
|
||||
} else if (this.elUserName) {
|
||||
this.elUserName.tooltip({
|
||||
title: name,
|
||||
placement: 'cursor',
|
||||
html: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
|
|
134
apps/common/main/lib/view/UserNameDialog.js
Normal file
134
apps/common/main/lib/view/UserNameDialog.js
Normal file
|
@ -0,0 +1,134 @@
|
|||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2010-2020
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
|
||||
* street, Riga, Latvia, EU, LV-1050.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* UserNameDialog.js
|
||||
*
|
||||
* Created by Julia Radzhabova on 09.12.2020
|
||||
* Copyright (c) 2020 Ascensio System SIA. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
define([
|
||||
'common/main/lib/component/Window',
|
||||
'common/main/lib/component/InputField'
|
||||
], function () { 'use strict';
|
||||
|
||||
Common.Views.UserNameDialog = Common.UI.Window.extend(_.extend({
|
||||
options: {
|
||||
width: 330,
|
||||
header: false,
|
||||
modal : false,
|
||||
cls: 'modal-dlg',
|
||||
buttons: ['ok', 'cancel']
|
||||
},
|
||||
|
||||
initialize : function(options) {
|
||||
_.extend(this.options, options || {});
|
||||
|
||||
this.template = [
|
||||
'<div class="box">',
|
||||
'<div style="margin-bottom: 2px;">' + (this.options.label ? this.options.label : this.textLabel) + '</div>',
|
||||
'<div id="id-dlg-username-caption" class="input-row"></div>',
|
||||
'<div id="id-dlg-username-chk-use" class="" style="margin-top: 10px;"></div>',
|
||||
'</div>'
|
||||
].join('');
|
||||
|
||||
this.options.tpl = _.template(this.template)(this.options);
|
||||
|
||||
Common.UI.Window.prototype.initialize.call(this, this.options);
|
||||
},
|
||||
|
||||
render: function() {
|
||||
Common.UI.Window.prototype.render.call(this);
|
||||
|
||||
var me = this;
|
||||
me.inputLabel = new Common.UI.InputField({
|
||||
el : $('#id-dlg-username-caption'),
|
||||
allowBlank : true,
|
||||
style : 'width: 100%;',
|
||||
maxLength : 128,
|
||||
validateOnBlur: false,
|
||||
validation : me.options.validation || function(value) {
|
||||
return value ? true : '';
|
||||
}
|
||||
});
|
||||
me.inputLabel.setValue(this.options.value || '' );
|
||||
|
||||
me.chDontShow = new Common.UI.CheckBox({
|
||||
el: $('#id-dlg-username-chk-use'),
|
||||
labelText: this.textDontShow,
|
||||
value: this.options.check
|
||||
});
|
||||
|
||||
var $window = this.getChild();
|
||||
$window.find('.btn').on('click', _.bind(this.onBtnClick, this));
|
||||
},
|
||||
|
||||
show: function() {
|
||||
Common.UI.Window.prototype.show.apply(this, arguments);
|
||||
|
||||
var me = this;
|
||||
_.delay(function(){
|
||||
me.getChild('input').focus();
|
||||
},50);
|
||||
},
|
||||
|
||||
onPrimary: function(event) {
|
||||
this._handleInput('ok');
|
||||
return false;
|
||||
},
|
||||
|
||||
onBtnClick: function(event) {
|
||||
this._handleInput(event.currentTarget.attributes['result'].value);
|
||||
},
|
||||
|
||||
_handleInput: function(state) {
|
||||
if (this.options.handler) {
|
||||
if (state == 'ok') {
|
||||
if (this.inputLabel.checkValidate() !== true) {
|
||||
this.inputLabel.cmpEl.find('input').focus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.options.handler.call(this, state, {input: this.inputLabel.getValue(), checkbox: this.chDontShow.getValue()=='checked'});
|
||||
}
|
||||
|
||||
this.close();
|
||||
},
|
||||
|
||||
textLabel: 'Label:',
|
||||
textLabelError: 'Label must not be empty.',
|
||||
textDontShow: 'Don\'t ask me again'
|
||||
}, Common.Views.UserNameDialog || {}));
|
||||
});
|
BIN
apps/common/main/resources/img/toolbar/1.25x/btn-user.png
Normal file
BIN
apps/common/main/resources/img/toolbar/1.25x/btn-user.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 552 B |
BIN
apps/common/main/resources/img/toolbar/1.5x/btn-user.png
Normal file
BIN
apps/common/main/resources/img/toolbar/1.5x/btn-user.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 748 B |
BIN
apps/common/main/resources/img/toolbar/1.75x/btn-user.png
Normal file
BIN
apps/common/main/resources/img/toolbar/1.75x/btn-user.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 830 B |
BIN
apps/common/main/resources/img/toolbar/1x/btn-user.png
Normal file
BIN
apps/common/main/resources/img/toolbar/1x/btn-user.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 462 B |
BIN
apps/common/main/resources/img/toolbar/2x/btn-user.png
Normal file
BIN
apps/common/main/resources/img/toolbar/2x/btn-user.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1,009 B |
|
@ -206,6 +206,38 @@
|
|||
}
|
||||
}
|
||||
|
||||
.btn-current-user {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
width: 40px;
|
||||
padding: 0 10px;
|
||||
|
||||
.icon {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
display: inline-block;
|
||||
background-repeat: no-repeat;
|
||||
padding: 0;
|
||||
|
||||
&.icon--inverse {
|
||||
background-position-x: -20px;
|
||||
}
|
||||
}
|
||||
|
||||
svg.icon {
|
||||
vertical-align: middle;
|
||||
|
||||
@media
|
||||
only screen and (-webkit-min-device-pixel-ratio: 1.5),
|
||||
only screen and (min-resolution: 1.5dppx),
|
||||
only screen and (min-resolution: 144dpi) {
|
||||
width:calc(~"28px/1.5");
|
||||
height:calc(~"28px/1.5");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.cousers-menu {
|
||||
position: fixed;
|
||||
top: @height-tabs - 8px;
|
||||
|
@ -401,6 +433,11 @@
|
|||
height: 100%;
|
||||
padding: 0 12px;
|
||||
line-height: @height-title;
|
||||
pointer-events: none;
|
||||
&.clickable {
|
||||
cursor: pointer;
|
||||
pointer-events: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.lr-separator {
|
||||
|
|
|
@ -417,6 +417,16 @@
|
|||
}
|
||||
}
|
||||
|
||||
.btn-current-user {
|
||||
.icon--inverse {
|
||||
background-position-x: 0;
|
||||
}
|
||||
|
||||
svg.icon {
|
||||
fill: @gray-deep;
|
||||
}
|
||||
}
|
||||
|
||||
#rib-doc-name {
|
||||
color: @gray-deep;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
},
|
||||
|
|
|
@ -49,6 +49,7 @@ define([
|
|||
'common/main/lib/controller/Fonts',
|
||||
'common/main/lib/collection/TextArt',
|
||||
'common/main/lib/view/OpenDialog',
|
||||
'common/main/lib/view/UserNameDialog',
|
||||
'common/main/lib/util/LocalStorage',
|
||||
'documenteditor/main/app/collection/ShapeGroups',
|
||||
'documenteditor/main/app/collection/EquationGroups'
|
||||
|
@ -341,8 +342,19 @@ define([
|
|||
loadConfig: function(data) {
|
||||
this.editorConfig = $.extend(this.editorConfig, data.config);
|
||||
|
||||
this.appOptions.customization = this.editorConfig.customization;
|
||||
this.appOptions.canRenameAnonymous = !((typeof (this.appOptions.customization) == 'object') && (typeof (this.appOptions.customization.anonymous) == 'object') && (this.appOptions.customization.anonymous.request===false));
|
||||
this.appOptions.guestName = (typeof (this.appOptions.customization) == 'object') && (typeof (this.appOptions.customization.anonymous) == 'object') &&
|
||||
(typeof (this.appOptions.customization.anonymous.label) == 'string') && this.appOptions.customization.anonymous.label.trim()!=='' ?
|
||||
Common.Utils.String.htmlEncode(this.appOptions.customization.anonymous.label) : this.textGuest;
|
||||
var value;
|
||||
if (this.appOptions.canRenameAnonymous) {
|
||||
value = Common.localStorage.getItem("guest-username");
|
||||
Common.Utils.InternalSettings.set("guest-username", value);
|
||||
Common.Utils.InternalSettings.set("save-guest-username", !!value);
|
||||
}
|
||||
this.editorConfig.user =
|
||||
this.appOptions.user = Common.Utils.fillUserInfo(this.editorConfig.user, this.editorConfig.lang, this.textAnonymous);
|
||||
this.appOptions.user = Common.Utils.fillUserInfo(this.editorConfig.user, this.editorConfig.lang, value ? (value + ' (' + this.appOptions.guestName + ')' ) : this.textAnonymous);
|
||||
this.appOptions.isDesktopApp = this.editorConfig.targetApp == 'desktop';
|
||||
this.appOptions.canCreateNew = this.editorConfig.canRequestCreateNew || !_.isEmpty(this.editorConfig.createUrl);
|
||||
this.appOptions.canOpenRecent = this.editorConfig.recent !== undefined && !this.appOptions.isDesktopApp;
|
||||
|
@ -358,7 +370,6 @@ define([
|
|||
this.appOptions.saveAsUrl = this.editorConfig.saveAsUrl;
|
||||
this.appOptions.canAnalytics = false;
|
||||
this.appOptions.canRequestClose = this.editorConfig.canRequestClose;
|
||||
this.appOptions.customization = this.editorConfig.customization;
|
||||
this.appOptions.canBackToFolder = (this.editorConfig.canBackToFolder!==false) && (typeof (this.editorConfig.customization) == 'object') && (typeof (this.editorConfig.customization.goback) == 'object')
|
||||
&& (!_.isEmpty(this.editorConfig.customization.goback.url) || this.editorConfig.customization.goback.requestClose && this.appOptions.canRequestClose);
|
||||
this.appOptions.canBack = this.appOptions.canBackToFolder === true;
|
||||
|
@ -376,6 +387,8 @@ define([
|
|||
this.appOptions.canFeatureContentControl = !!this.api.asc_isSupportFeature("content-controls");
|
||||
this.appOptions.mentionShare = !((typeof (this.appOptions.customization) == 'object') && (this.appOptions.customization.mentionShare==false));
|
||||
|
||||
this.appOptions.user.guest && this.appOptions.canRenameAnonymous && Common.NotificationCenter.on('user:rename', _.bind(this.showRenameUserDialog, this));
|
||||
|
||||
appHeader = this.getApplication().getController('Viewport').getView('Common.Views.Header');
|
||||
appHeader.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '');
|
||||
|
||||
|
@ -391,7 +404,7 @@ define([
|
|||
$('#editor-container').append('<div class="doc-placeholder">' + '<div class="line"></div>'.repeat(20) + '</div>');
|
||||
}
|
||||
|
||||
var value = Common.localStorage.getItem("de-macros-mode");
|
||||
value = Common.localStorage.getItem("de-macros-mode");
|
||||
if (value === null) {
|
||||
value = this.editorConfig.customization ? this.editorConfig.customization.macrosMode : 'warn';
|
||||
value = (value == 'enable') ? 1 : (value == 'disable' ? 2 : 0);
|
||||
|
@ -1133,6 +1146,8 @@ define([
|
|||
|
||||
$('#editor-container').css('overflow', '');
|
||||
$('.doc-placeholder').remove();
|
||||
|
||||
this.appOptions.user.guest && this.appOptions.canRenameAnonymous && (Common.Utils.InternalSettings.get("guest-username")===null) && this.showRenameUserDialog();
|
||||
},
|
||||
|
||||
onLicenseChanged: function(params) {
|
||||
|
@ -1300,7 +1315,9 @@ define([
|
|||
|
||||
this.appOptions.canUseReviewPermissions = this.appOptions.canLicense && this.editorConfig.customization && this.editorConfig.customization.reviewPermissions && (typeof (this.editorConfig.customization.reviewPermissions) == 'object');
|
||||
Common.Utils.UserInfoParser.setParser(this.appOptions.canUseReviewPermissions);
|
||||
appHeader.setUserName(Common.Utils.UserInfoParser.getParsedName(this.appOptions.user.fullname));
|
||||
Common.Utils.UserInfoParser.setCurrentName(this.appOptions.user.fullname);
|
||||
this.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(this.editorConfig.customization.reviewPermissions);
|
||||
appHeader.setUserName(Common.Utils.UserInfoParser.getParsedName(Common.Utils.UserInfoParser.getCurrentName()));
|
||||
|
||||
this.appOptions.canRename && appHeader.setCanRename(true);
|
||||
this.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object' || this.editorConfig.plugins);
|
||||
|
@ -1344,6 +1361,7 @@ define([
|
|||
this.api.asc_registerCallback('asc_onDownloadUrl', _.bind(this.onDownloadUrl, this));
|
||||
this.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(this.onAuthParticipantsChanged, this));
|
||||
this.api.asc_registerCallback('asc_onParticipantsChanged', _.bind(this.onAuthParticipantsChanged, this));
|
||||
this.api.asc_registerCallback('asc_onConnectionStateChanged', _.bind(this.onUserConnection, this));
|
||||
this.api.asc_registerCallback('asc_onDocumentModifiedChanged', _.bind(this.onDocumentModifiedChanged, this));
|
||||
},
|
||||
|
||||
|
@ -2185,6 +2203,24 @@ define([
|
|||
this._state.usersCount = length;
|
||||
},
|
||||
|
||||
onUserConnection: function(change){
|
||||
if (change && this.appOptions.user.guest && this.appOptions.canRenameAnonymous && (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);
|
||||
appHeader.setUserName(Common.Utils.UserInfoParser.getParsedName(name));
|
||||
|
||||
var idx1 = name.lastIndexOf('('),
|
||||
idx2 = name.lastIndexOf(')'),
|
||||
str = (idx1>0) && (idx1<idx2) ? name.substring(0, idx1-1) : '';
|
||||
if (Common.localStorage.getItem("guest-username")!==null) {
|
||||
Common.localStorage.setItem("guest-username", str);
|
||||
}
|
||||
Common.Utils.InternalSettings.set("guest-username", str);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
applySettings: function() {
|
||||
if (this.appOptions.isEdit && !this.appOptions.isOffline && this.appOptions.canCoAuthoring) {
|
||||
var oldval = this._state.fastCoauth;
|
||||
|
@ -2383,6 +2419,40 @@ define([
|
|||
me.api.asc_SetAutoCorrectHyphensWithDash(value);
|
||||
},
|
||||
|
||||
showRenameUserDialog: function() {
|
||||
if (this._renameDialog) return;
|
||||
|
||||
var me = this;
|
||||
this._renameDialog = new Common.Views.UserNameDialog({
|
||||
label: this.textRenameLabel,
|
||||
error: this.textRenameError,
|
||||
value: Common.Utils.InternalSettings.get("guest-username") || '',
|
||||
check: Common.Utils.InternalSettings.get("save-guest-username") || false,
|
||||
validation: function(value) {
|
||||
return value.length<128 ? true : me.textLongName;
|
||||
},
|
||||
handler: function(result, settings) {
|
||||
if (result == 'ok') {
|
||||
var name = settings.input ? settings.input + ' (' + me.appOptions.guestName + ')' : me.textAnonymous;
|
||||
var _user = new Asc.asc_CUserInfo();
|
||||
_user.put_FullName(name);
|
||||
|
||||
var docInfo = new Asc.asc_CDocInfo();
|
||||
docInfo.put_UserInfo(_user);
|
||||
me.api.asc_changeDocInfo(docInfo);
|
||||
|
||||
settings.checkbox ? Common.localStorage.setItem("guest-username", settings.input) : Common.localStorage.removeItem("guest-username");
|
||||
Common.Utils.InternalSettings.set("guest-username", settings.input);
|
||||
Common.Utils.InternalSettings.set("save-guest-username", settings.checkbox);
|
||||
}
|
||||
}
|
||||
});
|
||||
this._renameDialog.on('close', function() {
|
||||
me._renameDialog = undefined;
|
||||
});
|
||||
this._renameDialog.show(Common.Utils.innerWidth() - this._renameDialog.options.width - 15, 30);
|
||||
},
|
||||
|
||||
leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' then \'Save\' to save them. Click \'Leave this Page\' to discard all the unsaved changes.',
|
||||
criticalErrorTitle: 'Error',
|
||||
notcriticalErrorTitle: 'Warning',
|
||||
|
@ -2741,7 +2811,11 @@ define([
|
|||
warnLicenseLimitedNoAccess: 'License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.',
|
||||
saveErrorTextDesktop: 'This file cannot be saved or created.<br>Possible reasons are: <br>1. The file is read-only. <br>2. The file is being edited by other users. <br>3. The disk is full or corrupted.',
|
||||
errorComboSeries: 'To create a combination chart, select at least two series of data.',
|
||||
errorSetPassword: 'Password could not be set.'
|
||||
errorSetPassword: 'Password could not be set.',
|
||||
textRenameLabel: 'Enter a name to be used for collaboration',
|
||||
textRenameError: 'User name must not be empty.',
|
||||
textLongName: 'Enter a name that is less than 128 characters.',
|
||||
textGuest: 'Guest'
|
||||
}
|
||||
})(), DE.Controllers.Main || {}))
|
||||
});
|
|
@ -439,6 +439,7 @@ define([
|
|||
}));
|
||||
} else {
|
||||
user.set({online: change.asc_getState()});
|
||||
user.set({username: change.asc_getUserName()});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -198,8 +198,19 @@ define([
|
|||
|
||||
me.editorConfig = $.extend(me.editorConfig, data.config);
|
||||
|
||||
me.appOptions.customization = me.editorConfig.customization;
|
||||
me.appOptions.canRenameAnonymous = !((typeof (me.appOptions.customization) == 'object') && (typeof (me.appOptions.customization.anonymous) == 'object') && (me.appOptions.customization.anonymous.request===false));
|
||||
me.appOptions.guestName = (typeof (me.appOptions.customization) == 'object') && (typeof (me.appOptions.customization.anonymous) == 'object') &&
|
||||
(typeof (me.appOptions.customization.anonymous.label) == 'string') && me.appOptions.customization.anonymous.label.trim()!=='' ?
|
||||
Common.Utils.String.htmlEncode(me.appOptions.customization.anonymous.label) : me.textGuest;
|
||||
var value;
|
||||
if (me.appOptions.canRenameAnonymous) {
|
||||
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.appOptions.guestName + ')' ) : 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;
|
||||
|
@ -213,7 +224,6 @@ define([
|
|||
me.appOptions.mergeFolderUrl = me.editorConfig.mergeFolderUrl;
|
||||
me.appOptions.canAnalytics = false;
|
||||
me.appOptions.canRequestClose = me.editorConfig.canRequestClose;
|
||||
me.appOptions.customization = me.editorConfig.customization;
|
||||
me.appOptions.canBackToFolder = (me.editorConfig.canBackToFolder!==false) && (typeof (me.editorConfig.customization) == 'object') && (typeof (me.editorConfig.customization.goback) == 'object')
|
||||
&& (!_.isEmpty(me.editorConfig.customization.goback.url) || me.editorConfig.customization.goback.requestClose && me.appOptions.canRequestClose);
|
||||
me.appOptions.canBack = me.appOptions.canBackToFolder === true;
|
||||
|
@ -226,7 +236,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 +828,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 +867,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 +1368,15 @@ define([
|
|||
this._state.usersCount = length;
|
||||
},
|
||||
|
||||
onUserConnection: function(change){
|
||||
if (change && this.appOptions.user.guest && this.appOptions.canRenameAnonymous && (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 +1617,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 || {}))
|
||||
});
|
|
@ -49,6 +49,7 @@ define([
|
|||
'common/main/lib/controller/Fonts',
|
||||
'common/main/lib/collection/TextArt',
|
||||
'common/main/lib/view/OpenDialog',
|
||||
'common/main/lib/view/UserNameDialog',
|
||||
'common/main/lib/util/LocalStorage',
|
||||
'presentationeditor/main/app/collection/ShapeGroups',
|
||||
'presentationeditor/main/app/collection/SlideLayouts',
|
||||
|
@ -305,8 +306,19 @@ define([
|
|||
loadConfig: function(data) {
|
||||
this.editorConfig = $.extend(this.editorConfig, data.config);
|
||||
|
||||
this.appOptions.customization = this.editorConfig.customization;
|
||||
this.appOptions.canRenameAnonymous = !((typeof (this.appOptions.customization) == 'object') && (typeof (this.appOptions.customization.anonymous) == 'object') && (this.appOptions.customization.anonymous.request===false));
|
||||
this.appOptions.guestName = (typeof (this.appOptions.customization) == 'object') && (typeof (this.appOptions.customization.anonymous) == 'object') &&
|
||||
(typeof (this.appOptions.customization.anonymous.label) == 'string') && this.appOptions.customization.anonymous.label.trim()!=='' ?
|
||||
Common.Utils.String.htmlEncode(this.appOptions.customization.anonymous.label) : this.textGuest;
|
||||
var value;
|
||||
if (this.appOptions.canRenameAnonymous) {
|
||||
value = Common.localStorage.getItem("guest-username");
|
||||
Common.Utils.InternalSettings.set("guest-username", value);
|
||||
Common.Utils.InternalSettings.set("save-guest-username", !!value);
|
||||
}
|
||||
this.editorConfig.user =
|
||||
this.appOptions.user = Common.Utils.fillUserInfo(data.config.user, this.editorConfig.lang, this.textAnonymous);
|
||||
this.appOptions.user = Common.Utils.fillUserInfo(data.config.user, this.editorConfig.lang, value ? (value + ' (' + this.appOptions.guestName + ')' ) : this.textAnonymous);
|
||||
this.appOptions.isDesktopApp = this.editorConfig.targetApp == 'desktop';
|
||||
this.appOptions.canCreateNew = this.editorConfig.canRequestCreateNew || !_.isEmpty(this.editorConfig.createUrl);
|
||||
this.appOptions.canOpenRecent = this.editorConfig.recent !== undefined && !this.appOptions.isDesktopApp;
|
||||
|
@ -321,7 +333,6 @@ define([
|
|||
this.appOptions.fileChoiceUrl = this.editorConfig.fileChoiceUrl;
|
||||
this.appOptions.canAnalytics = false;
|
||||
this.appOptions.canRequestClose = this.editorConfig.canRequestClose;
|
||||
this.appOptions.customization = this.editorConfig.customization;
|
||||
this.appOptions.canBackToFolder = (this.editorConfig.canBackToFolder!==false) && (typeof (this.editorConfig.customization) == 'object') && (typeof (this.editorConfig.customization.goback) == 'object')
|
||||
&& (!_.isEmpty(this.editorConfig.customization.goback.url) || this.editorConfig.customization.goback.requestClose && this.appOptions.canRequestClose);
|
||||
this.appOptions.canBack = this.appOptions.canBackToFolder === true;
|
||||
|
@ -334,6 +345,8 @@ define([
|
|||
this.appOptions.canRequestSharingSettings = this.editorConfig.canRequestSharingSettings;
|
||||
this.appOptions.mentionShare = !((typeof (this.appOptions.customization) == 'object') && (this.appOptions.customization.mentionShare==false));
|
||||
|
||||
this.appOptions.user.guest && this.appOptions.canRenameAnonymous && Common.NotificationCenter.on('user:rename', _.bind(this.showRenameUserDialog, this));
|
||||
|
||||
appHeader = this.getApplication().getController('Viewport').getView('Common.Views.Header');
|
||||
appHeader.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '');
|
||||
|
||||
|
@ -348,7 +361,7 @@ define([
|
|||
$('#editor-container').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-macros-mode");
|
||||
value = Common.localStorage.getItem("pe-macros-mode");
|
||||
if (value === null) {
|
||||
value = this.editorConfig.customization ? this.editorConfig.customization.macrosMode : 'warn';
|
||||
value = (value == 'enable') ? 1 : (value == 'disable' ? 2 : 0);
|
||||
|
@ -856,6 +869,7 @@ define([
|
|||
Common.Gateway.documentReady();
|
||||
|
||||
$('.doc-placeholder').remove();
|
||||
this.appOptions.user.guest && this.appOptions.canRenameAnonymous && (Common.Utils.InternalSettings.get("guest-username")===null) && this.showRenameUserDialog();
|
||||
},
|
||||
|
||||
onLicenseChanged: function(params) {
|
||||
|
@ -1001,7 +1015,9 @@ define([
|
|||
|
||||
this.appOptions.canUseReviewPermissions = this.appOptions.canLicense && this.editorConfig.customization && this.editorConfig.customization.reviewPermissions && (typeof (this.editorConfig.customization.reviewPermissions) == 'object');
|
||||
Common.Utils.UserInfoParser.setParser(this.appOptions.canUseReviewPermissions);
|
||||
appHeader.setUserName(Common.Utils.UserInfoParser.getParsedName(this.appOptions.user.fullname));
|
||||
Common.Utils.UserInfoParser.setCurrentName(this.appOptions.user.fullname);
|
||||
this.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(this.editorConfig.customization.reviewPermissions);
|
||||
appHeader.setUserName(Common.Utils.UserInfoParser.getParsedName(Common.Utils.UserInfoParser.getCurrentName()));
|
||||
|
||||
this.appOptions.canRename && appHeader.setCanRename(true);
|
||||
this.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object' || this.editorConfig.plugins);
|
||||
|
@ -1108,6 +1124,7 @@ define([
|
|||
me.api.asc_registerCallback('asc_OnTryUndoInFastCollaborative',_.bind(me.onTryUndoInFastCollaborative, 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));
|
||||
/** coauthoring end **/
|
||||
|
||||
if (me.stackLongActions.exist({id: ApplyEditRights, type: Asc.c_oAscAsyncActionType['BlockInteraction']})) {
|
||||
|
@ -1836,6 +1853,24 @@ define([
|
|||
this._state.usersCount = length;
|
||||
},
|
||||
|
||||
onUserConnection: function(change){
|
||||
if (change && this.appOptions.user.guest && this.appOptions.canRenameAnonymous && (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);
|
||||
appHeader.setUserName(Common.Utils.UserInfoParser.getParsedName(name));
|
||||
|
||||
var idx1 = name.lastIndexOf('('),
|
||||
idx2 = name.lastIndexOf(')'),
|
||||
str = (idx1>0) && (idx1<idx2) ? name.substring(0, idx1-1) : '';
|
||||
if (Common.localStorage.getItem("guest-username")!==null) {
|
||||
Common.localStorage.setItem("guest-username", str);
|
||||
}
|
||||
Common.Utils.InternalSettings.set("guest-username", str);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
applySettings: function() {
|
||||
if (this.appOptions.isEdit && !this.appOptions.isOffline && this.appOptions.canCoAuthoring) {
|
||||
var oldval = this._state.fastCoauth;
|
||||
|
@ -2024,7 +2059,41 @@ define([
|
|||
me.api.asc_SetAutoCorrectHyphensWithDash(value);
|
||||
|
||||
},
|
||||
|
||||
|
||||
showRenameUserDialog: function() {
|
||||
if (this._renameDialog) return;
|
||||
|
||||
var me = this;
|
||||
this._renameDialog = new Common.Views.UserNameDialog({
|
||||
label: this.textRenameLabel,
|
||||
error: this.textRenameError,
|
||||
value: Common.Utils.InternalSettings.get("guest-username") || '',
|
||||
check: Common.Utils.InternalSettings.get("save-guest-username") || false,
|
||||
validation: function(value) {
|
||||
return value.length<128 ? true : me.textLongName;
|
||||
},
|
||||
handler: function(result, settings) {
|
||||
if (result == 'ok') {
|
||||
var name = settings.input ? settings.input + ' (' + me.textGuest + ')' : me.textAnonymous;
|
||||
var _user = new Asc.asc_CUserInfo();
|
||||
_user.put_FullName(name);
|
||||
|
||||
var docInfo = new Asc.asc_CDocInfo();
|
||||
docInfo.put_UserInfo(_user);
|
||||
me.api.asc_changeDocInfo(docInfo);
|
||||
|
||||
settings.checkbox ? Common.localStorage.setItem("guest-username", settings.input) : Common.localStorage.removeItem("guest-username");
|
||||
Common.Utils.InternalSettings.set("guest-username", settings.input);
|
||||
Common.Utils.InternalSettings.set("save-guest-username", settings.checkbox);
|
||||
}
|
||||
}
|
||||
});
|
||||
this._renameDialog.on('close', function() {
|
||||
me._renameDialog = undefined;
|
||||
});
|
||||
this._renameDialog.show(Common.Utils.innerWidth() - this._renameDialog.options.width - 15, 30);
|
||||
},
|
||||
|
||||
// Translation
|
||||
leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' then \'Save\' to save them. Click \'Leave this Page\' to discard all the unsaved changes.',
|
||||
criticalErrorTitle: 'Error',
|
||||
|
@ -2383,7 +2452,11 @@ define([
|
|||
warnLicenseLimitedNoAccess: 'License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.',
|
||||
saveErrorTextDesktop: 'This file cannot be saved or created.<br>Possible reasons are: <br>1. The file is read-only. <br>2. The file is being edited by other users. <br>3. The disk is full or corrupted.',
|
||||
errorComboSeries: 'To create a combination chart, select at least two series of data.',
|
||||
errorSetPassword: 'Password could not be set.'
|
||||
errorSetPassword: 'Password could not be set.',
|
||||
textRenameLabel: 'Enter a name to be used for collaboration',
|
||||
textRenameError: 'User name must not be empty.',
|
||||
textLongName: 'Enter a name that is less than 128 characters.',
|
||||
textGuest: 'Guest'
|
||||
}
|
||||
})(), PE.Controllers.Main || {}))
|
||||
});
|
||||
|
|
|
@ -201,8 +201,19 @@ define([
|
|||
|
||||
me.editorConfig = $.extend(me.editorConfig, data.config);
|
||||
|
||||
me.appOptions.customization = me.editorConfig.customization;
|
||||
me.appOptions.canRenameAnonymous = !((typeof (me.appOptions.customization) == 'object') && (typeof (me.appOptions.customization.anonymous) == 'object') && (me.appOptions.customization.anonymous.request===false));
|
||||
me.appOptions.guestName = (typeof (me.appOptions.customization) == 'object') && (typeof (me.appOptions.customization.anonymous) == 'object') &&
|
||||
(typeof (me.appOptions.customization.anonymous.label) == 'string') && me.appOptions.customization.anonymous.label.trim()!=='' ?
|
||||
Common.Utils.String.htmlEncode(me.appOptions.customization.anonymous.label) : me.textGuest;
|
||||
var value;
|
||||
if (me.appOptions.canRenameAnonymous) {
|
||||
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.appOptions.guestName + ')' ) : 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;
|
||||
|
@ -216,7 +227,6 @@ define([
|
|||
me.appOptions.mergeFolderUrl = me.editorConfig.mergeFolderUrl;
|
||||
me.appOptions.canAnalytics = false;
|
||||
me.appOptions.canRequestClose = me.editorConfig.canRequestClose;
|
||||
me.appOptions.customization = me.editorConfig.customization;
|
||||
me.appOptions.canBackToFolder = (me.editorConfig.canBackToFolder!==false) && (typeof (me.editorConfig.customization) == 'object') && (typeof (me.editorConfig.customization.goback) == 'object')
|
||||
&& (!_.isEmpty(me.editorConfig.customization.goback.url) || me.editorConfig.customization.goback.requestClose && me.appOptions.canRequestClose);
|
||||
me.appOptions.canBack = me.appOptions.canBackToFolder === true;
|
||||
|
@ -229,7 +239,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 +754,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 +793,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 +1261,15 @@ define([
|
|||
this._state.usersCount = length;
|
||||
},
|
||||
|
||||
onUserConnection: function(change){
|
||||
if (change && this.appOptions.user.guest && this.appOptions.canRenameAnonymous && (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 +1558,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 || {}))
|
||||
});
|
|
@ -49,6 +49,7 @@ define([
|
|||
'common/main/lib/controller/Fonts',
|
||||
'common/main/lib/collection/TextArt',
|
||||
'common/main/lib/view/OpenDialog',
|
||||
'common/main/lib/view/UserNameDialog',
|
||||
'common/main/lib/util/LanguageInfo',
|
||||
'common/main/lib/util/LocalStorage',
|
||||
'spreadsheeteditor/main/app/collection/ShapeGroups',
|
||||
|
@ -327,8 +328,19 @@ define([
|
|||
|
||||
this.appOptions = {};
|
||||
|
||||
this.appOptions.customization = this.editorConfig.customization;
|
||||
this.appOptions.canRenameAnonymous = !((typeof (this.appOptions.customization) == 'object') && (typeof (this.appOptions.customization.anonymous) == 'object') && (this.appOptions.customization.anonymous.request===false));
|
||||
this.appOptions.guestName = (typeof (this.appOptions.customization) == 'object') && (typeof (this.appOptions.customization.anonymous) == 'object') &&
|
||||
(typeof (this.appOptions.customization.anonymous.label) == 'string') && this.appOptions.customization.anonymous.label.trim()!=='' ?
|
||||
Common.Utils.String.htmlEncode(this.appOptions.customization.anonymous.label) : this.textGuest;
|
||||
var value;
|
||||
if (this.appOptions.canRenameAnonymous) {
|
||||
value = Common.localStorage.getItem("guest-username");
|
||||
Common.Utils.InternalSettings.set("guest-username", value);
|
||||
Common.Utils.InternalSettings.set("save-guest-username", !!value);
|
||||
}
|
||||
this.editorConfig.user =
|
||||
this.appOptions.user = Common.Utils.fillUserInfo(this.editorConfig.user, this.editorConfig.lang, this.textAnonymous);
|
||||
this.appOptions.user = Common.Utils.fillUserInfo(this.editorConfig.user, this.editorConfig.lang, value ? (value + ' (' + this.appOptions.guestName + ')' ) : this.textAnonymous);
|
||||
this.appOptions.isDesktopApp = this.editorConfig.targetApp == 'desktop';
|
||||
this.appOptions.canCreateNew = this.editorConfig.canRequestCreateNew || !_.isEmpty(this.editorConfig.createUrl);
|
||||
this.appOptions.canOpenRecent = this.editorConfig.recent !== undefined && !this.appOptions.isDesktopApp;
|
||||
|
@ -347,7 +359,6 @@ define([
|
|||
this.appOptions.isEditDiagram = this.editorConfig.mode == 'editdiagram';
|
||||
this.appOptions.isEditMailMerge = this.editorConfig.mode == 'editmerge';
|
||||
this.appOptions.canRequestClose = this.editorConfig.canRequestClose;
|
||||
this.appOptions.customization = this.editorConfig.customization;
|
||||
this.appOptions.canBackToFolder = (this.editorConfig.canBackToFolder!==false) && (typeof (this.editorConfig.customization) == 'object') && (typeof (this.editorConfig.customization.goback) == 'object')
|
||||
&& (!_.isEmpty(this.editorConfig.customization.goback.url) || this.editorConfig.customization.goback.requestClose && this.appOptions.canRequestClose);
|
||||
this.appOptions.canBack = this.appOptions.canBackToFolder === true;
|
||||
|
@ -363,6 +374,8 @@ define([
|
|||
this.appOptions.canFeaturePivot = true;
|
||||
this.appOptions.canFeatureViews = !!this.api.asc_isSupportFeature("sheet-views");
|
||||
|
||||
this.appOptions.user.guest && this.appOptions.canRenameAnonymous && Common.NotificationCenter.on('user:rename', _.bind(this.showRenameUserDialog, this));
|
||||
|
||||
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 : '');
|
||||
|
||||
|
@ -388,7 +401,7 @@ define([
|
|||
}
|
||||
Common.Utils.InternalSettings.set("sse-config-lang", this.editorConfig.lang);
|
||||
|
||||
var value = Common.localStorage.getBool("sse-settings-r1c1");
|
||||
value = Common.localStorage.getBool("sse-settings-r1c1");
|
||||
Common.Utils.InternalSettings.set("sse-settings-r1c1", value);
|
||||
this.api.asc_setR1C1Mode(value);
|
||||
|
||||
|
@ -920,6 +933,7 @@ define([
|
|||
} else checkWarns();
|
||||
|
||||
Common.Gateway.documentReady();
|
||||
this.appOptions.user.guest && this.appOptions.canRenameAnonymous && (Common.Utils.InternalSettings.get("guest-username")===null) && this.showRenameUserDialog();
|
||||
},
|
||||
|
||||
onLicenseChanged: function(params) {
|
||||
|
@ -1056,7 +1070,9 @@ define([
|
|||
this.appOptions.canRename && this.headerView.setCanRename(true);
|
||||
this.appOptions.canUseReviewPermissions = this.appOptions.canLicense && this.editorConfig.customization && this.editorConfig.customization.reviewPermissions && (typeof (this.editorConfig.customization.reviewPermissions) == 'object');
|
||||
Common.Utils.UserInfoParser.setParser(this.appOptions.canUseReviewPermissions);
|
||||
this.headerView.setUserName(Common.Utils.UserInfoParser.getParsedName(this.appOptions.user.fullname));
|
||||
Common.Utils.UserInfoParser.setCurrentName(this.appOptions.user.fullname);
|
||||
this.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(this.editorConfig.customization.reviewPermissions);
|
||||
this.headerView.setUserName(Common.Utils.UserInfoParser.getParsedName(Common.Utils.UserInfoParser.getCurrentName()));
|
||||
} else
|
||||
this.appOptions.canModifyFilter = true;
|
||||
|
||||
|
@ -1206,6 +1222,7 @@ define([
|
|||
/** coauthoring begin **/
|
||||
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));
|
||||
/** coauthoring end **/
|
||||
if (me.appOptions.isEditDiagram)
|
||||
me.api.asc_registerCallback('asc_onSelectionChanged', _.bind(me.onSelectionChanged, me));
|
||||
|
@ -2193,6 +2210,24 @@ define([
|
|||
this._state.usersCount = length;
|
||||
},
|
||||
|
||||
onUserConnection: function(change){
|
||||
if (change && this.appOptions.user.guest && this.appOptions.canRenameAnonymous && (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);
|
||||
this.headerView.setUserName(Common.Utils.UserInfoParser.getParsedName(name));
|
||||
|
||||
var idx1 = name.lastIndexOf('('),
|
||||
idx2 = name.lastIndexOf(')'),
|
||||
str = (idx1>0) && (idx1<idx2) ? name.substring(0, idx1-1) : '';
|
||||
if (Common.localStorage.getItem("guest-username")!==null) {
|
||||
Common.localStorage.setItem("guest-username", str);
|
||||
}
|
||||
Common.Utils.InternalSettings.set("guest-username", str);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
applySettings: function() {
|
||||
if (this.appOptions.isEdit && !this.appOptions.isOffline && this.appOptions.canCoAuthoring) {
|
||||
var value = Common.localStorage.getItem("sse-settings-coauthmode"),
|
||||
|
@ -2338,6 +2373,40 @@ define([
|
|||
me.api.asc_setIncludeNewRowColTable(value);
|
||||
},
|
||||
|
||||
showRenameUserDialog: function() {
|
||||
if (this._renameDialog) return;
|
||||
|
||||
var me = this;
|
||||
this._renameDialog = new Common.Views.UserNameDialog({
|
||||
label: this.textRenameLabel,
|
||||
error: this.textRenameError,
|
||||
value: Common.Utils.InternalSettings.get("guest-username") || '',
|
||||
check: Common.Utils.InternalSettings.get("save-guest-username") || false,
|
||||
validation: function(value) {
|
||||
return value.length<128 ? true : me.textLongName;
|
||||
},
|
||||
handler: function(result, settings) {
|
||||
if (result == 'ok') {
|
||||
var name = settings.input ? settings.input + ' (' + me.textGuest + ')' : me.textAnonymous;
|
||||
var _user = new Asc.asc_CUserInfo();
|
||||
_user.put_FullName(name);
|
||||
|
||||
var docInfo = new Asc.asc_CDocInfo();
|
||||
docInfo.put_UserInfo(_user);
|
||||
me.api.asc_changeDocInfo(docInfo);
|
||||
|
||||
settings.checkbox ? Common.localStorage.setItem("guest-username", settings.input) : Common.localStorage.removeItem("guest-username");
|
||||
Common.Utils.InternalSettings.set("guest-username", settings.input);
|
||||
Common.Utils.InternalSettings.set("save-guest-username", settings.checkbox);
|
||||
}
|
||||
}
|
||||
});
|
||||
this._renameDialog.on('close', function() {
|
||||
me._renameDialog = undefined;
|
||||
});
|
||||
this._renameDialog.show(Common.Utils.innerWidth() - this._renameDialog.options.width - 15, 30);
|
||||
},
|
||||
|
||||
leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' then \'Save\' to save them. Click \'Leave this Page\' to discard all the unsaved changes.',
|
||||
criticalErrorTitle: 'Error',
|
||||
notcriticalErrorTitle: 'Warning',
|
||||
|
@ -2718,7 +2787,11 @@ define([
|
|||
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.',
|
||||
saveErrorTextDesktop: 'This file cannot be saved or created.<br>Possible reasons are: <br>1. The file is read-only. <br>2. The file is being edited by other users. <br>3. The disk is full or corrupted.',
|
||||
errorSetPassword: 'Password could not be set.'
|
||||
errorSetPassword: 'Password could not be set.',
|
||||
textRenameLabel: 'Enter a name to be used for collaboration',
|
||||
textRenameError: 'User name must not be empty.',
|
||||
textLongName: 'Enter a name that is less than 128 characters.',
|
||||
textGuest: 'Guest'
|
||||
}
|
||||
})(), SSE.Controllers.Main || {}))
|
||||
});
|
||||
|
|
|
@ -204,8 +204,19 @@ define([
|
|||
|
||||
me.editorConfig = $.extend(me.editorConfig, data.config);
|
||||
|
||||
me.appOptions.customization = me.editorConfig.customization;
|
||||
me.appOptions.canRenameAnonymous = !((typeof (me.appOptions.customization) == 'object') && (typeof (me.appOptions.customization.anonymous) == 'object') && (me.appOptions.customization.anonymous.request===false));
|
||||
me.appOptions.guestName = (typeof (me.appOptions.customization) == 'object') && (typeof (me.appOptions.customization.anonymous) == 'object') &&
|
||||
(typeof (me.appOptions.customization.anonymous.label) == 'string') && me.appOptions.customization.anonymous.label.trim()!=='' ?
|
||||
Common.Utils.String.htmlEncode(me.appOptions.customization.anonymous.label) : me.textGuest;
|
||||
var value;
|
||||
if (me.appOptions.canRenameAnonymous) {
|
||||
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.appOptions.guestName + ')' ) : 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;
|
||||
|
@ -220,14 +231,13 @@ define([
|
|||
me.appOptions.mergeFolderUrl = me.editorConfig.mergeFolderUrl;
|
||||
me.appOptions.canAnalytics = false;
|
||||
me.appOptions.canRequestClose = me.editorConfig.canRequestClose;
|
||||
me.appOptions.customization = me.editorConfig.customization;
|
||||
me.appOptions.canBackToFolder = (me.editorConfig.canBackToFolder!==false) && (typeof (me.editorConfig.customization) == 'object') && (typeof (me.editorConfig.customization.goback) == 'object')
|
||||
&& (!_.isEmpty(me.editorConfig.customization.goback.url) || me.editorConfig.customization.goback.requestClose && me.appOptions.canRequestClose);
|
||||
me.appOptions.canBack = me.appOptions.canBackToFolder === true;
|
||||
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 +766,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 +815,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 +1468,15 @@ define([
|
|||
this._state.usersCount = length;
|
||||
},
|
||||
|
||||
onUserConnection: function(change){
|
||||
if (change && this.appOptions.user.guest && this.appOptions.canRenameAnonymous && (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 +1776,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