Commit 6f778528 authored by Alexey Golubev's avatar Alexey Golubev Committed by GitHub

Merge pull request #213 from ONLYOFFICE/hotfix/v5.0.3-desktop-fix-offline-mode

set offline mode on function asc_setDocInfo, because onEndLoadDocInfo…
parents fb0c48c9 a83c9ce1
...@@ -1931,7 +1931,7 @@ function DrawingObjects() { ...@@ -1931,7 +1931,7 @@ function DrawingObjects() {
for(i = 0; i < aImagesSync.length; ++i) for(i = 0; i < aImagesSync.length; ++i)
{ {
var localUrl = aImagesSync[i]; var localUrl = aImagesSync[i];
if(api.DocInfo && api.DocInfo.asc_getOfflineApp()) { if(api.DocInfo && api.DocInfo.get_OfflineApp()) {
AscCommon.g_oDocumentUrls.addImageUrl(localUrl, "/sdkjs/cell/document/media/" + localUrl); AscCommon.g_oDocumentUrls.addImageUrl(localUrl, "/sdkjs/cell/document/media/" + localUrl);
} }
aImagesSync[i] = AscCommon.getFullImageSrc2(localUrl); aImagesSync[i] = AscCommon.getFullImageSrc2(localUrl);
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
(function(window, undefined) (function(window, undefined)
{ {
// Import // Import
var offlineMode = AscCommon.offlineMode;
var c_oEditorId = AscCommon.c_oEditorId; var c_oEditorId = AscCommon.c_oEditorId;
var c_oCloseCode = AscCommon.c_oCloseCode; var c_oCloseCode = AscCommon.c_oCloseCode;
...@@ -274,15 +273,24 @@ ...@@ -274,15 +273,24 @@
this.CoAuthoringApi.setDocId(this.documentId); this.CoAuthoringApi.setDocId(this.documentId);
if (this.watermarkDraw) if (this.watermarkDraw)
{
this.watermarkDraw.CheckParams(this); this.watermarkDraw.CheckParams(this);
}
}
if (AscCommon.offlineMode === this.documentUrl)
{
this.documentUrl = '/sdkjs/' + this._editorNameById() + '/document/';
this.DocInfo.put_OfflineApp(true);
} }
if (undefined !== window["AscDesktopEditor"] && offlineMode != this.documentUrl) if (undefined !== window["AscDesktopEditor"] && !(this.DocInfo && this.DocInfo.get_OfflineApp()))
{ {
window["AscDesktopEditor"]["SetDocumentName"](this.documentTitle); window["AscDesktopEditor"]["SetDocumentName"](this.documentTitle);
} }
if (!oldInfo) { if (!oldInfo)
{
this.onEndLoadDocInfo(); this.onEndLoadDocInfo();
} }
}; };
...@@ -429,7 +437,7 @@ ...@@ -429,7 +437,7 @@
// Меняем тип состояния (на открытие) // Меняем тип состояния (на открытие)
this.advancedOptionsAction = AscCommon.c_oAscAdvancedOptionsAction.Open; this.advancedOptionsAction = AscCommon.c_oAscAdvancedOptionsAction.Open;
var rData = null; var rData = null;
if (offlineMode !== this.documentUrl) if (!(this.DocInfo && this.DocInfo.get_OfflineApp()))
{ {
rData = { rData = {
"c" : 'open', "c" : 'open',
...@@ -458,12 +466,6 @@ ...@@ -458,12 +466,6 @@
if (!isRepeat) { if (!isRepeat) {
this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Open); this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Open);
} }
if (offlineMode === this.documentUrl)
{
this.documentUrl = '/sdkjs/' + this._editorNameById() + '/document/';
this.DocInfo.asc_putOfflineApp(true);
}
}; };
baseEditorsApi.prototype._OfflineAppDocumentStartLoad = function() baseEditorsApi.prototype._OfflineAppDocumentStartLoad = function()
{ {
...@@ -574,7 +576,7 @@ ...@@ -574,7 +576,7 @@
} }
//в обычном серверном режиме портим ссылку, потому что CoAuthoring теперь имеет встроенный адрес //в обычном серверном режиме портим ссылку, потому что CoAuthoring теперь имеет встроенный адрес
//todo надо использовать проверку get_OfflineApp //todo надо использовать проверку get_OfflineApp
if (!(window['NATIVE_EDITOR_ENJINE'] || offlineMode === this.documentUrl) || window['IS_NATIVE_EDITOR']) if (!(window['NATIVE_EDITOR_ENJINE'] || (this.DocInfo && this.DocInfo.get_OfflineApp())) || window['IS_NATIVE_EDITOR'])
{ {
this.CoAuthoringApi.set_url(null); this.CoAuthoringApi.set_url(null);
} }
......
...@@ -2924,6 +2924,7 @@ ...@@ -2924,6 +2924,7 @@
this.Mode = null; this.Mode = null;
this.Permissions = null; this.Permissions = null;
this.Lang = null; this.Lang = null;
this.OfflineApp = false;
} }
prot = asc_CDocInfo.prototype; prot = asc_CDocInfo.prototype;
...@@ -2963,10 +2964,10 @@ ...@@ -2963,10 +2964,10 @@
prot.put_Token = prot.asc_putToken = function (v) { prot.put_Token = prot.asc_putToken = function (v) {
this.Token = v; this.Token = v;
}; };
prot.get_OfflineApp = prot.asc_getOfflineApp = function () { prot.get_OfflineApp = function () {
return this.OfflineApp; return this.OfflineApp;
}; };
prot.put_OfflineApp = prot.asc_putOfflineApp = function (v) { prot.put_OfflineApp = function (v) {
this.OfflineApp = v; this.OfflineApp = v;
}; };
prot.get_UserId = prot.asc_getUserId = function () { prot.get_UserId = prot.asc_getUserId = function () {
...@@ -4207,8 +4208,6 @@ ...@@ -4207,8 +4208,6 @@
prot["put_Format"] = prot["asc_putFormat"] = prot.asc_putFormat; prot["put_Format"] = prot["asc_putFormat"] = prot.asc_putFormat;
prot["get_VKey"] = prot["asc_getVKey"] = prot.asc_getVKey; prot["get_VKey"] = prot["asc_getVKey"] = prot.asc_getVKey;
prot["put_VKey"] = prot["asc_putVKey"] = prot.asc_putVKey; prot["put_VKey"] = prot["asc_putVKey"] = prot.asc_putVKey;
prot["get_OfflineApp"] = prot["asc_getOfflineApp"] = prot.asc_getOfflineApp;
prot["put_OfflineApp"] = prot["asc_putOfflineApp"] = prot.asc_putOfflineApp;
prot["get_UserId"] = prot["asc_getUserId"] = prot.asc_getUserId; prot["get_UserId"] = prot["asc_getUserId"] = prot.asc_getUserId;
prot["get_UserName"] = prot["asc_getUserName"] = prot.asc_getUserName; prot["get_UserName"] = prot["asc_getUserName"] = prot.asc_getUserName;
prot["get_Options"] = prot["asc_getOptions"] = prot.asc_getOptions; prot["get_Options"] = prot["asc_getOptions"] = prot.asc_getOptions;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment