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

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=utf-8"%>
  2. <%@ page import ="com.redmoon.forum.ui.*"%>
  3. <%@ page import ="com.redmoon.forum.*"%>
  4. <%@ page import = "cn.js.fan.web.*"%>
  5. <%@ page import = "cn.js.fan.util.*"%>
  6. <%@ page import = "java.io.*"%>
  7. <%@ include file="../inc/nocache.jsp" %>
  8. <%@ taglib uri="/WEB-INF/tlds/LabelTag.tld" prefix="lt" %>
  9. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  10. <html xmlns="http://www.w3.org/1999/xhtml">
  11. <head>
  12. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  13. <link href="default.css" rel="stylesheet" type="text/css">
  14. <jsp:useBean id="fchar" scope="page" class="cn.js.fan.util.StrUtil"/>
  15. <title><lt:Label res="res.label.forum.admin.forum_face" key="face_manage"/></title>
  16. <style type="text/css">
  17. <!--
  18. body {
  19. margin-left:0px;
  20. margin-top: 0px;
  21. }
  22. -->
  23. </style></head>
  24. <body>
  25. <jsp:useBean id="privilege" scope="page" class="com.redmoon.forum.Privilege"/>
  26. <%
  27. if (!privilege.isMasterLogin(request))
  28. {
  29. out.print(cn.js.fan.web.SkinUtil.makeErrMsg(request, cn.js.fan.web.SkinUtil.LoadString(request, "pvg_invalid")));
  30. return;
  31. }
  32. String path = Global.getRootPath() + "/forum/images/face/";
  33. FaceFileViewer fileViewer = new FaceFileViewer(application.getRealPath("/") + "/forum/images/face/");
  34. fileViewer.init(); 
  35. FaceMgr fm = new FaceMgr();
  36. String op = ParamUtil.get(request, "op");
  37. String directory = ParamUtil.get(request, "directory");
  38. String sourceName = ParamUtil.get(request, "sourceName");
  39. String filenamePath = directory + "/" + sourceName; 
  40. File file = new File(filenamePath);//源文件
  41. if (op.equals("modify")) {
  42.   String destName = ParamUtil.get(request, "destName");
  43.   File dest = new File(directory + "/" + destName); //目标文件
  44.       if(!destName.startsWith("face")) {
  45.     out.print(StrUtil.Alert_Back(SkinUtil.LoadString(request, "res.label.forum.admin.forum_face", "err_msg")));
  46.     return;   
  47.   }
  48.   int endIndex = destName.indexOf(".");
  49.   String substring = destName.substring(4,endIndex);
  50.       try {
  51.      Integer.parseInt(substring);
  52.   } catch(NumberFormatException e) {
  53.      out.print(StrUtil.Alert_Back(SkinUtil.LoadString(request, "res.label.forum.admin.forum_face", "err_msg")));
  54.  return;
  55.   }
  56.   if (destName.equals("")) {
  57.     out.print(StrUtil.Alert_Back(SkinUtil.LoadString(request, "res.label.forum.admin.forum_face", "err_msg")));
  58.     return;
  59.       }   
  60.   else {
  61.   if (file.renameTo(dest))
  62. out.println(fchar.Alert_Redirect(SkinUtil.LoadString(request, "info_op_success"), "forum_face.jsp"));
  63.   }
  64. }
  65.   
  66. if (op.equals("del")) {
  67.  if (file.delete())
  68. out.println(fchar.Alert_Redirect(SkinUtil.LoadString(request, "info_op_success"), "forum_face.jsp"));
  69. }
  70. %>
  71. <table width='100%' cellpadding='0' cellspacing='0' >
  72.   <tr>
  73.     <td class="head"><lt:Label res="res.label.forum.admin.forum_face" key="face_manage"/></td>
  74.   </tr>
  75. </table>
  76. <br>
  77.  <table width="92%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#999999">
  78.   <tr class="thead">
  79.     <td><lt:Label res="res.label.forum.admin.forum_face" key="pic"/></td>
  80.     <td><lt:Label res="res.label.forum.admin.forum_face" key="filename"/>      </td>
  81.     <td><lt:Label res="res.label.forum.admin.forum_face" key="rename"/></td>
  82.     <td><lt:Label res="res.label.forum.admin.forum_face" key="del"/> </td>
  83.   </tr>
  84. <%
  85. int k=0;
  86. while(fileViewer.nextFile()){
  87.   if (fileViewer.getFileName().lastIndexOf("gif") != -1 || fileViewer.getFileName().lastIndexOf("jpg") != -1 || fileViewer.getFileName().lastIndexOf("png") != -1 || fileViewer.getFileName().lastIndexOf("bmp") != -1 && fileViewer.getFileName().indexOf("face") != -1) {
  88. %>  
  89. <FORM METHOD=POST id="form<%=k%>" name="form<%=k%>" ACTION='?'>
  90.   <tr>
  91.     <td bgcolor="#FFF7FF">&nbsp;<a  href="<%="../images/face/" + fileViewer.getFileName()%>" target="_blank">&nbsp;<img src="<%="../images/face/" + fileViewer.getFileName()%>" width="32" height="32" border="0" /></a></td>
  92.     <td bgcolor="#FFF7FF">&nbsp;
  93.       <input type="input" value="<%=fileViewer.getFileName()%>" size="30" name="destName"/>      &nbsp;</td>
  94.     <td bgcolor="#FFF7FF">&nbsp;
  95. <%if(fileViewer.getFileName().equals("face.gif")) {
  96.    out.print("默认头像");
  97.  }else {%>     
  98.   <input type="submit" value="<lt:Label res="res.label.forum.admin.forum_face" key="modfiy"/>" /><input type="hidden" name="directory" value="<%=fileViewer.getDirectory()%>"/>
  99.       <input type="hidden" name="sourceName" value="<%=fileViewer.getFileName()%>"/>
  100.       <input type="hidden" name="op" value="modify"/>
  101. <%}%>   
  102.   </td>
  103.     <td bgcolor="#FFF7FF">&nbsp;
  104.       <input type="button" value="<lt:Label res="res.label.forum.admin.forum_face" key="del"/>" onClick="del(form<%=k%>)"/></td>
  105.   </tr>
  106. </form>
  107. <%
  108.   k++;
  109.  } //end if 
  110. }%>  
  111. </table>
  112. <table width="100%" height="52" align="center" class="p9">
  113.   <form name="form_upload" enctype="MULTIPART/FORM-DATA" action="forum_face_upload.jsp" method="post">
  114.     <tr> 
  115.       <td height="46"><div align="center"><lt:Label res="res.label.forum.admin.forum_face" key="upload_face"/> 
  116.           <input name=filename type=file id="filename"> 
  117.           <input type=submit value=<lt:Label key="ok"/>>&nbsp;&nbsp;&nbsp; <br>
  118.       </div></td>
  119.     </tr>
  120.   </form>
  121. </table>
  122. </body>
  123. <script>
  124.   function del(formObj) {
  125.    formObj.op.value = "del";
  126.     formObj.submit();
  127.   }
  128. </script>
  129. </html>