%@page import="com.hanweb.common.util.NumberUtil" %>
<%@page import="com.hanweb.common.util.SpringUtil" %>
<%@page import="com.hanweb.jcms.service.info.generalformat.GeneralFormatBLF" %>
<%@page import="com.hanweb.jcms.service.plugin.Jcms_ExtramodalBLF" %>
<%@ page import="com.hanweb.jcms.service.website.Jcms_WebinfomationBLF" %>
<%@ page import="com.hanweb.jcms.sys.service.SysInfo" %>
<%@ page import="com.hanweb.jcms.util.SafeUtil" %>
<%@ page import="com.hanweb.jcms.util.CacheUtil" %>
<%@ page import="com.hanweb.jcms.constant.Caches" %>
<%@ page import="com.hanweb.jcms.constant.CacheType" %>
<%@ page import="com.hanweb.common.util.StringUtil" %>
<%@ page import="com.hanweb.jcms.plugins.xxgk.service.Jcms_Xxgk_ConfigBLF" %>
<%@ page import="com.hanweb.jcms.plugins.xxgk.entity.Jcms_Xxgk_ConfigEntity" %>
<%@ page import="com.hanweb.common.util.mvc.Script" %>
<%@ page import="com.hanweb.jcms.util.AccessUtil" %>
<%@page contentType="text/html;charset=UTF-8" %>
<%@ include file="config.jsp" %>
<%
Script script = Script.getInstanceOnly();
if(!AccessUtil.checkAccess(request)){ //阻止跨站点请求伪造
out.print(script.addScript("location.href='../../';").getScript());
return;
}
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", -10);
//System.out.println("进来了...strAppID=" + strAppID + " strWebID=" + strWebID);
//当前网站ID
int nWebID = NumberUtil.getInt(strWebID);
if (!Jcms_ExtramodalBLF.isExist("xxgk", nWebID)) {
out.println("信息公开扩展功能不存在!");
return;
}
//页面传递的参数值
//节点编码
String area = SafeUtil.getSafeString(request.getParameter("area"));
int webid = NumberUtil.getInt(strWebID);
if (area == null || area.trim().equals("")) {
out.println("请输入正确的节点编码!");
return;
}
out.print(getArtCSS());
//从缓存获取指南内容
String cacheKey = nWebID + "_" + area;
String showContent = CacheUtil.getValue(Caches.XXGKGUIDECONTENT.name(), cacheKey, CacheType.str);
if (StringUtil.isNotEmpty(showContent)) {
out.print(showContent);
return;
}
//获取必要参数组织内外网路径
String strPath = application.getRealPath("").replaceAll("\\\\", "/") + "/jcms_files/jcms" + strAppID + "/web" + nWebID + "/site/";
String strModulePath = strPath + "module/xxgk/";
String strConfigPath = strModulePath + "config/config.xml"; //信息公开外挂配置文件
//内外网
int type = NumberUtil.getInt(xmlFile.getContent("webtype", strConfigPath), 1);
//应用名称
String appName = xmlFile.getContent("web_in_servername", strConfigPath);
SysInfo sys = new SysInfo();
sys.initSysPara(SpringUtil.getRequest());
String strDomain = Jcms_WebinfomationBLF.getInstance().getDomain(webid);
//获取指南元数据表名,如果未null说明不存在
String[][] tableNameARR = generalFormatBLF.getGuideTable();
if (tableNameARR == null || tableNameARR.length == 0) {
out.println("信息公开报表元数据不存在!");
return;
}
String tablename = tableNameARR[0][0];
//获取最新一条指南
String[][] infoData = generalFormatBLF.getRelativeInfo(webid, tablename, area, " ");
if (infoData == null || infoData.length == 0) {
out.println(getNoInfo("该机构未发布信息公开指南!"));
return;
}
String title = infoData[0][3];
String content = infoData[0][4];
String deploytime = infoData[0][5];
//如果是前台,处理正文URL
String sitePath = "/" + appName + "/jcms_files/jcms" + strAppID + "/web" + nWebID + "/site/";
if(type == 2){
content = content.replaceAll(sitePath, strDomain + "/");
content = content.replaceAll("/[^/]+?/ui/widgets/", strDomain + "/module/jslib/");
}
Jcms_Xxgk_ConfigEntity en1 = Jcms_Xxgk_ConfigBLF.getInstance().getEntityByWebId(webid);
if (en1.getB_wdrtshow() == 1) {
showContent = getArtHtml(getTitle(title), getPublicTime(deploytime), getArtContent(content));
} else {
showContent = getArtHtml(getTitle(title), getPublicTime(), getArtContent(content));
}
//生命周期:5天
if (StringUtil.isNotEmpty(showContent)) {
CacheUtil.setValue(Caches.XXGKGUIDECONTENT.name(), cacheKey, showContent, 60 * 60 * 24 * 5);
}
out.print(showContent);
%>
<%!
GeneralFormatBLF generalFormatBLF = SpringUtil.getBean(GeneralFormatBLF.class);
/**
* 获取无信息提示
* @return
*/
public String getNoInfo(String message) {
String str = "
" + message + "
";
return str;
}
/**
* 获取文章标题
* @return
*/
public String getTitle(String title) {
String str = "" + title + "
";
return str;
}
/**
* 获取文章正文
* @return
*/
public String getArtContent(String art) {
String str = "" + art + "
";
return str;
}
/**
* 指南是否显示发布时间
* b_wdrtshow 为 1 时显示
* @param deploytime
* @return
*/
public String getPublicTime(String deploytime) {
String str = "发布时间:" + deploytime + "
";
return str;
}
public String getPublicTime(){
String str = "";
return str;
}
/**
* 获取css
* @return
*/
public String getArtCSS() {
String str = "";
return str;
}
/**
* 获取文字正文HTML
* @param title
* @param PublicTime
* @param artContent
* @return
*/
public String getArtHtml(String title, String PublicTime, String artContent) {
String str = "\n" +
" \n" +
" \n" +
" \n" +
" \n" +
" \n" +
" 政府信息公开指南\n" +
" \n" +
" \n" +
" \n" +
" ";
str += title + PublicTime;
str += " " +
"
";
str += artContent;
str += "
\n" +
"\n";
return str;
}
/**
* 获取公共样式
* @return
*/
public String getStyleCSS(){
String str ="body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, input, button, textarea, p, blockquote, th, td{margin:0;padding:0;}\n" +
"body {color: #333;text-align: left;font-size: 14px;font-family:\"微软雅黑\";font-family: microsoft yahei,Arial,Helvetica,sans-serif;/* background: url(../images/ind_mbg.png) ; */background: #fdfdfe;}\n" +
"\n" +
"\n" +
"a{ text-decoration:none; color:inherit; color: #222;font-family:\"微软雅黑\";}\n" +
"a:link,a:visited {\n" +
"\tcolor: inherit;\n" +
"\ttext-decoration: none;\n" +
"}\n" +
"a:active,a:hover {\n" +
"\tcolor: #0062eb;\n" +
"\ttext-decoration: none;\n" +
"}\n" +
"img{ margin:0px; padding:0px; border: none;}\n" +
"p{ margin:0px; padding:0px;}\n" +
"\n" +
"em {\n" +
"\tfont-style: normal;\n" +
"}\n" +
"li,ul {\n" +
"\tlist-style: none;\n" +
"\ttext-decoration: none;\n" +
"}\n" +
"li {\n" +
"\tlist-style-type: none;\n" +
"}\n" +
"div {\n" +
"\tword-wrap: break-word;\n" +
"\tword-break: break-all;\n" +
"}\n" +
"h1,h2,h3,h4,h5,h6 {\n" +
"\tfont-size: 9pt; font-weight: normal;\n" +
"\tfont-family:\"微软雅黑\";\n" +
"}";
return str;
}
%>