loleaflet/README                         |    8 +++++
 loleaflet/build/deps.js                  |    5 ++-
 loleaflet/debug/document/loleaflet.html  |    1 
 loleaflet/dist/errormessages.js          |    3 +-
 loleaflet/dist/loleaflet.css             |    9 ++++++
 loleaflet/main.css                       |    1 
 loleaflet/main.js                        |    1 
 loleaflet/src/control/Control.Infobar.js |   42 +++++++++++++++++++++++++++++++
 loleaflet/src/core/Socket.js             |    9 ++++--
 9 files changed, 73 insertions(+), 6 deletions(-)

New commits:
commit 4c9872188f3ae5f876fb5652273c6bdb10065d14
Author: Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
Date:   Thu Feb 22 14:19:03 2018 +0100

    Add non-obtrusive notification method (infobar-alike)
    
    This reuses the vex dialogs and pushes notifications to the bottom right 
area.
    Converted the limit reached notification to this new type.
    
    Change-Id: I20f0c1202eecde028e70156f02ba31497ef2f9b9

diff --git a/loleaflet/README b/loleaflet/README
index acc790da..4694417a 100644
--- a/loleaflet/README
+++ b/loleaflet/README
@@ -300,6 +300,14 @@ Error:
             + [e.cmd] = the command that caused the error
             + [e.kind] = the kind of error
 
+Infobars:
+    - events
+        map.on('infobar', function (e) {}) where
+            + [e.msg] = a message
+            + [e.actionlabel] = Label for the action button
+            + [e.action] = A link (starting with http).
+                           Please extend to allow other actions when needed.
+
 CommandValues:
     - api:
         map.getToolbarCommandValues(command)
diff --git a/loleaflet/build/deps.js b/loleaflet/build/deps.js
index 9c905d76..59f4cde3 100644
--- a/loleaflet/build/deps.js
+++ b/loleaflet/build/deps.js
@@ -343,8 +343,9 @@ var deps = {
 
        ControlDialog: {
                src: ['control/Control.js',
-                     'control/Control.LokDialog.js',
-                     'control/Control.AlertDialog.js'],
+                       'control/Control.LokDialog.js',
+                       'control/Control.AlertDialog.js',
+                       'control/Control.Infobar.js'],
                heading: 'Controls',
                desc: 'Handles vex dialogs for displaying alerts'
        },
diff --git a/loleaflet/debug/document/loleaflet.html 
b/loleaflet/debug/document/loleaflet.html
index 49c0dfce..2d7a6a75 100644
--- a/loleaflet/debug/document/loleaflet.html
+++ b/loleaflet/debug/document/loleaflet.html
@@ -20,6 +20,7 @@
 <link rel="stylesheet" 
href="/loleaflet/%VERSION%/contextMenu/jquery.contextMenu.css">
 <link rel="stylesheet" href="/loleaflet/%VERSION%/dialog/vex.css" />
 <link rel="stylesheet" href="/loleaflet/%VERSION%/dialog/vex-theme-plain.css" 
/>
+<link rel="stylesheet" 
href="/loleaflet/%VERSION%/dialog/vex-theme-bottom-right-corner.css" />
 <link rel="stylesheet" href="/loleaflet/%VERSION%/toolbar/w2ui.min.css" />
 <link rel="stylesheet" href="/loleaflet/%VERSION%/toolbar/select2.min.css" />
 <link rel="stylesheet" href="/loleaflet/%VERSION%/smartmenus/sm-core-css.css" 
