[Libreoffice-commits] online.git: 2 commits - loleaflet/js loleaflet/src
loleaflet/js/global.js|2 +- loleaflet/src/control/Control.Menubar.js | 12 ++-- loleaflet/src/control/Control.PartsPreview.js |6 +++--- loleaflet/src/control/Control.Toolbar.js |4 ++-- loleaflet/src/control/Permission.js |6 +++--- loleaflet/src/layer/AnnotationManager.js |2 +- loleaflet/src/layer/marker/Annotation.js |2 +- loleaflet/src/layer/tile/CalcTileLayer.js |2 +- loleaflet/src/layer/tile/GridLayer.js |2 +- loleaflet/src/layer/tile/ImpressTileLayer.js |2 +- loleaflet/src/layer/tile/WriterTileLayer.js |2 +- loleaflet/src/map/Clipboard.js|2 +- loleaflet/src/map/Map.js | 20 ++-- 13 files changed, 32 insertions(+), 32 deletions(-) New commits: commit f070a0ffd4450932e27b41ef3bdb1d86705cf694 Author: Jan Holesovsky AuthorDate: Wed Apr 8 14:15:22 2020 +0200 Commit: Jan Holesovsky CommitDate: Fri Apr 10 13:12:07 2020 +0200 mobile, tablet: Even the small tablets or large phones should get the phone UI. There is clearly not enough space for the normal sidebar when one of the dimensions is below 768. Change-Id: Iac27f12f837b9e6a64d1cce7b8376009bbe2c15f Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92004 Tested-by: Jenkins CollaboraOffice Reviewed-by: Jan Holesovsky diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js index a4fd77bab..3022d94a3 100644 --- a/loleaflet/js/global.js +++ b/loleaflet/js/global.js @@ -149,7 +149,7 @@ return true; } - return L.Browser.mobile && screen.width < 768; + return L.Browser.mobile && (screen.width < 768 || screen.height < 768); }, // Mobile device with big screen size. isTablet: function() { commit 7725c7f309f343c8db0ed19adfbfd667bf66573f Author: Jan Holesovsky AuthorDate: Wed Apr 8 13:32:59 2020 +0200 Commit: Jan Holesovsky CommitDate: Fri Apr 10 13:11:52 2020 +0200 mobile: Never use L.Browser.mobile, instead use window.mode.isXYZ(). The L.Browser detects the browser capabilities, but the window.mode.isMobile()/isTablet()/isDesktop() is what decides what form factor are we targeting in the particular instance of the Online. This commit tries to kill convert the L.Browser.mobile checks into the appropriate window.mode.isXYZ(), hope I got the intention right on most of the places - it wouldn't be correct to blindly convert everything to (isMobile() || isTablet()). Change-Id: I57430058ec15deb5f67f9c645d234f998fbf539d Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92003 Tested-by: Jenkins CollaboraOffice Reviewed-by: Jan Holesovsky diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js index f7aa69111..dac5d07d2 100644 --- a/loleaflet/src/control/Control.Menubar.js +++ b/loleaflet/src/control/Control.Menubar.js @@ -841,7 +841,7 @@ L.Control.Menubar = L.Control.extend({ var pageStyles = e.commandValues['HeaderFooter']; for (var iterator in pageStyles) { style = pageStyles[iterator]; - if (!L.Browser.mobile) { + if (!window.mode.isMobile()) { $menuHeader.append(this._createUnoMenuItem(_(style), constHeader + encodeURIComponent(style) + constArg, style)); $menuFooter.append(this._createUnoMenuItem(_(style), constFooter + encodeURIComponent(style) + constArg, style)); } else { @@ -897,12 +897,12 @@ L.Control.Menubar = L.Control.extend({ var $nav = $menu.parent(); if (this.checked) { self._map.fire('closesidebar'); - if (!L.Browser.mobile) { + if (!window.mode.isMobile()) { // Surely this code, if it really is related only to the hamburger menu, // will never be invoked on non-mobile browsers? I might be wrong though. // If you notice this logging, please modify this comment to indicate what is // going on. - console.log('==> Assertion failed!? Not L.Browser.mobile? Control.Menubar.js #1'); + console.log('==> Assertion failed!? Not
[Libreoffice-commits] online.git: 2 commits - loleaflet/js loleaflet/src
loleaflet/js/global.js | 11 +++ loleaflet/src/core/Socket.js | 29 + 2 files changed, 12 insertions(+), 28 deletions(-) New commits: commit f5791f9e1f7b4c77cba62158fe342c248f715284 Author: Tor Lillqvist AuthorDate: Wed Mar 6 15:29:17 2019 +0200 Commit: Tor Lillqvist CommitDate: Wed Mar 6 15:30:49 2019 +0200 Send the HULLO message to the mobile app native code already in global.js Apparently the connect() function in Socket.js is now dead code? Now the iOS app seems to work as before. Change-Id: Ib6c2b9a08e818ec8f4b5dbdfbf75f507c4bb7069 diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js index bc1e96e05..3057361af 100644 --- a/loleaflet/js/global.js +++ b/loleaflet/js/global.js @@ -134,5 +134,16 @@ } global.socket.binaryType = 'arraybuffer'; + + if (window.ThisIsAMobileApp) { + // This corresponds to the initial GET request when creating a WebSocket + // connection and tells the app's code that it is OK to start invoking + // TheFakeWebSocket's onmessage handler. The app code that handles this + // special message knows the document to be edited anyway, and can send it + // on as necessary to the Online code. + window.postMobileMessage('HULLO'); + // A FakeWebSocket is immediately open. + this.socket.onopen(); + } } }(window)); commit 9dee58271840f0f6167b9ad1377d60a40097cbf3 Author: Tor Lillqvist AuthorDate: Wed Mar 6 15:28:25 2019 +0200 Commit: Tor Lillqvist CommitDate: Wed Mar 6 15:28:54 2019 +0200 Bin the now duplicate and unnecessary FakeWebSocket things in Socket.js global.js now defines windows.FakeWebSocket. Change-Id: I9a430a684769ab071838e4e3e30372f26f761139 diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js index 3fe3cb2c7..5b0b4 100644 --- a/loleaflet/src/core/Socket.js +++ b/loleaflet/src/core/Socket.js @@ -5,33 +5,6 @@ /* global _ vex $ errorMessages Uint8Array brandProductName brandProductFAQURL */ -window.fakeWebSocketCounter = 0; -function FakeWebSocket() { - this.binaryType = 'arraybuffer'; - this.bufferedAmount = 0; - this.extensions = ''; - this.protocol = ''; - this.readyState = 1; - this.id = window.fakeWebSocketCounter++; - this.sendCounter = 0; - this.onclose = function() { - }; - this.onerror = function() { - }; - this.onmessage = function() { - }; - this.onopen = function() { - }; -} - -FakeWebSocket.prototype.close = function() { -} - -FakeWebSocket.prototype.send = function(data) { - this.sendCounter++; - window.postMobileMessage(data); -} - L.Socket = L.Class.extend({ ProtocolVersionNumber: '0.1', ReconnectCount: 0, @@ -59,7 +32,7 @@ L.Socket = L.Class.extend({ this.close(); } if (window.ThisIsAMobileApp) { - this.socket = new FakeWebSocket(); + this.socket = new window.FakeWebSocket(); window.TheFakeWebSocket = this.socket; } else { var wopiSrc = ''; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: 2 commits - loleaflet/js loleaflet/src
loleaflet/js/toolbar.js |3 loleaflet/src/control/Signing.js | 207 ++- 2 files changed, 123 insertions(+), 87 deletions(-) New commits: commit 8ddfbead3ca62146a316f1e7959a0c11b4a65075 Author: Tomaž Vajngerl AuthorDate: Tue Jan 1 22:00:52 2019 +0100 Commit: Tomaž Vajngerl CommitDate: Tue Jan 1 23:40:30 2019 +0100 add functions to get API, iframe and WOPI URL for Vereign Change-Id: Ib97b696f5a3965c4bdf6ddc79aa4cab196630ce2 Reviewed-on: https://gerrit.libreoffice.org/65785 Reviewed-by: Tomaž Vajngerl Tested-by: Tomaž Vajngerl diff --git a/loleaflet/src/control/Signing.js b/loleaflet/src/control/Signing.js index 7c308c482..5f2bc61b8 100644 --- a/loleaflet/src/control/Signing.js +++ b/loleaflet/src/control/Signing.js @@ -29,6 +29,16 @@ function getVereignWopiURL() { return vereignURL + '/wopi/'; } +function getVereignApiURL() { + var vereignURL = window.documentSigningURL == null ? '' : window.documentSigningURL; + return vereignURL + '/api/'; +} + +function getVereignIFrameURL() { + var vereignURL = window.documentSigningURL == null ? '' : window.documentSigningURL; + return vereignURL + '/vcl/js/iframe'; +} + function randomName() { return Math.random().toString(36).substring(2) + (new Date()).getTime().toString(36); } @@ -495,8 +505,8 @@ L.Map.include({ } } }, - vereignURL + '/vcl/js/iframe', - vereignURL + '/api/', + getVereignIFrameURL(), + getVereignApiURL(), getVereignWopiURL() ).then(function(lib) { library = lib; commit 4656bdcb38fef68410d4ce62517ccc9732cddba6 Author: Tomaž Vajngerl AuthorDate: Tue Jan 1 21:58:28 2019 +0100 Commit: Tomaž Vajngerl CommitDate: Tue Jan 1 23:40:18 2019 +0100 Combine Sign and Upload to one action First the document is signed, then when the signature status is returned, upload to Vereign. Change-Id: I02a3a3d401cffa295751483ba85bd45c22c7950f Reviewed-on: https://gerrit.libreoffice.org/65784 Reviewed-by: Tomaž Vajngerl Tested-by: Tomaž Vajngerl diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js index 0d7335049..7b42ae28a 100644 --- a/loleaflet/js/toolbar.js +++ b/loleaflet/js/toolbar.js @@ -1096,8 +1096,7 @@ function initNormalToolbar(toolItems) { items: [ {type: 'html', id: 'left'}, {type: 'html', id: 'logo', html: 'Vereign'}, - {type: 'button', id: 'sign', caption: _('Sign'), img: '', hint: _('Sign document')}, - {type: 'button', id: 'upload', caption: _('Upload'), img: '', hint: _('Upload document')}, + {type: 'button', id: 'sign-upload', caption: _('Sign & Upload'), img: '', hint: _('Sign and upload document')}, {type: 'break' }, {type: 'html', id: 'identity-label', html: '' + _('Identity:') + ''}, {type: 'html', id: 'identity', html: _('N/A')}, diff --git a/loleaflet/src/control/Signing.js b/loleaflet/src/control/Signing.js index 1450d2615..7c308c482 100644 --- a/loleaflet/src/control/Signing.js +++ b/loleaflet/src/control/Signing.js @@ -14,6 +14,8 @@ var oldtoolbarSize = null; var _map = null; var currentDocumentSigningStatus = 'N/A' +var awaitForDocumentStatusToUpload = false; + function isSuccess(result) { return result.code == '200'; } @@ -22,6 +24,22 @@ function haveIdentity() { return identity != null; } +function getVereignWopiURL() { + var vereignURL = window.documentSigningURL == null ? '' : window.documentSigningURL; + return vereignURL + '/wopi/'; +} + +function randomName() { + return Math.random().toString(36).substring(2) + (new Date()).getTime().toString(36); +} + +function getCurrentDocumentFilename(documentType) { + var filename = _map['wopi'].BaseFileName; + if (!filename) + filename = randomName() + '.' + documentType; + return filename; +} + function updateIndentity() { if (library) { if (identity) { @@ -121,8 +139,7 @@ function adjustUIState() { if (currentPassport) { w2ui['document-signing-bar'].show('passport'); w2ui['document-signing-bar'].show('current-passport'); - w2ui['document-signing-bar'].show('sign'); - w2ui['document-signing-bar'].show('upload'); + w2ui['document-signing-bar'].show('sign-upload'); } else {
[Libreoffice-commits] online.git: 2 commits - loleaflet/js loleaflet/src
loleaflet/js/toolbar.js | 12 -- loleaflet/src/control/Signing.js | 46 --- 2 files changed, 48 insertions(+), 10 deletions(-) New commits: commit 77e67f44b968fd91d2e0b97d71f269bc77886cc3 Author: Tomaž Vajngerl AuthorDate: Thu Nov 15 09:47:37 2018 +0100 Commit: Tomaž Vajngerl CommitDate: Thu Nov 29 21:46:57 2018 +0100 separate lib. init. from login, show UI elements on state change It is needed to separate initialization of the library and login (the button) as you may already be logged in if you have credentials in the local storage (already logged in through vereign website for example). So behaviour now is either you get logged in immediately or you get a login button. There is a lot of state changes where various elements of the infobar are show or hidden. To make it easier to track the changes it is necessary to have showing/hiding at one function which is triggered every time a state change may occur. Change-Id: I0f36f342baaf80dc109f608e294b89a955a6572e Reviewed-on: https://gerrit.libreoffice.org/63413 Reviewed-by: Tomaž Vajngerl Tested-by: Tomaž Vajngerl diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js index c4c0ce685..15b91adeb 100644 --- a/loleaflet/js/toolbar.js +++ b/loleaflet/js/toolbar.js @@ -952,8 +952,8 @@ function initNormalToolbar(toolItems) { {type: 'html', id: 'logo', html: 'Vereign'}, {type: 'button', id: 'sign', caption: 'Sign', img: '', hint: _('Sign document')}, {type: 'break' }, - {type: 'html', id: 'user-label', html: 'User:'}, - {type: 'html', id: 'user', html: ''}, + {type: 'html', id: 'identity-label', html: 'Identity:'}, + {type: 'html', id: 'identity', html: 'N/A'}, {type: 'break' }, {type: 'button', id: 'logout', caption: 'Logout', img: '', hint: _('Logout')}, {type: 'button', id: 'login', caption: 'Login', img: '', hint: _('Login')}, @@ -1471,10 +1471,6 @@ function onDocLayerInit() { $('#spreadsheet-toolbar').hide(); $('#presentation-toolbar').hide(); - if (L.DomUtil.get('document-signing-bar') !== null) { - w2ui['document-signing-bar'].hide('logout'); - } - break; case 'presentation': var presentationToolbar = w2ui['presentation-toolbar']; @@ -1513,6 +1509,10 @@ function onDocLayerInit() { break; } + if (L.DomUtil.get('document-signing-bar') !== null) { + map.signingInitializeBar(); + } + if (L.Browser.mobile) { _mobilify(); nUsers = '%n'; diff --git a/loleaflet/src/control/Signing.js b/loleaflet/src/control/Signing.js index 6ee79bba8..ba656565f 100644 --- a/loleaflet/src/control/Signing.js +++ b/loleaflet/src/control/Signing.js @@ -17,22 +17,45 @@ function updateIndentity() { if (identity) { library.getIdentityProfile(identity.authentication.publicKey).then(function(result) { var initials = result.data.initials; - var color = result.data.identityColor; - console.log(initials + ' ' + color); - w2ui['document-signing-bar'].get('user').html = '' + initials + ''; + w2ui['document-signing-bar'].get('identity').html = '' + initials + ''; w2ui['document-signing-bar'].refresh(); }); } else { - w2ui['document-signing-bar'].get('user').html = ''; + w2ui['document-signing-bar'].get('identity').html = ''; w2ui['document-signing-bar'].refresh(); } } } +function adjustUIState() { + if (library && identity) { + w2ui['document-signing-bar'].hide('login'); + w2ui['document-signing-bar'].show('logout'); + w2ui['document-signing-bar'].show('identity-label'); + w2ui['document-signing-bar'].show('identity'); + w2ui['document-signing-bar'].show('sign'); + } + else { + if (library) + w2ui['document-signing-bar'].show('login'); + else + w2ui['document-signing-bar'].hide('login'); + + w2ui['document-signing-bar'].hide('logout'); + w2ui['document-signing-bar'].hide('identity-label'); + w2ui['document-signing-bar'].hide('identity'); +
[Libreoffice-commits] online.git: 2 commits - loleaflet/js loleaflet/src Mobile/Mobile Mobile/Mobile.xcodeproj
Mobile/Mobile.xcodeproj/project.pbxproj | 134 +++ Mobile/Mobile/Document.mm|1 Mobile/Mobile/DocumentViewController.mm | 49 +-- loleaflet/js/toolbar.js |8 + loleaflet/src/control/Control.Menubar.js |8 + 5 files changed, 186 insertions(+), 14 deletions(-) New commits: commit ed348677f22d887d80c76b5dcae22a109e457f72 Author: Tor Lillqvist AuthorDate: Fri Oct 12 17:48:45 2018 +0300 Commit: Tor Lillqvist CommitDate: Fri Oct 12 17:48:45 2018 +0300 Add "Close document" menu entry (or corresponding button) to the iOS app In the JS, send the special "BYE" message to the app code. In the iOS app code, handle that message by closing the fake socket connection to the Online code, which eventually will cause the corresponding thread to exit etc, and the app to return to displaying the DocumentBrowserViewController. (Currently it causes the whole app to exit which is wrong of course; an iOS should never exit intentionally.) diff --git a/Mobile/Mobile/Document.mm b/Mobile/Mobile/Document.mm index eadf653ec..e36b219e0 100644 --- a/Mobile/Mobile/Document.mm +++ b/Mobile/Mobile/Document.mm @@ -38,6 +38,7 @@ NSURL *url = [[NSBundle mainBundle] URLForResource:@"loleaflet" withExtension:@"html"]; NSURLComponents *components = [NSURLComponents componentsWithURL:url resolvingAgainstBaseURL:NO]; components.queryItems = @[ [NSURLQueryItem queryItemWithName:@"file_path" value:[NSString stringWithUTF8String:uri.c_str()]], + [NSURLQueryItem queryItemWithName:@"closebutton" value:@"1"], [NSURLQueryItem queryItemWithName:@"permission" value:@"edit"], [NSURLQueryItem queryItemWithName:@"debug" value:@"true"]]; NSURLRequest *request = [[NSURLRequest alloc]initWithURL:components.URL]; diff --git a/Mobile/Mobile/DocumentViewController.mm b/Mobile/Mobile/DocumentViewController.mm index 5f203fdef..fc7f2deee 100644 --- a/Mobile/Mobile/DocumentViewController.mm +++ b/Mobile/Mobile/DocumentViewController.mm @@ -19,7 +19,7 @@ #import "DocumentViewController.h" @interface DocumentViewController() { -BOOL waitingForInitialLoad; +int closeNotificationPipeForForwardingThread[2]; } @end @@ -157,20 +157,42 @@ rc = fakeSocketConnect(self.document->fakeClientFd, loolwsd_server_socket_fd); assert(rc != -1); +// Create a socket pair to notify the below thread when the document has been closed +fakeSocketPipe2(closeNotificationPipeForForwardingThread); + // Start another thread to read responses and forward them to the JavaScript dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ while (true) { - struct pollfd p; - p.fd = self.document->fakeClientFd; - p.events = POLLIN; - if (fakeSocketPoll(, 1, -1) == 1) { - int n = fakeSocketAvailableDataLength(self.document->fakeClientFd); - if (n == 0) + struct pollfd p[2]; + p[0].fd = self.document->fakeClientFd; + p[0].events = POLLIN; + p[1].fd = self->closeNotificationPipeForForwardingThread[1]; + p[1].events = POLLIN; + if (fakeSocketPoll(p, 2, -1) > 0) { + if (p[1].revents == POLLIN) { + // The code below handling the "BYE" fake Websocket + // message has closed the other end of the + // closeNotificationPipeForForwardingThread. Let's close + // the other end too just for cleanliness, even if a + // FakeSocket as such is not a system resource so nothing + // is saved by closing it. + fakeSocketClose(self->closeNotificationPipeForForwardingThread[0]); + + // Close our end of the fake socket connection to the + // ClientSession thread, so that it terminates + fakeSocketClose(self.document->fakeClientFd); + return; - std::vector buf(n); - n =