SpecialFileCheck.jsp 19.1 KB
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 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500
<!DOCTYPE html>
<html>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.templetecheck.filecheck.NonStandardFiles" %>
<%@ page import="com.weaver.function.ConfigInfo" %>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<%@ taglib uri="/WEB-INF/weaver.tld" prefix="wea"%>
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1"/>
	<meta name="viewport"
		  content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
	<title>特殊文件检测</title>
	<link rel="stylesheet" href="/wui/theme/ecology8/jquery/js/zDialog_e8_wev8.css" type="text/css"/>
	<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>
	<LINK href="/css/Weaver_wev8.css" type=text/css rel=STYLESHEET>
	<SCRIPT language="javascript" src="/js/weaver_wev8.js"></script>
	<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>
	<%
		//判断只有管理员才有权限
		int userid = user.getUID();
		if(userid!=1) {
			response.sendRedirect("/notice/noright.jsp");
			return;
		}
String tableStr = "";
String checktype = Util.null2String(request.getParameter("checktype"));
String isWorkflow = Util.null2String(request.getParameter("is_workflow"));
if("1".equals(checktype)) {
	NonStandardFiles nonStandardFiles = new NonStandardFiles();
	tableStr = nonStandardFiles.getNonStandardFiles(user,"");
} else {
}
 %>

<style type="text/css">
.node {
	width:800px;
	height:30px;
	line-height:30px;
	padding-left:10px;
	margin-top:10px;
	background-color:#489dd2;
}

.level1 {
	display:inline-block;
}
.line1 {
	/* width:15px;
	border-right:1px; */
}
.line2 {
	/* height:15px;
	width:15px;
	border-bottom:1px;
	border-style:solid; */
}
.btn {
	height:40px;
	width:150px;
	line-height:40px;
	border-radius:5px;
	background-color:#169BD5;
	border:none;
}

.btnnoclick {
    height:40px;
    width:150px;
    line-height:40px;
    border-radius:5px;
    background-color:#AAAAAA;
    border:none;
}
#messagediv {
	width:100%;
	border-radius:10px;
	border:1px solid;
	margin-top:2%;
	padding:1%;
	background-color:#FFFFCC
}
.padding-left {
	padding:0px!important;
}

</style>
</head>

