cmspreview.html 4.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  5. <link rel="stylesheet" type="text/css" href="css/style.css" charset="UTF-8" />
  6. <link rel="stylesheet" href="css/mBoxNotice.css" charset="UTF-8" />
  7. <link rel="stylesheet" href="css/mBoxTooltip.css" charset="UTF-8" />
  8. <script src="../o2_core/o2.min.js"></script>
  9. <script src="../o2_lib/Decimal.js"></script>
  10. <script src="js/base.min.js"></script>
  11. <title>FORM PREVIEW</title>
  12. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  13. <script>
  14. layout.addReady(function(){
  15. (function(layout){
  16. MWF.getJSON("res/config/config.json", function(config){
  17. if (config.proxyCenterEnable){
  18. if (o2.typeOf(config.center)==="array"){
  19. config.center.forEach(function(c){
  20. c.port = window.location.port || 80;
  21. })
  22. }else{
  23. config.port = window.location.port || 80;
  24. }
  25. }
  26. layout.config = config;
  27. if (layout.config.app_protocol=="auto"){
  28. layout.config.app_protocol = window.location.protocol;
  29. }
  30. //MWF.defaultPath = "../x_desktop"+MWF.defaultPath;
  31. MWF.loadLP(MWF.language);
  32. MWF.require("MWF.xDesktop.Layout", function(){
  33. //MWF.require("MWF.xDesktop.Authentication", null, false);
  34. (function(){
  35. layout.load = function(){
  36. // if (this.isAuthentication()){
  37. var preview = window.frameElement.retrieve("preview");
  38. layout.desktop = window.frameElement.ownerDocument.window.layout.desktop;
  39. MWF.xDesktop.requireApp("cms.Xform", "Form", function(){
  40. layout.appForm = new MWF.CMSForm($("layout"), preview.data);
  41. layout.appForm.formDataText = JSON.stringify(preview.data);
  42. layout.appForm.app = {
  43. "options" : {
  44. "name" : "CMSDocument"
  45. },
  46. "content": document.body,
  47. "addEvent" : function(){},
  48. "fireEvent": function(){}
  49. };
  50. layout.appForm.documentAction = MWF.Actions.get("x_cms_assemble_control");
  51. MWF.getJSON("res/preview/cmsdoc.json", function(data){
  52. if( preview.form && preview.form.designer && preview.form.designer.application && preview.form.designer.application.id ){
  53. data.document.appId = preview.form.designer.application.id;
  54. }
  55. if( preview.form && preview.form.json && preview.form.json.mode && preview.form.json.mode === "Mobile" ){
  56. layout.mobile = true;
  57. }
  58. layout.appForm.businessData = {
  59. "data": data.data,
  60. "document": data.document,
  61. "attachmentList": data.attachmentList,
  62. "control": data.control,
  63. "status": {
  64. //"readonly": (this.options.readonly) ? true : false
  65. "readonly": false
  66. }
  67. };
  68. layout.appForm.load();
  69. });
  70. });
  71. // }
  72. };
  73. layout.load();
  74. })();
  75. });
  76. }.bind(this));
  77. })(layout);
  78. });
  79. </script>
  80. </head>
  81. <body style="overflow: auto">
  82. <div id="layout" class="layout" style="overflow: auto">
  83. <div id="layout_top">
  84. </div>
  85. <div id="layout_form">
  86. </div>
  87. </div>
  88. </body>
  89. </html>