Commit df5b9923 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Поправил открытие offline документа

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@53803 954022d7-b5bf-4e40-9824-e11837661b57
parent 2a9e9057
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
<script type="text/javascript"> <script type="text/javascript">
//<![CDATA[ //<![CDATA[
window.g_debug_mode = false; window.g_debug_mode = false;
window.g_offline_doc = "../Excel/document/";
//window.g_debug_mode = true; //window.g_debug_mode = true;
//window.g_isMobileVersion = true; //window.g_isMobileVersion = true;
//]]> //]]>
...@@ -63,8 +64,6 @@ ...@@ -63,8 +64,6 @@
<script type="text/javascript" src="graphics/DrawingContext.js"></script> <script type="text/javascript" src="graphics/DrawingContext.js"></script>
<script type="text/javascript" src="graphics/pdfprinter.js"></script> <script type="text/javascript" src="graphics/pdfprinter.js"></script>
<!--TODO: remove test data-->
<script type="text/javascript" src="offlinedocs/test-workbook9/Editor.js"></script>
<script type="text/javascript" src="offlinedocs/empty-workbook.js"></script> <script type="text/javascript" src="offlinedocs/empty-workbook.js"></script>
<script type="text/javascript" src="model/CollaborativeEditing.js"></script> <script type="text/javascript" src="model/CollaborativeEditing.js"></script>
......
...@@ -949,56 +949,69 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -949,56 +949,69 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
type: 'POST', type: 'POST',
url: url, url: url,
data: rdata, data: rdata,
error: function(jqXHR, textStatus, errorThrown){ error: function(jqXHR, textStatus, errorThrown) {
var result = {returnCode: c_oAscError.Level.Critical, val:c_oAscError.ID.Unknown}; if (callback)
if(callback) callback({returnCode: c_oAscError.Level.Critical, val:c_oAscError.ID.Unknown});
callback(result);
}, },
success: function(msg){ success: function(msg){
var result; if (!msg || msg.length < 1) {
if(!msg || msg.length < 1){ if (callback)
result = {returnCode: c_oAscError.Level.Critical, val:c_oAscError.ID.Unknown}; callback({returnCode: c_oAscError.Level.Critical, val:c_oAscError.ID.Unknown});
if(callback) } else {
callback(result);
return;
}
else{
var incomeObject = JSON.parse(msg); var incomeObject = JSON.parse(msg);
if (callback)
if(callback)
callback(incomeObject); callback(incomeObject);
} }
}, },
dataType: "text"}); dataType: "text"});
}, },
_OfflineAppDocumentStartLoad: function (fCallback) {
var t = this, src = this.FontLoader.fontFilesPath;
src += window.g_offline_doc ? window.g_offline_doc : "../Excel/document/";
var scriptElem = document.createElement('script');
scriptElem.onload = scriptElem.onerror = function () {t._OfflineAppDocumentEndLoad(src, fCallback);};
scriptElem.setAttribute('src', src + "editor.js");
scriptElem.setAttribute('type','text/javascript');
document.getElementsByTagName('head')[0].appendChild(scriptElem);
},
_OfflineAppDocumentEndLoad: function (sUrlPath, fCallback) {
var data = getTestWorkbook();
var sData = data + "";
if (c_oSerFormat.Signature === sData.substring(0, c_oSerFormat.Signature.length)) {
var wb = this.asc_OpenDocument(sUrlPath, sData);
fCallback({returnCode: 0, val:wb});
}
},
_asc_open: function (fCallback) { //fCallback({returnCode:"", val:obj, ...}) _asc_open: function (fCallback) { //fCallback({returnCode:"", val:obj, ...})
if ( this.chartEditor ) { if (this.chartEditor) {
} else if (!this.documentId || !this.documentUrl) { } else if (!this.documentId || !this.documentUrl) {
var data = getTestWorkbook(); this._OfflineAppDocumentStartLoad(fCallback);
var sData = data + ""; } else {
if( c_oSerFormat.Signature === sData.substring(0, c_oSerFormat.Signature.length)) var v = {
{ "id" : this.documentId,
var sUrlPath = "offlinedocs/test-workbook9/"; "format" : this.documentFormat,
var wb = this.asc_OpenDocument(sUrlPath, sData); "vkey" : this.documentVKey,
fCallback({returnCode: 0, val:wb}); "editorid" : c_oEditorId.Speadsheet,
} "url" : this.documentUrl,
} "title" : this.documentTitle,
else { "embeddedfonts" : this.isUseEmbeddedCutFonts
if(this.documentOpenOptions && this.documentOpenOptions["isEmpty"]) };
{ if (this.documentOpenOptions && this.documentOpenOptions["isEmpty"]) {
var sEmptyWorkbook = getEmptyWorkbook(); var sEmptyWorkbook = getEmptyWorkbook();
var v = {"id":this.documentId, "format": this.documentFormat, "vkey": this.documentVKey, "editorid": c_oEditorId.Speadsheet, "c":"create", "url": this.documentUrl, "title": this.documentTitle, "embeddedfonts": this.isUseEmbeddedCutFonts, "data": sEmptyWorkbook}; v["c"] = "create";
v["data"] = sEmptyWorkbook;
this._asc_sendCommand (fCallback, v); this._asc_sendCommand (fCallback, v);
var wb = this.asc_OpenDocument(g_sResourceServiceLocalUrl + this.documentId + "/", sEmptyWorkbook); var wb = this.asc_OpenDocument(g_sResourceServiceLocalUrl + this.documentId + "/", sEmptyWorkbook);
fCallback({returnCode: 0, val:wb}); fCallback({returnCode: 0, val:wb});
} } else {
else
{
// Меняем тип состояния (на открытие) // Меняем тип состояния (на открытие)
this.advancedOptionsAction = c_oAscAdvancedOptionsAction.Open; this.advancedOptionsAction = c_oAscAdvancedOptionsAction.Open;
var v = {"id":this.documentId, "format": this.documentFormat, "vkey": this.documentVKey, "editorid": c_oEditorId.Speadsheet, "c":"open", "url": this.documentUrl, "title": this.documentTitle, "embeddedfonts": this.isUseEmbeddedCutFonts}; v["c"] = "open";
this._asc_sendCommand (fCallback, v); this._asc_sendCommand (fCallback, v);
} }
} }
......
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