[Libreoffice-commits] online.git: loleaflet/src wsd/DocumentBroker.cpp wsd/reference.txt wsd/Storage.cpp wsd/Storage.hpp
Jan Holesovsky
kendy at collabora.com
Tue Aug 29 17:48:01 UTC 2017
loleaflet/src/core/Socket.js | 9 +++++++--
loleaflet/src/map/Map.js | 9 +++++++--
loleaflet/src/map/handler/Map.WOPI.js | 2 ++
wsd/DocumentBroker.cpp | 1 +
wsd/Storage.cpp | 4 +++-
wsd/Storage.hpp | 4 ++++
wsd/reference.txt | 6 ++++++
7 files changed, 30 insertions(+), 5 deletions(-)
New commits:
commit f7c199684c9a45e68cd1186d25def761978e2ce8
Author: Jan Holesovsky <kendy at collabora.com>
Date: Tue Aug 29 18:59:14 2017 +0200
WOPI extension: DisableInactiveMessages to avoid showing message when dimmed.
Change-Id: I925602295dde95611ab1a6565dd7266460769a50
Reviewed-on: https://gerrit.libreoffice.org/41709
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Tested-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index e0a0cc8a..fbdfd340 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -248,7 +248,7 @@ L.Socket = L.Class.extend({
postMsgData['Reason'] = 'OwnerTermination';
}
else if (textMsg === 'idle' || textMsg === 'oom') {
- msg = _('Session was terminated due to idleness - please click to reload');
+ msg = _('Idle document - please click to reload and resume editing');
this._map._documentIdle = true;
postMsgData['Reason'] = 'DocumentIdle';
if (textMsg === 'oom')
@@ -317,12 +317,17 @@ L.Socket = L.Class.extend({
vex.close(id);
}
+ var message = '';
+ if (!this._map['wopi'].DisableInactiveMessages) {
+ message = msg;
+ }
+
var options = $.extend({}, vex.defaultOptions, {
contentCSS: {'background':'rgba(0, 0, 0, 0)',
'font-size': 'xx-large',
'color': '#fff',
'text-align': 'center'},
- content: msg
+ content: message
});
options.id = vex.globalID;
vex.dialogID = options.id;
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index c8e99784..fca9e8c6 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -862,12 +862,18 @@ L.Map = L.Evented.extend({
this._active = false;
clearTimeout(vex.timer);
+ var message = '';
+ var map = this;
+ if (!map['wopi'].DisableInactiveMessages) {
+ message = _('Inactive document - please click to resume editing');
+ }
+
var options = $.extend({}, vex.defaultOptions, {
contentCSS: {'background':'rgba(0, 0, 0, 0)',
'font-size': 'xx-large',
'color': '#fff',
'text-align': 'center'},
- content: _('Inactive document - please click to resume editing')
+ content: message
});
options.id = vex.globalID;
vex.dialogID = options.id;
@@ -879,7 +885,6 @@ L.Map = L.Evented.extend({
vex: options
});
- var map = this;
options.$vex.bind('click.vex', function(e) {
console.debug('_dim: click.vex function');
return map._activate();
diff --git a/loleaflet/src/map/handler/Map.WOPI.js b/loleaflet/src/map/handler/Map.WOPI.js
index dc6f0fa3..211ab469 100644
--- a/loleaflet/src/map/handler/Map.WOPI.js
+++ b/loleaflet/src/map/handler/Map.WOPI.js
@@ -15,6 +15,7 @@ L.Map.WOPI = L.Handler.extend({
DisablePrint: false,
DisableExport: false,
DisableCopy: false,
+ DisableInactiveMessages: false,
_appLoadedConditions: {
docloaded: false,
@@ -65,6 +66,7 @@ L.Map.WOPI = L.Handler.extend({
this.DisablePrint = !!wopiInfo['DisablePrint'];
this.DisableExport = !!wopiInfo['DisableExport'];
this.DisableCopy = !!wopiInfo['DisableCopy'];
+ this.DisableInactiveMessages = !!wopiInfo['DisableInactiveMessages'];
this._map.fire('postMessage', {msgId: 'App_LoadingStatus', args: {Status: 'Frame_Ready'}});
},
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 6744b838..11f40004 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -467,6 +467,7 @@ bool DocumentBroker::load(const std::shared_ptr<ClientSession>& session, const s
wopiInfo->set("DisablePrint", wopifileinfo->_disablePrint);
wopiInfo->set("DisableExport", wopifileinfo->_disableExport);
wopiInfo->set("DisableCopy", wopifileinfo->_disableCopy);
+ wopiInfo->set("DisableInactiveMessages", wopifileinfo->_disableInactiveMessages);
std::ostringstream ossWopiInfo;
wopiInfo->stringify(ossWopiInfo);
diff --git a/wsd/Storage.cpp b/wsd/Storage.cpp
index c571ecb1..7cf22e56 100644
--- a/wsd/Storage.cpp
+++ b/wsd/Storage.cpp
@@ -549,6 +549,7 @@ std::unique_ptr<WopiStorage::WOPIFileInfo> WopiStorage::getWOPIFileInfo(const Au
bool disablePrint = false;
bool disableExport = false;
bool disableCopy = false;
+ bool disableInactiveMessages = false;
std::string lastModifiedTime;
LOG_DBG("WOPI::CheckFileInfo returned: " << resMsg << ". Call duration: " << callDuration.count() << "s");
@@ -570,6 +571,7 @@ std::unique_ptr<WopiStorage::WOPIFileInfo> WopiStorage::getWOPIFileInfo(const Au
getWOPIValue(object, "DisablePrint", disablePrint);
getWOPIValue(object, "DisableExport", disableExport);
getWOPIValue(object, "DisableCopy", disableCopy);
+ getWOPIValue(object, "DisableInactiveMessages", disableInactiveMessages);
getWOPIValue(object, "LastModifiedTime", lastModifiedTime);
}
else
@@ -581,7 +583,7 @@ std::unique_ptr<WopiStorage::WOPIFileInfo> WopiStorage::getWOPIFileInfo(const Au
const Poco::Timestamp modifiedTime = iso8601ToTimestamp(lastModifiedTime);
_fileInfo = FileInfo({filename, ownerId, modifiedTime, size});
- return std::unique_ptr<WopiStorage::WOPIFileInfo>(new WOPIFileInfo({userId, userName, userExtraInfo, canWrite, postMessageOrigin, hidePrintOption, hideSaveOption, hideExportOption, enableOwnerTermination, disablePrint, disableExport, disableCopy, callDuration}));
+ return std::unique_ptr<WopiStorage::WOPIFileInfo>(new WOPIFileInfo({userId, userName, userExtraInfo, canWrite, postMessageOrigin, hidePrintOption, hideSaveOption, hideExportOption, enableOwnerTermination, disablePrint, disableExport, disableCopy, disableInactiveMessages, callDuration}));
}
/// PutRelativeFile - uri format: http://server/<...>/wopi*/files/<id>/
diff --git a/wsd/Storage.hpp b/wsd/Storage.hpp
index 827a8fa7..28532e4a 100644
--- a/wsd/Storage.hpp
+++ b/wsd/Storage.hpp
@@ -207,6 +207,7 @@ public:
const bool disablePrint,
const bool disableExport,
const bool disableCopy,
+ const bool disableInactiveMessages,
const std::chrono::duration<double> callDuration)
: _userid(userid),
_username(username),
@@ -219,6 +220,7 @@ public:
_disablePrint(disablePrint),
_disableExport(disableExport),
_disableCopy(disableCopy),
+ _disableInactiveMessages(disableInactiveMessages),
_callDuration(callDuration)
{
_userExtraInfo = userExtraInfo;
@@ -248,6 +250,8 @@ public:
bool _disableExport;
/// If WOPI host has allowed the user to copy to/from the document
bool _disableCopy;
+ /// If WOPI host has allowed the loleaflet to show texts on the overlay informing about inactivity, or if the integration is handling that.
+ bool _disableInactiveMessages;
/// Time it took to call WOPI's CheckFileInfo
std::chrono::duration<double> _callDuration;
};
diff --git a/wsd/reference.txt b/wsd/reference.txt
index 0f70035b..92d0e3e2 100644
--- a/wsd/reference.txt
+++ b/wsd/reference.txt
@@ -63,6 +63,12 @@ DisableCopy
backend. Pasting into the document would still be possible.
However, it is still possible to do an "internal" cut/copy/paste.
+DisableInactiveMessages
+ Disables displaying of the explanation text on the overlay when the
+ document becomes inactive or killed. With this, the JS integration
+ must provide the user with appropriate message when it gets
+ Session_Closed or User_Idle postMessage's.
+
EnableOwnerTermination
If set to true, it allows the document owner (the one with OwnerId =
UserId) to send a 'closedocument' message (see protocol.txt)
More information about the Libreoffice-commits
mailing list