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

Jsp/Servlet

开发平台:

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="com.redmoon.oa.pvg.*" %>
  6. <html>
  7. <head>
  8. <title>管理登录</title>
  9. <link href="../common.css" rel="stylesheet" type="text/css">
  10. <link href="default.css" rel="stylesheet" type="text/css">
  11. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  12. <style type="text/css">
  13. <!--
  14. .style1 {
  15. color: #FFFFFF;
  16. font-weight: bold;
  17. }
  18. .style2 {color: #FFFFFF}
  19. -->
  20. </style>
  21. </head>
  22. <body bgcolor="#FFFFFF" text="#000000">
  23. <jsp:useBean id="backup" scope="page" class="cn.js.fan.util.Backup"/>
  24. <jsp:useBean id="cfg" scope="page" class="cn.js.fan.web.Config"/>
  25. <jsp:useBean id="privilege" scope="page" class="com.redmoon.oa.pvg.Privilege"/>
  26. <%
  27. if (!privilege.isUserPrivValid(request, PrivDb.PRIV_BACKUP))
  28. {
  29.     out.print(cn.js.fan.web.SkinUtil.makeErrMsg(request, cn.js.fan.web.SkinUtil.LoadString(request, "pvg_invalid")));
  30. return;
  31. }
  32. %>
  33. <table cellSpacing="0" cellPadding="0" width="100%">
  34.   <tbody>
  35.     <tr>
  36.       <td class="head">数据管理</td>
  37.     </tr>
  38.   </tbody>
  39. </table>
  40. <TABLE 
  41. style="BORDER-RIGHT: #a6a398 1px solid; BORDER-TOP: #a6a398 1px solid; BORDER-LEFT: #a6a398 1px solid; BORDER-BOTTOM: #a6a398 1px solid" 
  42. cellSpacing=0 cellPadding=3 width="95%" align=center>
  43.   <!-- Table Head Start-->
  44.   <TBODY>
  45.     <TR>
  46.       <TD class=thead style="PADDING-LEFT: 10px" noWrap width="70%">&nbsp;</TD>
  47.     </TR>
  48.     <TR class=row style="BACKGROUND-COLOR: #fafafa">
  49.       <TD height="175" align="center" style="PADDING-LEFT: 10px"><table width="470" border="0" align="center">
  50.         <tr>
  51.           <td>&nbsp;</td>
  52.           <td>&nbsp;</td>
  53.           <td>&nbsp;</td>
  54.         </tr>
  55.         <tr>
  56.           <td>&nbsp;</td>
  57.           <td align="center"><p>
  58.     <%
  59. String op = ParamUtil.get(request, "op");
  60. String rootpath = request.getContextPath();
  61. String srcpath = application.getRealPath("/") + "upfile/";
  62. String bakpath = cfg.getProperty("Application.bak_path");;
  63. if (op.equals("file")) {
  64. backup.copyDirectory(application.getRealPath("/")+bakpath+"/file",srcpath);//拷贝至file目录下
  65. out.print(StrUtil.p_center("拷贝文件成功!"));
  66. String zipfilepath = application.getRealPath("/")+bakpath+"/bak_file.zip";
  67. backup.generateZipFile(srcpath, zipfilepath);
  68. out.print(StrUtil.p_center("压缩ZIP文件成功!"));
  69. %>
  70. <a href="<%=rootpath+"/"+bakpath%>/bak_file.zip">下载ZIP文件</a>
  71. <%}
  72. if (op.equals("db")) {
  73. String dbfile = application.getRealPath("/") + bakpath + "/bak_db.bak";
  74. String dbname = "zjrj";
  75. if (backup.BackupDB(dbname, Global.defaultDB, dbfile))
  76. out.print(StrUtil.p_center("备份数据库成功!"));
  77. else
  78. out.print(StrUtil.p_center("备份数据库失败!"));
  79. %>
  80. <a href="<%=rootpath+"/"+bakpath%>/bak_db.bak">下载数据库备份文件</a>
  81. <%}%>
  82.                </p>
  83.               </td>
  84.           <td>&nbsp;</td>
  85.         </tr>
  86.         <tr>
  87.           <td height="37">&nbsp;</td>
  88.           <td align="center">&nbsp;</td>
  89.           <td>&nbsp;</td>
  90.         </tr>
  91.       </table></TD>
  92.     </TR>
  93.     <!-- Table Body End -->
  94.     <!-- Table Foot -->
  95.     <TR>
  96.       <TD class=tfoot align=right><DIV align=right> </DIV></TD>
  97.     </TR>
  98.     <!-- Table Foot -->
  99.   </TBODY>
  100. </TABLE>
  101. </body>
  102. <script language="javascript">
  103. <!--
  104. //-->
  105. </script>
  106. </html>