owncloud / ocis

:atom_symbol: ownCloud Infinite Scale Stack
https://doc.owncloud.com/ocis/next/
Apache License 2.0
1.36k stars 180 forks source link

[Workaround] WOPI / OnlyOffice create new form file #6989

Closed wkloucek closed 10 months ago

wkloucek commented 1 year ago

Is your feature request related to a problem? Please describe.

I want to create new files for the OnlyOffice form editor. Forms to be created have the .docxf file extension (https://www.onlyoffice.com/blog/de/2022/03/onlyoffice-formulare-oform-docxf). It seems like there is no mimetype for it.

When looking at the /hosting/discovery endpoint of OO 7.4 it looks like the editor is the same for docx and docxf:

<action name="view" ext="docx" urlsrc="https://onlyoffice.kube.owncloud.test/hosting/wopi/word/view?&<rs=DC_LLCC&><dchat=DISABLE_CHAT&><embed=EMBEDDED&><fs=FULLSCREEN&><hid=HOST_SESSION_ID&><rec=RECORDING&><sc=SESSION_CONTEXT&><thm=THEME_ID&><ui=UI_LLCC&><wopisrc=WOPI_SOURCE&>&"/>
<action name="embedview" ext="docx" urlsrc="https://onlyoffice.kube.owncloud.test/hosting/wopi/word/view?embed=1&<rs=DC_LLCC&><dchat=DISABLE_CHAT&><embed=EMBEDDED&><fs=FULLSCREEN&><hid=HOST_SESSION_ID&><rec=RECORDING&><sc=SESSION_CONTEXT&><thm=THEME_ID&><ui=UI_LLCC&><wopisrc=WOPI_SOURCE&>&"/>
<action name="mobileView" ext="docx" urlsrc="https://onlyoffice.kube.owncloud.test/hosting/wopi/word/view?mobile=1&<rs=DC_LLCC&><dchat=DISABLE_CHAT&><embed=EMBEDDED&><fs=FULLSCREEN&><hid=HOST_SESSION_ID&><rec=RECORDING&><sc=SESSION_CONTEXT&><thm=THEME_ID&><ui=UI_LLCC&><wopisrc=WOPI_SOURCE&>&"/>
<action name="editnew" ext="docx" requires="locks,update" urlsrc="https://onlyoffice.kube.owncloud.test/hosting/wopi/word/edit?&<rs=DC_LLCC&><dchat=DISABLE_CHAT&><embed=EMBEDDED&><fs=FULLSCREEN&><hid=HOST_SESSION_ID&><rec=RECORDING&><sc=SESSION_CONTEXT&><thm=THEME_ID&><ui=UI_LLCC&><wopisrc=WOPI_SOURCE&>&"/>
<action name="edit" ext="docx" default="true" requires="locks,update" urlsrc="https://onlyoffice.kube.owncloud.test/hosting/wopi/word/edit?&<rs=DC_LLCC&><dchat=DISABLE_CHAT&><embed=EMBEDDED&><fs=FULLSCREEN&><hid=HOST_SESSION_ID&><rec=RECORDING&><sc=SESSION_CONTEXT&><thm=THEME_ID&><ui=UI_LLCC&><wopisrc=WOPI_SOURCE&>&"/>
<action name="mobileEdit" ext="docx" requires="locks,update" urlsrc="https://onlyoffice.kube.owncloud.test/hosting/wopi/word/edit?mobile=1&<rs=DC_LLCC&><dchat=DISABLE_CHAT&><embed=EMBEDDED&><fs=FULLSCREEN&><hid=HOST_SESSION_ID&><rec=RECORDING&><sc=SESSION_CONTEXT&><thm=THEME_ID&><ui=UI_LLCC&><wopisrc=WOPI_SOURCE&>&"/>

<action name="view" ext="docxf" urlsrc="https://onlyoffice.kube.owncloud.test/hosting/wopi/word/view?&<rs=DC_LLCC&><dchat=DISABLE_CHAT&><embed=EMBEDDED&><fs=FULLSCREEN&><hid=HOST_SESSION_ID&><rec=RECORDING&><sc=SESSION_CONTEXT&><thm=THEME_ID&><ui=UI_LLCC&><wopisrc=WOPI_SOURCE&>&"/>
<action name="embedview" ext="docxf" urlsrc="https://onlyoffice.kube.owncloud.test/hosting/wopi/word/view?embed=1&<rs=DC_LLCC&><dchat=DISABLE_CHAT&><embed=EMBEDDED&><fs=FULLSCREEN&><hid=HOST_SESSION_ID&><rec=RECORDING&><sc=SESSION_CONTEXT&><thm=THEME_ID&><ui=UI_LLCC&><wopisrc=WOPI_SOURCE&>&"/>
<action name="mobileView" ext="docxf" urlsrc="https://onlyoffice.kube.owncloud.test/hosting/wopi/word/view?mobile=1&<rs=DC_LLCC&><dchat=DISABLE_CHAT&><embed=EMBEDDED&><fs=FULLSCREEN&><hid=HOST_SESSION_ID&><rec=RECORDING&><sc=SESSION_CONTEXT&><thm=THEME_ID&><ui=UI_LLCC&><wopisrc=WOPI_SOURCE&>&"/>
<action name="editnew" ext="docxf" requires="locks,update" urlsrc="https://onlyoffice.kube.owncloud.test/hosting/wopi/word/edit?&<rs=DC_LLCC&><dchat=DISABLE_CHAT&><embed=EMBEDDED&><fs=FULLSCREEN&><hid=HOST_SESSION_ID&><rec=RECORDING&><sc=SESSION_CONTEXT&><thm=THEME_ID&><ui=UI_LLCC&><wopisrc=WOPI_SOURCE&>&"/>
<action name="edit" ext="docxf" default="true" requires="locks,update" urlsrc="https://onlyoffice.kube.owncloud.test/hosting/wopi/word/edit?&<rs=DC_LLCC&><dchat=DISABLE_CHAT&><embed=EMBEDDED&><fs=FULLSCREEN&><hid=HOST_SESSION_ID&><rec=RECORDING&><sc=SESSION_CONTEXT&><thm=THEME_ID&><ui=UI_LLCC&><wopisrc=WOPI_SOURCE&>&"/>
<action name="mobileEdit" ext="docxf" requires="locks,update" urlsrc="https://onlyoffice.kube.owncloud.test/hosting/wopi/word/edit?mobile=1&<rs=DC_LLCC&><dchat=DISABLE_CHAT&><embed=EMBEDDED&><fs=FULLSCREEN&><hid=HOST_SESSION_ID&><rec=RECORDING&><sc=SESSION_CONTEXT&><thm=THEME_ID&><ui=UI_LLCC&><wopisrc=WOPI_SOURCE&>&"/>

Therefore you can just create a .docxf file and edit it in the form editor view.

But I cannot configure oCIS to allow creating docxf forms without cannibalizing a different file format.

Describe the solution you'd like

A possible solution / workaround is to make up a mimetype for docxf files in REVA's pkg/mime/mime.go:

"docxf":                    "application/vnd.openxmlformats-officedocument.wordprocessingml.form",

Then I can configure following actions in the mimetypes section (in this example via the oCIS Helm chart (https://github.com/owncloud/ocis-charts/blob/49eea9b36cffa590b3e40b9e9aa0db1717101bbc/charts/ocis/values.yaml#L232-L243):

- mime_type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
  extension: docx
  name: Text document
  description: Text document
  icon: image-edit
  default_app: "OnlyOffice"
  allow_creation: true
- mime_type: application/vnd.openxmlformats-officedocument.wordprocessingml.form
  extension: docxf
  name: Form document
  description: Form document
  icon: image-edit
  default_app: "OnlyOffice"
  allow_creation: true
...
...

It'll leave me with this "New file" menu in Web:

image

Describe alternatives you've considered

Probably we're doing something really complicated with the mime type to file extension conversion. We could probably unclutter that.

kobergj commented 1 year ago

Not sure if you prefer another solution and/or more investigation. But if it helps to just add this mimetype you can have it quick and easy: https://github.com/cs3org/reva/pull/4116

wkloucek commented 1 year ago

I think adding non well known mimetypes is only a workaround. I think we should look at why we're doing a lot of complicated mime type to file extension conversions and vice versa.

kobergj commented 1 year ago

Then let's plan this ticket properly for one of the next sprints. It is more a story than a bug anyways

dj4oC commented 1 year ago

@tbsbdr please schedule.