12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- MWF.xDesktop.requireApp("process.Xform", "OnlyOffice", null, false);
- MWF.xApplication.cms.Xform.OnlyOffice = MWF.CMSOnlyOffice = new Class({
- Extends: MWF.APPOnlyOffice,
- createDocument : function (callback){
- var data = {
- "fileName" : MWF.xApplication.process.Xform.LP.onlyoffice.filetext + "." + this.json.officeType,
- "fileType" : this.json.officeType,
- "appToken" : "x_cms_assemble_control",
- "workId" : this.form.businessData.document.id,
- "site" : "filetext"
- };
- this.action.OnlyofficeAction.createForO2(data,
- function( json ){
- this.documentId = json.data.fileId;
- this.setData();
- if (callback) callback();
- }.bind(this),null, false
- );
- },
- createDocumentByTemplate : function (callback){
- this.action.OnlyofficeAction.get(this.json.template).then(function(json) {
- var data = {
- "fileName": MWF.xApplication.process.Xform.LP.onlyoffice.filetext + "." + json.data.fileModel.document.fileType,
- "fileType": json.data.fileModel.document.fileType,
- "appToken" : "x_cms_assemble_control",
- "workId" : this.form.businessData.document.id,
- "site" : "filetext",
- "tempId": this.json.template
- };
- this.action.OnlyofficeAction.createForO2(data,
- function( json ){
- this.documentId = json.data.fileId;
- this.setData();
- if (callback) callback();
- }.bind(this),null, false
- );
- }.bind(this));
- },
- createUpload : function (){
- this.uploadNode = new Element("div",{"style":"margin:10px;"}).inject(this.node);
- var uploadBtn = new Element("button",{"text":MWF.xApplication.process.Xform.LP.ofdview.upload,"style":"margin-left: 15px; color: rgb(255, 255, 255); cursor: pointer; height: 26px; line-height: 26px; padding: 0px 10px; min-width: 40px; background-color: rgb(74, 144, 226); border: 1px solid rgb(82, 139, 204); border-radius: 15px;"}).inject(this.uploadNode);
- uploadBtn.addEvent("click",function (){
- o2.require("o2.widget.Upload", null, false);
- var upload = new o2.widget.Upload(this.content, {
- "action": o2.Actions.get("x_cms_assemble_control").action,
- "method": "replaceAttachment",
- "accept" : ".docx,.xlsx,.pptx",
- "parameter": {
- "id" : this.documentId,
- "documentid" : this.form.businessData.document.id,
- },
- "data":{
- },
- "onCompleted": function(data){
- this.documentId = data.id;
- this.setData();
- this.node.empty();
- this.createUpload();
- this.loadDocument();
- }.bind(this)
- });
- upload.load();
- }.bind(this));
- },
- setData: function() {
- var data = {
- "documentId": this.documentId,
- "appToken": "x_cms_assemble_control"
- };
- this.data = data;
- this._setBusinessData(data);
- var jsonData = {}
- jsonData[this.json.id] = data;
- o2.Actions.load("x_cms_assemble_control").DataAction.updateWithDocument(this.form.businessData.document.id, jsonData, function (json) {
- data = json.data;
- });
- }
- });
|