SpecialFileCheckRule.jsp 13 KB
<%@ page import="weaver.general.Util" %>

<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ 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><HEAD>
<LINK href="/css/Weaver_wev8.css" type=text/css rel=STYLESHEET>
<SCRIPT language="javascript" src="/js/weaver_wev8.js"></script>
<link rel="stylesheet" href="/css/ecology8/request/requestTopMenu_wev8.css" type="text/css" />
<link rel="stylesheet" href="/wui/theme/ecology8/jquery/js/zDialog_e8_wev8.css" type="text/css" />
<script type="text/javascript" src="/js/dragBox/parentShowcol_wev8.js"></script>
<link rel="stylesheet" href="/css/ecology8/request/requestView_wev8.css" type="text/css" />
<link rel="stylesheet" href="/wui/theme/ecology8/weaveredittable/css/WeaverEditTable_wev8.css">
<script  src="/wui/theme/ecology8/weaveredittable/js/WeaverEditTable_wev8.js"></script>
<link href="/js/checkbox/jquery.tzCheckbox_wev8.css" type=text/css rel=STYLESHEET>
<script type="text/javascript" src="/js/ecology8/jNice/jNice/jquery.jNice_wev8.js"></script>
<%!
public String replaceStr(String str) {
	if(str != null) {
		str = str.replace("<","&lt;");
		str = str.replace(">","&gt;");
	}
	return str;
}
%>
<%
//判断只有管理员才有权限
int userid = user.getUID();
if(userid!=1) {
	response.sendRedirect("/notice/noright.jsp");
  return;
}
%>
<script type="text/javascript">
function addRow(v){
	group.addRow(null);

}
function removeRow(v)
{
	var count = 0;//删除数据选中个数
	jQuery("#"+v+" input[name='paramid']").each(function(){
		if($(this).is(':checked')){
			count++;
		}
	});
	if(count==0){
		top.Dialog.alert("请选择需要删除的数据!");
	}else{
		group.deleteRows();
	}
}
jQuery(document).ready(function(){
	 jQuery("td[_samepair='rulelist']").css("padding","0px!important");
});
</script>
</head>
<%

String imagefilename = "/images/hdMaintenance_wev8.gif";
String titlename = "文件检测";
String needfav ="1";
String needhelp ="";
String type = Util.null2String(request.getParameter("type"));
String note = "选填。输入多个路径请以\",\"分隔";
String sourceparams = "";
String description = Util.null2String(request.getParameter("description"));
String name  = Util.null2String(request.getParameter("name"));
String checktype  = Util.null2String(request.getParameter("checktype"));
String filepath  = Util.null2String(request.getParameter("filepath"));
filepath=URLEncoder.encode(filepath,"utf-8");
String content = Util.null2String(request.getParameter("content"));
String navName = java.net.URLDecoder.decode(Util.null2String(request.getParameter("navName")),"UTF-8");
String fileids=Util.null2String(request.getParameter("fileids"));
String name2=Util.null2String(request.getParameter("name2"));
%>
<BODY>
<%@ include file="/systeminfo/TopTitle_wev8.jsp" %>
<%@ include file="/systeminfo/RightClickMenuConent_wev8.jsp" %>


<%

RCMenu += "{新建规则,javascript:add(),_self} " ;
RCMenuHeight += RCMenuHeightStep ;
RCMenu += "{删除规则,javascript:dodelete2(),_self} " ;
RCMenuHeight += RCMenuHeightStep ;
RCMenu += "{批量检测规则,javascript:match(),_self} " ;
RCMenuHeight += RCMenuHeightStep ;

String PageConstId = "rulelist";

String backfields = " t1.* ";
String fromSql  = " from upgradecheckrule t1 ";
String sqlWhere = " where 1=1 ";

if(!"".equals(name)) {
	sqlWhere = sqlWhere + " and rulename like '%" + name + "%'";
}else if(!"".equals(name2)){
	sqlWhere = sqlWhere + " and rulename like '%" + name2 + "%'";
}
if(!"".equals(description)) {
	sqlWhere = sqlWhere + " and ruledesc like '%" + description + "%'";
}

if(!"".equals(content)) {
	sqlWhere = sqlWhere + " and content like '%" + content + "%'";
}


String orderby  = "id";
String tableStringrule = "<table instanceid=\"rulelist\" tabletype=\"checkbox\" pagesize=\""+PageIdConst.getPageSize(PageConstId,user.getUID())+"\" >"+
"	   <sql backfields=\""+backfields+"\" sqlform=\""+fromSql+"\"  sqlorderby=\"" + orderby + "\" sqlwhere=\""+Util.toHtmlForSplitPage(sqlWhere)+"\"    sqlprimarykey=\"id\" sqlsortway=\"Desc\"/>"+
"			<head>";
tableStringrule += "<col width=\"10%\"  text=\"标识\" column=\"id\" orderkey=\"id\" display=\"false\"/>"+
		"<col width=\"10%\"  text=\"名称\" column=\"rulename\" orderkey=\"rulename\"  transmethod=\"weaver.templetecheck.transmethod.RuleTrans.changeStr3\"/>"+
		"<col width=\"10%\"  text=\"规则类型\" column=\"ruletype\" orderkey=\"ruletype\" transmethod=\"weaver.templetecheck.transmethod.RuleTrans.getRuleType\" />"+
	             "<col width=\"20%\"  text=\"描述\" column=\"ruledesc\" orderkey=\"ruledesc\"  transmethod=\"weaver.templetecheck.transmethod.RuleTrans.changeStr3\"/>"+
	             "<col width=\"20%\"  text=\"规则\" column=\"content\" orderkey=\"content\"  transmethod=\"weaver.templetecheck.transmethod.RuleTrans.changeStr3\"/>"+
				 "<col width=\"20%\"  text=\"替换内容\" column=\"replacecontent\" orderkey=\"replacecontent\"  transmethod=\"weaver.templetecheck.transmethod.RuleTrans.changeStr3\"/>"+
	       "</head>"+
			"		<operates>"+
			"			<operate href=\"javascript:matchsingle();\" text=\"检测规则\" index=\"0\"/>"+
			"			<operate href=\"javascript:edit();\" text=\"编辑\" index=\"1\"/>"+
			"			<operate href=\"javascript:dodelete();\" text=\"删除\" index=\"2\"/>"+
	       "</operates></table>";
%>	
<%@ include file="/systeminfo/RightClickMenu_wev8.jsp" %>

<form action="" method="post" name="form1" id="form1" >
<jsp:include page="/systeminfo/commonTabHead.jsp">
   <jsp:param name="mouldID" value="check"/>
   <jsp:param name="navName" value="<%=titlename %>"/>
</jsp:include>
<table id="topTitle" cellpadding="0" cellspacing="0">
	<tr>
		<td></td>
		<td class="rightSearchSpan" style="text-align:right; width:500px!important">
		<%--<input type="hidden" class="searchInput" id="flowTitle" name="flowTitle" value="" onchange=""/>--%>
			<input class="searchInput" id="name2" name="name2"/>
			<input type="button" value="批量检测规则" style="width:100%;max-width:120px!important;" class="e8_btn_top" onclick="match()"/>
			<span id="advancedSearch" class="advancedSearch">高级搜索</span>&nbsp;&nbsp;
			<span title="菜单" class="cornerMenu"></span>
			
		</td>
	</tr>
</table>
<div id="tabDiv" >
   <span style="font-size:14px;font-weight:bold;">流程模板检查</span>
</div>
	
<div class="cornerMenuDiv"></div>
<div class="advancedSearchDiv" id="advancedSearchDiv">
	<wea:layout type="4col">
		<wea:group context="高级搜索">
			<wea:item>名称</wea:item>
			<wea:item><input  type="text" name="name" value="<%=name%>"></wea:item>
			<wea:item>描述</wea:item>
			<wea:item><input   type="text" name="description" value="<%=description%>"></wea:item>
			<wea:item>规则</wea:item>
			<wea:item><input   type="text" name="content" value="<%=content%>"></wea:item>
		</wea:group>
		<wea:group context="" attributes="{'groupDisplay':'none'}">
			<wea:item type="toolbar">
					<input type="submit"  onclick="doRefresh()" value="搜索" class="zd_btn_submit"/>
					<input type="button" value="重置" class="e8_btn_cancel" onclick="resetCondtion();"/>
					<input type="button" value="取消" class="e8_btn_cancel" id="cancel"/>
			</wea:item>
		</wea:group>
	</wea:layout>
</div>	

<TABLE width="100%">
    <tr>
        <td valign="top">  
        	<input type="hidden" name="pageId" id="pageId" value="rulelist"/>
           	<wea:SplitPageTag  tableString="<%=tableStringrule %>" isShowTopInfo="true" mode="run" />
        </td>
    </tr>
</TABLE>
<input name="type" value="" type="hidden"></input>
<input name="ruleid" value="" type="hidden"></input>
<input type="hidden" name="type" value="<%=type%>"></input>
<input type="hidden" name="filepath" value="<%=filepath%>"></input>
	<input type="hidden" name="fileids" value="<%=fileids%>"></input>
	<input type="hidden" name="checktype" value="<%=checktype%>"></input>

</form>
<div id="message_table_Div2111" class="xTable_message" style="display: none; position: absolute; top: 203px; left: 787.5px;">正在加载数据,请稍候...</div>

