Merge branch 'develop' of http://192.168.10.125/k18_web/NFS.git into develop

This commit is contained in:
leijun
2018-10-15 19:19:04 +08:00
13 changed files with 129 additions and 134 deletions

View File

@@ -7,10 +7,6 @@ import java.util.Map;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
public final class Constants { public final class Constants {
/**
* IPSEC协议
*/
public static Integer IPSEC_PROTOCOL=Configurations.getIntProperty("ipsec_protocol", 8);
public static final String GROUP_REUSE_SOURCES=Configurations.getStringProperty("groupReuseSources","groupReuseSources"); public static final String GROUP_REUSE_SOURCES=Configurations.getStringProperty("groupReuseSources","groupReuseSources");
public static Integer APP_SPEC_SERVICE_CODE_MIN_VAL=Configurations.getIntProperty("app_spec_service_code_min_val", 300001); public static Integer APP_SPEC_SERVICE_CODE_MIN_VAL=Configurations.getIntProperty("app_spec_service_code_min_val", 300001);
public static Integer APP_SPEC_SERVICE_CODE_MAX_VAL=Configurations.getIntProperty("app_spec_service_code_max_val", 268435455); public static Integer APP_SPEC_SERVICE_CODE_MAX_VAL=Configurations.getIntProperty("app_spec_service_code_max_val", 268435455);

View File

@@ -136,11 +136,7 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
ipCfgDao.saveCfgIndex(entity); ipCfgDao.saveCfgIndex(entity);
if(entity.getIpPortList()!=null){ if(entity.getIpPortList()!=null){
for(IpPortCfg cfg:entity.getIpPortList()){ for(IpPortCfg cfg:entity.getIpPortList()){
if(Constants.IPSEC_PROTOCOL.intValue()==cfg.getProtocol().intValue()) { BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
BeanUtils.copyProperties(entity, cfg,new String[]{"userRegion1","cfgRegionCode","cfgType"});
}else {
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
}
ipCfgDao.saveIpPortCfg(cfg); ipCfgDao.saveIpPortCfg(cfg);
} }
} }
@@ -176,11 +172,7 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
entity.setCreatorId(entity.getCurrentUser().getId()); entity.setCreatorId(entity.getCurrentUser().getId());
if(entity.getIpPortList()!=null){ if(entity.getIpPortList()!=null){
for(IpPortCfg cfg:entity.getIpPortList()){ for(IpPortCfg cfg:entity.getIpPortList()){
if(Constants.IPSEC_PROTOCOL.intValue()==cfg.getProtocol().intValue()) { BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
BeanUtils.copyProperties(entity, cfg,new String[]{"userRegion1","cfgRegionCode","cfgType"});
}else {
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
}
ipCfgDao.saveIpPortCfg(cfg); ipCfgDao.saveIpPortCfg(cfg);
} }
} }
@@ -567,11 +559,6 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
ipCfgDao.auditCfg(cfg); ipCfgDao.auditCfg(cfg);
} }
if(isAudit==1&&maatType==Constants.MAAT_TYPE){ if(isAudit==1&&maatType==Constants.MAAT_TYPE){
for(IpPortCfg cfg:entity.getIpPortList()) {
if(Constants.IPSEC_PROTOCOL==cfg.getProtocol().intValue()) {
cfg.setProtocol(Integer.parseInt(cfg.getUserRegion1()));
}
}
Map<String,List> map = cfgConvert(ipRegionList,entity.getIpPortList(),1,entity,groupRelationList); Map<String,List> map = cfgConvert(ipRegionList,entity.getIpPortList(),1,entity,groupRelationList);
groupRelationList=map.get("groupList"); groupRelationList=map.get("groupList");
ipRegionList=map.get("dstList"); ipRegionList=map.get("dstList");
@@ -610,10 +597,7 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
List<InlineIp> ipList=new ArrayList<>(); List<InlineIp> ipList=new ArrayList<>();
for(IpPortCfg cfg :entity.getIpPortList()) { for(IpPortCfg cfg :entity.getIpPortList()) {
Integer ipsecProtocol=null; Integer ipsecProtocol=null;
if(Constants.IPSEC_PROTOCOL==cfg.getProtocol().intValue()) { BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
ipsecProtocol=Integer.parseInt(cfg.getUserRegion1());
}
BeanUtils.copyProperties(entity, cfg, new String[]{"userRegion1","cfgId"});
InlineIp ip=convertCallBackIp(cfg,null); InlineIp ip=convertCallBackIp(cfg,null);
if(ipsecProtocol!=null) { if(ipsecProtocol!=null) {
ip.setProtocol(ipsecProtocol); ip.setProtocol(ipsecProtocol);
@@ -677,10 +661,7 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
List<InlineIp> ipList=new ArrayList<>(); List<InlineIp> ipList=new ArrayList<>();
for(IpPortCfg cfg :entity.getIpPortList()) { for(IpPortCfg cfg :entity.getIpPortList()) {
Integer ipsecProtocol=null; Integer ipsecProtocol=null;
if(Constants.IPSEC_PROTOCOL==cfg.getProtocol().intValue()) { BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
ipsecProtocol=Integer.parseInt(cfg.getUserRegion1());
}
BeanUtils.copyProperties(entity, cfg, new String[]{"userRegion1","cfgId"});
InlineIp ip=convertCallBackIp(cfg,null); InlineIp ip=convertCallBackIp(cfg,null);
if(ipsecProtocol!=null) { if(ipsecProtocol!=null) {
ip.setProtocol(ipsecProtocol); ip.setProtocol(ipsecProtocol);

View File

@@ -527,5 +527,4 @@ log_time_end=2018-10-01 00:00:00
area_tag=location area_tag=location
isp_tag=isp isp_tag=isp
mmFileDigestLog=mmFileDigestLogs mmFileDigestLog=mmFileDigestLogs
ntcStreamMediaLog=ntcStreamMediaLogs ntcStreamMediaLog=ntcStreamMediaLogs
ipsec_protocol=8

View File

@@ -0,0 +1,3 @@
INSERT INTO sys_data_dictionary_item VALUES(2725,50,'ESP','ESP',0,1,1,63),(2726,51,'AH','AH',0,1,1,63)
UPDATE function_region_dict SET config_protocol='6,17,1,15,50,51' WHERE function_id=5 AND config_region_value='INLINE_IP_CB';

View File

@@ -0,0 +1,20 @@
delete from sys_dict_info where item_type=1;
INSERT INTO `sys_dict_info` (`sys_dict_id`, `item_type`, `item_code`, `item_value`, `item_desc`, `parent_id`, `is_leaf`, `level_no`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `is_initianlize`) VALUES ('8', '1', '7172', 'Astana', '阿斯塔纳市', '0', '1', '1', '1', '1', '2018-05-30 10:08:30', '1', '2018-05-30 10:11:48', '0');
INSERT INTO `sys_dict_info` (`sys_dict_id`, `item_type`, `item_code`, `item_value`, `item_desc`, `parent_id`, `is_leaf`, `level_no`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `is_initianlize`) VALUES ('9', '1', '7272', 'Almaty', '阿拉木图市', '0', '1', '1', '1', '1', '2018-05-30 10:09:00', '1', '2018-05-30 10:12:29', '0');
INSERT INTO `sys_dict_info` (`sys_dict_id`, `item_type`, `item_code`, `item_value`, `item_desc`, `parent_id`, `is_leaf`, `level_no`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `is_initianlize`) VALUES ('10', '1', '7292', 'Aktau', '阿克套', '0', '1', '1', '1', '1', '2018-05-30 10:12:12', '1', '2018-05-30 10:12:20', '0');
INSERT INTO `sys_dict_info` (`sys_dict_id`, `item_type`, `item_code`, `item_value`, `item_desc`, `parent_id`, `is_leaf`, `level_no`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `is_initianlize`) VALUES ('11', '1', '72822', 'Taldykurgan', '塔尔德库尔干', '0', '1', '1', '1', '1', '2018-05-30 10:13:42', '1', '2018-06-05 15:49:38', '0');
INSERT INTO `sys_dict_info` (`sys_dict_id`, `item_type`, `item_code`, `item_value`, `item_desc`, `parent_id`, `is_leaf`, `level_no`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `is_initianlize`) VALUES ('12', '1', '7132', 'Aktubinsk', '阿克图宾斯克', '0', '1', '1', '1', '1', '2018-05-30 10:14:36', '1', '2018-05-30 10:14:36', '0');
INSERT INTO `sys_dict_info` (`sys_dict_id`, `item_type`, `item_code`, `item_value`, `item_desc`, `parent_id`, `is_leaf`, `level_no`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `is_initianlize`) VALUES ('13', '1', '7122', 'Atyrau', '阿特劳州', '0', '1', '1', '1', '1', '2018-05-30 10:15:11', '1', '2018-05-30 10:15:45', '0');
INSERT INTO `sys_dict_info` (`sys_dict_id`, `item_type`, `item_code`, `item_value`, `item_desc`, `parent_id`, `is_leaf`, `level_no`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `is_initianlize`) VALUES ('14', '1', '7182', 'Pavlodar', '巴甫洛达尔州', '0', '1', '1', '1', '1', '2018-05-30 10:15:27', '1', '2018-05-30 10:15:38', '0');
INSERT INTO `sys_dict_info` (`sys_dict_id`, `item_type`, `item_code`, `item_value`, `item_desc`, `parent_id`, `is_leaf`, `level_no`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `is_initianlize`) VALUES ('15', '1', '7162', 'Kokshetau', '科克舍套', '0', '1', '1', '1', '1', '2018-05-30 10:15:59', '1', '2018-05-30 10:16:06', '0');
INSERT INTO `sys_dict_info` (`sys_dict_id`, `item_type`, `item_code`, `item_value`, `item_desc`, `parent_id`, `is_leaf`, `level_no`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `is_initianlize`) VALUES ('16', '1', '7212', 'Karaganda', '卡拉干达州', '0', '1', '1', '1', '1', '2018-05-30 10:16:24', '1', '2018-05-30 10:16:24', '0');
INSERT INTO `sys_dict_info` (`sys_dict_id`, `item_type`, `item_code`, `item_value`, `item_desc`, `parent_id`, `is_leaf`, `level_no`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `is_initianlize`) VALUES ('17', '1', '7142', 'Kostanay', '科斯塔奈州', '0', '1', '1', '1', '1', '2018-05-30 10:16:43', '1', '2018-05-30 10:16:43', '0');
INSERT INTO `sys_dict_info` (`sys_dict_id`, `item_type`, `item_code`, `item_value`, `item_desc`, `parent_id`, `is_leaf`, `level_no`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `is_initianlize`) VALUES ('18', '1', '7242', 'Kyzylorda', '克孜勒奥尔达州', '0', '1', '1', '1', '1', '2018-05-30 10:17:04', '1', '2018-05-30 10:22:54', '0');
INSERT INTO `sys_dict_info` (`sys_dict_id`, `item_type`, `item_code`, `item_value`, `item_desc`, `parent_id`, `is_leaf`, `level_no`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `is_initianlize`) VALUES ('19', '1', '7252', 'Shymkent', '奇姆肯特', '0', '1', '1', '1', '1', '2018-05-30 10:21:14', '1', '2018-05-30 10:21:14', '0');
INSERT INTO `sys_dict_info` (`sys_dict_id`, `item_type`, `item_code`, `item_value`, `item_desc`, `parent_id`, `is_leaf`, `level_no`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `is_initianlize`) VALUES ('20', '1', '7152', 'Petropavl', '彼得罗巴甫尔', '0', '1', '1', '1', '1', '2018-05-30 10:21:29', '1', '2018-05-30 10:22:37', '0');
INSERT INTO `sys_dict_info` (`sys_dict_id`, `item_type`, `item_code`, `item_value`, `item_desc`, `parent_id`, `is_leaf`, `level_no`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `is_initianlize`) VALUES ('21', '1', '7222', 'Semey', '塞米伊', '0', '1', '1', '1', '1', '2018-05-30 10:21:51', '1', '2018-05-30 10:22:45', '0');
INSERT INTO `sys_dict_info` (`sys_dict_id`, `item_type`, `item_code`, `item_value`, `item_desc`, `parent_id`, `is_leaf`, `level_no`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `is_initianlize`) VALUES ('22', '1', '7262', 'Taraz', '塔拉兹', '0', '1', '1', '1', '1', '2018-05-30 10:22:11', '1', '2018-05-30 10:22:11', '0');
INSERT INTO `sys_dict_info` (`sys_dict_id`, `item_type`, `item_code`, `item_value`, `item_desc`, `parent_id`, `is_leaf`, `level_no`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `is_initianlize`) VALUES ('23', '1', '7112', 'Uralsk', '乌拉尔斯克州', '0', '1', '1', '1', '1', '2018-05-30 10:22:28', '1', '2018-08-07 17:40:13', '0');
INSERT INTO `sys_dict_info` (`sys_dict_id`, `item_type`, `item_code`, `item_value`, `item_desc`, `parent_id`, `is_leaf`, `level_no`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `is_initianlize`) VALUES ('24', '1', '7232', 'Ust-Kamenogorsk', '乌斯季卡缅诺戈尔斯克', '0', '1', '1', '1', '1', '2018-10-15 12:59:02', '1', '2018-10-15 12:59:06', '0');
INSERT INTO `sys_dict_info` (`sys_dict_id`, `item_type`, `item_code`, `item_value`, `item_desc`, `parent_id`, `is_leaf`, `level_no`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `is_initianlize`) VALUES ('25', '1', '7102', 'Zhezkazgan', '杰兹卡兹甘', '0', '1', '1', '1', '1', '2018-10-15 13:02:07', '1', '2018-10-15 13:02:10', '0');
INSERT INTO `sys_dict_info` (`sys_dict_id`, `item_type`, `item_code`, `item_value`, `item_desc`, `parent_id`, `is_leaf`, `level_no`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `is_initianlize`) VALUES ('26', '1', '717', 'NationalCenter', '国家中心', '0', '1', '1', '1', '1', '2018-10-15 13:02:58', '1', '2018-10-15 13:03:01', '0');

View File

@@ -66,7 +66,7 @@ $(function(){
<div for="areaCode"></div> <div for="areaCode"></div>
</div> </div>
</div> </div>
<div class="col-md-6 hidden"> <div class="col-md-6 ">
<div class="form-group"> <div class="form-group">
<label class="control-label col-md-3"><spring:message code="isp"/></label> <label class="control-label col-md-3"><spring:message code="isp"/></label>
<div class="col-md-6"> <div class="col-md-6">
@@ -105,7 +105,7 @@ $(function(){
<div for="areaIsp[${status.index}].area"></div> <div for="areaIsp[${status.index}].area"></div>
</div> </div>
</div> </div>
<div class="col-md-6 hidden"> <div class="col-md-6 ">
<div class="form-group"> <div class="form-group">
<label class="control-label col-md-3"><spring:message code="isp"/></label> <label class="control-label col-md-3"><spring:message code="isp"/></label>
<div class="col-md-6"> <div class="col-md-6">

View File

@@ -64,20 +64,6 @@
</div> </div>
</div> </div>
</c:if> </c:if>
<div class="col-md-6 ipsecProtocol hidden">
<div class="form-group">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="ipsec_protocol"/></label>
<div class="col-md-6">
<select name="${cfgName}.userRegion1" class="selectpicker show-tick form-control required" disabled="disabled">
<option value=""><spring:message code="select"/></option>
<c:forEach items="${fns:getDictList('IPSEC_PROTOCOL')}" var="ipType">
<option value="${ipType.itemCode}" <c:if test="${_cfg.ipPortList[0].userRegion1==ipType.itemCode}">selected</c:if> ><spring:message code="${ipType.itemValue}"/></option>
</c:forEach>
</select>
</div>
<div for="${cfgName}.userRegion1"></div>
</div>
</div>
</div> </div>
<div class="row ip"> <div class="row ip">
<div class="col-md-6"> <div class="col-md-6">

View File

@@ -32,12 +32,6 @@
}else{ }else{
hideAction(1,asnRegionCode); hideAction(1,asnRegionCode);
} }
$("[name$='protocol']").each(function(){
showHideIPSECProtocol($(this));
});
$("[name$='protocol']").on("change",function(){
showHideIPSECProtocol($(this));
});
if(isAsn==0){ if(isAsn==0){
$("[class~='glyphicon-plus'][class~='ipPortList']").click(); $("[class~='glyphicon-plus'][class~='ipPortList']").click();
$("[class~='boxSolid'][class~='asn']").find(".glyphicon-remove").click(); $("[class~='boxSolid'][class~='asn']").find(".glyphicon-remove").click();
@@ -113,7 +107,6 @@
changeIPVal(tabInfo); changeIPVal(tabInfo);
} }
processAction(isAsn,tabInfo); processAction(isAsn,tabInfo);
$("[name$='protocol']").change();
/* if(tabInfo){ /* if(tabInfo){
tabInfo.find("[name$='cfgType']").val(cfgType); tabInfo.find("[name$='cfgType']").val(cfgType);
tabInfo.find("[name$='cfgRegionCode']").val(cfgRegionCode); tabInfo.find("[name$='cfgRegionCode']").val(cfgRegionCode);

View File

@@ -255,21 +255,34 @@ jQuery.validator.addMethod("ipCheck",function(value, element) {
var ipv6_ip_range_regexp= /^((::)|(([0-9A-Fa-f]{1,4}:){7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}|2[0-4]\d|25[0-5])){3})|(:(:[0-9A-Fa-f]{1,4}){0,5}:(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])(\.(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])){3}))$/;
var name=$(element).attr("name");
if(value.length==0||value.trim().length==0){return true;} if(value.length==0||value.trim().length==0){return true;}
var typeInt=$(element).parents(".row").parent(".row").find("select[name$='ipType']").val(); var ipTypeE,ipPatternE,srcIpAddressE,destIpAddressE;
var ipPattern=$(element).parents(".row").parent(".row").find("select[name$='ipPattern']").val(); if(name.indexOf("srcIpAddress")>-1){
var srcIpAddress=$(element).parents(".row").parent(".row").find("input[name$='srcIpAddress']").val(); srcIpAddressE=$(element);
var destIpAddress=$(element).parents(".row").parent(".row").find("input[name$='destIpAddress']").val(); ipTypeE=$("select[name='"+name.replace("srcIpAddress","ipType")+"']");
var srcIpIsHidden=$(element).parents(".row").parent(".row").find("input[name$='srcIpAddress']").is(":hidden"); ipPatternE=$("select[name='"+name.replace("srcIpAddress","ipPattern")+"']");
var destIpIsHidden=$(element).parents(".row").parent(".row").find("input[name$='destIpAddress']").is(":hidden"); destIpAddressE=$("input[name='"+name.replace("srcIpAddress","destIpAddress")+"']");
if(ipPattern==1){//ip/掩码格式 }else if(name.indexOf("destIpAddress")>-1){
destIpAddressE=$(element);
ipTypeE=$("select[name='"+name.replace("destIpAddress","ipType")+"']");
ipPatternE=$("select[name='"+name.replace("destIpAddress","ipPattern")+"']");
srcIpAddressE=$("input[name='"+name.replace("destIpAddress","srcIpAddress")+"']");
}
var typeInt=ipTypeE.val();
var ipPattern=ipPatternE.val();
var srcIpAddress=srcIpAddressE.val();
var destIpAddress=destIpAddressE.val();
var srcIpIsHidden=srcIpAddressE.is(":hidden");
var destIpIsHidden=destIpAddressE.is(":hidden");
var IPv4RangeDefault="0.0.0.0-0.0.0.0";
/*if(ipPattern==1){//ip/掩码格式
srcIpAddress=srcIpAddress.indexOf("/") >-1 ?srcIpAddress.split("/")[0] : srcIpAddress; srcIpAddress=srcIpAddress.indexOf("/") >-1 ?srcIpAddress.split("/")[0] : srcIpAddress;
destIpAddress=destIpAddress.indexOf("/") >-1 ?destIpAddress.split("/")[0] : destIpAddress; destIpAddress=destIpAddress.indexOf("/") >-1 ?destIpAddress.split("/")[0] : destIpAddress;
}else if (ipPattern==2){ }else if (ipPattern==2){
srcIpAddress=srcIpAddress.indexOf("-") >-1 ?srcIpAddress.split("-")[0] : srcIpAddress; srcIpAddress=srcIpAddress.indexOf("-") >-1 ?srcIpAddress.split("-")[0] : srcIpAddress;
destIpAddress=destIpAddress.indexOf("-") >-1 ?destIpAddress.split("-")[0] : destIpAddress; destIpAddress=destIpAddress.indexOf("-") >-1 ?destIpAddress.split("-")[0] : destIpAddress;
} }*/
if(srcIpIsHidden){ if(srcIpIsHidden){
if((srcIpAddress == destIpAddress)){ if((srcIpAddress == destIpAddress)){
$.validator.messages.ipCheck=$.validator.messages.destIpIsNotValue+destIpAddress; $.validator.messages.ipCheck=$.validator.messages.destIpIsNotValue+destIpAddress;
@@ -311,26 +324,28 @@ jQuery.validator.addMethod("ipCheck",function(value, element) {
//B类128.0.0.0-191.255.255.255 默认掩码255.255.0.0 //B类128.0.0.0-191.255.255.255 默认掩码255.255.0.0
//C类192.0.0.0-223.255.255.255 默认掩码255.255.255.0 //C类192.0.0.0-223.255.255.255 默认掩码255.255.255.0
if(ipv4_ip_range_regexp.test(value)){ if(ipv4_ip_range_regexp.test(value)){
if(/^(\d+)\.(\d+)\.(\d+)\.(\d+)\-(\d+)\.(\d+)\.(\d+)\.(\d+)$/.test(value)&&(RegExp.$1 <256 && RegExp.$2<256 && RegExp.$3<256 && RegExp.$4<256 && RegExp.$5 <256 && RegExp.$6<256 && RegExp.$7<256 && RegExp.$8<256)){ var startIp=value.split("-")[0];
var startPart0= RegExp.$1; var endIp=value.split("-")[1];
var startPart1= RegExp.$5; var startPart0=startIp.split(".")[0];
if((startPart0<128&&startPart1<128)||(startPart0>127&&startPart1>127&&startPart0<192&&startPart1<192) var startPart1=endIp.split(".")[0];
||(startPart0>191&&startPart1>191&&startPart0<224&&startPart1<224) if(value==IPv4RangeDefault){
||(startPart0>223&&startPart1>223&&startPart0<240&&startPart1<240) return true;
||(startPart0>239&&startPart1>239&&startPart0<256&&startPart1<256)){ }
}else{ if(startPart0>191&&startPart1>191&&startPart0<224&&startPart1<224){//仅允许C段IP
$.validator.messages.ipCheck=$.validator.messages.ipRange;
return false;
}
var startIp=value.split("-")[0];
var endIp=value.split("-")[1];
if(ipToNumber(startIp)<=ipToNumber(endIp)){//比较IP大小 if(ipToNumber(startIp)<=ipToNumber(endIp)){//比较IP大小
return true; if((startIp.split(".")[0]!=endIp.split(".")[0])||
(startIp.split(".")[1]!=endIp.split(".")[1])||
(startIp.split(".")[2]!=endIp.split(".")[2])){
$.validator.messages.ipCheck=$.validator.messages.netAddress;
}else{
return true;
}
}else{ }else{
$.validator.messages.ipCheck=$.validator.messages.ipRange1; $.validator.messages.ipCheck=$.validator.messages.ipRange1;
return false; return false;
} }
}else{ }else{
$.validator.messages.ipCheck=$.validator.messages.ipRange;
return false; return false;
} }
}else{ }else{
@@ -430,28 +445,28 @@ jQuery.validator.addMethod("ipCheck",function(value, element) {
//B类128.0.0.0-191.255.255.255 默认掩码255.255.0.0 //B类128.0.0.0-191.255.255.255 默认掩码255.255.0.0
//C类192.0.0.0-223.255.255.255 默认掩码255.255.255.0 //C类192.0.0.0-223.255.255.255 默认掩码255.255.255.0
if(ipv4_ip_range_regexp.test(value)){ if(ipv4_ip_range_regexp.test(value)){
if(/^(\d+)\.(\d+)\.(\d+)\.(\d+)\-(\d+)\.(\d+)\.(\d+)\.(\d+)$/.test(value)&&(RegExp.$1 <256 && RegExp.$2<256 && RegExp.$3<256 && RegExp.$4<256 && RegExp.$5 <256 && RegExp.$6<256 && RegExp.$7<256 && RegExp.$8<256)){ var startIp=value.split("-")[0];
var startPart0= RegExp.$1; var endIp=value.split("-")[1];
var startPart1= RegExp.$5; var startPart0=startIp.split(".")[0];
if((startPart0<128&&startPart1<128)||(startPart0>127&&startPart1>127&&startPart0<192&&startPart1<192) var startPart1=endIp.split(".")[0];
||(startPart0>191&&startPart1>191&&startPart0<224&&startPart1<224) if(value==IPv4RangeDefault){
||(startPart0>223&&startPart1>223&&startPart0<240&&startPart1<240) return true;
||(startPart0>239&&startPart1>239&&startPart0<256&&startPart1<256)){ }
}else{ if(startPart0>191&&startPart1>191&&startPart0<224&&startPart1<224){//仅允许C段IP
$.validator.messages.ipCheck=$.validator.messages.ipRange;
return false;
}
var startIp=value.split("-")[0];
var endIp=value.split("-")[1];
if(ipToNumber(startIp)<=ipToNumber(endIp)){//比较IP大小 if(ipToNumber(startIp)<=ipToNumber(endIp)){//比较IP大小
return true; if((startIp.split(".")[0]!=endIp.split(".")[0])||
(startIp.split(".")[1]!=endIp.split(".")[1])||
(startIp.split(".")[2]!=endIp.split(".")[2])){
$.validator.messages.ipCheck=$.validator.messages.netAddress;
}else{
return true;
}
}else{ }else{
$.validator.messages.ipCheck=$.validator.messages.ipRange1; $.validator.messages.ipCheck=$.validator.messages.ipRange1;
return false; return false;
} }
}else{ }else{
$.validator.messages.ipCheck=$.validator.messages.ip; $.validator.messages.ipCheck=$.validator.messages.ipRange;
return false; return false;
} }
}else{ }else{
@@ -578,7 +593,6 @@ jQuery.validator.addMethod("ipCheck",function(value, element) {
} }
} }
}else if(name.indexOf("destIpAddress")>-1){ }else if(name.indexOf("destIpAddress")>-1){
console.log("server ip must ipv4");
if(ipPattern==1){//ip/掩码格式 if(ipPattern==1){//ip/掩码格式
if(this.optional(element)||(/^(\d+)\.(\d+)\.(\d+)\.(\d+)\/(\d+)$/.test(value) && (RegExp.$1 <256 && RegExp.$2<256 && RegExp.$3<256 && RegExp.$4<256 && RegExp.$5<=32))){ if(this.optional(element)||(/^(\d+)\.(\d+)\.(\d+)\.(\d+)\/(\d+)$/.test(value) && (RegExp.$1 <256 && RegExp.$2<256 && RegExp.$3<256 && RegExp.$4<256 && RegExp.$5<=32))){
if(ipv4_ip_subnet_regexp.test(value)){ if(ipv4_ip_subnet_regexp.test(value)){
@@ -599,28 +613,28 @@ jQuery.validator.addMethod("ipCheck",function(value, element) {
//B类128.0.0.0-191.255.255.255 默认掩码255.255.0.0 //B类128.0.0.0-191.255.255.255 默认掩码255.255.0.0
//C类192.0.0.0-223.255.255.255 默认掩码255.255.255.0 //C类192.0.0.0-223.255.255.255 默认掩码255.255.255.0
if(ipv4_ip_range_regexp.test(value)){ if(ipv4_ip_range_regexp.test(value)){
if(/^(\d+)\.(\d+)\.(\d+)\.(\d+)\-(\d+)\.(\d+)\.(\d+)\.(\d+)$/.test(value)&&(RegExp.$1 <256 && RegExp.$2<256 && RegExp.$3<256 && RegExp.$4<256 && RegExp.$5 <256 && RegExp.$6<256 && RegExp.$7<256 && RegExp.$8<256)){ var startIp=value.split("-")[0];
var startPart0= RegExp.$1; var endIp=value.split("-")[1];
var startPart1= RegExp.$5; var startPart0=startIp.split(".")[0];
if((startPart0<128&&startPart1<128)||(startPart0>127&&startPart1>127&&startPart0<192&&startPart1<192) var startPart1=endIp.split(".")[0];
||(startPart0>191&&startPart1>191&&startPart0<224&&startPart1<224) if(value==IPv4RangeDefault){
||(startPart0>223&&startPart1>223&&startPart0<240&&startPart1<240) return true;
||(startPart0>239&&startPart1>239&&startPart0<256&&startPart1<256)){ }
}else{ if(startPart0>191&&startPart1>191&&startPart0<224&&startPart1<224){//仅允许C段IP
$.validator.messages.ipCheck=$.validator.messages.ipRange;
return false;
}
var startIp=value.split("-")[0];
var endIp=value.split("-")[1];
if(ipToNumber(startIp)<=ipToNumber(endIp)){//比较IP大小 if(ipToNumber(startIp)<=ipToNumber(endIp)){//比较IP大小
return true; if((startIp.split(".")[0]!=endIp.split(".")[0])||
(startIp.split(".")[1]!=endIp.split(".")[1])||
(startIp.split(".")[2]!=endIp.split(".")[2])){
$.validator.messages.ipCheck=$.validator.messages.netAddress;
}else{
return true;
}
}else{ }else{
$.validator.messages.ipCheck=$.validator.messages.ipRange1; $.validator.messages.ipCheck=$.validator.messages.ipRange1;
return false; return false;
} }
}else{ }else{
$.validator.messages.ipCheck=$.validator.messages.ip; $.validator.messages.ipCheck=$.validator.messages.ipRange;
return false; return false;
} }
}else{ }else{
@@ -652,28 +666,28 @@ jQuery.validator.addMethod("ipCheck",function(value, element) {
//B类128.0.0.0-191.255.255.255 默认掩码255.255.0.0 //B类128.0.0.0-191.255.255.255 默认掩码255.255.0.0
//C类192.0.0.0-223.255.255.255 默认掩码255.255.255.0 //C类192.0.0.0-223.255.255.255 默认掩码255.255.255.0
if(ipv4_ip_range_regexp.test(value)){ if(ipv4_ip_range_regexp.test(value)){
if(/^(\d+)\.(\d+)\.(\d+)\.(\d+)\-(\d+)\.(\d+)\.(\d+)\.(\d+)$/.test(value)&&(RegExp.$1 <256 && RegExp.$2<256 && RegExp.$3<256 && RegExp.$4<256 && RegExp.$5 <256 && RegExp.$6<256 && RegExp.$7<256 && RegExp.$8<256)){ var startIp=value.split("-")[0];
var startPart0= RegExp.$1; var endIp=value.split("-")[1];
var startPart1= RegExp.$5; var startPart0=startIp.split(".")[0];
if((startPart0<128&&startPart1<128)||(startPart0>127&&startPart1>127&&startPart0<192&&startPart1<192) var startPart1=endIp.split(".")[0];
||(startPart0>191&&startPart1>191&&startPart0<224&&startPart1<224) if(value==IPv4RangeDefault){
||(startPart0>223&&startPart1>223&&startPart0<240&&startPart1<240) return true;
||(startPart0>239&&startPart1>239&&startPart0<256&&startPart1<256)){ }
}else{ if(startPart0>191&&startPart1>191&&startPart0<224&&startPart1<224){//仅允许C段IP
$.validator.messages.ipCheck=$.validator.messages.ipRange;
return false;
}
var startIp=value.split("-")[0];
var endIp=value.split("-")[1];
if(ipToNumber(startIp)<=ipToNumber(endIp)){//比较IP大小 if(ipToNumber(startIp)<=ipToNumber(endIp)){//比较IP大小
return true; if((startIp.split(".")[0]!=endIp.split(".")[0])||
(startIp.split(".")[1]!=endIp.split(".")[1])||
(startIp.split(".")[2]!=endIp.split(".")[2])){
$.validator.messages.ipCheck=$.validator.messages.netAddress;
}else{
return true;
}
}else{ }else{
$.validator.messages.ipCheck=$.validator.messages.ipRange1; $.validator.messages.ipCheck=$.validator.messages.ipRange1;
return false; return false;
} }
}else{ }else{
$.validator.messages.ipCheck=$.validator.messages.ip; $.validator.messages.ipCheck=$.validator.messages.ipRange;
return false; return false;
} }
}else if(ipv6_ip_subnet_regexp.test(value)){ }else if(ipv6_ip_subnet_regexp.test(value)){

View File

@@ -35,7 +35,7 @@
IpNotEqDestIp:" can't be the same", IpNotEqDestIp:" can't be the same",
srcIpIsNotValue:"Client IP can't be ", srcIpIsNotValue:"Client IP can't be ",
destIpIsNotValue:"Server IP can't be ", destIpIsNotValue:"Server IP can't be ",
ipRange:"Wrong IP format or start IP and end IP in two subnet", ipRange:"Wrong IP format or start IP and end IP in C subnet",
ipRange1:"start IP should smaller than end IP", ipRange1:"start IP should smaller than end IP",
portCheck:"Please enter a correct port", portCheck:"Please enter a correct port",
notStartZero:"Please enter a valid Integer", notStartZero:"Please enter a valid Integer",
@@ -74,6 +74,7 @@
log_1_hour:"Log For The Last Hour", log_1_hour:"Log For The Last Hour",
input:"Please Enter ", input:"Please Enter ",
protocolPort:"TCP protocol or UDP protocol must be chosen when port is greater than 0", protocolPort:"TCP protocol or UDP protocol must be chosen when port is greater than 0",
protocolPort1:"Only when TCP protocol or UDP protocol is chosen can port greater than 0,ALL protocol has no limit" protocolPort1:"Only when TCP protocol or UDP protocol is chosen can port greater than 0,ALL protocol has no limit",
netAddress:"The class C type of IP addresses must has the same network number bit field"
}); });
}(jQuery)); }(jQuery));

View File

@@ -35,7 +35,7 @@
IpNotEqDestIp:"Не может быть одинаковым", IpNotEqDestIp:"Не может быть одинаковым",
srcIpIsNotValue:"Исходный IP не может быть ", srcIpIsNotValue:"Исходный IP не может быть ",
destIpIsNotValue:"IP назначение не может быть", destIpIsNotValue:"IP назначение не может быть",
ipRange:"Неверный IP-формат или начальный IP и конечный IP в двух подсети", ipRange:"IP范围格式错误或者起始IP与结束IP不在C网段",
ipRange1:"Начальный IP должен быть меньше конечного IP", ipRange1:"Начальный IP должен быть меньше конечного IP",
portCheck: "Введите  правильный  порт.", portCheck: "Введите  правильный  порт.",
notStartZero:"Введите действительное целое число", notStartZero:"Введите действительное целое число",
@@ -74,6 +74,7 @@
log_1_hour:"Log For The Last Hour", log_1_hour:"Log For The Last Hour",
input:"Please Enter ", input:"Please Enter ",
protocolPort:"TCP protocol or UDP protocol must be chosen when port is greater than 0", protocolPort:"TCP protocol or UDP protocol must be chosen when port is greater than 0",
protocolPort1:"Only when TCP protocol or UDP protocol is chosen can port greater than 0,ALL protocol has no limit" protocolPort1:"Only when TCP protocol or UDP protocol is chosen can port greater than 0,ALL protocol has no limit",
netAddress:"C类IP地址网络位必须相同"
}); });
}(jQuery)); }(jQuery));

View File

@@ -35,7 +35,7 @@
IpNotEqDestIp:" 不能相同", IpNotEqDestIp:" 不能相同",
srcIpIsNotValue:"源IP不能为 ", srcIpIsNotValue:"源IP不能为 ",
destIpIsNotValue:"目的IP不能为", destIpIsNotValue:"目的IP不能为",
ipRange:"IP范围格式错误或者起始IP与结束IP不在同一网段", ipRange:"IP范围格式错误或者起始IP与结束IP不在C网段",
ipRange1:"起始IP值应小于结束IP值", ipRange1:"起始IP值应小于结束IP值",
portCheck:"请填写正确的端口", portCheck:"请填写正确的端口",
notStartZero:"请填写正确的数值", notStartZero:"请填写正确的数值",
@@ -74,6 +74,7 @@
log_1_hour:"1小时日志量", log_1_hour:"1小时日志量",
input:"请输入 ", input:"请输入 ",
protocolPort:"端口大于0时必须选择TCP协议或者UDP协议", protocolPort:"端口大于0时必须选择TCP协议或者UDP协议",
protocolPort1:"只有tcp,udp协议端口号可以不为0,全部协议无限制" protocolPort1:"只有tcp,udp协议端口号可以不为0,全部协议无限制",
netAddress:"C类IP地址网络位必须相同"
}); });
}(jQuery)); }(jQuery));

View File

@@ -1302,16 +1302,16 @@ var viewAreaInfo=function(path,areaEffectiveIds,compileId){
title=$.validator.messages.area;//+" "+$.validator.messages.isp; title=$.validator.messages.area;//+" "+$.validator.messages.isp;
html+="<table class='table table-striped table-bordered table-condensed' style='margin-left: 10px; width: 96%;margin-top: 15px;'>"; html+="<table class='table table-striped table-bordered table-condensed' style='margin-left: 10px; width: 96%;margin-top: 15px;'>";
html+="<thead>"; html+="<thead>";
html+="<th style='width:50%;padding-right:0px'>"+$.validator.messages.area+"</th>";/* + html+="<th style='width:50%;padding-right:0px'>"+$.validator.messages.area+"</th>" +
"<th style='width:50%;padding-right:0px'>"+$.validator.messages.isp+"</th>";*/ "<th style='width:50%;padding-right:0px'>"+$.validator.messages.isp+"</th>";
html+="</thead>"; html+="</thead>";
html+="<tbody>"; html+="<tbody>";
for(i=0;i<data.areaIsps.length;i++){ for(i=0;i<data.areaIsps.length;i++){
html+="<tr>"; html+="<tr>";
html+="<td>"+data.areaIsps[i].areaName; html+="<td>"+data.areaIsps[i].areaName;
html+="</td>"; html+="</td>";
/*html+="<td>"+data.areaIsps[i].ispName; html+="<td>"+data.areaIsps[i].ispName;
html+="</td>";*/ html+="</td>";
html+="</tr>"; html+="</tr>";
} }
html+="</tbody>"; html+="</tbody>";