cmspreview.html 4.6 KB
Newer Older
NoSubject's avatar
NoSubject 已提交
1
<!DOCTYPE html>
R
roo00 已提交
2
<html lang="zh-CN">
NoSubject's avatar
NoSubject 已提交
3 4
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
NoSubject's avatar
NoSubject 已提交
5 6 7
    <link rel="stylesheet" type="text/css" href="css/style.css" charset="UTF-8" />
    <link rel="stylesheet" href="css/mBoxNotice.css" charset="UTF-8" />
    <link rel="stylesheet" href="css/mBoxTooltip.css" charset="UTF-8" />
R
roo00 已提交
8
    <script src="../o2_core/o2.min.js"></script>
NoSubject's avatar
NoSubject 已提交
9
    <script src="../o2_lib/Decimal.js"></script>
10
    <script src="js/base.min.js"></script>
NoSubject's avatar
NoSubject 已提交
11 12 13 14 15

    <title>FORM PREVIEW</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

    <script>
16 17
        layout.addReady(function(){
            (function(layout){
R
roo00 已提交
18
                MWF.getJSON("res/config/config.json", function(config){
19 20 21
                    if (config.proxyCenterEnable){
                        if (o2.typeOf(config.center)==="array"){
                            config.center.forEach(function(c){
NoSubject's avatar
NoSubject 已提交
22
                                c.port = window.location.port || 80;
23 24
                            })
                        }else{
NoSubject's avatar
NoSubject 已提交
25
                            config.port = window.location.port || 80;
26 27
                        }
                    }
R
roo00 已提交
28 29 30 31
                    layout.config = config;
                    if (layout.config.app_protocol=="auto"){
                        layout.config.app_protocol = window.location.protocol;
                    }
32
                    //MWF.defaultPath = "../x_desktop"+MWF.defaultPath;
R
roo00 已提交
33 34 35 36 37 38 39 40
                    MWF.loadLP(MWF.language);
                    MWF.require("MWF.xDesktop.Layout", function(){
                        //MWF.require("MWF.xDesktop.Authentication", null, false);
                        (function(){
                            layout.load = function(){
                                //        if (this.isAuthentication()){
                                var preview = window.frameElement.retrieve("preview");
                                layout.desktop = window.frameElement.ownerDocument.window.layout.desktop;
NoSubject's avatar
NoSubject 已提交
41

R
roo00 已提交
42 43
                                MWF.xDesktop.requireApp("cms.Xform", "Form", function(){
                                    layout.appForm = new MWF.CMSForm($("layout"), preview.data);
44
                                    layout.appForm.formDataText = JSON.stringify(preview.data);
R
roo00 已提交
45 46 47
                                    layout.appForm.app = {
                                        "options" : {
                                            "name" : "CMSDocument"
NoSubject's avatar
NoSubject 已提交
48
                                        },
R
roo00 已提交
49
                                        "content": document.body,
50 51
                                        "addEvent" : function(){},
                                        "fireEvent": function(){}
NoSubject's avatar
NoSubject 已提交
52
                                    };
53
                                    layout.appForm.documentAction = MWF.Actions.get("x_cms_assemble_control");
R
roo00 已提交
54
                                    MWF.getJSON("res/preview/cmsdoc.json", function(data){
U
unknown 已提交
55 56 57
                                        if( preview.form && preview.form.designer && preview.form.designer.application && preview.form.designer.application.id ){
                                            data.document.appId = preview.form.designer.application.id;
                                        }
58 59 60
                                        if( preview.form && preview.form.json && preview.form.json.mode && preview.form.json.mode === "Mobile" ){
                                            layout.mobile = true;
                                        }
R
roo00 已提交
61 62 63 64
                                        layout.appForm.businessData = {
                                            "data": data.data,
                                            "document": data.document,
                                            "attachmentList": data.attachmentList,
65
                                            "control": data.control,
R
roo00 已提交
66 67
                                            "status": {
                                                //"readonly": (this.options.readonly) ? true : false
68 69
                                                "readonly": false
                                            }
R
roo00 已提交
70 71 72
                                        };
                                        layout.appForm.load();
                                    });
NoSubject's avatar
NoSubject 已提交
73
                                });
R
roo00 已提交
74 75
                                //        }
                            };
NoSubject's avatar
NoSubject 已提交
76

77
                            layout.load();
R
roo00 已提交
78
                        })();
NoSubject's avatar
NoSubject 已提交
79

R
roo00 已提交
80 81
                    });
                }.bind(this));
82
            })(layout);
NoSubject's avatar
NoSubject 已提交
83 84 85 86
        });
    </script>
</head>
<body style="overflow: auto">
NoSubject's avatar
NoSubject 已提交
87
<div id="layout" class="layout" style="overflow: auto">
NoSubject's avatar
NoSubject 已提交
88 89 90 91 92 93 94
    <div id="layout_top">

    </div>
    <div id="layout_form">
    </div>
</div>
</body>
R
roo00 已提交
95
</html>