/***************************************************************** * 01. 업무구분 : 출입관리 * 02. 화면명 : 자바스크립트 공통 함수 모듈 * 03. 설명 : 자바스크립트 공통 함수 모듈 * 04. 작성 일자 : 2012.06.20 * 05. 작성자 : 정동호 ****************************************************************/ //= 117) && (event.keyCode <= 123))) // function // F5 { event.keyCode = 0; event.cancelBubble = true; event.returnValue = false; } } }; document.onkeydown = doNotReload; DU.locale = function() { return gJavaLocale; }; DU.viewManual = function(url) { if (DU.isEmpty(url)) { url = url || 'this'; DU.alert(url + " is no Manual"); } else { window.open('/jsp/tc/tcz/manual/manual.jsp?request=' + url + "&", '_blank', 'titlebar=1,width=950pt,scrollbars=1,height=660px,toolbar=0,menubar=0,status=0,resizable=0,location=0,directories=0,copyhistory=0'); } }; var ds_Setup =new DU.data.LJsonDataSet({ id: 'ds_Setup' , fields: [ {id: 'code'} , {id: 'value'} ] }); DU.setup = function(id) { return ds_Setup.getAt(ds_Setup.findRow("code", id, 0)).get("value"); }; DU.helperDesk = function() { var tell = ""; var admin = ""; tell = tell || DU.setup("VISIT_MANAGER_TEL"); admin = admin || DU.setup("VISIT_CONTROL_MESSAGE"); DU.alert("시스템에 문제가 생겼을 경우 관리자 또는 " + admin + "

☎ : " + tell); }; DU.requestExp = function(s) { return s.replace(/^'+|'+$/g, ""); }; DU.makeParameter = function(params, name, value) { params = params || ""; if (params == "") { params += name + "=" + value; } else { params += "&" + name + "=" + value; } return params; }; DU.getMakeURL = function(url, params) { return (url + "?" + params); }; DU.namespace("DU.util"); /** * @description 메세지 관련 창 띄우기 * @author 정동호 * @creation 2012.06.28 * */ DU.util.LMessage = { alert : function (option) { var msgBox = DU.widget.LMessageBox; var Ev = DU.util.LEvent; var option = option || {}; if(typeof option == 'string') { option = { text : option, handler : DU.emptyFn }; } option = DU.applyIf(option, { buttons: [ { text:"OK", handler:function(){ this.hideMask(); option.handler.call(this, window.event); this.destroy(); }, isDefault:true } ] }); msgBox.createMessageBox(option).show(); }, /******************************************************************************************************************* * 설명 : DU.prompt를 베이스로한 customized prompt * 작성일자 : 2012.06.28 * 작성자 : 정동호 ******************************************************************************************************************/ prompt : function(option) { var msgBox = DU.widget.LMessageBox; var Ev = DU.util.LEvent; var promptId = DU.id() ; var option = option || {}; if(typeof option == 'string') { option = { text : option, value: '', handler: DU.emptyFn }; } option = DU.applyIf(option, { buttons: [ { text:"OK", handler:function(){ this.hideMask(); option.handler.call(this, DU.get(promptId).getValue()); this.destroy(); }, isDefault:true }/* * , { text:"Cancel", handler:function(){ this.destroy(); } } */ ] }); option.text += "

