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

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
  2. <%@ page import="java.io.InputStream" %>
  3. <%@ page import="java.util.*" %>
  4. <%@ page import="cn.js.fan.db.*" %>
  5. <%@ page import="cn.js.fan.util.*" %>
  6. <%@ page import="cn.js.fan.web.*" %>
  7. <%@ page import="com.redmoon.oa.netdisk.*" %>
  8. <%@ page import="com.redmoon.oa.pvg.*" %>
  9. <%@ page import="com.redmoon.oa.dept.*" %>
  10. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  11. <html>
  12. <head>
  13. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  14. <title>转移</title>
  15. <LINK href="../admin/default.css" type=text/css rel=stylesheet>
  16. <script>
  17. </script>
  18. </head>
  19. <body>
  20. <jsp:useBean id="privilege" scope="page" class="com.redmoon.oa.pvg.Privilege"/>
  21. <jsp:useBean id="docmanager" scope="page" class="com.redmoon.oa.netdisk.DocumentMgr"/>
  22. <%
  23. if (!privilege.isUserLogin(request))
  24. {
  25. out.println(SkinUtil.makeErrMsg(request, SkinUtil.LoadString(request, "pvg_invalid")));
  26. return;
  27. }
  28. %>
  29. <%
  30. int attachId = ParamUtil.getInt(request, "attachId");
  31. Attachment att = new Attachment();
  32. att = att.getAttachment(attachId);
  33. LeafPriv lp = new LeafPriv(att.getDirCode());
  34. if (!lp.canUserModify(privilege.getUser(request))) {
  35. out.print(SkinUtil.makeErrMsg(request, SkinUtil.LoadString(request, "pvg_invalid")));
  36. return;
  37. }
  38. int docId = att.getDocId();
  39. Document doc = new Document();
  40. doc = doc.getDocument(docId);
  41. Leaf leaf = new Leaf();
  42. leaf = leaf.getLeaf(doc.getDirCode());
  43. // 只有本人才可以改父目录
  44. if (!leaf.getRootCode().equals(privilege.getUser(request))) {
  45. out.print(SkinUtil.makeErrMsg(request, SkinUtil.LoadString(request, "pvg_invalid")));
  46. return;
  47. }
  48. String op = ParamUtil.get(request, "op");
  49. if (op.equals("change")) {
  50. String newDirCode = ParamUtil.get(request, "newDirCode");
  51. if (!newDirCode.equals("")) {
  52. doc.changeAttachmentToDir(att, newDirCode);
  53. out.print(StrUtil.Alert_Redirect("修改成功!", "dir_list.jsp?op=editarticle&dir_code=" + StrUtil.UrlEncode(newDirCode)));
  54. return;
  55. }
  56. }
  57. if (op.equals("changeattachname")) {
  58. boolean re = false;
  59. try {
  60. String newname = ParamUtil.get(request, "newname").trim();
  61. if (newname.equals("")) {
  62. throw new ErrMsgException("文件名不能为空!");
  63. }
  64. re = docmanager.updateAttachmentName(request);
  65. }
  66. catch (ErrMsgException e) {
  67. out.print(StrUtil.Alert_Back(e.getMessage()));
  68. }
  69. if (re) {
  70. out.print(StrUtil.Alert_Back("修改成功!"));
  71. }
  72. }
  73. %>
  74. <br>
  75. <TABLE 
  76. style="BORDER-RIGHT: #a6a398 1px solid; BORDER-TOP: #a6a398 1px solid; BORDER-LEFT: #a6a398 1px solid; BORDER-BOTTOM: #a6a398 1px solid" 
  77. cellSpacing=0 cellPadding=3 width="95%" align=center>
  78.   <!-- Table Head Start-->
  79.   <TBODY>
  80.     <TR>
  81.       <TD class=thead style="PADDING-LEFT: 10px" noWrap width="70%">将<%=att.getName()%>转移至目录</TD>
  82.     </TR>
  83.     <TR class=row style="BACKGROUND-COLOR: #fafafa">
  84.       <TD align="center" style="PADDING-LEFT: 10px"><table class="frame_gray" width="335" border="0" cellpadding="0" cellspacing="1">
  85.         <tr>
  86.           <td width="411" align="center"><table width="98%">
  87.             <form name="form1" method="post" action="?op=change">
  88.                <tr>
  89.                 <td width="243" align="center"><span class="unnamed2">
  90.                   <select name="newDirCode">
  91. <%
  92. Leaf rootlf = leaf.getLeaf(privilege.getUser(request));
  93. DirectoryView dv = new DirectoryView(rootlf);
  94. dv.ShowDirectoryAsOptionsWithCode(out, rootlf, rootlf.getLayer());
  95. %>
  96.   </select>
  97. <script>
  98. form1.newDirCode.value = "<%=leaf.getCode()%>";
  99. </script>
  100.                 </span></td>
  101.               </tr>
  102.               <tr>
  103.                 <td align="left"></td>
  104.               </tr>
  105.               <tr>
  106.                 <td align="center"><input name="Submit" type="submit" class="singleboarder" value="提交">
  107.                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  108.                   <input name="Submit" type="reset" class="singleboarder" value="重置"> 
  109.   <input name="attachId" value="<%=attachId%>" type=hidden>   </tr>
  110.             </form>
  111.           </table></td>
  112.         </tr>
  113.       </table>
  114.       </TD>
  115.     </TR>
  116.     <!-- Table Body End -->
  117.     <!-- Table Foot -->
  118.     <TR>
  119.       <TD class=tfoot align=right><DIV align=right> </DIV></TD>
  120.     </TR>
  121.     <!-- Table Foot -->
  122.   </TBODY>
  123. </TABLE>
  124. <br>
  125. <TABLE 
  126. style="BORDER-RIGHT: #a6a398 1px solid; BORDER-TOP: #a6a398 1px solid; BORDER-LEFT: #a6a398 1px solid; BORDER-BOTTOM: #a6a398 1px solid" 
  127. cellSpacing=0 cellPadding=3 width="95%" align=center>
  128.   <!-- Table Head Start-->
  129.   <TBODY>
  130.     <TR>
  131.       <TD class=thead style="PADDING-LEFT: 10px" noWrap width="70%"><%=att.getName()%> 重命名 </TD>
  132.     </TR>
  133.     <TR class=row style="BACKGROUND-COLOR: #fafafa">
  134.       <TD align="center" style="PADDING-LEFT: 10px"><table class="frame_gray" width="335" border="0" cellpadding="0" cellspacing="1">
  135.         <tr>
  136.           <td width="411" align="center"><table width="98%">
  137.             <form name="form2" method="post" action="?op=changeattachname">
  138.               <tr>
  139.                 <td width="243" align="center">
  140. 请输入新名称
  141.   <input name="newname" value="<%=att.getName()%>">
  142. </td>
  143.               </tr>
  144.               <tr>
  145.                 <td align="left"></td>
  146.               </tr>
  147.               <tr>
  148.                 <td align="center"><input name="Submit2" type="submit" class="singleboarder" value="提交">
  149.                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  150.                   <input name="Submit2" type="reset" class="singleboarder" value="重置">
  151.                   <input name="attachId" value="<%=attachId%>" type=hidden>
  152.                   <input name="attach_id" value="<%=attachId%>" type=hidden>
  153.                   <input name="doc_id" value="<%=docId%>" type=hidden>
  154.                   <input name="page_num" value="1" type=hidden>
  155.                 </tr>
  156.             </form>
  157.           </table></td>
  158.         </tr>
  159.       </table></TD>
  160.     </TR>
  161.     <!-- Table Body End -->
  162.     <!-- Table Foot -->
  163.     <TR>
  164.       <TD class=tfoot align=right><DIV align=right> </DIV></TD>
  165.     </TR>
  166.     <!-- Table Foot -->
  167.   </TBODY>
  168. </TABLE>
  169. </body>
  170. </html>