[Libreoffice-commits] online.git: loleaflet/src wsd/DocumentBroker.cpp

2020-06-26 Thread Mike Kaganski (via logerrit)
 loleaflet/src/map/Map.js |5 +
 wsd/DocumentBroker.cpp   |4 
 2 files changed, 9 insertions(+)

New commits:
commit ec1bc5807090dea9f28ef25c6211785c7fa1a00f
Author: Mike Kaganski 
AuthorDate: Fri Jun 26 14:47:37 2020 +0300
Commit: Andras Timar 
CommitDate: Fri Jun 26 14:42:34 2020 +0200

Don't show last modification indicator when data is unavailable

E.g., SharePoint 2013 and 2016 don't support LastModifiedTime field
in CheckFileInfo [1].

[1] 
https://docs.microsoft.com/en-us/openspecs/office_protocols/ms-wopi/e2e91eab-4c6d-4f00-9c3f-3a1962135626#Appendix_A_30

Change-Id: Icdcf9f82758b4bd34be25f553e9d756ab76b8bfa
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97221
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 67bac9bfd..5f9882a53 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -386,6 +386,11 @@ L.Map = L.Evented.extend({
if (lastModButton !== null && lastModButton !== undefined
&& lastModButton.firstChild.innerHTML !== null
&& lastModButton.firstChild.childElementCount == 0) {
+   if (this._lastmodtime == null) {
+   // No modification time -> hide the indicator
+   lastModButton.innerHTML = '';
+   return;
+   }
var mainSpan = document.createElement('span');
var label = document.createTextNode(_('Last 
modification'));
var separator = document.createTextNode(': ');
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index fe99ed26a..f062e0145 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -74,6 +74,10 @@ void sendLastModificationTime(const 
std::shared_ptr& session,
 if (!session)
 return;
 
+if (documentLastModifiedTime == std::chrono::system_clock::time_point())
+// No time from the storage (e.g., SharePoint 2013 and 2016) -> don't 
send
+return;
+
 std::stringstream stream;
 stream << "lastmodtime: " << documentLastModifiedTime;
 const std::string message = stream.str();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: loleaflet/src wsd/DocumentBroker.cpp wsd/Storage.cpp wsd/Storage.hpp

2020-06-11 Thread Michael Meeks (via logerrit)
 loleaflet/src/control/Control.DocumentNameInput.js |7 +++
 loleaflet/src/map/handler/Map.WOPI.js  |4 
 wsd/DocumentBroker.cpp |2 ++
 wsd/Storage.cpp|1 +
 wsd/Storage.hpp|4 
 5 files changed, 14 insertions(+), 4 deletions(-)

New commits:
commit d34854f6884940b683d4cff4b8a7496de63cae35
Author: Michael Meeks 
AuthorDate: Tue Jun 9 17:43:58 2020 +0100
Commit: Michael Meeks 
CommitDate: Thu Jun 11 19:44:01 2020 +0200

Add support for BreadcrumbDocName.

Change-Id: I06c56e92dd3acf9269140ecefb0c8bc731191260
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95960
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Michael Meeks 

diff --git a/loleaflet/src/control/Control.DocumentNameInput.js 
b/loleaflet/src/control/Control.DocumentNameInput.js
index 28db57f41..cfc4e5998 100644
--- a/loleaflet/src/control/Control.DocumentNameInput.js
+++ b/loleaflet/src/control/Control.DocumentNameInput.js
@@ -40,7 +40,7 @@ L.Control.DocumentNameInput = L.Control.extend({
},
 
documentNameCancel: function() {
-   $('#document-name-input').val(this.map['wopi'].BaseFileName);
+   
$('#document-name-input').val(this.map['wopi'].BreadcrumbDocName);
this.map._onGotFocus();
},
 
@@ -97,10 +97,9 @@ L.Control.DocumentNameInput = L.Control.extend({
},
 
onWopiProps: function(e) {
-   if (e.BaseFileName !== null) {
+   if (e.BaseFileName !== null)
// set the document name into the name field
-   $('#document-name-input').val(e.BaseFileName);
-   }
+   $('#document-name-input').val(e.BreadcrumbDocName !== 
undefined ? e.BreadcrumbDocName : e.BaseFileName);
 
if (e.UserCanNotWriteRelative === false) {
// Save As allowed
diff --git a/loleaflet/src/map/handler/Map.WOPI.js 
b/loleaflet/src/map/handler/Map.WOPI.js
index da79219e8..3e41b7fae 100644
--- a/loleaflet/src/map/handler/Map.WOPI.js
+++ b/loleaflet/src/map/handler/Map.WOPI.js
@@ -10,6 +10,7 @@ L.Map.WOPI = L.Handler.extend({
// wouldn't be possible otherwise.
PostMessageOrigin: '*',
BaseFileName: '',
+   BreadcrumbDocName: '',
DocumentLoadedTime: false,
HidePrintOption: false,
HideSaveOption: false,
@@ -76,6 +77,9 @@ L.Map.WOPI = L.Handler.extend({
}
 
this.BaseFileName = wopiInfo['BaseFileName'];
+   this.BreadcrumbDocName = wopiInfo['BreadcrumbDocName'];
+   if (this.BreadcrumbDocName === undefined)
+   this.BreadcrumbDocName = this.BaseFileName;
this.HidePrintOption = !!wopiInfo['HidePrintOption'];
this.HideSaveOption = !!wopiInfo['HideSaveOption'];
this.HideExportOption = !!wopiInfo['HideExportOption'];
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 55e921295..f62241808 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -659,6 +659,8 @@ bool DocumentBroker::load(const 
std::shared_ptr& session, const s
 wopifileinfo->setHideExportOption(true);
 
 wopiInfo->set("BaseFileName", 
wopiStorage->getFileInfo().getFilename());
+if (wopifileinfo->getBreadcrumbDocName().size())
+wopiInfo->set("BreadcrumbDocName", 
wopifileinfo->getBreadcrumbDocName());
 
 if (!wopifileinfo->getTemplateSaveAs().empty())
 wopiInfo->set("TemplateSaveAs", wopifileinfo->getTemplateSaveAs());
diff --git a/wsd/Storage.cpp b/wsd/Storage.cpp
index 3960544c2..1da4eaf74 100644
--- a/wsd/Storage.cpp
+++ b/wsd/Storage.cpp
@@ -737,6 +737,7 @@ WopiStorage::WOPIFileInfo::WOPIFileInfo(const FileInfo 
,
 JsonUtil::findJSONValue(object, "SupportsLocks", _supportsLocks);
 JsonUtil::findJSONValue(object, "SupportsRename", _supportsRename);
 JsonUtil::findJSONValue(object, "UserCanRename", _userCanRename);
+JsonUtil::findJSONValue(object, "BreadcrumbDocName", _breadcrumbDocName);
 bool booleanFlag = false;
 if (JsonUtil::findJSONValue(object, "DisableChangeTrackingRecord", 
booleanFlag))
 _disableChangeTrackingRecord = (booleanFlag ? 
WOPIFileInfo::TriState::True : WOPIFileInfo::TriState::False);
diff --git a/wsd/Storage.hpp b/wsd/Storage.hpp
index 5adb2da0c..b426d44bd 100644
--- a/wsd/Storage.hpp
+++ b/wsd/Storage.hpp
@@ -386,6 +386,8 @@ public:
 const std::string& getWatermarkText() const { return _watermarkText; }
 const std::string& getTemplateSaveAs() const { return _templateSaveAs; 
}
 const std::string& getTemplateSource() const { return _templateSource; 
}
+const std::string& getBreadcrumbDocName() const { return 
_breadcrumbDocName; }
+
 bool getUserCanWrite() const { 

[Libreoffice-commits] online.git: loleaflet/src wsd/DocumentBroker.cpp

2019-10-28 Thread Ashod Nakashian (via logerrit)
 loleaflet/src/core/Socket.js   |3 +++
 loleaflet/src/errormessages.js |1 +
 wsd/DocumentBroker.cpp |   15 +++
 3 files changed, 11 insertions(+), 8 deletions(-)

New commits:
commit 8809f4f10459ac0258a43a22408a2e5b41b7d9d9
Author: Ashod Nakashian 
AuthorDate: Wed Oct 2 08:38:45 2019 -0400
Commit: Michael Meeks 
CommitDate: Mon Oct 28 10:48:37 2019 +0100

wsd: notify the client of document load timeout

This gives users some feedback as to why loading
failed, which in this case is quite useful (as
it is highly unlikely retrying will help, since
the issue is with the document, being too large
or resource intensive).

Reviewed-on: https://gerrit.libreoffice.org/80325
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 
(cherry picked from commit d332e1d4a2999da4f93e7831ffc0d58e96fad1c6)

Change-Id: I01052105b8412023ac7651f3a92cc67fe739fd1a
Reviewed-on: https://gerrit.libreoffice.org/81563
Reviewed-by: Michael Meeks 
Tested-by: Michael Meeks 

diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 94454b82d..6f3d22d27 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -590,6 +590,9 @@ L.Socket = L.Class.extend({
} else if (errorKind.startsWith('faileddocloading')) {
this._map._fatal = true;
this._map.fire('error', {msg: 
errorMessages.faileddocloading});
+   } else if (errorKind.startsWith('docloadtimeout')) {
+   this._map._fatal = true;
+   this._map.fire('error', {msg: 
errorMessages.docloadtimeout});
} else if (errorKind.startsWith('docunloading')) {
// The document is unloading. Have to wait a 
bit.
this._map._active = false;
diff --git a/loleaflet/src/errormessages.js b/loleaflet/src/errormessages.js
index 16dc14086..37addbc20 100644
--- a/loleaflet/src/errormessages.js
+++ b/loleaflet/src/errormessages.js
@@ -23,6 +23,7 @@ errorMessages.sessionexpired = _('Your session has been 
expired. Further changes
 errorMessages.faileddocloading = _('Failed to load the document. Please ensure 
the file type is supported and not corrupted, and try again.');
 errorMessages.invalidLink = _('Invalid link: \'%url\'');
 errorMessages.leaving = _('You are leaving the editor, are you sure you want 
to visit %url?');
+errorMessages.docloadtimeout = _('Failed to load the document. This document 
is either malformed or is taking more resources than allowed. Please contact 
the administrator.');
 
 if (window.ThisIsAMobileApp) {
errorMessages.storage = {
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 791089042..c3f0dd04c 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -292,22 +292,21 @@ void DocumentBroker::pollThread()
 #if !MOBILEAPP
 if (!_isLoaded && (limit_load_secs > 0) && (now > loadDeadline))
 {
+LOG_WRN("Doc [" << _docKey << "] is taking too long to load. Will 
kill process ["
+<< _childProcess->getPid() << "]. 
per_document.limit_load_secs set to "
+<< limit_load_secs << " secs.");
+broadcastMessage("error: cmd=load kind=docloadtimeout");
+
 // Brutal but effective.
 if (_childProcess)
-{
-LOG_WRN("Doc [" << _docKey << "] is taking too long to load. 
Will kill process ["
-<< _childProcess->getPid()
-<< "]. per_document.limit_load_secs set to " 
<< limit_load_secs
-<< " secs.");
 _childProcess->terminate();
-}
 
 stop("Load timed out");
 continue;
 }
 
 if (std::chrono::duration_cast
-(now - lastBWUpdateTime).count() >= 5 * 1000)
+(now - lastBWUpdateTime).count() >= COMMAND_TIMEOUT_MS)
 {
 lastBWUpdateTime = now;
 uint64_t sent, recv;
@@ -317,9 +316,9 @@ void DocumentBroker::pollThread()
// connection drop transiently reduces 
this.
(sent > adminSent ? (sent - adminSent): 
uint64_t(0)),
(recv > adminRecv ? (recv - adminRecv): 
uint64_t(0)));
-LOG_DBG("Doc [" << _docKey << "] added sent: " << sent << " recv: 
" << recv << " bytes to totals");
 adminSent = sent;
 adminRecv = recv;
+LOG_TRC("Doc [" << _docKey << "] added stats sent: " << sent << ", 
recv: " << recv << " bytes to totals.");
 }
 #endif
 
___
Libreoffice-commits mailing list

[Libreoffice-commits] online.git: loleaflet/src wsd/DocumentBroker.cpp wsd/Storage.cpp wsd/Storage.hpp

2018-04-24 Thread Marco Cecchetti
 loleaflet/src/control/Control.Menubar.js |5 -
 loleaflet/src/map/handler/Map.WOPI.js|2 ++
 wsd/DocumentBroker.cpp   |1 +
 wsd/Storage.cpp  |4 +++-
 wsd/Storage.hpp  |4 
 5 files changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 6a0fcdf15faff87da3d5431316777a85f4b3773c
Author: Marco Cecchetti 
Date:   Mon Apr 23 16:25:00 2018 +0200

wopi flag for hiding the change tracking controls from UI

Change-Id: I1b9aa4f8111d77ae12093022205fad1cbee850ac
Reviewed-on: https://gerrit.libreoffice.org/53335
Reviewed-by: Ashod Nakashian 
Tested-by: Ashod Nakashian 

diff --git a/loleaflet/src/control/Control.Menubar.js 
b/loleaflet/src/control/Control.Menubar.js
index 81288d617..d6ec74ca8 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -40,7 +40,7 @@ L.Control.Menubar = L.Control.extend({
{type: 'separator'},
{uno: '.uno:SearchDialog'},
{type: 'separator'},
-   {name: _UNO('.uno:ChangesMenu', 'text'), type: 
'menu', menu: [
+   {name: _UNO('.uno:ChangesMenu', 'text'), id: 
'changesmenu', type: 'menu', menu: [
{uno: '.uno:TrackChanges'},
{uno: '.uno:ShowTrackedChanges'},
{type: 'separator'},
@@ -811,6 +811,9 @@ L.Control.Menubar = L.Control.extend({
if (menu[i].id && 
menu[i].id.startsWith('fullscreen-presentation') && 
this._map['wopi'].HideExportOption)
continue;
 
+   if (menu[i].id === 'changesmenu' && 
this._map['wopi'].HideChangeTrackingControls)
+   continue;
+
// Keep track of all 'downloadas-' options and register 
them as
// export formats with docLayer which can then be 
publicly accessed unlike
// this Menubar control for which there doesn't seem to 
be any easy way
diff --git a/loleaflet/src/map/handler/Map.WOPI.js 
b/loleaflet/src/map/handler/Map.WOPI.js
index ff08ba7c1..5842259aa 100644
--- a/loleaflet/src/map/handler/Map.WOPI.js
+++ b/loleaflet/src/map/handler/Map.WOPI.js
@@ -13,6 +13,7 @@ L.Map.WOPI = L.Handler.extend({
HidePrintOption: false,
HideSaveOption: false,
HideExportOption: false,
+   HideChangeTrackingControls: false,
DisablePrint: false,
DisableExport: false,
DisableCopy: false,
@@ -67,6 +68,7 @@ L.Map.WOPI = L.Handler.extend({
this.HidePrintOption = !!wopiInfo['HidePrintOption'];
this.HideSaveOption = !!wopiInfo['HideSaveOption'];
this.HideExportOption = !!wopiInfo['HideExportOption'];
+   this.HideChangeTrackingControls = 
!!wopiInfo['HideChangeTrackingControls'];
this.DisablePrint = !!wopiInfo['DisablePrint'];
this.DisableExport = !!wopiInfo['DisableExport'];
this.DisableCopy = !!wopiInfo['DisableCopy'];
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 25a495e27..e972459af 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -502,6 +502,7 @@ bool DocumentBroker::load(const 
std::shared_ptr& session, const s
 wopiInfo->set("HidePrintOption", wopifileinfo->_hidePrintOption);
 wopiInfo->set("HideSaveOption", wopifileinfo->_hideSaveOption);
 wopiInfo->set("HideExportOption", wopifileinfo->_hideExportOption);
+wopiInfo->set("HideChangeTrackingControls", 
wopifileinfo->_hideChangeTrackingControls);
 wopiInfo->set("DisablePrint", wopifileinfo->_disablePrint);
 wopiInfo->set("DisableExport", wopifileinfo->_disableExport);
 wopiInfo->set("DisableCopy", wopifileinfo->_disableCopy);
diff --git a/wsd/Storage.cpp b/wsd/Storage.cpp
index f25220894..ca306a340 100644
--- a/wsd/Storage.cpp
+++ b/wsd/Storage.cpp
@@ -446,6 +446,7 @@ std::unique_ptr 
WopiStorage::getWOPIFileInfo(const Au
 bool hidePrintOption = false;
 bool hideSaveOption = false;
 bool hideExportOption = false;
+bool hideChangeTrackingControls = false;
 bool disablePrint = false;
 bool disableExport = false;
 bool disableCopy = false;
@@ -469,6 +470,7 @@ std::unique_ptr 
WopiStorage::getWOPIFileInfo(const Au
 JsonUtil::findJSONValue(object, "HidePrintOption", hidePrintOption);
 JsonUtil::findJSONValue(object, "HideSaveOption", hideSaveOption);
 JsonUtil::findJSONValue(object, "HideExportOption", hideExportOption);
+JsonUtil::findJSONValue(object, "hideChangeTrackingControls", 
hideChangeTrackingControls);
 

[Libreoffice-commits] online.git: loleaflet/src wsd/DocumentBroker.cpp wsd/Storage.cpp wsd/Storage.hpp

2017-10-03 Thread Pranav Kant
 loleaflet/src/control/Control.Menubar.js |5 +
 loleaflet/src/map/handler/Map.WOPI.js|2 ++
 wsd/DocumentBroker.cpp   |1 +
 wsd/Storage.cpp  |4 +++-
 wsd/Storage.hpp  |4 
 5 files changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 6a73c19d160a312cc4345014ae9f79ee63f9b234
Author: Pranav Kant 
Date:   Tue Oct 3 20:36:02 2017 +0530

Show save-as option based on CheckFileInfo params

If UserCanNotWriteRelative is mentioned in the CheckFileInfo response.

Change-Id: I33d2e21159b3e18ae88fd72f404f2d1d1d9b64e5

diff --git a/loleaflet/src/control/Control.Menubar.js 
b/loleaflet/src/control/Control.Menubar.js
index 56319ebc..14f62e3b 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -187,6 +187,7 @@ L.Control.Menubar = L.Control.extend({
presentation: [
{name: _('File'), id: 'file', type: 'menu', menu: [
{name: _('Save'), id: 'save', type: 'action'},
+   {name: _('Save As'), id: 'saveas', type: 
'action'},
{name: _('Print'), id: 'print', type: 'action'},
{name: _('See revision history'), id: 
'rev-history', type: 'action'},
{name: _('Download as'), id: 'downloadas', 
type: 'menu', menu: [
@@ -251,6 +252,7 @@ L.Control.Menubar = L.Control.extend({
spreadsheet: [
{name: _('File'), id: 'file', type: 'menu', menu: [
{name: _('Save'), id: 'save', type: 'action'},
+   {name: _('Save As'), id: 'saveas', type: 
'action'},
{name: _('Print'), id: 'print', type: 'action'},
{name: _('See revision history'), id: 
'rev-history', type: 'action'},
{name: _('Download as'), id:'downloadas', type: 
'menu', menu: [
@@ -775,6 +777,9 @@ L.Control.Menubar = L.Control.extend({
if (menu[i].id === 'save' && 
this._map['wopi'].HideSaveOption)
continue;
 
+   if (menu[i].id === 'saveas' && 
this._map['wopi'].UserCanNotWriteRelative)
+   continue;
+
if (menu[i].id && 
menu[i].id.startsWith('fullscreen-presentation') && 
this._map['wopi'].HideExportOption)
continue;
 
diff --git a/loleaflet/src/map/handler/Map.WOPI.js 
b/loleaflet/src/map/handler/Map.WOPI.js
index 211ab469..f1bd0701 100644
--- a/loleaflet/src/map/handler/Map.WOPI.js
+++ b/loleaflet/src/map/handler/Map.WOPI.js
@@ -16,6 +16,7 @@ L.Map.WOPI = L.Handler.extend({
DisableExport: false,
DisableCopy: false,
DisableInactiveMessages: false,
+   UserCanNotWriteRelative: true,
 
_appLoadedConditions: {
docloaded: false,
@@ -67,6 +68,7 @@ L.Map.WOPI = L.Handler.extend({
this.DisableExport = !!wopiInfo['DisableExport'];
this.DisableCopy = !!wopiInfo['DisableCopy'];
this.DisableInactiveMessages = 
!!wopiInfo['DisableInactiveMessages'];
+   this.UserCanNotWriteRelative = 
!!wopiInfo['UserCanNotWriteRelative'];
 
this._map.fire('postMessage', {msgId: 'App_LoadingStatus', 
args: {Status: 'Frame_Ready'}});
},
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 6eff18bb..7a72393d 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -470,6 +470,7 @@ bool DocumentBroker::load(const 
std::shared_ptr& session, const s
 wopiInfo->set("DisableExport", wopifileinfo->_disableExport);
 wopiInfo->set("DisableCopy", wopifileinfo->_disableCopy);
 wopiInfo->set("DisableInactiveMessages", 
wopifileinfo->_disableInactiveMessages);
+wopiInfo->set("UserCanNotWriteRelative", 
wopifileinfo->_userCanNotWriteRelative);
 
 std::ostringstream ossWopiInfo;
 wopiInfo->stringify(ossWopiInfo);
diff --git a/wsd/Storage.cpp b/wsd/Storage.cpp
index 6a02649a..7612fa98 100644
--- a/wsd/Storage.cpp
+++ b/wsd/Storage.cpp
@@ -552,6 +552,7 @@ std::unique_ptr 
WopiStorage::getWOPIFileInfo(const Au
 bool disableCopy = false;
 bool disableInactiveMessages = false;
 std::string lastModifiedTime;
+bool userCanNotWriteRelative = true;
 
 LOG_DBG("WOPI::CheckFileInfo returned: " << resMsg << ". Call duration: " 
<< callDuration.count() << "s");
 Poco::JSON::Object::Ptr object;
@@ -575,6 +576,7 @@ std::unique_ptr 
WopiStorage::getWOPIFileInfo(const Au
 getWOPIValue(object, "DisableCopy", disableCopy);
 getWOPIValue(object, "DisableInactiveMessages", 
disableInactiveMessages);
 getWOPIValue(object, "LastModifiedTime", lastModifiedTime);
+ 

[Libreoffice-commits] online.git: loleaflet/src wsd/DocumentBroker.cpp wsd/reference.txt wsd/Storage.cpp wsd/Storage.hpp

2017-08-29 Thread Jan Holesovsky
 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 
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 
Tested-by: Jan Holesovsky 

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
+++ 

[Libreoffice-commits] online.git: loleaflet/src wsd/DocumentBroker.cpp

2017-06-01 Thread Pranav Kant
 loleaflet/src/core/Socket.js |3 +++
 wsd/DocumentBroker.cpp   |8 +++-
 2 files changed, 6 insertions(+), 5 deletions(-)

New commits:
commit a0710c9613309cb7be2934e8eedc75507185b87f
Author: Pranav Kant 
Date:   Thu Jun 1 22:02:08 2017 +0530

Inform the current session about document change too

Change-Id: I9947eb8b23e5a698cc2cbf39bfde4e1941aae0f0

diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index e1cfde78..c0b53dca 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -282,6 +282,9 @@ L.Socket = L.Class.extend({
var username = 
textMsg.substring('documentconflict '.length);
msg = _('%user asked to refresh the document. 
Document will now refresh automatically.').replace('%user', username);
 
+   if (this._map._docLayer) {
+   this._map._docLayer.removeAllViews();
+   }
// Detach all the handlers from current socket, 
otherwise _onSocketClose tries to reconnect again
// However, we want to reconnect manually here.
this.close();
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index dfad745e..d92df509 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -497,11 +497,9 @@ bool DocumentBroker::load(const 
std::shared_ptr& session, const s
 {
 LOG_WRN("Document [" << _docKey << "] has been modified behind our 
back. Informing all clients.");
 _documentChangedInStorage = true;
-// Inform all clients
-for (const auto& sessionIt : _sessions)
-{
-sessionIt.second->sendTextFrame("error: cmd=storage 
kind=documentconflict");
-}
+const std::string errorMsg = "error: cmd=storage 
kind=documentconflict";
+session->sendTextFrame(errorMsg);
+broadcastMessage(errorMsg);
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: loleaflet/src wsd/DocumentBroker.cpp

2016-12-13 Thread Pranav Kant
 loleaflet/src/control/Toolbar.js  |9 -
 loleaflet/src/map/handler/Map.WOPI.js |6 ++
 wsd/DocumentBroker.cpp|3 +++
 3 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit a76825728e13a36ed570621cfb9da72b5e3c0a24
Author: Pranav Kant 
Date:   Tue Dec 13 17:54:42 2016 +0530

Pass Disable{Print,Export,Copy} options to client and handle them

Change-Id: I59a9432bbdd06d8b184f96882c5f4009fcd0be54

diff --git a/loleaflet/src/control/Toolbar.js b/loleaflet/src/control/Toolbar.js
index 5fe402f..8ad990a 100644
--- a/loleaflet/src/control/Toolbar.js
+++ b/loleaflet/src/control/Toolbar.js
@@ -52,13 +52,20 @@ L.Map.include({
return;
}
 
+   id = id || 'export'; // not any special download, simple export
+
+   if ((id === 'print' && this['wopi'].DisablePrint) ||
+   (id === 'export' && this['wopi'].DisableExport)) {
+   this.hideBusy();
+   return;
+   }
+
if (format === undefined || format === null) {
format = '';
}
if (options === undefined || options === null) {
options = '';
}
-   id = id || 'export'; // not any special download, simple export
 
this.showBusy(_('Downloading...'), false);
this._socket.sendMessage('downloadas ' +
diff --git a/loleaflet/src/map/handler/Map.WOPI.js 
b/loleaflet/src/map/handler/Map.WOPI.js
index a47fc09..38e0a5b 100644
--- a/loleaflet/src/map/handler/Map.WOPI.js
+++ b/loleaflet/src/map/handler/Map.WOPI.js
@@ -10,6 +10,9 @@ L.Map.WOPI = L.Handler.extend({
HidePrintOption: false,
HideSaveOption: false,
HideExportOption: false,
+   DisablePrint: false,
+   DisableExport: false,
+   DisableCopy: false,
 
_appLoadedConditions: {
doclayerinit: false,
@@ -57,6 +60,9 @@ L.Map.WOPI = L.Handler.extend({
this.HidePrintOption = !!wopiInfo['HidePrintOption'];
this.HideSaveOption = !!wopiInfo['HideSaveOption'];
this.HideExportOption = !!wopiInfo['HideExportOption'];
+   this.DisablePrint = !!wopiInfo['DisablePrint'];
+   this.DisableExport = !!wopiInfo['DisableExport'];
+   this.DisableCopy = !!wopiInfo['DisableCopy'];
 
this._map.fire('postMessage', {msgId: 'App_LoadingStatus', 
args: {Status: 'Frame_Ready'}});
},
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 319b3e8..4a5b1c8 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -269,6 +269,9 @@ bool DocumentBroker::load(std::shared_ptr& 
session, const std::st
 wopiInfo->set("HidePrintOption", wopifileinfo->_hidePrintOption);
 wopiInfo->set("HideSaveOption", wopifileinfo->_hideSaveOption);
 wopiInfo->set("HideExportOption", wopifileinfo->_hideExportOption);
+wopiInfo->set("DisablePrint", wopifileinfo->_disablePrint);
+wopiInfo->set("DisableExport", wopifileinfo->_disableExport);
+wopiInfo->set("DisableCopy", wopifileinfo->_disableCopy);
 
 std::ostringstream ossWopiInfo;
 wopiInfo->stringify(ossWopiInfo);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits