loleaflet/dist/errormessages.js |    1 +
 loleaflet/src/core/Socket.js    |   21 ++++++++++++++++-----
 2 files changed, 17 insertions(+), 5 deletions(-)

New commits:
commit 4dc6b574a02b0598b2e0c042c8b21e4815016e98
Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk>
Date:   Sat Jan 28 18:36:17 2017 -0500

    wsd: show a different limit message for non-dev builds
    
    For now we assume configurations of more than 50
    documents are not for dev or demo. This is because
    loading 50 documents will require a reasonably
    sized server and is beyond the default of 10.
    
    Change-Id: I099206d7d35a88102c1834ea9015b85810a3f190
    Reviewed-on: https://gerrit.libreoffice.org/33670
    Reviewed-by: Ashod Nakashian <ashnak...@gmail.com>
    Tested-by: Ashod Nakashian <ashnak...@gmail.com>

diff --git a/loleaflet/dist/errormessages.js b/loleaflet/dist/errormessages.js
index 329fa55..d1eccac 100644
--- a/loleaflet/dist/errormessages.js
+++ b/loleaflet/dist/errormessages.js
@@ -1,6 +1,7 @@
 exports.diskfull = _('No disk space left on server, please contact the server 
administrator to continue.');
 exports.emptyhosturl = _('The host URL is empty. The loolwsd server is 
probably misconfigured, please contact the administrator.');
 exports.limitreached = _('This development build is limited to %0 documents, 
and %1 connections - to avoid the impression that it is suitable for deployment 
in large enterprises. To find out more about deploying and scaling %2 check 
out: <br/><a href=\"%3\">%3</a>.');
+exports.limitreachedprod = _('This service is limited to %0 documents, and %1 
connections total by the admin. This limit has been reached. Please try again 
later.');
 exports.serviceunavailable = _('Service is unavailable. Please try again later 
and report to your administrator if the issue persists.');
 exports.unauthorized = _('Unauthorized WOPI host. Please try again later and 
report to your administrator if the issue persists.');
 exports.wrongwopisrc = _('Wrong WOPISrc, usage: WOPISrc=valid encoded URI, or 
file_path, usage: file_path=/path/to/doc/');
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 32ed572..e42e951 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -378,14 +378,25 @@ L.Socket = L.Class.extend({
                        textMsg = textMsg.substring(6);
                        if (command.errorKind === 'limitreached') {
                                this._map._fatal = true;
-                               textMsg = errorMessages.limitreached;
-                               textMsg = textMsg.replace(/%0/g, 
command.params[0]);
-                               textMsg = textMsg.replace(/%1/g, 
command.params[1]);
-                               textMsg = textMsg.replace(/%2/g, (typeof 
brandProductName !== 'undefined' ? brandProductName : 'LibreOffice Online'));
-                               textMsg = textMsg.replace(/%3/g, (typeof 
brandProductFAQURL !== 'undefined' ? brandProductFAQURL : 
'https://wiki.documentfoundation.org/Development/LibreOffice_Online'));
+                               this._map._active = false; // Practically 
disconnected.
+
+                               // Servers configured for more than 50 
documents are not demo/development.
+                               if (parseInt(command.params[0]) > 50) {
+                                       textMsg = 
errorMessages.limitreachedprod;
+                                       textMsg = textMsg.replace(/%0/g, 
command.params[0]);
+                                       textMsg = textMsg.replace(/%1/g, 
command.params[1]);
+                               }
+                               else {
+                                       textMsg = errorMessages.limitreached;
+                                       textMsg = textMsg.replace(/%0/g, 
command.params[0]);
+                                       textMsg = textMsg.replace(/%1/g, 
command.params[1]);
+                                       textMsg = textMsg.replace(/%2/g, 
(typeof brandProductName !== 'undefined' ? brandProductName : 'LibreOffice 
Online'));
+                                       textMsg = textMsg.replace(/%3/g, 
(typeof brandProductFAQURL !== 'undefined' ? brandProductFAQURL : 
'https://wiki.documentfoundation.org/Development/LibreOffice_Online'));
+                               }
                        }
                        else if (command.errorKind === 'serviceunavailable') {
                                this._map._fatal = true;
+                               this._map._active = false; // Practically 
disconnected.
                                textMsg = errorMessages.serviceunavailable;
                        }
                        this._map.fire('error', {msg: textMsg});
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to