|
@@ -1,11 +1,6 @@
|
|
|
package com.key.dwsurvey.action.sysuser;
|
|
package com.key.dwsurvey.action.sysuser;
|
|
|
|
|
|
|
|
-import java.io.File;
|
|
|
|
|
-import java.io.FileInputStream;
|
|
|
|
|
-import java.io.FileOutputStream;
|
|
|
|
|
-import java.io.IOException;
|
|
|
|
|
-import java.io.InputStreamReader;
|
|
|
|
|
-import java.io.OutputStreamWriter;
|
|
|
|
|
|
|
+import java.io.*;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
import java.util.Properties;
|
|
import java.util.Properties;
|
|
@@ -42,19 +37,15 @@ import com.opensymphony.xwork2.ActionSupport;
|
|
|
@Result(name=CrudActionSupport.SUCCESS,location="/sy/system/sys-property!input.action",type=Struts2Utils.REDIRECT)
|
|
@Result(name=CrudActionSupport.SUCCESS,location="/sy/system/sys-property!input.action",type=Struts2Utils.REDIRECT)
|
|
|
})
|
|
})
|
|
|
public class SysPropertyAction extends ActionSupport{
|
|
public class SysPropertyAction extends ActionSupport{
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public String input() throws Exception {
|
|
public String input() throws Exception {
|
|
|
HttpServletRequest request = Struts2Utils.getRequest();
|
|
HttpServletRequest request = Struts2Utils.getRequest();
|
|
|
-
|
|
|
|
|
String fileName="site.properties";
|
|
String fileName="site.properties";
|
|
|
- ServletContext sc = Struts2Utils.getSession().getServletContext();
|
|
|
|
|
- String filePath = "/WEB-INF/classes/conf/site/".replace("/", File.separator);
|
|
|
|
|
- String fileRealPath = sc.getRealPath("/")+filePath+fileName;
|
|
|
|
|
- File file=new File(fileRealPath);
|
|
|
|
|
- InputStreamReader fr = new InputStreamReader(new FileInputStream(file),"UTF-8");
|
|
|
|
|
-
|
|
|
|
|
- Properties p = new Properties();
|
|
|
|
|
|
|
+ ClassLoader cl = this.getClass().getClassLoader();
|
|
|
|
|
+ InputStream input = cl.getResourceAsStream("conf/site/".replace("/", File.separator)+fileName);
|
|
|
|
|
+ InputStreamReader fr=new InputStreamReader(input,"UTF-8");
|
|
|
|
|
+ Properties p = new Properties();
|
|
|
try {
|
|
try {
|
|
|
p.load(fr);
|
|
p.load(fr);
|
|
|
fr.close();
|
|
fr.close();
|
|
@@ -77,7 +68,7 @@ public class SysPropertyAction extends ActionSupport{
|
|
|
}
|
|
}
|
|
|
return INPUT;
|
|
return INPUT;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
public String save() throws Exception {
|
|
public String save() throws Exception {
|
|
|
//管理员邮箱
|
|
//管理员邮箱
|
|
|
String adminEmail = Struts2Utils.getParameter("adminEmail");
|
|
String adminEmail = Struts2Utils.getParameter("adminEmail");
|
|
@@ -105,7 +96,7 @@ public class SysPropertyAction extends ActionSupport{
|
|
|
String headerData="<a href=\"${ctx }\"><img alt=\"\" src=\"${ctx }/images/logo/LOGO.png\" align=\"middle\" height=\"46\" ><span class=\"titleTempSpan\">OSS</span></a> ";
|
|
String headerData="<a href=\"${ctx }\"><img alt=\"\" src=\"${ctx }/images/logo/LOGO.png\" align=\"middle\" height=\"46\" ><span class=\"titleTempSpan\">OSS</span></a> ";
|
|
|
String headerDataPath="/WEB-INF/page/layouts/logo-img.jsp".replace("/", File.separator);
|
|
String headerDataPath="/WEB-INF/page/layouts/logo-img.jsp".replace("/", File.separator);
|
|
|
writeData(headerDataPath, headerData);
|
|
writeData(headerDataPath, headerData);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if(adminTelephone!=null && adminEmail!=null){
|
|
if(adminTelephone!=null && adminEmail!=null){
|
|
|
//写footer文件
|
|
//写footer文件
|
|
|
String footer1="<div class=\"dw_footcopy\" style=\"font-size: 16px;color: gray;\"><p style=\"margin-bottom: 6px;\">"
|
|
String footer1="<div class=\"dw_footcopy\" style=\"font-size: 16px;color: gray;\"><p style=\"margin-bottom: 6px;\">"
|
|
@@ -113,22 +104,22 @@ public class SysPropertyAction extends ActionSupport{
|
|
|
+"<a href=\"/\" style=\"color: gray;font-size: 16px;\">"+icpCode+"</a></p></div>";
|
|
+"<a href=\"/\" style=\"color: gray;font-size: 16px;\">"+icpCode+"</a></p></div>";
|
|
|
String footerPath="/WEB-INF/page/layouts/footer-1.jsp".replace("/", File.separator);
|
|
String footerPath="/WEB-INF/page/layouts/footer-1.jsp".replace("/", File.separator);
|
|
|
writeData(footerPath, footer1);
|
|
writeData(footerPath, footer1);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
String adminInfo="<div style=\"color: gray;\"><h3 style=\"line-height: 40px;\">联系信息</h3><p style=\"line-height: 40px;\">邮箱:"+adminEmail+"</p><p style=\"line-height: 40px;\">电话:"+adminTelephone+"</p><p style=\"line-height: 40px;\">"+icpCode+"</p></div>";
|
|
String adminInfo="<div style=\"color: gray;\"><h3 style=\"line-height: 40px;\">联系信息</h3><p style=\"line-height: 40px;\">邮箱:"+adminEmail+"</p><p style=\"line-height: 40px;\">电话:"+adminTelephone+"</p><p style=\"line-height: 40px;\">"+icpCode+"</p></div>";
|
|
|
String adminInfoPath="/WEB-INF/page/layouts/admin-info.jsp".replace("/", File.separator);
|
|
String adminInfoPath="/WEB-INF/page/layouts/admin-info.jsp".replace("/", File.separator);
|
|
|
writeData(adminInfoPath, adminInfo);
|
|
writeData(adminInfoPath, adminInfo);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if(loginBgImg!=null){
|
|
if(loginBgImg!=null){
|
|
|
String loginbgimg="<div class=\"m-logbg\"><img src=\"${ctx }"+loginBgImg+"\" style=\"margin-top:0px; margin-left: 0px; opacity: 1;\" width=\"100%\" ></div>";
|
|
String loginbgimg="<div class=\"m-logbg\"><img src=\"${ctx }"+loginBgImg+"\" style=\"margin-top:0px; margin-left: 0px; opacity: 1;\" width=\"100%\" ></div>";
|
|
|
String loginbgimgPath="/WEB-INF/page/layouts/loginbgimg.jsp".replace("/", File.separator);
|
|
String loginbgimgPath="/WEB-INF/page/layouts/loginbgimg.jsp".replace("/", File.separator);
|
|
|
writeData(loginbgimgPath, loginbgimg);
|
|
writeData(loginbgimgPath, loginbgimg);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
return SUCCESS;
|
|
return SUCCESS;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
private void writeData(String filePath,String data) {
|
|
private void writeData(String filePath,String data) {
|
|
|
OutputStreamWriter fw = null;
|
|
OutputStreamWriter fw = null;
|
|
|
try {
|
|
try {
|