ipType、ipPattern、portPattern
三个参数变化,动态设置ip和端口默认值
This commit is contained in:
@@ -60,10 +60,11 @@ public class AvContentController extends BaseController {
|
||||
@ModelAttribute("voipAccountIds")String voipAccountIds){
|
||||
try{
|
||||
avContentCfgService.saveOrUpdateAvVoip(cfg,voipIpIds,voipAccountIds);
|
||||
addMessage(model,"save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("voip信息保存失败",e);
|
||||
e.printStackTrace();
|
||||
addMessage(model,"save_voip_failed");
|
||||
addMessage(model,"save_failed");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/ntc/av/voipList?functionId="+cfg.getFunctionId();
|
||||
|
||||
@@ -555,3 +555,10 @@ no_permission=permission denied
|
||||
param_error=param error,server can't analyze
|
||||
request_service_failed=request server failed
|
||||
request_error=request error
|
||||
av_voip_ip_title=voip Ip
|
||||
av_voip_account_title=voip Account
|
||||
ip_pattern=ip Pattern
|
||||
port_pattern=port Pattern
|
||||
port_mask=port Mask
|
||||
ip_range=ip Range
|
||||
ip_subnet=Subnet
|
||||
@@ -381,3 +381,10 @@ no_permission=permission denied
|
||||
param_error=param error,server can't analyze
|
||||
request_service_failed=request server failed
|
||||
request_error=request error
|
||||
av_voip_ip_title=voip Ip
|
||||
av_voip_account_title=voip Account
|
||||
ip_pattern=ip Pattern
|
||||
port_pattern=port Pattern
|
||||
port_mask=port Mask
|
||||
ip_range=ip Range
|
||||
ip_subnet=Subnet
|
||||
@@ -556,12 +556,12 @@ no_permission=\u6743\u9650\u4E0D\u8DB3
|
||||
param_error=\u53C2\u6570\u6709\u8BEF\uFF0C\u670D\u52A1\u5668\u65E0\u6CD5\u89E3\u6790\u3002
|
||||
request_service_failed=\u8BF7\u6C42\u670D\u52A1\u63A5\u53E3\u5931\u8D25
|
||||
request_error=\u8BF7\u6C42\u9519\u8BEF
|
||||
av_voip_ip_title=VoIP IP
|
||||
av_voip_account_title=VoIP\u8D26\u53F7
|
||||
ip_pattern=IP \u683C\u5F0F
|
||||
av_voip_ip_title=voip Ip
|
||||
av_voip_account_title=voip\u8D26\u53F7
|
||||
ip_pattern=ip \u683C\u5F0F
|
||||
port_pattern=\u7AEF\u53E3\u683C\u5F0F
|
||||
port_mask=port Mask
|
||||
ip_range=IP Range
|
||||
ip_range=ip Range
|
||||
ip_subnet=Subnet
|
||||
http_ip_title=HTTP IP\u914D\u7F6E
|
||||
http_url_title=HTTP URL \u914D\u7F6E
|
||||
|
||||
@@ -13,7 +13,19 @@ border:1px solid #eeeeee
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
switchIpType($("select[name$='ipType']"));
|
||||
$("select[name$='ipType']").each(function(){
|
||||
switchIpInfo(this,"ipType");
|
||||
})
|
||||
$("select[name$='ipType']").on("change",function(){
|
||||
switchIpInfo(this,"ipType");
|
||||
});
|
||||
$("select[name$='ipPattern']").on("change",function(){
|
||||
switchIpInfo(this,"ipPattern");
|
||||
});
|
||||
$("select[name$='portPattern']").on("change",function(){
|
||||
switchIpInfo(this,"portPattern");
|
||||
});
|
||||
|
||||
areaControlInit();
|
||||
$("input[name='isAreaEffective']").on('change',function(){
|
||||
var val=$(this).val();
|
||||
@@ -30,9 +42,6 @@ $(function(){
|
||||
$("#areaIsp").addClass("hidden");
|
||||
}
|
||||
});
|
||||
$("select[name$='ipType']").on("change",function(){
|
||||
switchIpType($(this));
|
||||
});
|
||||
$("input[name='areaType']").on('change',function(){
|
||||
var val=$(this).val();
|
||||
if($(this).is(":visible")){
|
||||
@@ -61,6 +70,11 @@ $(function(){
|
||||
},
|
||||
submitHandler: function(form){
|
||||
//loading('onloading...');
|
||||
//代表所有业务都隐藏了,提示必须增加一种业务数据
|
||||
if($(".boxSolid").length ==$(".boxSolid.hidden").length){
|
||||
top.$.jBox.tip("<spring:message code='one_more'/>", "<spring:message code='info'/>");
|
||||
return;
|
||||
}
|
||||
form.submit();
|
||||
},
|
||||
errorContainer: "#messageBox",
|
||||
@@ -221,7 +235,7 @@ var delContent=function(contentClassName,addBtnClassName){
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row ip">
|
||||
<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="ip_pattern"/></label>
|
||||
@@ -235,25 +249,7 @@ var delContent=function(contentClassName,addBtnClassName){
|
||||
<div for="voipIps[${status.index }].ipPattern"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="client_ip"/></label>
|
||||
<div class="col-md-6">
|
||||
<input class="form-control required" type="text" name="voipIps[${status.index }].srcIpAddress" value="${voipIp.srcIpAddress}">
|
||||
</div>
|
||||
<div for="voipIps[${status.index }].srcIpAddress"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<c:choose>
|
||||
<c:when test="${voipIp.cfgId==null}">
|
||||
<div class="row hidden port">
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<div class="row port">
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="port_pattern"/></label>
|
||||
<div class="col-md-6">
|
||||
@@ -265,6 +261,17 @@ var delContent=function(contentClassName,addBtnClassName){
|
||||
<div for="voipIps[${status.index }].portPattern"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<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="client_ip"/></label>
|
||||
<div class="col-md-6">
|
||||
<input class="form-control required ipCheck" type="text" name="voipIps[${status.index }].srcIpAddress" value="${voipIp.srcIpAddress}">
|
||||
</div>
|
||||
<div for="voipIps[${status.index }].srcIpAddress"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="client_port"/></label>
|
||||
@@ -277,10 +284,10 @@ var delContent=function(contentClassName,addBtnClassName){
|
||||
</div>
|
||||
<c:choose>
|
||||
<c:when test="${voipIp.cfgId==null}">
|
||||
<div class="row hidden destIpPort">
|
||||
<div class="row hidden port">
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<div class="row destIpPort">
|
||||
<div class="row port">
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
<div class="col-md-6">
|
||||
|
||||
@@ -54,6 +54,163 @@ var switchIpType=function(obj){
|
||||
}
|
||||
}
|
||||
}
|
||||
//ipType、ipPattern、portPattern选项变化时调用此方法,添加默认值
|
||||
var switchIpInfo=function(obj,type){
|
||||
var ipType="";
|
||||
var ipPattern="";
|
||||
var portPattern="";
|
||||
|
||||
var row=$(obj).parents('.row');
|
||||
|
||||
if(type=="ipType"){
|
||||
ipType=$(obj).val();
|
||||
ipPattern=row.siblings().find("select[name$='ipPattern']").val();
|
||||
portPattern=row.siblings().find("select[name$='portPattern']").val();
|
||||
}
|
||||
if(type=="ipPattern"){
|
||||
ipType=row.siblings().find("select[name$='ipType']").val();
|
||||
ipPattern=$(obj).val();
|
||||
portPattern=row.siblings().find("select[name$='portPattern']").val();
|
||||
}
|
||||
if(type=="portPattern"){
|
||||
ipType=row.siblings().find("select[name$='ipType']").val();
|
||||
ipPattern=row.siblings().find("select[name$='ipPattern']").val();
|
||||
portPattern=$(obj).val();
|
||||
}
|
||||
|
||||
var srcIp=row.siblings().find("input[name$='srcIpAddress']");
|
||||
var destIp=row.siblings().find("input[name$='destIpAddress']");
|
||||
var srcPort=row.siblings().find("input[name$='srcPort']");
|
||||
var destPort=row.siblings().find("input[name$='destPort']");
|
||||
|
||||
var ipV4Default=new Array();
|
||||
ipV4Default[0]="0.0.0.0/8"; //subnet
|
||||
ipV4Default[1]="0.0.0.0-1.1.1.1";//ip_range
|
||||
ipV4Default[2]="0.0.0.0"; //ip
|
||||
|
||||
var ipV6Default=new Array();
|
||||
ipV6Default[0]="::/64"; //subnet
|
||||
ipV6Default[1]="::-::";//ip_range
|
||||
ipV6Default[2]="::"; //ip
|
||||
|
||||
var portDefault=new Array();
|
||||
portDefault[0]="0";//port
|
||||
portDefault[1]="0/0";//port_mask
|
||||
|
||||
//IPv4设置默认值
|
||||
if(4==ipType){
|
||||
if(!$(srcIp).val()){
|
||||
if(ipPattern==1){
|
||||
$(srcIp).val(ipV4Default[0]);
|
||||
}else if(ipPattern==2){
|
||||
$(srcIp).val(ipV4Default[1]);
|
||||
}else if(ipPattern==3){
|
||||
$(srcIp).val(ipV4Default[2]);
|
||||
}
|
||||
}else{
|
||||
if($.inArray($(srcIp).val(),ipV4Default) > -1 || $.inArray($(srcIp).val(),ipV6Default) > -1){ //是ipV4的默认值其中一个
|
||||
if(ipPattern==1){
|
||||
$(srcIp).val(ipV4Default[0]);
|
||||
}else if(ipPattern==2){
|
||||
$(srcIp).val(ipV4Default[1]);
|
||||
}else if(ipPattern==3){
|
||||
$(srcIp).val(ipV4Default[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!$(destIp).val()){
|
||||
if(ipPattern==1){
|
||||
$(destIp).val(ipV4Default[0]);
|
||||
}else if(ipPattern==2){
|
||||
$(destIp).val(ipV4Default[1]);
|
||||
}else if(ipPattern==3){
|
||||
$(destIp).val(ipV4Default[2]);
|
||||
}
|
||||
}else{
|
||||
if($.inArray($(destIp).val(),ipV4Default) > -1 || $.inArray($(destIp).val(),ipV6Default) > -1){ //是ipV4的默认值其中一个
|
||||
if(ipPattern==1){
|
||||
$(destIp).val(ipV4Default[0]);
|
||||
}else if(ipPattern==2){
|
||||
$(destIp).val(ipV4Default[1]);
|
||||
}else if(ipPattern==3){
|
||||
$(destIp).val(ipV4Default[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(6==ipType){
|
||||
if(!$(srcIp).val()){
|
||||
if(ipPattern==1){
|
||||
$(srcIp).val(ipV6Default[0]);
|
||||
}else if(ipPattern==2){
|
||||
$(srcIp).val(ipV6Default[1]);
|
||||
}else if(ipPattern==3){
|
||||
$(srcIp).val(ipV6Default[2]);
|
||||
}
|
||||
}else{
|
||||
if($.inArray($(srcIp).val(),ipV4Default) > -1 || $.inArray($(srcIp).val(),ipV6Default) > -1){ //是ipV6的默认值其中一个
|
||||
if(ipPattern==1){
|
||||
$(srcIp).val(ipV6Default[0]);
|
||||
}else if(ipPattern==2){
|
||||
$(srcIp).val(ipV6Default[1]);
|
||||
}else if(ipPattern==3){
|
||||
$(srcIp).val(ipV6Default[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!$(destIp).val()){
|
||||
if(ipPattern==1){
|
||||
$(destIp).val(ipV6Default[0]);
|
||||
}else if(ipPattern==2){
|
||||
$(destIp).val(ipV6Default[1]);
|
||||
}else if(ipPattern==3){
|
||||
$(destIp).val(ipV6Default[2]);
|
||||
}
|
||||
}else{
|
||||
if($.inArray($(destIp).val(),ipV4Default) > -1 || $.inArray($(destIp).val(),ipV6Default) > -1){ //是ipV6的默认值其中一个
|
||||
if(ipPattern==1){
|
||||
$(destIp).val(ipV6Default[0]);
|
||||
}else if(ipPattern==2){
|
||||
$(destIp).val(ipV6Default[1]);
|
||||
}else if(ipPattern==3){
|
||||
$(destIp).val(ipV6Default[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//设置源端口默认值
|
||||
if(!$(srcPort).val()){
|
||||
if(portPattern==1){
|
||||
$(srcPort).val(portDefault[0]);
|
||||
}else if(portPattern==2){
|
||||
$(srcPort).val(portDefault[1]);
|
||||
}
|
||||
}else{
|
||||
if($.inArray($(srcPort).val(),portDefault) > -1){ //是ipV4的默认值其中一个
|
||||
if(portPattern==1){
|
||||
$(srcPort).val(portDefault[0]);
|
||||
}else if(portPattern==2){
|
||||
$(srcPort).val(portDefault[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
//设置目的端口默认值
|
||||
if(!$(destPort).val()){
|
||||
if(portPattern==1){
|
||||
$(destPort).val(portDefault[0]);
|
||||
}else if(portPattern==2){
|
||||
$(destPort).val(portDefault[1]);
|
||||
}
|
||||
}else{
|
||||
if($.inArray($(destPort).val(),portDefault) > -1){ //是port的默认值其中一个
|
||||
if(portPattern==1){
|
||||
$(destPort).val(portDefault[0]);
|
||||
}else if(portPattern==2){
|
||||
$(destPort).val(portDefault[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var areaControlInit=function(){
|
||||
if($("input[name='isAreaEffective']:checked").val()==1){
|
||||
$(".areaType").removeClass("hidden");
|
||||
@@ -87,10 +244,6 @@ var more=function(obj){
|
||||
$(obj).data("click-times",clickTimes+1);
|
||||
}
|
||||
if(clickTimes==1){
|
||||
$(".destIpPort").removeClass("hidden").removeClass("disabled");
|
||||
$(obj).data("click-times",clickTimes+1);
|
||||
}
|
||||
if(clickTimes==2){
|
||||
$(".protocol").removeClass("hidden").removeClass("disabled");
|
||||
$(obj).data("click-times",clickTimes+1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user