design.jsp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  1. <%@ page pageEncoding="UTF-8"%>
  2. <%@ page contentType="text/html; charset=UTF-8" language="java" %>
  3. <%@ page language="java"
  4. import="java.util.ArrayList,
  5. com.sysmodel.XFormFactory,
  6. com.sysmodel.XFormModel,
  7. com.sysmodel.collectmodel.xmlmodel.able.FormCollection,
  8. com.sysmodel.XFormModelImpl,
  9. com.sysmodel.collectmodel.xmlmodel.able.*,
  10. com.sysmodel.collectmodel.xmlmodel.impl.*"%>
  11. <%
  12. String pageid = request.getParameter("pagid") == null ? "" : request.getParameter("pagid");
  13. if(pageid.equals("")) return;
  14. String sessionReload = request.getParameter("sessionReload") == null ? "false" : request.getParameter("sessionReload");
  15. FormCollection FormCollectionClone = null;
  16. if(session.getAttribute("FormCollect"+pageid) == null || sessionReload.equals("true")){
  17. if(!pageid.equals("")){
  18. FormCollection FormCollection0bj = XFormFactory.getXFormModel().getFormCollection(pageid);
  19. FormCollectionClone = (FormCollection)FormCollection0bj.clone();
  20. session.setAttribute("FormCollect"+pageid,FormCollection0bj.clone());
  21. } else{
  22. return;
  23. }
  24. } else {
  25. FormCollectionClone = (FormCollection)session.getAttribute("FormCollect"+pageid);
  26. }
  27. %>
  28. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  29. <html>
  30. <HEAD>
  31. <script type="text/javascript">
  32. function openDesiner(ulr,width,height){
  33. window.open(ulr+"?pageid=<%=pageid%>",'',"'width="+width+",height="+height+"'");
  34. }
  35. </script>
  36. <TITLE></TITLE>
  37. <META http-equiv="Content-Type" content="text/html; charset=GB2312">
  38. <link rel="stylesheet" href="../../../styles/css.css" type="text/css">
  39. <LINK rel="stylesheet" href="../../../styles/sortabletable.css" type="text/css">
  40. <link rel="stylesheet" href="../../../styles/contextMenu.css" type="text/css"></link>
  41. <script language="JavaScript" src="../../../scripts/pagetree.jsp" type="text/JavaScript"></script>
  42. <script type="text/javascript" src="../../../scripts/contextMenu.js"></script>
  43. <script type="text/javascript" src="../../../scripts/calendar/calendar.js"></script>
  44. <link rel="stylesheet" href="../../../scripts/calendar/calendar-blue.css" type="text/css"></link>
  45. <script type="text/javascript" src="../../../scripts/calendar/calendar-zh.js"></script>
  46. <script type="text/javascript" src="../../../scripts/dojo/dojo/dojo.js"
  47. djConfig="isDebug: false, parseOnLoad: true"></script>
  48. <script type="text/javascript">
  49. dojo.require("dijit.form.Form");
  50. dojo.require("dijit.form.FilteringSelect");
  51. dojo.require("dijit.form.ValidationTextBox");
  52. dojo.require("dijit.form.NumberSpinner");
  53. dojo.require("dijit.form.Slider");
  54. dojo.require("dijit.form.FilteringSelect");
  55. dojo.require("dijit.form.Textarea");
  56. dojo.require("dijit.form.CheckBox");
  57. dojo.require("dijit.form.Button");
  58. dojo.require("dijit.Tooltip");
  59. </script>
  60. <style type="text/css">
  61. @import "../../../scripts/dojo/dojo/resources/dojo.css";
  62. @import "../../../scripts/dojo/dijit/themes/tundra/tundra.css";
  63. @import "../../../scripts/dojo/dijit/themes/tundra/tundra_rtl.css";
  64. @import "../../../scripts/dojo/dijit/tests/css/dijitTests.css";
  65. .buttonbox {
  66. margin:15px 0px;
  67. margin-top:15px;
  68. clear:both;
  69. }
  70. </style>
  71. <script type="text/javascript">
  72. var selectTdObj;
  73. function makeMenu(){
  74. var myMenu, item;
  75. myMenu = new contextMenu();
  76. item = new contextItem("修改", "../../../images/button/edit.gif", "editObj();", "menu");
  77. myMenu.addItem(item);
  78. item = new contextItem("删除", "../../../images/button/delete.gif", "deleteObj();", "menu");
  79. myMenu.addItem(item);
  80. item = new contextItem("", "", "", "separator");
  81. myMenu.addItem(item);
  82. item = new contextItem("刷新", "../../../images/button/refresh.gif", "window.location.reload();", "menu");
  83. myMenu.addItem(item);
  84. myMenu.show(this.document);
  85. delete item;
  86. delete myMenu;
  87. }
  88. function reloadConfig(){
  89. if(confirm("确定要恢复原来的配置吗?")){
  90. location.href="designExc.jsp?pageid=<%=pageid%>&doaction=reload";
  91. }}
  92. function saveConfig(){
  93. if(confirm("确定要发布应用吗?")){
  94. location.href="designExc.jsp?pageid=<%=pageid%>&doaction=save";
  95. }
  96. }
  97. function deleteObj(){
  98. alert("确定要删除吗?");
  99. var type = selectTdObj.type;
  100. if(type=="ReportField"){
  101. location.href="designExc.jsp?pageid=<%=pageid%>&deltype=" + type+"&fieldname="+selectTdObj.fieldname;
  102. }
  103. }
  104. function editObj(){
  105. var controltype = selectTdObj.controltype;
  106. var fieldname = selectTdObj.fieldname;
  107. var url = "pageid=<%=pageid%>&name="+fieldname;
  108. if(controltype == 'date'){
  109. window.open("../design/date.jsp?"+url,'',"'width=400,height=500'");
  110. }else if(controltype == 'textarea'){
  111. window.open("../design/textarea.jsp?"+url,'',"'width=400,height=500'");
  112. }else if(controltype == 'text'){
  113. window.open("../design/text.jsp?"+url,'',"'width=400,height=500'");
  114. }else if(controltype == 'select'){
  115. window.open("../design/select.jsp?"+url,'',"'width=400,height=500'");
  116. }else if(controltype == 'radio'){
  117. window.open("../design/radio.jsp?"+url,'',"'width=400,height=500'");
  118. }else if(controltype == 'tree'){
  119. window.open("../design/tree.jsp?"+url,'',"'width=400,height=500'");
  120. }else if(controltype == 'checkbox'){
  121. window.open("../design/checkBox.jsp?"+url,'',"'width=400,height=500'");
  122. }else if(controltype == 'button'){
  123. var buttontype = selectTdObj.buttontype;
  124. var buttonvalue = selectTdObj.buttonvalue;
  125. window.open("../design/butoon.jsp?pageid=<%=pageid%>&buttontype="+buttontype+"&buttonvalue="+buttonvalue,'',"'width=400,height=500'");
  126. }
  127. }
  128. makeMenu();
  129. document.onclick = hideMenu;
  130. </script>
  131. </HEAD>
  132. <body class="tundra" oncontextmenu="if(!event.ctrlKey){return false} else {return true}">
  133. <form action="">
  134. <div style="position: absolute; width:10%; height:80%;top:10px; left:12px; border: 1px solid #999999; overflow:auto;" id="layer1">
  135. <table align="center">
  136. <tr>
  137. <td width="20">
  138. <img id="tsave" src="../../../images/tool/save.gif" onclick="saveConfig();"></img>
  139. <span dojoType="dijit.Tooltip" connectId="tsave">发布到客户端</span>
  140. </td>
  141. <td width="20">
  142. <img id="tundo" src="../../../images/tool/undo.gif" onclick="reloadConfig();"></img>
  143. <span dojoType="dijit.Tooltip" connectId="tundo">撤销到系统在用的设计</span>
  144. </td>
  145. </tr>
  146. <tr>
  147. <td>
  148. <img id="htmltab" onclick="openDesiner('../design/tableAtt.jsp','400','500');" src="../../../images/tool/htmltab.gif"></img>
  149. <span dojoType="dijit.Tooltip" connectId="htmltab" >采集表单属性</span>
  150. </td>
  151. <td></td>
  152. </tr>
  153. <tr><td colspan="2">&nbsp;</td></tr>
  154. <tr>
  155. <td>
  156. <img id="select" src="../../../images/tool/select.gif" onclick="openDesiner('../design/select.jsp','400','500');"></img>
  157. <span dojoType="dijit.Tooltip" connectId="select">定义选择输入构件</span>
  158. </td>
  159. <td></td>
  160. </tr>
  161. <tr>
  162. <td>
  163. <img id="checkbox" src="../../../images/tool/checkbox.gif" onclick="openDesiner('../design/checkBox.jsp','400','500');"></img>
  164. <span dojoType="dijit.Tooltip" connectId="checkbox">定义多选输入构件</span>
  165. </td>
  166. <td></td>
  167. </tr>
  168. <tr>
  169. <td>
  170. <img id="radio" src="../../../images/tool/radio.gif" onclick="openDesiner('../design/radio.jsp','400','500');"></img>
  171. <span dojoType="dijit.Tooltip" connectId="radio">定义单选输入构件</span>
  172. </td>
  173. <td></td>
  174. </tr>
  175. <tr>
  176. <td>
  177. <img id="date" src="../../../images/tool/date.gif" onclick="openDesiner('../design/date.jsp','400','500');"></img>
  178. <span dojoType="dijit.Tooltip" connectId="date">定义日期输入构件</span>
  179. </td>
  180. <td></td>
  181. </tr>
  182. <tr>
  183. <td>
  184. <img id="text" src="../../../images/tool/text.gif" onclick="openDesiner('../design/text.jsp','400','500');"></img>
  185. <span dojoType="dijit.Tooltip" connectId="text">定义文本框输入构件</span>
  186. </td>
  187. <td></td>
  188. </tr>
  189. <tr>
  190. <td>
  191. <img id="tree1" src="../../../images/tool/tree.gif" onclick="openDesiner('../design/tree.jsp','400','500');"></img>
  192. <span dojoType="dijit.Tooltip" connectId="tree1">定义树形输入构件</span>
  193. </td>
  194. <td></td>
  195. </tr>
  196. <tr>
  197. <td>
  198. <img id="textarea" src="../../../images/tool/textarea.gif" onclick="openDesiner('../design/textarea.jsp','400','500');"></img>
  199. <span dojoType="dijit.Tooltip" connectId="textarea">定义文本域输入构件</span>
  200. </td>
  201. <td></td>
  202. </tr>
  203. <tr>
  204. <td>
  205. <img id="sortReport" src="../../../images/tool/sort.gif" onclick="openDesiner('../design/outSort.jsp','400','500');"></img>
  206. <span dojoType="dijit.Tooltip" connectId="sortReport">排序输入构件</span>
  207. </td>
  208. <td></td>
  209. </tr>
  210. <tr><td colspan="2">&nbsp;</td></tr>
  211. <tr>
  212. <td>
  213. <img id="button" src="../../../images/tool/button.gif" onclick="openDesiner('../design/butoon.jsp','400','500');"></img>
  214. <span dojoType="dijit.Tooltip" connectId="button">定义表单按钮</span>
  215. </td>
  216. <td></td>
  217. </tr>
  218. <tr>
  219. <td>
  220. <img id="sortbutton" src="../../../images/tool/sort.gif" onclick="openDesiner('../design/buttonSort.jsp','400','500');"></img>
  221. <span dojoType="dijit.Tooltip" connectId="sortbutton">排序按钮</span>
  222. </td>
  223. <td></td>
  224. </tr>
  225. </table>
  226. </div>
  227. <div style="position: absolute; width:90%; height:auto; top:10; left:100; border: 1px solid #999999; overflow:auto;" align="center" id="layer1">
  228. <br>
  229. <div id=total>
  230. <div class="whiteborder">
  231. <div class="titback">
  232. <div class="floatleft"><img src="../../../images/index/arrow1.gif" width="20" height="24" /></div>
  233. <div class="dropshadow"><%
  234. if(FormCollectionClone.getPageHead() != null)
  235. out.print(FormCollectionClone.getPageHead().getPageTitle());
  236. %></div>
  237. <div class="clear"></div>
  238. </div>
  239. </div>
  240. <div class="report">
  241. <%
  242. PageBodyImpl PageBody =(PageBodyImpl)FormCollectionClone.getPageBody();
  243. XFormModel XFormModel = XFormFactory.getXFormModel();
  244. String width = PageBody.getWidth();
  245. String height = PageBody.getHeight();
  246. String labelWidth = PageBody.getLabelWidth();
  247. String controlWidth = PageBody.getControlWidth();
  248. String labelAlign = PageBody.getLabelAlign();
  249. String controlAlign =PageBody.getControlAlign();
  250. ArrayList<ReportFieldImpl> alReportFields = PageBody.getAllReportFields();
  251. ArrayList<HiddenFieldImpl> alHiddenFields = PageBody.getAlHiddenFields();
  252. int columnCount = PageBody.getColumnCount();
  253. StringBuffer sb = new StringBuffer();
  254. for (int i = 0; i < alHiddenFields.size(); i++) {
  255. HiddenField field = (HiddenField) alHiddenFields.get(i);
  256. sb.append(field.getHiddenInput(request)).append("\n");
  257. }
  258. sb.append("<table align=\"center\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" width=\"");
  259. sb.append(width + "\"");
  260. String css = XFormModel.getCSSValue("ReportTableCss");
  261. if (!css.equals(""))
  262. sb.append(" class=\"" + css + "\"");
  263. if (!height.equals(""))
  264. sb.append(" height=\"" + height + "\"");
  265. sb.append(">");
  266. boolean nextLine = true;
  267. int currentCount = 0;
  268. String FontTextCss = XFormModel.getCSSValue("FontTextCss");
  269. FontTextCss = FontTextCss.equals("")? "":" class=\"" + FontTextCss + "\"";
  270. short[] widthFlag = new short[columnCount * 2];
  271. String htmlLabelWidth = labelWidth.equals("") ? "" : " width=\"" + labelWidth+ "\"";
  272. String htmControlWidth = controlWidth.equals("") ? "" : " width=\""+ controlWidth + "\"";
  273. String htmlLabelAlign = labelAlign.equals("") ? "" : " align=\"" + labelAlign+ "\"";
  274. String htmControlAlign = controlAlign.equals("") ? "" : " align=\""+ controlAlign + "\"";
  275. String LineCssA = XFormModel.getCSSValue("LineCssA");
  276. String LineCssB = XFormModel.getCSSValue("LineCssB");
  277. LineCssA = LineCssA.equals("") ? "" : " class=\"" + LineCssA + "\"";
  278. LineCssB = LineCssB.equals("") ? "" : " class=\"" + LineCssB + "\"";
  279. boolean currentLineCss = true;
  280. for (int i = 0; i < alReportFields.size(); i++) {
  281. ReportField field = (ReportField) alReportFields.get(i);
  282. String scospan = field.getColspan();
  283. scospan = scospan.equals("") ? "1" : scospan;
  284. int iColspan = Integer.parseInt(scospan);
  285. int result = currentCount + iColspan;
  286. if (result > columnCount) {
  287. int tdCount = columnCount - currentCount;
  288. for (int j = 0; j < tdCount; j++) {
  289. int index = currentCount + j;
  290. if (widthFlag[index] == 0) {
  291. widthFlag[index] = 1;
  292. widthFlag[index + 1] = 1;
  293. sb.append("<td").append(htmlLabelWidth + "></td>");
  294. sb.append("<td").append(htmControlWidth+ "></td>");
  295. } else {
  296. sb.append("<td></td>").append("<td></td>");
  297. }
  298. }
  299. sb.append("</tr>");
  300. nextLine = true;
  301. currentCount = 0;
  302. }
  303. if (nextLine) {
  304. if (currentLineCss)
  305. sb.append("<tr").append(LineCssA + ">");
  306. else
  307. sb.append("<tr").append(LineCssB + ">");
  308. nextLine = false;
  309. currentLineCss = !currentLineCss;
  310. }
  311. if (field.getName().equals("")) {
  312. int colspan = iColspan * 2;
  313. sb.append("<td colspan=\"").append(colspan + "\"");
  314. sb.append(" onMouseUp=\"rightUp(this);\" onmouseover=\"tdchangeStyle(this, 'on');\" ");
  315. sb.append(" onmouseout=\"tdchangeStyle(this, 'out');\"");
  316. sb.append(">");
  317. String DivCss = XFormModel.getCSSValue("DivCss");
  318. DivCss = DivCss.equals("")? "":" class=\"" + DivCss + "\"";
  319. sb.append("<div").append(DivCss);
  320. sb.append(">" + field.getLabel()).append("</div></td>");
  321. } else {
  322. sb.append("<td"+htmlLabelAlign);
  323. if (widthFlag[currentCount] == 0) {
  324. widthFlag[currentCount] = 1;
  325. sb.append(htmlLabelWidth);
  326. }
  327. sb.append(" type=\"ReportField\"");
  328. sb.append(" fieldname=\""+field.getName()+"\"");
  329. sb.append(" controltype=\""+field.getControlType()+"\"");
  330. sb.append(" onMouseUp=\"rightUp(this);\" onmouseover=\"tdchangeStyle(this, 'on');\" ");
  331. sb.append(" onmouseout=\"tdchangeStyle(this, 'out');\"");
  332. sb.append(">");
  333. sb.append("<font").append(FontTextCss).append(">" + field.getLabel()).append("</font>");
  334. if(field.getValidate().isNeed()) sb.append(" <span class=\"redcolor\">*</span>");
  335. sb.append("</td>");
  336. sb.append("<td"+htmControlAlign);
  337. if (iColspan > 1) {
  338. int colspan = iColspan * 2 - 1;
  339. sb.append(" colspan=\"").append(colspan + "\"");
  340. } else {
  341. if (widthFlag[currentCount + 1] == 0) {
  342. widthFlag[currentCount + 1] = 1;
  343. sb.append(htmControlWidth);
  344. }
  345. }
  346. sb.append(" nowrap>");
  347. sb.append(field.getControl().produceHtml(field.getName(), "", "",field.getValidate()));
  348. sb.append("</td>");
  349. }
  350. if (result == columnCount) {
  351. sb.append("</tr>");
  352. nextLine = true;
  353. currentCount = 0;
  354. } else
  355. currentCount += iColspan;
  356. }
  357. if (currentCount > 0) {
  358. int tdCount = columnCount - currentCount;
  359. for (int j = 0; j < tdCount; j++) {
  360. int index = currentCount + j;
  361. if (widthFlag[index] == 0) {
  362. widthFlag[index] = 1;
  363. widthFlag[index + 1] = 1;
  364. sb.append("<td").append(htmlLabelWidth + "></td>");
  365. sb.append("<td").append(htmControlWidth+ "></td>");
  366. } else {
  367. sb.append("<td></td>").append("<td></td>");
  368. }
  369. }
  370. sb.append("</tr>");
  371. }
  372. sb.append("</table>");
  373. out.print(sb.toString());
  374. %>
  375. <%
  376. PageRootImpl PageRoot = (PageRootImpl)FormCollectionClone.getPageRoot();
  377. %>
  378. <div class="buttonbox" align="<%=PageRoot.getAlign()%>">
  379. <%
  380. sb = new StringBuffer();
  381. ArrayList alAction = PageRoot.getAllActions();
  382. if(PageRoot.isImage()){
  383. for (int i = 0; i < alAction.size(); i++) {
  384. Action action = (Action)alAction.get(i);
  385. sb.append("<img border=\"0\" src=\"").append(action.getValue()+"\" ");
  386. sb.append(" type=\"button\" controltype=\"button\"");
  387. sb.append(" isimage=\""+ PageRoot.isImage() +"\"");
  388. sb.append(" buttontype=\""+action.getType()+"\"");
  389. sb.append(" buttonvalue=\""+action.getValue()+"\"");
  390. sb.append(" onMouseUp=\"rightUp(this);\" onmouseover=\"imgbtchangeStyle(this, 'on');\" ");
  391. sb.append(" onmouseout=\"imgbtchangeStyle(this, 'out');\"");
  392. sb.append("\">").append(action.appendSpace());
  393. }
  394. }else{
  395. for (int i = 0; i < alAction.size(); i++) {
  396. Action action = (Action)alAction.get(i);
  397. String buttonValue = action.getValue();
  398. String dojoType = XFormModelImpl.getInstance().getJsFunctionByCode(action.getDojoType());
  399. sb.append("<input type=\"button\" dojoType=\""+dojoType+"\" controltype=\"button\" value=\"").append(buttonValue+"\"");
  400. sb.append(" isimage=\""+ PageRoot.isImage() +"\"");
  401. sb.append(" buttontype=\""+action.getType()+"\"");
  402. sb.append(" buttonvalue=\""+action.getValue()+"\"");
  403. sb.append(" onMouseUp=\"rightUp(this);\" onmouseover=\"inputbtchangeStyle(this, 'on');\" ");
  404. sb.append(" onmouseout=\"inputbtchangeStyle(this, 'out');\"");
  405. sb.append(" class=\"button\" >").append(action.appendSpace());
  406. action = null;
  407. }
  408. out.print(sb.toString());
  409. }
  410. %>
  411. </div>
  412. </div>
  413. </div>
  414. <br>
  415. </div>
  416. </form>
  417. </body>
  418. </html>