Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
a924c358
Commit
a924c358
authored
Apr 14, 2016
by
Alexander.Trofimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
common/docscoapicommon and common/docscoapi to function-closure
parent
90bd4283
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
47 additions
and
24 deletions
+47
-24
cell/api.js
cell/api.js
+2
-2
cell/native/native.js
cell/native/native.js
+6
-3
common/Local/common.js
common/Local/common.js
+2
-2
common/Native/native.js
common/Native/native.js
+4
-2
common/apiBase.js
common/apiBase.js
+4
-4
common/docscoapi.js
common/docscoapi.js
+6
-4
common/docscoapicommon.js
common/docscoapicommon.js
+17
-1
slide/api.js
slide/api.js
+2
-2
word/api.js
word/api.js
+4
-4
No files found.
cell/api.js
View file @
a924c358
...
...
@@ -1568,7 +1568,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
);
...
...
@@ -3079,7 +3079,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
"
);
...
...
cell/native/native.js
View file @
a924c358
...
...
@@ -22,12 +22,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
"
;
...
...
common/Local/common.js
View file @
a924c358
...
...
@@ -167,11 +167,11 @@ function DesktopOfflineUpdateLocalName(_api)
window
[
"
AscDesktopEditor
"
][
"
SetDocumentName
"
](
_name
);
}
Asc
.
CDocsCoApi
.
prototype
.
askSaveChanges
=
function
(
callback
)
Asc
Common
.
CDocsCoApi
.
prototype
.
askSaveChanges
=
function
(
callback
)
{
callback
({
"
saveLock
"
:
false
});
};
Asc
.
CDocsCoApi
.
prototype
.
saveChanges
=
function
(
arrayChanges
,
deleteIndex
,
excelAdditionalInfo
)
Asc
Common
.
CDocsCoApi
.
prototype
.
saveChanges
=
function
(
arrayChanges
,
deleteIndex
,
excelAdditionalInfo
)
{
window
[
"
AscDesktopEditor
"
][
"
LocalFileSaveChanges
"
](
arrayChanges
.
join
(
"
\"
,
\"
"
),
deleteIndex
,
arrayChanges
.
length
);
//this.onUnSaveLock();
...
...
common/Native/native.js
View file @
a924c358
...
...
@@ -162,8 +162,9 @@ native_canvas.prototype =
};
window
[
"
Asc
"
]
=
{};
window
[
"
AscCommonExcel
"
]
=
{};
window
[
"
AscBrowser
"
]
=
{};
window
[
"
AscCommon
"
]
=
{};
window
[
"
AscCommonExcel
"
]
=
{};
var
_null_object
=
{};
_null_object
.
length
=
0
;
...
...
@@ -257,8 +258,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
)
{
...
...
common/apiBase.js
View file @
a924c358
...
...
@@ -68,7 +68,7 @@ function baseEditorsApi(name) {
// CoAuthoring and Chat
this
.
User
=
undefined
;
this
.
CoAuthoringApi
=
new
Asc
.
CDocsCoApi
();
this
.
CoAuthoringApi
=
new
Asc
Common
.
CDocsCoApi
();
this
.
isCoAuthoringEnable
=
true
;
// Массив lock-ов, которые были на открытии документа
this
.
arrPreOpenLocksObjects
=
[];
...
...
@@ -166,7 +166,7 @@ baseEditorsApi.prototype.asc_setDocInfo = function(oDocInfo) {
this
.
documentOpenOptions
=
this
.
DocInfo
.
asc_getOptions
();
this
.
User
=
new
Asc
.
asc_CUser
();
this
.
User
=
new
Asc
Common
.
asc_CUser
();
this
.
User
.
setId
(
this
.
DocInfo
.
get_UserId
());
this
.
User
.
setUserName
(
this
.
DocInfo
.
get_UserName
());
}
...
...
@@ -371,7 +371,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
Asc
Common
.
asc_CUser
();
this
.
User
.
setId
(
"
Unknown
"
);
this
.
User
.
setUserName
(
"
Unknown
"
);
}
...
...
@@ -419,7 +419,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
)
{
...
...
common/docscoapi.js
View file @
a924c358
...
...
@@ -3,8 +3,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
)
{
...
...
@@ -995,7 +995,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
())
{
...
...
@@ -1020,7 +1020,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
();
...
...
@@ -1312,5 +1312,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
common/docscoapicommon.js
View file @
a924c358
"
use strict
"
;
/* docscoapicommon.js * * Author: Alexander.Trofimov * Date: 09.11.12 */
(
/** * @param {Window} window * @param {undefined} undefined */
function
(
window
,
undefined
)
{
/* * Import * ----------------------------------------------------------------------------- */
var
asc
=
window
[
"
Asc
"
]
?
window
[
"
Asc
"
]
:
(
window
[
"
Asc
"
]
=
{});
var
prot
;
/** * Класс user для совместного редактирования/просмотра документа * ----------------------------------------------------------------------------- * * @constructor * @memberOf Asc */
function
asc_CUser
(
val
)
{
this
.
id
=
null
;
// уникальный id - пользователя this.idOriginal = null; // уникальный id - пользователя this.userName = null; // имя пользователя this.state = undefined; // состояние (true - подключен, false - отключился) this.indexUser = -1; // Индекс пользователя (фактически равно числу заходов в документ на сервере) this.color = null; // цвет пользователя this.view = false; // просмотр(true), редактор(false) this._setUser(val); return this; } asc_CUser.prototype._setUser = function(val) { if (val) { this.id = val['id']; this.idOriginal = val['idOriginal']; this.userName = val['username']; this.indexUser = val['indexUser']; this.color = getUserColorById(this.idOriginal, this.userName, false, true); this.view = val['view']; } }; asc_CUser.prototype.asc_getId = function() { return this.id; }; asc_CUser.prototype.asc_getUserName = function() { return this.userName; }; asc_CUser.prototype.asc_getState = function() { return this.state; }; asc_CUser.prototype.asc_getColor = function() { return '#' + ('000000' + this.color.toString(16)).substr(-6); }; asc_CUser.prototype.asc_getView = function() { return this.view; }; asc_CUser.prototype.setId = function(val) { this.id = val; }; asc_CUser.prototype.setUserName = function(val) { this.userName = val; }; asc_CUser.prototype.setState = function(val) { this.state = val; }; /* * Export * ----------------------------------------------------------------------------- */ window["Asc"].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
"
use strict
"
;
/* docscoapicommon.js * * Author: Alexander.Trofimov * Date: 09.11.12 */
(
/** * @param {Window} window * @param {undefined} undefined */
function
(
window
,
undefined
)
{
/** * Класс user для совместного редактирования/просмотра документа * ----------------------------------------------------------------------------- * * @constructor * @memberOf Asc */
function
asc_CUser
(
val
)
{
this
.
id
=
null
;
// уникальный id - пользователя this.idOriginal = null; // уникальный id - пользователя this.userName = null; // имя пользователя this.state = undefined; // состояние (true - подключен, false - отключился) this.indexUser = -1; // Индекс пользователя (фактически равно числу заходов в документ на сервере) this.color = null; // цвет пользователя this.view = false; // просмотр(true), редактор(false) this._setUser(val); return this; } asc_CUser.prototype._setUser = function(val) { if (val) { this.id = val['id']; this.idOriginal = val['idOriginal']; this.userName = val['username']; this.indexUser = val['indexUser']; this.color = getUserColorById(this.idOriginal, this.userName, false, true); this.view = val['view']; } }; asc_CUser.prototype.asc_getId = function() { return this.id; }; asc_CUser.prototype.asc_getUserName = function() { return this.userName; }; asc_CUser.prototype.asc_getState = function() { return this.state; }; asc_CUser.prototype.asc_getColor = function() { return '#' + ('000000' + this.color.toString(16)).substr(-6); }; asc_CUser.prototype.asc_getView = function() { return this.view; }; asc_CUser.prototype.setId = function(val) { this.id = val; }; asc_CUser.prototype.setUserName = function(val) { this.userName = val; }; asc_CUser.prototype.setState = function(val) { 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 * ----------------------------------------------------------------------------- */
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
[
"
AscCommon
"
].
ConnectionState
=
ConnectionState
;
})(
window
);
\ No newline at end of file
...
...
slide/api.js
View file @
a924c358
...
...
@@ -1171,7 +1171,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
;
...
...
@@ -4771,7 +4771,7 @@ window["asc_docs_api"].prototype["asc_nativeOpenFile"] = function(base64File, ve
{
this
.
SpellCheckUrl
=
''
;
this
.
User
=
new
Asc
.
asc_CUser
();
this
.
User
=
new
Asc
Common
.
asc_CUser
();
this
.
User
.
setId
(
"
TM
"
);
this
.
User
.
setUserName
(
"
native
"
);
...
...
word/api.js
View file @
a924c358
...
...
@@ -1962,7 +1962,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
;
...
...
@@ -7121,7 +7121,7 @@ window["asc_docs_api"].prototype["asc_nativeOpenFile"] = function(base64File, ve
{
this
.
SpellCheckUrl
=
''
;
this
.
User
=
new
Asc
.
asc_CUser
();
this
.
User
=
new
Asc
Common
.
asc_CUser
();
this
.
User
.
setId
(
"
TM
"
);
this
.
User
.
setUserName
(
"
native
"
);
...
...
@@ -7165,11 +7165,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
)
Asc
Common
.
CDocsCoApi
.
prototype
.
askSaveChanges
=
function
(
callback
)
{
callback
({
"
saveLock
"
:
false
});
};
Asc
.
CDocsCoApi
.
prototype
.
saveChanges
=
function
(
arrayChanges
,
deleteIndex
,
excelAdditionalInfo
)
Asc
Common
.
CDocsCoApi
.
prototype
.
saveChanges
=
function
(
arrayChanges
,
deleteIndex
,
excelAdditionalInfo
)
{
if
(
window
[
"
native
"
][
"
SaveChanges
"
])
window
[
"
native
"
][
"
SaveChanges
"
](
arrayChanges
.
join
(
"
\"
,
\"
"
),
deleteIndex
,
arrayChanges
.
length
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment