/** Á¦ÀÛÀÏ : 2007-10-04 3:30¿ÀÈÄ Á¦ÀÛÀÚ : Çö´ëÁ¤º¸±â¼ú ÀÇ·á±â¼úÆÀ, ²Þ²Ù´Â ÇÁ·Î±×·¡¸Ó ÀÌÁ¦°ü (je2kwan2@naver.com) ¼³¸í : °£È£ÀÎÁõ °øÅë ¸ðµâ (version TF4 Default) */ var Sign = new ENRSign; Sign.init(); // function ENRSign(){ this.version = "TF4"; // CMC Framework based on TrustForm 4.0 RAD Tool this.certreload = false; this.debug = false; this.kmi_name = ""; this.smm_name = ""; this.kmi_ip = ""; this.kmi_port = ""; this.CERT_YEAR = 1970; this.CERT_MONTH = 1; this.CERT_DATE = 1; this.CERT_UID = ""; this.CERT_DN = ""; this.errmsg = "[ÀüÀÚ¼­¸í ¿¡·¯]"; this.errcode = new Array; this.xmlDoc = new ActiveXObject("Msxml2.DOMDocument.4.0"); this.xmlDoc.async = false; this.xmlDoc.resolveExternals = false; this.certchkflag = "Y"; this.tempstr = ""; this.signedInfos = new Array; // ¿ÜºÎ¿ë this.signData = ""; // ³»ºÎ¿ë this.signedData = ""; // ³»ºÎ¿ë this.emptyattname = "xml:"; // XML Text º¯È¯½Ã Attribute ºó°ª¿¡ ´ëÇÑ prefix name this.nulldatastring = "-"; // Topinfo ¹× Session µ¥ÀÌÅͰ¡ null À϶§ ÀÎÁõµ¥ÀÌÅÍ¿¡ Ç¥±âÇÒ String this.XPATH_MAINNODE = "/root/main"; this.XPATH_SIGNBASE = "/root/temp/SignData"; this.XPATH_BASICINFO = this.XPATH_SIGNBASE + "/PatientInfo"; this.XPATH_SIGNINFO = this.XPATH_SIGNBASE + "/SignInfo"; this.XPATH_SESSIONINFO = this.XPATH_SIGNBASE + "/SessionInfo"; // Sign KMI Communication & Verify Function this.init = enrfSign_Init; this.tfcheck = enrfSign_Check; this.chk_mm = enrfSign_ActiveXCheck; this.loadkeyandcert = enrfSign_LoadKeyAndCert; this.certcheck = enrfSign_CertCheck; this.makesigndata = enrfSign_MakeSignData; this.verifysign = enrfSign_VerifySign; // ENR Sign Create Funtion this.findnode = enrfSign_FindNode; this.makenode = enrfSign_MakeNode; this.setattnode = enrfSign_SetAttNode; this.getcommoninfo = enrfSign_GetCommonInfo; this.settaginfos = enrfSign_SetTagInfos; this.setsigninstance = enrfSign_SetSignInstance; this.removenochild = enrfSign_RemoveNoChild; this.makemainattnode = enrfSign_MakeMainAttNode; this.makeuserattnode = enrfSign_MakeUserAttNode; this.addnode = enrfSign_AddCopyNode; this.getsigndatatostr = enrfSign_GetSignDataToStr; this.getsigndataArray = enrfSign_GetSignDataArray; this.getnodenamestrvalue = enrfSign_GetNodeNameStrValue; this.signprocess = enrfSign_SignProcess; // core this.view_signprocess = enrfSign_ViewSignProcess; // core } // function enrfSign_Check(){ var m_check = false; if (this.version == "TF4"){ this.smm_name = "SKCOMMAX.SKCommAXCtrl.1"; // SKCommAX °´Ã¼ ¼³Ä¡ ¿©ºÎ È®ÀÎ this.kmi_name = "KMCLIENTAX.KMClientAXCtrl.1"; // KMI ¸ðµâ ¼³Ä¡ ¿©ºÎÈ®ÀÎ this.kmi_ip = getUserInfo( "kmiip" ); this.kmi_port = parseInt(getUserInfo( "kmiport" )); this.CERT_UID = getUserId(); //2009-11-05 ¿ÀÈÄ 1:28:31 taebum È®»êº´¿ø °øÅë °èÁ¤ »ç¿ëÀ¸·Î ÁÖ¼®Ã³¸® ÇÔ. //if(this.CERT_UID == "ENR"){ // this.CERT_UID = "00000001"; //} m_check = true; } return m_check; } // function enrfSign_ActiveXCheck(pModule_name){ var m_ClientAX; try { m_ClientAX = new ActiveXObject(pModule_name); } catch( ex ) { m_ClientAX = null; } return m_ClientAX; } // function enrfSign_Init(){ var m_return = true; if (this.tfcheck()){ // zesfInitSign body.createChild("xforms:object", "id:KMClientAX; clsid:{d3c608b5-b664-4962-91b7-289da892953a}; visibility:hidden; left:0px; top:0px; width:0px; height:0px; "); body.createChild("xforms:object", "id:CertManX; clsid:{ec5d5118-9fde-4a3e-84f3-c2b711740e70}; visibility:hidden; left:0px; top:0px; width:0px; height:0px; "); if((this.chk_mm(this.kmi_name) == null) || (this.chk_mm(this.kmi_name) == null)) { messageBox( "KMI / ÀüÀÚ¼­¸í ¸ðµâÀÌ ¼³Ä¡µÇÁö", "E007" ); m_return = false; } } return m_return; } // ÀÎÁõ¼­ Reload ¿©ºÎ Á¡°Ë Process function enrfSign_CertCheck(pUid, pReload){ var dn = ""; var msg = ""; var m_return = ""; var today = new Date(); var m_Reload = false; this.errcode[3] = 362; if (pUid == null && pUid == "") pUid = getUserId(); if (pReload == true) m_Reload = true; if (this.CERT_UID != pUid) m_Reload = true; if (this.CERT_YEAR != today.getFullYear()) m_Reload = true; if (this.CERT_MONTH != today.getMonth() + 1) m_Reload = true; if (this.CERT_DATE != today.getDate()) m_Reload = true; this.errcode[3] = 363; if (this.version == "TF4"){ if (m_Reload) { this.errcode[3] = 364; CertManX.UnsetMatchedContext(); this.errcode[3] = 365; dn = this.loadkeyandcert(pUid); this.CERT_DN = dn; } else { dn = this.CERT_DN; } } return dn; } // function enrfSign_LoadKeyAndCert(pUid) { var dn = ""; var msg = ""; var xpt = window.screenLeft + 400; var ypt = window.screenTop + 60; var pwd = ""; var viewerObj = getViewer("sysMessage"); var certloadyn = "N"; certloadyn = viewerObj.window.model.getValue("/root/properties/orderbasicinfo/hardcdlist/hardcd[hardcdno = '5996']/hardcd"); if ( certloadyn == "Y" ) { //ÀÌÀ±ÁÖ ¼öÁ¤(20150415) viewerObj.window.model.removeNodeset("/root/main/pwdhidden"); modal("SPZMS00300",xpt,ypt); pwd = viewerObj.window.model.getValue("/root/main/pwdhidden/pwd"); if (pwd == null || pwd == "") { return dn; } } this.errcode[4] = 365.00; if( !KMClientAX.kmsConnect(this.kmi_ip, this.kmi_port) ) { msg = "KMI ¼­¹ö( IP:" + this.kmi_ip + ",Æ÷Æ®:" + this.kmi_port + ") ¿¬°á¿¡"; messageBox( msg, "E009", getKMIErrMsg() ); return dn; } if( this.debug == true ) { alert( "KMI ¼­¹ö°¡ ¿¬°áµÇ¾ú½À´Ï´Ù." ); } this.errcode[4] = 365.01; var envelop = KMClientAX.kmsInit(); if( envelop == "" ) { msg = "KMI ¸ðµâÀÇ ÃʱâÈ­¿¡"; messageBox( msg, "E009", getKMIErrMsg() ); KMClientAX.kmsDisconnect(); return dn; } if( this.debug == true ) { alert( "KMI ¸ðµâÀÌ ÃʱâÈ­µÇ¾ú½À´Ï´Ù. \nENVELOP : " + envelop ); } this.errcode[4] = 365.02; dn = KMClientAX.GetKeyAndCert( pUid ); if( dn == "" ) { msg = "KMI ¼­¹ö¿¡¼­ ÀÎÁõ¼­( " + pUid + " )¸¦ °¡Á®¿À´Â µ¥."; messageBox( msg, "E009", getKMIErrMsg() ); KMClientAX.kmsDisconnect(); return dn; } if( this.debug == true ) { alert( "ÀÎÁõ¼­¸¦ ´Ù¿î·ÎµåÇÏ¿´½À´Ï´Ù.\n´Ù¿î·Îµå ÀÎÁõ¼­ DN : " + dn ); } this.errcode[4] = 365.03; switch( KMClientAX.IsCertNew(pUid, dn) ) { case 0 : // ÇöÀç ÀÎÁõ¼­°¡ À¯È¿ÇÔ if( this.debug == true ) { alert( "ÇöÀç ÀÎÁõ¼­°¡ À¯È¿ÇÕ´Ï´Ù." ); } break; case 1 : // ÀÎÁõ¼­°¡ °»½ÅµÇ¾î KMI¿¡ Àçµî·ÏµÊ msg = "ÀÎÁõ¼­ÀÇ °»½ÅÀÌ"; messageBox( msg, "I002"); break; case 2 : // ÀÎÁõ¼­ °»½Å ½ÇÆÐ ( ¿¡·¯ÄÚµå¿Í ¸Þ½ÃÁö°¡ ¸®ÅÏµÊ ) msg = "ÀÎÁõ¼­ °»½Å¿¡"; messageBox( msg, "E009", getKMIErrMsg()); KMClientAX.LocalDelKeyAndCert(dn); KMClientAX.kmsDisconnect(); return dn; case 3 : // ÀÎÁõ¼­ °»½ÅÀº ¼º°ø ÇÏ¿´À¸³ª KMI ¼­¹ö µî·Ï ½ÇÆÐ (ÀÎÁõ¼­ ¹é¾÷ ¼º°ø) case 4 : // ÀÎÁõ¼­ °»½ÅÀº ¼º°ø ÇÏ¿´À¸³ª KMI ¼­¹ö µî·Ï ½ÇÆÐ (ÀÎÁõ¼­ ¹é¾÷ ½ÇÆÐ) msg = "°»½ÅµÈ ÀÎÁõ¼­ÀÇ KMI µî·Ï¿¡"; messageBox( msg, "E009", "°ü¸®ÀÚ¿¡°Ô ¹®ÀÇÇϽñ⠹ٶø´Ï´Ù."); KMClientAX.LocalDelKeyAndCert(dn); KMClientAX.kmsDisconnect(); return dn; case 5 : // ÀÌ¹Ì ¸¸·á µÇ¾ú°Å³ª ÆóÁöµÈ ÀÎÁõ¼­ msg = "ÀÎÁõ¼­°¡ ¸¸·áµÇ¾î »ç¿ë"; messageBox( msg, "E001", "ÀÎÁõ¼­¸¦ Àç¹ß±Þ ¹ÞÀ¸½Ã±â ¹Ù¶ø´Ï´Ù."); KMClientAX.LocalDelKeyAndCert(dn); KMClientAX.kmsDisconnect(); return dn; case 6 : // ÀÎÁõ¼­ÀÇ °»½ÅÀ» »ç¿ëÀÚ°¡ Ãë¼Ò break; case 7 : msg = "ÀÎÁõ¼­ È­ÀÏ¿¡ ¹®Á¦°¡ ÀÖ¾î ÀÎÁõ¼­ Àб⿡."; messageBox( msg, "E009", "°ü¸®ÀÚ¿¡°Ô ¹®ÀÇÇϽñ⠹ٶø´Ï´Ù."); KMClientAX.LocalDelKeyAndCert(dn); KMClientAX.kmsDisconnect(); return dn; } this.errcode[4] = 365.04; // 0 * 256 : SignKoreaÀÇ ÀÎÁõ¼­¸¸ ¼±Åà // 0 * 16 : ºñ¹Ð¹øÈ£ ÀÔ·Â ¹ÞÀ½ // 1 : ÇöÀçÀÇ ActiveX ÀνºÅϽº°¡ À¯È¿ÇÒ µ¿¾È ¼±ÅÃÇÑ Á¤º¸ À¯Áö // dn = CertManX.SetMatchedContextExt( dn, "", "", 0 * 256 + 0 * 16 + 1 ); //var matched_dn = CertManX.SetMatchedContextExt(dn, "", "", 0 * 256 + 0 * 16 + 1 ); //ÀÌÀ±ÁÖ¼öÁ¤(20150415) var matched_dn = CertManX.SetMatchedContextExt(dn, "", pwd, 0 * 256 + 0 * 16 + 1 ); if( matched_dn == "" ) { msg = "ÀÎÁõ¼­ÀÇ ¸Þ¸ð¸® ·Îµå¿¡"; messageBox( msg, "E009", this.errmsg + CertManX.GetLastErrorMsg()); KMClientAX.LocalDelKeyAndCert(dn); KMClientAX.kmsDisconnect(); return matched_dn; } this.errcode[4] = 365.05; var today = new Date(); // Client Time »ç¿ë, But ServerTime Check ÇÊ¿ä this.CERT_YEAR = today.getFullYear(); this.CERT_MONTH = today.getMonth() + 1; this.CERT_DATE = today.getDate(); this.CERT_UID = pUid; this.errcode[4] = 365.06; KMClientAX.LocalDelKeyAndCert(dn); this.errcode[4] = 365.07; KMClientAX.kmsDisconnect(); return dn; } // function enrfSign_MakeSignData(pOrgData, pUid, pReload) { var m_signedData = ""; if (this.version == "TF4"){ this.errcode[2] = 361; if (this.certcheck(pUid, pReload) != ""){ this.errcode[2] = 366; m_signedData = CertManX.SignDataB64( "", pOrgData, 0 ); this.errcode[2] = 367; if (m_signedData == ""){ var msg = "ÀüÀÚ¼­¸í »ý¼º¿¡" messageBox( msg, "E009", this.errmsg + CertManX.GetLastErrorMsg()); } } } this.signData = pOrgData; this.signedData = m_signedData; return m_signedData; } // ÀüÀÚ¼­¸íµÈ µ¥ÀÌÅÍ º¹¿ø°ËÁõ Process function enrfSign_VerifySign(pSignedData){ var orgData = ""; if (this.version == "TF4"){ if (pSignedData == null) pSignedData = this.signedData; if (pSignedData != ""){ orgData = CertManX.VerifyDataB64(pSignedData, 0 ); if( orgData == "" ) { var msg = "ÀüÀÚ¼­¸í °ËÁõ¿¡"; messageBox( msg, "E009", this.errmsg + CertManX.GetLastErrorMsg()); } } } return orgData; } // function enrfSign_FindNode(pXPath){ var m_node = null; switch (this.version){ case "TF4" : m_node = model.instances(0).selectSingleNode(pXPath); break; default : // TF3 m_node = model.instance.selectSingleNode(pXPath); break; } return m_node; } // function enrfSign_MakeNode(pXPath) { var mNode = this.findnode(pXPath); if (mNode== null){ model.makenode(pXPath); // TF3,4 mNode = this.findnode(pXPath); } return mNode; } // function enrfSign_SetAttNode(pXPath, pAttrName, pValue) { var m_node = this.makenode(pXPath); m_node.setAttribute("name", pAttrName); var bHasCheck = this.findnode(pXPath).hasChildNodes(); if (pValue != null){ if (bHasCheck == false){ // Àڽijëµå°¡ ¾øÀ¸¸é model.setValue(pXPath, pValue); // TF3.4 } else { var sErr = "[Debug Mode] : ÀÎÁõ±¸Á¶ »ý¼ºÁß SetAttNodeÇÔ¼ö ¼öÇà½Ã »óÀ§³ëµå¿¡ °ªÀ» Setting ÇÒ¼ö ¾ø½À´Ï´Ù." sErr += "\n\n[xPath] " + pXPath; sErr += "\n\n[Value] " + pValue; alert(sErr); return null; } } return m_node; } // function enrfSign_SetSignInstance() { var m_topinfo = ""; var m_sessioninfo = ""; this.setattnode(this.XPATH_BASICINFO, "ȯÀÚÁ¤º¸"); this.setattnode(this.XPATH_SIGNINFO, "ÀÎÁõÁ¤º¸"); this.setattnode(this.XPATH_SESSIONINFO, "SessionÁ¤º¸"); switch (this.version){ case "TF4" : m_topinfo = "pid¢ËȯÀÚ¹øÈ£¢Ìpname¢ËȯÀÚÀ̸§¢Ìage¢Ë³ªÀ̼ºº°¢Ìbody¢Ë۸ö¹«°Ô¢Ìbtype¢ËÇ÷¾×Çü¢Ìinsukind¢Ëº¸ÇèÀ¯Çü¢Ìorddept¢ËÁø·á°ú¢Ìapntdr¢ËÁöÁ¤ÀÇ¢Ìattndr¢ËÁÖÄ¡ÀÇ¢Ì"; m_sessioninfo = "userid¢Ë»ç¿ëÀÚ¹øÈ£¢Ìusernm¢Ë»ç¿ëÀÚÀ̸§¢Ìposinstnm¢Ë¼Ò¼Ó±â°ü¸í¢Ìposdeptnm¢Ë¼Ò¼ÓºÎ¼­¸í¢Ìdutplceinstnm¢Ë±Ù¹«Áö±â°ü¸í¢Ìdutplcenm¢Ë±Ù¹«ÁöºÎ¼­¸í¢Ìjobkindnm¢ËÁ÷Á¾¸í¢Ìjobposnm¢ËÁ÷À§¸í¢Ìjobrespnm¢ËÁ÷Ã¥¸í¢Ìprfshipflagnm¢Ë±³Á÷±¸ºÐ¸í¢Ìdeptabbr¢ËºÎ¼­¾à¾î¢Ìsystemnm¢Ë½Ã½ºÅÛ¸íĪ¢Ìsysteminstnm¢Ë½Ã½ºÅÛ¼Ò¼Ó±â°ü¸í¢Ìlogindt¢Ë·Î±×Àνð£¢Ì"; this.settaginfos(m_topinfo, this.XPATH_BASICINFO, "TopInfo", false); // TopInfo Á¤º¸ this.settaginfos(m_sessioninfo, this.XPATH_SESSIONINFO, "SessionInfo", false); // Session Á¤º¸ break; case "TF3" : m_topinfo = "HJID¢ËȯÀÚ¾ÆÀ̵ð¢ÌHJName¢ËȯÀÚÀ̸§¢ÌHJAgeSex¢ËȯÀÚ¼ºº°¢ÌHJBlood¢ËȯÀÚÇ÷¾×Çü¢ÌHJHeightWeight¢ËȯÀÚŰ/¸ö¹«°Ô¢ÌHJInOutFlag¢ËÀÔ¿ø/¿Ü·¡È¯ÀÚ±¸ºÐ¢ÌHJBDInDay¢ËÀÔ¿øÀÏ¢ÌHJORDay¢Ë¿Ü·¡³»¿øÀÏ¢ÌHJBDTerm¢ËÀç¿ø¢ÌHJInsuranc¢Ëº¸Çè¢ÌHJBD¢Ëº´µ¿Á¤º¸¢ÌHJDept¢Ë´ã´çºÎ¼­¢ÌAppoinmentDoctor¢ËÁöÁ¤ÀÇ¢ÌMainDoctor¢ËÁÖÄ¡ÀÇ¢Ì"; m_sessioninfo = "userid¢Ë¾ÆÀ̵ð¢Ìusername¢ËÀ̸§¢Ìuserdeptname¢ËºÎ¼­À̸§¢Ìlogondatetime¢Ë·Î±×Àνð£¢Ìempldeptgmnm¢Ë±Ù¹«ºÎ¼­¸í¢Ìempljkcodenm¢ËÁ÷±Þ¸í"; break; } if (this.debug == true){ alert("enrfSign_SetSignInstance XML View\n\n----------------------\n" + instance1.xml); } } // function enrfSign_SetTagInfos(pParStr, pPath, pMode, pClear) { var m_SessionInfo = ""; var m_KeyName = ""; m_SessionInfo = pParStr; m_SessionInfo = m_SessionInfo.split("¢Ì"); for (var iCnt =0; iCnt < m_SessionInfo.length; iCnt++){ m_KeyName = m_SessionInfo[iCnt].split("¢Ë"); if (m_KeyName != ""){ this.setattnode(pPath + "/" + m_KeyName[0], m_KeyName[1], this.getcommoninfo(pMode, m_KeyName[0])); } } if (pClear == true){ this.removenochild(this.findnode(pPath)); } } // function enrfSign_GetCommonInfo(pMode, pKeyInfo){ var m_return = ""; if (pMode == "TopInfo"){ switch (this.version){ case "TF4" : m_return = getPatientInfo(pKeyInfo); if (m_return == "null") m_return = this.nulldatastring; break; case "TF3" : break; } return m_return; } else if (pMode == "SessionInfo"){ switch (this.version){ case "TF4" : m_return = getUserInfo(pKeyInfo); if (m_return == "null") m_return = this.nulldatastring; break; case "TF3" : break; } return m_return; } } // TF4¿¡¼­¸¸ È®ÀÎÇØº½ : ³ëµå¿¡ °ªÀÌ ¾øÀ¸¸é Á¦°ÅÇÏ´Â ÇÔ¼ö function enrfSign_RemoveNoChild(pNode, pDebug) { //if (pNode == null) return; var pCnt = 0; var iCnt = 0; var iCntLoop = 0; while (1){ iCntLoop++; iCnt = f_removechecker(pNode, iCnt); if (pCnt != iCnt){ pCnt = iCnt; } else { break; } } // if (pDebug == true){ alert("[Debug] RemoveNoChild ÇÔ¼ö ÁøÇà, ¹Ýº¹È½¼ö iCntLoop:" + iCntLoop + " ÃÑ »èÁ¦³ëµå°Ç¼ö iCnt : " + pCnt ); } } // TF4¿¡¼­¸¸ È®ÀÎÇØº½ : function f_removechecker(pNode, iCnt){ if (pNode == null ) return iCnt; var nodes = pNode.childNodes; if (nodes.length > 0){ // exist var m_node = nodes.nextNode(); while (m_node != null){ iCnt = f_removechecker(m_node, iCnt); m_node = nodes.nextNode(); } } else { var prNode = pNode.parentNode; if (pNode.nodeTypedValue == "" || pNode.nodeValue == ""){ prNode.removeChild(pNode); iCnt++; } } return iCnt; } /** [MainData°¡ ±âÁØÀÎ ÇÔ¼ö] - pXPath : È­¸é¿¡ ±¸ÇöµÈ /root/MainData/... °æ·Î path(MainData PATH´Â ÀÚµ¿À¸·Î SignData·Î º¯°æ) - pAttrName : ÇØ´ç ³ëµå¿¡ Ãß°¡µÉ ¼Ó¼º name ÀÇ °ª - pNodeValue : Ãß°¡µÉ ³ëµå¿¡ ¼³Á¤ÇÒ Value °ª - pAddNodeName : pXPath¿¡ Ãß°¡µÉ Ãß°¡³ëµå - »ç¿ë¿¹) Sign.makemainattnode("/root/MainData/condition/datas", "Á¶°Çµé", "¾øÀ½", "check"); »ç¿ë¿¹ °á°ú) ¾øÀ½ */ function enrfSign_MakeMainAttNode(pXPath, pAttrName, pNodeValue, pAddNodeName) { var m_PathNode = this.XPATH_SIGNINFO; if (pAddNodeName != null){ m_PathNode += "/" + pAddNodeName; } var re = new RegExp(this.XPATH_MAINNODE, ["gi"]); var m_Path = pXPath.replace(re, m_PathNode); var m_node = null; m_node = this.setattnode(m_Path, pAttrName, pNodeValue); if (m_node == null){ throw "MakeMainAttNode return Value : Null"; } return m_node; } /** »ç¿ëÀÚ°¡ ÁöÁ¤ÇÑ °æ·Î(pSignPath)¿¡ ³ëµå¸¦ ¸¸µå´Â ÇÔ¼ö - »ç¿ë¿¹) Sign.makeuserattnode("/root/SignData/emrdata", "±âº»", "¿µ¾çº°"); »ç¿ë¿¹ °á°ú) ¿µ¾çº° */ function enrfSign_MakeUserAttNode(pSignPath, pAttrName, pNodeValue) { var m_node = null; if (pSignPath == null) return m_node; m_node = this.setattnode(pSignPath, pAttrName, pNodeValue); if (m_node == null){ throw "MakeUserAttNode return Value : Null"; } return m_node; } // function enrfSign_AddCopyNode(pCopyNodePath){ var m_RootNode = this.findnode(pCopyNodePath); if (m_RootNode != null){ if (pCopyNodePath != "" && pCopyNodePath != null){ var m_temppath = this.XPATH_SIGNINFO + "/" + m_RootNode.nodeName; this.makenode(m_temppath); model.copynode(m_temppath, pCopyNodePath); } } } // ¼±Åà node¸¦ String µ¥ÀÌÅÍ·Î µ¹·ÁÁÖ´Â ÇÔ¼ö function enrfSign_GetSignDataToStr(pXPath){ this.tempstr = ""; var m_RootNode = this.findnode(pXPath); var m_NowNode = m_RootNode.firstChild; if (m_NowNode == null) return; var m_txt = ""; while ((m_NowNode.nodeName != m_RootNode.nodeName) && (m_NowNode.parentNode.nodeName != m_RootNode.parentNode.nodeName)) { if (m_NowNode.getAttribute("name") != null && m_NowNode.getAttribute("name") != ""){ m_txt = m_txt + "\n" + this.tempstr + m_NowNode.getAttribute("name"); } else { m_txt = m_txt + "\n" + this.tempstr + this.emptyattname + m_NowNode.nodeName; } if (m_NowNode.nodeValue != null && m_NowNode.nodeValue != "") { m_txt = m_txt + ": " + m_NowNode.nodeValue; } m_NowNode = this.getnodenamestrvalue(m_NowNode, m_RootNode); if (m_NowNode == null) { break; } } return m_txt; } // GetSignDataToStr ¿¡¼­ »ç¿ëÇÏ´Â Àç±ÍÇÔ¼ö function enrfSign_GetNodeNameStrValue(pNowNode, pRootNode){ var m_tempPath = "/root"; var m_refPath = m_tempPath + "/" + pNowNode.nodeName; var m_childnode = pNowNode.firstChild; if (m_childnode != null){ m_tempPath = m_refPath; this.tempstr = this.tempstr + " "; return m_childnode; } var m_sibling = pNowNode.nextSibling; if (m_sibling != null) { m_tempPath = m_refPath; return m_sibling; } else { // m_sibling == null var m_nodePT = pNowNode; while(1) { m_nodePT = m_nodePT.parentNode; this.tempstr = this.tempstr.substring(0, this.tempstr.length-2); if (m_nodePT == null) { return null; } if ((m_nodePT.nodeName == pRootNode.nodeName) && (m_nodePT.getAttribute("name") == pRootNode.getAttribute("name"))) { return m_nodePT; } if (m_nodePT.nextSibling == null){ continue; } else { return m_nodePT.nextSibling; } } } } // function enrfSign_SignProcess(pClearNode){ // this.errcode[0] = 0; this.errcode[1] = 0; this.errcode[2] = 0; this.errcode[3] = 0; this.errcode[4] = 0; var bCheck = true; var bResultArr = null; // ÀÎÁõ°á°ú Clear Setting this.signedInfos[0] = false; this.signedInfos[1] = ""; this.signedInfos[2] = ""; this.signedInfos[3] = ""; this.signedInfos[4] = ""; this.signedInfos[5] = ""; //this.errcode[0] = 100; model.removeNodeset(this.XPATH_SIGNBASE); // TF3,4 this.setsigninstance(); //this.errcode[0] = 200; try{ // ÀÎÁõ Process "fMake_SignData" CallBack ÇÔ¼ö : »ç¿ëÀÚÁ¤ÀÇ fMake_SignData(); } catch(E){ bCheck = false; alert("[Debug Mode] : ENR ÀÎÁõµ¥ÀÌÅÍ »ý¼ºÇÔ¼ö(fMake_SignData)¿¡ ¹®Á¦°¡ ÀÖ½À´Ï´Ù."); } this.errcode[0] = 300; if (bCheck == true){ bCheck = this.getsigndataArray(this.CERT_UID, this.certreload); // Array ±¸Á¶·Î »ý¼ºµÈ µ¥ÀÌÅ͸¦ µ¹·ÁÁÜ : this.signedInfos } if (pClearNode == true){ // 3. ÀÎÁõÀ» À§ÇØ »ý¼ºµÈ µ¥ÀÌÅÍ »èÁ¦ model.removeNodeset(this.XPATH_SIGNBASE); } return bCheck; } function enrfSign_ViewSignProcess(pClearNode){ // this.errcode[0] = 0; this.errcode[1] = 0; this.errcode[2] = 0; this.errcode[3] = 0; this.errcode[4] = 0; var bCheck = true; var bResultArr = null; // ÀÎÁõ°á°ú Clear Setting this.signedInfos[0] = false; this.signedInfos[1] = ""; this.signedInfos[2] = ""; this.signedInfos[3] = ""; this.signedInfos[4] = ""; this.signedInfos[5] = ""; //this.errcode[0] = 100; model.removeNodeset(this.XPATH_SIGNBASE); // TF3,4 this.setsigninstance(); //this.errcode[0] = 200; try{ // ÀÎÁõ Process "fMake_SignData" CallBack ÇÔ¼ö : »ç¿ëÀÚÁ¤ÀÇ fMake_ViewSignData(); } catch(E){ bCheck = false; alert("[Debug Mode] : ENR ÀÎÁõµ¥ÀÌÅÍ »ý¼ºÇÔ¼ö(fMake_SignData)¿¡ ¹®Á¦°¡ ÀÖ½À´Ï´Ù."); } this.errcode[0] = 300; if (bCheck == true){ bCheck = this.getsigndataArray(this.CERT_UID, this.certreload); // Array ±¸Á¶·Î »ý¼ºµÈ µ¥ÀÌÅ͸¦ µ¹·ÁÁÜ : this.signedInfos } if (pClearNode == true){ // 3. ÀÎÁõÀ» À§ÇØ »ý¼ºµÈ µ¥ÀÌÅÍ »èÁ¦ model.removeNodeset(this.XPATH_SIGNBASE); } return bCheck; } // function enrfSign_GetSignDataArray(pUid, pReload) { var ls_enrinptsavetime = fGetEMRHardCDList("Y", 450, 3); // Áø·áÇϵåÄÚµù Á¶È¸ CareCom.js var ll_enrinptsavetime = ls_enrinptsavetime == "" ? 0 : parseInt(ls_enrinptsavetime) * -1; var mstatecheck = false; var mSignData1 = ""; var mSignedData = ""; var mSignData3 = ""; var mViewData4 = ""; var mViewData5 = ""; this.errcode[1] = 300; try { this.errcode[1] = 310; mSignData3 = this.findnode(this.XPATH_SIGNBASE).xml; // º¯°æ xml µ¥ÀÌÅÍÀúÀåÆÐÅÏÀ¸·Î... this.errcode[1] = 320; mViewData4 = this.getsigndatatostr(this.XPATH_SIGNBASE); // ÀüÀÚ¼­¸íÇÒ ¿ø¹® µ¥ÀÌÅÍ // °ªÀÌ ¾ø´Â°ÍµéÀº Á¦°ÅÇÔ (Attribute¸¸ Àִ°͵µ ³¯¸²) this.errcode[1] = 330; this.removenochild(this.findnode(this.XPATH_SIGNBASE)); this.errcode[1] = 340; mSignData1 = this.findnode(this.XPATH_SIGNBASE).xml; // º¯°æ xml µ¥ÀÌÅÍÀúÀåÆÐÅÏÀ¸·Î... this.errcode[1] = 350; mViewData5 = this.getsigndatatostr(this.XPATH_SIGNBASE); // ÀüÀÚ¼­¸íÇÒ ¿ø¹® µ¥ÀÌÅÍ this.errcode[1] = 360; // -----------------------(2010.08.18 ¼¾ÅÍ)start-------------------- //¿î¿µ¼­¹ö´Â ÀÎÁõ¸ðµâ Ÿ°í ±×¿Ü¼­¹ö´Â ÀÎÁõ¸ðµâÁ¦¿Ü //if (htmlwindow.DEVSystem != "true") { if(this.certchkflag == "Y") { if(ll_enrinptsavetime < 0 && getGlobalVariable("enrinptsavetime") >= getCurrentDateTime().toDate("YYYYMMDD hhmmss").getAddDate(ll_enrinptsavetime, "m").getDateFormat("YYYYMMDD hhmmss")){ mSignedData = this.makesigndata(mSignData1, pUid, false); //ÀüÀÚ¼­¸í ¾øÀÌ ÀúÀåó¸®ÇÒ °æ¿ì ¼³Á¤ ºÎºÐ }else{ mSignedData = this.makesigndata(mSignData1, pUid, pReload, true) //ÀüÀÚ¼­¸í popupÈ£Ãâ } } else { mSignedData = this.findnode(this.XPATH_SIGNBASE).xml //ÀüÀÚ¼­¸í ¾øÀÌ ÀúÀåó¸®ÇÒ °æ¿ì ¼³Á¤ ºÎºÐ } //} else { // mSignedData = this.findnode(this.XPATH_SIGNBASE).xml //ÀüÀÚ¼­¸í ¾øÀÌ ÀúÀåó¸®ÇÒ °æ¿ì ¼³Á¤ ºÎºÐ //} // -----------------------(2010.08.18 ¼¾ÅÍ)start-------------------- this.errcode[1] = 370; if (mSignedData == "" || mSignedData == null) { this.signedInfos[0] = mstatecheck; this.signedInfos[1] = mSignData1; // ÀÎÁõÇÒ µ¥ÀÌÅÍ Á¤º¸ this.signedInfos[2] = mSignedData; this.signedInfos[3] = mSignData3; this.signedInfos[4] = mViewData4; this.signedInfos[5] = mViewData5; return false; } this.errcode[1] = 0; mstatecheck = true; } catch(E){ alert("ENR ÀÎÁõ¸ðµâ ÀÛ¾÷¿¡ ¹®Á¦°¡ ÀÖ½À´Ï´Ù. °ü¸®ÀÚ¿¡°Ô ¹®ÀÇÇϼ¼¿ä Code(" + this.errcode + ")...\n\n" + E); return mstatecheck; } this.signedInfos[0] = mstatecheck; // [0] : ÀÎÁõ¼º°ø¿©ºÎ this.signedInfos[1] = mSignData1; // [1] : ÀÎÁõÇÒ µ¥ÀÌÅÍ Á¤º¸ (¹Ì±â·Ï ³ëµå Á¦°ÅµÈ Á¤º¸) this.signedInfos[2] = mSignedData; // [2] : °øÀÎÀÎÁõ ó¸®ÈÄ µ¥ÀÌÅÍ this.signedInfos[3] = mSignData3; // [3] : ÀÎÁõÇÒ µ¥ÀÌÅÍ Á¤º¸ (¹Ì±â·Ï ³ëµå Á¦°ÅÀü ¿øº» ³ëµå) this.signedInfos[4] = mViewData4; // [4] : [3]µ¥ÀÌÅÍ(¾ø´Â ³ëµå Æ÷ÇÔµÈ)¸¦ text ÇüÅ·ΠÃßÃ⺸±â this.signedInfos[5] = mViewData5; // [5] : [1]µ¥ÀÌÅÍ(¾ø´Â ³ëµå Á¦°ÅµÈ)¸¦ text ÇüÅ·ΠÃßÃ⺸±â if(mstatecheck == true){ if(ll_enrinptsavetime < 0 && getGlobalVariable("enrinptsavetime") >= getCurrentDateTime().toDate("YYYYMMDD hhmmss").getAddDate(ll_enrinptsavetime, "m").getDateFormat("YYYYMMDD hhmmss")){ }else{ setGlobalVariable("enrinptsavetime", getCurrentDateTime()); } } return mstatecheck; } // Áø·á ÇϵåÄÚµù Á¶È¸ function fGetEMRHardCDList(option, hardcdno, rtnValue , rslt_ref_list) { model.makeNode(rslt_ref_list); var destNode = model.instances(0).selectSingleNode(rslt_ref_list); var sysMessageobj = getViewer("sysMessage"); if (sysMessageobj != null) { if (option == "Y") { try { var hardcdno = sysMessageobj.window.instance1.selectSingleNode("/root/properties/orderbasicinfo/hardcdlist/hardcd[hardcdno='" + hardcdno + "']/hardcdno").text; var hardcodenm = sysMessageobj.window.instance1.selectSingleNode("/root/properties/orderbasicinfo/hardcdlist/hardcd[hardcdno='" + hardcdno + "']/hardcodenm").text; var hardcd = sysMessageobj.window.instance1.selectSingleNode("/root/properties/orderbasicinfo/hardcdlist/hardcd[hardcdno='" + hardcdno + "']/hardcd").text; var hardcdnm = sysMessageobj.window.instance1.selectSingleNode("/root/properties/orderbasicinfo/hardcdlist/hardcd[hardcdno='" + hardcdno + "']/hardcdnm").text; var cdseqno = sysMessageobj.window.instance1.selectSingleNode("/root/properties/orderbasicinfo/hardcdlist/hardcd[hardcdno='" + hardcdno + "']/cdseqno").text; } catch(err) { model.makeValue("/root/enrtemp/hardcd", hardcdno); mmbfGetHardCodeInfo("/root/send/reqdata", "/root/enrtemp/hardcd", hardcdno); // var hardcd = model.getValue("/root/enrtemp/hardcd/hardcd"); var hardcdnm = model.getValue("/root/enrtemp/hardcd/hardcdnm"); var cdseqno = model.getValue("/root/enrtemp/hardcd/cdseqno"); } if (rtnValue == 1) { return hardcdno; } else if (rtnValue == 1) { return hardcodenm; } else if (rtnValue == 2) { return hardcdno; } else if (rtnValue == 3) { return hardcd; } else if (rtnValue == 4) { return hardcdnm; } else if (rtnValue == 5) { return cdseqno; } else if (rtnValue == 9) { return hardcd+ "|" + hardcdnm + "|" + cdseqno; } } else { var destListLen = destNode.childNodes.length; if (destListLen < 1 ) { // ÇѹøÀÌ¶óµµ º¹»çµÈ ³»¿ëÀÌ ÀÖÀ¸¸é ´Ù½Ã ¾ÈÇϵµ·Ï ¼öÁ¤ 2011. 01.20 ±è¿µÇÐ var destNode = instance1.selectSingleNode(rslt_ref_list); var nodes = sysMessageobj.window.instance1.selectNodes("/root/properties/orderbasicinfo/hardcdlist/hardcd[hardcdno='"+hardcdno+"']"); for(i=1; i<= nodes.length; i++) { destNode.appendChild(nodes.item(i-1).cloneNode(true)); } } } } } function mmbfGetHardCodeInfo(ref, rsltref, hardcd){ fGetEMRHardCDList("N", hardcd, 0, rsltref); model.refresh(); }