Commit e41f0650 authored by Alexander.Trofimov's avatar Alexander.Trofimov

Добавил getViewMode в baseEditorsApi, _onOpenCommand, _onNeedParams, asc_coAuthoringDisconnect

onDocumentOpen вынес в baseEditorsApi
_onOpenCommand delete from export

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@66476 954022d7-b5bf-4e40-9824-e11837661b57
parent 8d9fc422
......@@ -165,6 +165,13 @@ baseEditorsApi.prototype.sync_TryUndoInFastCollaborative = function()
{
this.sendEvent("asc_OnTryUndoInFastCollaborative");
};
baseEditorsApi.prototype.getViewMode = function() {
};
// Open
baseEditorsApi.prototype._onOpenCommand = function(data) {
};
baseEditorsApi.prototype._onNeedParams = function(data) {
};
// Выставление интервала автосохранения (0 - означает, что автосохранения нет)
baseEditorsApi.prototype.asc_setAutoSaveGap = function(autoSaveGap) {
if (typeof autoSaveGap === "number") {
......@@ -227,11 +234,58 @@ baseEditorsApi.prototype._coAuthoringInit = function() {
this.CoAuthoringApi.onWarning = function(e) {
t.sendEvent('asc_onError', c_oAscError.ID.Warning, c_oAscError.Level.NoCritical);
};
this.CoAuthoringApi.onDocumentOpen = function(inputWrap) {
if (inputWrap["data"]) {
var input = inputWrap["data"];
switch (input["type"]) {
case 'reopen':
case 'open':
switch (input["status"]) {
case "updateversion":
case "ok":
var urls = input["data"];
g_oDocumentUrls.init(urls);
if (null != urls['Editor.bin']) {
if ('ok' === input["status"] || t.getViewMode()) {
t._onOpenCommand(urls['Editor.bin']);
} else {
t.sendEvent("asc_onDocumentUpdateVersion", function() {
if (t.isCoAuthoringEnable) {
t.asc_coAuthoringDisconnect();
}
t._onOpenCommand(urls['Editor.bin']);
})
}
} else {
t.sendEvent("asc_onError", c_oAscError.ID.ConvertationError, c_oAscError.Level.Critical);
}
break;
case "needparams":
t._onNeedParams(input["data"]);
break;
case "err":
t.sendEvent("asc_onError", g_fMapAscServerErrorToAscError(parseInt(input["data"])), c_oAscError.Level.Critical);
break;
}
break;
default:
if (t.fCurCallback) {
t.fCurCallback(input);
t.fCurCallback = null;
} else {
t.sendEvent("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.NoCritical);
}
break;
}
}
};
this._coAuthoringInitEnd();
};
baseEditorsApi.prototype._coAuthoringInitEnd = function() {
};
baseEditorsApi.prototype.asc_coAuthoringDisconnect = function() {
};
// SpellCheck
baseEditorsApi.prototype._coSpellCheckInit = function() {
};
......
......@@ -639,22 +639,44 @@ var editor;
return this.wbModel.getWorksheet(sheetIndex).PagePrintOptions;
};
spreadsheet_api.prototype._onOpenCommand = function(callback, data) {
spreadsheet_api.prototype._onNeedParams = function(data) {
var t = this;
// Проверяем, возможно нам пришли опции для CSV
if (this.documentOpenOptions) {
var codePageCsv = c_oAscEncodingsMap[this.documentOpenOptions["codePage"]] || c_oAscCodePageUtf8, delimiterCsv = this.documentOpenOptions["delimiter"];
if (null != codePageCsv && null != delimiterCsv) {
this.asc_setAdvancedOptions(c_oAscAdvancedOptionsID.CSV, new asc.asc_CCSVAdvancedOptions(codePageCsv, delimiterCsv));
return;
}
}
if (data) {
asc_ajax({
url: data,
dataType: "text",
success: function(result) {
var cp = JSON.parse(result);
cp['encodings'] = getEncodingParams();
t.handlers.trigger("asc_onAdvancedOptions", new asc.asc_CAdvancedOptions(c_oAscAdvancedOptionsID.CSV, cp), t.advancedOptionsAction);
},
error: function() {
t.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.Critical);
}
});
} else {
t.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.NoCritical);
}
};
spreadsheet_api.prototype._onOpenCommand = function(data) {
var t = this;
g_fOpenFileCommand(data, this.documentUrlChanges, Asc.c_oSerFormat.Signature, function(error, result) {
if (error || !result.bSerFormat) {
var oError = {returnCode: c_oAscError.Level.Critical, val: c_oAscError.ID.Unknown};
t.handlers.trigger("asc_onError", oError.val, oError.returnCode);
if (callback) {
callback(oError);
}
return;
}
var wb = t._openDocument(result.data);
if (callback) {
callback({returnCode: 0, val: wb});
}
t._startOpenDocument({returnCode: 0, val: wb});
});
};
......@@ -1307,84 +1329,6 @@ var editor;
t.handlers.trigger("asc_onError", isCloseCoAuthoring ? c_oAscError.ID.UserDrop : c_oAscError.ID.CoAuthoringDisconnect, c_oAscError.Level.NoCritical);
}
};
this.CoAuthoringApi.onDocumentOpen = function(inputWrap) {
if (inputWrap["data"]) {
var input = inputWrap["data"];
switch (input["type"]) {
case 'reopen':
case 'open':
{
switch (input["status"]) {
case "updateversion":
case "ok":
var urls = input["data"];
g_oDocumentUrls.init(urls);
if (null != urls['Editor.bin']) {
if ('ok' === input["status"] || t.getViewMode()) {
t._onOpenCommand(function(response) {
t._startOpenDocument(response);
}, urls['Editor.bin']);
} else {
t.handlers.trigger("asc_onDocumentUpdateVersion", function () {
if (t.isCoAuthoringEnable) {
t.asc_coAuthoringDisconnect();
}
t._onOpenCommand(function(response) {
t._startOpenDocument(response);
}, urls['Editor.bin']);
});
}
} else {
t.handlers.trigger("asc_onError", c_oAscError.ID.ConvertationError, c_oAscError.Level.Critical);
}
break;
case "needparams":
// Проверяем, возможно нам пришли опции для CSV
if (t.documentOpenOptions) {
var codePageCsv = c_oAscEncodingsMap[t.documentOpenOptions["codePage"]] || c_oAscCodePageUtf8,
delimiterCsv = t.documentOpenOptions["delimiter"];
if (null !== codePageCsv && undefined !== codePageCsv && null !== delimiterCsv && undefined !== delimiterCsv) {
t.asc_setAdvancedOptions(c_oAscAdvancedOptionsID.CSV, new asc.asc_CCSVAdvancedOptions(codePageCsv, delimiterCsv));
break;
}
}
if(input["data"]) {
asc_ajax({
url: input["data"],
dataType: "text",
success: function(result) {
var cp = JSON.parse(result);
cp['encodings'] = getEncodingParams();
t.handlers.trigger("asc_onAdvancedOptions", new asc.asc_CAdvancedOptions(c_oAscAdvancedOptionsID.CSV, cp), t.advancedOptionsAction);
},
error: function() {
t.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.Critical);
if (fCallback) {
fCallback({returnCode: c_oAscError.Level.Critical, val: c_oAscError.ID.Unknown});
}
}
});
} else {
t.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.NoCritical);
}
break;
case "err":
t.handlers.trigger("asc_onError", g_fMapAscServerErrorToAscError(parseInt(input["data"])), c_oAscError.Level.Critical);
break;
}
}
break;
default:
if (t.fCurCallback) {
t.fCurCallback(input);
t.fCurCallback = null;
} else {
t.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.NoCritical);
}
break;
}
}
};
this.CoAuthoringApi.init(this.User, this.documentId, this.documentCallbackUrl, 'fghhfgsjdgfjs', c_oEditorId.Spreadsheet, this.documentFormatSave);
};
......
......@@ -380,53 +380,6 @@ asc_docs_api.prototype._coAuthoringInitEnd = function() {
t.sync_ErrorCallback(isCloseCoAuthoring ? c_oAscError.ID.UserDrop : c_oAscError.ID.CoAuthoringDisconnect, c_oAscError.Level.NoCritical);
}
};
this.CoAuthoringApi.onDocumentOpen = function(inputWrap) {
if (inputWrap["data"]) {
var input = inputWrap["data"];
switch (input["type"]) {
case 'open':
{
switch (input["status"]) {
case "updateversion":
case "ok":
var urls = input["data"];
g_oDocumentUrls.init(urls);
if (null != urls['Editor.bin']) {
if ('ok' === input["status"] || editor.isViewMode) {
_onOpenCommand(function() {
}, {'data': urls['Editor.bin']});
} else {
editor.asc_fireCallback("asc_onDocumentUpdateVersion", function() {
if (editor.isCoAuthoringEnable) {
editor.asc_coAuthoringDisconnect();
}
_onOpenCommand(function() {
}, {'data': urls['Editor.bin']});
});
}
} else {
t.asc_fireCallback("asc_onError", c_oAscError.ID.ConvertationError, c_oAscError.Level.NoCritical);
}
break;
case "needparams":
break;
case "err":
t.asc_fireCallback("asc_onError", g_fMapAscServerErrorToAscError(parseInt(input["data"])), c_oAscError.Level.Critical);
break;
}
}
break;
default:
if (t.fCurCallback) {
t.fCurCallback(input);
t.fCurCallback = null;
} else {
t.asc_fireCallback("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.NoCritical);
}
break;
}
}
};
this.CoAuthoringApi.init(this.User, this.documentId, this.documentCallbackUrl, 'fghhfgsjdgfjs', c_oEditorId.Presentation, this.documentFormatSave);
};
......@@ -4857,21 +4810,20 @@ asc_docs_api.prototype.sync_ContextMenuCallback = function(Data)
this.asc_fireCallback("asc_onContextMenu", Data);
};
function _onOpenCommand(fCallback, incomeObject) {
g_fOpenFileCommand(incomeObject["data"], editor.documentUrlChanges, c_oSerFormat.Signature, function (error, result) {
asc_docs_api.prototype._onOpenCommand = function(data) {
var t = this;
g_fOpenFileCommand(data, this.documentUrlChanges, c_oSerFormat.Signature, function (error, result) {
if (error || !result.bSerFormat) {
editor.asc_fireCallback("asc_onError",c_oAscError.ID.Unknown,c_oAscError.Level.Critical);
if(fCallback) fCallback();
t.asc_fireCallback("asc_onError",c_oAscError.ID.Unknown,c_oAscError.Level.Critical);
return;
}
editor.OpenDocument2(result.url, result.data);
editor.DocumentOrientation = (null == editor.WordControl.m_oLogicDocument) ? true : !editor.WordControl.m_oLogicDocument.Orientation;
editor.sync_DocSizeCallback(Page_Width, Page_Height);
editor.sync_PageOrientCallback(editor.get_DocumentOrientation());
if(fCallback) fCallback();
t.OpenDocument2(result.url, result.data);
t.DocumentOrientation = (null == t.WordControl.m_oLogicDocument) ? true : !t.WordControl.m_oLogicDocument.Orientation;
t.sync_DocSizeCallback(Page_Width, Page_Height);
t.sync_PageOrientCallback(t.get_DocumentOrientation());
});
}
};
function _downloadAs(editor, filetype, actionType, options)
{
if (!options) {
......
......@@ -442,7 +442,6 @@ CContextMenuData.prototype['get_Type'] = CContextMenuData.prototype.get_Type;
CContextMenuData.prototype['get_X'] = CContextMenuData.prototype.get_X;
CContextMenuData.prototype['get_Y'] = CContextMenuData.prototype.get_Y;
CContextMenuData.prototype['get_IsSlideSelect'] = CContextMenuData.prototype.get_IsSlideSelect;
window['_onOpenCommand'] = _onOpenCommand;
window['_downloadAs'] = _downloadAs;
window['CAscSlideTiming'] = CAscSlideTiming;
CAscSlideTiming.prototype['put_TransitionType'] = CAscSlideTiming.prototype.put_TransitionType;
......
......@@ -1081,56 +1081,6 @@ asc_docs_api.prototype._coAuthoringInitEnd = function() {
t.sync_ErrorCallback(isCloseCoAuthoring ? c_oAscError.ID.UserDrop : c_oAscError.ID.CoAuthoringDisconnect, c_oAscError.Level.NoCritical);
}
};
this.CoAuthoringApi.onDocumentOpen = function(inputWrap) {
if (inputWrap["data"]) {
var input = inputWrap["data"];
switch (input["type"]) {
case 'reopen':
case 'open':
{
switch (input["status"]) {
case "updateversion":
case "ok":
var urls = input["data"];
g_oDocumentUrls.init(urls);
if (null != urls['Editor.bin']) {
if ('ok' === input["status"] || editor.isViewMode) {
_onOpenCommand(function() {
}, {'data': urls['Editor.bin']});
} else {
editor.asc_fireCallback("asc_onDocumentUpdateVersion", function() {
if (editor.isCoAuthoringEnable) {
editor.asc_coAuthoringDisconnect();
}
_onOpenCommand(function() {
}, {'data': urls['Editor.bin']});
});
}
} else {
t.asc_fireCallback("asc_onError", c_oAscError.ID.ConvertationError, c_oAscError.Level.Critical);
}
break;
case "needparams":
var cp = {'codepage': c_oAscCodePageUtf8, 'encodings': getEncodingParams()};
t.asc_fireCallback("asc_onAdvancedOptions", new asc.asc_CAdvancedOptions(c_oAscAdvancedOptionsID.TXT, cp), t.advancedOptionsAction);
break;
case "err":
t.asc_fireCallback("asc_onError", g_fMapAscServerErrorToAscError(parseInt(input["data"])), c_oAscError.Level.Critical);
break;
}
}
break;
default:
if (t.fCurCallback) {
t.fCurCallback(input);
t.fCurCallback = null;
} else {
t.asc_fireCallback("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.NoCritical);
}
break;
}
}
};
this.CoAuthoringApi.init(this.User, this.documentId, this.documentCallbackUrl, 'fghhfgsjdgfjs', c_oEditorId.Word, this.documentFormatSave);
};
......@@ -6457,26 +6407,29 @@ window["asc_nativeOnSpellCheck"] = function (response)
editor.SpellCheckApi.onSpellCheck(response);
};
function _onOpenCommand(fCallback, incomeObject) {
g_fOpenFileCommand(incomeObject["data"], editor.documentUrlChanges, c_oSerFormat.Signature, function (error, result) {
asc_docs_api.prototype._onNeedParams = function(data) {
var cp = {'codepage': c_oAscCodePageUtf8, 'encodings': getEncodingParams()};
this.asc_fireCallback("asc_onAdvancedOptions", new asc.asc_CAdvancedOptions(c_oAscAdvancedOptionsID.TXT, cp), this.advancedOptionsAction);
};
asc_docs_api.prototype._onOpenCommand = function(data) {
var t = this;
g_fOpenFileCommand(data, this.documentUrlChanges, c_oSerFormat.Signature, function (error, result) {
if (error) {
editor.asc_fireCallback("asc_onError",c_oAscError.ID.Unknown,c_oAscError.Level.Critical);
if(fCallback) fCallback();
t.asc_fireCallback("asc_onError",c_oAscError.ID.Unknown,c_oAscError.Level.Critical);
return;
}
if (result.changes && editor.VersionHistory) {
editor.VersionHistory.changes = result.changes;
editor.VersionHistory.applyChanges(editor);
if (result.changes && t.VersionHistory) {
t.VersionHistory.changes = result.changes;
t.VersionHistory.applyChanges(t);
}
if (result.bSerFormat)
editor.OpenDocument2(result.url, result.data);
t.OpenDocument2(result.url, result.data);
else
editor.OpenDocument(result.url, result.data);
if(fCallback) fCallback();
t.OpenDocument(result.url, result.data);
});
}
};
function _downloadAs(editor, command, filetype, actionType, options, fCallbackRequest) {
if (!options) {
options = {};
......
......@@ -727,7 +727,6 @@ asc_CCommentDataWord.prototype['asc_putSolved'] = asc_CCommentDataWord.prototype
asc_CCommentDataWord.prototype['asc_getReply'] = asc_CCommentDataWord.prototype.asc_getReply;
asc_CCommentDataWord.prototype['asc_addReply'] = asc_CCommentDataWord.prototype.asc_addReply;
asc_CCommentDataWord.prototype['asc_getRepliesCount'] = asc_CCommentDataWord.prototype.asc_getRepliesCount;
window['_onOpenCommand'] = _onOpenCommand;
window['_downloadAs'] = _downloadAs;
window['_addImageUrl2'] = _addImageUrl2;
window['_isDocumentModified2'] = _isDocumentModified2;
......
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