ONLYOFFICE历史版本功能的开发

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

上面的页面介绍如何进行历史版本功能的开发。

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

上面介绍了onlyoffice document server所包含的功能,

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 thedocument 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 thedocument managerwhich 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). Thedocument editorinterface is used to access all thedocument editing servicefeatures.

Document command service- the server service which allows to perfom additional commands withdocument editing service.

Document conversion service- the server service which allows to convert the document file into the appropriate Office Open XML format (docxfor text documents,xlsxfor spreadsheets andpptxfor presentations) for their editing or downloading.

Please note, that ONLYOFFICE Document Server includes thedocument editor,document editing service,document command service anddocument conversion service. Thedocument manageranddocument storage serviceare either included to Community Server or must be implemented by the software integrators who use ONLYOFFICE Document Server on their own server.

请注意,onlyoffice document server包括document editordocument editing servicedocument command service(文档编辑器、文档编辑服务、文档命令服务和文档转换服务)。文档管理器和文档存储服务要么包含在社区服务器上,要么必须由在自己的服务器上仅使用office文档服务器的软件集成商实现。

我用golang就是开发了文档管理器和文档存储

类似可道云的那种云盘的资料管理。

可道云的界面

但相比可道云,对于我们工程设计人员来说,更容易管理文档,比如编号和名称分开,文件作为附件放到成果下面,而不像可道云这样直接看到的就是附件,一个成果下可以放多个附件。还可以发布文章,可以设置成果间的关联,可以设置目录的权限,可以根据附件扩展名来设置权限,比如只运行看pdf文件,不运行看dwg,dgn等图纸文件。

回到正题,历史版本的开发必须从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  

}  

官网上的例子:

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

[html] view plain copy

{  

    "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"]  

}  

所以用beego开发先设置数据结构,然后解析到结构体就行了。

[plain] view plain copy

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"` //必须大写才能在tpl中显示{{.json}}  

    Name string `json:"name"`  

}  

历史版本功能开发
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 159,290评论 4 363
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 67,399评论 1 294
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 109,021评论 0 243
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 44,034评论 0 207
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,412评论 3 287
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,651评论 1 219
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,902评论 2 313
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,605评论 0 199
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,339评论 1 246
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,586评论 2 246
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 32,076评论 1 261
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,400评论 2 253
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 33,060评论 3 236
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,083评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,851评论 0 195
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,685评论 2 274
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,595评论 2 270

推荐阅读更多精彩内容