dir_list_search.jsp
上传用户:jhtang88
上传日期:2014-01-27
资源大小:28528k
文件大小:9k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=utf-8" %>
  2. <%@ page import="cn.js.fan.security.*"%>
  3. <%@ page import="cn.js.fan.util.*"%>
  4. <%@ page import="cn.js.fan.db.*"%>
  5. <%@ page import="java.util.*"%>
  6. <%@ page import="cn.js.fan.web.*"%>
  7. <%@ page import="com.redmoon.oa.pvg.*"%>
  8. <%@ page import="com.redmoon.oa.person.UserDb"%>
  9. <%@ page import="java.util.Calendar" %>
  10. <%@ page import="cn.js.fan.db.Paginator"%>
  11. <%@ page import="com.redmoon.oa.netdisk.*"%>
  12. <html><head>
  13. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  14. <link href="common.css" rel="stylesheet" type="text/css">
  15. <%@ include file="../inc/nocache.jsp"%>
  16. <jsp:useBean id="strutil" scope="page" class="cn.js.fan.util.StrUtil"/>
  17. <jsp:useBean id="dir" scope="page" class="com.redmoon.oa.netdisk.Directory"/>
  18. <%
  19. int id = 0;
  20. Privilege privilege = new Privilege();
  21. if (!privilege.isUserLogin(request))
  22. {
  23. out.println(cn.js.fan.web.SkinUtil.makeErrMsg(request, cn.js.fan.web.SkinUtil.LoadString(request, "pvg_invalid")));
  24. return;
  25. }
  26. String userName = privilege.getUser(request);
  27. String fileName = ParamUtil.get(request, "fileName");
  28. %>
  29. <title>搜索</title>
  30. <script language="JavaScript">
  31. <!--
  32. //-->
  33. </script>
  34. </head>
  35. <body bgcolor="#FFFFFF" text="#000000" style="overflow:auto">
  36. <TABLE width="100%" BORDER=0 align="center" CELLPADDING=0 CELLSPACING=0>
  37.   <TR valign="top" bgcolor="#FFFFFF">
  38.     <TD width="" height="430" colspan="2" style="background-attachment: fixed; background-image: url(images/bg_bottom.jpg); background-repeat: no-repeat">
  39.           <TABLE cellSpacing=0 cellPadding=0 width="100%">
  40.             <TBODY>
  41.               <TR>
  42.                 <TD class=head>
  43. &nbsp;
  44.     <%
  45. UserDb ud = new UserDb();
  46. ud = ud.getUserDb(userName);
  47. String strDiskAllow = NumberUtil.round((double)ud.getDiskSpaceAllowed()/1024000, 3);
  48. String strDiskHas = NumberUtil.round((double)(ud.getDiskSpaceAllowed()-ud.getDiskSpaceUsed())/1024000, 3);
  49. %>
  50. &nbsp;磁盘份额:<%=strDiskAllow%>M &nbsp;剩余空间:<%=strDiskHas%>M&nbsp;&nbsp;</TD>
  51.               </TR>
  52.             </TBODY>
  53.           </TABLE>
  54.           <table border="0" cellspacing="0" width="100%" cellpadding="0" align="center">
  55.             <tr align="center">
  56.               <td width="90%" align="left" valign="top" bgcolor="#F2F2F2" class="unnamed2">              </td>
  57.             </tr>
  58.             
  59.             <tr>
  60.               <td height="25" align="center" bgcolor="#FFFFFF"><table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="D6D3CE">
  61.                 <tr>
  62.                   <td width="40%" align="center"><table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolorlight="#aaaaaa" borderColorDark="#ffffff" bgcolor="D6D3CE">
  63.                       <tr>
  64.                         <td>&nbsp;文件名</td>
  65.                       </tr>
  66.                   </table></td>
  67.                   <td width="13%" bgcolor="#EAE9E6"><table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolorlight="#aaaaaa" borderColorDark="#ffffff" bgcolor="D6D3CE">
  68.                       <tr>
  69.                         <td>&nbsp;大小</td>
  70.                       </tr>
  71.                     </table></td>
  72.                   <td width="20%" bgcolor="#EAE9E6"><table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolorlight="#aaaaaa" borderColorDark="#ffffff" bgcolor="D6D3CE">
  73.                       <tr>
  74.                         <td>&nbsp;上传时间                    </td>
  75.                       </tr>
  76.                   </table></td>
  77.                   <td width="27%" bgcolor="#EAE9E6"><table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolorlight="#aaaaaa" borderColorDark="#ffffff" bgcolor="D6D3CE">
  78.                       <tr>
  79.                         <td>&nbsp;操作</td>
  80.                       </tr>
  81.                   </table></td>
  82.                 </tr>
  83.               </table>
  84.     <%
  85. String strcurpage = StrUtil.getNullString(request.getParameter("CPages"));
  86. if (strcurpage.equals(""))
  87. strcurpage = "1";
  88. if (!StrUtil.isNumeric(strcurpage)) {
  89. out.print(StrUtil.makeErrMsg("标识非法!"));
  90. return;
  91. }
  92. Attachment am = new Attachment();
  93. long fileLength = -1;
  94. int pagesize = 20;
  95. int curpage = Integer.parseInt(strcurpage);
  96. String dirCode = ParamUtil.get(request, "dirCode");
  97. String sql = "SELECT id FROM netdisk_document_attach WHERE name like " + StrUtil.sqlstr("%" + fileName + "%") + " and page_num=1";
  98. if (dirCode.equals("")) {
  99. sql += " and USER_NAME=" + StrUtil.sqlstr(privilege.getUser(request));
  100. }
  101. else {
  102. Leaf lf = new Leaf();
  103. lf = lf.getLeaf(dirCode);
  104. int docId = lf.getDocId();
  105. sql +=  " and doc_id=" + docId;
  106. }
  107. sql += " order by name";
  108. // out.print(sql);
  109. ListResult lr = am.listResult(sql, curpage, pagesize);
  110. int total = lr.getTotal();
  111. Paginator paginator = new Paginator(request, total, pagesize);
  112. // 设置当前页数和总页数
  113. int totalpages = paginator.getTotalPages();
  114. if (totalpages==0)
  115. {
  116. curpage = 1;
  117. totalpages = 1;
  118. }
  119.   // Vector attachments = doc.getAttachments(1);
  120.   Vector attachments = lr.getResult();
  121.   Iterator ir = attachments.iterator();
  122.   while (ir.hasNext()) {
  123.    am = (Attachment) ir.next(); 
  124. fileLength = (long)am.getSize()/1024; 
  125. if(fileLength == 0 && (long)am.getSize() > 0)
  126. fileLength = 1;  
  127. %>
  128.     <table width="100%"  border="0" cellpadding="0" cellspacing="0" onMouseOver="this.style.backgroundColor='#FFD6DE'" onMouseOut="this.style.backgroundColor='#ffffff'">
  129.                   <tr>
  130.                     <td width="4%" align="center"><a title="打开文件" target="_blank" href="netdisk_getfile.jsp?id=<%=am.getDocId()%>&attachId=<%=am.getId()%>"><img src="images/<%=am.getIcon()%>" border="0"></a></td>
  131.                     <td width="37%">&nbsp; <a title="打开文件" class="mainA" href="netdisk_getfile.jsp?id=<%=am.getDocId()%>&attachId=<%=am.getId()%>" target="_blank"><%=am.getName()%></a></td>
  132.                     <td width="13%"><%=fileLength%>KB</td>
  133.                     <td width="19%"><%=DateUtil.format(am.getUploadDate(), "yyyy-MM-dd HH:mm")%></td>
  134.                     <td width="27%">&nbsp;<a href="dir_change.jsp?attachId=<%=am.getId()%>"><img src="images/rename.gif" alt="重命名及移动文件" width="16" height="16" border="0" align="absmiddle"></a> &nbsp;<a href="javascript:delAttach('<%=am.getId()%>', '<%=am.getDocId()%>')"><img src="images/del.gif" alt="删除" width="16" height="16" border="0" align="absmiddle"></a>&nbsp;&nbsp;<a target="_blank" href="netdisk_downloadfile.jsp?id=<%=am.getDocId()%>&attachId=<%=am.getId()%>"><img src="images/download.gif" alt="下载" width="16" height="16" border="0" align="absmiddle"></a>
  135.                         <%if (!StrUtil.getNullStr(am.getPublicShareDir()).equals("")) {%>
  136.                         <a href="netdisk_public_share.jsp?attachId=<%=am.getId()%>"><img src="images/share_public_yes.gif" alt="已发布" width="16" height="16" border="0" align="absmiddle"></a>
  137.                         <%}else{%>
  138.                         <a href="netdisk_public_share.jsp?attachId=<%=am.getId()%>"><img src="images/share_public.gif" alt="发布" width="16" height="16" border="0" align="absmiddle"></a>
  139.                         <%}%></td>
  140.                   </tr>
  141.                 </table>
  142.   <%}
  143.   %>   <table width="100%" border="0" cellspacing="0" cellpadding="0">
  144.                 <tr>
  145.                   <td height="30" align="right">共 <b><%=paginator.getTotal() %></b> 个 每页显示 <b><%=paginator.getPageSize() %></b> 个 页次 <b><%=paginator.getCurrentPage() %>/<%=paginator.getTotalPages() %></b>
  146.                     <%
  147. String querystr = "";
  148.     out.print(paginator.getCurPageBlock("?"+querystr));
  149. %>
  150.                     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
  151.                 </tr>
  152.               </table></td>
  153.             </tr>
  154.       </table>
  155. </TD>
  156.   </TR>
  157. </TABLE>
  158. <iframe id="hideframe" name="hideframe" src="fwebedit_do.jsp" width=0 height=0></iframe>
  159. </body>
  160. <script>
  161. function findObj(theObj, theDoc)
  162. {
  163.   var p, i, foundObj;
  164.   
  165.   if(!theDoc) theDoc = document;
  166.   if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  167.   {
  168.     theDoc = parent.frames[theObj.substring(p+1)].document;
  169.     theObj = theObj.substring(0,p);
  170.   }
  171.   if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  172.   for (i=0; !foundObj && i < theDoc.forms.length; i++) 
  173.     foundObj = theDoc.forms[i][theObj];
  174.   for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
  175.     foundObj = findObj(theObj,theDoc.layers[i].document);
  176.   if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  177.   
  178.   return foundObj;
  179. }
  180. function changeAttachName(attach_id, doc_id, nm) {
  181. var obj = findObj(nm);
  182. // document.frames.hideframe.location.href = "fwebedit_do.jsp?op=changeattachname&page_num=1&doc_id=" + doc_id + "&attach_id=" + attach_id + "&newname=" + obj.value
  183. form3.action = "dir_list_do.jsp?op=changeattachname&page_num=1&doc_id=" + doc_id + "&attach_id=" + attach_id;
  184. form3.newname.value = obj.value;
  185. form3.submit();
  186. }
  187. function delAttach(attach_id, doc_id) {
  188. if (!window.confirm("您确定要删除吗?")) {
  189. return;
  190. }
  191. document.frames.hideframe.location.href = "dir_list_do.jsp?op=delAttach&page_num=1&doc_id=" + doc_id + "&attach_id=" + attach_id
  192. }
  193. </script>
  194. </html>