YozoOffice.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. MWF.xApplication.process.FormDesigner.Module = MWF.xApplication.process.FormDesigner.Module || {};
  2. MWF.xDesktop.requireApp("process.FormDesigner", "Module.$Element", null, false);
  3. MWF.xApplication.process.FormDesigner.Module.YozoOffice = MWF.FCYozoOffice = new Class({
  4. Extends: MWF.FC$Element,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "propertyPath": "../x_component_process_FormDesigner/Module/YozoOffice/office.html"
  9. },
  10. initialize: function(form, options){
  11. this.setOptions(options);
  12. this.path = "../x_component_process_FormDesigner/Module/YozoOffice/";
  13. this.cssPath = "../x_component_process_FormDesigner/Module/YozoOffice/"+this.options.style+"/css.wcss";
  14. this._loadCss();
  15. this.moduleType = "element";
  16. this.moduleName = "yozoOffice";
  17. this.form = form;
  18. this.container = null;
  19. this.containerNode = null;
  20. },
  21. _createMoveNode: function(){
  22. this.moveNode = new Element("div", {
  23. "MWFType": "yozoOffice",
  24. "id": this.json.id,
  25. "styles": this.css.moduleNodeMove,
  26. "events": {
  27. "selectstart": function(){
  28. return false;
  29. }
  30. }
  31. }).inject(this.form.container);
  32. },
  33. _createNode: function(){
  34. this.node = this.moveNode.clone(true, true);
  35. this.node.setStyles(this.css.moduleNode);
  36. this.node.set("id", this.json.id);
  37. this.node.addEvent("selectstart", function(){
  38. return false;
  39. });
  40. if(!layout.serviceAddressList["x_yozofile_assemble_control"]){
  41. this.tipNode = new Element("div").inject(this.node);
  42. this.tipNode.set("html","<h3><font color=red>请先安装永中应用</font></h3>");
  43. }
  44. this.iconNode = new Element("div", {
  45. "styles": this.css.iconNode
  46. }).inject(this.node);
  47. var icon = new Element("div", {
  48. "styles": this.css.iconNodeIcon
  49. }).inject(this.iconNode);
  50. var text = new Element("div", {
  51. "styles": this.css.iconNodeText,
  52. "text": "YozoOffice"
  53. }).inject(this.iconNode);
  54. this.setIcon();
  55. },
  56. _loadNodeStyles: function(){
  57. this.iconNode = this.node.getElement("div").setStyles(this.css.iconNode);
  58. this.iconNode.getFirst("div").setStyles(this.css.iconNodeIcon);
  59. this.iconNode.getLast("div").setStyles(this.css.iconNodeText);
  60. this.setIcon();
  61. },
  62. setIconNode: function(img, txt, color, width){
  63. if (this.iconNode){
  64. this.iconNode.setStyle("width", width);
  65. var icon = this.iconNode.getFirst();
  66. var text = this.iconNode.getLast();
  67. icon.setStyle("background-image", "url("+this.path+this.options.style+"/icon/"+img+".png)");
  68. text.set("text", txt);
  69. text.setStyles({
  70. "color": color,
  71. "width": width-34
  72. });
  73. }
  74. },
  75. setIcon: function(){
  76. if (this.json.officeType=="word"){
  77. this.setIconNode("word", "Word", "#2b5797", 90);
  78. }
  79. if (this.json.officeType=="excel"){
  80. this.setIconNode("excel", "Excel", "#1e7145", 86);
  81. }
  82. if (this.json.officeType=="ppt"){
  83. this.setIconNode("ppt", "PowerPoint", "#d04525", 130);
  84. }
  85. if (this.json.officeType=="other"){
  86. this.setIconNode("office", "Office", "#f36523", 96);
  87. }
  88. },
  89. _setEditStyle_custom: function(name){
  90. if (name=="officeType"){
  91. this.setIcon();
  92. }
  93. }
  94. });