(1)ip地址功能整个asn功能
(2)ip域处理提到单独的js ipRegion.js中
This commit is contained in:
@@ -95,7 +95,7 @@
|
||||
<script src="${pageContext.request.contextPath}/static/global/scripts/common.js" type="text/javascript"></script>
|
||||
<script src="${pageContext.request.contextPath}/static/global/scripts/jquery.tagsinput.js" type="text/javascript"></script>
|
||||
<script src="${pageContext.request.contextPath}/static/global/scripts/app.js" type="text/javascript"></script>
|
||||
|
||||
<script src="${pageContext.request.contextPath}/static/global/scripts/ipRegion.js" type="text/javascript"></script>
|
||||
<!-- 文件导入 -->
|
||||
<script src="${pageContext.request.contextPath}/static/global/plugins/bootstrap-fileupload/js/bootstrap-fileupload.js" type="text/javascript"></script>
|
||||
<script src="${pageContext.request.contextPath}/static/global/plugins/bootstrap-fileupload/js/jquery.cookie.min.js" type="text/javascript"></script>
|
||||
@@ -103,4 +103,4 @@
|
||||
<script src="${pageContext.request.contextPath}/static/global/plugins/jquery-tree-multiselect/jquery.tree-multiselect.js" type="text/javascript"></script>
|
||||
|
||||
<!-- 日志界面 -->
|
||||
<script src="${pageContext.request.contextPath}/static/pages/scripts/pageLogs.js" type="text/javascript"></script>
|
||||
<script src="${pageContext.request.contextPath}/static/pages/scripts/pageLogs.js" type="text/javascript"></script>
|
||||
|
||||
@@ -17,26 +17,64 @@
|
||||
$("#cancel").on("click", function() {
|
||||
window.history.back();
|
||||
});*/
|
||||
$(".glyphicon-plus").first().click();
|
||||
$(".ipPortList").find(".glyphicon-remove").addClass("hidden")
|
||||
var action=$(".action:checked").val();
|
||||
/*if(action==32){
|
||||
$(".subscribeId").find(".glyphicon-remove").click();
|
||||
$(".subscribeId").prev("h4").addClass("hidden");
|
||||
}*/
|
||||
var regionCodes=$(".action:checked").attr("regionCode").split(",");
|
||||
$("h4[class*='ipPortListTitle']").each(function(){
|
||||
var has=false;
|
||||
for(var ind in regionCodes){
|
||||
if($(this).hasClass("ipPortListTitle"+regionCodes[ind])){
|
||||
has=true;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
$(this).html("");
|
||||
var asnRegionCode,configType;
|
||||
$("input[id^='cfgRegionCode']").each(function(){
|
||||
var regionCode=$(this).val();
|
||||
if("asn"==$(this).attr("servicetype")){
|
||||
asnRegionCode=$(this).val();
|
||||
}
|
||||
});
|
||||
processAction($(".ipPortList"));
|
||||
$(".configType a").on("click",function(){
|
||||
if($(this).attr("id")=="ipCfgTab"){
|
||||
configType="ip";
|
||||
$(".glyphicon-plus").first().click();
|
||||
$(".ipPortList").find(".glyphicon-remove").addClass("hidden")
|
||||
hideAction(1,asnRegionCode);
|
||||
}else{
|
||||
configType="asn";
|
||||
hideAction(0,asnRegionCode);
|
||||
}
|
||||
var region = ($(this).attr("for"));
|
||||
if(region=="ipaddr"){
|
||||
$(".asn").addClass("hidden").addClass("disabled");
|
||||
$(".ipaddr").removeClass("hidden").removeClass("disabled");
|
||||
}else{
|
||||
$(".ipaddr").addClass("hidden").addClass("disabled");
|
||||
$(".asn").removeClass("hidden").removeClass("disabled");
|
||||
}
|
||||
});
|
||||
//切换tab
|
||||
if("${_cfg.cfgId}"==''){
|
||||
configType='ip';
|
||||
$("#ipCfgTab").click();
|
||||
}else if("${_cfg.userRegion4}"==""){
|
||||
configType='ip';
|
||||
$("#ipCfgTab").click();
|
||||
}else{
|
||||
configType='asn';
|
||||
$("#ansCfgTab").click();
|
||||
}
|
||||
if(configType!='asn'){
|
||||
$(".glyphicon-plus").first().click();
|
||||
$(".ipPortList").find(".glyphicon-remove").addClass("hidden")
|
||||
/*if(action==32){
|
||||
$(".subscribeId").find(".glyphicon-remove").click();
|
||||
$(".subscribeId").prev("h4").addClass("hidden");
|
||||
}*/
|
||||
var regionCodes=$(".action:checked").attr("regionCode").split(",");
|
||||
$("h4[class*='ipPortListTitle']").each(function(){
|
||||
var has=false;
|
||||
for(var ind in regionCodes){
|
||||
if($(this).hasClass("ipPortListTitle"+regionCodes[ind])){
|
||||
has=true;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
$(this).addClass("hidden");
|
||||
}
|
||||
});
|
||||
processAction(configType,$(".ipPortList"));
|
||||
}
|
||||
$(".action").on("change", function() {
|
||||
$("#serviceId").val($(this).attr("serviceId"));
|
||||
$("#protocolId").val($(this).attr("protocolId"));
|
||||
@@ -57,8 +95,24 @@
|
||||
$("h4[class*='ipPortListTitle']").each(function(){
|
||||
$(this).find(".ipPortTitle").html(i18nCode);
|
||||
});
|
||||
$("input[id^='cfgRegionCode']").each(function(){
|
||||
if($(this).attr("id")!=("cfgRegionCode"+cfgRegionCode)){
|
||||
$(this).removeAttr("name");
|
||||
$("#cfgType"+$(this).val()).removeAttr("name");
|
||||
}else{
|
||||
$(this).attr("name",'cfgRegionCode');
|
||||
$("#cfgType"+$(this).val()).attr("name",'cfgType');
|
||||
}
|
||||
});
|
||||
var tabInfo=$(".ipPortList");
|
||||
processAction(tabInfo);
|
||||
if(tabInfo){
|
||||
tabInfo.find("[name$='cfgType']").val(cfgType);
|
||||
tabInfo.find("[name$='cfgRegionCode']").val(cfgRegionCode);
|
||||
}
|
||||
if(configType!='asn'){
|
||||
changeIPVal(tabInfo);
|
||||
}
|
||||
processAction(configType,tabInfo);
|
||||
/* if(tabInfo){
|
||||
tabInfo.find("[name$='cfgType']").val(cfgType);
|
||||
tabInfo.find("[name$='cfgRegionCode']").val(cfgRegionCode);
|
||||
@@ -86,6 +140,9 @@
|
||||
});
|
||||
$("#serviceId").val($(".action:checked").attr("serviceId"));
|
||||
$("#protocolId").val($(".action:checked").attr("protocolId"));
|
||||
$(".ratelimitAction").find("input[name='userRegion1']").on("change",function(){
|
||||
switchRateLimitType();
|
||||
})
|
||||
$("#cfgFrom").validate(
|
||||
{
|
||||
errorPlacement : function(error, element) {
|
||||
@@ -145,11 +202,15 @@
|
||||
flag=flag1;
|
||||
}
|
||||
if(flag){
|
||||
if(configType!='asn'){
|
||||
$("input[name='userRegion4']").attr("disabled",true);
|
||||
}
|
||||
$("input[name$='userRegion1']").attr("disabled",false);
|
||||
$("input[name$='exprType']").attr("disabled",false);
|
||||
//将disable属性的元素删除
|
||||
$(".disabled").each(function(){
|
||||
$(this).remove();
|
||||
});
|
||||
$("input[name$='exprType']").attr("disabled",false);
|
||||
loading('onloading...');
|
||||
form.submit();
|
||||
}else{
|
||||
@@ -185,41 +246,126 @@
|
||||
}); */
|
||||
$("." + addBtnClassName).removeClass("hidden");
|
||||
}
|
||||
var processAction=function(obj){
|
||||
var o=$(obj)
|
||||
if(o){
|
||||
var action=$(".action:checked").val();
|
||||
/*处理协议*/
|
||||
var selectedProtocol=o.find("select[name$='protocol'] option:selected").attr("value");
|
||||
//先清空,再添加
|
||||
o.find("select[name$='protocol']").empty();
|
||||
if(action==32){
|
||||
$.ipcommon.protocol.each(function(){
|
||||
if($(this).attr("value")==0||$(this).attr("value")==6||$(this).attr("value")==17||$(this).attr("value")==1||$(this).attr("value")==8||$(this).attr("value")==15){
|
||||
o.find("select[name$='protocol']").append($(this));
|
||||
}
|
||||
})
|
||||
}else if(action==16){
|
||||
$.ipcommon.protocol.each(function(){
|
||||
if($(this).attr("value")==0||$(this).attr("value")==6){
|
||||
o.find("select[name$='protocol']").append($(this));
|
||||
}
|
||||
})
|
||||
}else if(action==64){
|
||||
$.ipcommon.protocol.each(function(){
|
||||
if($(this).attr("value")==0||$(this).attr("value")==6||$(this).attr("value")==17){
|
||||
o.find("select[name$='protocol']").append($(this));
|
||||
}
|
||||
})
|
||||
|
||||
var hideAction=function(isHide,regionCode){
|
||||
var action=$(".action:checked").val();
|
||||
var serviceId=$(".action:checked").attr("serviceId");
|
||||
$(".action").each(function(){
|
||||
var regionCodeArr=$(this).attr("regionCode").split(',');
|
||||
var has=false;
|
||||
for(var code in regionCodeArr){
|
||||
if(regionCode==regionCodeArr[code]){
|
||||
has=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
o.find("select[name$='protocol']").selectpicker("refresh");
|
||||
//切换后如果没找到选项,选任意协议
|
||||
if(o.find("select[name$='protocol'] option[value='"+selectedProtocol+"']").length>0){
|
||||
o.find("select[name$='protocol']").selectpicker("val",selectedProtocol);
|
||||
if(has){
|
||||
if(isHide==1){
|
||||
$(this).attr("disabled","disabled");
|
||||
$(this).parent(".radio-inline").addClass("hidden");
|
||||
}else{
|
||||
$(this).removeAttr("disabled");
|
||||
$(this).parent(".radio-inline").removeClass("hidden");
|
||||
}
|
||||
}else{
|
||||
o.find("select[name$='protocol']").selectpicker("val",0);
|
||||
if(isHide==1){
|
||||
$(this).removeAttr("disabled");
|
||||
$(this).parent(".radio-inline").removeClass("hidden");
|
||||
}else{
|
||||
$(this).attr("disabled","disabled");
|
||||
$(this).parent(".radio-inline").addClass("hidden");
|
||||
}
|
||||
}
|
||||
});
|
||||
if($("[class*='action'][value='"+action+"']:visible").length>0){
|
||||
$("[class*='action'][value='"+action+"']:visible").click();
|
||||
}else{
|
||||
$(".action:visible").get(0).click();
|
||||
}
|
||||
var reginosNew=$(".action:checked").attr("regioncode").split(",");
|
||||
$("input[id^='cfgRegionCode']").each(function(){
|
||||
var has=false;
|
||||
for(var code in reginosNew){
|
||||
if($(this).val()==reginosNew[code]){
|
||||
has=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(has){
|
||||
$(this).attr("name","cfgRegionCode");
|
||||
$("#cfgType"+$(this).val()).attr("name","cfgType");
|
||||
}else{
|
||||
$(this).removeAttr("name");
|
||||
$("#cfgType"+$(this).val()).removeAttr("name");
|
||||
}
|
||||
});
|
||||
}
|
||||
var processAction=function(configType,obj){
|
||||
var action=$(".action:checked").val();
|
||||
if(configType!='asn'){
|
||||
var o=$(obj)
|
||||
if(o){
|
||||
/*处理协议*/
|
||||
var selectedProtocol=o.find("select[name$='protocol'] option:selected").attr("value");
|
||||
if(action==32){
|
||||
//先清空,再添加
|
||||
/* o.find("select[name$='protocol']").empty();
|
||||
$.ipcommon.protocol.each(function(){
|
||||
if($(this).attr("value")==0||$(this).attr("value")==6||$(this).attr("value")==17||$(this).attr("value")==1||$(this).attr("value")==8||$(this).attr("value")==15){
|
||||
o.find("select[name$='protocol']").append($(this));
|
||||
}
|
||||
}) */
|
||||
$(".ratelimitAction").addClass("hidden");
|
||||
$(".ratelimitAction").find("input[name^='userRegion'],select[name^='userRegion']").attr("disabled",true);
|
||||
}else if(action==16){
|
||||
//先清空,再添加
|
||||
o.find("select[name$='protocol']").empty();
|
||||
$.ipcommon.protocol.each(function(){
|
||||
if($(this).attr("value")==0||$(this).attr("value")==6){
|
||||
o.find("select[name$='protocol']").append($(this));
|
||||
}
|
||||
})
|
||||
$(".ratelimitAction").addClass("hidden");
|
||||
$(".ratelimitAction").find("input[name^='userRegion'],select[name^='userRegion']").attr("disabled",true);
|
||||
}else if(action==64){
|
||||
//先清空,再添加
|
||||
/* o.find("select[name$='protocol']").empty();
|
||||
$.ipcommon.protocol.each(function(){
|
||||
if($(this).attr("value")==0||$(this).attr("value")==6||$(this).attr("value")==17){
|
||||
o.find("select[name$='protocol']").append($(this));
|
||||
}
|
||||
}) */
|
||||
$(".ratelimitAction").removeClass("hidden");
|
||||
var rateLimitType=$("input[name='userRegion1']:checked").val();
|
||||
if(rateLimitType == 0){//丢包率
|
||||
$(".bandwith").find("input[name='userRegion3']").attr("disabled",true);
|
||||
$(".droprate").find("input[name='userRegion2']").removeAttr("disabled");
|
||||
}
|
||||
if(rateLimitType == 1){//带宽
|
||||
$(".bandwith").find("input[name='userRegion3']").removeAttr("disabled");
|
||||
$(".droprate").find("input[name='userRegion2']").attr("disabled",true);
|
||||
}
|
||||
}else if(action==1){
|
||||
//先清空,再添加
|
||||
o.find("select[name$='protocol']").empty();
|
||||
$.ipcommon.protocol.each(function(){
|
||||
if($(this).attr("value")==0||$(this).attr("value")==6||$(this).attr("value")==17){
|
||||
o.find("select[name$='protocol']").append($(this));
|
||||
}
|
||||
})
|
||||
$(".ratelimitAction").addClass("hidden");
|
||||
$(".ratelimitAction").find("input[name^='userRegion'],select[name^='userRegion']").attr("disabled",true);
|
||||
}
|
||||
o.find("select[name$='protocol']").selectpicker("refresh");
|
||||
//切换后如果没找到选项,选任意协议
|
||||
if(o.find("select[name$='protocol'] option[value='"+selectedProtocol+"']").length>0){
|
||||
o.find("select[name$='protocol']").selectpicker("val",selectedProtocol);
|
||||
}else{
|
||||
o.find("select[name$='protocol']").selectpicker("val",0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
@@ -227,7 +373,7 @@ var processAction=function(obj){
|
||||
<span id="keywordError" style="display:none"><spring:message code="required"></spring:message></span>
|
||||
<span id="tagsinputTip" style="display:none"><spring:message code="multiple_keywords_tip"></spring:message></span>
|
||||
<div class="page-content">
|
||||
<%-- <h3 class="page-title">
|
||||
<%-- <h3 class="page-title">
|
||||
<spring:message code="ip_control"></spring:message>
|
||||
</h3> --%>
|
||||
<div class="row">
|
||||
@@ -270,178 +416,264 @@ var processAction=function(obj){
|
||||
value="${region.configRegionCode}">
|
||||
</c:forEach>
|
||||
<div class="form-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><spring:message
|
||||
code="config_describe" /></label>
|
||||
<div class="col-md-6">
|
||||
<input class="form-control" type="text" name="cfgDesc"
|
||||
value="${_cfg.cfgDesc}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><spring:message
|
||||
code="action" /></label>
|
||||
<div class="col-md-6">
|
||||
<c:forEach items="${serviceList}" var="service"
|
||||
varStatus="satus">
|
||||
<label class="radio-inline"> <c:if
|
||||
test="${_cfg.functionId eq service.functionId}">
|
||||
<input type="radio" name="action"
|
||||
serviceId="${service.serviceId }"
|
||||
protocolId="${service.protocolId }"
|
||||
regionCode="${service.regionCode }"
|
||||
value="${service.action }" class="required action"
|
||||
<c:if test="${_cfg.action==service.action || (_cfg.action==null && satus.index==0)}">checked</c:if>>
|
||||
<c:forEach items="${fns:getDictList('SERVICE_ACTION') }" var="dict">
|
||||
<c:if test="${dict.itemCode eq service.action }">
|
||||
<spring:message code="${dict.itemValue }"/>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:if>
|
||||
</label>
|
||||
</c:forEach>
|
||||
</div>
|
||||
<div for="action"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- dolog begin-->
|
||||
<div class="row doLog">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><spring:message code="do_log" /></label>
|
||||
<c:forEach items="${fns:getDictList('DO_LOG') }" var="dict">
|
||||
<c:choose>
|
||||
<c:when test="${dict.itemCode eq _cfg.doLog}">
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="doLog" checked value="${dict.itemCode}" ><spring:message code="${dict.itemValue}"/>
|
||||
</label>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="doLog" value="${dict.itemCode}" ><spring:message code="${dict.itemValue}"/>
|
||||
</label>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
|
||||
</c:forEach>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- dolog end-->
|
||||
<c:set var="ipCfgIndex" value="0"></c:set>
|
||||
<c:set var="strCfgIndex" value="0"></c:set>
|
||||
<c:set var="subscribeIdIndex" value="0"></c:set>
|
||||
<c:forEach items="${regionList}" var="region" varStatus="status">
|
||||
<c:if test="${region.regionType eq 1 }">
|
||||
<c:if test="${ipCfgIndex==0}">
|
||||
<!--ip info-->
|
||||
<c:set var="tabName" value="${region.configRegionValue}Tab"></c:set>
|
||||
<h4 class="form-section ipPortListTitle${region.configRegionCode}">
|
||||
<span class="ipPortTitle"><spring:message code="${region.configRegionValue}" /></span>
|
||||
<small> <span
|
||||
class="glyphicon glyphicon-plus ${tabName}Add"
|
||||
onClick="addContent(this,'${tabName}')" title="add"></span></small>
|
||||
</h4>
|
||||
<c:set var="cfgName" value="ipPortList[${ipCfgIndex}]"></c:set>
|
||||
<%-- <c:set var="regionValue" value="${region.configRegionValue}"></c:set> --%>
|
||||
<c:choose>
|
||||
<c:when test="${fn:length(_cfg.ipPortList)>0 and ipCfgIndex<fn:length(_cfg.ipPortList) }">
|
||||
<c:forEach items="${_cfg.ipPortList}" var="ipPort">
|
||||
<c:if test="${region.configRegionValue eq ipPort.cfgType }">
|
||||
<div class="row boxSolid ipPortList ${tabName}${status.index}">
|
||||
<%@include file="/WEB-INF/views/cfg/ipCfgForm.jsp"%>
|
||||
</div>
|
||||
<c:set var="ipCfgIndex" value="${ipCfgIndex+1}"></c:set>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<div class="row boxSolid ipPortList ${tabName}${status.index} hidden disabled">
|
||||
<%@include file="/WEB-INF/views/cfg/ipCfgForm.jsp"%>
|
||||
</div>
|
||||
<c:set var="ipCfgIndex" value="${ipCfgIndex+1 }"></c:set>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</c:if>
|
||||
<!--/ip info-->
|
||||
</c:if>
|
||||
<c:if test="${region.regionType eq 2 }">
|
||||
<c:set var="tabName" value="${region.configRegionValue}Tab"></c:set>
|
||||
<h4 class="form-section">
|
||||
<spring:message code="${region.configRegionValue}" />
|
||||
<small> <span
|
||||
class="glyphicon glyphicon-plus ${tabName}Add"
|
||||
onClick="addContent(this,'${tabName}')" title="add"></span></small>
|
||||
</h4>
|
||||
<c:if test="${region.configServiceType eq 'subscribe_id' }">
|
||||
<c:set var="cfgName" value="ntcSubscribeIdCfgList[${subscribeIdIndex}]"></c:set>
|
||||
</c:if>
|
||||
<%-- <c:set var="regionValue" value="${region.configRegionValue}"></c:set> --%>
|
||||
<c:choose>
|
||||
<c:when test="${fn:length(_cfg.ntcSubscribeIdCfgList)>0}">
|
||||
<c:set var="isBreak" value="false" ></c:set>
|
||||
<c:forEach items="${_cfg.ntcSubscribeIdCfgList}" var="cfg">
|
||||
<c:choose>
|
||||
<c:when test="${region.configRegionValue eq cfg.cfgType and !isBreak}">
|
||||
<div class="row boxSolid subscribeId ${tabName}${status.index}">
|
||||
<%@include file="/WEB-INF/views/cfg/complexCfgForm.jsp"%>
|
||||
<div class="portlet-body flip-scroll">
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<div class="tabbable tabbable-custom tabs-left">
|
||||
<!-- Only required for left/right tabs -->
|
||||
<ul class="nav nav-tabs tabs-left">
|
||||
<li class="configType"><a href="#ip_tab" id="ipCfgTab"
|
||||
data-toggle="tab" for="ipaddr"
|
||||
data_dldk="<spring:message code="IP"/>"><spring:message
|
||||
code="IP" /></a></li>
|
||||
<li class="configType"><a href="#asn_tab" data-toggle="tab" for="asn" id="ansCfgTab"
|
||||
data_dldk="<spring:message code="ASN"/>"><spring:message
|
||||
code="ASN" /></a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><spring:message
|
||||
code="config_describe" /></label>
|
||||
<div class="col-md-6">
|
||||
<input class="form-control" type="text" name="cfgDesc"
|
||||
value="${_cfg.cfgDesc}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<c:set var="isBreak" value="true" ></c:set>
|
||||
<c:set var="subscribeIdIndex" value="${subscribeIdIndex+1 }"></c:set>
|
||||
</c:when>
|
||||
</c:choose>
|
||||
</c:forEach>
|
||||
<c:if test="${!isBreak}">
|
||||
<div class="row boxSolid subscribeId ${tabName}${status.index} hidden disabled">
|
||||
<%@include file="/WEB-INF/views/cfg/complexCfgForm.jsp"%>
|
||||
</div>
|
||||
<c:if test="${region.configServiceType eq 'subscribe_id' }">
|
||||
<c:set var="subscribeIdIndex" value="${subscribeIdIndex+1 }"></c:set>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><spring:message
|
||||
code="action" /></label>
|
||||
<div class="col-md-6">
|
||||
<c:forEach items="${serviceList}" var="service"
|
||||
varStatus="satus">
|
||||
<label class="radio-inline"> <c:if
|
||||
test="${_cfg.functionId eq service.functionId}">
|
||||
<input type="radio" name="action"
|
||||
serviceId="${service.serviceId }"
|
||||
protocolId="${service.protocolId }"
|
||||
regionCode="${service.regionCode }"
|
||||
value="${service.action }" class="required action"
|
||||
<c:if test="${_cfg.serviceId==service.serviceId || (_cfg.serviceId==null && satus.index==0)}">checked</c:if>>
|
||||
<c:forEach items="${fns:getDictList('SERVICE_ACTION') }" var="dict">
|
||||
<c:if test="${dict.itemCode eq service.action }">
|
||||
<spring:message code="${dict.itemValue }"/>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:if>
|
||||
</label>
|
||||
</c:forEach>
|
||||
</div>
|
||||
<div for="action"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- dolog begin-->
|
||||
<div class="row doLog">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><spring:message code="do_log" /></label>
|
||||
<c:forEach items="${fns:getDictList('DO_LOG') }" var="dict">
|
||||
<c:choose>
|
||||
<c:when test="${dict.itemCode eq _cfg.doLog}">
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="doLog" checked value="${dict.itemCode}" ><spring:message code="${dict.itemValue}"/>
|
||||
</label>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="doLog" value="${dict.itemCode}" ><spring:message code="${dict.itemValue}"/>
|
||||
</label>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
|
||||
</c:forEach>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row ratelimitAction hidden">
|
||||
<div class="col-md-6 hidden">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="limit_rate_type"/></label>
|
||||
<div class="col-md-6">
|
||||
<label class="radio-inline">
|
||||
<input type="radio"
|
||||
name="userRegion1" value="0"
|
||||
<%-- <c:if test="${(userRegion1 eq 0) || (empty userRegion1)}"> --%>
|
||||
checked
|
||||
<%-- </c:if> --%>
|
||||
class="required" >
|
||||
<spring:message code="ratelimit" />
|
||||
</label>
|
||||
<%-- <label class="radio-inline">
|
||||
<input type="radio"
|
||||
name="userRegion1" value="1"
|
||||
<c:if test="${(userRegion1 eq 1)}">
|
||||
checked
|
||||
</c:if>
|
||||
class="required" >
|
||||
<spring:message code="bandwith" />
|
||||
</label> --%>
|
||||
</div>
|
||||
<div for="userRegion1"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 droprate">
|
||||
<div class="form-group ">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="ratelimit"/></label>
|
||||
<div class="col-md-6">
|
||||
<input class="form-control required number" range="[0,1]" type="text" placeholder="0.001" name="userRegion2" value="${_cfg.userRegion2 }">
|
||||
</div>
|
||||
<div for="userRegion2"></div>
|
||||
</div>
|
||||
</div>
|
||||
<%-- <div class="col-md-6 bandwith">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="bandwith"/></label>
|
||||
<div class="col-md-6">
|
||||
<input class="form-control required number" type="text" name="userRegion3" value="${_cfg.userRegion3 }">
|
||||
</div>
|
||||
<div for="userRegion3"></div>
|
||||
</div>
|
||||
</div> --%>
|
||||
</div>
|
||||
<!-- dolog end-->
|
||||
<c:set var="ipCfgIndex" value="0"></c:set>
|
||||
<c:set var="strCfgIndex" value="0"></c:set>
|
||||
<c:set var="subscribeIdIndex" value="0"></c:set>
|
||||
<c:forEach items="${regionList}" var="region" varStatus="status">
|
||||
<c:if test="${region.regionType eq 1 }">
|
||||
<c:if test="${ipCfgIndex==0}">
|
||||
<div class="ipaddr">
|
||||
<!--ip info-->
|
||||
<c:set var="tabName" value="${region.configRegionValue}Tab"></c:set>
|
||||
<h4 class="form-section ipPortListTitle${region.configRegionCode}">
|
||||
<span class="ipPortTitle"><spring:message code="${region.configRegionValue}" /></span>
|
||||
<small> <span
|
||||
class="glyphicon glyphicon-plus ${tabName}Add"
|
||||
onClick="addContent(this,'${tabName}')" title="add"></span></small>
|
||||
</h4>
|
||||
<c:set var="cfgName" value="ipPortList[${ipCfgIndex}]"></c:set>
|
||||
<%-- <c:set var="regionValue" value="${region.configRegionValue}"></c:set> --%>
|
||||
<c:choose>
|
||||
<c:when test="${fn:length(_cfg.ipPortList)>0 and ipCfgIndex<fn:length(_cfg.ipPortList) }">
|
||||
<c:forEach items="${_cfg.ipPortList}" var="ipPort">
|
||||
<c:if test="${region.configRegionValue eq ipPort.cfgType }">
|
||||
<div class="row boxSolid ipPortList ${tabName}${status.index}">
|
||||
<%@include file="/WEB-INF/views/cfg/ipCfgForm.jsp"%>
|
||||
</div>
|
||||
<c:set var="ipCfgIndex" value="${ipCfgIndex+1}"></c:set>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<div class="row boxSolid ipPortList ${tabName}${status.index} hidden disabled">
|
||||
<%@include file="/WEB-INF/views/cfg/ipCfgForm.jsp"%>
|
||||
</div>
|
||||
<c:set var="ipCfgIndex" value="${ipCfgIndex+1 }"></c:set>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</div>
|
||||
</c:if>
|
||||
</c:if>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<div class="row boxSolid subscribeId ${tabName}${status.index} hidden disabled">
|
||||
<%@include file="/WEB-INF/views/cfg/complexCfgForm.jsp"%>
|
||||
</div>
|
||||
<c:if test="${region.configServiceType eq 'subscribe_id' }">
|
||||
<c:set var="subscribeIdIndex" value="${subscribeIdIndex+1 }"></c:set>
|
||||
</c:if>
|
||||
<c:if test="${region.configServiceType ne 'subscribe_id' }">
|
||||
<c:set var="strCfgIndex" value="${strCfgIndex+1 }"></c:set>
|
||||
</c:if>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
<br>
|
||||
<%@include file="/WEB-INF/include/form/areaInfo.jsp"%>
|
||||
<br>
|
||||
<%@include file="/WEB-INF/include/form/basicInfo.jsp"%>
|
||||
<div class="form-actions">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="row">
|
||||
<div class="col-md-offset-3 col-md-8">
|
||||
<button id="save" type="submit" class="btn green">
|
||||
<spring:message code="submit" />
|
||||
</button>
|
||||
<button id="cancel" type="button" class="btn default">
|
||||
<spring:message code="cancel" />
|
||||
</button>
|
||||
<!--/ip info-->
|
||||
</c:if>
|
||||
<c:if test="${region.regionType eq 2 }">
|
||||
<div class="ipaddr">
|
||||
<c:set var="tabName" value="${region.configRegionValue}Tab"></c:set>
|
||||
<h4 class="form-section">
|
||||
<spring:message code="${region.configRegionValue}" />
|
||||
<small> <span
|
||||
class="glyphicon glyphicon-plus ${tabName}Add"
|
||||
onClick="addContent(this,'${tabName}')" title="add"></span></small>
|
||||
</h4>
|
||||
<c:if test="${region.configServiceType eq 'subscribe_id' }">
|
||||
<c:set var="cfgName" value="ntcSubscribeIdCfgList[${subscribeIdIndex}]"></c:set>
|
||||
</c:if>
|
||||
<%-- <c:set var="regionValue" value="${region.configRegionValue}"></c:set> --%>
|
||||
<c:choose>
|
||||
<c:when test="${fn:length(_cfg.ntcSubscribeIdCfgList)>0}">
|
||||
<c:set var="isBreak" value="false" ></c:set>
|
||||
<c:forEach items="${_cfg.ntcSubscribeIdCfgList}" var="cfg">
|
||||
<c:choose>
|
||||
<c:when test="${region.configRegionValue eq cfg.cfgType and !isBreak}">
|
||||
<div class="row boxSolid subscribeId ${tabName}${status.index}">
|
||||
<%@include file="/WEB-INF/views/cfg/complexCfgForm.jsp"%>
|
||||
</div>
|
||||
<c:set var="isBreak" value="true" ></c:set>
|
||||
<c:set var="subscribeIdIndex" value="${subscribeIdIndex+1 }"></c:set>
|
||||
</c:when>
|
||||
</c:choose>
|
||||
</c:forEach>
|
||||
<c:if test="${!isBreak}">
|
||||
<div class="row boxSolid subscribeId ${tabName}${status.index} hidden disabled">
|
||||
<%@include file="/WEB-INF/views/cfg/complexCfgForm.jsp"%>
|
||||
</div>
|
||||
<c:if test="${region.configServiceType eq 'subscribe_id' }">
|
||||
<c:set var="subscribeIdIndex" value="${subscribeIdIndex+1 }"></c:set>
|
||||
</c:if>
|
||||
</c:if>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<div class="row boxSolid subscribeId ${tabName}${status.index} hidden disabled">
|
||||
<%@include file="/WEB-INF/views/cfg/complexCfgForm.jsp"%>
|
||||
</div>
|
||||
<c:if test="${region.configServiceType eq 'subscribe_id' }">
|
||||
<c:set var="subscribeIdIndex" value="${subscribeIdIndex+1 }"></c:set>
|
||||
</c:if>
|
||||
<c:if test="${region.configServiceType ne 'subscribe_id' }">
|
||||
<c:set var="strCfgIndex" value="${strCfgIndex+1 }"></c:set>
|
||||
</c:if>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</div>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
<div class="asn">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="group"/></label>
|
||||
<div class="col-md-6">
|
||||
<select name="userRegion4" class="selectpicker show-tick form-control required" data-live-search="true" data-live-search-placeholder="search">
|
||||
<c:forEach items="${policyGroups }" var="policyGroup">
|
||||
<option value="${policyGroup.groupId}" <c:if test="${_cfg.userRegion1==policyGroup.groupId }">selected</c:if>><spring:message code="${policyGroup.groupName}"/></option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
<div for="userRegion4"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<%@include file="/WEB-INF/include/form/areaInfo.jsp"%>
|
||||
<br>
|
||||
<%@include file="/WEB-INF/include/form/basicInfo.jsp"%>
|
||||
<div class="form-actions">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="row">
|
||||
<div class="col-md-offset-3 col-md-8">
|
||||
<button id="save" type="submit" class="btn green">
|
||||
<spring:message code="submit" />
|
||||
</button>
|
||||
<button id="cancel" type="button" class="btn default">
|
||||
<spring:message code="cancel" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</form>
|
||||
<!-- END FORM-->
|
||||
|
||||
@@ -143,7 +143,7 @@
|
||||
<form:select id="actionSelect" path="action" class="selectpicker select2 input-small" >
|
||||
<form:option value=""><spring:message code="select"/></form:option>
|
||||
<c:forEach items="${serviceList}" var="service">
|
||||
<form:option value="${service.action }"><spring:message code="action_${service.actionCode }"/></form:option>
|
||||
<form:option value="${service.action }"><spring:message code="${service.serviceName}"/> <spring:message code="action_${service.actionCode }"/></form:option>
|
||||
</c:forEach>
|
||||
</form:select>
|
||||
<form:select path="isValid" class="selectpicker select2 input-small" >
|
||||
@@ -319,6 +319,7 @@
|
||||
<th class="sort-column a.compile_id" style="display: none"><spring:message code="cfg_id"/></th>
|
||||
<th class="sort-column a.cfg_desc cfgDesc"><spring:message code="config_describe"/></th>
|
||||
<th class="sort-column a.action"><spring:message code="block_type"/></th>
|
||||
<th><spring:message code="ratelimit"/></th>
|
||||
<th><spring:message code="do_log"/></th>
|
||||
<th><spring:message code="whether_area_block"/></th>
|
||||
<th><spring:message code="letter"/></th>
|
||||
@@ -352,6 +353,7 @@
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</td>
|
||||
<td>${indexCfg.userRegion2 }</td>
|
||||
<td>
|
||||
<c:forEach items="${fns:getDictList('DO_LOG') }" var="dict">
|
||||
<c:if test="${dict.itemCode eq indexCfg.doLog }">
|
||||
|
||||
@@ -218,5 +218,19 @@
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:if>
|
||||
<c:if test="${(region[0] eq 3) && (not empty _cfg.userRegion4)}">
|
||||
<div id="${region[1]}Info${index}" class="content" name="subCfg${index}">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label><spring:message code='group'/>:</label>
|
||||
<label>
|
||||
${_cfg.asnIpGroupName}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</html>
|
||||
@@ -1,14 +1,4 @@
|
||||
$(function(){
|
||||
$.ipcommon=function(){
|
||||
return {};
|
||||
}
|
||||
$.extend($.ipcommon, {
|
||||
ipType:[],
|
||||
ipPattern:[],
|
||||
portPattern:[],
|
||||
protocol:[],
|
||||
direction:[]
|
||||
});
|
||||
$("input[name$='isCaseSenstive']").on("change",function(){
|
||||
setIsHexBin(this);
|
||||
});
|
||||
@@ -425,7 +415,6 @@ $(function(){
|
||||
window.history.back();
|
||||
return false;
|
||||
});
|
||||
initCommIpVal();
|
||||
//去掉首尾空格
|
||||
$("input,textarea").on("blur",function(){
|
||||
var val=$(this).val();
|
||||
@@ -1675,185 +1664,6 @@ var setHexCaseSenstive=function(){
|
||||
|
||||
});
|
||||
}
|
||||
/**
|
||||
* ip默认选项处理
|
||||
*/
|
||||
var initCommIpVal=function(){
|
||||
var action,regionCode,serviceType,ipPortShow,ipType,
|
||||
ipPattern,portPattern,direction,protocol,regionType;
|
||||
if($("input[name$='action']:checked").length>0){
|
||||
regionCode=$("input[name$='action']:checked").attr("regionCode");
|
||||
action=$("input[name$='action']:checked").val();
|
||||
}else{
|
||||
regionCode=$("input[name$='action']").attr("regionCode");
|
||||
action=$("input[name$='action']").val();
|
||||
}
|
||||
if(regionCode){
|
||||
if(regionCode.indexOf(",")==-1){
|
||||
$("#cfgRegionCode"+regionCode).attr("name","cfgRegionCode");
|
||||
$("#cfgType"+regionCode).attr("name","cfgType");
|
||||
}else{
|
||||
var _region='';
|
||||
var regionArr=regionCode.split(',');
|
||||
$("input[name$='cfgRegionCode'][regionType='1']").each(function(){
|
||||
for(var re in regionArr){
|
||||
if($(this).val()==regionArr[re]){
|
||||
_region=regionArr[re];
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
if(_region!=''){
|
||||
regionCode=_region;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(regionCode){//IP域大于1个,根据action获取ip属性
|
||||
ipPortShow=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("ipPortShow"),
|
||||
ipType=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("ipType"),
|
||||
ipPattern=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("ipPattern"),
|
||||
portPattern=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("portPattern"),
|
||||
direction=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("direction"),
|
||||
protocol=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("protocol"),
|
||||
regionType=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("regionType");
|
||||
}else{//IP域只有一个,获取regionType为1的
|
||||
ipPortShow=$("input[name$='cfgRegionCode'][regionType='1']").attr("ipPortShow"),
|
||||
ipType=$("input[name$='cfgRegionCode'][regionType='1']").attr("ipType"),
|
||||
ipPattern=$("input[name$='cfgRegionCode'][regionType='1']").attr("ipPattern"),
|
||||
portPattern=$("input[name$='cfgRegionCode'][regionType='1']").attr("portPattern"),
|
||||
direction=$("input[name$='cfgRegionCode'][regionType='1']").attr("direction"),
|
||||
protocol=$("input[name$='cfgRegionCode'][regionType='1']").attr("protocol"),
|
||||
regionType=$("input[name$='cfgRegionCode'][regionType='1']").attr("regionType");
|
||||
}
|
||||
//ip,端口处理
|
||||
if(ipPortShow){
|
||||
if(ipPortShow.indexOf('1')>-1){//展示源IP,端口
|
||||
$("input[name$='srcIpAddress']").parents(".form-group").removeClass("hidden");
|
||||
$("input[name$='srcPort']").parents(".form-group").removeClass("hidden");
|
||||
}else{
|
||||
$("input[name$='srcIpAddress']").parents(".form-group").addClass("hidden");
|
||||
$("input[name$='srcPort']").parents(".form-group").addClass("hidden");
|
||||
}
|
||||
if(ipPortShow.indexOf('2')>-1){//展示目的IP,端口
|
||||
$("input[name$='destIpAddress']").parents(".form-group").removeClass("hidden");
|
||||
$("input[name$='destPort']").parents(".form-group").removeClass("hidden");
|
||||
}else{
|
||||
$("input[name$='destIpAddress']").parents(".form-group").addClass("hidden");
|
||||
$("input[name$='destPort']").parents(".form-group").addClass("hidden");
|
||||
}
|
||||
}
|
||||
//ip类型处理
|
||||
if(ipType){
|
||||
var arr=ipType.split(',');
|
||||
$.ipcommon.ipType=$("select[name$='ipType'] option");
|
||||
$("select[name$='ipType'] option").each(function(){
|
||||
var has=false;
|
||||
for(var type in arr){
|
||||
if($(this).val()==arr[type]){
|
||||
has=true;
|
||||
if($(this).attr("disabled")){
|
||||
$(this).removeAttr("disabled")
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
}else{
|
||||
$.ipcommon.ipType=[];
|
||||
}
|
||||
//ip格式处理
|
||||
if(ipPattern){
|
||||
arr=ipPattern.split(',');
|
||||
$.ipcommon.ipPattern=$("select[name$='ipPattern'] option");
|
||||
$("select[name$='ipPattern'] option").each(function(){
|
||||
var has=false;
|
||||
for(var type in arr){
|
||||
if($(this).val()==arr[type]){
|
||||
has=true;
|
||||
if($(this).attr("disabled")){
|
||||
$(this).removeAttr("disabled")
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
}else{
|
||||
$.ipcommon.ipPattern=[];
|
||||
}
|
||||
//端口格式处理
|
||||
if(portPattern){
|
||||
arr=portPattern.split(',');
|
||||
$.ipcommon.portPattern=$("select[name$='portPattern'] option");
|
||||
$("select[name$='portPattern'] option").each(function(){
|
||||
var has=false;
|
||||
for(var type in arr){
|
||||
if($(this).val()==arr[type]){
|
||||
has=true;
|
||||
if($(this).attr("disabled")){
|
||||
$(this).removeAttr("disabled")
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
}else{
|
||||
$.ipcommon.portPattern=[];
|
||||
}
|
||||
//方向处理
|
||||
if(direction){
|
||||
arr=direction.split(',');
|
||||
$.ipcommon.direction=$("select[name$='direction'] option");
|
||||
$("select[name$='direction'] option").each(function(){
|
||||
var has=false;
|
||||
for(var type in arr){
|
||||
if($(this).val()==arr[type]){
|
||||
has=true;
|
||||
if($(this).attr("disabled")){
|
||||
$(this).removeAttr("disabled")
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
}else{
|
||||
$.ipcommon.direction=[];
|
||||
}
|
||||
//协议处理
|
||||
if(protocol){
|
||||
arr=protocol.split(',');
|
||||
$.ipcommon.protocol=$("select[name$='protocol'] option");
|
||||
$("select[name$='protocol'] option").each(function(){
|
||||
var has=false;
|
||||
for(var type in arr){
|
||||
if($(this).val()==arr[type]){
|
||||
has=true;
|
||||
if($(this).attr("disabled")){
|
||||
$(this).removeAttr("disabled")
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
}else{
|
||||
$.ipcommon.protocol=[];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function heightDiv(type){
|
||||
var hei=document.documentElement.clientHeight;
|
||||
|
||||
371
src/main/webapp/static/global/scripts/ipRegion.js
Normal file
371
src/main/webapp/static/global/scripts/ipRegion.js
Normal file
@@ -0,0 +1,371 @@
|
||||
/**
|
||||
* 处理IP域值
|
||||
*/
|
||||
;(function($){
|
||||
$.extend({
|
||||
ipcommon:function(){
|
||||
return {};
|
||||
}
|
||||
});
|
||||
$.extend($.ipcommon, {
|
||||
ipType:[],
|
||||
ipPattern:[],
|
||||
portPattern:[],
|
||||
protocol:[],
|
||||
direction:[]
|
||||
});
|
||||
})(jQuery);
|
||||
$(function(){
|
||||
initCommIpVal();
|
||||
});
|
||||
window.$.ipcommon=$.ipcommon;
|
||||
/**
|
||||
* ip默认选项处理
|
||||
*/
|
||||
var initCommIpVal=function(){
|
||||
var action,regionCode,serviceType,ipPortShow,ipType,
|
||||
ipPattern,portPattern,direction,protocol,regionType;
|
||||
if($("input[name$='action']:checked").length>0){
|
||||
regionCode=$("input[name$='action']:checked").attr("regionCode");
|
||||
action=$("input[name$='action']:checked").val();
|
||||
}else{
|
||||
regionCode=$("input[name$='action']").attr("regionCode");
|
||||
action=$("input[name$='action']").val();
|
||||
}
|
||||
if(regionCode){
|
||||
if(regionCode.indexOf(",")==-1){
|
||||
$("#cfgRegionCode"+regionCode).attr("name","cfgRegionCode");
|
||||
$("#cfgType"+regionCode).attr("name","cfgType");
|
||||
}else{
|
||||
var _region='';
|
||||
var regionArr=regionCode.split(',');
|
||||
$("input[name$='cfgRegionCode'][regionType='1']").each(function(){
|
||||
for(var re in regionArr){
|
||||
if($(this).val()==regionArr[re]){
|
||||
_region=regionArr[re];
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
if(_region!=''){
|
||||
regionCode=_region;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(regionCode){//IP域大于1个,根据action获取ip属性
|
||||
ipPortShow=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("ipPortShow"),
|
||||
ipType=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("ipType"),
|
||||
ipPattern=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("ipPattern"),
|
||||
portPattern=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("portPattern"),
|
||||
direction=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("direction"),
|
||||
protocol=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("protocol"),
|
||||
regionType=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("regionType");
|
||||
}else{//IP域只有一个,获取regionType为1的
|
||||
ipPortShow=$("input[name$='cfgRegionCode'][regionType='1']").attr("ipPortShow"),
|
||||
ipType=$("input[name$='cfgRegionCode'][regionType='1']").attr("ipType"),
|
||||
ipPattern=$("input[name$='cfgRegionCode'][regionType='1']").attr("ipPattern"),
|
||||
portPattern=$("input[name$='cfgRegionCode'][regionType='1']").attr("portPattern"),
|
||||
direction=$("input[name$='cfgRegionCode'][regionType='1']").attr("direction"),
|
||||
protocol=$("input[name$='cfgRegionCode'][regionType='1']").attr("protocol"),
|
||||
regionType=$("input[name$='cfgRegionCode'][regionType='1']").attr("regionType");
|
||||
}
|
||||
//ip,端口处理
|
||||
if(ipPortShow){
|
||||
if(ipPortShow.indexOf('1')>-1){//展示源IP,端口
|
||||
$("input[name$='srcIpAddress']").parents(".form-group").removeClass("hidden");
|
||||
$("input[name$='srcPort']").parents(".form-group").removeClass("hidden");
|
||||
}else{
|
||||
$("input[name$='srcIpAddress']").parents(".form-group").addClass("hidden");
|
||||
$("input[name$='srcPort']").parents(".form-group").addClass("hidden");
|
||||
}
|
||||
if(ipPortShow.indexOf('2')>-1){//展示目的IP,端口
|
||||
$("input[name$='destIpAddress']").parents(".form-group").removeClass("hidden");
|
||||
$("input[name$='destPort']").parents(".form-group").removeClass("hidden");
|
||||
}else{
|
||||
$("input[name$='destIpAddress']").parents(".form-group").addClass("hidden");
|
||||
$("input[name$='destPort']").parents(".form-group").addClass("hidden");
|
||||
}
|
||||
}
|
||||
//ip类型处理
|
||||
$.ipcommon.ipType=$("select[name$='ipType'] option");
|
||||
if(ipType){
|
||||
var arr=ipType.split(',');
|
||||
$("select[name$='ipType'] option").each(function(){
|
||||
var has=false;
|
||||
for(var type in arr){
|
||||
if($(this).val()==arr[type]){
|
||||
has=true;
|
||||
if($(this).attr("disabled")){
|
||||
$(this).removeAttr("disabled")
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
//ip格式处理
|
||||
$.ipcommon.ipPattern=$("select[name$='ipPattern'] option");
|
||||
if(ipPattern){
|
||||
arr=ipPattern.split(',');
|
||||
$("select[name$='ipPattern'] option").each(function(){
|
||||
var has=false;
|
||||
for(var type in arr){
|
||||
if($(this).val()==arr[type]){
|
||||
has=true;
|
||||
if($(this).attr("disabled")){
|
||||
$(this).removeAttr("disabled")
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
//端口格式处理
|
||||
$.ipcommon.portPattern=$("select[name$='portPattern'] option");
|
||||
if(portPattern){
|
||||
arr=portPattern.split(',');
|
||||
$("select[name$='portPattern'] option").each(function(){
|
||||
var has=false;
|
||||
for(var type in arr){
|
||||
if($(this).val()==arr[type]){
|
||||
has=true;
|
||||
if($(this).attr("disabled")){
|
||||
$(this).removeAttr("disabled")
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
//方向处理
|
||||
$.ipcommon.direction=$("select[name$='direction'] option");
|
||||
if(direction){
|
||||
arr=direction.split(',');
|
||||
$("select[name$='direction'] option").each(function(){
|
||||
var has=false;
|
||||
for(var type in arr){
|
||||
if($(this).val()==arr[type]){
|
||||
has=true;
|
||||
if($(this).attr("disabled")){
|
||||
$(this).removeAttr("disabled")
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
//协议处理
|
||||
$.ipcommon.protocol=$("select[name$='protocol'] option");
|
||||
if(protocol){
|
||||
arr=protocol.split(',');
|
||||
$("select[name$='protocol'] option").each(function(){
|
||||
var has=false;
|
||||
for(var type in arr){
|
||||
if($(this).val()==arr[type]){
|
||||
has=true;
|
||||
if($(this).attr("disabled")){
|
||||
$(this).removeAttr("disabled")
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* ip切换默认值处理
|
||||
*/
|
||||
var changeIPVal=function(obj){
|
||||
var action,regionCode,serviceType,ipPortShow,ipType,
|
||||
ipPattern,portPattern,direction,protocol,regionType,o;
|
||||
o=$(obj);
|
||||
if($("input[name$='action']:checked").length>0){
|
||||
regionCode=$("input[name$='action']:checked").attr("regionCode");
|
||||
action=$("input[name$='action']:checked").val();
|
||||
}else{
|
||||
regionCode=$("input[name$='action']").attr("regionCode");
|
||||
action=$("input[name$='action']").val();
|
||||
}
|
||||
if(regionCode){
|
||||
if(regionCode.indexOf(",")==-1){
|
||||
$("#cfgRegionCode"+regionCode).attr("name","cfgRegionCode");
|
||||
$("#cfgType"+regionCode).attr("name","cfgType");
|
||||
}else{
|
||||
var _region='';
|
||||
var regionArr=regionCode.split(',');
|
||||
$("input[name$='cfgRegionCode'][regionType='1']").each(function(){
|
||||
for(var re in regionArr){
|
||||
if($(this).val()==regionArr[re]){
|
||||
_region=regionArr[re];
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
if(_region!=''){
|
||||
regionCode=_region;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(regionCode){//IP域大于1个,根据action获取ip属性
|
||||
ipPortShow=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("ipPortShow"),
|
||||
ipType=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("ipType"),
|
||||
ipPattern=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("ipPattern"),
|
||||
portPattern=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("portPattern"),
|
||||
direction=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("direction"),
|
||||
protocol=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("protocol"),
|
||||
regionType=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("regionType");
|
||||
}else{//IP域只有一个,获取regionType为1的
|
||||
ipPortShow=$("input[name$='cfgRegionCode'][regionType='1']").attr("ipPortShow"),
|
||||
ipType=$("input[name$='cfgRegionCode'][regionType='1']").attr("ipType"),
|
||||
ipPattern=$("input[name$='cfgRegionCode'][regionType='1']").attr("ipPattern"),
|
||||
portPattern=$("input[name$='cfgRegionCode'][regionType='1']").attr("portPattern"),
|
||||
direction=$("input[name$='cfgRegionCode'][regionType='1']").attr("direction"),
|
||||
protocol=$("input[name$='cfgRegionCode'][regionType='1']").attr("protocol"),
|
||||
regionType=$("input[name$='cfgRegionCode'][regionType='1']").attr("regionType");
|
||||
}
|
||||
if(o){
|
||||
//ip,端口处理
|
||||
if(ipPortShow){
|
||||
if(ipPortShow.indexOf('1')>-1){//展示源IP,端口
|
||||
o.find("input[name$='srcIpAddress']").parents(".form-group").removeClass("hidden");
|
||||
o.find("input[name$='srcPort']").parents(".form-group").removeClass("hidden");
|
||||
}else{
|
||||
o.find("input[name$='srcIpAddress']").parents(".form-group").addClass("hidden");
|
||||
o.find("input[name$='srcPort']").parents(".form-group").addClass("hidden");
|
||||
}
|
||||
if(ipPortShow.indexOf('2')>-1){//展示目的IP,端口
|
||||
o.find("input[name$='destIpAddress']").parents(".form-group").removeClass("hidden");
|
||||
o.find("input[name$='destPort']").parents(".form-group").removeClass("hidden");
|
||||
}else{
|
||||
o.find("input[name$='destIpAddress']").parents(".form-group").addClass("hidden");
|
||||
o.find("input[name$='destPort']").parents(".form-group").addClass("hidden");
|
||||
}
|
||||
}
|
||||
//ip类型处理
|
||||
if(ipType){
|
||||
var arr=ipType.split(',');
|
||||
var ipTypeVal=o.find("select[name$='ipType'] option:selected").attr("value");
|
||||
o.find("select[name$='ipType']").empty();
|
||||
$.ipcommon.ipType.each(function(){
|
||||
var has=false;
|
||||
for(var type in arr){
|
||||
if($(this).val()==arr[type]){
|
||||
has=true;
|
||||
o.find("select[name$='ipType']").append($(this));
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
o.find("select[name$='ipType']").selectpicker("refresh");
|
||||
if(o.find("select[name$='ipType'] option[value='"+ipTypeVal+"']").length>0){
|
||||
o.find("select[name$='ipType']").selectpicker("val",ipTypeVal);
|
||||
}else{
|
||||
o.find("select[name$='ipType']").selectpicker("val",4);
|
||||
}
|
||||
|
||||
}
|
||||
//ip格式处理
|
||||
if(ipPattern){
|
||||
arr=ipPattern.split(',');
|
||||
var ipPatternVal=o.find("select[name$='ipPattern'] option:selected").attr("value");
|
||||
o.find("select[name$='ipPattern']").empty();
|
||||
$.ipcommon.ipPattern.each(function(){
|
||||
var has=false;
|
||||
for(var type in arr){
|
||||
if($(this).val()==arr[type]){
|
||||
has=true;
|
||||
o.find("select[name$='ipPattern']").append($(this));
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
o.find("select[name$='ipPattern']").selectpicker("refresh");
|
||||
if(o.find("select[name$='ipPattern'] option[value='"+ipPatternVal+"']").length>0){
|
||||
o.find("select[name$='ipPattern']").selectpicker("val",ipPatternVal);
|
||||
}else{
|
||||
o.find("select[name$='ipPattern']").selectpicker("val",1);
|
||||
}
|
||||
}
|
||||
//端口格式处理
|
||||
if(portPattern){
|
||||
arr=portPattern.split(',');
|
||||
var portPatternVal=o.find("select[name$='portPattern'] option:selected").attr("value");
|
||||
o.find("select[name$='portPattern']").empty();
|
||||
$.ipcommon.portPattern.each(function(){
|
||||
var has=false;
|
||||
for(var type in arr){
|
||||
if($(this).val()==arr[type]){
|
||||
has=true;
|
||||
o.find("select[name$='portPattern']").append($(this));
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
o.find("select[name$='portPattern']").selectpicker("refresh");
|
||||
if(o.find("select[name$='portPattern'] option[value='"+portPatternVal+"']").length>0){
|
||||
o.find("select[name$='portPattern']").selectpicker("val",portPatternVal);
|
||||
}else{
|
||||
o.find("select[name$='portPattern']").selectpicker("val",1);
|
||||
}
|
||||
}
|
||||
//方向处理
|
||||
if(direction){
|
||||
arr=direction.split(',');
|
||||
var directionVal=o.find("select[name$='direction'] option:selected").attr("value");
|
||||
o.find("select[name$='direction']").empty();
|
||||
$.ipcommon.direction.each(function(){
|
||||
var has=false;
|
||||
for(var type in arr){
|
||||
if($(this).val()==arr[type]){
|
||||
has=true;
|
||||
o.find("select[name$='direction']").append($(this));
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
o.find("select[name$='direction']").selectpicker("refresh");
|
||||
if(o.find("select[name$='direction'] option[value='"+directionVal+"']").length>0){
|
||||
o.find("select[name$='direction']").selectpicker("val",directionVal);
|
||||
}else{
|
||||
o.find("select[name$='direction']").selectpicker("val",0);
|
||||
}
|
||||
}
|
||||
//协议处理
|
||||
if(protocol){
|
||||
arr=protocol.split(',');
|
||||
var protocolVal=o.find("select[name$='protocol'] option:selected").attr("value");
|
||||
o.find("select[name$='protocol']").empty();
|
||||
$.ipcommon.protocol.each(function(){
|
||||
var has=false;
|
||||
for(var type in arr){
|
||||
if($(this).val()==arr[type]){
|
||||
has=true;
|
||||
o.find("select[name$='protocol']").append($(this));
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
o.find("select[name$='protocol']").selectpicker("refresh");
|
||||
if(o.find("select[name$='protocol'] option[value='"+protocolVal+"']").length>0){
|
||||
o.find("select[name$='protocol']").selectpicker("val",protocolVal);
|
||||
}else{
|
||||
o.find("select[name$='protocol']").selectpicker("val",0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user