// // ?? ?? ?? ??? // var gvMyUIDPath = null; var gvOpUIDPath = null; var gvChUIDPath = null; var gvDate = null; var gvParamPath = null; var gvPropPath = null; var gvAuthPath = null; var gvTitlePath = null; var gvScnTypePath = null; var gvErrorMsgPath = null; var gvSystemPath = null; var gvMenuPath = null; var gvMenuGroupCdPath = null; var gvMenuPrestDeptCdPath = null; var gvMenuItemCdPath = null; var gvMenuParamPath = null; var gvSystemCd = null; //var gvMyCBOnClosePath = null; //var gvOpCBOnClosePath = null; // // ??? ?? ?? // var gvReportPath = null; var gvSubReportPath = null; var gvReportPropsPath = null; var gvReportParamsPath = null; var gvReportOptionsPath = null; //???? ?? ?? var gvPatientInfoPath = null; var gvOperationInfoPath = null; var gvConsultInfoPath = null; var gvPatientInfoFlagPath = null; var gvOrderBasicInfoPath = null; //???? ?? var gvPopupMenuPath = null; function xforms_model_construct() { gvPropPath="/root/properties"; gvMyUIDPath=gvPropPath+"/uid/myself"; gvOpUIDPath=gvPropPath+"/uid/opener"; gvChUIDPath=gvPropPath+"/uid/children/"; // gvMyCBOnClosePath=gvPropPath+"/callback/onclose/myself"; // gvOpCBOnClosePath=gvPropPath+"/callback/onclose/opener"; gvParamPath=gvPropPath+"/parameters"; gvChildClosePath=gvPropPath+"/childclose"; gvSystemPath=gvPropPath+"/domain"; gvAuthPath=gvPropPath+"/auth"; gvMenuPath=gvPropPath+"/menu"; gvMenuGroupCdPath=gvMenuPath+"/menugroupcd"; gvMenuPrestDeptCdPath=gvMenuPath+"/menuprestdeptcd"; gvMenuItemCdPath=gvMenuPath+"/menuitemcd"; gvMenuParamPath=gvMenuPath+"/menuparam"; gvTitlePath=gvPropPath+"/title"; gvScnTypePath=gvPropPath+"/stype"; gvErrorMsgPath=gvPropPath+"/error"; gvReportPath=gvPropPath+"/report/mainreport"; gvSubReportPath=gvPropPath+"/report/subreport"; gvReportPropsPath=gvReportPath+"/props"; gvReportParamsPath=gvReportPath+"/params"; gvReportOptionsPath=gvReportPath+"/options"; gvPatientInfoPath=gvPropPath+"/patient"; gvOperationInfoPath=gvPatientInfoPath+"/operationinfo"; gvConsultInfoPath=gvPatientInfoPath+"/consultinfo"; gvPatientInfoFlagPath=gvPatientInfoPath+"/patientflag"; gvOrderBasicInfoPath=gvPropPath+"/orderbasicinfo"; gvPopupMenuPath=gvPropPath+"/popupmenu"; // ??? UID ??(????? ??) // window.load()? xforms_model_construct() ? ????? ???? uid? ????? gvDate = new Date(); var uid = gvDate.getTime(); model.makeValue(gvMyUIDPath,uid); model.makeValue(gvOpUIDPath,""); model.makeValue(gvSystemPath,""); if (isPopup()) { // opener uid? ????. model.setValue(gvOpUIDPath,opener.model.getValue(gvMyUIDPath)); // opener callback? ??? ????. // model.makeValue(gvOpCBOnClosePath,opener.model.getValue(gvMyCBOnClosePath)); // opener? latest? uid? ????. opener.model.makeValue(gvChUIDPath+"latest",uid); // opener? ????? ????. model.makeValue(gvAuthPath,opener.model.getValue(gvAuthPath)); // opener? ????????? ????. model.makeValue(gvMenuParamPath,opener.model.getValue(gvMenuParamPath)); // ??? ???? ??? ??? ????.(???? ?? Open? ??) model.setValue(gvSystemPath,getGlobalVariable("systemcode"),true); setGlobalVariable("systemcode",""); // ??? ?? ?? setWindowSize(); // ??? ??? ????. ?? addOpenWindow() ??? ????? ??. initTitle(); // ?? ?? ??? ?? addOpenWindow(); } else { // ??? ??? ????. initTitle(); // ???? ??? ?? ?? ????. setScreenAuth(); // ??Parameter??? ????. setScreenMenuParameter(); } // ????? ????. setScreenMenuGroup(); // ??Item??? ????. setScreenMenuItem(); // ???? ??? ???? ?? ????. setScreenPrestDeptCd(); event.stopPropagation(); // ??? ??? ??(??? ? ??? 3? ????.) } function xforms_ready() { // ???? ??? window.setPopupMenu(false); // ??? ???key ?? //??? ???? ???? ?? ???? ??? ? ??. //????? accesskey ??? ???? onaccesskey ??? ?? ? DOMActivate ???? Dispatch ??. //body.attribute("accesskey") = "f1"; } function xforms_close() { // event ??? model??? ???? head ??? propagation ??. if( document.all.item(event.currentTarget).elementName == "xhtml:head" ) { event.stopPropagation(); return; } if ( isPopup() ) { // opener? childeren UID ??? ????. opener.model.removenode(gvChUIDPath+"child::*[text()=""+getMyUID()+""]"); //??? ?? ?? ??? ??? ?? if(window.type == "modal"){ var viewerObj = getViewer("sysMessage"); if (viewerObj != null && viewerObj.window.javascript.fGetLastModal != undefined){ var modalWindowNm = viewerObj.window.javascript.fGetLastModal(getMyUID()); if(modalWindowNm != null && modalWindowNm != ""){ messageBox("?? ?? ????? ?? ?","C003","("+modalWindowNm.split('|')[3]+")"); } } } } //event.stopPropagation(); } function xforms_model_destruct() { // event ??? model??? ???? head ??? propagation ??. if( document.all.item(event.currentTarget).elementName == "xhtml:head" ) { event.stopPropagation(); return; } //????? ???? ?? var mainClose = getGlobalVariable("mainclose"); if ( mainClose != "Y") { //????? ?? ????? ????. if ( isPopup() ) { // ??? ?? ?? ????? ????. setScreenLocation(getScreenID(),window.left,window.top); // ???? ???? ????. removeOpenWindow(); //topmost??? ?? ?? //opener.body.disabled = false; //opener.body.dispatch(model.getValue(gvOpCBOnClosePath)); } } //event.stopPropagation(); } /* function onaccesskey(){ //accesskey ? ??? var scnID = getScreenID(); openHtml(getDomain()+"/docs/help/"+getBizName(scnID)+"/"+scnID+".html","Help","toolbar=no"); event.stopPropagation(); } */ // ?????? ?? ???. function initTitle() { var titleValue = null; var syscd = model.getValue(gvSystemPath); if( syscd == null || syscd == "") { titleValue = document.head.title.text; } else { titleValue = document.head.title.text + "(" + getGlobalVariable("sysname"+syscd) + ")"; } model.makeValue(gvTitlePath,titleValue); if (!isPopup() && getGlobalVariable("userinfos") != "") { var scrnTitle = "CMC nU " ; scrnTitle = scrnTitle + getUserInfo("systeminstnm") + " "; scrnTitle = scrnTitle + new String(htmlwindow.vision) + " "; scrnTitle = scrnTitle + getUserInfo("dutplcenm") + " "; scrnTitle = scrnTitle + getUserName() + " "; scrnTitle = scrnTitle + getTitleLoginDate() + " "; document.title = scrnTitle; } if (isPopup()) { document.title = titleValue; } } // ?? ??? ???? ?? function getTitle() { return model.getValue(gvTitlePath); } //??? ?? ?? function getTitleLoginDate() { var weekarr = new Array("?", "?", "?", "?", "?", "?", "?"); var dt = getUserInfo("logindt"); var dtyear = dt.substring(0,4); var dtmonth = dt.substring(4,6); var dtday = dt.substring(6,8); var dthour = dt.substring(8,10); var dtmin = dt.substring(10,12); var dtval = new Date(dtmonth+"/"+dtday+"/"+dtyear); var dtweek = weekarr[dtval.getDay()]; var dtstr = dtyear + "?" + dtmonth + "?" + dtday + "? (" + dtweek + ") " + dthour +"?" + dtmin +"?"; return dtstr; } // MIS??? ??? ????. function getMISSystemCd() { var systemcd = getSystemCd(); var systeminstcd = systemcd.substring(3,6); var missystemcd = ""; if(systeminstcd == "999"){ missystemcd = "MIS999"; }else if(systeminstcd == "888"){ missystemcd = "MIS888"; }else if(systeminstcd == "011" || systeminstcd == "012" || systeminstcd == "013" || systeminstcd == "016"){ missystemcd = "MIS001"; }else{ missystemcd = systemcd; } return missystemcd; } // ??? ??? ????. function getSystemCd() { if (gvSystemCd != null) { return gvSystemCd; } if (htmlwindow.systemcd == undefined) { gvSystemCd = ""; } else { gvSystemCd = new String(htmlwindow.systemcd); } return gvSystemCd; } // ??? ??? TF Viewer ??? ????. function getViewer(name) { return viewer.item(getSystemCd()+"_"+name); } //menugroupcd? ????. function setScreenMenuGroup(){ model.makeValue(gvMenuGroupCdPath, getGlobalVariable("menugroupcd")); } //menuitemcd? ????. function setScreenMenuItem(){ model.makeValue(gvMenuItemCdPath, getGlobalVariable("menuitemcd")); } // ???? ??? ???? ??? ????. function setScreenPrestDeptCd(){ model.makeValue(gvMenuPrestDeptCdPath, getGlobalVariable("prestdeptcd")); } // ???? ??? ???? ??? ????. function getScreenPrestDeptCd(){ return model.getValue(gvMenuPrestDeptCdPath); } // ??Parameter??? ????. function setScreenMenuParameter(){ model.makeValue(gvMenuParamPath, getGlobalVariable("menuparam")); if(window.type != "iviewer") setGlobalVariable("menuparam",""); } // ??Parameter??? ????. function getScreenMenuParameter(){ return model.getValue(gvMenuParamPath); } // url??? ??ID? ????. url? null?? ?? ??? url? ????. function getScreenID(url) { if (url == null) { url = document.url; } var sp = url.split("/"); return sp[sp.length-1].split(".")[0].substr(0,10); } //??? ??? ????. function setScreenAuth(){ var viewerObj = getViewer("bizMain"); //????(F5) ?? ?? if ( viewerObj == null ) { setGlobalVariable("scrnauth","11100000"); } model.makeValue(gvAuthPath, getGlobalVariable("scrnauth")); if(window.type != "iviewer") setGlobalVariable("scrnauth",""); } // ?? ??? ?? ??? ?? function checkAuth(auth) { var f = auth.charAt(0); var a = getAuth(); var v = '0'; switch(f) { case 'r': // ???? case 'R': v = a.charAt(0); break; case 'x': // ???? case 'X': v = a.charAt(1); break; case 'p': case 'P': v = a.charAt(2); break; } if (v == '1') { return true; } else { return false; } } // ?? ??? ??? ??? ?? function getAuth() { return model.getValue(gvAuthPath); } //?? ?? ??(_auth)? ?? ????(RXP)? ????. function setScreenBtnDisabled( documentObj ) { if (documentObj == null) { documentObj = document; } var childObjCnt = documentObj.controls.length; var childObj; for (var i=0; i < childObjCnt; i++) { childObj = documentObj.controls.item(i); if (childObj.elementName == "xforms:iviewer") { setScreenBtnDisabled( childObj.document ); } else if (childObj.elementName == "xforms:button") { var btnAuth = childObj.attribute("_auth"); if(btnAuth == "R" || btnAuth == "r" || btnAuth == "X" || btnAuth == "x" || btnAuth == "P" || btnAuth == "p"){ childObj.disabled = !checkAuth(btnAuth); } } } } // ?? ??? UID? ?? function getMyUID() { return model.getValue(gvMyUIDPath); } // Opener? UID? ??, Opener? ??? "" ?? function getOpenerUID() { return model.getValue(gvOpUIDPath); } // WID? ? child ???? ?? UID? ?? function getChildUID(wid) { var cid = model.getValue(gvChUIDPath+wid); if (cid==null) { cid=""; } return cid; } // Opener? ?? ???? ?????? ??? ????. function checkOpener() { if (isPopup()) { return (getOpenerUID()==opener.model.getValue(gvMyUIDPath)); } else { return false; } } // wid? ???? open? child window ??? ??? UID? ??? ?? window??? ????. // child window? ??? ???? UID? ????? null? ????. function getChildWindow(wid) { return findChildWindow(getChildUID(wid)); } // ???? child ??? ??? ??? UID? ??? cid? ??? // window ??? ??? ????. ??? null function findChildWindow(cid) { var child = null; for(i=0;i 0; i-- ) { window.children.item(i-1).close(); } } } //????? child? close??? ?? function setCloseChildWindow(){ model.makeValue(gvChildClosePath,"Y"); } // ??? ???? ???? ????. function isPopup() { var stype = window.type; if (stype == "iviewer" || stype == "main") { return false; } else { return true; } } // wid? open? child window? activate??. function activateChild(wid) { var cwnd = window.children.item(wid); if (cwnd != null) { cwnd.activate(); } } // opener? activate??. function activateOpener() { if (isPopup()) { opener.javascript.activateMyWindow(); } } // ?? ?? window? activate??. function activateMyWindow() { if (isPopup()) { window.activate(); } else { // main viewer ? ?? htmlwindow.focus(); } } //?? ?? ?? function getScreenDisabled(){ return body.disabled; } //??Object ???? function setMenuDisabled(type){ htmlwindow.setMenuDisabled(type); } function openInternal(openType,id,idType,monNo,xPos,yPos,wid,ref,resultref,userProp,prevPos) { if (!checkTimeout()) { // session timeout ??? ??? session ?? ?? setGlobalVariable("last_submit", (new Date()).getTime()); } var url = null; var sid = getScreenID(id); if (wid == null || wid == "") { wid = sid; } if (prevPos == null) { // ?? ?? ?? ?? ?? prevPos = true; } if ( idType == "url" ) { // idType == "url" ?? ID? ??? URL? open??. url = id; } else { // idType == "scn" //url = sid+".xrw"; url = getScreenURL(sid); } // ??? ?? var prop = null; if (monNo == null && xPos == null && yPos == null) { // ?? ?? ?? ?? ?? ?? ??? open var viewerObj = getViewer("sysMessage"); if (viewerObj != null && viewerObj.window.javascript.fSetStatusMessage != undefined) { // ?? ?????? ?? ??? ??? ?? ?? monNo = getCurrentMonitorNumber()-1; var monSize = viewerObj.window.javascript.fGetMonitorSize(monNo); xPos = monSize[0]/2 - 605; // 1211px/2 yPos = monSize[1]/2 - 392; // 784px/2 if (xPos < 0) { xPos = 0; } if (yPos < 0) { yPos = 0; } var loc = getAbsoluteLocation(monNo,xPos,yPos); xPos = loc[0]; yPos = loc[1]; prop = "top:"+yPos+"px;left:"+xPos+"px;width:1211px;height:784px;"; } else { prop = "align:center;width:1211px;height:784px;"; } } else { var xyPos = getScreenLocation(sid); // ?? ??? ???. var loc = null; if ( prevPos && xyPos != "") { // ?? ?? ?? loc = xyPos.split("|"); } else { // ??? ?? ??? ?? ??? ?? if (xPos == "" || xPos == null) {xPos = 0;} if (yPos == "" || yPos == null) {yPos = 0;} if (monNo == "" || monNo == null) {monNo = getCurrentMonitorNumber();} monNo = parseInt(monNo)-1; if (monNo < 0) { monNo = 0; } loc = getAbsoluteLocation(monNo,xPos,yPos); } xPos = loc[0]; yPos = loc[1]; prop="top:"+yPos+"px;left:"+xPos+"px;"; } // ??? ?? ???? ?? if (userProp != null) { prop = prop + userProp; } // ?? ??ID? ?? ????? ????, ??? ?? ?? ?? ID? ???? ?? ??? // ? ?? Activate ???. (2008.2.12 ??) var viewerObj = getViewer("sysMessage"); var wd = null; if (viewerObj != null && viewerObj.window.javascript.fGetOpenWindow != undefined) { // ????? ?? ????. ????? ???? ? ??? ???? ???? ????. // ????? ?? ??? ?? ?? ??? ??(????????? ????? ??? ?? ??ID? ??? Modeless? ??) // var mainWnd = getMainViewer(); // if (mainWnd != null && mainWnd.javascript.getScreenID() == sid) { // wd = mainWnd; // } else { wd = viewerObj.window.javascript.fGetOpenWindow(sid); // } } else { // ?? ??? ????. ??? opener, child ????? ???. if (isPopup() && opener.javascript.getScreenID() == sid) { wd = opener; } else if (getScreenID() == sid) { wd = window; } else { wd = findChildWindowByScreenID(sid); } } var cid = ""; if (wd != null && openType =="modeless") { // modeless? ??? ?? ?? ID? ??? ??:activate cid = wd.javascript.getMyUID(); wd.javascript.activateMyWindow(); // ???? ??? Activate ??. wd.body.dispatch("onActivate"); // Activate? ?? } else { // replace??? ??? ?? ??ID? ??? ??? ?? ?? : ?? ?? window.load(url,openType,wid,prop,ref,resultref); if (openType!="replace") { // open? ???? ??? uid? latest? ??????? ? ?? // wid? ???? ??????. cid = model.getValue(gvChUIDPath+"latest"); model.makeValue(gvChUIDPath+wid,cid); model.makeValue(gvChUIDPath+"latest",""); // latest? ?? } } return cid; /** // wid ? ????? ??? ???? ??? uid? ????. var cid = getChildUID(wid); // uid? ????? ??? ???? ???? children??? ??? ????. if (cid != "") { var child = findChildWindow(cid); // ?? uid? ????? ??? activate ?? ????. if ( child!=null ) { child.activate(); return cid; } } // ?? ?? ?? ?? ???? ??? replace??? uid? ?? ?? ??? ????. window.load(url,openType,wid,prop,ref,resultref); if (openType!="replace") { // open? ???? ??? uid? latest? ??????? ? ?? // wid? ???? ??????. cid = model.getValue(gvChUIDPath+"latest"); model.makeValue(gvChUIDPath+wid,cid); model.makeValue(gvChUIDPath+"latest",""); // latest? ?? return cid; } else { return ""; } **/ } function open(id,monNo,xPos,yPos,wid,ref,resultref,userProp,prevPos) { if (userProp == null) { userProp = "max:hidden;"; } else { userProp = "max:hidden;" + userProp; } return openInternal("modeless",id,"scn",monNo,xPos,yPos,wid,ref,resultref,userProp,prevPos); } function navigate(id,monNo,xPos,yPos,wid,ref,resultref) { //???? var scrnauth = model.getValue(gvAuthPath); setGlobalVariable("scrnauth", scrnauth); //child close closeChildWindow(); return openInternal("replace",id,"scn",monNo,xPos,yPos,wid,ref,resultref); } function modal(id,monNo,xPos,yPos,wid,ref,resultref,userProp,prevPos) { var rtn = ""; body.disabled = true; if (userProp == null) { userProp = "min:hidden;max:hidden;"; } else { userProp = "min:hidden;max:hidden;" + userProp; } rtn = openInternal("modal",id,"scn",monNo,xPos,yPos,wid,ref,resultref,userProp,prevPos); body.disabled = false; return rtn; } /* function topmost(id,monNo,xPos,yPos,wid,ref,resultref,userProp,prevPos,onCloseEvent) { var rtn = ""; body.disabled = true; if (userProp == null) { userProp = "min:hidden;max:hidden;"; } else { userProp = "min:hidden;max:hidden;" + userProp; } model.makeValue(gvMyCBOnClosePath,onCloseEvent); rtn = openInternal("modeless_topmost",id,"scn",monNo,xPos,yPos,wid,ref,resultref,userProp,prevPos); body.disabled = false; return rtn; } */ function openUrl(url,monNo,xPos,yPos,wid,ref,resultref,userProp,prevPos) { if (userProp == null) { userProp = "max:hidden;"; } else { userProp = "max:hidden;" + userProp; } return openInternal("modeless",url,"url",monNo,xPos,yPos,wid,ref,resultref,userProp,prevPos); } function navigateUrl(url,monNo,xPos,yPos,wid,ref,resultref) { //???? var scrnauth = model.getValue(gvAuthPath); setGlobalVariable("scrnauth", scrnauth); return openInternal("replace",url,"url",monNo,xPos,yPos,wid,ref,resultref); } function modalUrl(url,monNo,xPos,yPos,wid,ref,resultref,userProp,prevPos) { if (userProp == null) { userProp = "min:hidden;max:hidden;"; } else { userProp = "min:hidden;max:hidden;" + userProp; } return openInternal("modal",url,"url",monNo,xPos,yPos,wid,ref,resultref,userProp,prevPos); } // ???? Open function openExternal(syscd,id,monNo,xPos,yPos,wid,ref,resultref,userProp,prevPos) { var url = getScreenURL(id,syscd); setGlobalVariable("systemcode", syscd.toUpperCase()); var cid = openInternal("modeless",url,"url",monNo,xPos,yPos,wid,ref,resultref,userProp,prevPos); setGlobalVariable("systemcode", ""); return cid; } // ?? HTML Open function openHtml(url,wid,prop) { if (prop == null) { htmlwindow.open(url,wid); } else { htmlwindow.open(url,wid,prop); } } /** * ?? Size? ?? ??? ?? */ function setWindowSize(){ //????? var pageWidth = body.attribute("pagewidth") == "" ? 1211 : parseInt(body.attribute("pagewidth")); var pageHeight = body.attribute("pageheight") == "" ? 800 : parseInt(body.attribute("pageheight"))+16; //? ?? //?? OS? ???? ?? ??? ????? ? var captionSize = Math.abs(app.registry("HKEY_CURRENT_USER", "Control Panel\\Desktop\\WindowMetrics", "CaptionHeight" , "STRING"))/15; var marginWidth = 8; var marginHeight = captionSize+9; //?? ?? ?? body.attribute("margin-top") = 8; body.attribute("margin-bottom") = 8; //??? ?? window.setSize(pageWidth+marginWidth, pageHeight+marginHeight); } // ??? ??? ???? function setSystemMessage(msg) { var viewerObj = getViewer("sysMessage"); if (viewerObj != null && viewerObj.window.javascript.fSetStatusMessage != undefined) { viewerObj.window.javascript.fSetStatusMessage(msg); } } // ?? ?? ??? ????. function setScreenLocation(sid,xpos,ypos) { var viewerObj = getViewer("sysMessage"); if (viewerObj != null && viewerObj.window.javascript.fSetScreenLocation != undefined) { viewerObj.window.javascript.fSetScreenLocation(sid,xpos,ypos); } } // ?? ?? ??? ????. function getScreenLocation(sid) { var viewerObj = getViewer("sysMessage"); if (viewerObj != null && viewerObj.window.javascript.fGetScreenLocation != undefined) { return viewerObj.window.javascript.fGetScreenLocation(sid); } else { return ""; } } // ????? ????? ????? ????. function getAbsoluteLocation(mon,xpos,ypos) { var viewerObj = getViewer("sysMessage"); if (viewerObj != null && viewerObj.window.javascript.fGetAbsoluteCoordinate != undefined) { return viewerObj.window.javascript.fGetAbsoluteCoordinate(mon,xpos,ypos); } else { var abspos = new Array(2); abspos[0] = xpos; abspos[1] = ypos; return abspos; } } // ??? ?? ??? ??? ??? ??? ??? ????? ????. function getRelativeCoordinate(xpos,ypos){ var viewerObj = getViewer("sysMessage"); if (viewerObj != null && viewerObj.window.javascript.fGetRelativeCoordinate != undefined) { var coord = viewerObj.window.javascript.fGetRelativeCoordinate(xpos,ypos); coord[0] = coord[0]+1; return coord; } else { var coord = new Array(3); coord[0] = 1; coord[1] = xpos; coord[2] = ypos; return coord; } } function getCurrentMonitorNumber() { return getRelativeCoordinate(window.left,window.top)[0]; } // ??? ??? ????? ??? ????. function addOpenWindow() { var viewerObj = getViewer("sysMessage"); if (viewerObj != null && viewerObj.window.javascript.fAddOpenWindow != undefined) { // viewerObj.window.javascript.fAddOpenWindow(getScreenID()+"|"+getMyUID()+"|"+getTitle(),window); viewerObj.window.javascript.fAddOpenWindow(getScreenID()+"|"+getMyUID()+"|"+window.type+"|"+getTitle(),window); } } // ??? ??? ????? ???? ????. function removeOpenWindow() { var viewerObj = getViewer("sysMessage"); if (viewerObj != null && viewerObj.window.javascript.fRemoveOpenWindow != undefined) { // viewerObj.window.javascript.fRemoveOpenWindow(getScreenID()+"|"+getMyUID()+"|"+getTitle()); viewerObj.window.javascript.fRemoveOpenWindow(getScreenID()+"|"+getMyUID()+"|"+window.type+"|"+getTitle()); } } // ?? ??? ??? ?? ID? sid? ??? ??? ??? ????. // ?? ??? ??? null? ????. function getOpenWindow(sid) { var viewerObj = getViewer("sysMessage"); if (viewerObj != null && viewerObj.window.javascript.fGetOpenWindow != undefined) { return viewerObj.window.javascript.fGetOpenWindow(sid); } else { return null; } } // his main ??? ??? ????. // ?? window? ??? null? ????. function getMainViewer(){ var viewerObj = getViewer("bizMain"); //????(F5) ?? ?? if ( viewerObj == null ) { viewerObj = htmldocument.all.TFViewer1; } if ( viewerObj == null ) { return null; } else{ return viewerObj.window; } } // // ??? ??? ?? // // parameter ??? ???? ??? ?? function getParameterPath() { return gvParamPath; } // name ??? value ?? ??, ??? ?? name? ??? ??? ?? ??? function setParameter(name, value){ var valueNode = instance1.selectSingleNode(gvParamPath+"/"+name+"/"+name+"value"); model.makeValue(gvParamPath+"/"+name+"/"+name+"value", value); } // name ??? value ?? ?? function addParameter(name, value){ var valueNode = instance1.selectSingleNode(gvParamPath+"/"+name+"/"+name+"value"); if(valueNode==null){ model.makeValue(gvParamPath+"/"+name+"/"+name+"value", value); }else{ var nameNode = instance1.selectSingleNode(gvParamPath+"/"+name); valueNode = instance1.createNode("element", name+"value", ""); valueNode.text = value; nameNode.appendChild(valueNode); } } // index ?? name? ?? ???, index ???? 1 function getParameter(name, index){ if (index==null) { index = 1; } return model.getValue(gvParamPath+"/"+name+"/"+name+"value["+index+"]"); } function getParameterCount(name){ return new Number(instance1.selectnodes(gvParamPath+"/"+name+"/"+name+"value").length); } // index ?? name? ?? ???, index ???? 1 function removeParameter(name, index){ if (index==null) { index = 1; } model.removeNode(gvParamPath+"/"+name+"/"+name+"value["+index+"]"); } // name? ?? ?? ??? function clearParameter(name){ model.removeNode(gvParamPath+"/"+name); } // ??????? ???? ???? ???, ???? ???? ????. function getBizName(bizCode) { var firstChar = bizCode.charAt(2); //alert(firstChar); var bizName = ""; switch(firstChar) { case 'P': // ?? case 'p': bizName = "pam"; break; case 'M': // EMR case 'm': bizName = "emr"; break; case 'A': // ???? case 'a': bizName = "ast"; break; case 'L': // LIS case 'l': bizName = "lis"; break; case 'R': // MIS case 'r': bizName = "mis"; break; case 'Z': // ?? case 'z': bizName = "com"; break; case 'S': // ???? case 's': bizName = "sts"; break; case 'C': // CRM case 'c': bizName = "crm"; break; case 'I': // CRC(??????) case 'i': bizName = "crc"; break; case 'D': // CRD(????) case 'd': bizName = "crd"; break; case 'T': // ?? case 't': bizName = "tmp"; break; default: // unknown bizName = ""; break; } return bizName; } // ????? domain? ????. function getMainDomain() { var domainStr = getGlobalVariable("domain"); if (domainStr == "") { // ????? ?? domainStr = "http://localhost:9080"; } return domainStr; } // syscd ? ???? ?? ???? ?? ??? URL? ?? // syscd? null ?? ?? ??? ??? ??? ???? ?? ??? URL? ?? function getDomain(syscd) { var domainStr = null; if (syscd == null || syscd == "") { syscd = model.getValue(gvSystemPath); } if (syscd == null || syscd == "") { domainStr = getMainDomain(); } else { domainStr = getGlobalVariable("sysurl"+syscd.toUpperCase()); } return domainStr; } function getScreenURL(sid,syscd) { return getDomain(syscd)+getScreenURI(sid); } function getScreenURI(sid) { return "/himed/webapps/cmc/web/xrw/"+sid+".xrw"; } function getActionURI(submitID) { var bizName = getBizName(submitID); return "/himed/webapps/cmc/web/xrw/.live?submit_id="+submitID+"&business_id=" + bizName; } function getActionURL(submitID) { return getDomain()+getActionURI(submitID); } var gvOnSubmit = false; var gvShowAlert = false; var gvSuppressError = false; var gvForceSubmit = false; var gvHtmlRedirect = false; // ?? submit() ??? ???? ???? ???? ??? ??? MessageBox()? ????. function setAlertOn() { gvShowAlert = true; } // ?? submit() ??? ???? ???? ??? ?? ??? ???. function setErrorOff() { gvSuppressError = true; } // ?? submit() ??? ???? session timeout ? ???? submit()? ????? ??. function setForceOn() { gvForceSubmit = true; } // ?? submit() ??? ???? ??? HTML? ? ?? HTML ? ????? ????. function setHtmlRedirect() { gvHtmlRedirect = true; } // ?? ?? ?? ?? function checkTimeout() { var timeOut = parseInt(getGlobalVariable("session_timeout")); if (isNaN(timeOut) || timeOut <= 0) { // timeout ???? ?? return false; } var lastTime = getGlobalVariable("last_submit"); var curTime = (new Date()).getTime(); if (curTime - parseInt(lastTime) > (timeOut*60000)) { return true; } else { return false; } } function submit(submitID, refresh, ref, resultref, encoding) { var showAlert = gvShowAlert; var suppressError = gvSuppressError; gvShowAlert = false; gvSuppressError = false; if (!gvForceSubmit) { gvForceSubmit = false; if (checkTimeout()) { // ????? ??? body.disabled = true; setParameter("type", "session"); modal("SPZUM00400", "", "", "", "", "", "","width:241px;height:130px;align:center;"); // window.load("../../../com/hismainweb/xrw/SPZUM00400_????.xrw","modal","","width:241px;height:130px;align:center;"); body.disabled = false; if (checkTimeout()) { gvHtmlRedirect = false; return false; // ???? ?? } } // submit ?? ???? setGlobalVariable("last_submit", (new Date()).getTime()); } // ?? submit ?? ?? ?? ?? if (gvOnSubmit) { gvHtmlRedirect = false; return false; } else { gvOnSubmit = true; } var actionURL = getActionURL(submitID) + getUserSessionString(); // ????? query string ??. if ( refresh == null ) { refresh = true; } var retvalue = false; try { var sid = document.all(submitID); if (!sid) { messageBox("Submit["+submitID+"]? ????","E007"); gvOnSubmit = false; gvHtmlRedirect = false; return false; } // ref? resultref? ????. // null ??? "" ?? ???? ???. if ( ref != null && ref != "" ) { sid.attribute("ref") = ref; } if ( resultref != null && resultref != "" ) { sid.attribute("resultref") = resultref; } // action url? ????. sid.attribute("action") = actionURL; if (encoding != null && encoding != "") { sid.attribute("encoding") = encoding; } else { sid.attribute("encoding") = "utf-8"; } //alert(sid.attribute("encoding")); //sid.attribute("type") = "custom"; // ??? submit???? ?? ?? ??? ????? ???. model.removeNode(gvErrorMsgPath); // ??? submit??. var ret = model.send(submitID, refresh, false, true); //alert("return = " + ret); if ( ret == 200 ) { // ??? retvalue = showSystemMessage(showAlert,suppressError); } else { if (!suppressError) { messageBox("Submit["+submitID+"] ???","E009","[ret:"+ret+"]"); } retvalue = false; } } catch (e) { if (!suppressError) { messageBox("Submit["+submitID+"] ???","E009","[exception:"+e+"]"); } retvalue = false; } gvOnSubmit = false; gvHtmlRedirect = false; return retvalue; } function xforms_submit_error() { if (error.errorcode == 3003) { messageBox("?? ??? ? ???? ?? ??? ???? ?? ???","E009","[errorcode:"+error.errorcode+"]"); event.stopPropagation(); } } // ???? ??? ???? ??? ????. function showSystemMessage(showAlert,suppressError) { var type = model.getValue(gvErrorMsgPath+"/type"); var code = model.getValue(gvErrorMsgPath+"/code"); var msg = model.getValue(gvErrorMsgPath+"/msg"); var desc = model.getValue(gvErrorMsgPath+"/description"); if ( "error" == type ) { if (suppressError == null || !suppressError) { body.disabled = true; window.load("../../../com/commonweb/xrw/SPZZZ00100_?????.xrw","modal","","width:514px;height:198px;align:center;",gvErrorMsgPath,"/root/main"); body.disabled = false; } return false; } else { setSystemMessage(msg); if (showAlert != null && showAlert) { messageBox(msg,"I"); } return true; } } // submit? ?? ??? ?? ?? HTML ???? ??? ?? function onredirecthtml() { if( document.all(event.target).elementName == "xforms:submission" && gvHtmlRedirect == false) { event.preventDefault(); event.stopPropagation(); } gvHtmlRedirect = false; } // submit ??? ? ?? ?? function onerror() { var msg = error.description; var svrtime = error.errorSource; var pctime = (new Date()).getTime(); // ?????? ??? ??? ???. setGlobalVariable("timediff", svrtime - pctime); event.stopPropagation(); // ?? ??? instance? ?? handleSystemMessage(msg); } // submit ??? ??? error event? ??? ????. function handleSystemMessage(msg) { // ?? ??? instance? ?? var msgItem = msg.split("|"); model.makeValue(gvErrorMsgPath+"/type",msgItem[0]); // error ?? info model.makeValue(gvErrorMsgPath+"/code",msgItem[1]); // error? ?? ???? model.makeValue(gvErrorMsgPath+"/msg",msgItem[2].replace(";","\n"),true); // ???? newline ??? ; ? ?? ??????? var description = ""; if (msgItem[3] != null && msgItem[3] != "undefined") { description = msgItem[3]; } if (msgItem[4] != null && msgItem[4] != "undefined") { description = description + "\n" + msgItem[4]; } model.makeValue(gvErrorMsgPath+"/description",description); // error? ?? ???? } // ??? ?? ?? ???? ?? ?? submit? ?? ??? ??? // ?? ???? action URL? query string?? ????. // ?? ??? query string? ????. function getUserSessionString() { var sessionStr = "&macaddr="+getUserInfo("macaddr"); var isAnonymous = getGlobalVariable("anonymous"); if (isAnonymous == "true") { // ????? ?? ????? ????? ????. sessionStr = sessionStr + "&anony_session="+encodeURI(getUserInfos()); } return sessionStr; } /** * msg_code : I(Information), C(Critical), E(Exclamation), Q(Question, YN), S(Select, YNC) *I001=???????. *I002=???????. *I003=???????. *I004=????. *I005=?????. *I006=?????. *I007=??????. *I008=????. *I009=???. * *C001=?????? ! *C002=?????? ! *C003=?????? ! * *E001=? ? ????. *E002=??? ????. *E003=???????. *E004=???? ????. *E005=???????. *E006=???????. *E007=?????. *E008=???. *E009=???????. *E010=??? ?????. *E011=??? ?????. *E012=??? ?????. *E013=???? ????. *E014=???? ????. *E015=????? ?????. *E016=???? ????. * *Q001=?? ?????? ? *Q002=?? ?????? ? *Q003=?? ????????? *Q004=?? ??????? *Q005=?? ??????? *Q006=?? ??????? *Q007=?? ??????? *Q008=?? ??????? *Q009=?? ??????? *Q010=??? ??????? *Q011=?? ??????? *Q012=?? ??????? * *S001=???? ?(Yes)\n??? ???(No) *S002=?????? ?(Yes)\n?????? ???(No) *return : yes=6, no=7 */ function messageBox(pMessage, pCode, pOptMsg) { var alertMsg = null; var msgTitle = null; var msgType = null; var msgData = null; var msgRtn = ""; // Title Message switch( pCode.substr(0,1) ){ case "I": msgTitle = "??"; msgType = "64"; break; case "C": msgTitle = "??"; msgType = "16"; break; case "E": msgTitle = "??"; msgType = "48"; break; case "Q": msgTitle = "??"; msgType = "36"; break; case "S": msgTitle = "??"; msgType = "35"; break; default : msgTitle = "??"; msgType = "16"; } // Message Data switch( pCode ){ case "I001": alertMsg = " ???????."; break; case "I002": alertMsg = " ???????."; break; case "I003": alertMsg = " ???????."; break; case "I004": alertMsg = " ????."; break; case "I005": alertMsg = " ?????."; break; case "I006": alertMsg = " ?????."; break; case "I007": alertMsg = " ??????."; break; case "I008": alertMsg = " ????."; break; case "I009": alertMsg = " ???."; break; case "C001": alertMsg = " ??????."; break; case "C002": alertMsg = " ??????."; break; case "C003": alertMsg = " ??????."; break; case "E001": alertMsg = " ? ? ????."; break; case "E002": alertMsg = " ??? ????."; break; case "E003": alertMsg = " ???????."; break; case "E004": alertMsg = " ???? ????."; break; case "E005": alertMsg = " ???????."; break; case "E006": alertMsg = " ???????."; break; case "E007": alertMsg = " ?????."; break; case "E008": alertMsg = " ???."; break; case "E009": alertMsg = " ???????."; break; case "E010": alertMsg = " ??? ?????."; break; case "E011": alertMsg = " ??? ?????."; break; case "E012": alertMsg = " ??? ?????."; break; case "E013": alertMsg = " ???? ????."; break; case "E014": alertMsg = " ???? ????."; break; case "E015": alertMsg = " ????? ?????."; break; case "E016": alertMsg = " ???? ????."; break; case "Q001": alertMsg = " ?? ???????"; break; case "Q002": alertMsg = " ?? ???????"; break; case "Q003": alertMsg = " ?? ?????????"; break; case "Q004": alertMsg = " ?? ???????"; break; case "Q005": alertMsg = " ?? ???????"; break; case "Q006": alertMsg = " ?? ???????"; break; case "Q007": alertMsg = " ?? ???????"; break; case "Q008": alertMsg = " ?? ???????"; break; case "Q009": alertMsg = " ?? ???????"; break; case "Q010": alertMsg = " ??? ???????"; break; case "Q011": alertMsg = " ?? ???????"; break; case "Q012": alertMsg = " ?? ???????"; break; case "S001": alertMsg = " ???? ?(Yes)\n??? ???(No)? ??????."; break; case "S002": alertMsg = " ?????? ?(Yes)\n?????? ???(No)? ??????"; break; default : alertMsg = ""; } if(pOptMsg == null || pOptMsg == ""){ msgData = pMessage+alertMsg; }else{ msgData = pMessage+alertMsg + "\n" + pOptMsg; } body.disabled = true; msgRtn = window.alert( msgData, msgTitle, msgType ); body.disabled = false; return msgRtn; } // ??? ???? ????? function getUserId() { return getUserInfo("userid"); } function getUserName() { return getUserInfo("usernm"); } function getUserInfo(key) { if ( getGlobalVariable("userinfos") == "" ) { setDefaultUserInfo(); } return getGlobalVariable(key); } function getUserInfos() { if ( getGlobalVariable("userinfos") == "" ) { setDefaultUserInfo(); } return getGlobalVariable("userinfos"); } function setDefaultUserInfo() { var userInfoKeyStr="userid|usernm|posinstcd|posinstnm|posdeptcd|posdeptnm|dutplceinstcd|dutplceinstnm|dutplcecd|dutplcenm|jobkindcd|jobkindnm|jobposcd|jobposnm|jobrespcd|jobrespnm|prfshipflagcd|prfshipflagnm|licnsno|specordyn|deptabbr|orddeptflag|wardflag|systemcd|systemnm|systeminstcd|systeminstnm|logindt|kmiip|kmiport|usergrp|ipaddr|dutinstcd|dutinstnm|dutunitcd|dutunitnm|mpphonno|orginstcd|orginstnm|orgdeptcd|orgdeptnm|userkindcd|ordsupdeptcd"; var userInfoKeyArr = userInfoKeyStr.split("|"); var userInfoStr = ""; try { var fso = new ActiveXObject("Scripting.FileSystemObject"); var f = fso.GetFile("session.txt"); var ts = f.OpenAsTextStream(1); userInfoStr = ts.ReadLine(); ts.Close(); } catch(e) { } var userInfoArr = userInfoStr.split("|"); var len = userInfoKeyArr.length; setGlobalVariable("anonymous","true"); // ???????? ?????? for(i=0;i="011" && imageKey <= "018")|| imageKey == "103")){ imageKey = "001"; } return imageKey; } //loading ?? function openLoadingBar(msg){ setParameter("msg", msg); open("SPZZZ00400", "", "", "", "", "", "","width:327px; height:121px; caption:hidden; resize:false; align:center;"); // open("SPZZZ00400", "", "", "", "SPZZZ00400", "/root/properties/loadingmsg", "/root/main/msg", "width:327px; height:121px; caption:hidden; align:center;" ); } function closeLoadingBar(){ var child = getChildWindow("SPZZZ00400"); if(child != null) { child.close(); } } //??? ???? ?? ?? ?? function openPasswordValidate(titlemsg, helpMsg){ setParameter("titlemsg", titlemsg); setParameter("helpmsg", helpMsg); modal("SPZUM00400", "", "", "", "", "", "","width:280px;height:270px;align:center;"); return getParameter("pwdvalid"); } // // Caching API // var gvCommonCachePath="/root/hidden/common/cache"; // Cache?? itemname?? ??? ???? ??? resultref? ????. // ?? itemname?? ??? ???? true? ??? ??? ??? false? ????. // - itemname : cache?? ??? ??? ?? key // - resultref : cache? ??? ??? ?? function copyFromCache(itemname,resultref) { var viewerObj = getViewer("sysMessage"); if (viewerObj == null) { return false; } //itemnode = viewerObj.window.instance1.selectSingleNode(gvCommonCachePath+"/"+itemname); var srcPath = gvCommonCachePath+"/"+itemname; model.makeNode(resultref); // ??? resultref ?? ?? // Cache ?? ?? ?? var itemnode = viewerObj.window.instance1.selectSingleNode(srcPath); if (itemnode == null) { //alert("no cache"); return false; } else { // ?? ?? ?? var dueDate = itemnode.getAttribute("duedate"); var curDate = (new Date()).valueOf(); if (dueDate < curDate) { // ?? ?? ?? //alert("obsolate"); return false; } } // resultref ? ?? model.copyNode(resultref,itemnode); return true; } // resultref ??? ???? ??? cache? ????. // - itemname : cache? ?? ??? ?? Key // - resultref : ?? ????? cache? ?? // - ???? : ? (???? 10??) function storeIntoCache(itemname,resultref,duemin) { var viewerObj = getViewer("sysMessage"); if (viewerObj == null) { return; } var destPath = gvCommonCachePath+"/"+itemname; viewerObj.window.model.makeNode(destPath); // ??? Cache ?? ?? // resultref ?? ?? ?? var itemnode = instance1.selectSingleNode(resultref); if (itemnode == null) { return; } // Cache? ??? ? ????? attribute? ?? viewerObj.window.model.copyNode(destPath,itemnode); itemnode = viewerObj.window.instance1.selectSingleNode(destPath); if (itemnode != null) { var dueDate = (new Date()).valueOf(); //alert(dueDate); if (duemin == null) { duemin = 600; // 10 hours } dueDate = dueDate + duemin*60*1000; //alert(dueDate); itemnode.setAttribute("duedate",dueDate); } }