From 08dd0f386860aecd9c0356c89f190e48207c0acc Mon Sep 17 00:00:00 2001 From: zhangwenqing Date: Wed, 27 Mar 2019 18:05:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=85=8D=E7=BD=AE=E4=BF=9D?= =?UTF-8?q?=E6=8A=A4=E5=90=8D=E5=8D=95=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nis/domain/basics/ProtectionListInfo.java | 57 ++++ src/main/java/com/nis/util/Constants.java | 7 +- .../nis/web/controller/BaseController.java | 3 + .../basics/InnerProtectionListController.java | 83 ++++++ .../web/dao/basics/InnerProtectionDao.java | 21 ++ .../nis/web/dao/basics/InnerProtectionDao.xml | 128 +++++++++ .../basics/InnerProtectionListService.java | 106 +++++++ .../resources/messages/message_en.properties | 3 +- .../resources/messages/message_ru.properties | 3 +- .../messages/message_zh_CN.properties | 3 +- .../20190327/create_inner_protection_list.sql | 12 + .../views/basics/protectionInfoForm.jsp | 106 +++++++ .../views/basics/protectionInfoList.jsp | 260 ++++++++++++++++++ .../WEB-INF/views/cfg/complexCfgForm.jsp | 7 +- .../webapp/static/global/scripts/common.js | 59 +++- 15 files changed, 838 insertions(+), 20 deletions(-) create mode 100644 src/main/java/com/nis/domain/basics/ProtectionListInfo.java create mode 100644 src/main/java/com/nis/web/controller/basics/InnerProtectionListController.java create mode 100644 src/main/java/com/nis/web/dao/basics/InnerProtectionDao.java create mode 100644 src/main/java/com/nis/web/dao/basics/InnerProtectionDao.xml create mode 100644 src/main/java/com/nis/web/service/basics/InnerProtectionListService.java create mode 100644 src/main/resources/sql/20190327/create_inner_protection_list.sql create mode 100644 src/main/webapp/WEB-INF/views/basics/protectionInfoForm.jsp create mode 100644 src/main/webapp/WEB-INF/views/basics/protectionInfoList.jsp diff --git a/src/main/java/com/nis/domain/basics/ProtectionListInfo.java b/src/main/java/com/nis/domain/basics/ProtectionListInfo.java new file mode 100644 index 000000000..1e159d8a1 --- /dev/null +++ b/src/main/java/com/nis/domain/basics/ProtectionListInfo.java @@ -0,0 +1,57 @@ +package com.nis.domain.basics; + +import java.io.Serializable; +import java.util.Date; + +import com.nis.domain.configuration.BaseCfg; + +public class ProtectionListInfo extends BaseCfg implements Serializable{ + + /** + * + */ + private static final long serialVersionUID = -3781310894175345207L; + private Integer proId; + private String keyword; + private String targetType; + private String description; + + + public Integer getProId() { + return proId; + } + public void setProId(Integer proId) { + this.proId = proId; + } + public String getKeyword() { + return keyword; + } + public void setKeyword(String keyword) { + this.keyword = keyword; + } + public String getTargetType() { + return targetType; + } + public void setTargetType(String targetType) { + this.targetType = targetType; + } + public Date getCreateTime() { + return createTime; + } + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + public Date getEditTime() { + return editTime; + } + public void setEditTime(Date editTime) { + this.editTime = editTime; + } + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + +} diff --git a/src/main/java/com/nis/util/Constants.java b/src/main/java/com/nis/util/Constants.java index 6e9bc4177..195e5d2e6 100644 --- a/src/main/java/com/nis/util/Constants.java +++ b/src/main/java/com/nis/util/Constants.java @@ -828,5 +828,10 @@ public final class Constants { /** * vpn cgi接口报错信息 */ - public static final String CGI_ERROR = Configurations.getStringProperty("cgiError","");; + public static final String CGI_ERROR = Configurations.getStringProperty("cgiError",""); + + /** + * 配置保护名单字典key + */ + public static final String CACHE_PROTECTION_LIST_DICT = "protetionListDict"; } diff --git a/src/main/java/com/nis/web/controller/BaseController.java b/src/main/java/com/nis/web/controller/BaseController.java index da1d59524..86b3235c8 100644 --- a/src/main/java/com/nis/web/controller/BaseController.java +++ b/src/main/java/com/nis/web/controller/BaseController.java @@ -155,6 +155,7 @@ import com.nis.web.service.SystemService; import com.nis.web.service.UserService; import com.nis.web.service.basics.AsnGroupInfoService; import com.nis.web.service.basics.AsnIpCfgService; +import com.nis.web.service.basics.InnerProtectionListService; import com.nis.web.service.basics.IpReuseIpCfgService; import com.nis.web.service.basics.PolicyGroupInfoService; import com.nis.web.service.basics.ServiceDictInfoService; @@ -331,6 +332,8 @@ public class BaseController { protected PxyObjSpoofingIpPoolService pxyObjSpoofingIpPoolService;// 欺骗IP池 @Autowired protected AsnGroupInfoService asnGroupInfoService;// asn组 + @Autowired + protected InnerProtectionListService innerProtectionListService; /** * 管理基础路径 */ diff --git a/src/main/java/com/nis/web/controller/basics/InnerProtectionListController.java b/src/main/java/com/nis/web/controller/basics/InnerProtectionListController.java new file mode 100644 index 000000000..a56a810d1 --- /dev/null +++ b/src/main/java/com/nis/web/controller/basics/InnerProtectionListController.java @@ -0,0 +1,83 @@ +package com.nis.web.controller.basics; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang.StringUtils; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; + +import com.nis.domain.Page; +import com.nis.domain.basics.ProtectionListInfo; +import com.nis.util.StringUtil; +import com.nis.web.controller.BaseController; + +/** + * 内置配置保护名单管理 + */ +@Controller +@RequestMapping(value = "${adminPath}/basics/innerProtectionList") +public class InnerProtectionListController extends BaseController{ + + @RequestMapping(value = {"/list", ""}) + public String policyGroupList(ProtectionListInfo cfg,HttpServletRequest request, HttpServletResponse response, Model model, + RedirectAttributes redirectAttributes) { + if(cfg == null)cfg=new ProtectionListInfo(); + Page pageCondition = new Page(request, response,"r"); + Page page = innerProtectionListService.findProtectionInfoList(pageCondition,cfg); + + model.addAttribute("cfg", cfg); + model.addAttribute("page", page); + return "/basics/protectionInfoList"; + } + + @RequestMapping(value={"/form"}) + public String form(Integer groupType,String ids,Model model,String doAction,RedirectAttributes redirectAttributes) { + ProtectionListInfo protectionListInfo = new ProtectionListInfo(); + if(!StringUtil.isEmpty(ids)){ + protectionListInfo = innerProtectionListService.getById(Integer.parseInt(ids)); + } + model.addAttribute("_cfg", protectionListInfo); + return "/basics/protectionInfoForm"; + } + + @RequestMapping(value = "saveOrUpdate") + public String saveOrUpdate(ProtectionListInfo cfg,Model model,String itType,Integer groupType, + RedirectAttributes redirectAttributes) { + try { + innerProtectionListService.saveOrUpdate(cfg); + addMessage(redirectAttributes,"success","save_success"); + } catch (Exception e) { + logger.error("新增失败",e); + addMessage(redirectAttributes,"error","save_failed"); + } + return "redirect:" + adminPath + "/basics/innerProtectionList/list"; + } + + @RequestMapping(value={"delete"}) + public String delete(RedirectAttributes redirectAttributes,String ids,int isValid) { + try { + innerProtectionListService.deldete(ids,isValid); + addMessage(redirectAttributes,"success","delete_success"); + } catch (Exception e) { + logger.error("删除失败",e); + addMessage(redirectAttributes,"error","delete_failed"); + } + return "redirect:" + adminPath + "/basics/innerProtectionList/list"; + } + + @RequestMapping(value="ajaxGetAllInfo",method=RequestMethod.GET) + @ResponseBody + public Map> ajaxGetAllInfo(HttpServletRequest request, HttpServletResponse response){ + return innerProtectionListService.ajaxGetAllInfo(); + } +} diff --git a/src/main/java/com/nis/web/dao/basics/InnerProtectionDao.java b/src/main/java/com/nis/web/dao/basics/InnerProtectionDao.java new file mode 100644 index 000000000..fb1d6e4b5 --- /dev/null +++ b/src/main/java/com/nis/web/dao/basics/InnerProtectionDao.java @@ -0,0 +1,21 @@ +package com.nis.web.dao.basics; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; + +import com.nis.domain.basics.ProtectionListInfo; +import com.nis.web.dao.CrudDao; +import com.nis.web.dao.MyBatisDao; + +@MyBatisDao +public interface InnerProtectionDao extends CrudDao { + + List findProtectionInfoList(ProtectionListInfo protectionListInfo); + + ProtectionListInfo getById(@Param("proId")int proId); + + List ajaxGetAllInfo(); + + +} \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/basics/InnerProtectionDao.xml b/src/main/java/com/nis/web/dao/basics/InnerProtectionDao.xml new file mode 100644 index 000000000..da2d32b6b --- /dev/null +++ b/src/main/java/com/nis/web/dao/basics/InnerProtectionDao.xml @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + r.id,r.keyword,r.target_type,r.description,r.create_time,r.edit_time,r.creator_id,r.editor_id + + + + + + + + + INSERT INTO inner_protection_list( + KEYWORD, + TARGET_TYPE, + DESCRIPTION, + IS_VALID, + CREATOR_ID, + CREATE_TIME + )VALUES ( + #{keyword,jdbcType=VARCHAR}, + #{targetType,jdbcType=VARCHAR}, + #{description,jdbcType=VARCHAR}, + #{isValid,jdbcType=INTEGER}, + #{creatorId,jdbcType=INTEGER}, + #{createTime,jdbcType=TIMESTAMP} + ) + + + + update inner_protection_list + + + + keyword = #{keyword,jdbcType=VARCHAR}, + + + target_type = #{targetType,jdbcType=VARCHAR}, + + + description = #{description,jdbcType=VARCHAR}, + + + is_valid = #{isValid,jdbcType=INTEGER}, + + + editor_id = #{editorId,jdbcType=INTEGER}, + + + edit_time = #{editTime,jdbcType=TIMESTAMP}, + + + + + + AND id = #{proId,jdbcType=INTEGER} + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/service/basics/InnerProtectionListService.java b/src/main/java/com/nis/web/service/basics/InnerProtectionListService.java new file mode 100644 index 000000000..10d05824e --- /dev/null +++ b/src/main/java/com/nis/web/service/basics/InnerProtectionListService.java @@ -0,0 +1,106 @@ +package com.nis.web.service.basics; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.google.common.collect.Lists; +import com.nis.domain.Page; +import com.nis.domain.basics.ProtectionListInfo; +import com.nis.exceptions.MaatConvertException; +import com.nis.util.CacheUtils; +import com.nis.util.Constants; +import com.nis.util.StringUtil; +import com.nis.web.dao.basics.InnerProtectionDao; +import com.nis.web.security.UserUtils; +import com.nis.web.service.BaseService; + +@Service +public class InnerProtectionListService extends BaseService{ + + @Autowired + private InnerProtectionDao innerProtectionDao; + + public Page findProtectionInfoList(Page page, ProtectionListInfo entity) { + entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r")); + entity.setPage(page); + List list = innerProtectionDao.findProtectionInfoList(entity); + page.setList(list); + return page; + } + + public ProtectionListInfo getById(int id) { + ProtectionListInfo protectionListInfo = innerProtectionDao.getById(id); + return protectionListInfo; + } + + @Transactional(readOnly=false,rollbackFor=RuntimeException.class) + public void saveOrUpdate(ProtectionListInfo cfg) throws MaatConvertException{ + cfg.setIsValid(1); + if(cfg.getProId()==null){//新增 + Date createTime=new Date(); + cfg.setCreatorId(UserUtils.getUser().getId()); + cfg.setCreateTime(createTime); + innerProtectionDao.insert(cfg); + + }else{//更新 + Date editTime=new Date(); + cfg.setEditorId(UserUtils.getUser().getId()); + cfg.setEditTime(editTime); + innerProtectionDao.update(cfg); + + } + this.updateProtetionListDict(); + } + + @Transactional(readOnly=false,rollbackFor=RuntimeException.class) + public void deldete(String ids, int isValid){ + ProtectionListInfo entity=new ProtectionListInfo(); + Date editTime=new Date(); + entity.setEditorId(UserUtils.getUser().getId()); + entity.setEditTime(editTime); + entity.setIsValid(isValid); + if(!StringUtil.isEmpty(ids)){ + for (String id : ids.split(",")) { + if(!StringUtil.isEmpty(id)){ + entity.setProId(Integer.parseInt(id)); + innerProtectionDao.update(entity); + } + } + } + this.updateProtetionListDict(); + } + + public Map> ajaxGetAllInfo() { + Map> dictMap = (Map>)CacheUtils.get(Constants.CACHE_PROTECTION_LIST_DICT); + if(StringUtil.isEmpty(dictMap)) { + dictMap = this.updateProtetionListDict(); + } + return dictMap; + } + + /** + * 更新字典缓存 + * @return + */ + private Map> updateProtetionListDict() { + Map> dictMap = new HashMap>(); + List list = innerProtectionDao.ajaxGetAllInfo(); + for (ProtectionListInfo info : list) { + List putList = new ArrayList(); + if(dictMap.containsKey(info.getTargetType())) { + putList = dictMap.get(info.getTargetType()); + } + putList.add(info.getKeyword()); + dictMap.put(info.getTargetType(), putList); + } + CacheUtils.put(Constants.CACHE_PROTECTION_LIST_DICT, dictMap); + return dictMap; + } +} diff --git a/src/main/resources/messages/message_en.properties b/src/main/resources/messages/message_en.properties index 27e0c18e0..96b31650b 100644 --- a/src/main/resources/messages/message_en.properties +++ b/src/main/resources/messages/message_en.properties @@ -1501,4 +1501,5 @@ always=Permanent schedule=Scheduler cancel_all=Cancel all configurations! pre_version=Previous Version -approved_all=Approve all configurations! \ No newline at end of file +approved_all=Approve all configurations! +protection_list_manage=Protection List Manage \ No newline at end of file diff --git a/src/main/resources/messages/message_ru.properties b/src/main/resources/messages/message_ru.properties index 58977f8b0..0661058db 100644 --- a/src/main/resources/messages/message_ru.properties +++ b/src/main/resources/messages/message_ru.properties @@ -1506,4 +1506,5 @@ always=\u041F\u043E\u0441\u0442\u043E\u044F\u043D\u043D\u043E schedule=Scheduler cancel_all=Cancel all configurations! pre_version=Previous Version -approved_all=Approve all configurations! \ No newline at end of file +approved_all=Approve all configurations! +protection_list_manage=Protection List Manage \ No newline at end of file diff --git a/src/main/resources/messages/message_zh_CN.properties b/src/main/resources/messages/message_zh_CN.properties index 3640d0ed8..84cc65b02 100644 --- a/src/main/resources/messages/message_zh_CN.properties +++ b/src/main/resources/messages/message_zh_CN.properties @@ -1499,4 +1499,5 @@ schedule=Scheduler cancel_all=\u53D6\u6D88\u6240\u6709\u914D\u7F6E! pre_version=\u4e0a\u4e00\u7248 is_schduler=\u5b9a\u65f6\u5668 -approved_all=\u5BA1\u6838\u901A\u8FC7\u6240\u6709\u914D\u7F6E! \ No newline at end of file +approved_all=\u5BA1\u6838\u901A\u8FC7\u6240\u6709\u914D\u7F6E! +protection_list_manage=\u5185\u7F6E\u4FDD\u62A4\u540D\u5355\u7BA1\u7406 \ No newline at end of file diff --git a/src/main/resources/sql/20190327/create_inner_protection_list.sql b/src/main/resources/sql/20190327/create_inner_protection_list.sql new file mode 100644 index 000000000..03896f79a --- /dev/null +++ b/src/main/resources/sql/20190327/create_inner_protection_list.sql @@ -0,0 +1,12 @@ +CREATE TABLE `inner_protection_list` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `keyword` varchar(500) NOT NULL COMMENT '关键词', + `target_type` varchar(128) DEFAULT '' COMMENT '类型', + `description` varchar(200) DEFAULT '', + `is_valid` int(2) NOT NULL DEFAULT 0 COMMENT '-1删除 1有效', + `create_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `editor_id` int(11) DEFAULT NULL, + `creator_id` int(11) NOT NULL, + `edit_time` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=108 DEFAULT CHARSET=utf8mb4; diff --git a/src/main/webapp/WEB-INF/views/basics/protectionInfoForm.jsp b/src/main/webapp/WEB-INF/views/basics/protectionInfoForm.jsp new file mode 100644 index 000000000..7daa83dfc --- /dev/null +++ b/src/main/webapp/WEB-INF/views/basics/protectionInfoForm.jsp @@ -0,0 +1,106 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + +<spring:message code="${cfgName}"></spring:message> + + + + +
+ +

+ +

+ +
+
+
+
+
+ + + +
+
+
+ + + +
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+ <%-- --%> + +
+
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+
+
+
+ + +
+
+
+
+
+
+
+ +
+
+
+
+
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/basics/protectionInfoList.jsp b/src/main/webapp/WEB-INF/views/basics/protectionInfoList.jsp new file mode 100644 index 000000000..e582b2b99 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/basics/protectionInfoList.jsp @@ -0,0 +1,260 @@ +<%@ + page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + +<spring:message code="${cfgName}"></spring:message> + + + + +
+ + +

+ +

+ +
+
+
+
+ + + + <%-- --%> + + + + + +
+
+
+
+ + + + +
+ +
+ + + + + + +
+
+
+
+ + + +
+
+ + + + + <%-- --%> + + <%--
导出 + + +
--%> + + href="javascript:;"> + + +
+
+ + + +
+
+
+
+ + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+
+
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + ${fns:abbr(cfg.keyword,20)} + + + + + + ${fns:abbr(cfg.description,20)}${cfg.creatorName }${cfg.editorName }
+
${page}
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/complexCfgForm.jsp b/src/main/webapp/WEB-INF/views/cfg/complexCfgForm.jsp index 221d2c4a5..8244ea28b 100644 --- a/src/main/webapp/WEB-INF/views/cfg/complexCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/complexCfgForm.jsp @@ -85,7 +85,11 @@
- domainCheck urlCheck " type="text" id="tags_${tabName}${status.index}" + domainCheck + urlCheck + keywordSign " + type="text" id="tags_${tabName}${status.index}" name="${cfgName}.cfgKeywords" value="${cfg.cfgKeywords}">
@@ -97,6 +101,7 @@ domainCheck
urlCheck + keywordSign " type="text" name="${cfgName}.cfgKeywords" diff --git a/src/main/webapp/static/global/scripts/common.js b/src/main/webapp/static/global/scripts/common.js index dd4812ab4..74ebd6c64 100644 --- a/src/main/webapp/static/global/scripts/common.js +++ b/src/main/webapp/static/global/scripts/common.js @@ -1,11 +1,5 @@ $(function(){ - var protectedList = [".com"]; - $(".domainCheck").each(function(){ - $(this).on("blur",function(){ - protectedListWarn(this,$(this).val(),protectedList); - }); - protectedListWarn(this,$(this).val(),protectedList); - }); + // var leff =$("span[class~='le-ca-fo']").attr("data-original-title") // getConfigSyncStatus(); $("#contentTable").not(".logTb").find("tbody tr").each(function(i){ @@ -33,8 +27,33 @@ $(function(){ } }) - - + /** 获取配置保护名单 **/ + var protectionData; + var pathName = window.document.location.pathname.substring(0,window.document.location.pathname.lastIndexOf("/nis")+4); + $.ajax({ + type:'get', + url:pathName+'/basics/innerProtectionList/ajaxGetAllInfo', + dataType:"json", + async:false, + success:function(data){ + if(data != null){ + protectionData = data; + for(var key in data){ + var list = data[key]; + $("."+key).each(function(){ + if(!$(this).hasClass("tags")){ + this.setAttribute("onblur","protectedListWarn(this,'"+list+"')"); + } + protectedListWarn(this,list); + }); + + } + + } + + } + }); + //增加描述新增时的文字长度限制 $("form input[name='cfgDesc']").attr("maxlength","128"); $("form input[name='cfgDesc']").addClass("required"); @@ -436,8 +455,12 @@ $(function(){ }); $(this).prev("input[name$='cfgKeywords']").val(keywordValue);*/ exprTypeChecked(objNamePrefix,size,options); - if($(this).hasClass("urlCheck")){ - protectedListWarn($("#"+$(this).attr("id")+"_tagsinput"),$(this).val(),protectedList); + + var tagObj = $(this); + for(var key in protectionData){ + if(tagObj.hasClass(key)){ + protectedListWarn(tagObj,protectionData[key]); + } } }, onRemoveTag:function(tag,size){ @@ -449,8 +472,12 @@ $(function(){ }); $(this).prev("input[name$='cfgKeywords']").val(keywordValue);*/ exprTypeChecked(objNamePrefix,size,options); - if($(this).hasClass("urlCheck")){ - protectedListWarn($("#"+$(this).attr("id")+"_tagsinput"),$(this).val(),protectedList); + + var tagObj = $(this); + for(var key in protectionData){ + if(tagObj.hasClass(key)){ + protectedListWarn(tagObj,protectionData[key]); + } } } }); @@ -1719,9 +1746,11 @@ function addPrintTableCss(rowValue,cellValue,tableIdValue,cssName){ } } /**保护名单提醒**/ -function protectedListWarn(obj,value,protectedList){ +function protectedListWarn(obj,protectedList){ $(obj).next(".fa-warning").remove(); - if(value !=null){ + var value = $(obj).val(); + if(value != ""){ + protectedList = typeof(protectedList) == 'string' ? protectedList.split(",") : protectedList; if(protectedList.indexOf(value) >= 0){ //$(obj).after(""+$.validator.messages.protect_warn+""); $.jBox.info($.validator.messages.protect_warn,$.validator.messages.info);