/** * 프로그램 명 : spider 웹페이지 로딩시 기본 체크 모듈 * 일관성을 위하여 기본 적용되는 옵션들이 있고, 추가해주는 부분은 db에서 추가 하게 되어있다. db셋팅이 없으면 코딩으로 추가 하면 됨. * 작성자 : 오재훈 * 사용된 속성 * 1. nullable =false 이면 필수 요소임 * 2. chartype : 입력받을 문자열 셋 * |숫자만 | 영어만 | 영어숫자 | 실수 금액 |정수 금액 | * |onlynum | Eng | engnum | floatmoney | money | * 3. maskform #과 구분자로 이루어진 마스크. #은 값들이고 구분자가 각 위치에 들어가게 됨 * ex : 123456789 maskform="##-##,##.##/#" 결과 12-34,56.78/9 * 사용자 마스크를 따로 적용 할 경우 maskform="usermask"로 셋팅하여 마스크를 적용하면 프레임워크에서 spidersubmit()시에 숫자,영어 이외의 문자를 삭제함. * 4. maximum : 최대값 * 5. minimum : 최소값 * 6. disablecss : input창의 활성화,비활성화 속성 정의 * 7. maxbyte : 최대 입력 바이트 길이 계산. * 8. format : deprecate 함수 호출 형식으로 바뀜 프레임 워크에 있는 함수 호출(주민번호,이메일,사업자번호. 속성값 : psn,email,crn,date) * 9. message : nullable이 false (필수 항목) 일 경우 표시할 에러 메시지 */ /** *
* 다국어 alert() 메세지를 출력
*
* ex : printInfoMessage('I18NUtil.getLabel(localeCode, "IBA00001","개별1회이체한도금액이 초과하였습니다.")') (스크립틀릿임.)
* @param message : 다국어 메세지
*
*/
function printInfoMessage(message) {
var elem = document.createElement("");
elem.innerHTML = message;
alert(elem.outerText);
}
/**
*
* 다국어 confirm() 메세지를 출력
*
* ex : printConfirmMessage('I18NUtil.getLabel(localeCode, "COA00001","수정하시겠습니까?")') (스크립틀릿임.)
* @param message : 다국어 메세지
*
*/
function printConfirmMessage(message) {
var elem = document.createElement("");
elem.innerHTML = message;
return confirm(elem.outerText);
}
/*
*
* 스트링값을 정수형 머니 형태로 변환
*
* ex : changeIntMoneyType("1100000") 리턴되는 데이타 : 1,100,000
* @param data : 변환할 String 데이타
* @return 금액 형태로 변환된 스트링
*
function changeIntMoneyType(data) {
var tempV = data;
var moneyReg = new RegExp('(-?[0-9]+)([0-9]{3})');
tempV = tempV.replace(/\,/g, "");
while (moneyReg.test(tempV))
tempV = tempV.replace(moneyReg, '$1,$2');
return tempV;
}
*/
/*
*
* get,put 만 되는 hash table
* ex :
* var temphash = new javascriptHashtable()
* temphash.put("key1", "토요일"); 값 넣기
* temphash.put("key2", "일요일");
* temphash.get("key1"); 값 가져오기
* @constructor var temp = new javascriptHashtable();
*
function javascriptHashtable() {
this.hash = new Array();
}
javascriptHashtable.prototype.get = function (key) {
if(this.hash[key] == undefined)
return "null";
else
return this.hash[key];
}
javascriptHashtable.prototype.put = function (key, value) {
if (key == null || value == null) {
printInfoMessage("key and value do not permit null or blank");
return;
}
if (this.hash[key] != null) {
printInfoMessage("already exist value");
return;
}
this.hash[key] = value;
}
*/
/*
* * MaskUp된 데이타에서 마스크 Delemeter 제외하고 값 리턴 * * ex : unMaskUpData(form1.name) * @param element : 마스크한 요소 name 또는 해당 객체 자체. * @return 구분자를 제외한 데이타값 *function unMaskUpData(element) { var unmaskData = ""; //mask한 값에서 마스크 값 삭제 if ((element.maskform != undefined && element.maskform != "") || element.chartype == "money") unmaskData = getOnlyNumberFormat(element.value);//spcommon.js에 있는 숫자만 빼오기 로직 else unmaskData = element.value; return unmaskData; } */ /* * 공통 javascript 모듈 */ /* *
* window.showModalDialog(arg1,arg2,arg3) 옵션 배열의 갯수를 정확히 넣어줘야 합니다. 값이 필요 없으면 '' 을 넣습니다. * * ex : openPopModal(a.html,"test",[넓이,높이,center여부,x좌표,y좌표,scroll여부,resizable여부]) * openPopModal(a.html,"test",['200','200','yes','200','200','yes','yes']) * scroll은 default=yes임 , center가 yes로 되어있어도 x,y좌표가 있으면 좌표에 따른다. * @param url : 주소 * @param arg : 넘겨줄 파라미터 * @param option : 창관련 옵션(배열 형식) *function openPopModal(url, arg, option) { var sFeatures = ""; if (option != undefined) { var popWidth = option[0] == undefined || option[0] == "" ? "600" : option[0]; var popHeight = option[1] == undefined || option[1] == "" ? "450" : option[1]; var popCenter = option[2] == undefined || option[2] == "" ? "yes" : option[2]; var popXpos = option[3] == undefined || option[3] == "" ? 0 : option[3]; var popYpos = option[4] == undefined || option[4] == "" ? 0 : option[4]; var popScroll = option[5] == undefined || option[5] == "" ? "yes" : option[5]; var popResize = option[6] == undefined || option[6] == "" ? "no" : option[6]; sFeatures = "dialogWidth:" + popWidth + "px"; sFeatures += ";dialogHeight:" + popHeight + "px"; sFeatures += ";center:" + popCenter; sFeatures += ";dialogLeft:" + popXpos + "px"; sFeatures += ";dialogTop:" + popYpos + "px"; sFeatures += ";scroll:" + popScroll; sFeatures += ";resizable:" + popResize; } //Xecure 적용되면 풀어주어야 함 var qs ; var path = "/"; var cipher; var xecure_url; // get path info & query string & hash from url qs_begin_index = url.indexOf('?'); path = getPath(url) // get query string action url if ( qs_begin_index < 0 ) qs = ""; else qs = url.substring(qs_begin_index + 1, url.length ); if (gIsContinue == 0) { gIsContinue = 1; if (IsNetscape60()) // Netscape 6.0 cipher = document.XecureWeb.nsIXecurePluginInstance.BlockEnc(xgate_addr, path, XecureEscape(qs), "GET"); else cipher = document.XecureWeb.BlockEnc(xgate_addr, path, XecureEscape(qs),"GET"); gIsContinue = 0; } else { printInfoMessage(busy_info); return false; } if (cipher == "") return XecureWebError(); xecure_url = path + "?q=" + escape_url(cipher); // adding character set information if(usePageCharset) xecure_url += "&charset=" + document.charset; url = xecure_url; if(arg == "") arg = this;//파라미터가 없을 경우 현재 부모창을 넘김. window.showModalDialog(url, arg, sFeatures); } */ /* *
* window.showModelessDialog(arg1,arg2,arg3) 옵션 배열의 갯수를 정확히 넣어줘야 합니다. 값이 필요 없으면 '' 을 넣습니다. * scroll은 default=yes임 , center가 yes로 되어있어도 x,y좌표가 있으면 좌표에 따른다. * * ex : openPopModeless(a.html,"test",[넓이,높이,center여부,x좌표,y좌표,scroll여부,resizable여부]) * openPopModeless(a.html,"test",['200','200','yes','200','200','yes','yes']) * @param url : 주소 * @param arg : 파라미터 * @param option : 창관련 옵션(배열형식) * @return : 오픈시킨 window *function openPopModeless(url, arg, option) { var sFeatures = ""; if (option != undefined) { var popWidth = option[0] == undefined || option[0] == "" ? "600" : option[0]; var popHeight = option[1] == undefined || option[1] == "" ? "450" : option[1]; var popCenter = option[2] == undefined || option[2] == "" ? "yes" : option[2]; var popXpos = option[3] == undefined || option[3] == "" ? 0 : option[3]; var popYpos = option[4] == undefined || option[4] == "" ? 0 : option[4]; var popScroll = option[5] == undefined || option[5] == "" ? "yes" : option[5]; var popResize = option[6] == undefined || option[6] == "" ? "yes" : option[6]; sFeatures = "dialogWidth:"+popWidth+"px"; sFeatures += ";dialogHeight:"+popHeight+"px"; sFeatures += ";center:"+popCenter; sFeatures += ";dialogLeft:"+popXpos+"px"; sFeatures += ";dialogTop:"+popYpos+"px"; sFeatures += ";scroll:"+popScroll; sFeatures += ";resizable:"+popResize; } //Xecure 적용되면 풀어주어야 함 var qs ; var path = "/"; var cipher; var xecure_url; // get path info & query string & hash from url qs_begin_index = url.indexOf('?'); path = getPath(url) // get query string action url if (qs_begin_index < 0) qs = ""; else qs = url.substring(qs_begin_index + 1, url.length ); if (gIsContinue == 0) { gIsContinue = 1; if (IsNetscape60()) // Netscape 6.0 cipher = document.XecureWeb.nsIXecurePluginInstance.BlockEnc(xgate_addr, path, XecureEscape(qs), "GET"); else cipher = document.XecureWeb.BlockEnc(xgate_addr, path, XecureEscape(qs),"GET"); gIsContinue = 0; } else { printInfoMessage(busy_info); return false; } if (cipher == "") return XecureWebError(); xecure_url = path + "?q=" + escape_url(cipher); // adding character set information if(usePageCharset) xecure_url += "&charset=" + document.charset; url = xecure_url; if(arg == "") arg = this;//파라미터가 없을 경우 현재 부모창을 넘김. var win = window.showModelessDialog(url, arg, sFeatures); return win; } */ /** *
* window.open(arg1,arg2,arg3) 옵션 배열의 갯수를 정확히 넣어줘야 합니다. 값이 필요 없으면 '' 을 넣습니다.
* scroll은 default=yes임 , center가 yes로 되어있어도 x,y좌표가 있으면 좌표에 따른다.
*
* ex : openWinPop(a.html,"새창임","form 이름",[넓이,높이,x좌표,y좌표,scroll여부,resizable여부,주소창여부,menu var 여부,toolbar 여부,상태바 여부])
* openWinPop(act,"popupWin","form2") -> form 데이타를 submit 하면서 일반적인 창 크기
* openWinPop("test.web","popupWin","form2",["500","600"]) -> form 데이타를 submit 하면서 팝업 사이즈가 500,600 을 띄울 경우
* openWinPop(act,"popupWin"); form 데이타없이 일반적인 크기의 팝업을 띄울경우
* openWinPop("test.web?a=1","popupWin","",["500","600"]) -> form 데이타없이 팝업을 띄울 경우
* @param webUrl : 주소
* @param popupName : 윈도우 이름
* @param formName :
* @param options : 창관련 옵션(배열 형식)
*
*/
function openWinPop(webUrl, popupName, formName, options) {
var sFeatures = "";
if (options != undefined) {
var popWidth = options[0] == undefined || options[0] == "" ? "600" : options[0];
var popHeight = options[1] == undefined || options[1] == "" ? "450" : options[1];
var popLeft = options[2] == undefined || options[2] == "" ? 0 : options[2];
var popTop = options[3] == undefined || options[3] == "" ? 0 : options[3];
var popScroll = options[4] == undefined || options[4] == "" ? "no" : options[4];
var popResize = options[5] == undefined || options[5] == "" ? "yes" : options[5];
var popLocation = options[6] == undefined || options[6] == "" ? "no" : options[6];
var popMenubar = options[7] == undefined || options[7] == "" ? "no" : options[7];
var popToolbar = options[8] == undefined || options[8] == "" ? "no" : options[8];
var popStatus = options[9] == undefined || options[9] == "" ? "no" : options[9];
sFeatures = "width=" + popWidth;
sFeatures += ",height=" + popHeight;
sFeatures += ",left=" + popLeft;
sFeatures += ",top=" + popTop;
sFeatures += ",scrollbars=" + popScroll;
sFeatures += ",resizable=" + popResize;
sFeatures += ",location=" + popLocation;
sFeatures += ",menubar=" + popMenubar;
sFeatures += ",toolbar=" + popToolbar;
sFeatures += ",status=" + popStatus;
}
var elem;
if (formName != undefined && formName != "") {
elem = window.open('', popupName, sFeatures);
var submitform = eval("document." + formName);
submitform.action = webUrl;
submitform.target = popupName;
submitform.submit();
submitform.target="_self";
} else {
elem = window.open(webUrl, popupName, sFeatures);
elem.focus();
}
return elem;
}
/*
*
* onblur 이벤트에 사용되며 첫번째 인자와 해당 input 또는 select 객체값이 동일하면
* 한개이상의 인풋,select 창을 inable,disable 시키기
*
* ex : 폼이 있을경우(폼이름:aForm) ex : onblur=orderDisableDiv('aaa',['aForm.dis1','aForm.dis2',...])
* 폼이 없을경우 ex : onblur=orderDisableDiv('aaa',['dis1','dis2',...])
* @param divValue : disable 기준값
* @param divName : disable 시킬 개체의 name(배열 1개 이상)
*
function orderDisableDiv(divValue,divName) {
var eventValue = event.srcElement.value;
if (eventValue == divValue) {
for (var i = 0 ; i < divName.length ; i++) {
var eventTag = eval(divName[i]);
//input창일때
if (eventTag.tagName.toString().toLowerCase() == "input") {
eventTag.readOnly = true;
eventTag.disabled = true;
eventTag.style.backgroundColor = "#cccccc";
}
//select box일때
if (eventTag.tagName.toString().toLowerCase() == "select")
eventTag.disabled = true;
}
} else {
for (var j = 0; j < divName.length; j++) {
var eventTag = eval(divName[j]);
//input창일때
if (eventTag.tagName.toString().toLowerCase() == "input") {
eventTag.readOnly = false;
eventTag.disabled = false;
eventTag.style.backgroundColor = "";
}
//select box일때
if (eventTag.tagName.toString().toLowerCase() == "select")
eventTag.disabled = false;
}
}
}
*/
/*
*
* 디비 쿼리 리스트 팝업. 이미 등록되어 있는 팝업Action의 URL과 팝업에서 선택된 값이 입력될 parent창의 name을 넘기면
* 팝업에서 선택된 값이 셋팅됨 값 두개를 셋팅하여 parent창에 inputname, inputname_display에 셋팅됨.
*
* ex : openWinPopUnit("popup.web","form1.name","500","600"){
* @param targetUrl : 팝업으로 등록되어 있는 Action URL
* @param inputName : parent창에서 값으로 사용될 input name
* @param width : 팝업창 넓이
* @param height : 팝업창 높이
*
function openWinPopUnit(targetUrl,inputName,width,height){
var url = targetUrl + "?inputName="+inputName;
var popupWin = window.open(url,"popupWin","width="+width+",height="+height+",toolbar=no,resizable=yes");
}
*/
/*
* * 체크박스 체크 풀기 * * ex : unCheckedCheckBoxState( "name" ) * @param checkName : uncheck 할 체크 박스 이름 *function unCheckedCheckBoxState(checkName) { var checkingBox = eval( "form1."+checkName ); if (checkingBox.length == undefined) { checkingBox.checked = false; } else { for (var i = 0; i < checkingBox.length; i++) { if (checkingBox[i].checked == true) checkingBox[i].checked = false; } } } */ /* *
* 한개 이상의 체크박스의 상태 점검하기 * * ex : searchCheckBoxState( "name" ) * @param 상태를 점검할 체크박스 이름 * @return array[0] 체크박스중 체크된 갯수,array[1] 체크된 것중 마지막으로 체크된 체크박스의 value *function searchCheckBoxState(checkName) { var checkCnt = 0; var checkedLine = 0; var checkingBox = eval("form1." + checkName); if (checkingBox.length == undefined) { if(checkingBox.checked == true) return [1,0]; else return [0,0]; } for (var i = 0; i < checkingBox.length; i++) { if (checkingBox[i].checked == true) { checkCnt++; checkedLine = checkingBox[i].value; } } return [checkCnt, checkedLine]; } */ /* *
* 인풋 창의 상태 변경 readOnly,color 색상 변경 * * ex : changeReadOnlyState(["name1","name2"]) * @param 상태를 변경할 인풋 창 이름 배열 *function changeReadOnlyState(changeArray) { for (var i = 0; i < changeArray.length; i++) { var eventTag = eval(changeArray[i]); //input창일때 if (eventTag.tagName.toString().toLowerCase() == "input") { eventTag.readOnly = true; eventTag.style.color = "#777777"; } //select box일때 if (eventTag.tagName.toString().toLowerCase() == "select") eventTag.disabled = true; } } */ /* *
* 인풋 창의 상태 변경 Editable,color 색상 변경 * * ex : changeEditableState(["name1","name2"]) * @param 상태를 변경할 인풋 창 이름 배열 *function changeEditableState(changeArray) { for (var i = 0; i < changeArray.length; i++) { var eventTag = eval(changeArray[i]); //input창일때 if (eventTag.tagName.toString().toLowerCase() == "input") { eventTag.readOnly = false; eventTag.style.color = ""; } //select box일때 if (eventTag.tagName.toString().toLowerCase() == "select") eventTag.disabled = false; } } */ /* *
* 화면 프린트 * * ex : printPage() * @return : void *function printPage() { window.print(); } */ /** *
* 한글 2글자 영문 1글자로 길이 측정하여 문자열의 byte 길이를 리턴한다. * * @param text : 체크할 String value * @return 측정한 해당 값의 byte 길이 **/ function calcByteLengthOfText(text) { var nbytes = 0; for (var i = 0; i < text.length; i++) { var ch = text.charAt(i); if(escape(ch).length > 4) nbytes += 2; else if (ch == '\n') if (text.charAt(i - 1) != '\r') nbytes++; else if (ch == '<' || ch == '>') nbytes += 4; else nbytes++; } return nbytes; } /** *
* 공백 스트링 체크 * * @param s * @return **/ function isEmpty(text) { return (!text || (text.length == 0)); } var whitespace = " \t\r\n"; /** *
* 인자로 넘어온 문자열이 공백인지 체크 * * @param s * @return **/ function isWhitespace(text) { if (isEmpty(text)) return true; for (var i = 0; i < text.length; i++) { var c = text.charAt(i); if (whitespace.indexOf(c) < 0) return false; } return true; } function Accessible(sizeHeight,ttsString) { document.getElementById('headerLnavigation').style.height = sizeHeight + "px"; document.getElementById('navSwf').height = sizeHeight; if(readCookie('voiceStart')==1){ document.getElementById('TTSSoundPlayer').sendToFlex('test',ttsString); } } function readCookie( str ) { var key=str + '='; var key_len=key.length; var cookie_len=document.cookie.length; var i=0; while (i < cookie_len ) { var j = i + key_len; if ( document.cookie.substring( i, j ) == key ) { var cookie_end = document.cookie.indexOf(';',j); if (cookie_end == -1) { cookie_end = document.cookie.length; } return document.cookie.substring(j,cookie_end ); } i++ } return '' } var sel_type="none"; function color_sel() { if (sel_type=="block") { sel_type="none"; } else { sel_type="block"; } document.getElementById("colorsel").style.display=sel_type; } // gnb관련 플래시 호출 //var flashvars_gnb = {}; // var params_gnb = {}; // var attributes_gnb = {}; // attributes_gnb.id = "navSwf"; // swfobject.embedSWF("http://localhost:7001/sv_image/images/web/front/ko_KR/flash/top_menu.swf", "navSwf_alternative", "100%", "100%", "8.0.0", false, flashvars_gnb, params_gnb, attributes_gnb); // SWFFormFix("navSwf_alternative"); // tts관련 플래시 호출 //var flashvars_tts = {}; // var params_tts = {}; // var attributes_tts = {}; // attributes_tts.id = "TTSSoundPlayer"; // swfobject.embedSWF("http://localhost:7001/sv_image/images/web/front/ko_KR/flash/TTSSoundPlayer.swf", "TTSSoundPlayer_alternative", "100%", "100%", "9.0.0", false, flashvars_tts, params_tts, attributes_tts); // SWFFormFix("TTSSoundPlayer_alternative"); function activeTAB(id) { for(num=1; num<=4; num++) { document.getElementById('tabData'+num).style.display='none'; //D2MG1~D2MG4 까지 숨긴 다음 } document.getElementById(id).style.display='block'; //해당 ID만 보임 } function Floating(FloatingObj,MarginX,MarginY,Percentage,setTime) { this.FloatingObj = FloatingObj; this.MarginX = (MarginX) ? MarginX : 100; this.MarginY = (MarginY) ? MarginY : 0; this.Percentage = (Percentage) ? Percentage : 20; this.setTime = (setTime) ? setTime : 10; this.FloatingObj.style.position = "absolute"; this.Body = null; this.setTimeOut = null; this.Run(); } Floating.prototype.Run = function () { if ((document.documentElement.scrollLeft + document.documentElement.scrollTop) > (document.body.scrollLeft + document.body.scrollTop)) { this.Body = document.documentElement; } else { this.Body = document.body; } var This = this; var FloatingObjLeft = (this.FloatingObj.style.left) ? parseInt(this.FloatingObj.style.left,10) : this.FloatingObj.offsetLeft; var FloatingObjTop = (this.FloatingObj.style.top) ? parseInt(this.FloatingObj.style.top,10) : this.FloatingObj.offsetTop; var DocLeft = this.Body.scrollLeft + this.MarginX; var DocTop = this.Body.scrollTop + this.MarginY; var MoveX = Math.abs(FloatingObjLeft - DocLeft); MoveX = Math.ceil(MoveX / this.Percentage); var MoveY = Math.abs(FloatingObjTop - DocTop); MoveY = Math.ceil(MoveY / this.Percentage); /* if (FloatingObjLeft < DocLeft) { this.FloatingObj.style.left = FloatingObjLeft + MoveX + "px"; } else { this.FloatingObj.style.left = FloatingObjLeft - MoveX + "px"; } */ if (FloatingObjTop < DocTop) { this.FloatingObj.style.top = FloatingObjTop + MoveY + "px"; } else { this.FloatingObj.style.top = FloatingObjTop - MoveY + "px"; } window.clearTimeout(this.setTimeOut); this.setTimeOut = window.setTimeout(function () { This.Run(); },this.setTime); } function activeDIV(id) { for(num=1; num<=2; num++) { document.getElementById('us_010101_layerR_sub'+num).style.display='none'; //D2MG1~D2MG4 까지 숨긴 다음 } document.getElementById(id).style.display='block'; //해당 ID만 보임 }