Commit 97e14bf6 authored by Alexander.Trofimov's avatar Alexander.Trofimov

common/docscoapicommon and common/docscoapi to function-closure

parent b4323f09
......@@ -1592,7 +1592,7 @@ var editor;
this.collaborativeEditing.sendChanges(this.IsUserSave);
} else {
nState = t.CoAuthoringApi.get_state();
if (ConnectionState.Close === nState) {
if (AscCommon.ConnectionState.Close === nState) {
// Отключаемся от сохранения, соединение потеряно
if (this.IsUserSave) {
this.sync_EndAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.Save);
......@@ -3103,7 +3103,7 @@ var editor;
this.SpellCheckUrl = '';
this.User = new asc.asc_CUser();
this.User = new AscCommon.asc_CUser();
this.User.setId("TM");
this.User.setUserName("native");
......
......@@ -46,12 +46,15 @@ var History = {};
window["Asc"] = {};
var Asc = window["Asc"];
window["AscCommonExcel"] = {};
var AscCommonExcel = window["AscCommonExcel"];
window["AscBrowser"] = {};
var AscBrowser = window["AscBrowser"];
window["AscCommon"] = {};
var AscCommon = window["AscCommon"];
window["AscCommonExcel"] = {};
var AscCommonExcel = window["AscCommonExcel"];
//-------------------------------------------------------------------------------------------------
aStandartNumFormats = [];
aStandartNumFormats[0] = "General";
......
......@@ -191,11 +191,11 @@ function DesktopOfflineUpdateLocalName(_api)
window["AscDesktopEditor"]["SetDocumentName"](_name);
}
Asc.CDocsCoApi.prototype.askSaveChanges = function(callback)
AscCommon.CDocsCoApi.prototype.askSaveChanges = function(callback)
{
callback({"saveLock": false});
};
Asc.CDocsCoApi.prototype.saveChanges = function(arrayChanges, deleteIndex, excelAdditionalInfo)
AscCommon.CDocsCoApi.prototype.saveChanges = function(arrayChanges, deleteIndex, excelAdditionalInfo)
{
window["AscDesktopEditor"]["LocalFileSaveChanges"](arrayChanges.join("\",\""), deleteIndex, arrayChanges.length);
//this.onUnSaveLock();
......
......@@ -186,8 +186,9 @@ native_canvas.prototype =
};
window["Asc"] = {};
window["AscCommonExcel"] = {};
window["AscBrowser"] = {};
window["AscCommon"] = {};
window["AscCommonExcel"] = {};
var _null_object = {};
_null_object.length = 0;
......@@ -281,8 +282,9 @@ function GetNativeEngine()
var native_renderer = null;
var _api = null;
var Asc = window["Asc"];
var AscCommonExcel = window["AscCommonExcel"];
var AscBrowser = window["AscBrowser"];
var AscCommon = window["AscCommon"];
var AscCommonExcel = window["AscCommonExcel"];
function NativeOpenFileData(data, version)
{
......
......@@ -92,7 +92,7 @@ function baseEditorsApi(name) {
// CoAuthoring and Chat
this.User = undefined;
this.CoAuthoringApi = new Asc.CDocsCoApi();
this.CoAuthoringApi = new AscCommon.CDocsCoApi();
this.isCoAuthoringEnable = true;
// Массив lock-ов, которые были на открытии документа
this.arrPreOpenLocksObjects = [];
......@@ -190,7 +190,7 @@ baseEditorsApi.prototype.asc_setDocInfo = function(oDocInfo) {
this.documentOpenOptions = this.DocInfo.asc_getOptions();
this.User = new Asc.asc_CUser();
this.User = new AscCommon.asc_CUser();
this.User.setId(this.DocInfo.get_UserId());
this.User.setUserName(this.DocInfo.get_UserName());
}
......@@ -395,7 +395,7 @@ baseEditorsApi.prototype._coAuthoringInit = function() {
var t = this;
//Если User не задан, отключаем коавторинг.
if (null == this.User || null == this.User.asc_getId()) {
this.User = new Asc.asc_CUser();
this.User = new AscCommon.asc_CUser();
this.User.setId("Unknown");
this.User.setUserName("Unknown");
}
......@@ -443,7 +443,7 @@ baseEditorsApi.prototype._coAuthoringInit = function() {
* @param {Bool} isCloseCoAuthoring
*/
this.CoAuthoringApi.onDisconnect = function(e, isDisconnectAtAll, isCloseCoAuthoring) {
if (ConnectionState.None === t.CoAuthoringApi.get_state()) {
if (AscCommon.ConnectionState.None === t.CoAuthoringApi.get_state()) {
t.asyncServerIdEndLoaded();
}
if (isDisconnectAtAll) {
......
......@@ -27,8 +27,8 @@
(function(window, undefined) {
'use strict';
var asc = window["Asc"];
var asc_coAuthV = '3.0.9';
var ConnectionState = AscCommon.ConnectionState;
// Класс надстройка, для online и offline работы
function CDocsCoApi(options) {
......@@ -1019,7 +1019,7 @@
if (participants) {
var tmpUser;
for (var i = 0; i < participants.length; ++i) {
tmpUser = new asc.asc_CUser(participants[i]);
tmpUser = new AscCommon.asc_CUser(participants[i]);
this._participants[tmpUser.asc_getId()] = tmpUser;
// Считаем только число редакторов
if (!tmpUser.asc_getView()) {
......@@ -1044,7 +1044,7 @@
DocsCoApi.prototype._onConnectionStateChanged = function(data) {
var userStateChanged = null, userId, stateChanged = false, isEditUser = true;
if (this.onConnectionStateChanged) {
userStateChanged = new asc.asc_CUser(data['user']);
userStateChanged = new AscCommon.asc_CUser(data['user']);
userStateChanged.setState(data["state"]);
userId = userStateChanged.asc_getId();
......@@ -1336,5 +1336,7 @@
return window['SockJS'] ? window['SockJS'] : require('sockjs');
};
asc.CDocsCoApi = CDocsCoApi;
//----------------------------------------------------------export----------------------------------------------------
window['AscCommon'] = window['AscCommon'] || {};
window['AscCommon'].CDocsCoApi = CDocsCoApi;
})(window);
\ No newline at end of file
......@@ -34,13 +34,6 @@
* @param {undefined} undefined
*/
function(window, undefined) {
/*
* Import
* -----------------------------------------------------------------------------
*/
var asc = window["Asc"] ? window["Asc"] : (window["Asc"] = {});
var prot;
/**
* Класс user для совместного редактирования/просмотра документа
* -----------------------------------------------------------------------------
......@@ -96,26 +89,30 @@
this.state = val;
};
var ConnectionState = {
Reconnect: -1, // reconnect state
None: 0, // not initialized
WaitAuth: 1, // waiting session id
Authorized: 2, // authorized
ClosedCoAuth: 3, // closed coauthoring
ClosedAll: 4, // closed all
SaveChanges: 10 // save
};
/*
* Export
* -----------------------------------------------------------------------------
*/
window["Asc"].asc_CUser = asc_CUser;
var prot;
window['AscCommon'] = window['AscCommon'] || {};
window["AscCommon"].asc_CUser = asc_CUser;
prot = asc_CUser.prototype;
prot["asc_getId"] = prot.asc_getId;
prot["asc_getUserName"] = prot.asc_getUserName;
prot["asc_getState"] = prot.asc_getState;
prot["asc_getColor"] = prot.asc_getColor;
prot["asc_getView"] = prot.asc_getView;
})(window);
var ConnectionState = {
Reconnect: -1, // reconnect state
None: 0, // not initialized
WaitAuth: 1, // waiting session id
Authorized: 2, // authorized
ClosedCoAuth: 3, // closed coauthoring
ClosedAll: 4, // closed all
SaveChanges: 10 // save
};
\ No newline at end of file
window["AscCommon"].ConnectionState = ConnectionState;
})(window);
......@@ -1195,7 +1195,7 @@ function OnSave_Callback(e) {
CollaborativeEditing.Send_Changes(editor.IsUserSave, {UserId: editor.CoAuthoringApi.getUserConnectionId(), UserShortId : editor.DocInfo.get_UserId(), CursorInfo: CursorInfo});
} else {
var nState = editor.CoAuthoringApi.get_state();
if (ConnectionState.Close === nState) {
if (AscCommon.ConnectionState.Close === nState) {
// Отключаемся от сохранения, соединение потеряно
editor.canSave = true;
editor.IsUserSave = false;
......@@ -4795,7 +4795,7 @@ window["asc_docs_api"].prototype["asc_nativeOpenFile"] = function(base64File, ve
{
this.SpellCheckUrl = '';
this.User = new Asc.asc_CUser();
this.User = new AscCommon.asc_CUser();
this.User.setId("TM");
this.User.setUserName("native");
......
......@@ -1986,7 +1986,7 @@ function OnSave_Callback(e) {
CollaborativeEditing.Send_Changes(editor.IsUserSave, {UserId: editor.CoAuthoringApi.getUserConnectionId(), UserShortId : editor.DocInfo.get_UserId(), CursorInfo: CursorInfo}, HaveOtherChanges);
} else {
var nState = editor.CoAuthoringApi.get_state();
if (ConnectionState.Close === nState) {
if (AscCommon.ConnectionState.Close === nState) {
// Отключаемся от сохранения, соединение потеряно
editor.canSave = true;
editor.IsUserSave = false;
......@@ -7145,7 +7145,7 @@ window["asc_docs_api"].prototype["asc_nativeOpenFile"] = function(base64File, ve
{
this.SpellCheckUrl = '';
this.User = new Asc.asc_CUser();
this.User = new AscCommon.asc_CUser();
this.User.setId("TM");
this.User.setUserName("native");
......@@ -7189,11 +7189,11 @@ window["asc_docs_api"].prototype["asc_nativeOpenFile"] = function(base64File, ve
if (window["NATIVE_EDITOR_ENJINE"] === true && undefined != window["native"])
{
Asc.CDocsCoApi.prototype.askSaveChanges = function(callback)
AscCommon.CDocsCoApi.prototype.askSaveChanges = function(callback)
{
callback({"saveLock": false});
};
Asc.CDocsCoApi.prototype.saveChanges = function(arrayChanges, deleteIndex, excelAdditionalInfo)
AscCommon.CDocsCoApi.prototype.saveChanges = function(arrayChanges, deleteIndex, excelAdditionalInfo)
{
if (window["native"]["SaveChanges"])
window["native"]["SaveChanges"](arrayChanges.join("\",\""), deleteIndex, arrayChanges.length);
......
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