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
75d9147f
Commit
75d9147f
authored
Mar 03, 2017
by
konovalovsergey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
for forceSave button
parent
e22e6d0c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
30 deletions
+61
-30
common/apiBase.js
common/apiBase.js
+43
-7
common/commonDefines.js
common/commonDefines.js
+5
-1
common/docscoapi.js
common/docscoapi.js
+13
-22
No files found.
common/apiBase.js
View file @
75d9147f
...
...
@@ -140,6 +140,8 @@
this
.
canSave
=
true
;
// Флаг нужен чтобы не происходило сохранение пока не завершится предыдущее сохранение
this
.
IsUserSave
=
false
;
// Флаг, контролирующий сохранение было сделано пользователем или нет (по умолчанию - нет)
this
.
isForceSaveOnUserSave
=
false
;
this
.
forceSaveButtonTimeout
=
null
;
this
.
forceSaveTimeoutTimeout
=
null
;
// Version History
this
.
VersionHistory
=
null
;
// Объект, который отвечает за точку в списке версий
...
...
@@ -653,13 +655,47 @@
}
}
};
this
.
CoAuthoringApi
.
onForceSave
=
function
(
data
)
{
if
(
AscCommon
.
c_oAscForceSaveTypes
.
Button
===
data
.
type
)
{
t
.
sendEvent
(
'
asc_onForceSaveButton
'
);
}
else
if
(
AscCommon
.
c_oAscForceSaveTypes
.
Timeout
===
data
.
type
)
{
t
.
sendEvent
(
'
asc_onForceSaveTimeout
'
,
data
.
saved
);
}
};
this
.
CoAuthoringApi
.
onForceSave
=
function
(
data
)
{
if
(
AscCommon
.
c_oAscForceSaveTypes
.
Button
===
data
.
type
)
{
if
(
data
.
start
)
{
if
(
null
===
t
.
forceSaveButtonTimeout
)
{
t
.
sync_StartAction
(
c_oAscAsyncActionType
.
Information
,
c_oAscAsyncAction
.
ForceSaveButton
);
}
else
{
clearInterval
(
t
.
forceSaveButtonTimeout
);
}
t
.
forceSaveButtonTimeout
=
setInterval
(
function
()
{
t
.
forceSaveButtonTimeout
=
null
;
t
.
sync_EndAction
(
c_oAscAsyncActionType
.
Information
,
c_oAscAsyncAction
.
ForceSaveButton
);
},
Asc
.
c_nMaxConversionTime
);
}
else
{
if
(
null
!==
t
.
forceSaveButtonTimeout
)
{
clearInterval
(
t
.
forceSaveButtonTimeout
);
t
.
forceSaveButtonTimeout
=
null
;
t
.
sync_EndAction
(
c_oAscAsyncActionType
.
Information
,
c_oAscAsyncAction
.
ForceSaveButton
);
}
}
}
else
{
if
(
AscCommon
.
CollaborativeEditing
.
Is_Fast
()
||
null
!==
t
.
forceSaveTimeoutTimeout
)
{
if
(
data
.
start
)
{
if
(
null
===
t
.
forceSaveTimeoutTimeout
)
{
t
.
sync_StartAction
(
c_oAscAsyncActionType
.
Information
,
c_oAscAsyncAction
.
ForceSaveTimeout
);
}
else
{
clearInterval
(
t
.
forceSaveTimeoutTimeout
);
}
t
.
forceSaveTimeoutTimeout
=
setInterval
(
function
()
{
t
.
forceSaveTimeoutTimeout
=
null
;
t
.
sync_EndAction
(
c_oAscAsyncActionType
.
Information
,
c_oAscAsyncAction
.
ForceSaveTimeout
);
},
Asc
.
c_nMaxConversionTime
);
}
else
{
if
(
null
!==
t
.
forceSaveTimeoutTimeout
)
{
clearInterval
(
t
.
forceSaveTimeoutTimeout
);
t
.
forceSaveTimeoutTimeout
=
null
;
t
.
sync_EndAction
(
c_oAscAsyncActionType
.
Information
,
c_oAscAsyncAction
.
ForceSaveTimeout
);
}
}
}
}
};
/**
* Event об отсоединении от сервера
* @param {jQuery} e event об отсоединении с причиной
...
...
common/commonDefines.js
View file @
75d9147f
...
...
@@ -43,6 +43,7 @@
var
FONT_THUMBNAIL_HEIGHT
=
(
7
*
96.0
/
25.4
)
>>
0
;
var
c_oAscMaxColumnWidth
=
255
;
var
c_oAscMaxRowHeight
=
409
;
var
c_nMaxConversionTime
=
900000
;
//depends on config
//files type for Saving & DownloadAs
var
c_oAscFileType
=
{
...
...
@@ -187,7 +188,9 @@
LoadTheme
:
12
,
// загрузка темы
MailMergeLoadFile
:
13
,
// загрузка файла для mail merge
DownloadMerge
:
14
,
// cкачать файл с mail merge
SendMailMerge
:
15
// рассылка mail merge по почте
SendMailMerge
:
15
,
// рассылка mail merge по почте
ForceSaveButton
:
16
,
ForceSaveTimeout
:
17
};
var
c_oAscAdvancedOptionsID
=
{
...
...
@@ -1077,6 +1080,7 @@
window
[
'
Asc
'
][
'
FONT_THUMBNAIL_HEIGHT
'
]
=
FONT_THUMBNAIL_HEIGHT
;
window
[
'
Asc
'
][
'
c_oAscMaxColumnWidth
'
]
=
window
[
'
Asc
'
].
c_oAscMaxColumnWidth
=
c_oAscMaxColumnWidth
;
window
[
'
Asc
'
][
'
c_oAscMaxRowHeight
'
]
=
window
[
'
Asc
'
].
c_oAscMaxRowHeight
=
c_oAscMaxRowHeight
;
window
[
'
Asc
'
][
'
c_nMaxConversionTime
'
]
=
window
[
'
Asc
'
].
c_nMaxConversionTime
=
c_nMaxConversionTime
;
window
[
'
Asc
'
][
'
c_oAscFileType
'
]
=
window
[
'
Asc
'
].
c_oAscFileType
=
c_oAscFileType
;
prot
=
c_oAscFileType
;
prot
[
'
UNKNOWN
'
]
=
prot
.
UNKNOWN
;
...
...
common/docscoapi.js
View file @
75d9147f
...
...
@@ -565,8 +565,8 @@
this
.
_id
=
null
;
this
.
_sessionTimeConnect
=
null
;
this
.
_allChangesSaved
=
null
;
this
.
_lastForceSaveTime
=
null
;
this
.
_lastForceSaveButtonTime
=
null
;
this
.
_lastForceSaveTimeoutTime
=
null
;
this
.
_indexUser
=
-
1
;
// Если пользователей больше 1, то совместно редактируем
this
.
isCoAuthoring
=
false
;
...
...
@@ -979,31 +979,25 @@
DocsCoApi
.
prototype
.
_onForceSaveStart
=
function
(
data
)
{
if
(
data
[
'
code
'
]
===
c_oAscServerCommandErrors
.
NoError
)
{
this
.
_lastForceSaveButtonTime
=
data
[
'
time
'
];
this
.
onForceSave
({
type
:
c_oAscForceSaveTypes
.
Button
,
start
:
true
});
}
else
if
(
data
[
'
code
'
]
!==
c_oAscServerCommandErrors
.
NotModified
)
{
this
.
onWarning
(
Asc
.
c_oAscError
.
ID
.
Unknown
);
}
};
DocsCoApi
.
prototype
.
_onForceSave
=
function
(
data
)
{
if
(
c_oAscForceSaveTypes
.
Button
===
data
[
'
type
'
])
{
var
type
=
data
[
'
type
'
];
if
(
c_oAscForceSaveTypes
.
Button
===
type
)
{
if
(
this
.
_lastForceSaveButtonTime
==
data
[
'
time
'
])
{
this
.
onForceSave
({
type
:
c_oAscForceSaveTypes
.
Button
,
saved
:
true
});
this
.
onForceSave
({
type
:
type
,
success
:
data
[
'
success
'
]
});
}
}
if
(
null
!=
this
.
_lastForceSaveTime
)
{
this
.
_lastForceSaveTime
=
data
[
'
time
'
];
this
.
_checkLastForceSave
();
}
};
DocsCoApi
.
prototype
.
_checkLastForceSave
=
function
(
data
)
{
if
(
null
!=
this
.
_lastForceSaveTime
)
{
var
newState
=
false
;
if
((
-
1
==
this
.
lastOtherSaveTime
||
this
.
lastOtherSaveTime
<=
this
.
_lastForceSaveTime
)
&&
(
-
1
==
this
.
lastOwnSaveTime
||
this
.
lastOwnSaveTime
<=
this
.
_lastForceSaveTime
))
{
newState
=
true
;
}
if
(
newState
!=
this
.
_allChangesSaved
)
{
this
.
_allChangesSaved
=
newState
;
this
.
onForceSave
({
type
:
c_oAscForceSaveTypes
.
Timeout
,
saved
:
this
.
_allChangesSaved
});
}
else
{
if
(
data
[
'
start
'
])
{
this
.
onForceSave
({
type
:
type
,
start
:
true
});
this
.
_lastForceSaveTimeoutTime
=
data
[
'
time
'
];
}
else
{
if
(
this
.
_lastForceSaveTimeoutTime
==
data
[
'
time
'
])
{
this
.
onForceSave
({
type
:
type
,
success
:
data
[
'
success
'
]});
}
}
}
};
...
...
@@ -1166,7 +1160,6 @@
if
(
-
1
!==
data
[
'
time
'
])
{
this
.
lastOwnSaveTime
=
data
[
'
time
'
];
this
.
_checkLastForceSave
();
}
if
(
this
.
onUnSaveLock
)
{
...
...
@@ -1188,7 +1181,6 @@
this
.
onSaveChanges
(
JSON
.
parse
(
changesOneUser
),
change
[
'
useridoriginal
'
],
bFirstLoad
);
}
}
this
.
_checkLastForceSave
();
}
}
};
...
...
@@ -1374,7 +1366,6 @@
this
.
_state
=
ConnectionState
.
Authorized
;
this
.
_id
=
data
[
'
sessionId
'
];
this
.
_sessionTimeConnect
=
data
[
'
sessionTimeConnect
'
];
this
.
_lastForceSaveTime
=
data
[
'
lastForceSaveTime
'
];
this
.
_onAuthParticipantsChanged
(
data
[
'
participants
'
]);
...
...
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