folderlist.jsp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <%@ page language="java" pageEncoding="UTF-8" %>
  2. <%@ page import="java.io.File" %>
  3. <%@ page import="kr.comsquare.soonsu.define.AdminMessage" %>
  4. <% request.setCharacterEncoding("UTF-8"); %>
  5. <html>
  6. <head>
  7. <title>TrustForm Soonsu</title>
  8. </head>
  9. <%
  10. String strLanguage = AdminMessage.LANGUAGE;
  11. String strFontFamily = "Dotum, arial";
  12. if ("jp".equals(strLanguage))
  13. {
  14. strFontFamily = "MS Gothic, arial";
  15. }
  16. else if ("us".equals(strLanguage))
  17. {
  18. strFontFamily = "arial";
  19. }
  20. AdminMessage objAdminMessage = new AdminMessage();
  21. String strLogin = (String)session.getAttribute("login");
  22. if (strLogin == null || !strLogin.equals("Success"))
  23. {
  24. %>
  25. <script type="text/javascript">
  26. alert("<%=objAdminMessage.getMessage("main01")%>");
  27. if (window.parent.document.getElementById("modalBackground"))
  28. {
  29. window.parent.document.getElementById("tableFolderList").style.visibility = "hidden";
  30. window.parent.document.getElementById("modalBackground").style.visibility = "hidden";
  31. window.parent.document.getElementById("frameFolderList").src = "";
  32. }
  33. else
  34. {
  35. location.href = "index.jsp";
  36. }
  37. </script>
  38. <%
  39. return;
  40. }
  41. String strPathType = request.getParameter("inputFolderPathType");
  42. String strPathNum = request.getParameter("inputFolderPathNum");
  43. String strCurrentPath = request.getParameter("inputFolderValue") == null ? "" : request.getParameter("inputFolderValue");
  44. String strTargetPath = request.getParameter("inputTargetValue") == null ? "" : request.getParameter("inputTargetValue");
  45. String strFileSep = strPathType.equals("inputXrwPath") ? File.separator : "/";
  46. if (strTargetPath.equals(".."))
  47. {
  48. if (strCurrentPath.substring(strCurrentPath.length()-1).equals(strFileSep)) strCurrentPath = strCurrentPath.substring(0, strCurrentPath.length()-1);
  49. if (strCurrentPath.lastIndexOf(strFileSep) < 0)
  50. {
  51. strCurrentPath = "";
  52. }
  53. else
  54. {
  55. strCurrentPath = strCurrentPath.substring(0, strCurrentPath.lastIndexOf(strFileSep)) + strFileSep;
  56. }
  57. }
  58. else
  59. {
  60. if (strCurrentPath.equals(""))
  61. {
  62. if (strPathType.equals("inputHtmlPath")) strCurrentPath = "/";
  63. }
  64. else if (!strCurrentPath.substring(strCurrentPath.length()-1).equals(strFileSep))
  65. {
  66. strCurrentPath += strFileSep;
  67. }
  68. if (!strTargetPath.equals(""))
  69. {
  70. if (strTargetPath.substring(strTargetPath.length()-1).equals(strFileSep)) strTargetPath = strTargetPath.substring(0, strTargetPath.length()-1);
  71. strCurrentPath = strCurrentPath + strTargetPath + strFileSep;
  72. }
  73. }
  74. String strContextPath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath();
  75. String strCurrentRealPath = strPathType.equals("inputXrwPath") ? strCurrentPath : application.getRealPath("") + strCurrentPath;
  76. strCurrentRealPath = strCurrentRealPath.replace("/", File.separator);
  77. %>
  78. <script language="javascript">
  79. function submitByLink (strLinkValue)
  80. {
  81. document.getElementById("inputTargetValue").value = strLinkValue;
  82. document.formFolderList.submit();
  83. }
  84. function submitByType ()
  85. {
  86. document.getElementById("inputFolderValue").value = document.getElementById("inputCurrentPath").value;
  87. document.getElementById("inputTargetValue").value = "";
  88. document.formFolderList.submit();
  89. }
  90. function returnFolderPath ()
  91. {
  92. if (document.getElementById("inputFolderValue").value != document.getElementById("inputCurrentPath").value)
  93. {
  94. if ("<%=strPathType%>" == "inputXrwPath")
  95. {
  96. submitByType();
  97. }
  98. else if ("<%=strPathType%>" == "inputHtmlPath")
  99. {
  100. window.parent.document.getElementById("<%=strPathType%><%=strPathNum%>").value = document.getElementById("inputCurrentPath").value;
  101. closeFolderList();
  102. }
  103. }
  104. else
  105. {
  106. window.parent.document.getElementById("<%=strPathType%><%=strPathNum%>").value = document.getElementById("inputCurrentPath").value;
  107. closeFolderList();
  108. }
  109. }
  110. function closeFolderList ()
  111. {
  112. window.parent.document.getElementById("tableFolderList").style.visibility = "hidden";
  113. window.parent.document.getElementById("modalBackground").style.visibility = "hidden";
  114. window.parent.document.getElementById("frameFolderList").src = "";
  115. }
  116. <% if (strPathType.equals("inputHtmlPath")) { %>
  117. function adjustHtmlPath ()
  118. {
  119. var nSpanWidth = document.getElementById("spanCurrentPath").offsetWidth;
  120. var inputHtmlPath = document.getElementById("inputCurrentPath");
  121. inputHtmlPath.style.left = (nSpanWidth+4)+"px";
  122. inputHtmlPath.style.width = (345-nSpanWidth)+"px";
  123. }
  124. <% } %>
  125. </script>
  126. <body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" <% if (strPathType.equals("inputHtmlPath")) { %>onload="adjustHtmlPath();"<% } %>>
  127. <table cellpadding="0" cellspacing="0" align="center">
  128. <tr>
  129. <td width="400px" height="50px" align="center">
  130. <div style="position:relative; width:100%; height:100%; ">
  131. <div style="position:absolute; left:10px; top:11px; width:380px; height:28px; border:1px solid #CDCDCD; ">
  132. <%
  133. if (strPathType.equals("inputXrwPath"))
  134. {
  135. %>
  136. <input id="inputCurrentPath" type="text" style="position:absolute; left:4px; top:6px; width:372px; height:16px; font-family:<%=strFontFamily%>; font-size:9pt; border-width:0px; " value="<%=strCurrentPath%>" onkeypress="javascript:if (event.keyCode==13) {submitByType();}" title="<%=objAdminMessage.getTip("main07")%>"/>
  137. <%
  138. }
  139. else if (strPathType.equals("inputHtmlPath"))
  140. {
  141. %>
  142. <span id="spanCurrentPath" style="position:absolute; left:4px; top:7px; font-family:<%=strFontFamily%>; font-size:9pt; color:#7F7F7F; cursor:default; "><%=strContextPath%></span>
  143. <input id="inputCurrentPath" type="text" style="position:absolute; top:6px; height:16px; font-family:<%=strFontFamily%>; font-size:9pt; border-width:0px; " value="<%=strCurrentPath%>" onkeypress="javascript:if (event.keyCode==13) {submitByType();}" title="<%=objAdminMessage.getTip("main07")%>"/>
  144. <%
  145. }
  146. %>
  147. </div>
  148. </div>
  149. </td>
  150. </tr>
  151. <tr>
  152. <td width="400px" height="154px" align="center">
  153. <div style="width:380px;height:152px;overflow-y:scroll;overflow-x:hidden;border-top:1px solid #D9D9D9;border-bottom:1px solid #D9D9D9;">
  154. <table cellpadding="0" cellspacing="0" align="center" style="font-family:<%=strFontFamily%>; font-size:9pt; color:#1A5B83; ">
  155. <%
  156. File objFolderList = new File(strCurrentRealPath);
  157. String strTrTemp = "<tr bgcolor=\"#F3F3F3\" onmouseover=\"this.bgColor='#FFF8CE'\" onmouseout=\"this.bgColor='#F3F3F3'\">";
  158. int nPrintRows = 0;
  159. if (strCurrentRealPath.equals(""))
  160. {
  161. File [] arFolderList = File.listRoots();
  162. for (int i = 0; i < arFolderList.length; i++)
  163. {
  164. strTrTemp = strTrTemp.equals("<tr onmouseover=\"this.bgColor='#FFF8CE'\" onmouseout=\"this.bgColor=''\">") ? "<tr bgcolor=\"#F3F3F3\" onmouseover=\"this.bgColor='#FFF8CE'\" onmouseout=\"this.bgColor='#F3F3F3'\">":"<tr onmouseover=\"this.bgColor='#FFF8CE'\" onmouseout=\"this.bgColor=''\">";
  165. out.println(strTrTemp);
  166. out.println(" <td width=\"363px\" height=\"30px\" onclick=\"submitByLink('"+arFolderList[i].getPath().replace("\\","\\\\")+"')\" style=\"cursor:default; padding-left:10px; \">");
  167. out.println(" <img src=\"image/folderlist03.png\" width=\"21px\" height=\"18px\" border=\"0\" align=\"absmiddle\"/>&nbsp;&nbsp;"+arFolderList[i].getPath());
  168. out.println(" </td>");
  169. out.println("</tr>");
  170. nPrintRows = nPrintRows + 1;
  171. }
  172. }
  173. else if (strPathType.equals("inputXrwPath") && (objFolderList == null || !objFolderList.exists()))
  174. {
  175. out.println("<tr onmouseover=\"this.bgColor='#FFF8CE'\" onmouseout=\"this.bgColor=''\">");
  176. out.println(" <td width=\"363px\" height=\"30px\" align=\"center\">");
  177. out.println(" </td>");
  178. out.println("</tr>");
  179. out.println("<tr bgcolor=\"#F3F3F3\" onmouseover=\"this.bgColor='#FFF8CE'\" onmouseout=\"this.bgColor='#F3F3F3'\">");
  180. out.println(" <td height=\"30px\" align=\"center\" style=\"cursor:default;\">");
  181. out.println(" "+objAdminMessage.getTip("folderlist01"));
  182. out.println(" </td>");
  183. out.println("</tr>");
  184. nPrintRows = nPrintRows + 2;
  185. }
  186. else
  187. {
  188. if (strPathType.equals("inputXrwPath") || (strPathType.equals("inputHtmlPath") && !strCurrentPath.equals("/")))
  189. {
  190. out.println("<tr onmouseover=\"this.bgColor='#FFF8CE'\" onmouseout=\"this.bgColor=''\">");
  191. out.println(" <td width=\"363px\" height=\"30px\" onclick=\"submitByLink('..')\" style=\"cursor:default;\">");
  192. out.println(" <img src=\"image/folderlist02.gif\" width=\"11px\" height=\"10px\" border=\"0\" align=\"absmiddle\"/>&nbsp;&nbsp;..");
  193. out.println(" </td>");
  194. out.println("</tr>");
  195. strTrTemp = "<tr onmouseover=\"this.bgColor='#FFF8CE'\" onmouseout=\"this.bgColor=''\">";
  196. nPrintRows = nPrintRows + 1;
  197. }
  198. if (objFolderList.exists())
  199. {
  200. File [] arFolderList = objFolderList.listFiles();
  201. for (int i = 0; i < arFolderList.length; i++)
  202. {
  203. if (arFolderList[i].isDirectory() && !arFolderList[i].isHidden())
  204. {
  205. strTrTemp = strTrTemp.equals("<tr onmouseover=\"this.bgColor='#FFF8CE'\" onmouseout=\"this.bgColor=''\">") ? "<tr bgcolor=\"#F3F3F3\" onmouseover=\"this.bgColor='#FFF8CE'\" onmouseout=\"this.bgColor='#F3F3F3'\">":"<tr onmouseover=\"this.bgColor='#FFF8CE'\" onmouseout=\"this.bgColor=''\">";
  206. out.println(strTrTemp);
  207. out.println(" <td width=\"363px\" height=\"30px\" onclick=\"submitByLink('"+arFolderList[i].getName()+"')\" style=\"cursor:default; padding-left:10px; \">");
  208. out.println(" <div style=\"overflow:hidden; width:350px; \"><nobr><img src=\"image/folderlist03.png\" width=\"21px\" height=\"18px\" border=\"0\" align=\"absmiddle\"/>&nbsp;&nbsp;"+arFolderList[i].getName()+"</nobr>");
  209. out.println(" </td>");
  210. out.println("</tr>");
  211. nPrintRows = nPrintRows + 1;
  212. }
  213. }
  214. }
  215. }
  216. if (nPrintRows < 5)
  217. {
  218. while (nPrintRows < 5)
  219. {
  220. strTrTemp = strTrTemp.equals("<tr onmouseover=\"this.bgColor='#FFF8CE'\" onmouseout=\"this.bgColor=''\">") ? "<tr bgcolor=\"#F3F3F3\" onmouseover=\"this.bgColor='#FFF8CE'\" onmouseout=\"this.bgColor='#F3F3F3'\">":"<tr onmouseover=\"this.bgColor='#FFF8CE'\" onmouseout=\"this.bgColor=''\">";
  221. out.println(strTrTemp);
  222. out.println(" <td height=\"30px\"></td>");
  223. out.println("</tr>");
  224. nPrintRows = nPrintRows + 1;
  225. }
  226. }
  227. %>
  228. </table>
  229. </div>
  230. </td>
  231. </tr>
  232. <tr>
  233. <td width="400px" height="40px" align="center" valign="bottom">
  234. <%
  235. if (strPathType.equals("inputHtmlPath") || (strPathType.equals("inputXrwPath") && objFolderList.exists()))
  236. {
  237. out.println("<img src=\"image/modalButtOk_"+strLanguage+".gif\" style=\"background-color:#CCCCCC; cursor:hand; \" onclick=\"returnFolderPath();\" width=\"56px\" height=\"25px\" border=\"0\" title=\""+objAdminMessage.getTip("modal01")+"\" alt=\""+objAdminMessage.getTip("modal01")+"\"/>&nbsp;");
  238. }
  239. %>
  240. <img src="image/modalButtClose_<%=strLanguage%>.gif" style="background-color:#CCCCCC; cursor:hand; " onclick="closeFolderList();" width="56px" height="25px" border="0" title="<%=objAdminMessage.getTip("modal03")%>" alt="<%=objAdminMessage.getTip("modal03")%>"/>
  241. </td>
  242. </tr>
  243. </table>
  244. <form id="formFolderList" name="formFolderList" method="post" action="folderlist.jsp">
  245. <input id="inputFolderPathType" name="inputFolderPathType" type="hidden" value="<%=strPathType%>"/>
  246. <input id="inputFolderPathNum" name="inputFolderPathNum" type="hidden" value="<%=strPathNum%>"/>
  247. <input id="inputFolderValue" name="inputFolderValue" type="hidden" value="<%=strCurrentPath%>"/>
  248. <input id="inputTargetValue" name="inputTargetValue" type="hidden"/>
  249. </form>
  250. </body>
  251. </html>