Merge branch 'develop' of http://10.0.6.99/gwall/gwall.git into develop

This commit is contained in:
zhangshilin
2018-04-09 11:41:12 +08:00
7 changed files with 102 additions and 102 deletions

View File

@@ -51,7 +51,7 @@
<div class="form-group">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="client_port"/></label>
<div class="col-md-6">
<input class="form-control required" type="text" name="srcPort" value="${_cfg.srcPort}">
<input class="form-control required" type="text" name="srcPort" range="[0,65535]" value="${_cfg.srcPort}">
</div>
<div for="srcPort"></div>
</div>
@@ -60,7 +60,7 @@
<div class="form-group ">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="client_port_mask"/></label>
<div class="col-md-6">
<input class="form-control required" type="text" name="srcPortMask" value="${_cfg.srcPortMask}">
<input class="form-control required" type="text" name="srcPortMask" range="[0,65535]" value="${_cfg.srcPortMask}">
</div>
<div for="srcPortMask"></div>
</div>
@@ -91,7 +91,7 @@
<div class="form-group">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="server_port"/></label>
<div class="col-md-6">
<input class="form-control required" type="text" name="dstPort" value="${_cfg.dstPort}">
<input class="form-control required" type="text" name="dstPort" range="[0,65535]" value="${_cfg.dstPort}">
</div>
<div for="dstPort"></div>
</div>
@@ -100,7 +100,7 @@
<div class="form-group ">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="server_port_mask"/></label>
<div class="col-md-6">
<input class="form-control required" type="text" name="dstPortMask" value="${_cfg.dstPortMask}">
<input class="form-control required" type="text" name="dstPortMask" range="[0,65535]" value="${_cfg.dstPortMask}">
</div>
<div for="dstPortMask"></div>
</div>

View File

@@ -1,8 +1,5 @@
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/include/taglib.jsp"%>
<style>
</style>
<h3 class="form-section">
<c:choose>
<c:when test="${mainTableType eq '1' and otherTable==null}">
@@ -13,7 +10,7 @@
</c:when>
<c:otherwise>IP<spring:message code="block_config"/></c:otherwise>
</c:choose>
<small><span style="margin-left:10px"><input type="checkbox" id="ipSelect"/> 可选</span><!-- <span class="glyphicon glyphicon-plus" data-toggle="collapse" data-target=".ipCfg" title="add"></span> --></small></h3>
<small><span style="margin-left:10px"><input type="checkbox" id="ipSelect" <c:if test="${_cfg.ipCfg[mainTable]!= null and _cfg.ipCfg[mainTable].cfgId != null}">checked</c:if> <c:if test="${_cfg.ipCfg[otherTable.tableName]!= null and _cfg.ipCfg[otherTable.tableName].cfgId != null}">checked</c:if>/> 可选</span><!-- <span class="glyphicon glyphicon-plus" data-toggle="collapse" data-target=".ipCfg" title="add"></span> --></small></h3>
<div class="row ipCfg collapse">
<div class="col-md-6">
<div class="form-group">
@@ -118,10 +115,10 @@
<div class="col-md-6">
<c:choose>
<c:when test="${mainTableType eq '1' and otherTable==null}">
<input class="form-control required" type="text" name="ipCfg[${mainTable}].srcPort" value="${_cfg.ipCfg[mainTable].srcPort}">
<input class="form-control required" range="[0,65535]" type="text" name="ipCfg[${mainTable}].srcPort" value="${_cfg.ipCfg[mainTable].srcPort}">
</c:when>
<c:when test="${otherTable!=null and otherTable.tableType eq '1'}">
<input class="form-control required" type="text" name="ipCfg[${otherTable.tableName}].srcPort" value="${_cfg.ipCfg[otherTable.tableName].srcPort}">
<input class="form-control required" range="[0,65535]" type="text" name="ipCfg[${otherTable.tableName}].srcPort" value="${_cfg.ipCfg[otherTable.tableName].srcPort}">
</c:when>
</c:choose>
</div>
@@ -141,10 +138,10 @@
<div class="col-md-6">
<c:choose>
<c:when test="${mainTableType eq '1' and otherTable==null}">
<input class="form-control required" type="text" name="ipCfg[${mainTable}].srcPortMask" value="${_cfg.ipCfg[mainTable].srcPortMask}">
<input class="form-control required" type="text" name="ipCfg[${mainTable}].srcPortMask" range="[0,65535]" value="${_cfg.ipCfg[mainTable].srcPortMask}">
</c:when>
<c:when test="${otherTable!=null and otherTable.tableType eq '1'}">
<input class="form-control required" type="text" name="ipCfg[${otherTable.tableName}].srcPortMask" value="${_cfg.ipCfg[otherTable.tableName].srcPortMask}">
<input class="form-control required" type="text" name="ipCfg[${otherTable.tableName}].srcPortMask" range="[0,65535]" value="${_cfg.ipCfg[otherTable.tableName].srcPortMask}">
</c:when>
</c:choose>
</div>
@@ -214,10 +211,10 @@
<div class="col-md-6">
<c:choose>
<c:when test="${mainTableType eq '1' and otherTable==null}">
<input class="form-control required" type="text" name="ipCfg[${mainTable}].dstPort" value="${_cfg.ipCfg[mainTable].dstPort}">
<input class="form-control required" type="text" name="ipCfg[${mainTable}].dstPort" value="${_cfg.ipCfg[mainTable].dstPort}" range="[0,65535]">
</c:when>
<c:when test="${otherTable!=null and otherTable.tableType eq '1'}">
<input class="form-control required" type="text" name="ipCfg[${otherTable.tableName}].dstPort" value="${_cfg.ipCfg[otherTable.tableName].dstPort}">
<input class="form-control required" type="text" name="ipCfg[${otherTable.tableName}].dstPort" value="${_cfg.ipCfg[otherTable.tableName].dstPort}" range="[0,65535]">
</c:when>
</c:choose>
</div>
@@ -237,10 +234,10 @@
<div class="col-md-6">
<c:choose>
<c:when test="${mainTableType eq '1' and otherTable==null}">
<input class="form-control required" type="text" name="ipCfg[${mainTable}].dstPortMask" value="${_cfg.ipCfg[mainTable].dstPortMask}">
<input class="form-control required" type="text" name="ipCfg[${mainTable}].dstPortMask" range="[0,65535]" value="${_cfg.ipCfg[mainTable].dstPortMask}">
</c:when>
<c:when test="${otherTable!=null and otherTable.tableType eq '1'}">
<input class="form-control required" type="text" name="ipCfg[${otherTable.tableName}].dstPortMask" value="${_cfg.ipCfg[otherTable.tableName].dstPortMask}">
<input class="form-control required" type="text" name="ipCfg[${otherTable.tableName}].dstPortMask" range="[0,65535]" value="${_cfg.ipCfg[otherTable.tableName].dstPortMask}">
</c:when>
</c:choose>
</div>
@@ -264,15 +261,15 @@
<c:when test="${mainTableType eq '1' and otherTable==null}">
<select name="ipCfg[${mainTable}].direction" class="selectpicker show-tick form-control required" title=<spring:message code="select"/>>
<option value="" ><spring:message code="select"/></option>
<option value="0" <c:if test="${_cfg.ipCfg[mainTable].direction==0}">selected</c:if>>0</option>
<option value="1" <c:if test="${_cfg.ipCfg[mainTable].direction==1}">selected</c:if>>1</option>
<option value="0" <c:if test="${_cfg.ipCfg[mainTable].direction==0}">selected</c:if>><spring:message code="twoway"/></option>
<option value="1" <c:if test="${_cfg.ipCfg[mainTable].direction==1}">selected</c:if>><spring:message code="oneway"/></option>
</select>
</c:when>
<c:when test="${otherTable!=null and otherTable.tableType eq '1'}">
<select name="ipCfg[${otherTable.tableName}].direction" class="selectpicker show-tick form-control required" title=<spring:message code="select"/>>
<option value="" ><spring:message code="select"/></option>
<option value="0" <c:if test="${_cfg.ipCfg[otherTable.tableName].direction==0}">selected</c:if>>0</option>
<option value="1" <c:if test="${_cfg.ipCfg[otherTable.tableName].direction==1}">selected</c:if>>1</option>
<option value="0" <c:if test="${_cfg.ipCfg[otherTable.tableName].direction==0}">selected</c:if>><spring:message code="twoway"/></option>
<option value="1" <c:if test="${_cfg.ipCfg[otherTable.tableName].direction==1}">selected</c:if>><spring:message code="oneway"/></option>
</select>
</c:when>
</c:choose>

View File

@@ -85,3 +85,4 @@
<script src="${pageContext.request.contextPath}/static/global/plugins/jquery-validation/1.11.0/localization/messages_en.js"></script>
</c:otherwise>
</c:choose>
<script src="${pageContext.request.contextPath}/static/global/scripts/common.js" type="text/javascript"></script>

View File

