Delete BatchLoadLogDownload.jsp

parent 74f8102e
<%@page import="javax.servlet.*, javax.servlet.http.*, java.io.*, ibase.utility.CommonConstants, org.apache.commons.lang.StringEscapeUtils"%>
<%
String fileName = request.getParameter("FileName");
String sep = File.separator;
File file = new File(CommonConstants.JBOSSHOME + sep + "upload_failed" + sep + fileName);
String filePath = file.getAbsolutePath();
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>VisionEDI Log</title>
<style>
input[type="button"] {
margin: 0px 0px 0px 1100px;
font-size: 15px;
text-align: bottom;
display: inline-block;
border-radius: 4px;
}
h2 {
font-size: 20px;
text-align: bottom;
display: inline-block;
margin: 0px 0px 0px 0px;
}
</style>
</head>
<body style="font-family: calibri; margin: 0; padding: 0; overflow: hidden;">
<div style="display: flex; align-items: center; height: 50px; padding: 0 16px;">
<form style="margin: 0; padding: 0; display: flex; width: 100%; align-items: center; position: relative;">
<div style="font-size: 1.5em; font-weight: 600; text-align: left; min-height: 50px; display: flex; align-items: center; width: calc(100% - 100px); white-space: nowrap; text-overflow: ellipsis; overflow: hidden;">
File Name : <%= fileName %>
</div>
<input type="button" value="Return" onclick="history.back()" size="40" style="border-style: none; margin: 0; font-size: 12px; border-radius: 4px; box-shadow: 1px 1px 5px 2px rgba(0,0,0,.2); height: 30px; padding: 0 12px; background-color: #4286f5; color: #fff; letter-spacing: 1px; font-weight: 600; text-transform: uppercase; position: absolute; right: 0;">
</form>
</div>
<div style="padding: 16px; height: calc(100% - 98px); overflow: auto; box-shadow: 0px 0px 1px 1px rgba(0,0,0,.2); margin: 0 16px 16px 16px; border-radius: 3px;">
<% if (!filePath.endsWith(".log")) {
file = new File(CommonConstants.JBOSSHOME + sep + "upload_failed" + sep + fileName);
}
if (file.exists()) {
BufferedReader br = new BufferedReader(new FileReader(file));
String fileContents = "";
while ((fileContents = br.readLine()) != null) {
out.println(StringEscapeUtils.escapeXml(fileContents.toString()) + "<br>");
}
%>
</div>
<!-- Add the styled download button outside the div -->
<button style="margin: 16px; background-color: #4286f5; color: #fff; border: none; padding: 10px; border-radius: 4px; cursor: pointer;" onclick="downloadLogFile('<%= StringEscapeUtils.escapeJavaScript(fileContents) %>')">Download Log</button>
<% } else { %>
<%= fileName + " file not found" %>
<% } %>
<script>
function downloadLogFile(logContent) {
var blob = new Blob([logContent], { type: 'text/plain' });
var url = window.URL.createObjectURL(blob);
var a = document.createElement('a');
a.href = url;
a.download = '<%= fileName %>';
document.body.appendChild(a);
a.click();
// Cleanup
window.URL.revokeObjectURL(url);
document.body.removeChild(a);
}
</script>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment