xmlBytable.jsp 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <%@ page contentType="text/html; charset=UTF-8" language="java"%>
  2. <%@ page import="java.util.*"%>
  3. <%@ page
  4. import="com.sysmodel.datamodel.xmlmodel.ModelFactory,
  5. com.sysmodel.datamodel.xmlmodel.impl.MdpModuleImpl,
  6. com.sysmodel.datamodel.xmlmodel.able.SysModel,
  7. com.sysmodel.datamodel.xmlmodel.able.MdpConstant,
  8. com.sysmodel.datamodel.xmlmodel.able.MdpClass,
  9. com.persistence.DBdll.SysOperator"%>
  10. <%
  11. String sourcecode = request.getParameter("sourcecode");
  12. SysModel sysmodel = ModelFactory.getSysmodel();
  13. ArrayList list = sysmodel.getMdpModules();
  14. if(sourcecode == null) return;
  15. SysOperator SysOperator = new SysOperator();
  16. ArrayList xmltablelist = sysmodel.getMdpClassByDataSource(Integer.parseInt("13"));
  17. ArrayList xmlMdpConstantlist = sysmodel.getMdpConstantByDataSource(Integer.parseInt(sourcecode));
  18. %>
  19. <%!
  20. SysModel sysmodel = ModelFactory.getSysmodel();
  21. public String getClassIds(int number){
  22. StringBuffer sb = new StringBuffer();
  23. //提供的推荐编码个数
  24. int getNum = 5;
  25. int iToNumber = number + 100;
  26. sb.append("{"+number + "~" + iToNumber + "推荐编号 : ");
  27. int iget = 0;
  28. for(int i = number; i < iToNumber; i ++){
  29. if(iget > getNum) break;
  30. if(sysmodel.getMdpClassByClassID(i) == null){
  31. sb.append(" "+ i +" ");
  32. iget ++;
  33. }
  34. }
  35. sb.append("}");
  36. return sb.toString();
  37. }
  38. public boolean isTableExist(String tableName , ArrayList xmltablelist,ArrayList MdpConstantlist){
  39. boolean flag = true;
  40. int iFalg = 0;
  41. for (int i = 0 ; i < xmltablelist.size() ; i++){
  42. MdpClass mdpClass = (MdpClass)xmltablelist.get(i);
  43. if(mdpClass.getName().toUpperCase().equals(tableName.toUpperCase())){
  44. iFalg ++;
  45. }
  46. }
  47. for (int i = 0 ; i < MdpConstantlist.size() ; i++){
  48. MdpConstant mdpConstant = (MdpConstant)MdpConstantlist.get(i);
  49. if(mdpConstant.getCodeName().toUpperCase().equals(tableName.toUpperCase())){
  50. iFalg ++;
  51. }
  52. }
  53. if (iFalg > 0){
  54. flag = false;
  55. }
  56. return flag;
  57. }
  58. %>
  59. <HTML>
  60. <HEAD>
  61. <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
  62. <TITLE></TITLE>
  63. <link rel="stylesheet" href="../../../../styles/css.css" type="text/css"></link>
  64. <script type="text/javascript" src="../../../../scripts/dojo/dojo/dojo.js"
  65. djConfig="isDebug: false, parseOnLoad: true"></script>
  66. <script type="text/javascript">
  67. dojo.require("dijit.form.Form");
  68. dojo.require("dijit.form.FilteringSelect");
  69. dojo.require("dijit.form.Button");
  70. dojo.require("dijit.Tooltip");
  71. </script>
  72. <style type="text/css">
  73. @import "../../../../scripts/dojo/dojo/resources/dojo.css";
  74. @import "../../../../scripts/dojo/dijit/themes/tundra/tundra.css";
  75. @import "../../../../scripts/dojo/dijit/themes/tundra/tundra_rtl.css";
  76. @import "../../../../scripts/dojo/dijit/tests/css/dijitTests.css";
  77. </style>
  78. <script type="text/javascript" src="../select.js"></script>
  79. </HEAD>
  80. <body class="tundra">
  81. <form dojoType="dijit.form.Form" name="form1" method="post" action="">
  82. <div id=total>
  83. <div class="whiteborder">
  84. <div class="titback">
  85. <div class="floatleft"><img src="../../../../images/index/arrow1.gif" alt="1" width="20" height="24" /></div>
  86. <div class="dropshadow">由数据库中的表生成XML配置文件</div>
  87. <div class="clear"></div>
  88. </div>
  89. <div class="report">
  90. <table align="center" id="SortTable512_1" width="100%"
  91. cellpadding="1" cellspacing="1" class="ltab2">
  92. <tr>
  93. <td width="65%" valign="top">
  94. <table align="center" width="100%" border="0" cellpadding="1"cellspacing="1" class="ltab2">
  95. <tr class="TableBgColorAsh">
  96. <td width="45%" align="center">
  97. <select name="select" size="15" class="SelectScroll" multiple id="role1" style="width:80%">
  98. <%ArrayList tables = SysOperator.getTableNames(Integer.parseInt(sourcecode));
  99. for (int j = 0 ; j < tables.size() ; j++){
  100. String tableName = (String)tables.get(j);
  101. if (isTableExist(tableName, xmltablelist,xmlMdpConstantlist)){
  102. %>
  103. <option value="<%=tableName%>"> <%=tableName%> </option>
  104. <% }
  105. }
  106. %>
  107. </select> </td>
  108. <td width="10%" align="center"><input name="button" type="button" class="button2"
  109. style="cursor:hand" onClick="move(this.form.role1,this.form.role2);"
  110. value=" &gt;&gt; "/>
  111. <br>
  112. <br>
  113. <input name="button" type="button" class="button2"
  114. style="cursor:hand" onClick="move(this.form.role2,this.form.role1);"
  115. value=" &lt;&lt; "/></td>
  116. <td width="45%" align="center" valign="middle">
  117. <select name="select" size="15" multiple class="SelectScroll" id="role2" style="width:80%">
  118. </select></td>
  119. </tr>
  120. <tr align="left">
  121. <td colspan="4" height="31"> 所属模块&nbsp;&nbsp;&nbsp;
  122. <select name="module"
  123. required="true" id="module" autocomplete="true">
  124. <%for (int i = 0; i < list.size(); i++) {
  125. MdpModuleImpl Mdpmod = (MdpModuleImpl) list.get(i);%>
  126. <option value="<%=Mdpmod.getCode()%>"> <%=Mdpmod.getName()%> </option>
  127. <%}%>
  128. </select></td>
  129. </tr>
  130. <tr class="TableBgColorBlack">
  131. <td colspan="3" align="center">
  132. <button id="save" dojoType="dijit.form.Button" onClick='checkConfig();' type="button" iconClass="plusIcon">
  133. 开始创建</button></td>
  134. </tr>
  135. </table>
  136. </td>
  137. <td colspan="2" align="center" valign="top">
  138. <%
  139. //这里写FOR循环,针对每一百的波段提供一些唯一的编号
  140. out.print(getClassIds(100)+"<br>");
  141. out.print(getClassIds(200)+"<br>");
  142. out.print(getClassIds(300)+"<br>");
  143. out.print(getClassIds(400)+"<br>");
  144. out.print(getClassIds(500)+"<br>");
  145. out.print(getClassIds(600)+"<br>");
  146. out.print(getClassIds(700)+"<br>");
  147. out.print(getClassIds(800)+"<br>");
  148. out.print(getClassIds(900)+"<br>");
  149. %></td>
  150. </tr>
  151. </table>
  152. <div id="boxIdea" align="left" style="width:98%;height:98%;border:1px solid #999999;">
  153. </div>
  154. </div>
  155. </div>
  156. </div>
  157. </form>
  158. <script language="JavaScript">
  159. var indexOfCheck = 0;
  160. var role2=document.all.item("role2");
  161. function checkConfig() {
  162. indexOfCheck = 0
  163. var boxIdea=document.all.item("boxIdea");
  164. boxIdea.innerHTML = "";
  165. if(role2.options.length == 0){
  166. alert("请选则进行验证的表对象!");
  167. return;
  168. }
  169. var CodeName = role2.options[0].value;
  170. checkOneObj(CodeName)
  171. }
  172. function checkOneObj(CodeName){
  173. if(CodeName=="") return;
  174. createXMLHttpRequest();
  175. var strA = "";
  176. var moduleObj = dojo.byId('module');
  177. CodeName = encodeURI(CodeName);
  178. CodeName = encodeURI(CodeName);
  179. XMLHttpReq.open("POST","createExc.jsp?module="+moduleObj.value+"&sourcecode=<%=sourcecode%>&CodeName="+CodeName,false);
  180. XMLHttpReq.setRequestHeader("Content-Length",strA.length);
  181. XMLHttpReq.setRequestHeader("Content-type","application/x-www-form-urlencoded");
  182. XMLHttpReq.send(strA);
  183. var boxIdea=document.all.item("boxIdea");
  184. boxIdea.innerHTML = boxIdea.innerHTML + XMLHttpReq.responseText;
  185. indexOfCheck = indexOfCheck + 1;
  186. if(indexOfCheck < role2.options.length){
  187. checkOneObj(role2.options[indexOfCheck].value);
  188. }else{
  189. return;
  190. }
  191. }
  192. // End -->
  193. </script>
  194. </BODY>
  195. </HTML>