<body style="width:90%;margin:0px auto;height:90%;">
<form action="SpecialFileCheck.jsp" name="form" id="form" type="post">

	<div id="filepath" style="width:100%;height:50%;margin-top:2%">
		<div style="border:1px solid #ddd;border-radius:3px;height:40px;margin-bottom:10px;">
			<div style="background-color:#f4f4f4;width:200px;float:left;height:40px;line-height:40px;text-align:center">文件检查类型</div>
			<div style="height:100%;height:40px;line-height:40px">
				<input type="radio" class="checktype" name="checktype" value="0" onclick="submitForm();" />指定文件检测&nbsp;&nbsp;&nbsp;&nbsp;
                <input type="radio" class="checktype" name="checktype" value="1" onclick="submitForm();"/>非标准文件检测&nbsp;&nbsp;&nbsp;&nbsp;
				<%--<input type="button" class="btn" value="重新获取非标准文件" id="getNonStandardFileBtn" onclick="getNonStandardFile()" style="height:30px;line-height:30px;display:none"></input>--%>
			</div>
		</div>
		<div style="border:1px solid #ddd;border-radius:3px;height:40px;margin-bottom:10px;" id="is_workflowdiv">
			<div style="background-color:#f4f4f4;width:200px;float:left;height:40px;line-height:40px;text-align:center">是否流程模板相关文件</div>
			<div style="height:100%;height:40px;line-height:40px">
				<input type="checkbox" class="checktype" id="is_workflow" name="is_workflow" value="2" <%if(isWorkflow.equals("1")){%>checked="true"<%}%>/>流程模板相关&nbsp;&nbsp;&nbsp;&nbsp;
			</div>
		</div>

		<div id="pathdiv" style="border:1px solid #ddd;border-radius:3px;height:100px;">
			<div style="background-color:#f4f4f4;width:200px;height:100px;line-height:100px;text-align:center;float:left;">文件路径</div>
			<textarea id="filepatharea" name="filepath" style="width:50%;height:90%"></textarea>
		</div>
		<div id="filelist" style="border:1px solid #ddd;border-radius:3px;display:none">
			<wea:layout type="1col">
				<wea:group context="非标准文件列表">
					<wea:item attributes="{\"samePair\":\"rulelisttd\";\"colspan\":\"full\"}">
						<TABLE width="100%">
						    <tr>
						        <td valign="top">
						        	<input type="hidden" name="pageId" id="pageId" value="nonStandardFile"/>
						           	<wea:SplitPageTag tableString="<%=tableStr %>" isShowTopInfo="true" mode="run" />
						        </td>
						    </tr>
						</TABLE>
					</wea:item>
				</wea:group>
			</wea:layout>
		</div>
	</div>

	<div id="btndiv" style="width:100%;margin-top:2%">
		<input type="button" class="btn" value="开始检测" onclick="startcheck()" id="startcheckfile"/>&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="button" class="btn" value="检测规则详情"  id="checkfilerule" onclick="doOpenJSP()"/>&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="button" class="btn" value="重新获取非标准文件" id="getNonStandardFileBtn" onclick="getNonStandardFile()" />&nbsp;&nbsp;&nbsp;&nbsp;
	</div>

	<div id="messagediv" style="margin-bottom: 10px;">
		<span style="color:red">
	<b>操作步骤:</b><br>
	1.填写需要进行检查的文件路径或者选择需要检测的非标准文件<br>
	2.点击“开始检测”按钮,进入检测结果页面<br>
	3.在检测结果页面点击右上角“导出报告”按钮,下载Excel报告文件<br>
	4.导出报告后,根据报告中的说明内容进行相关操作:<br>
		&nbsp;&nbsp;&nbsp;&nbsp;>请根据检测结果的“被检测对象位置”,检查对应的功能是否正常,如存在问题,记录并告知开发人员<br>
		&nbsp;&nbsp;&nbsp;&nbsp;>如果部分内容无法自动替换,需要手动修改,请告知开发人员,按照“规则描述”进行手动修改<br>
		&nbsp;&nbsp;&nbsp;&nbsp;>请将检测结果报告提交一份到版本升级服务部对应的开发人员<br>
	</span><br>
	  <b>说明:</b><br>
	  1.可以检测的文件类型为(Jsp文件、Html文件、Js文件、Css文件、Less文件、Java文件、Sql文件)<br>
	  2.请在“文件路径”中输入文件路径或者目录(服务器上的路径)<br>
	  3.非标准文件检测,不选择会检测系统中所有的非标准文件;<br>
	  4.如果需要新增检测规则,请点击“检测规则详情”页面查看并新增规则;<br>
	  5.如果在检测结果页面进行“批量替换”,将自动备份文件或者对应的字段文件<br>
	  6.指定文件检测如果是流程模板路径,请勾选"流程模板相关",否则按一般文件模板进行检测<br>
		<br><b>版本信息</b><br>
		V<%=ConfigInfo.getToolVersion() %>
	</div>
</form>
<div id="message_table_Div2" class="xTable_message"
	 style="display: none; position: absolute; top: 203px; left: 787.5px;">正在加载数据,请稍候...
