12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117 |
- /**
- * Element Type
- */
- ET_DYNAMIC = 0x00000001;
- ET_STATIC = 0x00000010;
- ET_PARENT_AFFECT = 0x00000100;
- ET_ACTIVEX = 0x00001000;
- /**
- * Element Ability
- */
- EA_HAS_EVENT = 0x00000001;
- EA_ACTION = 0x00000002;
- EA_HAS_DOM = 0x00000020;
- EA_CONTROL_BASE = 0x00000100;
- EA_CONTROL = (EA_CONTROL_BASE | EA_HAS_EVENT);
- EA_HAS_FORMAT = 0x00000200;
- EA_HAS_TEXT = 0x00000400;
- EA_GROUP_BASE = 0x00001000;
- EA_GROUP = (EA_CONTROL | EA_GROUP_BASE);
- EA_PI_BASE = 0x00010000;
- /**
- * Cell Merge Flag
- */
- CMS_NORMAL = 0;
- CMS_MERGED = 1;
- CMS_HIDE = 2;
- CMS_LOCK = 3;
- /**
- * control의 type
- *
- */
- CON_TPYE_EDIT = 1;
- CON_TPYE_BUTTON = 2;
- CON_TPYE_VIEW = 3;
- /**
- * 한글의 완성된 형태만 체크할 때 사용
- * @memberOf {TypeName}
- */
- HANGLEREG = /[각-깋,낙-닣,닥-딯,락-맇,막-밓,박-빟,삭-싷,악-잏,작-짛,탁-팋,팍-핗,학-힣,깍-낗,딱-띻,짝-찧,빡-삫]/g;
- /**
- * EXCELLOAD 그리드를 나타냄
- * @memberOf {TypeName}
- */
- LOAD_EXCEL_GRID = "";
- LOAD_EXCEL_BUTTON = "";
- /**
- * 각 Browser에서 Event Object의 CrossBrowsing을 위하여 추가
- *
- * @author 김지환
- * @since TrustForm Soonsu 0.0.1
- */
- function TFEvent ()
- {
- this.name;
- this.handler;
- this.propagate;
- this.defaultAction;
- };
- /**
- * Event Button 의 값
- */
- TFEvent.BUTTON_LEFT = 1;//(is_ie)? 1 : 0;
- TFEvent.BUTTON_MIDDLE = 2;//(is_ie)? 4 : 1;
- TFEvent.BUTTON_RIGHT = 3;//2;
- /**
- * Event Keycode
- */
- TFEvent.BACKSPACE = 8;
- TFEvent.TAB = 9;
- TFEvent.ENTER = 13;
- TFEvent.SHIFT = 16;
- TFEvent.CONTROL = 17;
- TFEvent.ALT = 18;
- TFEvent.PAUSE_BREAK = 19;
- TFEvent.CAPSLOCK = 20;
- TFEvent.ESC = 27;
- TFEvent.SPACE = 32;
- TFEvent.PAGEUP = 33;
- TFEvent.PAGEDOWN = 34;
- TFEvent.END = 34;
- TFEvent.HOME = 34;
- TFEvent.LEFT = 37;
- TFEvent.UP = 38;
- TFEvent.RIGHT = 39;
- TFEvent.DOWN = 40;
- TFEvent.INSERT = 45;
- TFEvent.DELETE = 46;
- TFEvent.ZERO = 48;
- TFEvent.ONE = 49;
- TFEvent.TWO = 50;
- TFEvent.THREE = 51;
- TFEvent.FOUR = 52;
- TFEvent.FIVE = 53;
- TFEvent.SIX = 54;
- TFEvent.SEVEN = 55;
- TFEvent.EIGHT = 56;
- TFEvent.NINE = 57;
- TFEvent.A = 65;
- TFEvent.B = 66;
- TFEvent.C = 67;
- TFEvent.D = 68;
- TFEvent.E = 69;
- TFEvent.F = 70;
- TFEvent.G = 71;
- TFEvent.H = 72;
- TFEvent.I = 73;
- TFEvent.J = 74;
- TFEvent.K = 75;
- TFEvent.L = 76;
- TFEvent.M = 77;
- TFEvent.N = 78;
- TFEvent.O = 79;
- TFEvent.P = 80;
- TFEvent.Q = 81;
- TFEvent.R = 82;
- TFEvent.S = 83;
- TFEvent.T = 84;
- TFEvent.U = 85;
- TFEvent.V = 86;
- TFEvent.W = 87;
- TFEvent.X = 88;
- TFEvent.Y = 89;
- TFEvent.Z = 90;
- TFEvent.F1 = 112;
- TFEvent.F2 = 113;
- TFEvent.F3 = 114;
- TFEvent.F4 = 115;
- TFEvent.F5 = 116;
- TFEvent.F6 = 117;
- TFEvent.F7 = 118;
- TFEvent.F8 = 119;
- TFEvent.F9 = 120;
- TFEvent.F10 = 121;
- TFEvent.F11 = 122;
- TFEvent.F12 = 123;
- TFEvent.TRANSLANGUAGE = 229;
- /**
- * Attribute - Style 관련 : Style 목록을 만들어 둔다.
- */
- var STYLE_LIST = new Hashtable();
- STYLE_LIST["left"] = true;
- STYLE_LIST["right"] = true;
- STYLE_LIST["top"] = true;
- STYLE_LIST["bottom"] = true;
- STYLE_LIST["width"] = true;
- STYLE_LIST["height"] = true;
- STYLE_LIST["font-family"] = true;
- STYLE_LIST["font-size"] = true;
- STYLE_LIST["font-weight"] = true;
- STYLE_LIST["font-style"] = true;
- STYLE_LIST["text-decoration"] = true;
- STYLE_LIST["color"] = true;
- STYLE_LIST["text-align"] = true;
- STYLE_LIST["vertical-align"] = true;
- STYLE_LIST["word-wrap"] = true;
- STYLE_LIST["line-spacing"] = true;
- STYLE_LIST["letter-spacing"] = true;
- STYLE_LIST["padding"] = true;
- STYLE_LIST["padding-left"] = true;
- STYLE_LIST["padding-top"] = true;
- STYLE_LIST["padding-right"] = true;
- STYLE_LIST["padding-bottom"] = true;
- STYLE_LIST["background-color"] = true;
- STYLE_LIST["background-image"] = true;
- STYLE_LIST["background-repeat"] = true;
- STYLE_LIST["background-position"] = true;
- STYLE_LIST["border-color"] = true;
- STYLE_LIST["border-left-color"] = true;
- STYLE_LIST["border-top-color"] = true;
- STYLE_LIST["border-right-color"] = true;
- STYLE_LIST["border-bottom-color"] = true;
- STYLE_LIST["border-width"] = true;
- STYLE_LIST["border-left-width"] = true;
- STYLE_LIST["border-top-width"] = true;
- STYLE_LIST["border-right-width"] = true;
- STYLE_LIST["border-bottom-width"] = true;
- STYLE_LIST["border-style"] = true;
- STYLE_LIST["border-left-style"] = true;
- STYLE_LIST["border-top-style"] = true;
- STYLE_LIST["border-right-style"] = true;
- STYLE_LIST["border-bottom-style"] = true;
- STYLE_LIST["margin"] = true;
- STYLE_LIST["margin-left"] = true;
- STYLE_LIST["margin-top"] = true;
- STYLE_LIST["margin-right"] = true;
- STYLE_LIST["margin-bottom"] = true;
- STYLE_LIST["opacity"] = true;
- STYLE_LIST["clip"] = true;
- STYLE_LIST["gradient"] = true;
- STYLE_LIST["cursor"] = true;
- STYLE_LIST["focus-rect"] = true;
- STYLE_LIST["unloadmark"] = true;
- STYLE_LIST["display"] = true;
- STYLE_LIST["overflow"] = true;
- STYLE_LIST["background-repeat"] = true;
- /**
- * Tag Name 관련 : 기본컨트롤의 TAG NAME을 목록을 만들어 둔다.
- */
- var TAG_LIST = new Hashtable();
- TAG_LIST["xhtml:body"] = true;
- TAG_LIST["xforms:caption"] = true;
- TAG_LIST["xforms:output"] = true;
- TAG_LIST["xforms:input"] = true;
- TAG_LIST["xforms:secret"] = true;
- TAG_LIST["xforms:select"] = true;
- TAG_LIST["xforms:select1"] = true;
- TAG_LIST["xforms:group"] = true;
- TAG_LIST["xforms:datagrid"] = true;
- TAG_LIST["xforms:textarea"] = true;
- TAG_LIST["xforms:treeview"] = true;
- TAG_LIST["xforms:calendar"] = true;
- TAG_LIST["xforms:table"] = true;
- TAG_LIST["xforms:img"] = true;
- TAG_LIST["xforms:shape"] = true;
- TAG_LIST["xforms:line"] = true;
- TAG_LIST["xforms:object"] = true;
- TAG_LIST["xforms:browser"] = true;
- TAG_LIST["xforms:iviewer"] = true;
- TAG_LIST["xforms:switch"] = true;
- TAG_LIST["xforms:bool"] = true;
- TAG_LIST["xforms:file"] = true;
- TAG_LIST["xforms:import"] = true;
- var REF_ATTRIBUTE = new Hashtable();
- /**
- * Hashtable
- *
- * @author 김지환
- * @since TrustForm Soonsu 0.0.1
- */
- function Hashtable ()
- {
- };
- /**
- * Collection 객체
- *
- * @author 김지환
- * @since TrustForm Soonsu 0.0.1
- */
- function Collection ()
- {
- this.m_htCollection = new Hashtable();
- this.m_arOrder = new Array();
-
- this.length = 0;
- };
- Collection.prototype.add = function (objKey, objValue)
- {
- if (null == this.m_htCollection[objKey])
- {
- this.m_arOrder.push(objKey);
- }
- this.m_htCollection[objKey] = objValue;
- this.length = this.m_arOrder.length;
- };
- Collection.prototype.count = function ()
- {
- return this.m_arOrder.length;
- };
- Collection.prototype.exists = function (objKey)
- {
- return (null != this.m_htCollection[objKey]);
- };
- Collection.prototype.item = function (objKey)
- {
- if (null == this.m_arOrder[objKey])
- {
- return this.m_htCollection[objKey];
- }
- else
- {
- return this.m_htCollection[this.m_arOrder[objKey]];
- }
- };
- Collection.prototype.keys = function ()
- {
- return this.m_arOrder;
- };
- Collection.prototype.remove = function (objKey)
- {
- delete this.m_htCollection[objKey];
-
- var nIndex = this.m_arOrder.find(objKey);
- if (0 <= nIndex)
- {
- this.m_arOrder.splice(nIndex, 1);
- }
-
- this.length = this.m_arOrder.length;
- };
- Collection.prototype.removeAll = function ()
- {
- for (var objKey in this.m_htCollection)
- {
- delete this.m_htCollection[objKey];
- }
-
- this.m_arOrder.removeAll();
-
- this.length = this.m_arOrder.length;
- };
- function DOMNodeList ()
- {
- //property
- this.length = 0;
-
- this.m_arNode = new Array();
- this.m_nIterator = 0;
- };
- DOMNodeList.prototype.add = function (objNode)
- {
- this.m_arNode.push(objNode);
-
- this.length = this.m_arNode.length;
- };
- DOMNodeList.prototype.item = function (nIndex)
- {
- if (0 > nIndex && this.length <= nIndex)
- {
- return null;
- }
-
- return this.m_arNode[nIndex];
- };
- DOMNodeList.prototype.nextNode = function ()
- {
- if (0 > this.m_nIterator && this.length <= this.m_nIterator)
- {
- return null;
- }
-
- return this.m_arNode[this.m_nIterator++];
- };
- DOMNodeList.prototype.removeNext = function ()
- {
- this.m_arNode.splice(this.m_nIterator++, 1);
-
- this.length = this.m_arNode.length;
- };
- DOMNodeList.prototype.removeAll = function ()
- {
- this.m_arNode.removeAll();
- this.m_nIterator = 0;
-
- this.length = this.m_arNode.length;
- };
- DOMNodeList.prototype.reset = function ()
- {
- this.m_nIterator = 0;
- };
- /**
- * Array 객체에 fextractDupArr 함수를 추가한다.
- * 배열안의 중복된 값을 제거한다.
- */
- Array.prototype.fextractDupArr = function ()
- {
- for(var i=0; i<this.length; i++)
- {
- var checkDobl = 0;
- for(var j=0; j<this.length; j++)
- {
- if(this[i] != this[j])
- {
- continue;
- }
- else
- {
- checkDobl++;
- if(checkDobl>1)
- {
- spliced = this.splice(j,1);
- }
- }
- }
- }
- return this;
- };
- /**
- * Array 객체에 find 함수를 추가한다.
- * 배열에서 objValue의 index를 리턴한다.
- * @param objValue
- * @return index
- *
- * @author 김지환
- */
- Array.prototype.find = function (objValue)
- {
- for (var i=0; i<this.length; i++)
- {
- var objArrayValue = this[i];
- if (objArrayValue == objValue)
- {
- return i;
- }
- }
- return -1;
- };
- /**
- * Array 객체에 removeAt 함수를 추가한다.
- * @param nIndex
- * @return deleted item
- *
- * @author 김지환
- */
- Array.prototype.removeAt = function (nIndex)
- {
- return this.splice(nIndex, 1);
- };
- /**
- * Array 객체에 removeAll 함수를 추가한다.
- * @return null
- */
- Array.prototype.removeAll = function ()
- {
- while (0 != this.length)
- {
- this.pop();
- }
- };
- /**
- * 일반 배열에서 사용되는 sort 정의 함수
- */
- function numberASC(a, b)
- {
- return a - b;
- };
- /**
- * sort함수에서 숫자로 구성된 col일때 사용되는 함수
- */
- function numberorder(a, b)
- {
- return a[0] - b[0];
- };
- /**
- *1~16 까지 숫자를 16진수 형태의 문자로 표현한다.
- * @return
- */
- function giveHex (nDec)
- {
- switch (nDec)
- {
- case 10:
- {
- return "A";
- }
- case 11:
- {
- return "B";
- }
- case 12:
- {
- return "C";
- }
- case 13:
- {
- return "D";
- }
- case 14:
- {
- return "E";
- }
- case 15:
- {
- return "E";
- }
- default:
- {
- return String(nDec);
- }
- }
- };
- /**
- * String Buffer를 만든다
- * @return
- */
- function StringBuffer()
- {
- this.buffer = [];
- this.bSelect = false;
-
- this.isSelect = function ()
- {
- return this.bSelect;
- };
- this.select = function ()
- {
- this.bSelect = true;
- };
- this.insertString = function (nPosition, string)
- {
- this.buffer.splice(nPosition, 0, string);
- return this;
- };
- this.replacePosition = function (nPosition, string)
- {
- this.buffer[nPosition] = string;
- return this;
- };
- this.append = function(string)
- {
- this.buffer.push(string);
- return this;
- };
- this.findPosition = function(nPosition)
- {
- if (null != this.buffer[nPosition])
- {
- return true;
- }
- return false;
- };
- this.findString = function(nPosition ,string)
- {
- return -1 < this.buffer[nPosition].indexOf(string);
- };
- this.toString = function()
- {
- return this.buffer.join("");
- };
- this.length = function()
- {
- return this.buffer.length;
- };
- this.empty = function()
- {
- this.buffer = [];
- this.bSelect = false;
- return this;
- };
- };
- /**
- * textare,input 개행문자를 변환한다.
- */
- String.prototype.textCharConvert = function ()
- {
- var strText = this;
- strText = strText.replace(/\\n/g, "\n");
- strText = strText.replace(/\\r/g, "\r");
- strText = strText.replace(/\\t/g, "\t");
- return strText;
- };
- /**
- * 개행문자를 변환한다.
- */
- String.prototype.newlineCharConvert = function ()
- {
- var strText = this;
- strText = strText.replace(/\&/g, "&");
- strText = strText.replace(/\</g,"<");
- strText = strText.replace(/\>/g,">");
- strText = strText.split(" ").join(" ");
- strText = strText.split("\n").join("<br>");
- strText = strText.split("\r").join("");
- strText = strText.split("\t").join(" ");
- return strText;
- };
- /**
- * String RGB색상을 반전한다.
- * @return
- */
- String.prototype.invertRGB = function ()
- {
- var strRGB = this;
- if (-1 != this.indexOf("rgb"))
- {
- var strRGBData = this.substring(this.indexOf("(")+1, this.length);
- var alRGBValue = strRGBData.split(/\,/g);
- strRGB = "#";
- for (var i=0; i<alRGBValue.length; i++)
- {
- strRGB += giveHex(Math.floor(parseInt(alRGBValue[i])/16));
- strRGB += giveHex(parseInt(alRGBValue[i]) % 16);
- }
- }
- var strInvertRGB = "";
- for (var i=0; i<strRGB.length; i++)
- {
- switch (strRGB.charAt(i))
- {
- case "F":
- case "f":
- {
- strInvertRGB += "0";
- break;
- }
- case "E":
- case "e":
- {
- strInvertRGB += "1";
- break;
- }
- case "D":
- case "d":
- {
- strInvertRGB += "2";
- break;
- }
- case "C":
- case "c":
- {
- strInvertRGB += "3";
- break;
- }
- case "B":
- case "b":
- {
- strInvertRGB += "4";
- break;
- }
- case "A":
- case "a":
- {
- strInvertRGB += "5";
- break;
- }
- case "9":
- {
- strInvertRGB += "6";
- break;
- }
- case "8":
- {
- strInvertRGB += "7";
- break;
- }
- case "7":
- {
- strInvertRGB += "8";
- break;
- }
- case "6":
- {
- strInvertRGB += "9";
- break;
- }
- case "5":
- {
- strInvertRGB += "A";
- break;
- }
- case "4":
- {
- strInvertRGB += "B";
- break;
- }
- case "3":
- {
- strInvertRGB += "C";
- break;
- }
- case "2":
- {
- strInvertRGB += "D";
- break;
- }
- case "1":
- {
- strInvertRGB += "E";
- break;
- }
- case "0":
- {
- strInvertRGB += "F";
- break;
- }
- default:
- {
- strInvertRGB += strRGB.charAt(i);
- break;
- }
- }
- }
- return strInvertRGB;
- };
- String.prototype.formatting = function (strFormat)
- {
- var strTextData = this;
- var m_strDotZero = "";
- var nFormateStatus = formatStatus (strFormat);
- //format (-) 형태 판단
- var bSubtraction = false;
- if (-1 != strFormat.indexOf("(-)") && 0 < nFormateStatus)
- {
- bSubtraction = 0 == strTextData.indexOf("-");
- strFormat = strFormat.replace("(-)","");
- }
- var nPoint = strFormat.indexOf(".");
- if (-1 != nPoint)
- {
- m_strDotZero = "";
- while("0" == strFormat.charAt((nPoint + 1)))
- {
- m_strDotZero += "0";
- nPoint++;
- }
- }
- // format 선행, 후행 문자 저장
- var strTransData = strFormat.replace(/(\#|\,|\.|0|9)+/g,"__");
- strTransData = "HEAD" + strTransData;
- var arData = strTransData.split(/\_\_/g);
- if (1 == arData.length)
- {
- if (-1 == arData[0].indexOf("HEAD"))
- {
- arData[1] = arData[0];
- arData[0] = "";
- }
- else
- {
- arData[0] = arData[0].replace(/HEAD/g,"");
- arData[1] = "";
- }
- }
- else
- {
- arData[0] = null != arData[0] ? arData[0].replace(/HEAD/g,"") : "";
- arData[1] = null != arData[1] ? arData[1].replace(/\+/g,"") : "";
- }
- switch (nFormateStatus)
- {
- case 0:
- {
- return strTextData;
- }
- case 1:
- {
- return inputValidateCheck(strFormat, strTextData);
- }
- case 2:
- {
- strTextData = inputMoneyUnitValidateCheckPattern1 (strTextData, strTextData.length, strFormat, m_strDotZero);
- break;
- }
- case 3:
- {
- strTextData = inputMoneyUnitValidateCheckPattern2 (strTextData, strTextData.length, strFormat, m_strDotZero);
- break;
- }
- case 4:
- {
- strTextData = inputMoneyUnitValidateCheckPattern3 (strTextData, strTextData.length, strFormat, m_strDotZero);
- break;
- }
- case 5:
- { // 화폐 + 소수점 패턴일 경우
- if (-1 == strTextData.indexOf("."))
- {
- strTextData = inputMoneyUnitValidateCheckPattern2 (strTextData, strTextData.length, strFormat, m_strDotZero);
- if(0 != strTextData.length)
- {
- if (0 == m_strDotZero.length)
- {
- strTextData += ".0";
- }
- else
- {
- strTextData += "." + m_strDotZero;
- }
- }
- }
- else
- {
- this.m_bIsEmptyFormatted = true;
- var nStrDotTokenPoint = this.indexOf(".");
- strTextData = inputMoneyUnitValidateCheckPattern2 (this.substring(0, nStrDotTokenPoint), nStrDotTokenPoint, strFormat, m_strDotZero);
- strTextData += ".";
- strTextData += inputMoneyUnitValidateCheckPattern1 (this.substring(nStrDotTokenPoint + 1, this.length), this.length - nStrDotTokenPoint - 1, strFormat, m_strDotZero);
- }
- break;
- }
- }
- strTextData = bSubtraction ? arData[0] + "-" + strTextData + arData[1]: arData[0] + strTextData + arData[1];
- return strTextData;
- };
- /**
- * String 정규식의 된 식이 존재하는지 여부를 구한다.
- *
- * @author 김우겸
- *
- * @return Boolean
- */
- String.prototype.isRegular = function (rePattern)
- {
- var alStringData = this.match(rePattern);
- if (null != alStringData)
- {
- return true;
- }
- else
- {
- return false;
- }
- };
- /**
- * String tag의 attribute를 추가한다.
- *
- * @author 김우겸
- *
- * @return String
- */
- String.prototype.insertAttribute = function (strAttName, strAttValue)
- {
- if (!strAttName || !strAttValue)
- {
- return this;
- }
- var strTag = this;
- var nIndex = strTag.lastIndexOf(">");
- if (-1 == nIndex)
- {
- return this;
- }
- var strTag = strTag.substring(0, nIndex);
- strTag = strTag + " " + strAttName + "=" + "\"" + strAttValue + "\">";
- return strTag;
- };
- /**
- * String 객체가 비어 있는지 여부를 구한다.
- * @return
- *
- * @author 김지환
- */
- String.prototype.isEmpty = function ()
- {
- if (0 < this.length)
- {
- return false;
- }
- return true;
- };
- /**
- * String 객체에 Trim 함수를 추가한다.
- *
- * @author 김지환
- * 수정:2011-11-14 김우겸
- */
- String.prototype.trim = function ()
- {
- return this.replace(/^\s+/,"").replace(/\s+$/,"");
- };
- /**
- * String 객체에 ReplaceAll 함수를 추가한다.
- *
- * @author 김우겸
- */
- String.prototype.replaceAll = function (strFindString , strChangeString)
- {
- return this.split(strFindString).join(strChangeString);
- };
- /**
- * String 객체에 getByte 함수를 추가한다.
- *
- * @author 김우겸
- */
- String.prototype.getByte = function ()
- {
- var nBytrCnt = 0;
- for (var nCount = 0; nCount < this.length; nCount++)
- {
- if (this.charCodeAt(nCount) > 127)
- {
- nBytrCnt += 2;
- }
- else
- {
- nBytrCnt++;
- }
- }
- return nBytrCnt;
- };
- String.prototype.setByteWithStrLength = function (nByte)
- {
- var nBytrCnt = 0;
- var StrReturnValue = "";
- for (var nCount = 0; nCount < this.length && nBytrCnt < nByte; nCount++)
- {
- if (this.charCodeAt(nCount) > 127)
- {
- nBytrCnt += 2;
- StrReturnValue += this.charAt(nCount);
- }
- else
- {
- nBytrCnt++;
- StrReturnValue += this.charAt(nCount);
- }
- }
- return StrReturnValue;
- };
- String.prototype.changeExtension = function (strOldExtension, strNewExtension)
- {
- var nPosition = this.lastIndexOf('.');
-
- if (nPosition > 0 && nPosition < this.length && strOldExtension == this.substr(nPosition + 1))
- {
- var strNewFileName = this.substring(0, nPosition);
-
- return strNewFileName + "." + strNewExtension;
- }
- return this;
- };
- function URIEncoder ()
- {
- };
- URIEncoder.encode = function (strValue, strEncoding)
- {
- strEncoding = strEncoding.toUpperCase();
- if (/*defalut*/"" == strEncoding ||"UTF-8" == strEncoding || "UTF-16" == strEncoding )
- {
- return encodeURI(strValue);
- }
- else
- {
- var objHttpClient = new HttpClient();
- var strData = "encode=" + strEncoding + "&" + "value=" + encodeURI(strValue);
- var strResult = objHttpClient.post(__getAppName () + "/kr/comsquare/jsp/encoding.jsp", strData);
- if (null != strResult)
- {
- return strResult.trim();
- }
- }
- return strValue;
- };
- /**
- * Base64
- */
- function Base64 ()
- {
- };
- Base64.keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
- Base64.encode = function (strValue)
- {
- strValue = utf16.encode(strValue);
-
- var strResult = "";
- var ch1, ch2, ch3, encoded1, encoded2, encoded3, encoded4;
- var i = 0;
- while(i < strValue.length)
- {
- ch1 = strValue.charCodeAt(i++);
- ch2 = strValue.charCodeAt(i++);
- ch3 = strValue.charCodeAt(i++);
-
- encoded1 = ch1 >> 2;
- encoded2 = ((ch1 & 3) << 4) | (ch2 >> 4);
- encoded3 = ((ch2 & 15) << 2) | (ch3 >> 6);
- encoded4 = ch3 & 63;
-
- if (isNaN(ch2))
- {
- encoded3 = encoded4 = 64;
- }
- else if (isNaN(ch3))
- {
- encoded4 = 64;
- }
-
- strResult += Base64.keyStr.charAt(encoded1) + Base64.keyStr.charAt(encoded2) +
- Base64.keyStr.charAt(encoded3) + Base64.keyStr.charAt(encoded4);
- }
- return strResult;
- };
- Base64.decode = function (strValue)
- {
- strValue = strValue.replace(/[^A-Za-z0-9\+\/\=]/g, "");
-
- var strResult = "";
- var ch1, ch2, ch3, encode1, encode2, encode3, encode4;
-
-
- var i=0;
- while (i < strValue.length)
- {
- encode1 = Base64.keyStr.indexOf(strValue.charAt(i++));
- encode2 = Base64.keyStr.indexOf(strValue.charAt(i++));
- encode3 = Base64.keyStr.indexOf(strValue.charAt(i++));
- encode4 = Base64.keyStr.indexOf(strValue.charAt(i++));
-
- ch1 = (encode1 << 2) | (encode2 >> 4);
- ch2 = ((encode2 & 15) << 4) | (encode3 >> 2);
- ch3 = ((encode3 & 3) << 6) | encode4;
-
- strResult += String.fromCharCode(ch1);
- if (encode3 != 64)
- {
- strResult += String.fromCharCode(ch2);
- }
- if (encode4 != 64)
- {
- strResult += String.fromCharCode(ch3);
- }
- }
-
- return utf16.decode(strResult);
- };
- /**
- * UTF8 - URI Encoder / Decoder
- */
- function UTF8 ()
- {
- };
- UTF8.encode = function (strValue)
- {
- strValue = strValue.replace(/\r\n/g,"\n");
- var strUTF = "";
- for (var i=0; i<strValue.length; i++)
- {
- var chIndex = strValue.charCodeAt(i);
- if (chIndex < 128)
- {
- strUTF += String.fromCharCode(chIndex);
- }
- else if((chIndex > 127) && (chIndex < 2048))
- {
- strUTF += String.fromCharCode((chIndex >> 6) | 192);
- strUTF += String.fromCharCode((chIndex & 63) | 128);
- }
- else
- {
- strUTF += String.fromCharCode((chIndex >> 12) | 224);
- strUTF += String.fromCharCode(((chIndex >> 6) & 63) | 128);
- strUTF += String.fromCharCode((chIndex & 63) | 128);
- }
- }
- return strUTF;
- };
- UTF8.decode = function (strValue)
- {
- var strDecoded = "";
- var i = 0;
- var chIndex = chIndex1 = chIndex2 = 0;
- while ( i < strValue.length )
- {
- chIndex = strValue.charCodeAt(i);
- if (chIndex < 128)
- {
- strDecoded += String.fromCharCode(chIndex);
- i++;
- }
- else if((chIndex > 191) && (chIndex < 224))
- {
- chIndex1 = strValue.charCodeAt(i+1);
- strDecoded += String.fromCharCode(((chIndex & 31) << 6) | (chIndex1 & 63));
- i += 2;
- }
- else
- {
- chIndex1 = strValue.charCodeAt(i+1);
- chIndex2 = strValue.charCodeAt(i+2);
- strDecoded += String.fromCharCode(((chIndex & 15) << 12) | ((chIndex1 & 63) << 6) | (chIndex2 & 63));
- i += 3;
- }
- }
- return strDecoded;
- };
- function UTF16 ()
- {
- };
- UTF16.decode = function (input)
- {
- var output = [], i=0, len=input.length,value,extra;
- while (i < len)
- {
- value = input.charCodeAt(i++);
- if ((value & 0xF800) === 0xD800)
- {
- extra = input.charCodeAt(i++);
- if (((value & 0xFC00) !== 0xD800) || ((extra & 0xFC00) !== 0xDC00))
- {
- throw new RangeError("UTF-16(decode): Illegal UTF-16 sequence");
- }
- value = ((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000;
- }
- output.push(value);
- }
- return output;
- };
- UTF16.encode = function (input)
- {
- var output = [], i=0, len=input.length,value;
- while (i < len)
- {
- value = input[i++];
- if ((value & 0xF800) === 0xD800)
- {
- throw new RangeError("UTF-16(encode): Illegal UTF-16 value");
- }
- if (value > 0xFFFF)
- {
- value -= 0x10000;
- output.push(String.fromCharCode(((value >>>10) & 0x3FF) | 0xD800));
- value = 0xDC00 | (value & 0x3FF);
- }
- output.push(String.fromCharCode(value));
- }
- return output.join("");
- };
- /**
- * 좌표 객체
- * @param nX
- * @param nY
- * @return
- *
- * @author 김지환
- */
- function Point (nX, nY)
- {
- this.m_nX = nX;
- this.m_nY = nY;
- };
- Point.prototype.clone = function ()
- {
- return new Point(this.m_nX, this.m_nY);
- };
- Point.prototype.getX = function ()
- {
- return this.m_nX;
- };
- Point.prototype.setX = function (nX)
- {
- this.m_nX = nX;
- };
- Point.prototype.getY = function ()
- {
- return this.m_nY;
- };
- Point.prototype.setY = function (nY)
- {
- this.m_nY = nY;
- };
- /**
- * roundmode에 관한 수식을 연산하여 return 한다
- */
- function getRoundMode (strValue, strRoundMode, strRoundPosition)
- {
- var arValue = strValue.split(/\./g);
- var nRoundPosition = Number(strRoundPosition);
-
- if (nRoundPosition < 0 && null != arValue[1])
- { // 소수점에 관한 반올림,올림,내림일때
- if (Math.abs(nRoundPosition) > arValue[1].length)
- { // 입력한 포지션이 존재하지 않는 소수점에 위치할때
- return strValue;
- }
- else
- {
- if ("round" == strRoundMode)
- {//반올림
- if (parseInt(arValue[1].charAt(Math.abs(nRoundPosition) - 1)) > 4)
- {
- strRoundMode = "ceil";
- }
- else
- {
- strRoundMode = "floor";
- }
- }
-
- if ("ceil" == strRoundMode)
- {//올림
- if (-1 == nRoundPosition )
- {//소수점 첫번째 자리일 때 정수값을 +1 해준다
- return String(Number(arValue[0]) + 1);
- }
- else
- {// 올림할 값을 구함
- var strPlusValue = "0.";
- for (var i=0 ; i < (Math.abs(nRoundPosition) - 1); i++)
- {
- if((i + 1) == (Math.abs(nRoundPosition) - 1))
- {
- strPlusValue += "1";
- break;
- }
- else
- {
- strPlusValue += "0";
- }
- }
- if ("1" == arValue[1].substring(0, Math.abs(nRoundPosition) - 1))
- {//1.1 + 0.1의 값중 뒤에 쓰레기값이 존재 하는 특별한 경우
- return arValue[0] + ".2";
- }
- // 올림한 값을 더하여 return
- var fSubData = Number(arValue[0] + "." + arValue[1].substring(0, Math.abs(nRoundPosition) - 1)) + Number(strPlusValue);
- return String(fSubData.toFixed(Math.abs(nRoundPosition) - 1));
- }
- }
- else
- {//내림
- if (-1 == nRoundPosition )
- {//첫번째 자리수 일때 정수값만 return
- return arValue[0];
- }
- else
- {// 포지션의 앞자리까지의 값을 return
- return arValue[0] + "." + arValue[1].substring(0, Math.abs(nRoundPosition) - 1);
- }
- }
- }
- }
- else if(nRoundPosition > 0)
- {// 정수에 관한 반올림, 내읾 , 올림 일때
- if (nRoundPosition > arValue[0].length)
- {// 존재하지 않는 자릿수에 관한 처리
- return strValue;
- }
- else
- {
- if ("round" == strRoundMode)
- {// 반올림
- if (parseInt(arValue[0].charAt(arValue[0].length - nRoundPosition)) > 4)
- {
- strRoundMode = "ceil";
- }
- else
- {
- strRoundMode = "floor";
- }
- }
-
- if ("ceil" == strRoundMode)
- {//올림
- if (arValue[0].length == nRoundPosition )
- {// 포지션의 값이 정수의 맨 앞자리일때 처리
- return String(Math.pow(10, nRoundPosition));
- }
- else
- {//포지션 다음의 정수 자리의 값을 0 처리
- var strPlusValue = arValue[0].substring(0, arValue[0].length - nRoundPosition);
- for (var i=0 ; i < nRoundPosition; i++)
- {
- strPlusValue += "0";
- }
- //포지션의 값 + 1 해서 return
- return String(Number(strPlusValue) + Math.pow(10, nRoundPosition));
- }
- }
- else
- {//내림
- if (arValue[0].length == nRoundPosition )
- {// 포지션의 값이 정수의 맨 앞자리일때 처리
- return "0";
- }
- else
- {// 포지션 다음의 정수 자리의 값을 0처리
- var strPlusValue = arValue[0].substring(0, arValue[0].length - nRoundPosition);
- for (var i=0 ; i < nRoundPosition; i++)
- {
- strPlusValue += "0";
- }
- return strPlusValue;
- }
- }
- }
- }
- else
- {// 포지션이 0일 때 처리
- return strValue;
- }
- //잘못된 포지션 또는 잘못된 값이 넘어올 때 처리
- return strValue;
- };
- function recoveryStyle (heTarget, heClone)
- {
- heTarget.style.position = heClone.style.position;
- heTarget.style.left = heClone.style.left;
- heTarget.style.top = heClone.style.top;
- heTarget.style.width = heClone.style.width;
- heTarget.style.height = heClone.style.height;
- heTarget.style.fontFamily = heClone.style.fontFamily;
- heTarget.style.fontSize = heClone.style.fontSize;
- heTarget.style.fontWeight = heClone.style.fontWeight;
- heTarget.style.fontStyle = heClone.style.fontStyle;
- heTarget.style.textDecoration = heClone.style.textDecoration;
- heTarget.style.color = heClone.style.color;
- heTarget.style.textAlign = heClone.style.textAlign;
- heTarget.style.verticalAlign = heClone.style.verticalAlign;
- heTarget.style.wordWrap = heClone.style.wordWrap;
- heTarget.style.wordSpacing = heClone.style.wordSpacing;
- heTarget.style.letterSpacing = heClone.style.letterSpacing;
- heTarget.style.padding = heClone.style.padding;
- heTarget.style.paddingLeft = heClone.style.paddingLeft;
- heTarget.style.paddingTop = heClone.style.paddingTop;
- heTarget.style.paddingRight = heClone.style.paddingRight;
- heTarget.style.paddingBottom = heClone.style.paddingBottom;
- heTarget.style.backgroundColor = heClone.style.backgroundColor;
- heTarget.style.backgroundImage = heClone.style.backgroundImage;
- heTarget.style.backgroundRepeat = heClone.style.backgroundRepeat;
- heTarget.style.backgroundPosition = heClone.style.backgroundPosition;
- heTarget.style.borderColor = heClone.style.borderColor;
- heTarget.style.borderLeftColor = heClone.style.borderLeftColor;
- heTarget.style.borderTopColor = heClone.style.borderTopColor;
- heTarget.style.borderRightColor = heClone.style.borderRightColor;
- heTarget.style.borderBottomColor = heClone.style.borderBottomColor;
- heTarget.style.borderWidth = heClone.style.borderWidth;
- heTarget.style.borderLeftWidth = heClone.style.borderLeftWidth;
- heTarget.style.borderTopWidth = heClone.style.borderTopWidth;
- heTarget.style.borderRightWidth = heClone.style.borderRightWidth;
- heTarget.style.borderBottomWidth = heClone.style.borderBottomWidth;
- heTarget.style.borderStyle = heClone.style.borderStyle;
- heTarget.style.borderLeftStyle = heClone.style.borderLeftStyle;
- heTarget.style.borderTopStyle = heClone.style.borderTopStyle;
- heTarget.style.borderRightStyle = heClone.style.borderRightStyle;
- heTarget.style.borderBottomStyle = heClone.style.borderBottomStyle;
- heTarget.style.margin = heClone.style.margin;
- heTarget.style.marginLeft = heClone.style.marginLeft;
- heTarget.style.marginTop = heClone.style.marginTop;
- heTarget.style.marginRight = heClone.style.marginRight;
- heTarget.style.marginBottom = heClone.style.marginBottom;
- };
- /**
- * 사각형
- * @param nX
- * @param nY
- * @param nWidth
- * @param nHeight
- *
- * @author 김지환
- */
- function Rectangle (nX, nY, nWidth, nHeight)
- {
- this.m_nX = nX;
- this.m_nY = nY;
- this.m_nWidth = nWidth;
- this.m_nHeight = nHeight;
-
- this.m_nBottom;
- this.m_nRight;
-
- this.adjustButtomRight();
- };
- Rectangle.prototype.getX = function ()
- {
- return this.m_nX;
- };
- Rectangle.prototype.getY = function ()
- {
- return this.m_nY;
- };
- Rectangle.prototype.setX = function (nX)
- {
- this.m_nX = nX;
- this.adjustButtomRight();
- };
- Rectangle.prototype.setY = function (nY)
- {
- this.m_nY = nY;
- this.adjustButtomRight();
- };
- Rectangle.prototype.getWidth = function ()
- {
- return this.m_nWidth;
- };
- Rectangle.prototype.setWidth = function (nWidth)
- {
- this.m_nWidth = nWidth;
- this.adjustButtomRight();
- };
- Rectangle.prototype.getHeight = function ()
- {
- return this.m_nHeight;
- };
- Rectangle.prototype.setHeight = function (nHeight)
- {
- this.m_nHeight = nHeight;
- this.adjustButtomRight();
- };
- Rectangle.prototype.getBottom = function ()
- {
- return this.m_nBottom;
- };
- Rectangle.prototype.getRight = function ()
- {
- return this.m_nRight;
- };
- Rectangle.prototype.adjustButtomRight = function ()
- {
- this.m_nRight = this.m_nX + this.m_nWidth;
- this.m_nBottom = this.m_nY + this.m_nHeight;
- };
- Rectangle.prototype.isContainsPoint = function (ptContains)
- {
- if (null != ptContains && ptContains instanceof Point)
- {
- if (this.m_nX <= ptContains.getX()
- && this.m_nRight >= ptContains.getX()
- && this.m_nY <= ptContains.getY()
- && this.m_nBottom >= ptContains.getY())
- {
- return true;
- }
- }
- return false;
- };
- inputValidateCheck = function(strFormat, strValueData) //keydown 잘못 입력된 값 처리 && input된 초기값에 format 적용
- {
- var strSaveData = "";
- var strTempData = "";
- var nFormatSwtichPoint = 0;
- var nInputSwtichPoint = 0;
- var nFormatLength = strFormat.length;
- var strInputData = strValueData;
- var reSpecialChar = /\W|\s/g;
- strInputData = strInputData.replace(reSpecialChar , "");
-
-
- for (var i=0 ; i < nFormatLength ; i++)
- {
- if( nFormatSwtichPoint != nFormatLength && "" != strInputData.charAt(nInputSwtichPoint))
- {
- if ("9" != strFormat.charAt(nFormatSwtichPoint) && "y" != strFormat.charAt(nFormatSwtichPoint) &&
- "m" != strFormat.charAt(nFormatSwtichPoint) && "d" != strFormat.charAt(nFormatSwtichPoint) &&
- "h" != strFormat.charAt(nFormatSwtichPoint) && "n" != strFormat.charAt(nFormatSwtichPoint) &&
- "s" != strFormat.charAt(nFormatSwtichPoint) && "A" != strFormat.charAt(nFormatSwtichPoint) &&
- "a" != strFormat.charAt(nFormatSwtichPoint) && "C" != strFormat.charAt(nFormatSwtichPoint) &&
- "L" != strFormat.charAt(nFormatSwtichPoint))
- {
- strSaveData = strSaveData + strFormat.charAt(nFormatSwtichPoint);
- nFormatSwtichPoint++;
- }
- else
- {
- for (;nInputSwtichPoint < strInputData.length; nInputSwtichPoint++)
- {
- strTempData = validateFormat (nFormatSwtichPoint, strInputData.charAt(nInputSwtichPoint), strFormat, strInputData);
- if ("" != strTempData)
- {
- strSaveData = strSaveData + strTempData;
- nInputSwtichPoint++;
- if ("9" != strFormat.charAt(nFormatSwtichPoint + 1) && "y" != strFormat.charAt(nFormatSwtichPoint + 1) &&
- "m" != strFormat.charAt(nFormatSwtichPoint + 1) && "d" != strFormat.charAt(nFormatSwtichPoint + 1) &&
- "h" != strFormat.charAt(nFormatSwtichPoint + 1) && "n" != strFormat.charAt(nFormatSwtichPoint + 1) &&
- "s" != strFormat.charAt(nFormatSwtichPoint + 1) && "A" != strFormat.charAt(nFormatSwtichPoint + 1) &&
- "a" != strFormat.charAt(nFormatSwtichPoint + 1) && "C" != strFormat.charAt(nFormatSwtichPoint + 1) &&
- "L" != strFormat.charAt(nFormatSwtichPoint + 1))
- {
- strSaveData = strSaveData + strFormat.charAt(nFormatSwtichPoint + 1);
- nFormatSwtichPoint++;
- }
- break;
- }
- }
- nFormatSwtichPoint++;
- }
- }
- }
- return strSaveData;
- };
- validateFormat = function (nInputStringLength, strCharValue, strFormat, strInputData)
- {
-
- var nkeyCode = strCharValue.charCodeAt(0);
- switch (strFormat.charAt(nInputStringLength))
- {
- case "9":
- {
- if ( nkeyCode >= 48 && nkeyCode <= 57 )
- {
- return String.fromCharCode(nkeyCode);
- }
- return "";
- }
- case "y":
- {
- if ( nkeyCode >= 48 && nkeyCode <= 57 )
- {
- return String.fromCharCode(nkeyCode);
-
- }
- return "";
- }
- case "m":
- {
- if ("m" == strFormat.charAt(nInputStringLength + 1))
- {
- if ( nkeyCode >= 48 && nkeyCode <= 49 )
- {
- return String.fromCharCode(nkeyCode);
- }
- }
- else
- {
- if("m" == strFormat.charAt(nInputStringLength - 1) && "1" == strInputData.charAt(nInputStringLength - 1))
- {
- if ( nkeyCode >= 48 && nkeyCode <= 50 )
- {
- return String.fromCharCode(nkeyCode);
- }
- }
- else
- {
- if ( nkeyCode >= 48 && nkeyCode <= 57 )
- {
- return String.fromCharCode(nkeyCode);
- }
- }
- }
- return "";
- }
- case "d":
- {
- if ("d" == strFormat.charAt(nInputStringLength + 1))
- {
- if ("m" == strFormat.charAt(nInputStringLength - 2) && "2" == strInputData.charAt(nInputStringLength - 2) &&
- (("m" == strFormat.charAt(nInputStringLength - 3) && "0" == strInputData.charAt(nInputStringLength - 3)) ||
- "m" != strFormat.charAt(nInputStringLength - 3)))
- {
- if ( nkeyCode >= 48 && nkeyCode <= 50 )
- {
- return String.fromCharCode(nkeyCode);
- }
- }
- else
- {
- if ( nkeyCode >= 48 && nkeyCode <= 51 )
- {
- return String.fromCharCode(nkeyCode);
- }
- }
- }
- else
- {
- if ("d" == strFormat.charAt(nInputStringLength - 1) && "3" != strInputData.charAt(nInputStringLength - 1))
- {
- if ( nkeyCode >= 48 && nkeyCode <= 57 )
- {
- return String.fromCharCode(nkeyCode);
-
- }
- }
- else if ("d" == strFormat.charAt(nInputStringLength - 1) && "3" == strInputData.charAt(nInputStringLength - 1))
- {
- if ( nkeyCode >= 48 && nkeyCode <= 49 )
- {
- return String.fromCharCode(nkeyCode);
- }
- }
- else
- {
- if ( nkeyCode >= 48 && nkeyCode <= 57 )
- {
- return String.fromCharCode(nkeyCode);
-
- }
- }
- }
- return "";
- }
- case "h":
- {
- if ("h" == strFormat.charAt(nInputStringLength + 1))
- {
- if ( nkeyCode >= 48 && nkeyCode <= 50 )
- {
- return String.fromCharCode(nkeyCode);
- }
- }
- else
- {
- if ("h" == strFormat.charAt(nInputStringLength - 1) && "2" == strInputData.charAt(nInputStringLength - 1))
- {
- if ( nkeyCode >= 48 && nkeyCode <= 52 )
- {
- return String.fromCharCode(nkeyCode);
- }
- }
- else
- {
- if ( nkeyCode >= 48 && nkeyCode <= 57 )
- {
- return String.fromCharCode(nkeyCode);
-
- }
- }
- }
- return "";
- }
- case "n":
- {
- if ("n" == strFormat.charAt(nInputStringLength + 1))
- {
- if ( nkeyCode >= 48 && nkeyCode <= 53 )
- {
- return String.fromCharCode(nkeyCode);
- }
- }
- else
- {
- if ( nkeyCode >= 48 && nkeyCode <= 57 )
- {
- return String.fromCharCode(nkeyCode);
- }
- }
- return "";
- }
- case "s":
- {
- if ("s" == strFormat.charAt(nInputStringLength + 1))
- {
- if ( nkeyCode >= 48 && nkeyCode <= 53 )
- {
- return String.fromCharCode(nkeyCode);
- }
- }
- else
- {
- if ( nkeyCode >= 48 && nkeyCode <= 57 )
- {
- return String.fromCharCode(nkeyCode);
- }
- }
- return "";
- }
- case "A":
- {
- if ( (nkeyCode >= 48 && nkeyCode <= 57) || (nkeyCode >= 65 && nkeyCode <= 90) || (nkeyCode >= 97 && nkeyCode <= 129))
- {
- return strCharValue;
- }
- return "";
- }
- case "a":
- {
- if ((nkeyCode == 32) || (nkeyCode >= 48 && nkeyCode <= 57) || (nkeyCode >= 65 && nkeyCode <= 90) || (nkeyCode >= 97 && nkeyCode <= 129))
- {
- return strCharValue;
- }
- return "";
- }
- case "C":
- {
- if ((nkeyCode >= 48 && nkeyCode <= 112) || nkeyCode > 185 || (nkeyCode >= 97 && nkeyCode <= 129))
- {
- return strCharValue;
- }
- return "";
- }
- case "L":
- {
- if ((nkeyCode >= 65 && nkeyCode <= 90) || (nkeyCode >= 97 && nkeyCode <= 129))
- {
- return strCharValue;
- }
- return "";
- }
- default:
- {
- alert("미구현");
- return "";
- }
- }
- };
- /**
- * String 의 값을 인자로 받는 format형식으로 변환한다.
- *
- * @author 김우겸
- *
- */
- inputMoneyUnitValidateCheckPattern1 = function (strInputData, nInputDataLength, strFormat, m_strDotZero)
- { // # 숫자만 존재할 때
- var strSaveData = ""; //초기화
- var bExistFirstZero = -1 != strFormat.indexOf("9#");
- var bExistSaveData = true;
- var bNumber = parseFloat(strInputData) > 0;
- nInputDataLength = 0 == m_strDotZero.length ? strInputData.length : m_strDotZero.length;
- for (var i=0 ; i < nInputDataLength ; i++)
- {
- if (strInputData.charCodeAt(i) >= 48 && strInputData.charCodeAt(i) <= 57)
- {
- if (strInputData.charCodeAt(i) == 48 && !bExistFirstZero)
- {
- bExistFirstZero = false;
- }
- else
- {
- bExistFirstZero = true;
- }
-
- if (bExistFirstZero)
- {
- strSaveData = strSaveData + strInputData.charAt(i);
- bExistSaveData = false;
- //this.m_strInputRealityData = this.m_strInputRealityData + strInputData.charAt(i);
- }
-
- if (bNumber && bExistSaveData && strInputData.charCodeAt(i) == 48)
- {
- //this.m_strInputRealityData = strInputData.charAt(i);
- strSaveData = strInputData.charAt(i);
- }
- bExistSaveData = true;
- }
- }
- for (var i=0; i<m_strDotZero.length; i++)
- {
- if (strSaveData.length == m_strDotZero.length)
- {
- break;
- }
- if ("" == strSaveData.charAt(i))
- {
- // this.m_strInputRealityData = this.m_strInputRealityData + "0";
- strSaveData = strSaveData + "0";
- }
- }
- return strSaveData;
- };
- inputMoneyUnitValidateCheckPattern2 = function (strInputData, nInputDataLength, strFormat, m_strDotZero)
- { // (# + ,) 화폐단위 format일때
- var strSaveData = ""; //초기화
- if (-1 != strInputData.indexOf("."))
- {
- strInputData = strInputData.split(/\./g)[0]; //소숫점이 존재한다면 뒷부분 내림
- }
- nInputDataLength = strInputData.length;
- strInputData = strInputData.replace(/\W|\s|\D/g,""); //문자열에서 , 제외
- nInputDataLength = strInputData.length;
- var nCommaFirstPoint = nInputDataLength % 3;
- var nCommaLoopPoint = (nInputDataLength / 2) - 1 ;
- var nCommaFirstPrintCount = 0;
- var nCommaLoopPrintCount = 0;
- var bCommaLoopStarter = false;
- var bExistFirstZero = false;
- for (var i=0 ; i < nInputDataLength ; i++)
- {
- if (strInputData.charCodeAt(i) >= 48 && strInputData.charCodeAt(i) <= 57)
- {
- if (strInputData.charCodeAt(i) == 48 && !bExistFirstZero)
- {
- bExistFirstZero = false;
- }
- else
- {
- bExistFirstZero = true;
- }
-
- if (bExistFirstZero)
- {
- if (nCommaFirstPoint == nCommaFirstPrintCount)
- {
- if (nInputDataLength > 3 && nCommaFirstPoint != 0)
- {
- strSaveData = strSaveData + ",";
- bCommaLoopStarter = true;
- }
- else if (nInputDataLength > 3)
- {
- bCommaLoopStarter = true;
- }
- }
-
- if (3 == nCommaLoopPrintCount)
- {
- strSaveData = strSaveData + ",";
- nCommaLoopPrintCount = 0;
- }
- strSaveData = strSaveData + strInputData.charAt(i);
- //this.m_strInputRealityData = this.m_strInputRealityData + strInputData.charAt(i);
- nCommaFirstPrintCount ++;
- if (bCommaLoopStarter)
- {
- nCommaLoopPrintCount++;
- }
- }
- if (1 == nInputDataLength && 0 == i && strInputData.charCodeAt(i) == 48)
- {
- //this.m_strInputRealityData = strInputData.charAt(i);
- strSaveData = strInputData.charAt(i);
- }
- }
- }
- return strSaveData;
- };
- inputMoneyUnitValidateCheckPattern3 = function (strInputData, nInputDataLength, strFormat, m_strDotZero)
- {// (# + .) 소수점 단위일 때
- var strSaveData = ""; //초기화
- nInputDataLength = strInputData.length;
- var nCommaFirstPoint = nInputDataLength % 3;
- var nCommaLoopPoint = (nInputDataLength / 2) - 1 ;
- var nCommaFirstPrintCount = 0;
- var nCommaLoopPrintCount = 0;
- var bCommaLoopStarter = false;
- var bExistFirstZero = false;
- var bExistDot = true;
- for (var i=0 ; i < nInputDataLength ; i++)
- {
- if (((strInputData.charCodeAt(i) >= 48 && strInputData.charCodeAt(i) <= 57) || strInputData.charCodeAt(i) == 46) && bExistDot)
- {
- if (strInputData.charCodeAt(i) == 46)
- { // 첫번째 입력값이 .(dot) 일때
- if (0 ==i && !strInputData.charCodeAt(i + 1))
- {
- return "";
- }
- else if(0 ==i && strInputData.charCodeAt(i + 1))
- {
- return strInputData.substring(1 , nInputDataLength);
- }
- }
-
- if (strInputData.charCodeAt(i) == 48 && !bExistFirstZero)
- { //첫번째 값이 0일때 처리
- if (0 == i && !strInputData.charCodeAt(i + 1))
- {
- strSaveData = strSaveData + strInputData.charAt(i);
- //this.m_strInputRealityData = this.m_strInputRealityData + strInputData.charAt(i);
- }
- if(strInputData.charCodeAt(i + 1) != 46)
- {
- bExistFirstZero = false;
- }
- else
- {
- bExistFirstZero = true;
- }
- }
- else
- {
- bExistFirstZero = true;
- }
-
- if (bExistFirstZero)
- {
- strSaveData = strSaveData + strInputData.charAt(i);
- this.m_strInputRealityData = this.m_strInputRealityData + strInputData.charAt(i);
- if (strInputData.charCodeAt(i) == 46)
- {
- bExistDot = false;
- if (-1 != strFormat.indexOf("0"))
- {
- for (var i = strFormat.indexOf("0") ; i < this.m_nLength ; i++)
- {
- if ("0" == strFormat.charAt(i))
- {
- strSaveData += "0";
- //this.m_strInputRealityData += "0";
- }
- }
- return strSaveData;
- }
- }
- }
- }
- else if (strInputData.charCodeAt(i) >= 48 && strInputData.charCodeAt(i) <= 57)
- {
- strSaveData = strSaveData + strInputData.charAt(i);
- //this.m_strInputRealityData = this.m_strInputRealityData + strInputData.charAt(i);
- }
- }
- return strSaveData;
- };
- /**
- * format의 상태를 숫자로 return함
- *
- * @author 김우겸
- *
- * @return 정수(0:format이 없음 1:기본format 2:숫자format 3:화폐 4:소수점 5:화폐 + 소수점)
- *
- */
- formatStatus = function (strFormat)
- {
- if ("" == strFormat)
- {
- return 0;
- }
- var nMoneyUnitFormatPattern;
- if ("-1" == strFormat.indexOf("#") && "-1" == strFormat.indexOf("0"))
- {
- return 1;
- }
- else
- {
- nMoneyUnitFormatPattern = "-1" != strFormat.indexOf(",") ? 3: 2;
- nMoneyUnitFormatPattern = "-1" != strFormat.indexOf(".") ? (nMoneyUnitFormatPattern + 2): nMoneyUnitFormatPattern;
- return nMoneyUnitFormatPattern;
- }
- };
- /**
- * 캐럿의 위치를 저장할 객체
- */
- function CaretPosition()
- {
- var start = null;
- var end = null;
- };
- /**
- * textarea, input tag의 캐럿의 위치를 저장한 객체를 반환한다
- * @param {Object} heField
- * @return {TypeName}
- */
- function getCaretPosition (heField)
- {
- var objCaretPos = new CaretPosition();
- if (document.selection)
- {
- var trBookMark = document.selection.createRange().getBookmark();
- var trSel = heField.createTextRange();
- trSel.moveToBookmark(trBookMark);
- var trSelLeft = heField.createTextRange();
- trSelLeft.collapse(true);
- trSelLeft.setEndPoint("EndToStart", trSel);
- objCaretPos.start = trSelLeft.text.length;
- objCaretPos.end = trSelLeft.text.length + trSel.text.length;
- }
- else if (heField.selectionStart || heField.selectionStart == '0')
- {
- objCaretPos.start = heField.selectionStart;
- objCaretPos.end = heField.selectionEnd;
- }
- return objCaretPos;
- };
- /**
- * textarea, input tag에 지정한 케럿으로 selection 한다
- * @param {Object} heField
- * @param {Object} nCaretStart
- * @param {Object} nCaretEnd
- */
- function setCaretPosition(heField, nCaretStart, nCaretEnd)
- {
- if (document.selection)
- {
- heField.blur();
- heField.focus();
- heField.value = heField.value;
- var trSel = heField.createTextRange();
- trSel.moveStart("character", -heField.value.length);
- trSel.moveEnd("character", -heField.value.length);
- trSel.moveStart("character", nCaretStart);
- trSel.moveEnd("character", nCaretEnd - nCaretStart);
- trSel.select();
- }
- else if (heField.selectionStart || heField.selectionStart == '0')
- {
- heField.selectionStart = null;
- heField.selectionEnd = null;
- heField.selectionStart = nCaretStart;
- heField.selectionEnd = nCaretEnd;
- heField.focus();
- }
- };
- /**
- * textarea, input tag에 selection 한 내용을 반환한다
- * @param {Object} heField
- * @return {TypeName}
- */
- function getSelectionText(heField)
- {
- var objSel ="";
- if (document.selection)
- {
- objSel = document.selection.createRange();
- return objSel.text;
- }
- else
- {
- if (null != heField && null != heField.selectionStart)
- {
- return heField.value.substring(heField.selectionStart, heField.selectionEnd);
- }
- else
- {
- return window.getSelection();
- }
- }
- };
- /**
- * textarea, input tag에 selection 한 내용을 변환한다
- * @param {Object} heField
- * @param {Object} strText
- */
- function setSelectionText(heField, strText)
- {
- if (document.selection)
- {
- var trSel = document.selection.createRange();
- trSel.text = strText;
- }
- else
- {
- var nStartPosition = heField.selectionStart;
- var strHead = 0 != heField.selectionStart ? heField.value.substring(0, heField.selectionStart) : "";
- var strLast = heField.value.substring(heField.selectionEnd, heField.value.length);
- heField.value = strHead + strText + strLast;
- heField.focus();
- heField.selectionStart = nStartPosition;
- heField.selectionEnd = nStartPosition + strText.length;
- }
- };
- /**
- * keyCode의 값으로 검증한다.
- * @param {Object} nKeyCode
- */
- function getInputKeyCode (nKeyCode)
- {
- if ((48 <= nKeyCode && 57 >= nKeyCode) || (65 <= nKeyCode && 90 >= nKeyCode) ||
- (96 <= nKeyCode && 111 >= nKeyCode) || (219 <= nKeyCode && 222 >= nKeyCode) ||
- (186 <= nKeyCode && 192 >= nKeyCode) || 32 == nKeyCode || 229 == nKeyCode)
- {
- return true;
- }
- return false;
- };
- var viewportwidth;
- var viewportheight;
- if (typeof window.innerWidth != 'undefined')
- { viewportwidth = window.innerWidth;
- viewportheight = window.innerHeight; }
- // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
- else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0)
- { viewportwidth = document.documentElement.clientWidth;
- viewportheight = document.documentElement.clientHeight; }
- // older versions of IE
- else {
- viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
- viewportheight = document.getElementsByTagName('body')[0].clientHeight ;
- }
|