@@ -21,6 +21,7 @@
</c:choose>
<script type="text/javascript">
$(function(){
switchIpType($("select[name='ipType']"));
$("#submitBtn").on("click",function(){
$("#inputFrom").attr("action","${ctx}/cfg/dnsIp/save");
$("#inputFrom").submit();
@@ -29,73 +30,9 @@ $(function(){
window.history.back();
});
$("select[name='ipType']").on("change",function(){
var type=$(this).val();
if(4==type){
if(!$("input[name='srcIpMask']").val()){
$("input[name='srcIpMask']").val("255.255.255.255");
}else if($("input[name='srcIpMask']").val()=="FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"){
$("input[name='srcIpMask']").val("255.255.255.255");
}
if(!$("input[name='dstIpMask']").val()){
$("input[name='dstIpMask']").val("255.255.255.255");
}else if($("input[name='dstIpMask']").val()=="FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"){
$("input[name='dstIpMask']").val("255.255.255.255");
}
if(!$("input[name='srcIp']").val()){
$("input[name='srcIp']").val("0.0.0.0");
}else if($("input[name='srcIp']").val()=="::"){
$("input[name='srcIp']").val("0.0.0.0");
}
if(!$("input[name='dstIp']").val()){
$("input[name='dstIp']").val("0.0.0.0");
}else if($("input[name='dstIp']").val()=="::"){
$("input[name='dstIp']").val("0.0.0.0");
}
}
if(6==type){
if(!$("input[name='srcIpMask']").val()){
$("input[name='srcIpMask']").val("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
}else if($("input[name='srcIpMask']").val()=="255.255.255.255"){
$("input[name='srcIpMask']").val("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
}
if(!$("input[name='dstIpMask']").val()){
$("input[name='dstIpMask']").val("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
}else if($("input[name='dstIpMask']").val()=="255.255.255.255"){
$("input[name='dstIpMask']").val("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
}
if(!$("input[name='srcIp']").val()){
$("input[name='srcIp']").val("::");
}else if($("input[name='srcIp']").val()=="0.0.0.0"){
$("input[name='srcIp']").val("::");
}
if(!$("input[name='dstIp']").val()){
$("input[name='dstIp']").val("::");
}else if($("input[name='dstIp']").val()=="0.0.0.0"){
$("input[name='dstIp']").val("::");
}
}
switchIpType($(this));
});
$("#inputFrom").validate({
rules: {
srcPort: {
max: 65535,
min: 0
},
dstPort: {
max: 65535,
min: 0
}
},
messages: {
srcPort: {
max: '范围0-65535!',
min: '范围0-65535!'
},
dstPort: {
max: '范围0-65535!',
min: '范围0-65535!'
}
},
errorPlacement: function(error,element){
$(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error);
},
@@ -146,7 +83,7 @@ $(function(){
<div class="form-group">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="ip_type"/></label>
<div class="col-md-6">
<select name="ipType" class="selectpicker show-tick form-control required" title=<spring:message code="select"/>>
<select name="ipType" class="selectpicker show-tick form-control required">
<option value="4" <c:if test="${dnsIpCfg.ipType==4}">selected</c:if> >V4</option>
<option value="6" <c:if test="${dnsIpCfg.ipType==6}">selected</c:if>>V6</option>
</select>
@@ -169,7 +106,7 @@ $(function(){
<div class="form-group ">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="client_address_mask"/></label>
<div class="col-md-6">
<input class="form-control required" type="text" name="srcIpMask" value="${dnsIpCfg.srcIpMask}">
<input class="form-control required ipMask" type="text" name="srcIpMask" value="${dnsIpCfg.srcIpMask}">
</div>
<div for="srcIpMask"></div>
</div>
@@ -180,7 +117,7 @@ $(function(){
<div class="form-group">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="client_port"/></label>
<div class="col-md-6">
<input class="form-control required" type="text" name="srcPort" value="${dnsIpCfg.srcPort}">
<input class="form-control required" type="text" name="srcPort" value="${dnsIpCfg.srcPort}" range="[0,65535]">
</div>
<div for="srcPort"></div>
</div>
@@ -189,7 +126,7 @@ $(function(){
<div class="form-group ">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="client_port_mask"/></label>
<div class="col-md-6">
<input class="form-control required" type="text" name="srcPortMask" value="${dnsIpCfg.srcPortMask}">
<input class="form-control required" type="text" name="srcPortMask" value="${dnsIpCfg.srcPortMask}" range="[0,65535]">
</div>
<div for="srcPortMask"></div>
</div>
@@ -209,7 +146,7 @@ $(function(){
<div class="form-group ">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="server_address_mask"/></label>
<div class="col-md-6">
<input class="form-control required" type="text" name="dstIpMask" value="${dnsIpCfg.dstIpMask}">
<input class="form-control required ipMask" type="text" name="dstIpMask" value="${dnsIpCfg.dstIpMask}">
</div>
<div for="dstIpMask"></div>
</div>
@@ -220,7 +157,7 @@ $(function(){
<div class="form-group">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="server_port"/></label>
<div class="col-md-6">
<input class="form-control required" type="text" name="dstPort" value="${dnsIpCfg.dstPort}">
<input class="form-control required" type="text" name="dstPort" value="${dnsIpCfg.dstPort}" range="[0,65535]">
</div>
<div for="dstPort"></div>
</div>
@@ -229,7 +166,7 @@ $(function(){
<div class="form-group ">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="server_port_mask"/></label>
<div class="col-md-6">
<input class="form-control required" type="text" name="dstPortMask" value="${dnsIpCfg.dstPortMask}">
<input class="form-control required" type="text" name="dstPortMask" value="${dnsIpCfg.dstPortMask}" range="[0,65535]">
</div>
<div for="dstPortMask"></div>
</div>

View File

@@ -62,16 +62,6 @@ $(function(){
});
$("#ipCfgFrom").validate({
rules: {
srcPort: {
max: 65535,
min: 0
},
dstPort: {
max: 65535,
min: 0
}
},
errorPlacement: function(error,element){
$(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error);
},

View File

@@ -6,6 +6,13 @@
<script type="text/javascript">
$(function(){
$("[name^='ipCfg']").attr("disabled",true);
if($("#ipSelect").is(":checked")){
$("[name^='ipCfg']").removeProp("disabled");
//解决select插件disbale后无法恢复
$(".bootstrap-select").removeClass("disabled");
$(".bootstrap-select button").removeClass("disabled");
$(".collapse").addClass("in");
}
//$("[name^='stringCfg']").attr("disabled",true);
//$("[name^='complexCfg']").attr("disabled",true);
//$("[name^='numCfg']").attr("disabled",true);

View File

@@ -0,0 +1,68 @@
var switchIpType=function(obj){
var type=$(obj).val();
var row=$(obj).parents('.row');
var srcIpMask=row.siblings().find("input[name$='srcIpMask']");
var dstIpMask=row.siblings().find("input[name$='dstIpMask']");
var srcIp=row.siblings().find("input[name$='srcIp']");
var dstIp=row.siblings().find("input[name$='dstIp']");
var srcPort=row.siblings().find("input[name$='srcPort']");
var srcPortMask=row.siblings().find("input[name$='srcPortMask']");
var dstPort=row.siblings().find("input[name$='dstPort']");
var dstPortMask=row.siblings().find("input[name$='dstPortMask']");
if(4==type){
if(!$(srcIpMask).val()){
$(srcIpMask).val("255.255.255.255");
}else if($(srcIpMask).val()=="FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"){
$(srcIpMask).val("255.255.255.255");
}
if(!$(dstIpMask).val()){
$(dstIpMask).val("255.255.255.255");
}else if($(dstIpMask).val()=="FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"){
$(dstIpMask).val("255.255.255.255");
}
if(!$(srcIp).val()){
$(srcIp).val("0.0.0.0");
}else if($(srcIp).val()=="::"){
$(srcIp).val("0.0.0.0");
}
if(!$(dstIp).val()){
$(dstIp).val("0.0.0.0");
}else if($(dstIp).val()=="::"){
$(dstIp).val("0.0.0.0");
}
if(!$(srcPort).val()){
$(srcPort).val("0");
}
if(!$(dstPort).val()){
$(dstPort).val("0");
}
if(!$(srcPortMask).val()){
$(srcPortMask).val("65535");
}
if(!$(dstPortMask).val()){
$(dstPortMask).val("65535");
}
}
if(6==type){
if(!$(srcIpMask).val()){
$(srcIpMask).val("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
}else if($(srcIpMask).val()=="255.255.255.255"){
$(srcIpMask).val("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
}
if(!$(dstIpMask).val()){
$(dstIpMask).val("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
}else if($(dstIpMask).val()=="255.255.255.255"){
$(dstIpMask).val("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
}
if(!$(srcIp).val()){
$(srcIp).val("::");
}else if($(srcIp).val()=="0.0.0.0"){
$(srcIp).val("::");
}
if(!$(dstIp).val()){
$(dstIp).val("::");
}else if($(dstIp).val()=="0.0.0.0"){
$(dstIp).val("::");
}
}
}