</div>
</body>
<script type="text/javascript">
    var dialog = null;
    function closeDialog(){
        if(dialog)
            dialog.close();
    }
    var dWidth = 600;
    var dHeight = 500;
    var clientWidth = document.body.clientWidth;
    dWidth = clientWidth*0.9;
    var clientHeight = document.body.clientHeight;
    dHeight = clientHeight*0.9;

    function doOpenJSP(){
        var isWorkflow=$("#is_workflow").attr('checked');
        if(isWorkflow){
            filepath = $("#filepatharea").val();
            var re = new RegExp("\\\\","g");
            filepath = filepath.replace(re, "/");
            filepath=escape(filepath);
            doOpen('/templetecheck/filecheck/WorkflowCheckRule.jsp?filepath='+filepath+'&fromTab=speciafile','检测规则详情');
		}else{
            doOpen('/templetecheck/filecheck/SpecialFileCheckRule.jsp','检测规则详情');
		}

	}


    function doOpen(url,title){
		var re = new RegExp("\\\\","g");
        if(typeof dialog  == 'undefined' || dialog==null){
            dialog = new window.top.Dialog();
        }
        dialog.currentWindow = window;
        dialog.Title = title;
        dialog.Width =  dWidth;
        dialog.Height =  dHeight;
        dialog.Drag = true;
        dialog.maxiumnable = true;
        var ids = _xtable_CheckedCheckboxId();
        if(url.indexOf("?") > -1){
            dialog.URL = url+"&checktype=<%=checktype%>&filepath="+escape(($("#filepatharea").val()).replace(re, "/"))+"&fileids="+ids;
		}else{
            dialog.URL = url+"?checktype=<%=checktype%>&filepath="+escape(($("#filepatharea").val()).replace(re, "/"))+"&fileids="+ids;
        }
        try {
            dialog.show();
        }catch(e) {

        }
    }

    function doOpen2(url,title){

        if(typeof dialog  == 'undefined' || dialog==null){
            dialog = new window.top.Dialog();
        }
        dialog.currentWindow = window;
        dialog.Title = title;
        dialog.Width =  dWidth;
        dialog.Height =  dHeight;
        dialog.Drag = true;
        dialog.maxiumnable = true;
        dialog.CancelEvent = function(){
            $.ajax({
                url:"SpecialFileCheckOperation.jsp",
                type:'post',
                dataType:'json',
                data:{
                    'operation':'searchthreadstatus'
                },
                success:function(data) {
                    if (data) {
                       var res = data.status;
                       if (res == "ok") {
                           dialog.close();
                       } else {
                           top.Dialog.confirm("系统正在检测文件,离开页面将停止检测?", function () {
                               $.ajax({
                                   url:"SpecialFileCheckOperation.jsp",
                                   type:'post',
                                   dataType:'json',
                                   data:{
                                       'operation':'stopmatchfilethread'
                                   },
                                   success:function(data) {
                                       dialog.close();
                                       // if (data) {
                                       //    var res = data.status;
                                       //    if (res == "ok") {
                                       //        dialog.close();
                                       //    } else {
                                       //        top.Dialog.confirm("系统正在检测文件,确认离开检测页面?", function () {
                                       //            dialog.close();
                                       //        });
                                       //    }
                                       // }else{
                                       //    dialog.close();
                                       // }
                                   },
                                   error:function(){
                                       dialog.close();
                                   }
                               });
                           });
                       }
                    }else{
                       dialog.close();
                    }
                },
                error:function(){
                    dialog.close();
                }
            });



        };
        var ids = _xtable_CheckedCheckboxId();
        if(url.indexOf("?") > -1){
            dialog.URL = url+"&checktype=<%=checktype%>&filepath="+$("#filepatharea").val()+"&fileids="+ids;
        }else{
            dialog.URL = url+"?checktype=<%=checktype%>&filepath="+$("#filepatharea").val()+"&fileids="+ids;
        }
        try {
            dialog.show();
        }catch(e) {

        }
    }

    $(document).ready(function(){
        changetype("<%=checktype%>");
        var type = "<%=checktype%>";
        $(".checktype").attr("checked",false);
        $(".jNiceRadio").removeClass("jNiceChecked");
        if("0" == type || "" == type) {
            $("#is_workflowdiv").show();
            $("#pathdiv").show();
            $(".checktype").eq(0).attr("checked","checked");
            $(".jNiceRadio").eq(0).addClass("jNiceChecked");
        } else {
            $("#is_workflowdiv").hide();
            $("#pathdiv").hide();
            $(".checktype").eq(1).attr("checked","checked");
            $(".jNiceRadio").eq(1).addClass("jNiceChecked");
        }
        $("td[_samepair='rulelisttd']").removeClass("fieldName");
    });

    //类型转化
    function changetype(type) {
        if("0" == type || "" == type) {
            $("#pathdiv").show();
            $("#is_workflowdiv").hide();
            $("#filelist").hide();
            $("#nonstandardfilebtn").hide();
            $("#getNonStandardFileBtn").hide();
        } else {
            $("#pathdiv").hide();
            $("#is_workflowdiv").show();
            $("#filelist").show();
            $("#nonstandardfilebtn").show();
            $("#getNonStandardFileBtn").show();
        }

    }

    //提交
    function submitForm(){
        var type = "<%=checktype%>";
        
        if("0" == type || "" == type) {
            $("#is_workflowdiv").hide();
            $("#pathdiv").hide();
        } else {
            $("#is_workflowdiv").show();
            $("#pathdiv").show();
        }
            $("#message_table_Div2").show();
            $("#form").submit();
    }

    function startcheck() {
        $.ajax({
            url:'SpecialFileCheckOperation.jsp',
            dataType:'json',
            type:'post',
            data:{
                'operation':'checkrunstatus'
            },
            success:function(data){
                if(data) {
                    var res = data.status;
                    if(res == "ok") {
                        var tchecktype =  "<%=checktype%>";
                        var isWorkflow=$("#is_workflow").attr('checked');
                        var filepath;
                        if("1" != tchecktype) {
                            filepath = $("#filepatharea").val();
                            if(filepath == "") {
                                top.Dialog.alert("文件路径未填写!");
                                return;
                            }
                            var re = new RegExp("\\\\","g");
                            filepath = filepath.replace(re, "/");
                            filepath=escape(filepath);
                        }
                        var ids = _xtable_CheckedCheckboxId();
                        //开始执行检查
                        doOpen2("/templetecheck/filecheck/SpecialFileCheckResult.jsp?filepath="+filepath+"&fileids="+ids+"&isWorkflow="+isWorkflow,"文件检测结果");
                    } else {
                        top.Dialog.alert("系统正在检测文件,请稍候");
                        return;
                    }
                }
            }
        });

    }

    //重新获取非标文件
    function getNonStandardFile() {
        $("#message_table_Div2").ajaxStart(function(){
            $("#message_table_Div2").show();
        });
        $.ajax({
            url:'SpecialFileCheckOperation.jsp',
            dataType:'json',
            type:'post',
            data:{
                'operation':'checkNoStanderrunstatus'
            },
            success:function(data){
                if(data) {
                    var res = data.status;
                    if(res == "ok") {

                        $("#startcheckfile").attr("disabled",true);
                        $("#startcheckfile").removeClass("btn");
                        $("#startcheckfile").addClass("btnnoclick");

                        $("#checkfilerule").attr("disabled",true);
                        $("#checkfilerule").removeClass("btn");
                        $("#checkfilerule").addClass("btnnoclick");
                        $.ajax({
                            url: "/templetecheck/filecheck/SpecialFileCheckOperation.jsp",
                            dataType: 'json',
                            data: {
                                "operation": "refleshNonStandardFile"
                            },
                            type: 'post',
                            ayc: false,//同步加载
                            success: function (data) {
                                if (data) {
                                    $("#startcheckfile").attr("disabled",false);
                                    $("#startcheckfile").removeClass("btnnoclick");
                                    $("#startcheckfile").addClass("btn");

                                    $("#checkfilerule").attr("disabled",false);
                                    $("#checkfilerule").removeClass("btnnoclick");
                                    $("#checkfilerule").addClass("btn");
                                    $("#message_table_Div2").hide()
                                    _table.reLoad();
                                }
                            },
                            error: function (msg) {
                                $("#message_table_Div2").hide()
                                alert(msg)
                            }
                        });
                    } else {
                        top.Dialog.alert("系统正在检测非标准文件,请稍候");
                    }
                }
            }
        });
    }

    function matchsingle(index,filepath){

        $.ajax({
            url:'SpecialFileCheckOperation.jsp',
            dataType:'json',
            type:'post',
            data:{
                'operation':'checkrunstatus'
            },
            success:function(data){
                if(data) {
                    var res = data.status;
                    if(res == "ok") {
                        if(filepath == "") {
                            top.Dialog.alert("非标准文件路径不存在!");
                            return;
                        }
                        var re = new RegExp("\\\\","g");
                        filepath = filepath.replace(re, "/");
                        filepath=escape(filepath);
                        //开始执行检查
                        doOpen1("/templetecheck/filecheck/SpecialFileCheckResult.jsp?filepath="+filepath,"文件检测结果");
                    } else {
                        top.Dialog.alert("系统正在检测文件,请稍候");
                        return;
                    }
                }
            }
        });
	}

    function doOpen1(url,title){
        if(typeof dialog  == 'undefined' || dialog==null){
            dialog = new window.top.Dialog();
        }
        dialog.currentWindow = window;
        dialog.Title = title;
        dialog.Width =  dWidth;
        dialog.Height =  dHeight;
        dialog.Drag = true;
        dialog.maxiumnable = true;
        if(url.indexOf("?") > -1){
            dialog.URL = url+"&checktype=0";
        }else{
            dialog.URL = url+"?checktype=0";
        }
        try {
            dialog.show();
        }catch(e) {

        }
    }
</script>
</html>