cmspreview.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. <title>FORM PREVIEW</title>
  11. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  12. <script>
  13. layout = window.layout || {};
  14. var href = window.location.href;
  15. if (href.indexOf("debugger")!=-1) layout["debugger"] = true;
  16. var mode = (new URI(href)).get("data").mode;
  17. if (mode){
  18. if (mode=="mobile") layout.mobile = true;
  19. }
  20. layout.session = window.frameElement.ownerDocument.window.layout.session || {};
  21. //layout.desktop = layout;
  22. o2.addReady(function(){
  23. o2.load(["../o2_lib/mootools/plugin/mBox.Notice.js", "../o2_lib/mootools/plugin/mBox.Tooltip.js"], {"sequence": true}, function(){
  24. MWF.getJSON("res/config/config.json", function(config){
  25. layout.config = config;
  26. if (layout.config.app_protocol=="auto"){
  27. layout.config.app_protocol = window.location.protocol;
  28. }
  29. //MWF.defaultPath = "../x_desktop"+MWF.defaultPath;
  30. MWF.loadLP(MWF.language);
  31. MWF.require("MWF.widget.Common", null, false);
  32. MWF.require("MWF.xDesktop.Common", null, false);
  33. MWF.require("MWF.xAction.RestActions", null, false);
  34. MWF.require("MWF.xDesktop.Layout", function(){
  35. //MWF.require("MWF.xDesktop.Authentication", null, false);
  36. MWF.require("MWF.xDesktop.Actions.RestActions", null, false);
  37. (function(){
  38. layout.load = function(){
  39. debugger;
  40. // if (this.isAuthentication()){
  41. var preview = window.frameElement.retrieve("preview");
  42. layout.desktop = window.frameElement.ownerDocument.window.layout.desktop;
  43. MWF.xDesktop.requireApp("cms.Xform", "Form", function(){
  44. layout.appForm = new MWF.CMSForm($("layout"), preview.data);
  45. layout.appForm.app = {
  46. "options" : {
  47. "name" : "CMSDocument"
  48. },
  49. "content": document.body,
  50. "addEvent" : function(){}
  51. };
  52. MWF.getJSON("res/preview/cmsdoc.json", function(data){
  53. if( preview.form && preview.form.designer && preview.form.designer.application && preview.form.designer.application.id ){
  54. data.document.appId = preview.form.designer.application.id;
  55. }
  56. layout.appForm.businessData = {
  57. "data": data.data,
  58. "document": data.document,
  59. "attachmentList": data.attachmentList,
  60. "status": {
  61. //"readonly": (this.options.readonly) ? true : false
  62. "readonly": true //this.readonly
  63. },
  64. "control" : data.control
  65. };
  66. layout.appForm.load();
  67. });
  68. });
  69. // }
  70. };
  71. // layout.load();
  72. MWF.xDesktop.getServiceAddress(layout.config, function (service, center) {
  73. layout.serviceAddressList = service;
  74. layout.centerServer = center;
  75. layout.load();
  76. }.bind(this));
  77. })();
  78. });
  79. }.bind(this));
  80. });
  81. });
  82. </script>
  83. </head>
  84. <body style="overflow: auto">
  85. <div id="layout" style="overflow: auto">
  86. <div id="layout_top">
  87. </div>
  88. <div id="layout_form">
  89. </div>
  90. </div>
  91. </body>
  92. </html>