/>
diff --git a/loleaflet/dist/errormessages.js b/loleaflet/dist/errormessages.js
index edda0764..36937c06 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 is an unsupported version of {productname}. To 
avoid the impression that it is suitable for deployment in enterprises, this 
version is limited to {docs} documents, and {connections} 
connections.<br/>{a}More information and support{/a}');
+exports.limitreached = _('This is an unsupported version of {productname}. To 
avoid the impression that it is suitable for deployment in enterprises, this 
version is limited to {docs} documents, and {connections} connections.');
+exports.infoandsupport = _('More information and support');
 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.');
diff --git a/loleaflet/dist/loleaflet.css b/loleaflet/dist/loleaflet.css
index f458c371..6315efbf 100644
--- a/loleaflet/dist/loleaflet.css
+++ b/loleaflet/dist/loleaflet.css
@@ -362,3 +362,12 @@ body {
         -webkit-user-select: none;
         -o-user-select: none;
 }
+
+/* Infobar */
+.vex-theme-bottom-right-corner .vex-dialog-message {
+       font-size: 1em;
+}
+/* Place above statusbar */
+.vex.vex-theme-bottom-right-corner .vex-content {
+       bottom: 40px !important;
+}
\ No newline at end of file
diff --git a/loleaflet/main.css b/loleaflet/main.css
index 729b21b3..de61241f 100644
--- a/loleaflet/main.css
+++ b/loleaflet/main.css
@@ -14,6 +14,7 @@
 @import url('node_modules/jquery-contextmenu/dist/jquery.contextMenu.css');
 @import url('node_modules/vex-js/css/vex.css');
 @import url('node_modules/vex-js/css/vex-theme-plain.css');
+@import url('node_modules/vex-js/css/vex-theme-bottom-right-corner.css');
 @import url('node_modules/w2ui/w2ui.css');
 @import url('node_modules/select2/dist/css/select2.css');
 @import url('node_modules/smartmenus/dist/css/sm-core-css.css');
diff --git a/loleaflet/main.js b/loleaflet/main.js
index 02bedc68..8a79a8bb 100644
--- a/loleaflet/main.js
+++ b/loleaflet/main.js
@@ -127,6 +127,7 @@ map.addControl(L.control.columnHeader());
 map.addControl(L.control.rowHeader());
 map.addControl(L.control.contextMenu());
 map.addControl(L.control.menubar());
+map.addControl(L.control.infobar());
 map.loadDocument();
 
 window.addEventListener('beforeunload', function () {
diff --git a/loleaflet/src/control/Control.Infobar.js 
b/loleaflet/src/control/Control.Infobar.js
new file mode 100644
index 00000000..de70ff2f
--- /dev/null
+++ b/loleaflet/src/control/Control.Infobar.js
@@ -0,0 +1,42 @@
+/*
+ * L.Control.Infobar used for displaying non-annoying info messages
+ */
+
+/* global vex $ */
+L.Control.Infobar = L.Control.extend({
+       onAdd: function (map) {
+               map.on('infobar', this._onInfobar, this);
+       },
+
+       _onInfobar: function(e) {
+               if (!e.msg)
+                       return;
+
+               var buttons = [];
+               var callback = function() {};
+               if (e.actionLabel && e.action) {
+                       buttons.push($.extend({}, vex.dialog.buttons.YES, { 
text: e.actionLabel }));
+                       callback = function (value) {
+                               if (value === false) // close btn clicked
+                                       return;
+
+                               if (e.action.startsWith('http')) { // We have a 
link
+                                       var win = window.open(e.action, 
'_blank');
+                                       win.focus();
+                               }
+                       }
+               }
+
+               vex.dialog.open({
+                       message: e.msg,
+                       className: 'vex-theme-bottom-right-corner',
+                       showCloseButton: true,
+                       buttons: buttons,
+                       callback: callback
+               });
+       }
+});
+
+L.control.infobar = function (options) {
+       return new L.Control.Infobar(options);
+};
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 3e33a88d..53677404 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -574,9 +574,12 @@ L.Socket = L.Class.extend({
                                                brandProductName : 'LibreOffice 
Online'));
                                brandProductFAQURL = (typeof brandProductFAQURL 
!== 'undefined') ?
                                                brandProductFAQURL : 
'https://hub.libreoffice.org/professional-online-support';
-                               textMsg = textMsg.replace(/{a}/g, '<a 
target="_blank" href="'+brandProductFAQURL+'">');
-                               textMsg = textMsg.replace(/{\/a}/g, '</a>');
-                               this._map.fire('error', {msg: textMsg});
+                               this._map.fire('infobar',
+                                       {
+                                               msg: textMsg,
+                                               action: brandProductFAQURL,
+                                               actionLabel: 
errorMessages.infoandsupport
+                                       });
                        }
                }
                else if (textMsg.startsWith('pong ') && this._map._docLayer && 
this._map._docLayer._debug) {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to