[Embedded] Load id and name for anonymous user
This commit is contained in:
parent
d99ad6b1fc
commit
f52a6b459b
137
apps/common/embed/lib/util/LocalStorage.js
Normal file
137
apps/common/embed/lib/util/LocalStorage.js
Normal file
|
@ -0,0 +1,137 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* (c) Copyright Ascensio System SIA 2010-2021
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
!window.common && (window.common = {});
|
||||||
|
|
||||||
|
common.localStorage = new (function() {
|
||||||
|
var _storeName, _filter;
|
||||||
|
var _store = {};
|
||||||
|
|
||||||
|
var ongetstore = function(data) {
|
||||||
|
if (data.type == 'localstorage') {
|
||||||
|
_store = data.keys;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Common.Gateway.on('internalcommand', ongetstore);
|
||||||
|
|
||||||
|
var _refresh = function() {
|
||||||
|
if (!_lsAllowed)
|
||||||
|
Common.Gateway.internalMessage('localstorage', {cmd:'get', keys:_filter});
|
||||||
|
};
|
||||||
|
|
||||||
|
var _save = function() {
|
||||||
|
if (!_lsAllowed)
|
||||||
|
Common.Gateway.internalMessage('localstorage', {cmd:'set', keys:_store});
|
||||||
|
};
|
||||||
|
|
||||||
|
var _setItem = function(name, value, just) {
|
||||||
|
if (_lsAllowed) {
|
||||||
|
try
|
||||||
|
{
|
||||||
|
localStorage.setItem(name, value);
|
||||||
|
}
|
||||||
|
catch (error){}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
_store[name] = value;
|
||||||
|
|
||||||
|
if (just===true) {
|
||||||
|
Common.Gateway.internalMessage('localstorage', {
|
||||||
|
cmd:'set',
|
||||||
|
keys: {
|
||||||
|
name: value
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var _setItemAsBool = function(name, value, just) {
|
||||||
|
_setItem(name, value ? 1 : 0, just);
|
||||||
|
};
|
||||||
|
|
||||||
|
var _getItem = function(name) {
|
||||||
|
if (_lsAllowed)
|
||||||
|
return localStorage.getItem(name);
|
||||||
|
else
|
||||||
|
return _store[name]===undefined ? null : _store[name];
|
||||||
|
};
|
||||||
|
|
||||||
|
var _getItemAsBool = function (name, defValue) {
|
||||||
|
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;
|
||||||
|
} catch (e) {
|
||||||
|
_lsAllowed = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
getId: function() {
|
||||||
|
return _storeName;
|
||||||
|
},
|
||||||
|
setId: function(name) {
|
||||||
|
_storeName = name;
|
||||||
|
},
|
||||||
|
getItem: _getItem,
|
||||||
|
getBool: _getItemAsBool,
|
||||||
|
setBool: _setItemAsBool,
|
||||||
|
setItem: _setItem,
|
||||||
|
removeItem: _removeItem,
|
||||||
|
setKeysFilter: function(value) {
|
||||||
|
_filter = value;
|
||||||
|
},
|
||||||
|
getKeysFilter: function() {
|
||||||
|
return _filter;
|
||||||
|
},
|
||||||
|
itemExists: _getItemExists,
|
||||||
|
sync: _refresh,
|
||||||
|
save: _save
|
||||||
|
};
|
||||||
|
})();
|
|
@ -74,6 +74,16 @@
|
||||||
},
|
},
|
||||||
htmlEncode: function(value) {
|
htmlEncode: function(value) {
|
||||||
return $('<div/>').text(value).html();
|
return $('<div/>').text(value).html();
|
||||||
|
},
|
||||||
|
|
||||||
|
fillUserInfo: function(info, lang, defname, defid) {
|
||||||
|
var _user = info || {};
|
||||||
|
_user.anonymous = !_user.id;
|
||||||
|
!_user.id && (_user.id = defid);
|
||||||
|
_user.fullname = !_user.name ? defname : _user.name;
|
||||||
|
_user.group && (_user.fullname = (_user.group).toString() + AscCommon.UserInfoParser.getSeparator() + _user.fullname);
|
||||||
|
_user.guest = !_user.name;
|
||||||
|
return _user;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -255,6 +255,7 @@
|
||||||
<script type="text/javascript" src="../../common/locale.js"></script>
|
<script type="text/javascript" src="../../common/locale.js"></script>
|
||||||
<script type="text/javascript" src="../../common/Gateway.js"></script>
|
<script type="text/javascript" src="../../common/Gateway.js"></script>
|
||||||
<script type="text/javascript" src="../../common/Analytics.js"></script>
|
<script type="text/javascript" src="../../common/Analytics.js"></script>
|
||||||
|
<script type="text/javascript" src="../../common/embed/lib/util/LocalStorage.js"></script>
|
||||||
<script type="text/javascript" src="../../common/embed/lib/util/utils.js"></script>
|
<script type="text/javascript" src="../../common/embed/lib/util/utils.js"></script>
|
||||||
<script type="text/javascript" src="../../common/embed/lib/view/modals.js"></script>
|
<script type="text/javascript" src="../../common/embed/lib/view/modals.js"></script>
|
||||||
<script type="text/javascript" src="../../common/embed/lib/controller/modals.js"></script>
|
<script type="text/javascript" src="../../common/embed/lib/controller/modals.js"></script>
|
||||||
|
|
|
@ -349,6 +349,7 @@
|
||||||
<script type="text/javascript" src="../../common/locale.js"></script>
|
<script type="text/javascript" src="../../common/locale.js"></script>
|
||||||
<script type="text/javascript" src="../../common/Gateway.js"></script>
|
<script type="text/javascript" src="../../common/Gateway.js"></script>
|
||||||
<script type="text/javascript" src="../../common/Analytics.js"></script>
|
<script type="text/javascript" src="../../common/Analytics.js"></script>
|
||||||
|
<script type="text/javascript" src="../../common/embed/lib/util/LocalStorage.js"></script>
|
||||||
<script type="text/javascript" src="../../common/embed/lib/util/utils.js"></script>
|
<script type="text/javascript" src="../../common/embed/lib/util/utils.js"></script>
|
||||||
<script type="text/javascript" src="../../common/embed/lib/view/modals.js"></script>
|
<script type="text/javascript" src="../../common/embed/lib/view/modals.js"></script>
|
||||||
<script type="text/javascript" src="../../common/embed/lib/controller/modals.js"></script>
|
<script type="text/javascript" src="../../common/embed/lib/controller/modals.js"></script>
|
||||||
|
|
|
@ -59,6 +59,10 @@ DE.ApplicationController = new(function(){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
common.localStorage.setId('text');
|
||||||
|
common.localStorage.setKeysFilter('de-,asc.text');
|
||||||
|
common.localStorage.sync();
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
// -------------------------
|
// -------------------------
|
||||||
|
|
||||||
|
@ -92,7 +96,19 @@ DE.ApplicationController = new(function(){
|
||||||
var _permissions = $.extend({}, docConfig.permissions),
|
var _permissions = $.extend({}, docConfig.permissions),
|
||||||
docInfo = new Asc.asc_CDocInfo(),
|
docInfo = new Asc.asc_CDocInfo(),
|
||||||
_user = new Asc.asc_CUserInfo();
|
_user = new Asc.asc_CUserInfo();
|
||||||
_user.put_Id(config.user && config.user.id ? config.user.id : ('uid-' + Date.now()));
|
|
||||||
|
var canRenameAnonymous = !((typeof (config.customization) == 'object') && (typeof (config.customization.anonymous) == 'object') && (config.customization.anonymous.request===false)),
|
||||||
|
guestName = (typeof (config.customization) == 'object') && (typeof (config.customization.anonymous) == 'object') &&
|
||||||
|
(typeof (config.customization.anonymous.label) == 'string') && config.customization.anonymous.label.trim()!=='' ?
|
||||||
|
common.utils.htmlEncode(config.customization.anonymous.label) : me.textGuest,
|
||||||
|
value = canRenameAnonymous ? common.localStorage.getItem("guest-username") : null,
|
||||||
|
user = common.utils.fillUserInfo(config.user, config.lang, value ? (value + ' (' + guestName + ')' ) : me.textAnonymous,
|
||||||
|
common.localStorage.getItem("guest-id") || ('uid-' + Date.now()));
|
||||||
|
user.anonymous && common.localStorage.setItem("guest-id", user.id);
|
||||||
|
|
||||||
|
_user.put_Id(user.id);
|
||||||
|
_user.put_FullName(user.fullname);
|
||||||
|
// _user.put_isAnonymous(user.anonymous);
|
||||||
|
|
||||||
docInfo.put_Id(docConfig.key);
|
docInfo.put_Id(docConfig.key);
|
||||||
docInfo.put_Url(docConfig.url);
|
docInfo.put_Url(docConfig.url);
|
||||||
|
@ -634,7 +650,10 @@ DE.ApplicationController = new(function(){
|
||||||
if (api) api.asc_runAutostartMacroses();
|
if (api) api.asc_runAutostartMacroses();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helpers
|
function onBeforeUnload () {
|
||||||
|
common.localStorage.save();
|
||||||
|
}
|
||||||
|
// Helpers
|
||||||
// -------------------------
|
// -------------------------
|
||||||
|
|
||||||
function onDocumentResize() {
|
function onDocumentResize() {
|
||||||
|
@ -651,6 +670,7 @@ DE.ApplicationController = new(function(){
|
||||||
$(window).resize(function(){
|
$(window).resize(function(){
|
||||||
onDocumentResize();
|
onDocumentResize();
|
||||||
});
|
});
|
||||||
|
window.onbeforeunload = onBeforeUnload;
|
||||||
|
|
||||||
var ismodalshown = false;
|
var ismodalshown = false;
|
||||||
$(document.body).on('show.bs.modal', '.modal',
|
$(document.body).on('show.bs.modal', '.modal',
|
||||||
|
@ -735,6 +755,8 @@ DE.ApplicationController = new(function(){
|
||||||
textSubmit: 'Submit',
|
textSubmit: 'Submit',
|
||||||
textSubmited: '<b>Form submitted successfully</b><br>Click to close the tip.',
|
textSubmited: '<b>Form submitted successfully</b><br>Click to close the tip.',
|
||||||
errorSubmit: 'Submit failed.',
|
errorSubmit: 'Submit failed.',
|
||||||
errorEditingDownloadas: 'An error occurred during the work with the document.<br>Use the \'Download as...\' option to save the file backup copy to your computer hard drive.'
|
errorEditingDownloadas: 'An error occurred during the work with the document.<br>Use the \'Download as...\' option to save the file backup copy to your computer hard drive.',
|
||||||
|
textGuest: 'Guest',
|
||||||
|
textAnonymous: 'Anonymous'
|
||||||
}
|
}
|
||||||
})();
|
})();
|
|
@ -29,6 +29,8 @@
|
||||||
"DE.ApplicationController.unknownErrorText": "Unknown error.",
|
"DE.ApplicationController.unknownErrorText": "Unknown error.",
|
||||||
"DE.ApplicationController.unsupportedBrowserErrorText": "Your browser is not supported.",
|
"DE.ApplicationController.unsupportedBrowserErrorText": "Your browser is not supported.",
|
||||||
"DE.ApplicationController.waitText": "Please, wait...",
|
"DE.ApplicationController.waitText": "Please, wait...",
|
||||||
|
"DE.ApplicationController.textGuest": "Guest",
|
||||||
|
"DE.ApplicationController.textAnonymous": "Anonymous",
|
||||||
"DE.ApplicationView.txtDownload": "Download",
|
"DE.ApplicationView.txtDownload": "Download",
|
||||||
"DE.ApplicationView.txtDownloadDocx": "Download as docx",
|
"DE.ApplicationView.txtDownloadDocx": "Download as docx",
|
||||||
"DE.ApplicationView.txtDownloadPdf": "Download as pdf",
|
"DE.ApplicationView.txtDownloadPdf": "Download as pdf",
|
||||||
|
|
|
@ -305,6 +305,7 @@
|
||||||
<script type="text/javascript" src="../../common/locale.js"></script>
|
<script type="text/javascript" src="../../common/locale.js"></script>
|
||||||
<script type="text/javascript" src="../../common/Gateway.js"></script>
|
<script type="text/javascript" src="../../common/Gateway.js"></script>
|
||||||
<script type="text/javascript" src="../../common/Analytics.js"></script>
|
<script type="text/javascript" src="../../common/Analytics.js"></script>
|
||||||
|
<script type="text/javascript" src="../../common/embed/lib/util/LocalStorage.js"></script>
|
||||||
<script type="text/javascript" src="../../common/embed/lib/util/utils.js"></script>
|
<script type="text/javascript" src="../../common/embed/lib/util/utils.js"></script>
|
||||||
<script type="text/javascript" src="../../common/embed/lib/view/modals.js"></script>
|
<script type="text/javascript" src="../../common/embed/lib/view/modals.js"></script>
|
||||||
<script type="text/javascript" src="../../common/embed/lib/controller/modals.js"></script>
|
<script type="text/javascript" src="../../common/embed/lib/controller/modals.js"></script>
|
||||||
|
|
|
@ -347,6 +347,7 @@
|
||||||
<script type="text/javascript" src="../../common/locale.js"></script>
|
<script type="text/javascript" src="../../common/locale.js"></script>
|
||||||
<script type="text/javascript" src="../../common/Gateway.js"></script>
|
<script type="text/javascript" src="../../common/Gateway.js"></script>
|
||||||
<script type="text/javascript" src="../../common/Analytics.js"></script>
|
<script type="text/javascript" src="../../common/Analytics.js"></script>
|
||||||
|
<script type="text/javascript" src="../../common/embed/lib/util/LocalStorage.js"></script>
|
||||||
<script type="text/javascript" src="../../common/embed/lib/util/utils.js"></script>
|
<script type="text/javascript" src="../../common/embed/lib/util/utils.js"></script>
|
||||||
<script type="text/javascript" src="../../common/embed/lib/view/modals.js"></script>
|
<script type="text/javascript" src="../../common/embed/lib/view/modals.js"></script>
|
||||||
<script type="text/javascript" src="../../common/embed/lib/controller/modals.js"></script>
|
<script type="text/javascript" src="../../common/embed/lib/controller/modals.js"></script>
|
||||||
|
|
|
@ -57,6 +57,10 @@ PE.ApplicationController = new(function(){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
common.localStorage.setId('text');
|
||||||
|
common.localStorage.setKeysFilter('pe-,asc.presentation');
|
||||||
|
common.localStorage.sync();
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
// -------------------------
|
// -------------------------
|
||||||
|
|
||||||
|
@ -90,7 +94,19 @@ PE.ApplicationController = new(function(){
|
||||||
var _permissions = $.extend({}, docConfig.permissions),
|
var _permissions = $.extend({}, docConfig.permissions),
|
||||||
docInfo = new Asc.asc_CDocInfo(),
|
docInfo = new Asc.asc_CDocInfo(),
|
||||||
_user = new Asc.asc_CUserInfo();
|
_user = new Asc.asc_CUserInfo();
|
||||||
_user.put_Id(config.user && config.user.id ? config.user.id : ('uid-' + Date.now()));
|
|
||||||
|
var canRenameAnonymous = !((typeof (config.customization) == 'object') && (typeof (config.customization.anonymous) == 'object') && (config.customization.anonymous.request===false)),
|
||||||
|
guestName = (typeof (config.customization) == 'object') && (typeof (config.customization.anonymous) == 'object') &&
|
||||||
|
(typeof (config.customization.anonymous.label) == 'string') && config.customization.anonymous.label.trim()!=='' ?
|
||||||
|
common.utils.htmlEncode(config.customization.anonymous.label) : me.textGuest,
|
||||||
|
value = canRenameAnonymous ? common.localStorage.getItem("guest-username") : null,
|
||||||
|
user = common.utils.fillUserInfo(config.user, config.lang, value ? (value + ' (' + guestName + ')' ) : me.textAnonymous,
|
||||||
|
common.localStorage.getItem("guest-id") || ('uid-' + Date.now()));
|
||||||
|
user.anonymous && common.localStorage.setItem("guest-id", user.id);
|
||||||
|
|
||||||
|
_user.put_Id(user.id);
|
||||||
|
_user.put_FullName(user.fullname);
|
||||||
|
// _user.put_isAnonymous(user.anonymous);
|
||||||
|
|
||||||
docInfo.put_Id(docConfig.key);
|
docInfo.put_Id(docConfig.key);
|
||||||
docInfo.put_Url(docConfig.url);
|
docInfo.put_Url(docConfig.url);
|
||||||
|
@ -625,6 +641,9 @@ PE.ApplicationController = new(function(){
|
||||||
if (api) api.asc_runAutostartMacroses();
|
if (api) api.asc_runAutostartMacroses();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onBeforeUnload () {
|
||||||
|
common.localStorage.save();
|
||||||
|
}
|
||||||
// Helpers
|
// Helpers
|
||||||
// -------------------------
|
// -------------------------
|
||||||
|
|
||||||
|
@ -646,7 +665,8 @@ PE.ApplicationController = new(function(){
|
||||||
$(window).resize(function(){
|
$(window).resize(function(){
|
||||||
onDocumentResize();
|
onDocumentResize();
|
||||||
});
|
});
|
||||||
|
window.onbeforeunload = onBeforeUnload;
|
||||||
|
|
||||||
api = new Asc.asc_docs_api({
|
api = new Asc.asc_docs_api({
|
||||||
'id-view' : 'editor_sdk',
|
'id-view' : 'editor_sdk',
|
||||||
'embedded' : true
|
'embedded' : true
|
||||||
|
@ -691,6 +711,8 @@ PE.ApplicationController = new(function(){
|
||||||
textLoadingDocument: 'Loading presentation',
|
textLoadingDocument: 'Loading presentation',
|
||||||
txtClose: 'Close',
|
txtClose: 'Close',
|
||||||
errorFileSizeExceed: 'The file size exceeds the limitation set for your server.<br>Please contact your Document Server administrator for details.',
|
errorFileSizeExceed: 'The file size exceeds the limitation set for your server.<br>Please contact your Document Server administrator for details.',
|
||||||
errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.<br>Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.'
|
errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.<br>Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.',
|
||||||
|
textGuest: 'Guest',
|
||||||
|
textAnonymous: 'Anonymous'
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
"PE.ApplicationController.unknownErrorText": "Unknown error.",
|
"PE.ApplicationController.unknownErrorText": "Unknown error.",
|
||||||
"PE.ApplicationController.unsupportedBrowserErrorText": "Your browser is not supported.",
|
"PE.ApplicationController.unsupportedBrowserErrorText": "Your browser is not supported.",
|
||||||
"PE.ApplicationController.waitText": "Please, wait...",
|
"PE.ApplicationController.waitText": "Please, wait...",
|
||||||
|
"PE.ApplicationController.textGuest": "Guest",
|
||||||
|
"PE.ApplicationController.textAnonymous": "Anonymous",
|
||||||
"PE.ApplicationView.txtDownload": "Download",
|
"PE.ApplicationView.txtDownload": "Download",
|
||||||
"PE.ApplicationView.txtEmbed": "Embed",
|
"PE.ApplicationView.txtEmbed": "Embed",
|
||||||
"PE.ApplicationView.txtFileLocation": "Open file location",
|
"PE.ApplicationView.txtFileLocation": "Open file location",
|
||||||
|
|
|
@ -281,6 +281,7 @@
|
||||||
<script type="text/javascript" src="../../common/locale.js"></script>
|
<script type="text/javascript" src="../../common/locale.js"></script>
|
||||||
<script type="text/javascript" src="../../common/Gateway.js"></script>
|
<script type="text/javascript" src="../../common/Gateway.js"></script>
|
||||||
<script type="text/javascript" src="../../common/Analytics.js"></script>
|
<script type="text/javascript" src="../../common/Analytics.js"></script>
|
||||||
|
<script type="text/javascript" src="../../common/embed/lib/util/LocalStorage.js"></script>
|
||||||
<script type="text/javascript" src="../../common/embed/lib/util/utils.js"></script>
|
<script type="text/javascript" src="../../common/embed/lib/util/utils.js"></script>
|
||||||
<script type="text/javascript" src="../../common/embed/lib/view/modals.js"></script>
|
<script type="text/javascript" src="../../common/embed/lib/view/modals.js"></script>
|
||||||
<script type="text/javascript" src="../../common/embed/lib/controller/modals.js"></script>
|
<script type="text/javascript" src="../../common/embed/lib/controller/modals.js"></script>
|
||||||
|
|
|
@ -349,6 +349,7 @@
|
||||||
<script type="text/javascript" src="../../common/locale.js"></script>
|
<script type="text/javascript" src="../../common/locale.js"></script>
|
||||||
<script type="text/javascript" src="../../common/Gateway.js"></script>
|
<script type="text/javascript" src="../../common/Gateway.js"></script>
|
||||||
<script type="text/javascript" src="../../common/Analytics.js"></script>
|
<script type="text/javascript" src="../../common/Analytics.js"></script>
|
||||||
|
<script type="text/javascript" src="../../common/embed/lib/util/LocalStorage.js"></script>
|
||||||
<script type="text/javascript" src="../../common/embed/lib/util/utils.js"></script>
|
<script type="text/javascript" src="../../common/embed/lib/util/utils.js"></script>
|
||||||
<script type="text/javascript" src="../../common/embed/lib/view/modals.js"></script>
|
<script type="text/javascript" src="../../common/embed/lib/view/modals.js"></script>
|
||||||
<script type="text/javascript" src="../../common/embed/lib/controller/modals.js"></script>
|
<script type="text/javascript" src="../../common/embed/lib/controller/modals.js"></script>
|
||||||
|
|
|
@ -59,6 +59,9 @@ SSE.ApplicationController = new(function(){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
common.localStorage.setId('text');
|
||||||
|
common.localStorage.setKeysFilter('sse-,asc.table');
|
||||||
|
common.localStorage.sync();
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
// -------------------------
|
// -------------------------
|
||||||
|
@ -93,7 +96,19 @@ SSE.ApplicationController = new(function(){
|
||||||
var _permissions = $.extend({}, docConfig.permissions),
|
var _permissions = $.extend({}, docConfig.permissions),
|
||||||
docInfo = new Asc.asc_CDocInfo(),
|
docInfo = new Asc.asc_CDocInfo(),
|
||||||
_user = new Asc.asc_CUserInfo();
|
_user = new Asc.asc_CUserInfo();
|
||||||
_user.put_Id(config.user && config.user.id ? config.user.id : ('uid-' + Date.now()));
|
|
||||||
|
var canRenameAnonymous = !((typeof (config.customization) == 'object') && (typeof (config.customization.anonymous) == 'object') && (config.customization.anonymous.request===false)),
|
||||||
|
guestName = (typeof (config.customization) == 'object') && (typeof (config.customization.anonymous) == 'object') &&
|
||||||
|
(typeof (config.customization.anonymous.label) == 'string') && config.customization.anonymous.label.trim()!=='' ?
|
||||||
|
common.utils.htmlEncode(config.customization.anonymous.label) : me.textGuest,
|
||||||
|
value = canRenameAnonymous ? common.localStorage.getItem("guest-username") : null,
|
||||||
|
user = common.utils.fillUserInfo(config.user, config.lang, value ? (value + ' (' + guestName + ')' ) : me.textAnonymous,
|
||||||
|
common.localStorage.getItem("guest-id") || ('uid-' + Date.now()));
|
||||||
|
user.anonymous && common.localStorage.setItem("guest-id", user.id);
|
||||||
|
|
||||||
|
_user.put_Id(user.id);
|
||||||
|
_user.put_FullName(user.fullname);
|
||||||
|
// _user.put_isAnonymous(user.anonymous);
|
||||||
|
|
||||||
docInfo.put_Id(docConfig.key);
|
docInfo.put_Id(docConfig.key);
|
||||||
docInfo.put_Url(docConfig.url);
|
docInfo.put_Url(docConfig.url);
|
||||||
|
@ -580,6 +595,9 @@ SSE.ApplicationController = new(function(){
|
||||||
if (api) api.asc_runAutostartMacroses();
|
if (api) api.asc_runAutostartMacroses();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onBeforeUnload () {
|
||||||
|
common.localStorage.save();
|
||||||
|
}
|
||||||
// Helpers
|
// Helpers
|
||||||
// -------------------------
|
// -------------------------
|
||||||
|
|
||||||
|
@ -599,7 +617,8 @@ SSE.ApplicationController = new(function(){
|
||||||
$(window).resize(function(){
|
$(window).resize(function(){
|
||||||
onDocumentResize();
|
onDocumentResize();
|
||||||
});
|
});
|
||||||
|
window.onbeforeunload = onBeforeUnload;
|
||||||
|
|
||||||
api = new Asc.spreadsheet_api({
|
api = new Asc.spreadsheet_api({
|
||||||
'id-view': 'editor_sdk',
|
'id-view': 'editor_sdk',
|
||||||
'embedded' : true
|
'embedded' : true
|
||||||
|
@ -643,6 +662,8 @@ SSE.ApplicationController = new(function(){
|
||||||
textLoadingDocument: 'Loading spreadsheet',
|
textLoadingDocument: 'Loading spreadsheet',
|
||||||
txtClose: 'Close',
|
txtClose: 'Close',
|
||||||
errorFileSizeExceed: 'The file size exceeds the limitation set for your server.<br>Please contact your Document Server administrator for details.',
|
errorFileSizeExceed: 'The file size exceeds the limitation set for your server.<br>Please contact your Document Server administrator for details.',
|
||||||
errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.<br>Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.'
|
errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.<br>Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.',
|
||||||
|
textGuest: 'Guest',
|
||||||
|
textAnonymous: 'Anonymous'
|
||||||
}
|
}
|
||||||
})();
|
})();
|
|
@ -23,6 +23,8 @@
|
||||||
"SSE.ApplicationController.unknownErrorText": "Unknown error.",
|
"SSE.ApplicationController.unknownErrorText": "Unknown error.",
|
||||||
"SSE.ApplicationController.unsupportedBrowserErrorText": "Your browser is not supported.",
|
"SSE.ApplicationController.unsupportedBrowserErrorText": "Your browser is not supported.",
|
||||||
"SSE.ApplicationController.waitText": "Please, wait...",
|
"SSE.ApplicationController.waitText": "Please, wait...",
|
||||||
|
"SSE.ApplicationController.textGuest": "Guest",
|
||||||
|
"SSE.ApplicationController.textAnonymous": "Anonymous",
|
||||||
"SSE.ApplicationView.txtDownload": "Download",
|
"SSE.ApplicationView.txtDownload": "Download",
|
||||||
"SSE.ApplicationView.txtEmbed": "Embed",
|
"SSE.ApplicationView.txtEmbed": "Embed",
|
||||||
"SSE.ApplicationView.txtFileLocation": "Open file location",
|
"SSE.ApplicationView.txtFileLocation": "Open file location",
|
||||||
|
|
|
@ -409,6 +409,7 @@
|
||||||
"../apps/common/locale.js",
|
"../apps/common/locale.js",
|
||||||
"../apps/common/Gateway.js",
|
"../apps/common/Gateway.js",
|
||||||
"../apps/common/Analytics.js",
|
"../apps/common/Analytics.js",
|
||||||
|
"../apps/common/embed/lib/util/LocalStorage.js",
|
||||||
"../apps/common/embed/lib/util/utils.js",
|
"../apps/common/embed/lib/util/utils.js",
|
||||||
"../apps/common/embed/lib/view/modals.js",
|
"../apps/common/embed/lib/view/modals.js",
|
||||||
"../apps/common/embed/lib/controller/modals.js",
|
"../apps/common/embed/lib/controller/modals.js",
|
||||||
|
|
|
@ -413,6 +413,7 @@
|
||||||
"../apps/common/locale.js",
|
"../apps/common/locale.js",
|
||||||
"../apps/common/Gateway.js",
|
"../apps/common/Gateway.js",
|
||||||
"../apps/common/Analytics.js",
|
"../apps/common/Analytics.js",
|
||||||
|
"../apps/common/embed/lib/util/LocalStorage.js",
|
||||||
"../apps/common/embed/lib/util/utils.js",
|
"../apps/common/embed/lib/util/utils.js",
|
||||||
"../apps/common/embed/lib/view/modals.js",
|
"../apps/common/embed/lib/view/modals.js",
|
||||||
"../apps/common/embed/lib/controller/modals.js",
|
"../apps/common/embed/lib/controller/modals.js",
|
||||||
|
|
|
@ -426,6 +426,7 @@
|
||||||
"../apps/common/locale.js",
|
"../apps/common/locale.js",
|
||||||
"../apps/common/Gateway.js",
|
"../apps/common/Gateway.js",
|
||||||
"../apps/common/Analytics.js",
|
"../apps/common/Analytics.js",
|
||||||
|
"../apps/common/embed/lib/util/LocalStorage.js",
|
||||||
"../apps/common/embed/lib/util/utils.js",
|
"../apps/common/embed/lib/util/utils.js",
|
||||||
"../apps/common/embed/lib/view/modals.js",
|
"../apps/common/embed/lib/view/modals.js",
|
||||||
"../apps/common/embed/lib/controller/modals.js",
|
"../apps/common/embed/lib/controller/modals.js",
|
||||||
|
|
Loading…
Reference in a new issue