diff --git a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/jquery.validate.method.js b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/jquery.validate.method.js index 861d26785..2945ce45a 100644 --- a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/jquery.validate.method.js +++ b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/jquery.validate.method.js @@ -24,10 +24,18 @@ }); }(jQuery)); +jQuery.validator.addMethod("hexCheck", function(value, element) { + return this.optional(element) || /^([0-9|a-f|A-F]*)$/.test(value); +}, $.validator.messages.hexCheck); jQuery.validator.addMethod("ip", function(value, element) { return this.optional(element) || (/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/.test(value) && (RegExp.$1 <256 && RegExp.$2<256 && RegExp.$3<256 && RegExp.$4<256)); }, "请输入合法的IP地址"); +//IPv4 IPv6 +jQuery.validator.addMethod("ipv4v6", function(value, element) { + return this.optional(element) || (/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/.test(value) && (RegExp.$1 <256 && RegExp.$2<256 && RegExp.$3<256 && RegExp.$4<256))||/^\s*((([0-9A-Fa-f]{1,4}:){7}(([0-9A-Fa-f]{1,4})|:))|(([0-9A-Fa-f]{1,4}:){6}(:|(:[0-9A-Fa-f]{1,4})))|(([0-9A-Fa-f]{1,4}:){5}((:?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:){4}(:[0-9A-Fa-f]{1,4}){0,1}((:?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:){3}(:[0-9A-Fa-f]{1,4}){0,2}((:?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:){2}(:[0-9A-Fa-f]{1,4}){0,3}((:?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:)(:[0-9A-Fa-f]{1,4}){0,4}((:?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(:(:[0-9A-Fa-f]{1,4}){0,5}((:)|((:[0-9A-Fa-f]{1,4}){1,2}))))(%.+)?\s*$/.test(value); +}, "请输入合法的IP地址如IPv4 0.0.0.0或IPv6 ::"); + jQuery.validator.addMethod("abc",function(value, element) { return this.optional(element) || /^[a-zA-Z0-9_]*$/.test(value); },"请输入字母数字或下划线"); diff --git a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_en.js b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_en.js index d1929e3db..948e3d289 100644 --- a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_en.js +++ b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_en.js @@ -59,6 +59,7 @@ domainCheck:"Please enter a valid domain.", checkParent:"Configuration Type must match it's parent.", specServiceCodeCheck:"Protocol No is repeat.", - compareDate:"The end time should not be earlier than the start time." + compareDate:"The end time should not be earlier than the start time.", + hexCheck:"Please enter the HEX format chatactar" }); }(jQuery)); diff --git a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_ru.js b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_ru.js index 2d3fdd8cd..64649ea22 100644 --- a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_ru.js +++ b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_ru.js @@ -45,10 +45,11 @@ isp: "isp", close_info: "close", client_ip: "client ip", - ipv4: "ipv4", - ipv6: "ipv6", + ipv4: "IPv4", + ipv6: "IPv6", over6: "4over6", over4: "6over4", + ipv4v6:"IPv4(0.0.0.0) or IPv6(::)", all: "all", ip_subnet: "Subnet", ip_range: "ip Range", @@ -57,6 +58,7 @@ domainCheck:"Please enter a valid domain.", checkParent:"Configuration Type must match it's parent.", specServiceCodeCheck:"Protocol No is repeat.", - compareDate:"The end time should not be earlier than the start time." + compareDate:"The end time should not be earlier than the start time.", + hexCheck:"Please enter the HEX format chatactar" }); }(jQuery)); \ No newline at end of file diff --git a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_zh.js b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_zh.js index 18857583a..066213cc7 100644 --- a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_zh.js +++ b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_zh.js @@ -52,6 +52,7 @@ ipv6: "ipv6", over6: "4over6", over4: "6over4", + ipv4v6:"请输入合法的IP地址如IPv4(0.0.0.0)或IPv6(::)", all: "全部", ip_subnet: "Subnet", ip_subnet: "Subnet", @@ -61,6 +62,7 @@ domainCheck:"请输入有效的域名", checkParent:"配置类型必须与上级配置一致!", specServiceCodeCheck:"协议号重复", - compareDate:"结束时间不能早于开始时间" + compareDate:"结束时间不能早于开始时间", + hexCheck:"请输入十六进制字符" }); }(jQuery)); diff --git a/src/main/webapp/static/global/scripts/common.js b/src/main/webapp/static/global/scripts/common.js index 5db1d2792..fb6020f24 100644 --- a/src/main/webapp/static/global/scripts/common.js +++ b/src/main/webapp/static/global/scripts/common.js @@ -348,12 +348,12 @@ $(function(){ $("#protocolId").val($(this).attr("protocolId")); }); //选择hex cfgkeywords需校验十六进制 - /*$("select[name$='isHexbin']").each(function(){ + $("select[name$='isHexbin']").each(function(){ $(this).on("change",function(){ addHexCheck(this,$(this).val()); }); addHexCheck(this,$(this).val()); - });*/ + }); // 校验搜索条件里的时间选框,不允许起始时间晚于终止时间 $("#searchForm").validate({ rules:{ @@ -386,6 +386,15 @@ $(function(){ }, "doendDate": { compareDate: "[name=dobeginDate]" + }, + "capIp":{ + ipv4v6:true + }, + "sIp":{ + ipv4v6:true + }, + "dIp":{ + ipv4v6:true } }, submitHandler: function(form){ @@ -395,6 +404,10 @@ $(function(){ }); }); window.onload=function(){ + //日志查询IP类型增加格式提示 + $("#searchForm [name='capIp']").attr("placeholder","IPv4 0.0.0.0 or IPv6 ::"); + $("#searchForm [name='sIp']").attr("placeholder","IPv4 0.0.0.0 or IPv6 ::"); + $("#searchForm [name='dIp']").attr("placeholder","IPv4 0.0.0.0 or IPv6 ::"); // 动态调整日志页搜索框的样式,防止validate的错误提示导致样式错乱 var igHeight = $("#searchForm").find(".col-md-12").find(".pull-left").find(".input-group").height(); $("#searchForm").find(".col-md-12").find(".pull-left").find(".input-group").bind("DOMNodeInserted",function(e) {