<iframe id="excels" src="" style="display:none"></iframe>
</BODY>
</HTML>
<script language="javascript" src="/wui/theme/ecology8/jquery/js/zDialog_wev8.js"></script>
<script language="javascript" src="/wui/theme/ecology8/jquery/js/zDrag_wev8.js"></script>
<script type="text/javascript">
var filepath = "<%=filepath%>";
var fileids="<%=filepath %>";
var checktype="<%=checktype %>";
$(document).ready(function(){
	$(parent.document.getElementById("objName")).html("<%=navName %>");
	$("#tableitem").removeClass("fieldName");
	
	$("#topTitle").topMenuTitle({searchFn:doRefresh});
	$(".topMenuTitle td:eq(0)").html($("#tabDiv").html());
	$("#tabDiv").remove();
	
});
function matchsingle(id) {

    $.ajax({
        url:'SpecialFileCheckOperation.jsp',
        dataType:'json',
        type:'post',
        data:{
            'operation':'checkrunstatus'
        },
        success:function(data){
            if(data) {
                var res = data.status;
                if(res == "ok") {
                    if(checktype=="1"){
                        $("input[name='type']").val("1");
                        $("input[name='ruleid']").val(id);
                        $("input[name='navName']").val(encodeURIComponent("<%=navName%>"));
                        $("#form1").attr("action","SpecialFileCheckResult.jsp");
                        $("#form1").submit();
                    }else{
                        if("" == filepath || filepath == null || filepath == undefined) {
                            top.Dialog.alert("文件路径未设置");
                        } else {
                            $("input[name='type']").val("1");
                            $("input[name='ruleid']").val(id);
                            $("input[name='navName']").val(encodeURIComponent("<%=navName%>"));
                            $("#form1").attr("action","SpecialFileCheckResult.jsp");
                            $("#form1").submit();
                        }
                    }
                } else {
                    top.Dialog.alert("系统正在检测文件,请稍候");
                    return;
                }
            }
        }
    });
}

//保存自定义规则
function save() {
	$("#form1").submit();
}


//检查文件路径
function checkPath() {
    if(checktype=="1"){
        return true;
	}else{
        if("" == filepath || filepath == null || filepath == undefined) {
            top.Dialog.alert("文件路径未设置");
            return false;
        } else {
            return true;
        }
	}
}

function match() {
    $.ajax({
        url:'SpecialFileCheckOperation.jsp',
        dataType:'json',
        type:'post',
        data:{
            'operation':'checkrunstatus'
        },
        success:function(data){
            if(data) {
                var res = data.status;
                if(res == "ok") {
                    var checkPathRes = checkPath();
                    if(!checkPathRes) {
                        return;
                    }
                    var ids = _xtable_CheckedCheckboxId();
                    $("input[name='type']").val("1");
                    $("input[name='navName']").val(encodeURIComponent("<%=navName%>"));
                    $("input[name='ruleid']").val(ids);
                    $("#form1").attr("action","SpecialFileCheckResult.jsp");
                    $("#form1").submit();
                } else {
                    top.Dialog.alert("系统正在检测文件,请稍候");
                    return;
                }
            }
        }
    });

}




function add() {
	var url = "/templetecheck/filecheck/RuleEdit.jsp?method=add&rulefrom=specialfilecheck";
	doOpen(url,"新建规则");
}
function edit(id) {
	var url = "/templetecheck/filecheck/RuleEdit.jsp?flageid="+id+"&rulefrom=specialfilecheck";
	doOpen(url,"编辑规则");
}

function dodelete(flageids) {
	
	if(flageids==undefined||""==flageids) {
		top.Dialog.alert("请选择记录!");
		return;
	}
	//flageids = ","+flageids+",";
	try {
	top.Dialog.confirm("提示:是否确认删除?",
			function(){
	$.ajax({
		url:'RuleOperation.jsp?method=delete',
		dataType:'json',
		type:'post',
		data:{
		    'rulefrom':'specialfilecheck',
			'flageid':""+flageids,
		},
		success:function(data){
			if(data) {
				var res = data.status;
				if(res == "ok") {
					_table.reLoad();
					return;
				} else {
					top.Dialog.alert("删除失败");
					return;
				}
			}
		}
	});
	},function(){}
	);
	}catch(e) {
		
	}
}
function dodelete2() {
	dodelete(_xtable_CheckedCheckboxId());
}

function doRefresh(){
	$("#form1").attr("action","SpecialFileCheckRule.jsp");
	$("#form1").submit();
}
var dialog = null;
function closeDialog(){
    if(dialog)
        dialog.close();
}

var dWidth = 600;
var dHeight = 500;

function doOpen(url,title){
    if(typeof dialog  == 'undefined' || dialog==null){
        dialog = new window.top.Dialog();
    }
    dialog.currentWindow = window;
    dialog.Title = title;
    dialog.Width =  dWidth || 500;
    dialog.Height =  dWidth || 300;
    dialog.Drag = true;
    dialog.maxiumnable = true;
    dialog.URL = url;
    try {
        dialog.show();
    }catch(e) {

    }

}
</script>