This was initially introduced in OC so that we know which directory to
go after we close the editor but this seems unnecessary here in NC as
richdocuments is just an iframe which is removed from DOM when we close
the document.
(cherry picked from commit a5f6569591)
Signed-off-by: Andras Timar <andras.timar@collabora.com>
loleaflet expect a BCP47 language tag syntax while OC.getLocale returns
a lanugage tag where subtags are separated by '_' instead of '-'
(BCP47).
It seems safe to just replace '_' with '-' before feeding it to
loleaflet
(cherry picked from commit 5596ae17ce)
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Also simplify the logic during file action registration. Basically, we
should try to open all known mimetypes; file permissions are taken care
of later in the WOPI protocol.
Without this commit, it is not possible to open a document in a
directory for which user has no write access.
(cherry picked from commit f36c5106d6)
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Adds a new property PostMessageOrigin to WOPI's CheckFileInfo.
The inner frame then only sends message to target with origin
mentioned in this property.
Also implement editor initialization WOPI specs. Inner frame
sends a App_LoadingStatus message to us when ready, and we send
Host_PostmessageReady when we are ready.
There's a race condition here between page being rendered with
all the document(s) information and showing the editor to the
user. The later requires the former as it uses data rendered into
the page.
In most cases, former is quick enough and we do not see any
problems, but in some cases, mostly when the server is responding
very slowly, it will lag behind the later causing the editor to
be shown before data is rendered into the page leading to '404
Object not found'.
This should, hopefully, avoid such cases.
... so no need to create a deferred object separately and then
resolve it manually. This is since jquery 1.5
See: https://api.jquery.com/jquery.getjson/
Route /close/ doesn't mean anything, and we were making this
additional call always before closing the document. This had a
side-effect that sometimes /close/ call would be processed after
we assign returnToDir to window.location making browser always
stuck in richdocuments#index rather than reeturnToDir. This was
mainly the problem in firefox with owncloud9