DocumentServer icon indicating copy to clipboard operation
DocumentServer copied to clipboard

Click on Template file -> Create Document

Open tbsbdr opened this issue 1 year ago • 9 comments

This issue is unique.

  • [X] I have used the search tool and did not find an issue describing my idea.

Your idea.

Userstory

As a user I want to create a document by clicking on a template file so that I can use the templates from a shared folder.

Flow

( pasting here @ibnpetr 's proposal: )

  1. When interacting with a DOTX file (double-clicking, selecting an item in the context menu, hidden opening, or any other logic for opening from a template), a DOCX file without content should be “created.”
  2. The storage (OCIS) should determine the location of the DOCX file: the current or root user folder, or any alternative folder for opening from templates.
  3. It is important that this file can be manipulated like a regular file (CheckFileInfo, Lock, PutFile) except for GetFile. Instead of GetFile, a link to the DOTX template should be sent in the CheckFileInfo response (TemplateSource field).
  4. Immediately open this file for editing. OO Docs will convert the template to DOCX and place the DOCX file in the storage using PutFile.
  5. Further editing will proceed as with a regular DOCX file.

Note:

  • Editing a DOTX file as a template is not covered by this scheme.
  • Editing from DOTX to DOTX is enabled through a setting in the configuration file.

tbsbdr avatar Aug 12 '24 07:08 tbsbdr

Do I understand correctly that we create an empty DOCX file to a location writeable by the user and fill a new TemplateSource property in the GetFileInfo response with a URL to the DOTX template? onlyoffice would detect that new parameter, fetch the template and fill the DOCX file accordingly?

If so, I see no problems with this approach. We would have to store the template in the wopi session and add some code to handle the opening and creation logic. All good.

butonic avatar Aug 12 '24 09:08 butonic

Do I understand correctly that we create an empty DOCX file to a location writeable by the user and fill a new TemplateSource property in the GetFileInfo response with a URL to the DOTX template? onlyoffice would detect that new parameter, fetch the template and fill the DOCX file accordingly?

Yes, you can either create a new empty file or copy the template file itself, which is an alternative method used by other vendors. A new file will be created from the TemplateSource file.

ibnpetr avatar Aug 12 '24 12:08 ibnpetr

cc @micbar

tbsbdr avatar Aug 26 '24 13:08 tbsbdr

After discussion with oC colleagues, we have a vague idea how to implement that.

We should use the app provider /app/new Action to create the new file in the personal space of the user with a server choosen name (File name and user-friendly datetime). Then we can open that via /app/open with the selected template in the wopi CheckFileInfo response.

micbar avatar Sep 05 '24 09:09 micbar

@micbar any progress on that item?

dj4oC avatar Sep 25 '24 07:09 dj4oC

not yet.

micbar avatar Sep 26 '24 13:09 micbar

@ibnpetr @LuckySpecialist @igwyd I have an implementation and was hitting a roadblock.

I implemented the workflow as far as Step 3 in the top Post:

  • Opening a new empty file and sending a File Download Url like https://wopiserver/wopi/files/<fileid>/contents in the TemplateSource property.

My Observation:

OnlyOffice tries to download that file, but it doesn't send the Access Token.

Did i miss anyting?

I am using onlyoffice/4testing-documentserver:8.2.0.108

micbar avatar Oct 10 '24 14:10 micbar

we checked the documentation and it seems that TemplateSource is used as is and nothing is added. As per MS documentation it is stated that for alternative links FileUrl is used exactly as provided. Right now not only access token is added, but also the request is not signed with keys and X-WOPI-Proof is not added as well. Collabora for example, downloads templateUri with no authorization the same as FileUrl that is used exactly as provided and then below that they have auth.authorizeURI(uriObject); with access token. Is it important for you to add some kind of authorization or the way Collabora does meets your requirements?

alexonlyoffice avatar Oct 11 '24 07:10 alexonlyoffice

@alexonlyoffice Thank you. I will try to do an implementation which could work in that context.

micbar avatar Oct 14 '24 07:10 micbar