"; msgBox.createMessageBox(option).show(); }, /******************************************************************************************************************* * 설명 : DU.confirm을 베이스로한 customized confirm * 작성일자 : 2012.06.28 * 작성자 : 정동호 ******************************************************************************************************************/ confirm : function(option) { var msgBox = DU.widget.LMessageBox; var Ev = DU.util.LEvent; var option = option || {}; if(typeof option == 'string') { option = { text : option, icon: '', handleYes:DU.emptyFn, handleNo:DU.emptyFn }; } option = DU.applyIf(option, { title:"Question", buttons: [ { text:"Yes", handler:function(){ this.hideMask(); option.handlerYes.call(this); this.destroy(); }, isDefault:true } , { text:"No", handler:function(){ this.hideMask(); option.handlerNo.call(this); this.destroy(); }} ] }); msgBox.createMessageBox(option).show(); }, /******************************************************************************************************************* * 설명 : DU.widget.LSimgpleDialog를 베이스로한 WaitPanel * 작성일자 : 2012.06.28 * 작성자 : 정동호 ******************************************************************************************************************/ waitPanel : function(option) { var option = DU.applyIf(option, { title:"Information", width:300, fixedcenter: true, draggable: true, visible: false, close: false, modal:true, constraintoviewport: true, isDefaultCSS:true, zindex:99999 }); var WaitPanel = new DU.widget.LSimpleDialog("messageBox", option); WaitPanel.setHeader(""); WaitPanel.render(document.body); return WaitPanel; } }; /*********************************************************************************************************************** * 설명 : 정규식과 패턴으로 원하는 String으로 변환 * 작성자 : 정동호 * 작성일 : 2012.06.25 * ************************************************************************/ /** * @type : function * @access : public * @desc : 정규식과 패턴으로 원하는 String으로 변환 * @sig : rgExp, rgStr, strPattern * @param : * rgExp required 정규식 설정 rgStr required 문자열 strPattern required 변환 패턴 정의 * @param : * rgExp에 쓰일 정규식은 http://evolt.org/node/36435 참조(영문) * @return : 치환된 데이트 스트링 * @author : 정동호 */ var gf_RegularMake = function(rgExp, rgStr, strPattern) { var oldStr = String(rgStr); var newStr = oldStr.replace(rgExp, strPattern); return newStr; }; /*********************************************************************************************************************** * 설명 : javascript로 구현한 Request * 작성일자 : 2012.06.27 * 작성자 : 정동호 **********************************************************************************************************************/ var gf_Request = function(valuename) // javascript로 구현한 Request { var rtnval = ""; var nowAddress = unescape(location.href); var parameters = (nowAddress.slice(nowAddress.indexOf("?")+1,nowAddress.length)).split("&"); for(var i = 0 ; i < parameters.length ; i++){ var varName = parameters[i].split("=")[0]; if(varName.toUpperCase() == valuename.toUpperCase()) { rtnval = parameters[i].split(varName + "=")[1];; break; } } return rtnval; }; /*********************************************************************************************************************** * 설명 : 등록 후 쉽게 조회를 돕기 위한 성명,생년월일 포스트 전송 * 작성일자 : 2012.06.28 * 작성자 : 정동호 **********************************************************************************************************************/ var createForm = function(frmId, methodId, actionId, targetId) { var f = document.createElement("form"); f.name = frmId; f.method = methodId || "GET"; f.action = actionId || ""; f.target = targetId || ""; return f; }; var addHidden = function(frmId, name, value) { var i = document.createElement("input"); i.type = "hidden"; i.name = name || ""; i.value = value || ""; frmId.insertBefore(i); return frm; }; DU.applyObject(DU.util.LDate, { /******************************************************************************************************************* * 설명 : 날짜 관련 오류 체크 * 작성일자 : 2012.07.17 * 작성자 : 정동호 ******************************************************************************************************************/ /** * @author 정동호 * @creation 2012.07.17 * @return void * @param {Object} * f_obj 체크할 객체 * @param {LEvent} * e 이벤트 객체 * @param {Boolean} * f_msg Alert 메세지를 보여 줄 것인지 설정 * @param {Function} * f_fn 수행 후 실행할 함수 * @param {String} * f_param 함수에 넘겨질 파라메터 */ validDate : function(f_obj, e, f_msg, f_fn, f_param) { var Ev = DU.util.LEvent; switch(e.keyCode) { case 13: try { Ev.stopEvent(e); } catch(e) { cfAlertMsg("tc.info.com.callAdmin"); } case 9: var obj = f_obj; var value = (obj.getValue()).trim(); if (DU.isEmpty(value) || (value.length == 0)) { if (f_msg) { DU.alert({ text: cfGetMsg("tc.err.com.dataFormat") , handler: function() { obj.setValue(""); obj.focus(); } }); } return; } if (f_fn) f_fn(f_param); break; } }, /** * @description Today 날짜 구하기 * @param {Integer} option * 현재 날짜에서 더하거나 뺄 수 * @return {Date} * @author 정동호 * @creation: 2012.07.02 * *
     * 
