Commit 9adcde7d authored by Oleg Korshul's avatar Oleg Korshul

desktop 5.0

parent f90839ab
...@@ -60,7 +60,7 @@ var c_oAscError = Asc.c_oAscError; ...@@ -60,7 +60,7 @@ var c_oAscError = Asc.c_oAscError;
window["AscDesktopEditor"]["LocalStartOpen"](); window["AscDesktopEditor"]["LocalStartOpen"]();
}; };
asc['spreadsheet_api'].prototype._OfflineAppDocumentEndLoad = function(_data) asc['spreadsheet_api'].prototype._OfflineAppDocumentEndLoad = function(_data, _len)
{ {
AscCommon.g_oIdCounter.m_sUserId = window["AscDesktopEditor"]["CheckUserId"](); AscCommon.g_oIdCounter.m_sUserId = window["AscDesktopEditor"]["CheckUserId"]();
if (_data == "") if (_data == "")
...@@ -69,7 +69,8 @@ var c_oAscError = Asc.c_oAscError; ...@@ -69,7 +69,8 @@ var c_oAscError = Asc.c_oAscError;
return; return;
} }
this.openDocument(_data); var _binary = getBinaryArray(_data, _len);
this.openDocument(_binary);
AscCommon.History.UserSaveMode = true; AscCommon.History.UserSaveMode = true;
DesktopOfflineUpdateLocalName(this); DesktopOfflineUpdateLocalName(this);
...@@ -137,7 +138,7 @@ window["Asc"]['spreadsheet_api'].prototype.asc_setAdvancedOptions = function(idO ...@@ -137,7 +138,7 @@ window["Asc"]['spreadsheet_api'].prototype.asc_setAdvancedOptions = function(idO
}; };
window["Asc"]['spreadsheet_api'].prototype["asc_setAdvancedOptions"] = window["Asc"]['spreadsheet_api'].prototype.asc_setAdvancedOptions; window["Asc"]['spreadsheet_api'].prototype["asc_setAdvancedOptions"] = window["Asc"]['spreadsheet_api'].prototype.asc_setAdvancedOptions;
window["DesktopOfflineAppDocumentEndLoad"] = function(_url, _data) window["DesktopOfflineAppDocumentEndLoad"] = function(_url, _data, _len)
{ {
AscCommon.g_oDocumentUrls.documentUrl = _url; AscCommon.g_oDocumentUrls.documentUrl = _url;
if (AscCommon.g_oDocumentUrls.documentUrl.indexOf("file:") != 0) if (AscCommon.g_oDocumentUrls.documentUrl.indexOf("file:") != 0)
...@@ -147,7 +148,7 @@ window["DesktopOfflineAppDocumentEndLoad"] = function(_url, _data) ...@@ -147,7 +148,7 @@ window["DesktopOfflineAppDocumentEndLoad"] = function(_url, _data)
AscCommon.g_oDocumentUrls.documentUrl = "file://" + AscCommon.g_oDocumentUrls.documentUrl; AscCommon.g_oDocumentUrls.documentUrl = "file://" + AscCommon.g_oDocumentUrls.documentUrl;
} }
window["Asc"]["editor"]._OfflineAppDocumentEndLoad(_data); window["Asc"]["editor"]._OfflineAppDocumentEndLoad(_data, _len);
}; };
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
......
...@@ -388,6 +388,44 @@ window["DesktopAfterOpen"] = function(_api) ...@@ -388,6 +388,44 @@ window["DesktopAfterOpen"] = function(_api)
]); ]);
}; };
function getBinaryArray(_data, _len)
{
var _array = new Uint8Array(_len);
var _index = 0;
var _written = 0;
var _data_len = _data.length;
while (_index < _data_len)
{
var dwCurr = 0;
var i;
var nBits = 0;
for (i=0; i<4; i++)
{
if (_index >= _data_len)
break;
var nCh = DecodeBase64Char(_data.charCodeAt(_index++));
if (nCh == -1)
{
i--;
continue;
}
dwCurr <<= 6;
dwCurr |= nCh;
nBits += 6;
}
dwCurr <<= 24-nBits;
for (i=0; i<nBits/8; i++)
{
_array[_written++] = ((dwCurr & 0x00ff0000) >>> 16);
dwCurr <<= 8;
}
}
return _array;
}
// меняем среду // меняем среду
//AscBrowser.isSafari = false; //AscBrowser.isSafari = false;
//AscBrowser.isSafariMacOs = false; //AscBrowser.isSafariMacOs = false;
......
...@@ -1489,6 +1489,13 @@ ...@@ -1489,6 +1489,13 @@
return this.signatures; return this.signatures;
}; };
baseEditorsApi.prototype.asc_isSignaturesSupport = function()
{
if (window["AscDesktopEditor"] && window["AscDesktopEditor"]["IsSignaturesSupport"])
return window["AscDesktopEditor"]["IsSignaturesSupport"]();
return false;
};
baseEditorsApi.prototype.asc_getSignatureImage = function (sGuid) { baseEditorsApi.prototype.asc_getSignatureImage = function (sGuid) {
var count = this.signatures.length; var count = this.signatures.length;
......
...@@ -49,7 +49,7 @@ Asc['asc_docs_api'].prototype._OfflineAppDocumentStartLoad = function() ...@@ -49,7 +49,7 @@ Asc['asc_docs_api'].prototype._OfflineAppDocumentStartLoad = function()
AscCommon.History.UserSaveMode = true; AscCommon.History.UserSaveMode = true;
window["AscDesktopEditor"]["LocalStartOpen"](); window["AscDesktopEditor"]["LocalStartOpen"]();
}; };
Asc['asc_docs_api'].prototype._OfflineAppDocumentEndLoad = function(_url, _data) Asc['asc_docs_api'].prototype._OfflineAppDocumentEndLoad = function(_url, _data, _len)
{ {
AscCommon.g_oIdCounter.m_sUserId = window["AscDesktopEditor"]["CheckUserId"](); AscCommon.g_oIdCounter.m_sUserId = window["AscDesktopEditor"]["CheckUserId"]();
if (_data == "") if (_data == "")
...@@ -57,15 +57,16 @@ Asc['asc_docs_api'].prototype._OfflineAppDocumentEndLoad = function(_url, _data) ...@@ -57,15 +57,16 @@ Asc['asc_docs_api'].prototype._OfflineAppDocumentEndLoad = function(_url, _data)
this.sendEvent("asc_onError", c_oAscError.ID.ConvertationOpenError, c_oAscError.Level.Critical); this.sendEvent("asc_onError", c_oAscError.ID.ConvertationOpenError, c_oAscError.Level.Critical);
return; return;
} }
this.OpenDocument2(_url, _data); var _binary = getBinaryArray(_data, _len);
this.OpenDocument2(_url, _binary);
this.WordControl.m_oLogicDocument.Set_FastCollaborativeEditing(false); this.WordControl.m_oLogicDocument.Set_FastCollaborativeEditing(false);
this.DocumentOrientation = (null == this.WordControl.m_oLogicDocument) ? true : !this.WordControl.m_oLogicDocument.Orientation; this.DocumentOrientation = (null == this.WordControl.m_oLogicDocument) ? true : !this.WordControl.m_oLogicDocument.Orientation;
DesktopOfflineUpdateLocalName(this); DesktopOfflineUpdateLocalName(this);
window["DesktopAfterOpen"](this); window["DesktopAfterOpen"](this);
}; };
window["DesktopOfflineAppDocumentEndLoad"] = function(_url, _data) window["DesktopOfflineAppDocumentEndLoad"] = function(_url, _data, _len)
{ {
AscCommon.g_oDocumentUrls.documentUrl = _url; AscCommon.g_oDocumentUrls.documentUrl = _url;
if (AscCommon.g_oDocumentUrls.documentUrl.indexOf("file:") != 0) if (AscCommon.g_oDocumentUrls.documentUrl.indexOf("file:") != 0)
...@@ -75,7 +76,7 @@ window["DesktopOfflineAppDocumentEndLoad"] = function(_url, _data) ...@@ -75,7 +76,7 @@ window["DesktopOfflineAppDocumentEndLoad"] = function(_url, _data)
AscCommon.g_oDocumentUrls.documentUrl = "file://" + AscCommon.g_oDocumentUrls.documentUrl; AscCommon.g_oDocumentUrls.documentUrl = "file://" + AscCommon.g_oDocumentUrls.documentUrl;
} }
editor._OfflineAppDocumentEndLoad(_url, _data); editor._OfflineAppDocumentEndLoad(_url, _data, _len);
}; };
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
......
...@@ -49,7 +49,7 @@ Asc['asc_docs_api'].prototype._OfflineAppDocumentStartLoad = function() ...@@ -49,7 +49,7 @@ Asc['asc_docs_api'].prototype._OfflineAppDocumentStartLoad = function()
AscCommon.History.UserSaveMode = true; AscCommon.History.UserSaveMode = true;
window["AscDesktopEditor"]["LocalStartOpen"](); window["AscDesktopEditor"]["LocalStartOpen"]();
}; };
Asc['asc_docs_api'].prototype._OfflineAppDocumentEndLoad = function(_url, _data) Asc['asc_docs_api'].prototype._OfflineAppDocumentEndLoad = function(_url, _data, _len)
{ {
AscCommon.g_oIdCounter.m_sUserId = window["AscDesktopEditor"]["CheckUserId"](); AscCommon.g_oIdCounter.m_sUserId = window["AscDesktopEditor"]["CheckUserId"]();
if (_data == "") if (_data == "")
...@@ -57,20 +57,35 @@ Asc['asc_docs_api'].prototype._OfflineAppDocumentEndLoad = function(_url, _data) ...@@ -57,20 +57,35 @@ Asc['asc_docs_api'].prototype._OfflineAppDocumentEndLoad = function(_url, _data)
this.sendEvent("asc_onError", c_oAscError.ID.ConvertationOpenError, c_oAscError.Level.Critical); this.sendEvent("asc_onError", c_oAscError.ID.ConvertationOpenError, c_oAscError.Level.Critical);
return; return;
} }
if (AscCommon.c_oSerFormat.Signature !== _data.substring(0, AscCommon.c_oSerFormat.Signature.length))
var _binary = getBinaryArray(_data, _len);
var _sign_len = AscCommon.c_oSerFormat.Signature.length;
var _signature = "";
if (_binary.length >= _sign_len)
{
for (var i = 0; i < _sign_len; i++)
{
_signature += String.fromCharCode(_binary[i]);
}
}
if (AscCommon.c_oSerFormat.Signature !== _signature)
{ {
this.OpenDocument(_url, _data); this.OpenDocument(_url, _binary);
} }
else else
{ {
this.OpenDocument2(_url, _data); this.OpenDocument2(_url, _binary);
this.WordControl.m_oLogicDocument.Set_FastCollaborativeEditing(false); this.WordControl.m_oLogicDocument.Set_FastCollaborativeEditing(false);
} }
this.WordControl.m_oLogicDocument.Set_FastCollaborativeEditing(false);
DesktopOfflineUpdateLocalName(this); DesktopOfflineUpdateLocalName(this);
window["DesktopAfterOpen"](this); window["DesktopAfterOpen"](this);
}; };
window["DesktopOfflineAppDocumentEndLoad"] = function(_url, _data) window["DesktopOfflineAppDocumentEndLoad"] = function(_url, _data, _len)
{ {
AscCommon.g_oDocumentUrls.documentUrl = _url; AscCommon.g_oDocumentUrls.documentUrl = _url;
if (AscCommon.g_oDocumentUrls.documentUrl.indexOf("file:") != 0) if (AscCommon.g_oDocumentUrls.documentUrl.indexOf("file:") != 0)
...@@ -80,7 +95,7 @@ window["DesktopOfflineAppDocumentEndLoad"] = function(_url, _data) ...@@ -80,7 +95,7 @@ window["DesktopOfflineAppDocumentEndLoad"] = function(_url, _data)
AscCommon.g_oDocumentUrls.documentUrl = "file://" + AscCommon.g_oDocumentUrls.documentUrl; AscCommon.g_oDocumentUrls.documentUrl = "file://" + AscCommon.g_oDocumentUrls.documentUrl;
} }
editor._OfflineAppDocumentEndLoad(_url, _data); editor._OfflineAppDocumentEndLoad(_url, _data, _len);
}; };
Asc['asc_docs_api'].prototype.asc_setAdvancedOptions = function(idOption, option) Asc['asc_docs_api'].prototype.asc_setAdvancedOptions = function(idOption, option)
......
...@@ -8807,6 +8807,7 @@ background-repeat: no-repeat;\ ...@@ -8807,6 +8807,7 @@ background-repeat: no-repeat;\
asc_docs_api.prototype["asc_SelectCertificate"] = asc_docs_api.prototype.asc_SelectCertificate; asc_docs_api.prototype["asc_SelectCertificate"] = asc_docs_api.prototype.asc_SelectCertificate;
asc_docs_api.prototype["asc_GetDefaultCertificate"] = asc_docs_api.prototype.asc_GetDefaultCertificate; asc_docs_api.prototype["asc_GetDefaultCertificate"] = asc_docs_api.prototype.asc_GetDefaultCertificate;
asc_docs_api.prototype["asc_getSignatures"] = asc_docs_api.prototype.asc_getSignatures; asc_docs_api.prototype["asc_getSignatures"] = asc_docs_api.prototype.asc_getSignatures;
asc_docs_api.prototype["asc_isSignaturesSupport"] = asc_docs_api.prototype.asc_isSignaturesSupport;
CDocInfoProp.prototype['get_PageCount'] = CDocInfoProp.prototype.get_PageCount; CDocInfoProp.prototype['get_PageCount'] = CDocInfoProp.prototype.get_PageCount;
CDocInfoProp.prototype['put_PageCount'] = CDocInfoProp.prototype.put_PageCount; CDocInfoProp.prototype['put_PageCount'] = CDocInfoProp.prototype.put_PageCount;
......
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