One of the development technologies of ONLYOFFICE historical version function

https://api.onlyoffice.com/editors/history

The above page describes how to develop the historical version function.

https://api.onlyoffice.com/editors/howitworks

The functions included in the onlyoffice document server are described above.

The client side includes:

  • Document manager - the list of the documents displayed in the user browser where the user can select the necessary document and perform some actions with it (depending on the provided rights, the user can open the document to view it or edit, share the document with other users).
  • Document editor - the document viewing and editing interface with all the most known document editing features available, used as a medium between the user and the document editing service.

The server side includes:

  • Document storage service - the server service which stores all the documents available to the users with the appropriate access rights. It provides the document IDs and links to these documents to the document manager which the user sees in the browser.
  • Document editing service - the server service which allows to perform the document viewing and editing (in case the user has the appropriate rights to do that). The document editor interface is used to access all the document editing service features.
  • Document command service - the server service which allows to perfom additional commands with document editing service.
  • Document conversion service - the server service which allows to convert the document file into the appropriate Office Open XML format (docx for text documents, xlsx for spreadsheets and pptx for presentations) for their editing or downloading.

Please note, that ONLYOFFICE Document Server includes the document editordocument editing servicedocument command service and document conversion service. The document manager and document storage service are either included to Community Server or must be implemented by the software integrators who use ONLYOFFICE Document Server on their own server.

Note that onlyoffice document server includes document editordocument editing servicedocument command service ( document editor, document editing service, document command service and document conversion service). The document manager and document storage services are either included on the community server or have to be implemented by a software integrator using only the office document server on their own server.

I use golang to develop a document manager and document storage .


Data management of cloud disks similar to Kedao Cloud.


However, compared with Kedaoyun, it is easier for us engineers to manage documents, such as separate numbers and names, and files are placed under the results as attachments, unlike Kedaoyun, which is directly seen as attachments, a result. Multiple attachments can be placed under it. You can also publish articles, set the association between achievements, set the permissions of directories, and set permissions according to the extension of attachments, such as only running to view pdf files, and not running to view dwg, dgn and other drawing files.

Back to the topic, the development of the historical version must find the data structure from the return value of the onlyoffice document server.

{
    "key":"1520696086733383100",
    "status":2,
    
    "url":"http://192.168.99.100:9000/cache/files/1520696086733383100_1849/outpu
    t.docx/output.docx?md5=CSBXuCfKbp1zaA2C-IoB2g==&expires=1523288157&
    disposition=attachment&ooname=output.docx",
    "changesurl":"http://192.168.99.100:9000/cache/files/
    1520696086733383100_1849/changes.zip/changes.zip?
    md5=eQOOXry8Spob255EtEi7QA==&expires=1523288157&
    disposition=attachment&ooname=output.zip",
"history":{
    "serverVersion":"5.0.7",
    "changes":[
        {
            "created":"2018-03-10 15:34:57",
            "user":
            {
                "id":"9",
                "name":"qin.xc"
            }
        },
        {
            "created":"2018-03-10 15:35:29",
            "user":
            {
                "id":"8",
                "name":"qin8.xc"
            }
        }
    ]
},
"users":["8"],
"actions":[{"type":0,"userid":"9"}],
"lastsave":"2018-03-10T15:35:37.823Z",
"notmodified":false
}

Example from the official website:

Sample of JSON object sent to the "callbackUrl" address by document editing service when the user changed the document and closed it for editing

{
    "actions": [{"type": 0, "userid": "78e1e841"}],
    "changesurl": "https://documentserver/url-to-changes.zip",
    "history": {
        "changes": changes,
        "serverVersion": serverVersion
    },
    "key": "Khirz6zTPdfd7",
    "status": 2,
    "url": "https://documentserver/url-to-edited-document.docx",
    "users": ["6d5a81d0"]
}

So use beego development to set up the data structure first, and then parse to the structure.

type Callback struct {
	Key         string   `json:"key"`
	Status      int      `json:"status"`
	Url         string   `json:"url"`
	Changesurl  string   `json:"changesurl"`
	History     history1 `json:"history"`
	Users       []string `json:"users"`
	Actions     []action `json:"actions"`
	Lastsave    string   `json:"lastsave"`
	Notmodified bool     `json:"notmodified"`
}

type action struct {
	Type   int    `json:"type"`
	Userid string `json:"userid"`
}

type history1 struct {
	ServerVersion string   `json:"serverVersion"`
	Changes       []change `json:"changes"`
}

type change struct {
	Created string `json:"created"` //time.Time
	User    User1  `json:"user"`
}

type User1 struct {
	Id string `json:"id"` //must be uppercase to display in tpl {{.json}}
	Name string `json:"name"`
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325687590&siteId=291194637