*/ toDay : function(option) { var newDate = new Date(); if (!DU.isEmpty(option)) newDate.setDate(newDate.getDate() + (option)); return newDate; } }); DU.applyObject(DU.util.LRenderer, { /******************************************************************************************************************* * 설명 : 연락처 렌더링 * 작성일자 : 2012.07.04 * 작성자 : 정동호 ******************************************************************************************************************/ contactRenderer : function() { return function(v) { if (DU.isUndefined(v)) v = ""; v = String(v); var length = v.length; switch(length) { case 10: case 11: v = v.insert(3, '-'); v = v.insert(v.length - 4, '-'); break; default: v = v; } return v; }; }, /** * 여러번 real number 형식을 재사용할 수 있는 real number rendering 함수를 리턴한다. * @method pointRenderer * @param * @return {function} */ pointRenderer : function() { return function(v){ var oConfig = { //decimalPlaces: 3, decimalSeparator: ".", thousandsSeparator: "," }; if (!DU.isUndefined(v) && !DU.isNull(v) && v != 0) { v = DU.util.LFormat.numberFormat(Number(v), oConfig); } return v; }; } }); DU.util.LQuery = { /******************************************************************************************************************* * 설명 : Make xmlquery url * 작성일자 : 2012.06.20 * 작성자 : 정동호 ******************************************************************************************************************/ makeQuery : function(xml, work, jndi) { if (jndi == 0) { // default return "/tc/tca/d01/common/retrieveSingleData.ajax?work="+ work + "&xmlquery=" + xml + "&jndi=0"; } else if (jndi == 1) { // ds_tc return "/tc/tca/d01/common/retrieveSingleData.ajax?work="+ work + "&xmlquery=" + xml + "&jndi=1"; } else if (jndi == 2) { // json return "/jsp/tc/tcz/" + work + "/" + xml + ".json"; } }, /** * @description 단순 ajax 호출 * @param url * 호출 url * @param param * 호출 param * @param syncType * ajax sync / async * @param protocol * get / post * @return String * @author 정동호 * *
     * 
*/ callUrl : function(url, urlQuery, syncType, protocol) { var params; if(!protocol) protocol = "GET"; if (typeof(urlQuery) != 'string') { params = urlQuery; urlQuery = ''; protocol = "POST"; } else { url = url + "?" + urlQuery; } if (syncType != 'async') { var result; DU.LConnect.syncRequest(protocol, url, { success : function(e) { result = e.responseText; }, failure : function(e) { result = e.responseText; } }, params); return result; } else { DU.LConnect.asyncRequest(protocol, url, { success : function(e) { }, failure : function(e) { } }, params); } } }; DU.namespace("DU.data"); /** * @type : function * @access : public * @desc : 단순 ajax 호출 */ DU.data.LJdhDataSet = function(config) { DU.data.LJdhDataSet.superclass.constructor.call(this, config); /** * @description 데이터 처리 방식 (1:Json); * @property dataSetType * @private * @type {Int} */ this.dataSetType = DU.data.LJsonDataSet.DATA_TYPE; }; DU.extend(DU.data.LJdhDataSet, DU.data.LJsonDataSet, { /** * @description 콤보를 읽어서 세션에 저장 * @methmod session * @param (Object} target 콤보 객체 * @param {String} qId ajax navi ID * @return void * @creation 2012.07.19 * @author 정동호 */ session: function(target, qId) { if (this.getCount() == 0) { // get 함수에 decodeURIComponent 가 되어서 리턴되어야 하나, 무슨 이유인지 encode 상태로 반환되어, decodeURIComponent 함수로 둘러 쌈 var dataCd = decodeURIComponent(DU.util.LCookie.get(this.id)); if (dataCd == "null") { var ret = DU.util.LQuery.callUrl(qId, null, 'sync'); var data = DU.util.LJson.decode(ret.trim()); this.loadData(data[0]); DU.util.LCookie.set(this.id, ret, {path: "/"}); } else { var data = DU.util.LJson.decode(dataCd); this.loadData(data[0]); } if (this.getCount() > 0) { target.repaint(); target.doExpand(); } } }, /** * @description state값을 리턴하는 메소드 * @method getState * @protected * @return {String} */ getState : function(row) { var record = this.getAt(row); switch (record.state) { case DU.data.LRecord.STATE_INSERT: return 'I'; break; case DU.data.LRecord.STATE_UPDATE: return 'U'; break; case DU.data.LRecord.STATE_DELETE: return 'D'; break; } return ''; } }); DU.namespace("DU.data"); /** * LTransactionManager 확장 * * @namespace DU.data * @class LTransactionManagerEx * @extends DU.util.LEventProvider * @constructor LTransactionManagerEx * @param {Object} * oConfig The initial LTransactionManagerEx. */ DU.data.LTransactionManagerEx = function(oConfig){ DU.data.LTransactionManagerEx.superclass.constructor.call(this); var config = oConfig || {}; config = DU.util.LDom.applyIfProperties(config, '$.base.transactionManager'); config = DU.applyIf(config, { text: '잠시만 기다려 주십시오.' }); /** * @description field의 id * @property id * @public * @type {String} */ this.id = config.formId; DU.applyObject(this, config, true); }; DU.extend(DU.data.LTransactionManagerEx, DU.data.LTransactionManager, { /** * @description {DU.data.LDataSet}의 변경정보를 가지고 url로 서버를 호출하는 메소드 *

     *  var options = {
     *       dataSets:[dataSet],
     *       url:'test.dev',
     *       params:{},
     *       callback:{}
     *   }
     * 
*

Sample: 보기

* @method updateDataSet * @public * @param {Object} options 호출할때 전달할 Option정보 객체 *
* dataSets {Array} dataSet 배열
* url {String} url
* callback {Object} success, failure 콜백 메소드
* params {Object} 파라미터 객체
* isCheckedUpdate {boolean} 변경된 값이 존재하는지 체크할지 여부 *
* @return void * * @description 커스터마이징 */ updateDataSet : function(options) { var config = options || {}; config = DU.applyIf(config, { dataSets:[], url:null, params:{}, callback:{}, isCheckedUpdate:this.isCheckedUpdate }); var dataSets = config.dataSets; if(!this.filterTask) this.filterTask = new DU.util.LDelayedTask(DU.util.LFunction.createDelegate(function() {this.doUpdateDataSet(config, dataSets);}, this)); this.filterTask.delay(0); }, /** * @description 호출하게 되면 트랜잭션 작업을 null로 만듬 * @method taskKill * @public * @return {String} */ taskKill : function() { this.filterTask = null; } }); DU.namespace("DU.widget"); /*********************************************************************************************************************** * 설명 : IE가 아닌 브라우져에서는 width가 다르기 때문에 * width에서 border width인 1px을 뺀 것을 설정 * 을 위해 커스터마이징을 함 * 작성일자 : 2012.07.13 * 작성자 : 정동호 **********************************************************************************************************************/ DU.applyObject(DU.widget.LGridView.prototype, { getColGroupHtml : function(domTable,isMultiHeader) { var colWidths = new Array(); var colCount = this.columnModel.getColumnCount(); for(var i = 0 ; i < colCount; i++) { var column = this.columnModel.getColumnAt(i); colWidths.push({ id: column.getId(), hidden: column.isHidden(), width: this.adjustColumnWidth(column.getWidth(), true) }); } colWidths = this.adjustColGroupWidths(colWidths,domTable); var colgroup = ''; var hidden = ""; var width = 0; for(var i = 0 ; i < colWidths.length; i++) { // multiheader일 경우 td dom을 그리지 않으므로 colgroup도 뺀다. ie6/7에서 td가 안보여 진다. if (isMultiHeader && colWidths[i].hidden) { continue; } else { hidden = colWidths[i].hidden ? ' L-hide-display' : ''; if (!DU.browser.msie) width = colWidths[i].hidden ? 0 : (colWidths[i].width); else width = colWidths[i].hidden ? 0 : colWidths[i].width; colgroup += ''; } } colgroup += ''; return colgroup; }, /** * @description body의 cell html을 생성하여 리턴하는 메소드 * @method getRenderCell * @protected * @return {String} */ getRenderCell: function(row, i, columnCount, record) { var ts = this.templates || {}; var column = this.columnModel.getColumnAt(i); var defaultCss = (i == 0) ? "L-grid-cell-first" : (i == columnCount - 1) ? "L-grid-cell-last" : ""; var style = ""; if (!DU.browser.msie) style = "width:" + (column.getWidth() - 1) + "px;"; else style = "width:" + (this.adjustColumnWidth(column.getWidth())) + "px;"; if(column.align != '') style += 'text-align:' + column.align+';'; var hidden = column.isHidden()? 'L-hide-display' : ''; var css = []; if(column.field && record.isModifiedField(column.field)) css.push('L-grid-cell-update'); if(this.skipRowCellEvent !== true) this.fireEvent('renderCell', {css:css, row:row, col:i, record:record}); if(column.cellStyle) style += column.cellStyle + ';'; css = this.getRenderCellClass(css, row, i, record); if(column.verticalMerge === true && column.getField() != null) { var mergeCss = this.getVerticalMergeCss(row, i, column.getField()); if(mergeCss) css.push(mergeCss); } var p = { id: column.getId(), first_last: defaultCss, css: [], style: style, hidden: hidden }; p.value = this.getRenderCellValue(p, record, column, row, i); for(var i = 0; i < p.css.length; i++) css.push(p.css[i]); p.css = css.join(' '); if(p.value == null) p.value = ''; return ts.cell.apply(p); }, updateColumnWidth : function(cellIndex,oldWidth,newWidth){ var diffWidth = newWidth - oldWidth; // column width가 변경될 경우 전체 cell에 적용, cell merge는 배제. var contentWidth = this.columnModel.getTotalWidth(true); var offsetWidth = contentWidth + this.scrollBarWidth; // width 변경해야할 것 : header offset, header table & cell width, grid-body, body table & cell width this.updateHeaderWidth(cellIndex,diffWidth,offsetWidth,contentWidth, newWidth); this.bodyEl.setWidth(contentWidth); // empty message div도 조정 var isEmpty = this.updateEmptyWidth(contentWidth); if (!isEmpty) { // 성능을 위해 dom 직접 사용 var gridRows = this.bodyEl.dom.childNodes; var row = null; for (var i = 0; i < gridRows.length; i++) { row = gridRows[i]; if (row.firstChild && row.firstChild.tagName && row.firstChild.tagName.toLowerCase() == "table") { row.firstChild.style.width = contentWidth + "px"; row.firstChild.rows[0].childNodes[cellIndex].style.width = ((!DU.browser.msie)? (this.adjustColumnWidth(newWidth) - 1) : this.adjustColumnWidth(newWidth)) + "px" ; } row.style.width = contentWidth + "px"; } } }, /** * @description column resize에 따른 header column 넓이 설정 * @method updateHeaderWidth * @protected * @param {int} * cellIndex * @param {int} * diffWidth * @param {int} * offsetWidth * @param {int} * contentWidth * @param {int} * newWidth * @return {void} */ updateHeaderWidth : function(cellIndex,diffWidth,offsetWidth,contentWidth, newWidth){ var tblEl = this.headerOffsetEl.select("table").getAt(0); var colListEl = this.headerOffsetEl.select("colgroup col"); if(this.columnModel.multiheaderHtml){ // multi header일 경우 hidden일 경우 colgroup에서 hidden인 col이 생성되지 않는다. index를 조정해야 한다. var columnCount = this.columnModel.getColumnCount(); var minus = 0; for(var i=0;i ' + message); invalidObjList = invalidObjList.concat(colLabel); if (i != (invalidList.length - 1)) invalidObjList = invalidObjList.concat(', '); } newInvalidObjList.push((row + 1) + '번 : ' + invalidObjList); } } this.messageList = newMessageList; this.invalidObjList = newInvalidObjList; return isValid; }, /** * 잘 못된 객체 레이블명 리스트 * @method getMessageList * @return {String} 출력했던 전체 메시지 */ getObjectList : function() { var objList = []; /*for (var i = 0; i < this.messageList.length; i++) { var label = DU.util.LString.advancedSplit(this.messageList[i], ":", "it"); objList[i] = label[0]; } this.messageList = objList;*/ return this.invalidObjList; } }); /** * AllowCharValidator : 지정된 문자가 들어있을 경우 유효한것으로 판단한다. { id: 'col17', validExp:'Col17:true:allow=\\a;\\n'} * Wild 문자 ; - \; * 한글 - \h * 영문 - \a * 숫자 - \n * * @namespace DU.validate * @class LAllowValidator * @extends DU.validate.LValidator * @constructor LAllowValidator * @param {Object} * oConfig The intial LAllowValidator. */ DU.validate.LAllowValidator = function(id, fStr, oConfig){ DU.validate.LAllowValidator.superclass.constructor.call(this, id, oConfig); this.config = oConfig || {}; this.fStrArr = DU.util.LString.advancedSplit(fStr, ";", "i"); var msgFStr = String(fStr).split(";"); for(var i=0; i< msgFStr.length; i++) { if (msgFStr[i] == "koKR") { msgFStr[i] = "\\h"; // 한글 this.fStrArr[i] = "\\h"; // 한글 } else if(msgFStr[i] == "enUS") { msgFStr[i] = "\\a"; // 영어 this.fStrArr[i] = "\\a"; // 한글 } else if(msgFStr[i] == "num") { msgFStr[i] = "\\n"; // 숫자 this.fStrArr[i] = "\\n"; // 한글 } } this.msgId = "$.base.msg500"; // if 체크 부분이 잘 못되어 수정함 var retFStr = []; for (var i = 0; i < msgFStr.length; i++) { if (msgFStr[i] == "\\h") { retFStr[i] = DU.getMessageManager().get('$.core.kor'); // 한글 } else if(msgFStr[i] == "\\a") { retFStr[i] = DU.getMessageManager().get('$.core.eng'); // 영어 } else if(msgFStr[i] == "\\n") { retFStr[i] = DU.getMessageManager().get('$.core.num'); // 숫자 } } if (retFStr.length >= 2 )this.message = DU.getMessageManager().get(this.msgId, [retFStr.join(', ')]); else this.message = DU.getMessageManager().get(this.msgId, [retFStr.join('')]); }; DU.extend(DU.validate.LAllowValidator, DU.validate.LValidator, { otype: 'DU.validate.LAllowValidator', validate : function(value) { value += ''; for (var i = 0; i < value.length; i++) { var chr = value.charAt(i); var cCode = chr.charCodeAt(0); if ((0xAC00 <= cCode && cCode <= 0xD7A3)) { if(DU.util.LArray.indexOf(this.fStrArr, '\\h') == -1) return false; } else if((0x61 <= cCode && cCode <= 0x7A) || (0x41 <= cCode && cCode <= 0x5A)) { if(DU.util.LArray.indexOf(this.fStrArr, '\\a') == -1) return false; } else if(!isNaN(chr)) { if(DU.util.LArray.indexOf(this.fStrArr, '\\n') == -1) return false; } else { var isValid = false; for(var j = 0 ; j < this.fStrArr.length; j++) { if(this.fStrArr[j] == '\\h' || this.fStrArr[j] == '\\a' || this.fStrArr[j] == '\\n') continue; isValid = true; if(this.fStrArr[j].indexOf(chr) < 0) { isValid = false; break; } } if(isValid == false) return false; } } return true; } }); DU.namespace("DU.validate"); /** * LMobileValidator 폰번호인지 체크하는 validator * @namespace DU.validate * @class LMobileValidator * @constructor LMobileValidator * @param {Object} oConfig The intial LMobileValidator. */ DU.validate.LMobileValidator = function(id, oConfig){ DU.validate.LMobileValidator.superclass.constructor.call(this, id, oConfig); this.config = oConfig || {}; this.msgId = "$.base.msg502"; this.message = DU.getMessageManager().get(this.msgId); }; DU.extend(DU.validate.LMobileValidator, DU.validate.LValidator, { otype: 'DU.validate.LMobileValidator', validate : function(value) { var regExp = /^01(?:0|1|[6-9])(?:\d{3}|\d{4})\d{4}$/g; if ( !regExp.test(value) ) { return false; } else { return true; } } }); DU.namespace("DU.validate"); /** * LLicensepnValidator 올바른 차량번호인지 체크하는 validator * @namespace DU.validate * @class LLicensepnValidator * @constructor LLicensepnValidator * @param {Object} oConfig The intial LLicensepnValidator. * @author 정동호 * @creation 2012.08.06 * @ * */ DU.validate.LLicensepnValidator = function(id, oConfig){ DU.validate.LLicensepnValidator.superclass.constructor.call(this, id, oConfig); this.config = oConfig || {}; var pattern = ["구 번호판", "신 번호판", "임시번호판", "특수차량"]; this.msgId = "$.base.msg503"; this.message = DU.getMessageManager().get(this.msgId, [pattern.join(', ')]); }; DU.extend(DU.validate.LLicensepnValidator, DU.validate.LValidator, { otype: 'DU.validate.LLicensepnValidator', validate : function(value) { var carNo = value.trim(); // 자동차번호 // 형식1 체크 : 한글2자 + 01~99 + 한글1자 + 00~99 + 00~99 var pattern1 = /[가-힣]{2}[0-9]{1}[0-9]{1}[가-힣]{1}[0-9]{4}/g; // 형식2 체크 : 한글2자 + 01~99 + - + 00~99 + 00~99 var pattern2 = /[가-힣]{2}[0-9]{1}[0-9]{1}[-]{1}[0-9]{4}/g; // 형식3 체크 : 01~99 + 한글1자 +00~99 + 00~99 var pattern3 = /[0-9]{1}[0-9]{1}[가-힣]{1}[0-9]{4}/g; // 형식4 체크 : 임 + 숫자6자리 var pattern4 = /[임]{1}[0-9]{6}/g; // 형식5 체크 : 임시 + 숫자6자리 var pattern5 = /[임]{1}[시]{1}[0-9]{6}/g; // 형식6 체크 : 한글2자 + 01~99 + 한글1자 + 00~99 + 00~99 var pattern6 = /[가-힣]{2}[0-9]{1}[가-힣]{1}[0-9]{4}/g; // 형식7 체크 : 숫자3자 + 한글 1자 + 00~99 + 00~99 var pattern7 = /[0-9]{1}[0-9]{1}[0-9]{1}[가-힣]{1}[0-9]{4}/g; if(pattern1.test(carNo) && carNo.length == 9) { return true; } if(pattern2.test(carNo) && carNo.length == 9) { return true; } if(pattern3.test(carNo) && carNo.length == 7) { return true; } if(pattern4.test(carNo) && carNo.length == 7) { return true; } if(pattern5.test(carNo) && carNo.length == 8) { return true; } if(pattern6.test(carNo) && carNo.length == 8) { return true; } if(pattern7.test(carNo) && carNo.length == 8) { return true; } return false; } }); DU.namespace("DU.validate"); /** * LMaxFloatValidator 정수,소수점 자리수 체크하는 validator * @namespace DU.validate * @class LMaxFloatValidator * @constructor LMaxFloatValidator * @param {Object} oConfig The intial LMaxFloatValidator. * @author 정동호 * @creation 2012.08.07 * @ * */ DU.validate.LMaxFloatValidator = function(id, fStr, oConfig){ DU.validate.LMaxFloatValidator.superclass.constructor.call(this, id, oConfig); this.config = oConfig || {}; this.fStrArr = DU.util.LString.advancedSplit(fStr, "%", "i"); var maxArray = String(fStr).split("%"); this.msgId = "$.base.msg504"; this.message = DU.getMessageManager().get(this.msgId, [maxArray[0], maxArray[1]]); }; DU.extend(DU.validate.LMaxFloatValidator, DU.validate.LValidator, { otype: 'DU.validate.LMaxFloatValidator', validate : function(value) { if (isNaN(value)) { //this.message = ggetMsg(ezMessage("pbf.err.com.onlyNumber"), [ "@" ]); return false; } var strChkVal; if (value.toString().indexOf(".") < 0) { strChkVal = value.toString() + ".0"; } else { strChkVal = value.toString(); } var maxArray = this.fStrArr; var reg = new RegExp("^([0-9]{1," + maxArray[0] + "})?([.][0-9]{0," + maxArray[1] + "})?$", "g"); var bReturn = reg.test(strChkVal); if (!bReturn) { //this.message = gMsg.getMsg(ezMessage("pbf.err.com.maxFloat"), maxArray); return false; } this.validity = true; return true; } }); DU.LConnect.syncRequest('POST', DU.util.LQuery.makeQuery('retrieveSetup', 'json', 2), { success: function(e) { var data = DU.util.LJson.decode((e.responseText).trim()); ds_Setup.loadData(data[0]); }}, '', {} ); //]]>