Html.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. this.source = this._getSource();
  6. if (this.source){
  7. this._loadJsonData();
  8. }else{
  9. this.node.appendHTML(this.json.text, "after");
  10. this.node.destory();
  11. }
  12. },
  13. _getSource: function(){
  14. var parent = this.node.getParent();
  15. while(parent && (parent.get("MWFtype")!="source" && parent.get("MWFtype")!="subSource" && parent.get("MWFtype")!="subSourceItem")) parent = parent.getParent();
  16. return (parent) ? parent.retrieve("module") : null;
  17. },
  18. _loadJsonData: function(){
  19. this.node.set("html", "");
  20. this.source = this._getSource();
  21. if (this.source){
  22. if (this.source.data){
  23. this.template = new Template();
  24. this.html = this.template.substitute("{"+this.json.text+"}", this.source.data);
  25. this.node.set("html", this.html);
  26. // if (this.json.jsonText){
  27. // if (this.json.jsonText.code){
  28. // this.text = this.form.Macro.exec(this.json.jsonText.code, this);
  29. // this.node.set("text", this.text);
  30. // }else{
  31. // this.node.set("text", this.text);
  32. // }
  33. // }else{
  34. // this.node.set("text", this.text);
  35. // }
  36. }
  37. }
  38. }
  39. });