391 lines
12 KiB
Plaintext
391 lines
12 KiB
Plaintext
<%@ page import="th.co.muangthai.endrprint.util.VSMUtil" %>
|
|
<%@ page import="th.co.muangthai.endrprint.model.hibernate.HibernateUtil" %>
|
|
<%@ page import="java.io.*" %>
|
|
<%--<%@ page import="th.co.muangthai.model.service.wf.WorkflowWS" %>--%>
|
|
<%@ page import="java.util.*" %>
|
|
<%@ page import="th.co.muangthai.endrprint.util.DateUtil" %>
|
|
<%@ page import="th.co.muangthai.endrprint.UploadServlet" %>
|
|
<%--
|
|
Created by IntelliJ IDEA.
|
|
User: ZIZU
|
|
Date: 9/18/12
|
|
Time: 12:24 PM
|
|
To change this template use File | Settings | File Templates.
|
|
--%>
|
|
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
|
<html>
|
|
<%--<META HTTP-EQUIV="Refresh" CONTENT="5">--%>
|
|
<head>
|
|
<title></title>
|
|
|
|
<script>
|
|
function go() {
|
|
setTimeout(window.location = '#bottom', 20000);
|
|
}
|
|
</script>
|
|
<link href="styles/jquery-ui-1.8.20.custom.css" rel="stylesheet" type="text/css"/>
|
|
<link href="styles/screen.css?v=${dv}" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="js/jquery-1.7.2.js"></script>
|
|
<script type="text/javascript">
|
|
|
|
jQuery(document).ready(function () {
|
|
|
|
var username = getCookie("passChk");
|
|
if(username == "" || username == "false" ){
|
|
$('#dis').hide();
|
|
$('#error').show();
|
|
}else{
|
|
$('#error').hide();
|
|
}
|
|
|
|
$("#addCheckBoxValues").click(
|
|
function () {
|
|
alert('ยินดีต้อนรับ เข้าสู่ระบบ Upload file By LOF4POS');
|
|
$('#dis').show();
|
|
$('#error').hide();
|
|
$('#chkFlag').val(true);
|
|
setCookie('passChk',true,1);
|
|
|
|
}
|
|
);
|
|
|
|
$("#addCheckBoxValuesClear").click(
|
|
function () {
|
|
setCookie('passChk',false,1);
|
|
$('#dis').hide();
|
|
$('#error').show();
|
|
}
|
|
);
|
|
|
|
});
|
|
|
|
function setCookie(cname, cvalue, exdays) {
|
|
var d = new Date();
|
|
d.setTime(d.getTime() + (exdays*24*60*60*1000));
|
|
var expires = "expires="+d.toUTCString();
|
|
document.cookie = cname + "=" + cvalue + "; " + expires;
|
|
}
|
|
|
|
function getCookie(cname) {
|
|
var name = cname + "=";
|
|
var ca = document.cookie.split(';');
|
|
for(var i=0; i<ca.length; i++) {
|
|
var c = ca[i];
|
|
while (c.charAt(0)==' ') c = c.substring(1);
|
|
if (c.indexOf(name) == 0) return c.substring(name.length,c.length);
|
|
}
|
|
return "";
|
|
}
|
|
|
|
</script>
|
|
</head>
|
|
<%--<body onload='go()'>--%>
|
|
<body style="padding: 10px">
|
|
|
|
<div id="error">
|
|
|
|
<FONT FACE=Helvetica><BR CLEAR=all>
|
|
<TABLE border=0 cellspacing=5>
|
|
<TR>
|
|
<TD><BR CLEAR=all>
|
|
<FONT FACE="Helvetica" COLOR="black" SIZE="3"><H2>Error 404--Not Found</H2>
|
|
</FONT></TD>
|
|
</TR>
|
|
</TABLE>
|
|
<TABLE style="border:0;width:100%;cellpadding:10;color: black">
|
|
|
|
<TR>
|
|
<TD VALIGN=top WIDTH=100% BGCOLOR=white>
|
|
<FONT FACE="Courier New"><FONT FACE="Helvetica" SIZE="3"><H3>
|
|
From RFC 2068 <i>Hypertext Transfer Protocol -- HTTP/1.1</i>:</H3>
|
|
</FONT><FONT FACE="Helvetica" SIZE="3"><H4>10.4.5 404 Not Found</H4></FONT>
|
|
|
|
<FONT FACE="Courier New"><P>The server has not found anything matching the Request-URI. No
|
|
indication is given of whether the condition is temporary or permanent.</p>
|
|
|
|
<p>If the server does not wish to make this information available to the client, the <span id="addCheckBoxValues">status code</span> 403
|
|
(Forbidden) can be used instead. The 410 (Gone) status code SHOULD be used if the server knows,
|
|
through some internally configurable mechanism, that an old resource is permanently unavailable
|
|
and has no forwarding address.</P>
|
|
</FONT>
|
|
</FONT>
|
|
</TD>
|
|
</TR>
|
|
</TABLE>
|
|
</FONT>
|
|
</div>
|
|
|
|
<br/>
|
|
|
|
<div id="dis">
|
|
<form method="get" action="UploadServlet">
|
|
<span id="addCheckBoxValuesClear">1. Enter Path to upload :</span>
|
|
<input type="text" name="pathTo" id="pathTo"/><br/><br/>
|
|
<input type="submit" value="Set"/>
|
|
</form>
|
|
|
|
<form method="post" name="form" action="UploadServlet" enctype="multipart/form-data">
|
|
2. Select file to upload :
|
|
<input type="file" name="dataFile" id="fileChooser"/><br/>
|
|
Current Path : <span style="color: red;font-weight: bold"><%=UploadServlet.currentUploadPath%><br/><br/>
|
|
<input type="submit" value="Upload"/>
|
|
</form>
|
|
<hr/>
|
|
|
|
|
|
<br/>
|
|
|
|
<%
|
|
|
|
|
|
String pPath = request.getParameter("path");
|
|
|
|
if (request.getParameter("file") == null) {
|
|
String logFile = "/LOGGING2/LOF4POS/Web/";
|
|
if (VSMUtil.isNotEmpty(pPath)) {
|
|
logFile = pPath;
|
|
}
|
|
File dir = new File(logFile);
|
|
if (dir.isDirectory()) {
|
|
File[] fileArray = dir.listFiles();
|
|
List<File> fileList = new ArrayList<File>();
|
|
if (dir == null) {
|
|
return;
|
|
}
|
|
for (File file : dir.listFiles()) {
|
|
fileList.add(file);
|
|
}
|
|
|
|
Collections.sort(fileList, new Comparator<File>() {
|
|
|
|
public int compare(File o1, File o2) {
|
|
|
|
return o1.lastModified() == o2.lastModified() ? 0 : (o1.lastModified() < o2.lastModified() ? -1 : 1);
|
|
|
|
|
|
// if (o1.isDirectory() && o2.isDirectory())
|
|
// {
|
|
// //return o1.lastModified() == o2.lastModified() ? 0 : (o1.lastModified() < o2.lastModified() ? -1 : 1 ) ;
|
|
// return 0;
|
|
// }
|
|
|
|
// if (o1.isDirectory() && o2.isFile())
|
|
// {
|
|
// return -1;
|
|
// }
|
|
// else if (o1.isFile() && o2.isDirectory())
|
|
// {
|
|
// return 1;
|
|
// }
|
|
// else
|
|
// {
|
|
// return 0;
|
|
// }
|
|
|
|
// else if (o1.isFile() && o2.isDirectory())
|
|
// {
|
|
// return 1;
|
|
// }
|
|
// else
|
|
// {
|
|
// return 1;
|
|
// //return o1.lastModified() == o2.lastModified() ? 0 : (o1.lastModified() < o2.lastModified() ? 1 : -1 ) ;
|
|
// }
|
|
|
|
|
|
}
|
|
}
|
|
);
|
|
|
|
|
|
%>
|
|
|
|
|
|
<table width="700" border="0" cellpadding="0" cellspacing="0" class="tableresult">
|
|
<tr>
|
|
<td>Server :</td>
|
|
<td style="color: teal;font-weight: bold;"><%= request.getServerName()%>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Production :</td>
|
|
<td style="color: red" ng-style=""><%= VSMUtil.isProductionMode()%>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Database :</td>
|
|
<td style="font-weight: bold;"><%= VSMUtil.isNotEmpty(HibernateUtil.getHibernateProperties().get("connection.datasource")) ? (String) HibernateUtil.getHibernateProperties().get("connection.datasource") : HibernateUtil.getHibernateProperties().get("connection.url")%>
|
|
</td>
|
|
</tr>
|
|
<%--<tr>--%>
|
|
<%--<td>WORKFLOW_FLAG :</td>--%>
|
|
<%--<td><%= VSMUtil.WORKFLOW_FLAG%>--%>
|
|
<%--</td>--%>
|
|
<%--</tr>--%>
|
|
<%--<tr>--%>
|
|
<%--<td>CHECK_POLICY_ONLOAD_FLAG :</td>--%>
|
|
<%--<td><%= VSMUtil.CHECK_POLICY_ONLOAD_FLAG%>--%>
|
|
<%--</td>--%>
|
|
<%--</tr>--%>
|
|
<tr>
|
|
<td>AUTHENTICATION_AD :</td>
|
|
<td><%= VSMUtil.AUTHENTICATION_AD%>
|
|
</td>
|
|
</tr>
|
|
<%--<tr>--%>
|
|
<%--<td>Work Flow Service :</td>--%>
|
|
<%--<td><%= WorkflowWS.workFlowIP %></td>--%>
|
|
<%--</tr>--%>
|
|
<%--<tr>--%>
|
|
<%--<td>Deployment Version :</td>--%>
|
|
<%--<td></td>--%>
|
|
<%--<%–<td><%= VSMUtil.DEPLOYMENT_VERSION %></td>–%>--%>
|
|
<%--</tr>--%>
|
|
<tr>
|
|
<td>Deployment Mode :</td>
|
|
<%--<td></td>--%>
|
|
<td><%= VSMUtil.DEPLOYMENT_MODE %>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>LOF4POS 3.1 :</td>
|
|
<td></td>
|
|
<%--<td><%= VSMUtil.SEND_WORKFLOW31_FLAG %></td>--%>
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
<br/>
|
|
|
|
|
|
<fieldset class="tabletitle">
|
|
|
|
Path : <span style="color: red;font-weight: bold"><%=new File(logFile).getPath()%></span>
|
|
|
|
<a href="lof4pospathfile.jsp?path=<%=new File(logFile).getParent()%>">Up</a>
|
|
|
|
</fieldset>
|
|
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tableresult">
|
|
|
|
<tr>
|
|
<th>ลำดับ</th>
|
|
<th>File/Folder Name</th>
|
|
<th>Last Updated</th>
|
|
<th>Size</th>
|
|
<th>
|
|
<a href="lof4pospathfile.jsp?path=<%=new File(logFile).getParent()%>">Up</a>
|
|
</th>
|
|
</tr>
|
|
<%
|
|
int count = 0;
|
|
for (File file : fileList) {
|
|
%>
|
|
|
|
<tr>
|
|
<td width="50" style="border-bottom: #fbc7f9 1px solid" align="center"><%=++count%>
|
|
</td>
|
|
|
|
<td width="500" style="border-bottom: #fbc7f9 1px solid">
|
|
<%
|
|
if (file.isDirectory()) {
|
|
%>
|
|
<a href="lof4pospathfile.jsp?path=<%=file.getPath()%>">[DIR]</a>
|
|
<%
|
|
}
|
|
%>
|
|
|
|
|
|
<%=file.getName()
|
|
%>
|
|
|
|
</td>
|
|
<td width="300" style="border-bottom: #fbc7f9 1px solid" align="center">
|
|
<%=
|
|
DateUtil.toFormatString(new Date(file.lastModified()), "dd/MM/yyyy HH:mm:ss")
|
|
%>
|
|
</td>
|
|
<td width="300" style="border-bottom: #fbc7f9 1px solid" align="right">
|
|
<%=file.length() < 1024 ? "< 1KB" :
|
|
file.length() < 1024 * 1024 ? Math.round(file.length() / 1024.0 * 100.0) / 100.0 + " KB" :
|
|
file.length() >= 1024 * 1024 ? Math.round(file.length() / (1024.0 * 1024.0) * 100.0) / 100.0 + " MB" : ""
|
|
%>
|
|
</td>
|
|
<td style="border-bottom: #fbc7f9 1px solid" align="center">
|
|
<%
|
|
if (file.isFile()) {
|
|
%>
|
|
<a href="lof4pospathfile.jsp?file=<%=file.getAbsolutePath()%>">
|
|
View
|
|
</a>
|
|
<%
|
|
}
|
|
%>
|
|
</td>
|
|
|
|
</tr>
|
|
<%
|
|
}
|
|
|
|
%>
|
|
</table>
|
|
|
|
<%
|
|
}
|
|
}
|
|
|
|
%>
|
|
|
|
|
|
<%
|
|
if (request.getParameter("file") != null) {
|
|
String logFile = null;
|
|
try {
|
|
|
|
if (VSMUtil.isNotEmpty(request.getParameter("file"))) {
|
|
logFile = request.getParameter("file");
|
|
}
|
|
|
|
if (VSMUtil.isNotEmpty(request.getParameter("fileName"))) {
|
|
logFile = "/LOGGING2/LOF4POS/Web/" + request.getParameter("fileName");
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
out.println("error1 : " + e);
|
|
}
|
|
|
|
|
|
%>
|
|
path : <%=logFile%>
|
|
|
|
|
|
<br/><br/>
|
|
|
|
<pre>
|
|
|
|
<%
|
|
try {
|
|
BufferedReader input = new BufferedReader(new FileReader(logFile));
|
|
String line = "";
|
|
while ((line = input.readLine()) != null) {
|
|
out.println(line);
|
|
}
|
|
out.flush();
|
|
input.close();
|
|
|
|
} catch (Exception e) {
|
|
out.println("error2 : " + e);
|
|
}
|
|
|
|
%>
|
|
|
|
</pre>
|
|
<%
|
|
}
|
|
%>
|
|
</div>
|
|
</body>
|
|
<%--<div id="bottom"></div>--%>
|
|
<%--<a name='bottom'> </a>--%>
|
|
</html> |