Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template Files for WebOffice #10276

Merged
merged 1 commit into from
Oct 17, 2024
Merged

Template Files for WebOffice #10276

merged 1 commit into from
Oct 17, 2024

Conversation

micbar
Copy link
Contributor

@micbar micbar commented Oct 9, 2024

Description

Adds server-side template processing for WebOffice

We are supporting the following mime types:

OnlyOffice

  • MimeType: application/vnd.ms-word.template.macroenabled.12
    TargetExtension: docx

  • MimeType: application/vnd.oasis.opendocument.text-template
    TargetExtension: docx

  • MimeType: application/vnd.openxmlformats-officedocument.wordprocessingml.template
    TargetExtension: docx

  • MimeType: application/vnd.oasis.opendocument.spreadsheet-template
    TargetExtension: xlsx

  • MimeType: application/vnd.ms-excel.template.macroenabled.12
    TargetExtension: xlsx

  • MimeType: application/vnd.openxmlformats-officedocument.spreadsheetml.template
    TargetExtension: xlsx

  • MimeType: application/vnd.oasis.opendocument.presentation-template
    TargetExtension: pptx

  • MimeType: application/vnd.ms-powerpoint.template.macroenabled.12
    TargetExtension: pptx

  • MimeType: application/vnd.openxmlformats-officedocument.presentationml.template
    TargetExtension: pptx

Collabora

  • MimeType: application/vnd.oasis.opendocument.spreadsheet-template
    TargetExtension: ods

  • MimeType: application/vnd.oasis.opendocument.text-template
    TargetExtension: odt

  • MimeType: application/vnd.oasis.opendocument.presentation-template
    TargetExtension: odp

API

app/list

We have one new property.

target_ext- string with the suggested file extension when creating a new empty file from that template.

    {
      "mime_type": "application/vnd.oasis.opendocument.spreadsheet-template",
      "app_providers": [
        {
          "address": "com.owncloud.api.collaboration.OnlyOffice",
          "name": "OnlyOffice",
          "description": "Open office documents with Collabora",
          "icon": "https://onlyoffice.owncloud.test/web-apps/apps/documenteditor/main/resources/img/favicon.ico",
          "secure_view": false,
          "target_ext": "xlsx"
        }
      ]
    }

app/open

There is a new parameter template_id which takes a fileid. It should be used to specify the template which should be loaded during the open request.

Related Issue

Motivation and Context

How Has This Been Tested?

  • test environment:
  • test case 1:
  • test case 2:
  • ...

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

Copy link

update-docs bot commented Oct 9, 2024

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@kulmann
Copy link
Member

kulmann commented Oct 14, 2024

@micbar the target_ext field should live in the mime type struct, not in the app struct, right? I think it should look like this:

 {
      "mime_type": "application/vnd.oasis.opendocument.spreadsheet-template",
      "target_ext": "xlsx",
      "app_providers": [
        {
          "address": "com.owncloud.api.collaboration.OnlyOffice",
          "name": "OnlyOffice",
          "description": "Open office documents with Collabora",
          "icon": "https://onlyoffice.owncloud.test/web-apps/apps/documenteditor/main/resources/img/favicon.ico",
          "secure_view": false,
          "template": true
        }
      ]
    }

Maybe we should also rename template to something like template_conversion?

@micbar
Copy link
Contributor Author

micbar commented Oct 15, 2024

@micbar the target_ext field should live in the mime type struct, not in the app struct, right? I think it should look like this:

 {
      "mime_type": "application/vnd.oasis.opendocument.spreadsheet-template",
      "target_ext": "xlsx",
      "app_providers": [
        {
          "address": "com.owncloud.api.collaboration.OnlyOffice",
          "name": "OnlyOffice",
          "description": "Open office documents with Collabora",
          "icon": "https://onlyoffice.owncloud.test/web-apps/apps/documenteditor/main/resources/img/favicon.ico",
          "secure_view": false,
          "template": true
        }
      ]
    }

Maybe we should also rename template to something like template_conversion?

We agreed to remove template and keep target_ext

 {
      "mime_type": "application/vnd.oasis.opendocument.spreadsheet-template",
      "app_providers": [
        {
          "address": "com.owncloud.api.collaboration.OnlyOffice",
          "name": "OnlyOffice",
          "description": "Open office documents with Collabora",
          "icon": "https://onlyoffice.owncloud.test/web-apps/apps/documenteditor/main/resources/img/favicon.ico",
          "secure_view": false,
          "target_ext": "xlsx",
        }
      ]
    }

@micbar micbar force-pushed the templates branch 7 times, most recently from 4f466bc to b760377 Compare October 16, 2024 14:47
@micbar micbar marked this pull request as ready for review October 16, 2024 14:50
Copy link
Member

@jvillafanez jvillafanez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a couple of minor things from me.

services/collaboration/pkg/middleware/wopicontext.go Outdated Show resolved Hide resolved
services/collaboration/pkg/server/http/server.go Outdated Show resolved Hide resolved
Signed-off-by: Michael Barz <mbarz@owncloud.com>
Copy link

sonarcloud bot commented Oct 17, 2024

@micbar micbar merged commit 8b27e42 into master Oct 17, 2024
4 checks passed
@micbar micbar deleted the templates branch October 17, 2024 07:43
ownclouders pushed a commit that referenced this pull request Oct 17, 2024
Template Files for WebOffice
@micbar micbar mentioned this pull request Oct 21, 2024
18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

POC: Click on Template file -> Create Document (Web, Backend, mobile, desktop)
4 participants