1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html; charset=UTF-8" language="java"%>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%@ page import="com.csc.library.upload.UploadConfig" %>
<%@ page import="com.csc.library.utilities.UProfile,com.csc.library.utilities.*" %>
<%@ page import="com.csc.library.database.StaticProperties,com.csc.library.database.SystemCode" %>
<%@ page import="com.csc.library.session.InitialEnvironment" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Load Config(<%=System.getProperty("webapp.name")%>)</title>
<style type="text/css"><!--
label {
display: block;
}
--></style>
</head>
<body>
<style>
body{
background:#55C5EB;
}
</style>
<script>
function get_random_color() {
var letters = '0123456789ABCDEF'.split('');
var color = '#';
for (var i = 0; i < 6; i++ ) {
color += letters[Math.round(Math.random() * 15)];
}
return color;
}
document.body.style.backgroundColor=get_random_color();
</script>
<form id="cscform" name="cscform" method="post" action="?">
<div style="width:200px; border:solid 2px #666666; font-size:15px; margin:auto;">
<table width="200" cellpadding="1" cellspacing="0" style="background:#fdfdfd;">
<tr>
<td colspan="2" align="center" style="font-weight:bold; border-bottom:#333 solid 1px;">LoadConfig</td>
</tr>
<tr>
<td align="center" style="border-bottom:#333 solid 1px;"><input type="checkbox" name="protable" id="protable" value="protable" /></td>
<td style="border-bottom:#333 solid 1px;">Load Protable XML</td>
</tr>
<tr>
<td align="center" style="border-bottom:#333 solid 1px;"><input type="checkbox" name="systemcode" id="systemcode" value="systemcode" /></td>
<td style="border-bottom:#333 solid 1px;">Load System Code</td>
</tr>
<tr>
<td align="center" style="border-bottom:#333 solid 1px;"><input type="checkbox" name="uploadconfig" id="uploadconfig" value="uploadconfig" /></td>
<td style="border-bottom:#333 solid 1px;">Load Upload Config</td>
</tr>
<tr>
<td align="center" style="border-bottom:#333 solid 1px;"><input type="checkbox" name="loadmenu" id="loadmenu" value="loadmenu" /></td>
<td style="border-bottom:#333 solid 1px;">Load Menu XML</td>
</tr>
<tr>
<td align="center" style="border-bottom:#333 solid 1px;"><input type="checkbox" name="clearscreen" id="clearscreen" value="clearscreen" /></td>
<td style="border-bottom:#333 solid 1px;">Clear Screen Hash</td>
</tr>
<tr>
<td align="center" style="border-bottom:#333 solid 1px;"><input type="checkbox" name="cleartransferxml" id="cleartransferxml" value="cleartransferxml" /></td>
<td style="border-bottom:#333 solid 1px;">Clear Transfer Xml</td>
</tr>
<tr>
<td align="center" style="border-bottom:#333 solid 1px;"><input type="checkbox" name="select_all" id="select_all" value="select_all" onclick="chkAll();"/></td>
<td style="border-bottom:#333 solid 1px;"><strong>Select All</strong></td>
</tr>
<tr>
<td colspan="2" align="center" height="50">
<style>
input:hover{
font-size:24px;
font-weight:bold;
color:#F00 #0F0
}
</style>
<input name="process" type="submit" value="Process" style="background-color:#FFF; cursor:pointer; border:#000000 solid 1px;"/>
</td>
</tr>
</table>
</div>
<br />
<div style="width:700px; margin:auto; background-color:#FFF; ">
<%
if(request.getParameter("process") != null) {
boolean clearscreen = false;
if(request.getParameter("protable") != null) {
// load protable
clearscreen = true;
String lflag = request.getParameter("loadprocessdata");
if (lflag == null || lflag.equals(""))
lflag = "false";
System.out.println("::::: Start load protable waiting......");
ServletContext context = pageContext.getServletContext();
String nodeName=System.getProperty("webapp.name");
StaticProperties.invBase._configFile=context.getInitParameter("xmlconfig");
if(nodeName!=null && nodeName.trim().length()>0){
StaticProperties.invBase._configFile=nodeName+"-"+context.getInitParameter("xmlconfig");
}
StaticProperties.invBase._configPath=context.getRealPath("/WEB-INF/classes").replace("\\.\\", "\\")+"//";
StaticProperties.invBase._configPath=context.getRealPath("/WEB-INF/classes").replace("\\.\\", "\\")+"//";
StaticProperties.invBase.isconfigDoc=true;
LoadStaticProperties l = new LoadStaticProperties();
l.setIsSetConnection(false);
if (lflag.equalsIgnoreCase("false")) {
l.process();
} else {
l.setProcessData();
}
StaticProperties.isload = true;
System.out.println("::::: Load protable commited......");
out.println("<b> Load protable : </b> <span style=\"color:#0F0\"><b>Commited.</b></span><br>");
//------------------------------------------------------------------------------------------
}
if(request.getParameter("systemcode") != null) {
// load systemcode
clearscreen = true;
String resource = new InitialEnvironment("GLOBAL").getValue("config-dir");
new SystemCode().initValue(resource + "SYSTEMCODE.xml");
out.println("<b>Load System Code : </b> <span style=\"color:#0F0\"><b>Complete.</b></span><br>");
}
if(request.getParameter("cleartransferxml") != null) {
clearscreen = true;
new ReadXml().loadWorkflowXmlOnMemory();
out.println("<b>Clear Transfer Xml : </b> <span style=\"color:#0F0\"><b>Complete.</b></span><br>");
}
if(request.getParameter("uploadconfig") != null) {
// load uploadconfig
String cfg = application.getInitParameter("upload-config");
String uploadConfigPath = application.getRealPath( cfg ).replace('\\', '/').replace('/', File.separatorChar);
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
try {
UploadConfig upload = new UploadConfig( uploadConfigPath );
upload.load();
//upload.getProperties().list(new PrintWriter(out));
out.println("<b>Load Upload Config : </b> <span style=\"color:#0F0\"><b>Complete.</b></span><br />");
upload.getProperties().list(pw);
out.println("<!--");
out.println (sw.toString().replaceAll("\\n", "<br />"));
out.println("-->");
} catch (Exception e) {
out.println("<br/><br /><span style=\"color:#F00\"><b>Could not load upload-config :</b> </span>" +uploadConfigPath +"<br />");
out.println (sw.toString().replaceAll("\\n", "<br />"));
}
sw.close();
pw.close();
}
if(request.getParameter("loadmenu") != null ) {
// clear screen
com.csc.library.menu.StaticMenu.MENUMAP.clear();
//StaticProperties.jspAuthen= new com.csc.library.security.JspFileAuthen();
StaticProperties.jspAuthen.loadProperties();
com.csc.library.menu.StaticMenu.MENU_CACHED.clear();
out.println("<b>Clear Screen Hash :</b> <span style=\"color:#0F0\"><b>Complete.</b></span><br>");
}
%>
<script>
var url = document.URL;
var urlA = url.split("/");
document.write("<a href=\"http://"+urlA[2]+"/hr\">Go!! Login Page!</a>");
</script>
<%
}
%></div><br />
</form>
<script>
function chkAll(){
with(document.cscform){
if(select_all.checked==true){
protable.checked = true;
systemcode.checked = true;
uploadconfig.checked = true;
loadmenu.checked = true;
clearscreen.checked = true;
cleartransferxml.checked = true;
}else{
protable.checked = false;
systemcode.checked = false;
uploadconfig.checked = false;
loadmenu.checked = false;
clearscreen.checked = false;
cleartransferxml.checked = false;
}
}
}
</script>
</body>
</html>