Preview.js 1.2 KB

123456789101112131415161718192021222324252627282930313233
  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. },
  20. loadFormData: function(node){
  21. MWF.getJSON("/x_desktop/res/preview/cmsdoc.json", function(json){
  22. MWF.xDesktop.requireApp("cms.Xform", "Form", function(){
  23. this.appForm = new MWF.CMSForm(node, this.data);
  24. this.appForm.app = this.form.designer;
  25. this.appForm.load();
  26. }.bind(this));
  27. }.bind(this));
  28. }
  29. });