MessageDialog.jsp 4.96 KB
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.templetecheck.filecheck.CheckRule" %>
<%@ page import="weaver.templetecheck.filecheck.ExcelSecurity" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="weaver.templetecheck.FileUtil" %>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page"/>
<%@ taglib uri="/WEB-INF/weaver.tld" prefix="wea" %>
<HTML>
<%!
public static String getDetailContent(String resultTableName,String contentColumnName,String id){
    RecordSet rs = new RecordSet();
    FileUtil fileutil = new FileUtil();
    String content = "";
    String querysql ="";

    boolean column_isexist = CheckRule.checkDBFieldIsExist(contentColumnName,resultTableName);//检查需要查询的字段是否存在
    if(!column_isexist){
        return content;
    }

    if("workflow_nodehtmllayout".equalsIgnoreCase(resultTableName)) {
        String filepath = "";
        String modetype = "";
        querysql = "select a." + contentColumnName + ",a.syspath,b.modetype from workflow_nodehtmllayout a left join upgradecheckworkflowresult b " +
                " on a.id = b.nodehtmllayoutid where a.id='" + id + "'";
        rs.execute(querysql);
        if (rs.next()) {
            content = Util.null2String(rs.getString(contentColumnName));
            filepath = Util.null2String(rs.getString("syspath").replace("\\\\","\\")).replace("//","/");
            modetype = Util.null2String(rs.getString("modetype"));
        }
      if(!"".equals(filepath)&&"0".equals(modetype)){
            File file = new File(filepath);
            if(file.exists()){
                StringBuffer buffer = fileutil.readFile(file);
               content = buffer.toString();
            }
        }else if("scripts".equalsIgnoreCase(contentColumnName)&&!"".equals(content)){
            ExcelSecurity excelSecurity = new ExcelSecurity();
            content = excelSecurity.decode(content);
        }
    }else if("checkmobilemoderesult".equalsIgnoreCase(resultTableName)&&!"".equals(content)){
        String referkey="";
        String mectype="";
        querysql ="select t1." + contentColumnName + ",t1.referkey,t2.mectype from " + resultTableName + " t1 left join MobileExtendComponent t2 on t1.nodehtmllayoutid=t2.id where t1.id='" + id + "'";
        rs.execute(querysql);
        if (rs.next()) {
            content = Util.null2String(rs.getString(contentColumnName));
            referkey = Util.null2String(rs.getString("referkey"));
            mectype = Util.null2String(rs.getString("mectype"));
        }
        if(!"".equals(referkey)){//当获取内容为插件时,其他类型直接返回数据即可
            JSONObject json_t = JSONObject.parseObject("{"+content+"}");
            if("backscript".equalsIgnoreCase(referkey)&&"flbs".equalsIgnoreCase(mectype)){//对E8的某个版本中的lbs插件做特殊处理
                content = json_t.getString("backscript");
                try {
                    content = URLDecoder.decode(content, "UTF-8");
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }else{
                String tempreferkey = referkey.contains(".")?referkey.substring(referkey.lastIndexOf(".")+1):referkey;
                content = json_t.getString(tempreferkey);
            }
        }
    }else{
        querysql = "select " + contentColumnName + " from " + resultTableName + " where id='" + id + "'";
        rs.execute(querysql);
        if (rs.next()) {
            content = Util.null2String(rs.getString(contentColumnName));
        }
    }
    return content.trim();
}
%>
<HEAD>
    <%
        String titlename = "内容详情";
        //判断只有管理员才有权限
        int userid = user.getUID();
        if (userid != 1) {
            response.sendRedirect("/notice/noright.jsp");
            return;
        }
        String id = Util.null2String(request.getParameter("id"));
        String resultTableName = Util.null2String(request.getParameter("resultTableName"));
        String contentColumnName = Util.null2String(request.getParameter("contentColumnName"));
        String sourceContent=getDetailContent(resultTableName,contentColumnName,id);
    %>
    <script type="text/javascript">
        jQuery(document).ready(function () {
        });
    </script>
</head>
<BODY style="overflow:-Scroll;overflow-y:hidden">
<%@ include file="/systeminfo/TopTitle_wev8.jsp" %>

<form action="" method="post" name="form1" id="form1">
    <div style="width:100%;height: 100%;text-align:center";>
        <textarea style="padding:5px;resize: none;width: 99%;height:auto" rows="46"  name="codedesc" id="messagediv"><%=sourceContent %></textarea>
    </div>
</form>
<div id="message_table_Div2" class="xTable_message"
     style="display: none; position: absolute; top: 203px; left: 787.5px;">正在加载数据,请稍候...
</div>
</BODY>
</HTML>