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 f71ea056a8b1820188fc5091cfa2b2c7b79eb8c0
Author: Jan Holesovsky <ke...@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/41707
    Reviewed-by: pranavk <pran...@collabora.co.uk>
    Tested-by: pranavk <pran...@collabora.co.uk>

diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index b9f9b0fe..163dfd5c 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -244,7 +244,7 @@ L.Socket = L.Class.extend({
                                msg = _('Session terminated by document owner');
                        }
                        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;
                        }
                        else if (textMsg === 'shuttingdown') {
@@ -310,12 +310,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 0405102b..d4869820 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -843,12 +843,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;
@@ -860,7 +866,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 8e96efcc..acc999b8 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: {
                doclayerinit: 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 c18526cd..04bb2685 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -442,6 +442,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 b554bd5f..bd037c83 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}));
 }
 
 /// uri format: http://server/<...>/wopi*/files/<id>/content
diff --git a/wsd/Storage.hpp b/wsd/Storage.hpp
index 6b26c066..dff32cce 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 6f35c5cb..f0ce41a1 100644
--- a/wsd/reference.txt
+++ b/wsd/reference.txt
@@ -46,6 +46,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)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to