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
3d536247
Commit
3d536247
authored
Apr 06, 2017
by
Alexey.Musinov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
open documents with password (ios)
parent
83d09cb5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
201 additions
and
120 deletions
+201
-120
cell/native/common.js
cell/native/common.js
+8
-8
cell/native/native.js
cell/native/native.js
+94
-57
common/Native/Wrappers/api.js
common/Native/Wrappers/api.js
+99
-55
No files found.
cell/native/common.js
View file @
3d536247
...
@@ -300,7 +300,7 @@ function setTimeout(func, interval) {
...
@@ -300,7 +300,7 @@ function setTimeout(func, interval) {
var
id
=
window
[
"
native
"
][
"
GenerateTimeoutId
"
](
interval
);
var
id
=
window
[
"
native
"
][
"
GenerateTimeoutId
"
](
interval
);
window
.
NativeTimeoutObject
[
""
+
id
]
=
{
"
func
"
:
func
,
repeat
:
false
};
window
.
NativeTimeoutObject
[
""
+
id
]
=
{
"
func
"
:
func
,
repeat
:
false
};
return
id
;
return
id
;
}
}
...
@@ -318,7 +318,7 @@ function setInterval(func, interval) {
...
@@ -318,7 +318,7 @@ function setInterval(func, interval) {
var
id
=
window
[
"
native
"
][
"
GenerateTimeoutId
"
](
interval
);
var
id
=
window
[
"
native
"
][
"
GenerateTimeoutId
"
](
interval
);
window
.
NativeTimeoutObject
[
""
+
id
]
=
{
func
:
func
,
repeat
:
true
,
interval
:
interval
};
window
.
NativeTimeoutObject
[
""
+
id
]
=
{
func
:
func
,
repeat
:
true
,
interval
:
interval
};
return
id
;
return
id
;
}
}
function
clearInterval
(
id
)
{
function
clearInterval
(
id
)
{
...
@@ -334,26 +334,26 @@ function offline_timeoutFire(id) {
...
@@ -334,26 +334,26 @@ function offline_timeoutFire(id) {
return
;
return
;
var
prop
=
""
+
id
;
var
prop
=
""
+
id
;
if
(
undefined
===
window
.
NativeTimeoutObject
[
prop
])
{
if
(
undefined
===
window
.
NativeTimeoutObject
[
prop
])
{
return
;
return
;
}
}
var
func
=
window
.
NativeTimeoutObject
[
prop
].
func
;
var
func
=
window
.
NativeTimeoutObject
[
prop
].
func
;
var
repeat
=
window
.
NativeTimeoutObject
[
prop
].
repeat
;
var
repeat
=
window
.
NativeTimeoutObject
[
prop
].
repeat
;
var
interval
=
window
.
NativeTimeoutObject
[
prop
].
interval
;
var
interval
=
window
.
NativeTimeoutObject
[
prop
].
interval
;
window
.
NativeTimeoutObject
[
prop
]
=
undefined
;
window
.
NativeTimeoutObject
[
prop
]
=
undefined
;
if
(
!
func
)
if
(
!
func
)
return
;
return
;
func
.
call
(
null
);
func
.
call
(
null
);
if
(
repeat
)
{
if
(
repeat
)
{
setInterval
(
func
,
interval
);
setInterval
(
func
,
interval
);
}
}
func
=
null
;
func
=
null
;
}
}
...
@@ -363,7 +363,7 @@ window.clearInterval = clearInterval;
...
@@ -363,7 +363,7 @@ window.clearInterval = clearInterval;
window
.
setInterval
=
setInterval
;
window
.
setInterval
=
setInterval
;
var
console
=
{
var
console
=
{
log
:
function
(
param
)
{
window
.
native
.
consoleLog
(
param
);
},
log
:
function
(
param
)
{
window
[
"
native
"
][
"
consoleLog
"
]
(
param
);
},
time
:
function
(
param
)
{},
time
:
function
(
param
)
{},
timeEnd
:
function
(
param
)
{}
timeEnd
:
function
(
param
)
{}
};
};
...
...
cell/native/native.js
View file @
3d536247
...
@@ -3887,6 +3887,8 @@ function OfflineEditor () {
...
@@ -3887,6 +3887,8 @@ function OfflineEditor () {
var
docInfo
=
new
Asc
.
asc_CDocInfo
();
var
docInfo
=
new
Asc
.
asc_CDocInfo
();
docInfo
.
put_Id
(
this
.
initSettings
[
"
docKey
"
]);
docInfo
.
put_Id
(
this
.
initSettings
[
"
docKey
"
]);
docInfo
.
put_Url
(
this
.
initSettings
[
"
docURL
"
]);
docInfo
.
put_Format
(
"
xlsx
"
);
docInfo
.
put_UserInfo
(
userInfo
);
docInfo
.
put_UserInfo
(
userInfo
);
_api
.
asc_setDocInfo
(
docInfo
);
_api
.
asc_setDocInfo
(
docInfo
);
...
@@ -3904,7 +3906,7 @@ function OfflineEditor () {
...
@@ -3904,7 +3906,7 @@ function OfflineEditor () {
this
.
asc_WriteAllWorksheets
(
true
);
this
.
asc_WriteAllWorksheets
(
true
);
_api
.
sendColorThemes
(
_api
.
wbModel
.
theme
);
_api
.
sendColorThemes
(
_api
.
wbModel
.
theme
);
_api
.
asc_ApplyColorScheme
(
false
);
_api
.
asc_ApplyColorScheme
(
false
);
_api
.
_applyFirstLoadChanges
();
_api
.
_applyFirstLoadChanges
();
...
@@ -3914,8 +3916,8 @@ function OfflineEditor () {
...
@@ -3914,8 +3916,8 @@ function OfflineEditor () {
ws
.
_fixSelectionOfMergedCells
();
ws
.
_fixSelectionOfMergedCells
();
if
(
ws
.
topLeftFrozenCell
)
{
if
(
ws
.
topLeftFrozenCell
)
{
this
.
row0
=
ws
.
topLeftFrozenCell
.
getRow0
();
this
.
row0
=
ws
.
topLeftFrozenCell
.
getRow0
();
this
.
col0
=
ws
.
topLeftFrozenCell
.
getCol0
();
this
.
col0
=
ws
.
topLeftFrozenCell
.
getCol0
();
}
}
// TODO: Implement frozen places
// TODO: Implement frozen places
...
@@ -4077,6 +4079,13 @@ function OfflineEditor () {
...
@@ -4077,6 +4079,13 @@ function OfflineEditor () {
me
.
needToUpdateVersion
=
true
;
me
.
needToUpdateVersion
=
true
;
if
(
callback
)
callback
.
call
(
me
);
if
(
callback
)
callback
.
call
(
me
);
});
});
_api
.
asc_registerCallback
(
"
asc_onAdvancedOptions
"
,
function
(
options
)
{
var
stream
=
global_memory_stream_menu
;
stream
[
"
ClearNoAttack
"
]();
stream
[
"
WriteLong
"
](
options
.
asc_getOptionId
());
window
[
"
native
"
][
"
OnCallMenuEvent
"
](
22000
,
stream
);
// ASC_MENU_EVENT_TYPE_ADVANCED_OPTIONS
});
};
};
this
.
updateFrozen
=
function
()
{
this
.
updateFrozen
=
function
()
{
var
ws
=
_api
.
wb
.
getWorksheet
();
var
ws
=
_api
.
wb
.
getWorksheet
();
...
@@ -7362,60 +7371,66 @@ window["native"]["offline_apply_event"] = function(type,params) {
...
@@ -7362,60 +7371,66 @@ window["native"]["offline_apply_event"] = function(type,params) {
// console.log("JS - " + dataObject['type']);
// console.log("JS - " + dataObject['type']);
switch
(
dataObject
[
'
type
'
])
{
switch
(
dataObject
[
'
type
'
])
{
case
'
auth
'
:
case
'
auth
'
:
t
.
_onAuth
(
dataObject
);
t
.
_onAuth
(
dataObject
);
break
;
break
;
case
'
message
'
:
case
'
message
'
:
t
.
_onMessages
(
dataObject
,
false
);
t
.
_onMessages
(
dataObject
,
false
);
break
;
break
;
case
'
cursor
'
:
case
'
cursor
'
:
t
.
_onCursor
(
dataObject
);
t
.
_onCursor
(
dataObject
);
break
;
break
;
case
'
meta
'
:
case
'
meta
'
:
t
.
_onMeta
(
dataObject
);
t
.
_onMeta
(
dataObject
);
break
;
break
;
case
'
getLock
'
:
case
'
getLock
'
:
t
.
_onGetLock
(
dataObject
);
t
.
_onGetLock
(
dataObject
);
break
;
break
;
case
'
releaseLock
'
:
case
'
releaseLock
'
:
t
.
_onReleaseLock
(
dataObject
);
t
.
_onReleaseLock
(
dataObject
);
break
;
break
;
case
'
connectState
'
:
case
'
connectState
'
:
t
.
_onConnectionStateChanged
(
dataObject
);
t
.
_onConnectionStateChanged
(
dataObject
);
break
;
break
;
case
'
saveChanges
'
:
case
'
saveChanges
'
:
t
.
_onSaveChanges
(
dataObject
);
t
.
_onSaveChanges
(
dataObject
);
break
;
break
;
case
'
saveLock
'
:
case
'
saveLock
'
:
t
.
_onSaveLock
(
dataObject
);
t
.
_onSaveLock
(
dataObject
);
break
;
break
;
case
'
unSaveLock
'
:
case
'
unSaveLock
'
:
t
.
_onUnSaveLock
(
dataObject
);
t
.
_onUnSaveLock
(
dataObject
);
break
;
break
;
case
'
savePartChanges
'
:
case
'
savePartChanges
'
:
t
.
_onSavePartChanges
(
dataObject
);
t
.
_onSavePartChanges
(
dataObject
);
break
;
break
;
case
'
drop
'
:
case
'
drop
'
:
t
.
_onDrop
(
dataObject
);
t
.
_onDrop
(
dataObject
);
break
;
break
;
case
'
waitAuth
'
:
/*Ждем, когда придет auth, документ залочен*/
case
'
waitAuth
'
:
/*Ждем, когда придет auth, документ залочен*/
break
;
break
;
case
'
error
'
:
/*Старая версия sdk*/
case
'
error
'
:
/*Старая версия sdk*/
t
.
_onDrop
(
dataObject
);
t
.
_onDrop
(
dataObject
);
break
;
break
;
case
'
documentOpen
'
:
case
'
documentOpen
'
:
t
.
_documentOpen
(
dataObject
);
t
.
_documentOpen
(
dataObject
);
break
;
break
;
case
'
warning
'
:
case
'
warning
'
:
t
.
_onWarning
(
dataObject
);
t
.
_onWarning
(
dataObject
);
break
;
break
;
case
'
license
'
:
case
'
license
'
:
t
.
_onLicense
(
dataObject
);
t
.
_onLicense
(
dataObject
);
break
;
break
;
case
'
session
'
:
case
'
session
'
:
t
.
_onSession
(
dataObject
);
t
.
_onSession
(
dataObject
);
break
;
break
;
}
case
'
refreshToken
'
:
t
.
_onRefreshToken
(
dataObject
[
"
messages
"
]);
break
;
case
'
expiredToken
'
:
t
.
_onExpiredToken
();
break
;
}
break
;
break
;
}
}
...
@@ -7451,6 +7466,12 @@ window["native"]["offline_apply_event"] = function(type,params) {
...
@@ -7451,6 +7466,12 @@ window["native"]["offline_apply_event"] = function(type,params) {
break
;
break
;
}
}
case
22001
:
// ASC_MENU_EVENT_TYPE_SET_PASSWORD
{
_api
.
asc_setDocumentPassword
(
params
[
0
]);
break
;
}
default
:
default
:
break
;
break
;
}
}
...
@@ -7458,6 +7479,22 @@ window["native"]["offline_apply_event"] = function(type,params) {
...
@@ -7458,6 +7479,22 @@ window["native"]["offline_apply_event"] = function(type,params) {
return
_return
;
return
_return
;
}
}
window
[
"
Asc
"
][
"
spreadsheet_api
"
].
prototype
.
asc_setDocumentPassword
=
function
(
password
)
{
var
v
=
{
"
id
"
:
this
.
documentId
,
"
userid
"
:
this
.
documentUserId
,
"
format
"
:
this
.
documentFormat
,
"
c
"
:
"
reopen
"
,
"
url
"
:
this
.
documentUrl
,
"
title
"
:
this
.
documentTitle
,
"
embeddedfonts
"
:
this
.
isUseEmbeddedCutFonts
,
"
password
"
:
password
};
AscCommon
.
sendCommand
(
this
,
null
,
v
);
};
function
testLockedObjects
()
{
function
testLockedObjects
()
{
var
ws
=
_api
.
wb
.
getWorksheet
();
var
ws
=
_api
.
wb
.
getWorksheet
();
...
...
common/Native/Wrappers/api.js
View file @
3d536247
...
@@ -2202,60 +2202,66 @@ Asc['asc_docs_api'].prototype["Call_Menu_Event"] = function(type, _params)
...
@@ -2202,60 +2202,66 @@ Asc['asc_docs_api'].prototype["Call_Menu_Event"] = function(type, _params)
// console.log("JS - " + dataObject['type']);
// console.log("JS - " + dataObject['type']);
switch
(
dataObject
[
'
type
'
])
{
switch
(
dataObject
[
'
type
'
])
{
case
'
auth
'
:
case
'
auth
'
:
t
.
_onAuth
(
dataObject
);
t
.
_onAuth
(
dataObject
);
break
;
break
;
case
'
message
'
:
case
'
message
'
:
t
.
_onMessages
(
dataObject
,
false
);
t
.
_onMessages
(
dataObject
,
false
);
break
;
break
;
case
'
cursor
'
:
case
'
cursor
'
:
t
.
_onCursor
(
dataObject
);
t
.
_onCursor
(
dataObject
);
break
;
break
;
case
'
meta
'
:
case
'
meta
'
:
t
.
_onMeta
(
dataObject
);
t
.
_onMeta
(
dataObject
);
break
;
break
;
case
'
getLock
'
:
case
'
getLock
'
:
t
.
_onGetLock
(
dataObject
);
t
.
_onGetLock
(
dataObject
);
break
;
break
;
case
'
releaseLock
'
:
case
'
releaseLock
'
:
t
.
_onReleaseLock
(
dataObject
);
t
.
_onReleaseLock
(
dataObject
);
break
;
break
;
case
'
connectState
'
:
case
'
connectState
'
:
t
.
_onConnectionStateChanged
(
dataObject
);
t
.
_onConnectionStateChanged
(
dataObject
);
break
;
break
;
case
'
saveChanges
'
:
case
'
saveChanges
'
:
t
.
_onSaveChanges
(
dataObject
);
t
.
_onSaveChanges
(
dataObject
);
break
;
break
;
case
'
saveLock
'
:
case
'
saveLock
'
:
t
.
_onSaveLock
(
dataObject
);
t
.
_onSaveLock
(
dataObject
);
break
;
break
;
case
'
unSaveLock
'
:
case
'
unSaveLock
'
:
t
.
_onUnSaveLock
(
dataObject
);
t
.
_onUnSaveLock
(
dataObject
);
break
;
break
;
case
'
savePartChanges
'
:
case
'
savePartChanges
'
:
t
.
_onSavePartChanges
(
dataObject
);
t
.
_onSavePartChanges
(
dataObject
);
break
;
break
;
case
'
drop
'
:
case
'
drop
'
:
t
.
_onDrop
(
dataObject
);
t
.
_onDrop
(
dataObject
);
break
;
break
;
case
'
waitAuth
'
:
/*Ждем, когда придет auth, документ залочен*/
case
'
waitAuth
'
:
/*Ждем, когда придет auth, документ залочен*/
break
;
break
;
case
'
error
'
:
/*Старая версия sdk*/
case
'
error
'
:
/*Старая версия sdk*/
t
.
_onDrop
(
dataObject
);
t
.
_onDrop
(
dataObject
);
break
;
break
;
case
'
documentOpen
'
:
case
'
documentOpen
'
:
t
.
_documentOpen
(
dataObject
);
t
.
_documentOpen
(
dataObject
);
break
;
break
;
case
'
warning
'
:
case
'
warning
'
:
t
.
_onWarning
(
dataObject
);
t
.
_onWarning
(
dataObject
);
break
;
break
;
case
'
license
'
:
case
'
license
'
:
t
.
_onLicense
(
dataObject
);
t
.
_onLicense
(
dataObject
);
break
;
break
;
case
'
session
'
:
case
'
session
'
:
t
.
_onSession
(
dataObject
);
t
.
_onSession
(
dataObject
);
break
;
break
;
}
case
'
refreshToken
'
:
t
.
_onRefreshToken
(
dataObject
[
"
messages
"
]);
break
;
case
'
expiredToken
'
:
t
.
_onExpiredToken
();
break
;
}
break
;
break
;
}
}
...
@@ -2294,12 +2300,42 @@ Asc['asc_docs_api'].prototype["Call_Menu_Event"] = function(type, _params)
...
@@ -2294,12 +2300,42 @@ Asc['asc_docs_api'].prototype["Call_Menu_Event"] = function(type, _params)
break
;
break
;
}
}
case
21001
:
// ASC_COAUTH_EVENT_TYPE_LOAD_URL_IMAGE
{
_api
.
WordControl
.
m_oDrawingDocument
.
ClearCachePages
();
_api
.
WordControl
.
m_oDrawingDocument
.
FirePaint
();
break
;
}
case
22001
:
// ASC_MENU_EVENT_TYPE_SET_PASSWORD
{
_api
.
asc_setDocumentPassword
(
_params
[
0
]);
break
;
}
default
:
default
:
break
;
break
;
}
}
return
_return
;
return
_return
;
};
};
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_setDocumentPassword
=
function
(
password
)
{
var
v
=
{
"
id
"
:
this
.
documentId
,
"
userid
"
:
this
.
documentUserId
,
"
format
"
:
this
.
documentFormat
,
"
c
"
:
"
reopen
"
,
"
url
"
:
this
.
documentUrl
,
"
title
"
:
this
.
documentTitle
,
"
embeddedfonts
"
:
this
.
isUseEmbeddedCutFonts
,
"
password
"
:
password
};
AscCommon
.
sendCommand
(
this
,
null
,
v
);
};
function
asc_menu_WriteHeaderFooterPr
(
_hdrftrPr
,
_stream
)
function
asc_menu_WriteHeaderFooterPr
(
_hdrftrPr
,
_stream
)
{
{
if
(
_hdrftrPr
.
Type
!==
undefined
&&
_hdrftrPr
.
Type
!==
null
)
if
(
_hdrftrPr
.
Type
!==
undefined
&&
_hdrftrPr
.
Type
!==
null
)
...
@@ -5787,10 +5823,19 @@ function NativeOpenFile3(_params, documentInfo)
...
@@ -5787,10 +5823,19 @@ function NativeOpenFile3(_params, documentInfo)
var
docInfo
=
new
Asc
.
asc_CDocInfo
();
var
docInfo
=
new
Asc
.
asc_CDocInfo
();
docInfo
.
put_Id
(
window
.
documentInfo
[
"
docKey
"
]);
docInfo
.
put_Id
(
window
.
documentInfo
[
"
docKey
"
]);
docInfo
.
put_Url
(
window
.
documentInfo
[
"
docURL
"
]);
docInfo
.
put_Format
(
"
docx
"
);
docInfo
.
put_UserInfo
(
userInfo
);
docInfo
.
put_UserInfo
(
userInfo
);
_api
.
asc_setDocInfo
(
docInfo
);
_api
.
asc_setDocInfo
(
docInfo
);
_api
.
asc_registerCallback
(
"
asc_onAdvancedOptions
"
,
function
(
options
)
{
var
stream
=
global_memory_stream_menu
;
stream
[
"
ClearNoAttack
"
]();
stream
[
"
WriteLong
"
](
options
.
asc_getOptionId
());
window
[
"
native
"
][
"
OnCallMenuEvent
"
](
22000
,
stream
);
// ASC_MENU_EVENT_TYPE_ADVANCED_OPTIONS
});
if
(
window
.
documentInfo
[
"
iscoauthoring
"
])
{
if
(
window
.
documentInfo
[
"
iscoauthoring
"
])
{
_api
.
isSpellCheckEnable
=
false
;
_api
.
isSpellCheckEnable
=
false
;
...
@@ -6000,7 +6045,6 @@ Asc['asc_docs_api'].prototype.openDocument = function(sData)
...
@@ -6000,7 +6045,6 @@ Asc['asc_docs_api'].prototype.openDocument = function(sData)
};
};
window
[
"
AscCommon
"
].
getFullImageSrc2
=
function
(
src
)
{
window
[
"
AscCommon
"
].
getFullImageSrc2
=
function
(
src
)
{
var
start
=
src
.
slice
(
0
,
6
);
var
start
=
src
.
slice
(
0
,
6
);
if
(
0
===
start
.
indexOf
(
'
theme
'
)
&&
editor
.
ThemeLoader
){
if
(
0
===
start
.
indexOf
(
'
theme
'
)
&&
editor
.
ThemeLoader
){
return
editor
.
ThemeLoader
.
ThemesUrlAbs
+
src
;
return
editor
.
ThemeLoader
.
ThemesUrlAbs
+
src
;
...
...
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