tree.jsp 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
  2. <%@ page language="java"
  3. import="java.util.*,
  4. com.sysmodel.collectmodel.xmlmodel.able.FormCollection,
  5. com.sysmodel.datamodel.xmlmodel.ModelFactory,
  6. com.sysmodel.datamodel.xmlmodel.impl.MdpClassImpl,
  7. com.sysmodel.datamodel.xmlmodel.able.SysModel,
  8. com.sysmodel.datamodel.xmlmodel.impl.MdpAttributeImpl,
  9. com.sysmodel.collectmodel.xmlmodel.impl.ReportFieldImpl,
  10. com.sysmodel.XFormModelImpl,
  11. com.sysmodel.xformmodel.impl.RegExpImpl,
  12. com.sysmodel.xformmodel.importcontrol.TreeControl,
  13. com.sysmodel.xformmodel.able.Validate,
  14. com.sysmodel.collectmodel.xmlmanager.xmlobjdll.CollectModeldllImpl
  15. "%>
  16. <%
  17. String pageid = request.getParameter("pageid") == null ? "" : request.getParameter("pageid");
  18. String name = request.getParameter("name") == null ? "" : request.getParameter("name");
  19. String action = "add";
  20. SysModel sysmodel = ModelFactory.getSysmodel();
  21. MdpClassImpl MdpClass = null;
  22. FormCollection FormCollection = null;
  23. ArrayList reportFields = null;
  24. int columnCount = 0;
  25. String label = "";
  26. String colspan = "";
  27. String need = "";
  28. String size = "";
  29. String parentCode = "";
  30. String classid = "";
  31. if(session.getAttribute("FormCollect"+pageid) == null ){
  32. return;
  33. } else {
  34. FormCollection = (FormCollection)session.getAttribute("FormCollect"+pageid);
  35. int iclassid = Integer.parseInt(FormCollection.getClassid());
  36. MdpClass = (MdpClassImpl)sysmodel.getMdpClassByClassID(iclassid);
  37. reportFields = FormCollection.getReportFieldByControlType( FormCollection , "date");
  38. columnCount = FormCollection.getPageBody().getColumnCount();
  39. classid = FormCollection.getClassid()+"";
  40. if(!name.equals("")){
  41. action = "edit";
  42. ReportFieldImpl ReportFieldImpl = FormCollection.getReportFieldByName(FormCollection,name);
  43. label = ReportFieldImpl.getLabel();
  44. colspan = ReportFieldImpl.getColspan()+"";
  45. Validate Validate = ReportFieldImpl.getValidate();
  46. if(Validate!=null){
  47. System.out.println(Validate.isNeed());
  48. need = new Boolean(Validate.isNeed()).toString();
  49. }
  50. }
  51. }
  52. %>
  53. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  54. <html>
  55. <head>
  56. <title>定义树型采集构件</title>
  57. <meta http-equiv="pragma" content="no-cache">
  58. <meta http-equiv="cache-control" content="no-cache">
  59. <meta http-equiv="expires" content="0">
  60. <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
  61. <meta http-equiv="description" content="定义树型采集构件">
  62. <script type="text/javascript" src="../../../scripts/creatselect.js"></script>
  63. <link rel="stylesheet" href="../../../styles/css.css" type="text/css"></link>
  64. <link rel="stylesheet" href="../../../styles/style.css" type="text/css"></link>
  65. <script type="text/javascript" src="../../../scripts/creatselect.js"></script>
  66. <script type="text/javascript" src="../../../scripts/dojo/dojo/dojo.js" djConfig="isDebug: false, parseOnLoad: true"></script>
  67. <script type="text/javascript">
  68. dojo.require("dijit.form.Form");
  69. dojo.require("dijit.form.ValidationTextBox");
  70. dojo.require("dijit.form.ComboBox");
  71. dojo.require("dijit.form.FilteringSelect");
  72. dojo.require("dijit.form.NumberSpinner");
  73. dojo.require("dijit.form.Button");
  74. dojo.require("dijit.Tooltip");
  75. dojo.require("dojo.parser");
  76. </script>
  77. <style type="text/css">
  78. @import "../../../scripts/dojo/dojo/resources/dojo.css";
  79. @import "../../../scripts/dojo/dijit/themes/tundra/tundra.css";
  80. @import "../../../scripts/dojo/dijit/themes/tundra/tundra_rtl.css";
  81. @import "../../../scripts/dojo/dijit/tests/css/dijitTests.css";
  82. .formQuestion {
  83. background-color:#d0e3f5;
  84. padding:0.3em;
  85. font-weight:900;
  86. font-family:Verdana, Arial, sans-serif;
  87. font-size:0.8em;
  88. color:#5a5a5a;
  89. }
  90. .formAnswer {
  91. background-color:#f5eede;
  92. padding:0.3em;
  93. margin-bottom:1em;
  94. width: 100%;
  95. }
  96. .pageSubContentTitle {
  97. color:#8e8e8e;
  98. font-size:1em;
  99. font-family:Verdana, Arial, sans-serif;
  100. margin-bottom:0.75em;
  101. }
  102. .small INPUT {
  103. width: 2.5em;
  104. }
  105. .medium INPUT {
  106. width: 10em;
  107. }
  108. .long INPUT {
  109. width: 20em;
  110. }
  111. .firstLabel {
  112. display: inline-block;
  113. display: -moz-inline-box;
  114. width: 10em;
  115. min-width: 10em;
  116. }
  117. .secondLabel {
  118. width: auto;
  119. margin-left: 5em;
  120. margin-right: 1em;
  121. }
  122. fieldset label {
  123. margin-right: 1em;
  124. }
  125. .noticeMessage {
  126. display: block;
  127. float: right;
  128. font-weight: normal;
  129. font-family:Arial, Verdana, sans-serif;
  130. color:#663;
  131. font-size:0.9em;
  132. }
  133. </style>
  134. <script type="text/javascript">
  135. function shouOrder(str){
  136. var order_div = document.getElementById("orderdiv");
  137. if(str == '1'){
  138. order_div.style.display = "";
  139. } else {
  140. order_div.style.display = "none";
  141. }
  142. }
  143. function getTable_Dojo(obj,selectName){
  144. alert(obj)
  145. if(obj.getValue()=="")return;
  146. var strA = "";
  147. createXMLHttpRequest();
  148. axo = new ActiveXObject("Microsoft.XMLDOM");
  149. XMLHttpReq.open("POST","getAttributeXml.jsp?name="+obj.getValue()+"&classid=<%=classid%>",false);
  150. XMLHttpReq.setRequestHeader("Content-Length",strA.length);
  151. XMLHttpReq.setRequestHeader("Content-type","application/x-www-form-urlencoded");
  152. XMLHttpReq.send(strA);
  153. axo.loadXML(XMLHttpReq.responseText);
  154. n1 = axo.selectNodes("/root/name");
  155. n2 = axo.selectNodes("/root/description");
  156. alert(n1.length)
  157. if(n1.length > 0){
  158. shouOrder('1');
  159. BuildSel(unescape(XMLHttpReq.responseText),selectName, n1, n2);
  160. }else{
  161. shouOrder('0');
  162. }
  163. }
  164. </script>
  165. </head>
  166. <body class="tundra" onLoad="">
  167. <form name="form1" method="post" action="treeExc.jsp">
  168. <input type="hidden" name="pageid" value="<%=pageid %>">
  169. <input type="hidden" name="action" value="<%=action %>">
  170. <input type="hidden" name="oName" value="<%=name %>">
  171. <div id=total>
  172. <div class="whiteborder">
  173. <div class="titback">
  174. <div class="floatleft"><img src="../../../images/index/arrow1.gif" width="20" height="24"/></div>
  175. <div class="dropshadow">定义树型采集构件</div>
  176. <div class="clear"></div>
  177. </div>
  178. <div class="report">
  179. <table border="0" align="center" width="100%" cellpadding="1" cellspacing="1" class="ltab2">
  180. <tr class="">
  181. <td width="30%">字段</td>
  182. <td width="70%" align="left" >
  183. <select id="name" name="name"
  184. onChange="getTable_Dojo(this, document.all.order)"
  185. dojoType="dijit.form.FilteringSelect"
  186. required="true"
  187. autocomplete="true">
  188. <option value="0" selected></option>
  189. <%if(name.equals("")){
  190. ArrayList mdpAttributes = FormCollection.getReportFieldContrastAttribute(FormCollection,"tree");
  191. for (int i=0 ; i< mdpAttributes.size() ; i++){
  192. MdpAttributeImpl MdpAttributeImpl = (MdpAttributeImpl)mdpAttributes.get(i);
  193. %>
  194. <option value="<%=MdpAttributeImpl.getName() %>"><%=MdpAttributeImpl.getDescription()%></option>
  195. <%}
  196. }else{
  197. ArrayList allAttributes = FormCollection.getAllReportFieldContrastAttribute(FormCollection,"tree");
  198. for (int i=0 ; i< allAttributes.size() ; i++){
  199. MdpAttributeImpl MdpAttributeImpl = (MdpAttributeImpl)allAttributes.get(i);
  200. %>
  201. <option value="<%=MdpAttributeImpl.getName() %>" <%if(MdpAttributeImpl.getName().equals(name) )out.print("selected");%>><%=MdpAttributeImpl.getDescription()%></option>
  202. <% }
  203. }
  204. %>
  205. </select>
  206. </td>
  207. </tr>
  208. <tr class="">
  209. <td>父节点</td>
  210. <td align="left" >
  211. <select id="parentCode" name="parentCode"
  212. onChange=""
  213. dojoType="dijit.form.FilteringSelect"
  214. required="true"
  215. autocomplete="true">
  216. <option value="0" selected></option>
  217. <%
  218. List Attributes = MdpClass.getAllMdpAttributes();
  219. for (int i=0 ; i< Attributes.size() ; i++){
  220. MdpAttributeImpl MdpAttributeImpl = (MdpAttributeImpl)Attributes.get(i);
  221. %>
  222. <option value="<%=MdpAttributeImpl.getName() %>" <%if(MdpAttributeImpl.getName().equals(parentCode)) out.print("selected");%>><%=MdpAttributeImpl.getDescription()%></option>
  223. <%} %>
  224. </select>
  225. </td>
  226. </tr>
  227. <tr class="">
  228. <td>标题</td>
  229. <td align="left">
  230. <input type="text" value="<%=label %>"
  231. id="label" name="label" class="medium"
  232. dojoType="dijit.form.ValidationTextBox"
  233. required="true"
  234. ucfirst="true"
  235. invalidMessage="标题必须填写!">
  236. </td>
  237. </tr>
  238. <tr class="">
  239. <td>合并值</td>
  240. <td align="left" >
  241. <select id="colspan" name="colspan"
  242. onChange=""
  243. dojoType="dijit.form.FilteringSelect"
  244. required="true"
  245. autocomplete="true">
  246. <option value="" ></option>
  247. <% if(columnCount > 0){
  248. for (int i = 2 ; i<= columnCount * 2 ; i++){
  249. %>
  250. <option value="<%=i %>" <%if(colspan.equals(i+""))out.print("selected"); %>><%=i %></option>
  251. <%}} %>
  252. </select>
  253. </td>
  254. </tr>
  255. <tr class="">
  256. <td>是否必填</td>
  257. <td align="left" >
  258. <select id="need" name="need"
  259. onChange=""
  260. dojoType="dijit.form.FilteringSelect"
  261. required="true"
  262. autocomplete="true">
  263. <option value="true" <%if(need.equals("true"))out.print("selected"); %>>true</option>
  264. <option value="false"<%if(need.equals("false"))out.print("selected"); %>>false</option>
  265. </select>
  266. </td>
  267. </tr>
  268. <tr class="">
  269. <td>leafonly</td>
  270. <td align="left" >
  271. <select id="leafonly" name="leafonly"
  272. onChange=""
  273. dojoType="dijit.form.FilteringSelect"
  274. required="true"
  275. autocomplete="true">
  276. <option value="true">true</option>
  277. <option value="false">false</option>
  278. </select>
  279. </td>
  280. </tr>
  281. <tr class="">
  282. <td>size:</td>
  283. <td align="left">
  284. <input dojotype="dijit.form.NumberSpinner"
  285. id="size" name="size"
  286. value="<%=size %>"
  287. required="true"
  288. constraints="{min: 0, max:100, places:0}"
  289. size=10
  290. invalidMessage="size必须录入数字">
  291. </td>
  292. </tr>
  293. <tr class="" >
  294. <td colspan="2">
  295. <div width="100%" id="orderdiv" style="display:none">
  296. <table border="0" align="center" width="100%" cellpadding="1" cellspacing="1" class="ltab2">
  297. <tr>
  298. <td width="30%">排序字段</td>
  299. <td width="70%" align="left">
  300. <select name="order">
  301. <option value="0" selected></option>
  302. </select>
  303. </td>
  304. </tr>
  305. </table>
  306. </div>
  307. </td>
  308. </tr>
  309. </table>
  310. </div>
  311. <div class="btmbox">
  312. <button id="save" dojoType="dijit.form.Button" onClick='console.log("clicked simple")' type="submit" iconClass="plusIcon">
  313. 保存
  314. </button>
  315. <span dojoType="dijit.Tooltip" connectId="save">保存按钮</span>&nbsp;&nbsp;
  316. <button id="reset" dojoType="dijit.form.Button" onClick='document.form1.reset();' type="button" iconClass="plusIcon">
  317. 重置
  318. </button>
  319. <span dojoType="dijit.Tooltip" connectId="save">重置按钮</span>&nbsp;&nbsp;
  320. <button id="close" dojoType="dijit.form.Button" onClick='window.close();' type="button" iconClass="plusIcon">
  321. 关闭
  322. </button>
  323. <span dojoType="dijit.Tooltip" connectId="save">关闭按钮</span>&nbsp;&nbsp;
  324. </div>
  325. </div>
  326. </div>
  327. </form>
  328. <br>
  329. </body>
  330. </html>