Preview.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. MWF.xDesktop.requireApp("process.FormDesigner", "Preview", null, false);
  2. MWF.xApplication.cms.FormDesigner.Preview = MWF.CMSFCPreview = new Class({
  3. Extends: MWF.FCPreview,
  4. Implements: [Options, Events],
  5. options: {
  6. "style": "default",
  7. "previewPath": "../x_desktop/cmspreview.html",
  8. "size": null
  9. },
  10. initialize: function(form, options){
  11. this.setOptions(options);
  12. var href = window.location.href;
  13. if (href.indexOf("debugger")!=-1) this.options.previewPath = "../x_desktop/cmspreview.html?debugger";
  14. this.path = "../x_component_process_FormDesigner/$Preview/";
  15. this.cssPath = "../x_component_process_FormDesigner/$Preview/"+this.options.style+"/css.wcss";
  16. this._loadCss();
  17. this.form = form;
  18. // this.data = form._getFormData();
  19. this.data = this.form.data;
  20. },
  21. loadFormData: function(node){
  22. MWF.getJSON("../x_desktop/res/preview/cmsdoc.json", function(json){
  23. MWF.xDesktop.requireApp("cms.Xform", "Form", function(){
  24. this.appForm = new MWF.CMSForm(node, this.data);
  25. this.dataStr = JSON.stringify(this.data);
  26. this.appForm.formDataText = this.dataStr;
  27. this.appForm.app = this.form.designer;
  28. this.appForm.load();
  29. }.bind(this));
  30. }.bind(this));
  31. }
  32. });