[Libreoffice-commits] online.git: loleaflet/dist loleaflet/src
Pranav Kant
pranavk at collabora.com
Tue Jun 21 09:35:50 UTC 2016
loleaflet/dist/loleaflet.html | 21 +++++++++++++++++++++
loleaflet/src/control/Control.Menubar.js | 21 +++++++++++++++++++++
loleaflet/src/core/Socket.js | 12 +++++++++---
3 files changed, 51 insertions(+), 3 deletions(-)
New commits:
commit 90aee41c7019b1cf9c4d6fa0258ad1feb6f61ff0
Author: Pranav Kant <pranavk at collabora.com>
Date: Tue Jun 21 15:05:11 2016 +0530
loleaflet: Dialog to show loolwsd, lokit version information
Change-Id: Ie05f0597d3464b5e7705bd1d1ff4ab5c03af013f
diff --git a/loleaflet/dist/loleaflet.html b/loleaflet/dist/loleaflet.html
index a9f6613..0a1bb9a 100644
--- a/loleaflet/dist/loleaflet.html
+++ b/loleaflet/dist/loleaflet.html
@@ -136,5 +136,26 @@
</script>
+ <div id="about-dialog" style="display:none; text-align: center;">
+ <h1 class="translatable">About LibreOffice Online</h1>
+ <hr/>
+ <h3 class="translatable">This version of LibreOffice Online is powered by<h3>
+ <p>
+ <h3>LOOLWSD</h3>
+ <div id="loolwsd-version"></div>
+ </p>
+ <p>
+ <h3>LOKit</h3>
+ <div id="lokit-version"></div>
+ </p>
+ </div>
+
+ <script>
+ var translatableContent = document.getElementsByClassName("translatable");
+ for (var i=0; i < translatableContent.length; i++) {
+ translatableContent[i].innerHTML = translatableContent[i].innerHTML.toLocaleString();
+ }
+ </script>
+
<script src="/loleaflet/%VERSION%/toolbar/toolbar.js"></script>
</body></html>
diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js
index 9bdfba6..8ac4e25 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -4,6 +4,7 @@
/* global $ _ map title vex */
L.Control.Menubar = L.Control.extend({
+ // TODO: Some mechanism to stop the need to copy duplicate menus (eg. Help)
options: {
text: [
{name: _('File'), type: 'menu', menu: [{name: _('Save'), type: 'unocommand', uno: '.uno:Save'},
@@ -44,6 +45,8 @@ L.Control.Menubar = L.Control.extend({
{name: _('Column'), type: 'unocommand', uno: '.uno:EntireColumn'},
{name: _('Cell'), type: 'unocommand', uno: '.uno:EntireCell'}]},
{name: _('Merge cells'), type: 'unocommand', uno: '.uno:MergeCells'}]
+ },
+ {name: _('Help'), type: 'menu', menu: [{name: _('About'), id: 'about', type: 'action'}]
}
],
@@ -86,6 +89,8 @@ L.Control.Menubar = L.Control.extend({
{name: _('Delete slide'), id: 'deletepage', type: 'action'},
{type: 'separator'},
{name: _('Fullscreen presentation'), id: 'fullscreen-presentation', type: 'action'}]
+ },
+ {name: _('Help'), type: 'menu', menu: [{name: _('About'), id: 'about', type: 'action'}]
}
],
@@ -122,6 +127,8 @@ L.Control.Menubar = L.Control.extend({
{type: 'separator'},
{name: _('Delete row'), type: 'unocommand', uno: '.uno:DeleteRows'},
{name: _('Delete column'), type: 'unocommand', uno: '.uno:DeleteColumns'}]
+ },
+ {name: _('Help'), type: 'menu', menu: [{name: _('About'), id: 'about', type: 'action'}]
}
],
@@ -290,6 +297,20 @@ L.Control.Menubar = L.Control.extend({
message: _('Are you sure you want to delete this slide?'),
callback: this._onDeleteSlide
}, this);
+ } else if (id === 'about') {
+ $('#about-dialog').modal({
+ overlayClose:true,
+ opacity: 80,
+ overlayCss: {
+ backgroundColor : '#000'
+ },
+ containerCss: {
+ overflow : 'hidden',
+ backgroundColor : '#fff',
+ padding : '20px',
+ border : '2px solid #000'
+ }
+ });
}
},
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 49092c8..08402ab 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -2,7 +2,7 @@
* L.Socket contains methods for the communication with the server
*/
-/* global _ vex */
+/* global _ vex $ */
L.Socket = L.Class.extend({
ProtocolVersionNumber: '0.1',
@@ -127,11 +127,17 @@ L.Socket = L.Class.extend({
var command = this.parseServerCmd(textMsg);
if (textMsg.startsWith('loolserver ')) {
// This must be the first message, unless we reconnect.
- // TODO: For now we expect perfect match.
- if (textMsg.substring(11) !== this.ProtocolVersionNumber) {
+ var versionStr = textMsg.split(' ');
+ $('#loolwsd-version').text(versionStr[1] + ' ' + versionStr[2]);
+
+ // TODO: For now we expect perfect match in protocol versions
+ if (versionStr[3] !== this.ProtocolVersionNumber) {
this.fire('error', {msg: _('Unsupported server version.')});
}
}
+ else if (textMsg.startsWith('lokitversion ')) {
+ $('#lokit-version').text(textMsg.substring(13));
+ }
else if (textMsg.startsWith('error:') && command.errorCmd === 'load') {
this.close();
More information about the Libreoffice-commits
mailing list