Documenteditor.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. MWF.xDesktop.requireApp("process.Xform", "Documenteditor", null, false);
  2. MWF.xApplication.cms.Xform.Documenteditor = MWF.CMSDocumenteditor = new Class({
  3. Extends: MWF.APPDocumenteditor,
  4. loadDocumentEditor: function(callback){
  5. this._loadToolbars();
  6. this._loadFiletextPage(function(){
  7. this._singlePage();
  8. this.form.addEvent("beforeSave", function(){
  9. this.getData();
  10. this.checkSaveNewEdition();
  11. }.bind(this));
  12. if (this.json.toWord=="y"){
  13. if (this.json.toWordTrigger=="open") this.docToWord();
  14. if (this.json.toWordTrigger=="save") {
  15. if (!this.form.toWordSaveList) this.form.toWordSaveList = [];
  16. this.form.toWordSaveList.push(this);
  17. }
  18. if (this.json.toWordTrigger=="submit") {
  19. if (!this.form.toWordSubmitList) this.form.toWordSubmitList = [];
  20. this.form.toWordSubmitList.push(this);
  21. }
  22. }
  23. //if (!layout.mobile) this.loadSideToolbar();
  24. o2.load("../o2_lib/diff-match-patch/diff_match_patch.js");
  25. // if (this.form.businessData.data["$work"]){
  26. // var id = this.form.businessData.data["$work"].job;
  27. // o2.Actions.load("x_processplatform_assemble_surface").DocumentVersionAction.listWithJobCategory(id, this.json.id, function(json){
  28. // this.historyDocumentList = json.data;
  29. // if (this.historyDocumentList.length){
  30. // o2.Actions.load("x_processplatform_assemble_surface").DocumentVersionAction.get(this.historyDocumentList[this.historyDocumentList.length-1].id, function(json){
  31. // var data = JSON.parse(json.data.data);
  32. // this.originaHistoryData = data.data;
  33. // }.bind(this));
  34. // }
  35. // }.bind(this));
  36. // }
  37. if (callback) callback();
  38. }.bind(this));
  39. if (!this.form.documenteditorList) this.form.documenteditorList=[];
  40. this.form.documenteditorList.push(this);
  41. },
  42. _isAllowHistory: function(){
  43. return false;
  44. // if (this.json.allowHistory=="n") return false;
  45. // if (this.json.allowHistory=="s"){
  46. // if (this.json.allowHistoryScript && this.json.allowHistoryScript.code){
  47. // return !!this.form.Macro.exec(this.json.allowHistoryScript.code, this);
  48. // }
  49. // }
  50. // return true;
  51. },
  52. });