Html.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
  2. MWF.xApplication.process.Xform.Html = MWF.APPHtml = new Class({
  3. Extends: MWF.APP$Module,
  4. load: function(){
  5. debugger;
  6. this.source = this._getSource();
  7. if (this.source){
  8. this._loadJsonData();
  9. }else{
  10. debugger;
  11. this.node.appendHTML(this.json.text, "after");
  12. this.node.destory();
  13. }
  14. },
  15. _getSource: function(){
  16. var parent = this.node.getParent();
  17. while(parent && (parent.get("MWFtype")!="source" && parent.get("MWFtype")!="subSource" && parent.get("MWFtype")!="subSourceItem")) parent = parent.getParent();
  18. return (parent) ? parent.retrieve("module") : null;
  19. },
  20. _loadJsonData: function(){
  21. this.node.set("html", "");
  22. this.source = this._getSource();
  23. if (this.source){
  24. if (this.source.data){
  25. this.template = new Template();
  26. this.html = this.template.substitute("{"+this.json.text+"}", this.source.data);
  27. this.node.set("html", this.html);
  28. // if (this.json.jsonText){
  29. // if (this.json.jsonText.code){
  30. // this.text = this.form.Macro.exec(this.json.jsonText.code, this);
  31. // this.node.set("text", this.text);
  32. // }else{
  33. // this.node.set("text", this.text);
  34. // }
  35. // }else{
  36. // this.node.set("text", this.text);
  37. // }
  38. }
  39. }
  40. }
  41. });