document_list_m.jsp
Upload User: jhtang88
Upload Date: 2014-01-27
Package Size: 28528k
Code Size: 11k
Category:

Jsp/Servlet

Development Platform:

Java

  1. <%@ page contentType="text/html; charset=utf-8"%>
  2. <%@ page import="cn.js.fan.util.*"%>
  3. <%@ page import="cn.js.fan.db.*"%>
  4. <%@ page import="cn.js.fan.web.*"%>
  5. <%@ page import="cn.js.fan.module.cms.*" %>
  6. <%@ page import="com.redmoon.oa.pvg.*" %>
  7. <html>
  8. <head>
  9. <title>文件列表</title>
  10. <link href="../common.css" rel="stylesheet" type="text/css">
  11. <link href="default.css" rel="stylesheet" type="text/css">
  12. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  13. <style type="text/css">
  14. <!--
  15. .style4 {
  16. color: #FFFFFF;
  17. font-weight: bold;
  18. }
  19. -->
  20. </style>
  21. </head>
  22. <body bgcolor="#FFFFFF" text="#000000">
  23. <jsp:useBean id="docmanager" scope="page" class="cn.js.fan.module.cms.DocumentMgr"/>
  24. <jsp:useBean id="privilege" scope="page" class="com.redmoon.oa.pvg.Privilege"/>
  25. <jsp:useBean id="dir" scope="page" class="cn.js.fan.module.cms.Directory"/>
  26. <%
  27. if (!privilege.isUserPrivValid(request, PrivDb.PRIV_READ)) {
  28. out.println(cn.js.fan.web.SkinUtil.makeErrMsg(request, cn.js.fan.web.SkinUtil.LoadString(request, "pvg_invalid")));
  29. return;
  30. }
  31. %>
  32. <%
  33. String sql = "select class1,title,id,isHome,examine,modifiedDate,color,isBold,expire_date from document";
  34. String op = StrUtil.getNullString(request.getParameter("op"));
  35. String dir_code = ParamUtil.get(request, "dir_code");
  36. LeafPriv lp = new LeafPriv();
  37. if (!dir_code.equals("")) {
  38. lp.setDirCode(dir_code);
  39. if (!lp.canUserSee(privilege.getUser(request))) {
  40. out.print(SkinUtil.makeErrMsg(request, SkinUtil.LoadString(request, "pvg_invalid")));
  41. return;
  42. }
  43. }
  44. Leaf leaf = dir.getLeaf(dir_code);
  45. String dir_name = "";
  46. if (leaf!=null)
  47. dir_name = leaf.getName();
  48. if (op.equals("del")) {
  49. int id = ParamUtil.getInt(request, "id");
  50. try {
  51. if (docmanager.del(request, id, privilege))
  52. out.print(StrUtil.Alert_Redirect(SkinUtil.LoadString(request, "info_operate_success"), "document_list_m.jsp?dir_code=" + StrUtil.UrlEncode(dir_code)));
  53. else
  54. out.print(StrUtil.Alert("删除失败!"));
  55. }
  56. catch (ErrMsgException e) {
  57. out.print(StrUtil.Alert_Back(e.getMessage()));
  58. return;
  59. }
  60. op = "";
  61. }
  62. if (op.equals("delBatch")) {
  63. try {
  64. docmanager.delBatch(request);
  65. out.print(StrUtil.Alert_Redirect(SkinUtil.LoadString(request, "info_operate_success"), "document_list_m.jsp?dir_code=" + StrUtil.UrlEncode(dir_code)));
  66. }
  67. catch (ErrMsgException e) {
  68. out.print(StrUtil.Alert_Back(e.getMessage()));
  69. return;
  70. }
  71. op = "";
  72. }
  73. if (op.equals("passExamine")) {
  74. try {
  75. docmanager.passExamineBatch(request);
  76. out.print(StrUtil.Alert_Redirect(SkinUtil.LoadString(request, "info_operate_success"), "document_list_m.jsp?dir_code=" + StrUtil.UrlEncode(dir_code)));
  77. }
  78. catch (ErrMsgException e) {
  79. out.print(StrUtil.Alert_Back(e.getMessage()));
  80. return;
  81. }
  82. op = "";
  83. }
  84. %>
  85. <table cellSpacing="0" cellPadding="0" width="100%">
  86.   <tbody>
  87.     <tr>
  88.       <td class="head">
  89.    <%if (!dir_code.equals("") && lp.canUserModify(privilege.getUser(request))) {%>
  90.         <a href="dir_frame.jsp?root_code=<%=StrUtil.UrlEncode(dir_code)%>" target="_parent">管理目录</a>
  91.         &nbsp;&nbsp;|
  92.         <%}%>
  93. &nbsp;
  94.       <%
  95.   if (!op.equals("search")) {
  96.    if (leaf!=null && leaf.isLoaded()) {
  97. Leaf lf = leaf;
  98. String navstr = "";
  99. String parentcode = lf.getParentCode();
  100. Leaf plf = new Leaf();
  101. while (!parentcode.equals("root")) {
  102. plf = plf.getLeaf(parentcode);
  103. if (plf==null || !plf.isLoaded())
  104. break;
  105. if (plf.getType()==Leaf.TYPE_LIST && plf.getChildCount()!=0)
  106. navstr = "<a href='dir_frame.jsp?root_code=" + StrUtil.UrlEncode(plf.getCode()) + "'>" + plf.getName() + "</a>&nbsp;>>&nbsp;" + navstr;
  107. else if (plf.getType()==Leaf.TYPE_LIST && plf.getChildCount()==0)
  108. navstr = "<a href='document_list_m.jsp?dir_code=" + StrUtil.UrlEncode(plf.getCode()) + "'>" + plf.getName() + "</a>&nbsp;>>&nbsp;" + navstr;
  109. else
  110. navstr = plf.getName() + "</a>&nbsp;>>&nbsp;" + navstr;
  111. parentcode = plf.getParentCode();
  112. }
  113. out.print(navstr + lf.getName());
  114. }
  115. }
  116. else
  117. out.print("搜索结果");
  118. %></td>
  119.     </tr>
  120.   </tbody>
  121. </table>
  122. <%
  123. String what = "";
  124. String kind = "";
  125. if (op.equals("search")) {
  126. kind = ParamUtil.get(request, "kind");
  127. what = ParamUtil.get(request, "what");
  128. if (kind.equals("title"))
  129. sql += " where examine=" + Document.EXAMINE_PASS + " and title like "+StrUtil.sqlstr("%"+what+"%");
  130. // else if (kind.equals("content"))
  131. //  sql += " where content like " + StrUtil.sqlstr("%" + what + "%");
  132. else
  133. sql += " where examine=" + Document.EXAMINE_PASS + " and keywords like " + StrUtil.sqlstr("%" + what + "%");
  134. }
  135. else {
  136. if (!dir_code.equals(""))
  137. sql += " where class1=" + StrUtil.sqlstr(dir_code);
  138. if (!dir_code.equals("") && !lp.canUserModify(privilege.getUser(request))) {
  139. sql += " and examine=" + Document.EXAMINE_PASS;
  140. sql += " order by isHome desc, modifiedDate desc";
  141. }
  142. else
  143. sql += " order by examine asc, isHome desc, modifiedDate desc";
  144. }
  145. String strcurpage = StrUtil.getNullString(request.getParameter("CPages"));
  146. if (strcurpage.equals(""))
  147. strcurpage = "1";
  148. if (!StrUtil.isNumeric(strcurpage)) {
  149. out.print(StrUtil.makeErrMsg("标识非法!"));
  150. return;
  151. }
  152. int pagesize = 15;
  153. int curpage = Integer.parseInt(strcurpage);
  154. PageConn pageconn = new PageConn(Global.defaultDB, Integer.parseInt(strcurpage), pagesize);
  155. ResultIterator ri = pageconn.getResultIterator(sql);
  156. ResultRecord rr = null;
  157. Paginator paginator = new Paginator(request, pageconn.getTotal(), pagesize);
  158. //设置当前页数和总页数
  159. int totalpages = paginator.getTotalPages();
  160. if (totalpages==0)
  161. {
  162. curpage = 1;
  163. totalpages = 1;
  164. }
  165. %>
  166. <br>
  167. <table width="98%"  border="0" align="center" cellpadding="0" cellspacing="0" class="p9">
  168.     <tr>
  169.   <form name="form1" action="document_list_m.jsp?op=search" method="post">
  170.       <td width="82%" align="center">按
  171.         <select name="kind">
  172.           <option value="title">标题</option>
  173.           <option value="keywords">关键字</option>
  174.         </select>
  175. &nbsp;
  176. <input name=what size=20>
  177. &nbsp;
  178. <input name="submit" type=submit value="搜索"></td>
  179.   </form>
  180.       <td width="18%" align="center"><%if (!dir_code.equals("") && leaf.getType()==2) {%>
  181.         <input name="image" type=image 
  182. onClick="javascript:window.location.href='../fwebedit.jsp?op=add&dir_code=<%=StrUtil.UrlEncode(dir_code)%>&dir_name=<%=StrUtil.UrlEncode(dir_name, "utf-8")%>';" src="images/btn_add.gif" width=80 
  183. height=20>
  184.       <%}%></td>
  185.     </tr>
  186. </table>
  187. <br>
  188. <table width="92%" border="0" align="center" class="p9">
  189.   <tr>
  190.     <td height="24" align="right">找到符合条件的记录 <b><%=paginator.getTotal() %></b> 条 每页显示 <b><%=paginator.getPageSize() %></b> 条 页次 <b><%=paginator.getCurrentPage() %>/<%=paginator.getTotalPages() %></b></td>
  191.   </tr>
  192. </table>
  193. <table style="BORDER-RIGHT: #a6a398 1px solid; BORDER-TOP: #a6a398 1px solid; BORDER-LEFT: #a6a398 1px solid; BORDER-BOTTOM: #a6a398 1px solid" cellSpacing="1" cellPadding="3" width="98%" align="center">
  194.   <tbody>
  195.     <tr>
  196.       <td class="thead" style="PADDING-LEFT: 10px" noWrap width="55%">标题</td>
  197.       <td class="thead" noWrap width="15%"><img src="images/tl.gif" align="absMiddle" width="10" height="15">修改时间</td>
  198.       <td class="thead" noWrap width="11%"><img src="images/tl.gif" align="absMiddle" width="10" height="15">审核状态</td>
  199.       <td class="thead" noWrap width="19%"><img src="images/tl.gif" align="absMiddle" width="10" height="15">管理</td>
  200.     </tr>
  201.     <%
  202. while (ri.hasNext()) {
  203.   rr = (ResultRecord)ri.next(); 
  204. boolean isHome = rr.getInt("isHome")==1?true:false;
  205. String color = StrUtil.getNullStr(rr.getString("color"));
  206. boolean isBold = rr.getInt("isBold")==1;
  207. java.util.Date expireDate = rr.getDate("expire_date");
  208. %>
  209.     <tr onMouseOver="this.className='tbg1sel'" onMouseOut="this.className='tbg1'" class="tbg1">
  210.       <td><input name="ids" type="checkbox" value="<%=rr.getInt("id")%>">
  211.       <%if (DateUtil.compare(new java.util.Date(), expireDate)==2) {%>
  212.    <a href="../doc_show.jsp?id=<%=rr.getInt("id")%>" title="<%=rr.getString(2)%>">
  213. <%
  214. if (isBold)
  215. out.print("<B>");
  216. if (!color.equals("")) {
  217. %>
  218. <font color="<%=color%>">
  219. <%}%>
  220. <%=(String)rr.get(2)%>
  221. <%if (!color.equals("")) {%>
  222. </font>
  223. <%}%>
  224. <%
  225. if (isBold)
  226. out.print("</B>");
  227. %>
  228. </a>
  229.   <%}else{%>
  230.    <a href="../doc_show.jsp?id=<%=rr.getInt("id")%>" title="<%=rr.getString(2)%>"><%=(String)rr.get(2)%></a>
  231.   <%}%>   </td>
  232.       <td><%
  233.   java.util.Date d = rr.getDate("modifiedDate");
  234.   if (d!=null)
  235.    out.print(DateUtil.format(d, "yy-MM-dd HH:mm"));
  236.   %>      </td>
  237.       <td align="center">
  238.   <%
  239.   int examine = rr.getInt("examine");
  240.   if (examine==0)
  241.    out.print("<font color='blue'>未审核</font>");
  242.   else if (examine==1)
  243.    out.print("<font color='red'>未通过</font>");
  244.   else
  245.    out.print("已通过");
  246.   %>   </td>
  247.       <td align="left"><a href="../fwebedit.jsp?op=edit&id=<%=rr.getInt("id")%>&dir_code=<%=StrUtil.UrlEncode((String)rr.get(1))%>&dir_name=<%=StrUtil.UrlEncode(dir_name)%>">编辑</a> <a onClick="return confirm('您确定要删除吗?')" href="document_list_m.jsp?op=del&id=<%=rr.getString(3)%>&dir_code=<%=StrUtil.UrlEncode(dir_code)%>&dir_name=<%=StrUtil.UrlEncode(dir_name)%>">删除</a> <a href="../doc_show.jsp?id=<%=rr.getInt("id")%>">查看</a>&nbsp;<a href="document_list_m.jsp?op=passExamine&dir_code=<%=StrUtil.UrlEncode(dir_code)%>&ids=<%=rr.getInt("id")%>">通过</a></td>
  248.     </tr>
  249.     <%}%>
  250.   </tbody>
  251. </table>
  252. <table width="96%"  border="0" align="center" cellpadding="0" cellspacing="0">
  253.   <tr>
  254.     <td colspan="2" align="right">&nbsp;</td>
  255.   </tr>
  256.   <tr>
  257.     <td width="55%" align="left"><input name="button3" type="button" onClick="selAllCheckBox('ids')" value="全选">
  258. &nbsp;&nbsp;
  259. <input name="button3" type="button" onClick="clearAllCheckBox('ids')" value="清除选择">
  260. &nbsp;
  261. <input name="button3" type="button" onClick="doDel()" value="删除">
  262. &nbsp;
  263. <input name="button32" type="button" onClick="passExamineBatch()" value="通过"></td>
  264.     <td width="45%" align="right"><%
  265. String querystr = "op="+op+"&what="+StrUtil.UrlEncode(what) + "&dir_code=" + StrUtil.UrlEncode(dir_code) + "&op=" + op + "&kind=" + kind + "&what=" + StrUtil.UrlEncode(what);
  266.     out.print(paginator.getCurPageBlock("document_list_m.jsp?"+querystr));
  267. %></td>
  268.   </tr>
  269. </table>
  270. </body>
  271. <script src="../inc/common.js"></script>
  272. <script>
  273. function doDel() {
  274. var ids = getCheckboxValue("ids");
  275. if (ids=="") {
  276. alert("请选择文章!");
  277. return;
  278. }
  279. window.location.href = "?op=delBatch&dir_code=<%=StrUtil.UrlEncode(dir_code)%>&ids=" + ids;
  280. }
  281. function passExamineBatch() {
  282. var ids = getCheckboxValue("ids");
  283. if (ids=="") {
  284. alert("请选择文章!");
  285. return;
  286. }
  287. window.location.href = "?op=passExamine&dir_code=<%=StrUtil.UrlEncode(dir_code)%>&ids=" + ids;
  288. }
  289. function selAllCheckBox(checkboxname){
  290. var checkboxboxs = document.all.item(checkboxname);
  291. if (checkboxboxs!=null)
  292. {
  293. // 如果只有一个元素
  294. if (checkboxboxs.length==null) {
  295. checkboxboxs.checked = true;
  296. }
  297. for (i=0; i<checkboxboxs.length; i++)
  298. {
  299. checkboxboxs[i].checked = true;
  300. }
  301. }
  302. }
  303. function clearAllCheckBox(checkboxname) {
  304. var checkboxboxs = document.all.item(checkboxname);
  305. if (checkboxboxs!=null)
  306. {
  307. // 如果只有一个元素
  308. if (checkboxboxs.length==null) {
  309. checkboxboxs.checked = false;
  310. }
  311. for (i=0; i<checkboxboxs.length; i++)
  312. {
  313. checkboxboxs[i].checked = false;
  314. }
  315. }
  316. }
  317. </script>
  318. </html>