xinyb
2024-03-12 a724cc9cb339f5ec0a13d5fae58e3edecfd6ff4b
提交 | 用户 | age
a6a76f 1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
F 2 <%@page import="com.yc.sdk.shopping.util.SettingKey"%>
3 <%
4     String path = request.getContextPath();
5     String URL = SettingKey.getHostUrl(request)+path;
6     String rowid = request.getParameter("rowid");
7     //System.out.println("showFlowChart.jsp-rowid:"+rowid);
8     if(null == rowid || "".equals(rowid.trim()))return;
9 %>
10 <html>
11 <head>
12     <title>流程图显示</title>
13     <script type="text/javascript">
14         mxBasePath = 'src';
15     </script>
16
17     <!--加载mxclinet-->
18     <script type="text/javascript" src="/mxgraph/Base/mxclient.js?v=<%=com.yc.utils.FileUtil.getVerstion(request,"/mxgraph/Base/mxclient.js")%>"></script>
19     <!---->
20     <script type="text/javascript">
21     var graph;
22         function LoadCurrentDocument()
23         {
24             // Checks if browser is supported
25             if (!mxClient.isBrowserSupported())
26             {
27                 // Displays an error message if the browser is
28                 // not supported.
29                 mxUtils.error('Browser is not supported!', 200, false);
30             }
31             else
32             {
33                 // Creates the graph inside the given container
34                  graph = new mxGraph(document.getElementById("header"));
35                 
36                 // Adds rubberband selection
37                 new mxRubberband(graph);
38                 
39                 
40                 // Loads the default stylesheet into the graph
41                 var node = mxUtils.load('resources/default-style.xml').getDocumentElement();
42                 var dec = new mxCodec(node.ownerDocument);
43                 dec.decode(node, graph.getStylesheet());
44             
45                 
46                 graph.setHtmlLabels(true);
47                 graph.setEnabled(false);
48                 graph.getModel().beginUpdate();
49                 graph.getModel().endUpdate();
50                 if (mxClient.IS_IE)
51                 {
52                     new mxDivResizer(document.getElementById("header"));
53                 }
54             }
55
56             ajax_get("/getFlowChartInfo.do?rowid=<%=rowid %>",'',function(txt){
57                 LoadXmlDocument(txt);
58                 txt=null;
59             });
60             
61         }
62         //加载XML文档以显示新的绘图
63         function LoadXmlDocument(xml) 
64         {
65             if (xml != null && xml.length > 0)
66             {
67                 var doc = mxUtils.parseXml(xml); 
68                 var dec = new mxCodec(doc); 
69                 dec.decode(doc.documentElement, graph.getModel()); 
70             }
71         }
72         function ajax_get(url,data,callback){
73             var xmlHttp;
74             try{
75                 xmlHttp=new ActiveXObject("MSXML2.XMLHTTP");
76             }catch(e){
77                 try{
78                     xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
79                 }catch(e2){
80                     xmlHttp=false;
81                 }
82             }
83             if(!xmlHttp&&typeof(XMLHttpRequest)!='undefined')
84                 xmlHttp=new XMLHttpRequest();
85             xmlHttp.open("POST",url,true);
86             xmlHttp.setRequestHeader("content-type","application/x-www-form-urlencoded");
87             xmlHttp.onreadystatechange=function(){
88                 
89                 if(xmlHttp.readyState==4&&xmlHttp.status==200){
90                     callback(xmlHttp.responseText);
91                     delete(xmlHttp);
92                 }
93             }
94             xmlHttp.send(data);
95         }
96         
97     </script>
98 </head>
99 <body onload="LoadCurrentDocument();">
100 <div id="header"><div style="float:right;margin:5px;" class="x-small-editor"></div></div>
101 </body>
102 </html>