common.js 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988
  1. //
  2. // ?? ?? ?? ???
  3. //
  4. var gvMyUIDPath = null;
  5. var gvOpUIDPath = null;
  6. var gvChUIDPath = null;
  7. var gvDate = null;
  8. var gvParamPath = null;
  9. var gvPropPath = null;
  10. var gvAuthPath = null;
  11. var gvTitlePath = null;
  12. var gvScnTypePath = null;
  13. var gvErrorMsgPath = null;
  14. var gvSystemPath = null;
  15. var gvMenuPath = null;
  16. var gvMenuGroupCdPath = null;
  17. var gvMenuPrestDeptCdPath = null;
  18. var gvMenuItemCdPath = null;
  19. var gvMenuParamPath = null;
  20. var gvSystemCd = null;
  21. //var gvMyCBOnClosePath = null;
  22. //var gvOpCBOnClosePath = null;
  23. //
  24. // ??? ?? ??
  25. //
  26. var gvReportPath = null;
  27. var gvSubReportPath = null;
  28. var gvReportPropsPath = null;
  29. var gvReportParamsPath = null;
  30. var gvReportOptionsPath = null;
  31. //???? ?? ??
  32. var gvPatientInfoPath = null;
  33. var gvOperationInfoPath = null;
  34. var gvConsultInfoPath = null;
  35. var gvPatientInfoFlagPath = null;
  36. var gvOrderBasicInfoPath = null;
  37. //???? ??
  38. var gvPopupMenuPath = null;
  39. function xforms_model_construct() {
  40. gvPropPath="/root/properties";
  41. gvMyUIDPath=gvPropPath+"/uid/myself";
  42. gvOpUIDPath=gvPropPath+"/uid/opener";
  43. gvChUIDPath=gvPropPath+"/uid/children/";
  44. // gvMyCBOnClosePath=gvPropPath+"/callback/onclose/myself";
  45. // gvOpCBOnClosePath=gvPropPath+"/callback/onclose/opener";
  46. gvParamPath=gvPropPath+"/parameters";
  47. gvChildClosePath=gvPropPath+"/childclose";
  48. gvSystemPath=gvPropPath+"/domain";
  49. gvAuthPath=gvPropPath+"/auth";
  50. gvMenuPath=gvPropPath+"/menu";
  51. gvMenuGroupCdPath=gvMenuPath+"/menugroupcd";
  52. gvMenuPrestDeptCdPath=gvMenuPath+"/menuprestdeptcd";
  53. gvMenuItemCdPath=gvMenuPath+"/menuitemcd";
  54. gvMenuParamPath=gvMenuPath+"/menuparam";
  55. gvTitlePath=gvPropPath+"/title";
  56. gvScnTypePath=gvPropPath+"/stype";
  57. gvErrorMsgPath=gvPropPath+"/error";
  58. gvReportPath=gvPropPath+"/report/mainreport";
  59. gvSubReportPath=gvPropPath+"/report/subreport";
  60. gvReportPropsPath=gvReportPath+"/props";
  61. gvReportParamsPath=gvReportPath+"/params";
  62. gvReportOptionsPath=gvReportPath+"/options";
  63. gvPatientInfoPath=gvPropPath+"/patient";
  64. gvOperationInfoPath=gvPatientInfoPath+"/operationinfo";
  65. gvConsultInfoPath=gvPatientInfoPath+"/consultinfo";
  66. gvPatientInfoFlagPath=gvPatientInfoPath+"/patientflag";
  67. gvOrderBasicInfoPath=gvPropPath+"/orderbasicinfo";
  68. gvPopupMenuPath=gvPropPath+"/popupmenu";
  69. // ??? UID ??(????? ??)
  70. // window.load()? xforms_model_construct() ? ????? ???? uid? ?????
  71. gvDate = new Date();
  72. var uid = gvDate.getTime();
  73. model.makeValue(gvMyUIDPath,uid);
  74. model.makeValue(gvOpUIDPath,"");
  75. model.makeValue(gvSystemPath,"");
  76. if (isPopup()) {
  77. // opener uid? ????.
  78. model.setValue(gvOpUIDPath,opener.model.getValue(gvMyUIDPath));
  79. // opener callback? ??? ????.
  80. // model.makeValue(gvOpCBOnClosePath,opener.model.getValue(gvMyCBOnClosePath));
  81. // opener? latest? uid? ????.
  82. opener.model.makeValue(gvChUIDPath+"latest",uid);
  83. // opener? ????? ????.
  84. model.makeValue(gvAuthPath,opener.model.getValue(gvAuthPath));
  85. // opener? ????????? ????.
  86. model.makeValue(gvMenuParamPath,opener.model.getValue(gvMenuParamPath));
  87. // ??? ???? ??? ??? ????.(???? ?? Open? ??)
  88. model.setValue(gvSystemPath,getGlobalVariable("systemcode"),true);
  89. setGlobalVariable("systemcode","");
  90. // ??? ?? ??
  91. setWindowSize();
  92. // ??? ??? ????. ?? addOpenWindow() ??? ????? ??.
  93. initTitle();
  94. // ?? ?? ??? ??
  95. addOpenWindow();
  96. } else {
  97. // ??? ??? ????.
  98. initTitle();
  99. // ???? ??? ?? ?? ????.
  100. setScreenAuth();
  101. // ??Parameter??? ????.
  102. setScreenMenuParameter();
  103. }
  104. // ????? ????.
  105. setScreenMenuGroup();
  106. // ??Item??? ????.
  107. setScreenMenuItem();
  108. // ???? ??? ???? ?? ????.
  109. setScreenPrestDeptCd();
  110. event.stopPropagation(); // ??? ??? ??(??? ? ??? 3? ????.)
  111. }
  112. function xforms_ready() {
  113. // ???? ???
  114. window.setPopupMenu(false);
  115. // ??? ???key ??
  116. //??? ???? ???? ?? ???? ??? ? ??.
  117. //????? accesskey ??? ???? onaccesskey ??? ?? ? DOMActivate ???? Dispatch ??.
  118. //body.attribute("accesskey") = "f1";
  119. }
  120. function xforms_close() {
  121. // event ??? model??? ???? head ??? propagation ??.
  122. if( document.all.item(event.currentTarget).elementName == "xhtml:head" ) {
  123. event.stopPropagation();
  124. return;
  125. }
  126. if ( isPopup() ) {
  127. // opener? childeren UID ??? ????.
  128. opener.model.removenode(gvChUIDPath+"child::*[text()=""+getMyUID()+""]");
  129. //??? ?? ?? ??? ??? ??
  130. if(window.type == "modal"){
  131. var viewerObj = getViewer("sysMessage");
  132. if (viewerObj != null && viewerObj.window.javascript.fGetLastModal != undefined){
  133. var modalWindowNm = viewerObj.window.javascript.fGetLastModal(getMyUID());
  134. if(modalWindowNm != null && modalWindowNm != ""){
  135. messageBox("?? ?? ????? ?? ?","C003","("+modalWindowNm.split('|')[3]+")");
  136. }
  137. }
  138. }
  139. }
  140. //event.stopPropagation();
  141. }
  142. function xforms_model_destruct() {
  143. // event ??? model??? ???? head ??? propagation ??.
  144. if( document.all.item(event.currentTarget).elementName == "xhtml:head" ) {
  145. event.stopPropagation();
  146. return;
  147. }
  148. //????? ???? ??
  149. var mainClose = getGlobalVariable("mainclose");
  150. if ( mainClose != "Y")
  151. {
  152. //????? ?? ????? ????.
  153. if ( isPopup() ) {
  154. // ??? ?? ?? ????? ????.
  155. setScreenLocation(getScreenID(),window.left,window.top);
  156. // ???? ???? ????.
  157. removeOpenWindow();
  158. //topmost??? ?? ??
  159. //opener.body.disabled = false;
  160. //opener.body.dispatch(model.getValue(gvOpCBOnClosePath));
  161. }
  162. }
  163. //event.stopPropagation();
  164. }
  165. /*
  166. function onaccesskey(){
  167. //accesskey ? ???
  168. var scnID = getScreenID();
  169. openHtml(getDomain()+"/docs/help/"+getBizName(scnID)+"/"+scnID+".html","Help","toolbar=no");
  170. event.stopPropagation();
  171. }
  172. */
  173. // ?????? ?? ???.
  174. function initTitle() {
  175. var titleValue = null;
  176. var syscd = model.getValue(gvSystemPath);
  177. if( syscd == null || syscd == "") {
  178. titleValue = document.head.title.text;
  179. } else {
  180. titleValue = document.head.title.text + "(" + getGlobalVariable("sysname"+syscd) + ")";
  181. }
  182. model.makeValue(gvTitlePath,titleValue);
  183. if (!isPopup() && getGlobalVariable("userinfos") != "") {
  184. var scrnTitle = "CMC nU " ;
  185. scrnTitle = scrnTitle + getUserInfo("systeminstnm") + " ";
  186. scrnTitle = scrnTitle + new String(htmlwindow.vision) + " ";
  187. scrnTitle = scrnTitle + getUserInfo("dutplcenm") + " ";
  188. scrnTitle = scrnTitle + getUserName() + " ";
  189. scrnTitle = scrnTitle + getTitleLoginDate() + " ";
  190. document.title = scrnTitle;
  191. }
  192. if (isPopup()) {
  193. document.title = titleValue;
  194. }
  195. }
  196. // ?? ??? ???? ??
  197. function getTitle() {
  198. return model.getValue(gvTitlePath);
  199. }
  200. //??? ?? ??
  201. function getTitleLoginDate() {
  202. var weekarr = new Array("?", "?", "?", "?", "?", "?", "?");
  203. var dt = getUserInfo("logindt");
  204. var dtyear = dt.substring(0,4);
  205. var dtmonth = dt.substring(4,6);
  206. var dtday = dt.substring(6,8);
  207. var dthour = dt.substring(8,10);
  208. var dtmin = dt.substring(10,12);
  209. var dtval = new Date(dtmonth+"/"+dtday+"/"+dtyear);
  210. var dtweek = weekarr[dtval.getDay()];
  211. var dtstr = dtyear + "?" + dtmonth + "?" + dtday + "? (" + dtweek + ") " + dthour +"?" + dtmin +"?";
  212. return dtstr;
  213. }
  214. // MIS??? ??? ????.
  215. function getMISSystemCd() {
  216. var systemcd = getSystemCd();
  217. var systeminstcd = systemcd.substring(3,6);
  218. var missystemcd = "";
  219. if(systeminstcd == "999"){
  220. missystemcd = "MIS999";
  221. }else if(systeminstcd == "888"){
  222. missystemcd = "MIS888";
  223. }else if(systeminstcd == "011" || systeminstcd == "012" || systeminstcd == "013" || systeminstcd == "016"){
  224. missystemcd = "MIS001";
  225. }else{
  226. missystemcd = systemcd;
  227. }
  228. return missystemcd;
  229. }
  230. // ??? ??? ????.
  231. function getSystemCd() {
  232. if (gvSystemCd != null) {
  233. return gvSystemCd;
  234. }
  235. if (htmlwindow.systemcd == undefined) {
  236. gvSystemCd = "";
  237. } else {
  238. gvSystemCd = new String(htmlwindow.systemcd);
  239. }
  240. return gvSystemCd;
  241. }
  242. // ??? ??? TF Viewer ??? ????.
  243. function getViewer(name) {
  244. return viewer.item(getSystemCd()+"_"+name);
  245. }
  246. //menugroupcd? ????.
  247. function setScreenMenuGroup(){
  248. model.makeValue(gvMenuGroupCdPath, getGlobalVariable("menugroupcd"));
  249. }
  250. //menuitemcd? ????.
  251. function setScreenMenuItem(){
  252. model.makeValue(gvMenuItemCdPath, getGlobalVariable("menuitemcd"));
  253. }
  254. // ???? ??? ???? ??? ????.
  255. function setScreenPrestDeptCd(){
  256. model.makeValue(gvMenuPrestDeptCdPath, getGlobalVariable("prestdeptcd"));
  257. }
  258. // ???? ??? ???? ??? ????.
  259. function getScreenPrestDeptCd(){
  260. return model.getValue(gvMenuPrestDeptCdPath);
  261. }
  262. // ??Parameter??? ????.
  263. function setScreenMenuParameter(){
  264. model.makeValue(gvMenuParamPath, getGlobalVariable("menuparam"));
  265. if(window.type != "iviewer") setGlobalVariable("menuparam","");
  266. }
  267. // ??Parameter??? ????.
  268. function getScreenMenuParameter(){
  269. return model.getValue(gvMenuParamPath);
  270. }
  271. // url??? ??ID? ????. url? null?? ?? ??? url? ????.
  272. function getScreenID(url) {
  273. if (url == null) {
  274. url = document.url;
  275. }
  276. var sp = url.split("/");
  277. return sp[sp.length-1].split(".")[0].substr(0,10);
  278. }
  279. //??? ??? ????.
  280. function setScreenAuth(){
  281. var viewerObj = getViewer("bizMain");
  282. //????(F5) ?? ??
  283. if ( viewerObj == null )
  284. {
  285. setGlobalVariable("scrnauth","11100000");
  286. }
  287. model.makeValue(gvAuthPath, getGlobalVariable("scrnauth"));
  288. if(window.type != "iviewer") setGlobalVariable("scrnauth","");
  289. }
  290. // ?? ??? ?? ??? ??
  291. function checkAuth(auth) {
  292. var f = auth.charAt(0);
  293. var a = getAuth();
  294. var v = '0';
  295. switch(f) {
  296. case 'r': // ????
  297. case 'R':
  298. v = a.charAt(0);
  299. break;
  300. case 'x': // ????
  301. case 'X':
  302. v = a.charAt(1);
  303. break;
  304. case 'p':
  305. case 'P':
  306. v = a.charAt(2);
  307. break;
  308. }
  309. if (v == '1') {
  310. return true;
  311. } else {
  312. return false;
  313. }
  314. }
  315. // ?? ??? ??? ??? ??
  316. function getAuth() {
  317. return model.getValue(gvAuthPath);
  318. }
  319. //?? ?? ??(_auth)? ?? ????(RXP)? ????.
  320. function setScreenBtnDisabled( documentObj ) {
  321. if (documentObj == null) {
  322. documentObj = document;
  323. }
  324. var childObjCnt = documentObj.controls.length;
  325. var childObj;
  326. for (var i=0; i < childObjCnt; i++) {
  327. childObj = documentObj.controls.item(i);
  328. if (childObj.elementName == "xforms:iviewer") {
  329. setScreenBtnDisabled( childObj.document );
  330. } else if (childObj.elementName == "xforms:button") {
  331. var btnAuth = childObj.attribute("_auth");
  332. if(btnAuth == "R" || btnAuth == "r" || btnAuth == "X" || btnAuth == "x" || btnAuth == "P" || btnAuth == "p"){
  333. childObj.disabled = !checkAuth(btnAuth);
  334. }
  335. }
  336. }
  337. }
  338. // ?? ??? UID? ??
  339. function getMyUID() {
  340. return model.getValue(gvMyUIDPath);
  341. }
  342. // Opener? UID? ??, Opener? ??? "" ??
  343. function getOpenerUID() {
  344. return model.getValue(gvOpUIDPath);
  345. }
  346. // WID? ? child ???? ?? UID? ??
  347. function getChildUID(wid) {
  348. var cid = model.getValue(gvChUIDPath+wid);
  349. if (cid==null) { cid=""; }
  350. return cid;
  351. }
  352. // Opener? ?? ???? ?????? ??? ????.
  353. function checkOpener() {
  354. if (isPopup()) {
  355. return (getOpenerUID()==opener.model.getValue(gvMyUIDPath));
  356. } else {
  357. return false;
  358. }
  359. }
  360. // wid? ???? open? child window ??? ??? UID? ??? ?? window??? ????.
  361. // child window? ??? ???? UID? ????? null? ????.
  362. function getChildWindow(wid) {
  363. return findChildWindow(getChildUID(wid));
  364. }
  365. // ???? child ??? ??? ??? UID? ??? cid? ???
  366. // window ??? ??? ????. ??? null
  367. function findChildWindow(cid) {
  368. var child = null;
  369. for(i=0;i<window.children.length;i++) {
  370. child = window.children.item(i);
  371. if (child.model.getValue(gvMyUIDPath)==cid) return child;
  372. }
  373. return null;
  374. }
  375. // ???? child ??? ??? ?? ID? sid? ??? window ???
  376. // ??? ????. ??? null
  377. function findChildWindowByScreenID(sid) {
  378. var child = null;
  379. for(i=0;i<window.children.length;i++) {
  380. child = window.children.item(i);
  381. if (child.javascript.getScreenID()==sid) return child;
  382. }
  383. return null;
  384. }
  385. //????? child??? ??? ?? ?? child? ?? ???.
  386. function closeChildWindow() {
  387. if(model.getValue(gvChildClosePath) == "Y"){
  388. var childCnt = window.children.length;
  389. for( var i = childCnt; i > 0; i-- ) {
  390. window.children.item(i-1).close();
  391. }
  392. }
  393. }
  394. //????? child? close??? ??
  395. function setCloseChildWindow(){
  396. model.makeValue(gvChildClosePath,"Y");
  397. }
  398. // ??? ???? ???? ????.
  399. function isPopup() {
  400. var stype = window.type;
  401. if (stype == "iviewer" || stype == "main") {
  402. return false;
  403. } else {
  404. return true;
  405. }
  406. }
  407. // wid? open? child window? activate??.
  408. function activateChild(wid) {
  409. var cwnd = window.children.item(wid);
  410. if (cwnd != null) {
  411. cwnd.activate();
  412. }
  413. }
  414. // opener? activate??.
  415. function activateOpener() {
  416. if (isPopup()) {
  417. opener.javascript.activateMyWindow();
  418. }
  419. }
  420. // ?? ?? window? activate??.
  421. function activateMyWindow() {
  422. if (isPopup()) {
  423. window.activate();
  424. } else { // main viewer ? ??
  425. htmlwindow.focus();
  426. }
  427. }
  428. //?? ?? ??
  429. function getScreenDisabled(){
  430. return body.disabled;
  431. }
  432. //??Object ????
  433. function setMenuDisabled(type){
  434. htmlwindow.setMenuDisabled(type);
  435. }
  436. function openInternal(openType,id,idType,monNo,xPos,yPos,wid,ref,resultref,userProp,prevPos) {
  437. if (!checkTimeout()) {
  438. // session timeout ??? ??? session ?? ??
  439. setGlobalVariable("last_submit", (new Date()).getTime());
  440. }
  441. var url = null;
  442. var sid = getScreenID(id);
  443. if (wid == null || wid == "") {
  444. wid = sid;
  445. }
  446. if (prevPos == null) { // ?? ?? ?? ?? ??
  447. prevPos = true;
  448. }
  449. if ( idType == "url" ) { // idType == "url" ?? ID? ??? URL? open??.
  450. url = id;
  451. } else { // idType == "scn"
  452. //url = sid+".xrw";
  453. url = getScreenURL(sid);
  454. }
  455. // ??? ??
  456. var prop = null;
  457. if (monNo == null && xPos == null && yPos == null) { // ?? ?? ?? ?? ?? ?? ??? open
  458. var viewerObj = getViewer("sysMessage");
  459. if (viewerObj != null && viewerObj.window.javascript.fSetStatusMessage != undefined) {
  460. // ?? ?????? ?? ??? ??? ?? ??
  461. monNo = getCurrentMonitorNumber()-1;
  462. var monSize = viewerObj.window.javascript.fGetMonitorSize(monNo);
  463. xPos = monSize[0]/2 - 605; // 1211px/2
  464. yPos = monSize[1]/2 - 392; // 784px/2
  465. if (xPos < 0) { xPos = 0; }
  466. if (yPos < 0) { yPos = 0; }
  467. var loc = getAbsoluteLocation(monNo,xPos,yPos);
  468. xPos = loc[0];
  469. yPos = loc[1];
  470. prop = "top:"+yPos+"px;left:"+xPos+"px;width:1211px;height:784px;";
  471. } else {
  472. prop = "align:center;width:1211px;height:784px;";
  473. }
  474. } else {
  475. var xyPos = getScreenLocation(sid); // ?? ??? ???.
  476. var loc = null;
  477. if ( prevPos && xyPos != "") { // ?? ?? ??
  478. loc = xyPos.split("|");
  479. } else { // ??? ?? ??? ?? ??? ??
  480. if (xPos == "" || xPos == null) {xPos = 0;}
  481. if (yPos == "" || yPos == null) {yPos = 0;}
  482. if (monNo == "" || monNo == null) {monNo = getCurrentMonitorNumber();}
  483. monNo = parseInt(monNo)-1;
  484. if (monNo < 0) {
  485. monNo = 0;
  486. }
  487. loc = getAbsoluteLocation(monNo,xPos,yPos);
  488. }
  489. xPos = loc[0];
  490. yPos = loc[1];
  491. prop="top:"+yPos+"px;left:"+xPos+"px;";
  492. }
  493. // ??? ?? ???? ??
  494. if (userProp != null) {
  495. prop = prop + userProp;
  496. }
  497. // ?? ??ID? ?? ????? ????, ??? ?? ?? ?? ID? ???? ?? ???
  498. // ? ?? Activate ???. (2008.2.12 ??)
  499. var viewerObj = getViewer("sysMessage");
  500. var wd = null;
  501. if (viewerObj != null && viewerObj.window.javascript.fGetOpenWindow != undefined) {
  502. // ????? ?? ????. ????? ???? ? ??? ???? ???? ????.
  503. // ????? ?? ??? ?? ?? ??? ??(????????? ????? ??? ?? ??ID? ??? Modeless? ??)
  504. // var mainWnd = getMainViewer();
  505. // if (mainWnd != null && mainWnd.javascript.getScreenID() == sid) {
  506. // wd = mainWnd;
  507. // } else {
  508. wd = viewerObj.window.javascript.fGetOpenWindow(sid);
  509. // }
  510. } else { // ?? ??? ????. ??? opener, child ????? ???.
  511. if (isPopup() && opener.javascript.getScreenID() == sid) {
  512. wd = opener;
  513. } else if (getScreenID() == sid) {
  514. wd = window;
  515. } else {
  516. wd = findChildWindowByScreenID(sid);
  517. }
  518. }
  519. var cid = "";
  520. if (wd != null && openType =="modeless") { // modeless? ??? ?? ?? ID? ??? ??:activate
  521. cid = wd.javascript.getMyUID();
  522. wd.javascript.activateMyWindow(); // ???? ??? Activate ??.
  523. wd.body.dispatch("onActivate"); // Activate? ??
  524. } else { // replace??? ??? ?? ??ID? ??? ??? ?? ?? : ?? ??
  525. window.load(url,openType,wid,prop,ref,resultref);
  526. if (openType!="replace") {
  527. // open? ???? ??? uid? latest? ??????? ? ??
  528. // wid? ???? ??????.
  529. cid = model.getValue(gvChUIDPath+"latest");
  530. model.makeValue(gvChUIDPath+wid,cid);
  531. model.makeValue(gvChUIDPath+"latest",""); // latest? ??
  532. }
  533. }
  534. return cid;
  535. /**
  536. // wid ? ????? ??? ???? ??? uid? ????.
  537. var cid = getChildUID(wid);
  538. // uid? ????? ??? ???? ???? children??? ??? ????.
  539. if (cid != "") {
  540. var child = findChildWindow(cid);
  541. // ?? uid? ????? ??? activate ?? ????.
  542. if ( child!=null ) {
  543. child.activate();
  544. return cid;
  545. }
  546. }
  547. // ?? ?? ?? ?? ???? ??? replace??? uid? ?? ?? ??? ????.
  548. window.load(url,openType,wid,prop,ref,resultref);
  549. if (openType!="replace") {
  550. // open? ???? ??? uid? latest? ??????? ? ??
  551. // wid? ???? ??????.
  552. cid = model.getValue(gvChUIDPath+"latest");
  553. model.makeValue(gvChUIDPath+wid,cid);
  554. model.makeValue(gvChUIDPath+"latest",""); // latest? ??
  555. return cid;
  556. } else {
  557. return "";
  558. } **/
  559. }
  560. function open(id,monNo,xPos,yPos,wid,ref,resultref,userProp,prevPos) {
  561. if (userProp == null) {
  562. userProp = "max:hidden;";
  563. } else {
  564. userProp = "max:hidden;" + userProp;
  565. }
  566. return openInternal("modeless",id,"scn",monNo,xPos,yPos,wid,ref,resultref,userProp,prevPos);
  567. }
  568. function navigate(id,monNo,xPos,yPos,wid,ref,resultref) {
  569. //????
  570. var scrnauth = model.getValue(gvAuthPath);
  571. setGlobalVariable("scrnauth", scrnauth);
  572. //child close
  573. closeChildWindow();
  574. return openInternal("replace",id,"scn",monNo,xPos,yPos,wid,ref,resultref);
  575. }
  576. function modal(id,monNo,xPos,yPos,wid,ref,resultref,userProp,prevPos) {
  577. var rtn = "";
  578. body.disabled = true;
  579. if (userProp == null) {
  580. userProp = "min:hidden;max:hidden;";
  581. } else {
  582. userProp = "min:hidden;max:hidden;" + userProp;
  583. }
  584. rtn = openInternal("modal",id,"scn",monNo,xPos,yPos,wid,ref,resultref,userProp,prevPos);
  585. body.disabled = false;
  586. return rtn;
  587. }
  588. /*
  589. function topmost(id,monNo,xPos,yPos,wid,ref,resultref,userProp,prevPos,onCloseEvent) {
  590. var rtn = "";
  591. body.disabled = true;
  592. if (userProp == null) {
  593. userProp = "min:hidden;max:hidden;";
  594. } else {
  595. userProp = "min:hidden;max:hidden;" + userProp;
  596. }
  597. model.makeValue(gvMyCBOnClosePath,onCloseEvent);
  598. rtn = openInternal("modeless_topmost",id,"scn",monNo,xPos,yPos,wid,ref,resultref,userProp,prevPos);
  599. body.disabled = false;
  600. return rtn;
  601. }
  602. */
  603. function openUrl(url,monNo,xPos,yPos,wid,ref,resultref,userProp,prevPos) {
  604. if (userProp == null) {
  605. userProp = "max:hidden;";
  606. } else {
  607. userProp = "max:hidden;" + userProp;
  608. }
  609. return openInternal("modeless",url,"url",monNo,xPos,yPos,wid,ref,resultref,userProp,prevPos);
  610. }
  611. function navigateUrl(url,monNo,xPos,yPos,wid,ref,resultref) {
  612. //????
  613. var scrnauth = model.getValue(gvAuthPath);
  614. setGlobalVariable("scrnauth", scrnauth);
  615. return openInternal("replace",url,"url",monNo,xPos,yPos,wid,ref,resultref);
  616. }
  617. function modalUrl(url,monNo,xPos,yPos,wid,ref,resultref,userProp,prevPos) {
  618. if (userProp == null) {
  619. userProp = "min:hidden;max:hidden;";
  620. } else {
  621. userProp = "min:hidden;max:hidden;" + userProp;
  622. }
  623. return openInternal("modal",url,"url",monNo,xPos,yPos,wid,ref,resultref,userProp,prevPos);
  624. }
  625. // ???? Open
  626. function openExternal(syscd,id,monNo,xPos,yPos,wid,ref,resultref,userProp,prevPos) {
  627. var url = getScreenURL(id,syscd);
  628. setGlobalVariable("systemcode", syscd.toUpperCase());
  629. var cid = openInternal("modeless",url,"url",monNo,xPos,yPos,wid,ref,resultref,userProp,prevPos);
  630. setGlobalVariable("systemcode", "");
  631. return cid;
  632. }
  633. // ?? HTML Open
  634. function openHtml(url,wid,prop) {
  635. if (prop == null) {
  636. htmlwindow.open(url,wid);
  637. } else {
  638. htmlwindow.open(url,wid,prop);
  639. }
  640. }
  641. /**
  642. * ?? Size? ?? ??? ??
  643. */
  644. function setWindowSize(){
  645. //?????
  646. var pageWidth = body.attribute("pagewidth") == "" ? 1211 : parseInt(body.attribute("pagewidth"));
  647. var pageHeight = body.attribute("pageheight") == "" ? 800 : parseInt(body.attribute("pageheight"))+16;
  648. //? ??
  649. //?? OS? ???? ?? ??? ????? ?
  650. var captionSize = Math.abs(app.registry("HKEY_CURRENT_USER", "Control Panel\\Desktop\\WindowMetrics", "CaptionHeight" , "STRING"))/15;
  651. var marginWidth = 8;
  652. var marginHeight = captionSize+9;
  653. //?? ?? ??
  654. body.attribute("margin-top") = 8;
  655. body.attribute("margin-bottom") = 8;
  656. //??? ??
  657. window.setSize(pageWidth+marginWidth, pageHeight+marginHeight);
  658. }
  659. // ??? ??? ????
  660. function setSystemMessage(msg) {
  661. var viewerObj = getViewer("sysMessage");
  662. if (viewerObj != null && viewerObj.window.javascript.fSetStatusMessage != undefined) {
  663. viewerObj.window.javascript.fSetStatusMessage(msg);
  664. }
  665. }
  666. // ?? ?? ??? ????.
  667. function setScreenLocation(sid,xpos,ypos) {
  668. var viewerObj = getViewer("sysMessage");
  669. if (viewerObj != null && viewerObj.window.javascript.fSetScreenLocation != undefined) {
  670. viewerObj.window.javascript.fSetScreenLocation(sid,xpos,ypos);
  671. }
  672. }
  673. // ?? ?? ??? ????.
  674. function getScreenLocation(sid) {
  675. var viewerObj = getViewer("sysMessage");
  676. if (viewerObj != null && viewerObj.window.javascript.fGetScreenLocation != undefined) {
  677. return viewerObj.window.javascript.fGetScreenLocation(sid);
  678. } else {
  679. return "";
  680. }
  681. }
  682. // ????? ????? ????? ????.
  683. function getAbsoluteLocation(mon,xpos,ypos) {
  684. var viewerObj = getViewer("sysMessage");
  685. if (viewerObj != null && viewerObj.window.javascript.fGetAbsoluteCoordinate != undefined) {
  686. return viewerObj.window.javascript.fGetAbsoluteCoordinate(mon,xpos,ypos);
  687. } else {
  688. var abspos = new Array(2);
  689. abspos[0] = xpos;
  690. abspos[1] = ypos;
  691. return abspos;
  692. }
  693. }
  694. // ??? ?? ??? ??? ??? ??? ??? ????? ????.
  695. function getRelativeCoordinate(xpos,ypos){
  696. var viewerObj = getViewer("sysMessage");
  697. if (viewerObj != null && viewerObj.window.javascript.fGetRelativeCoordinate != undefined) {
  698. var coord = viewerObj.window.javascript.fGetRelativeCoordinate(xpos,ypos);
  699. coord[0] = coord[0]+1;
  700. return coord;
  701. } else {
  702. var coord = new Array(3);
  703. coord[0] = 1;
  704. coord[1] = xpos;
  705. coord[2] = ypos;
  706. return coord;
  707. }
  708. }
  709. function getCurrentMonitorNumber() {
  710. return getRelativeCoordinate(window.left,window.top)[0];
  711. }
  712. // ??? ??? ????? ??? ????.
  713. function addOpenWindow() {
  714. var viewerObj = getViewer("sysMessage");
  715. if (viewerObj != null && viewerObj.window.javascript.fAddOpenWindow != undefined) {
  716. // viewerObj.window.javascript.fAddOpenWindow(getScreenID()+"|"+getMyUID()+"|"+getTitle(),window);
  717. viewerObj.window.javascript.fAddOpenWindow(getScreenID()+"|"+getMyUID()+"|"+window.type+"|"+getTitle(),window);
  718. }
  719. }
  720. // ??? ??? ????? ???? ????.
  721. function removeOpenWindow() {
  722. var viewerObj = getViewer("sysMessage");
  723. if (viewerObj != null && viewerObj.window.javascript.fRemoveOpenWindow != undefined) {
  724. // viewerObj.window.javascript.fRemoveOpenWindow(getScreenID()+"|"+getMyUID()+"|"+getTitle());
  725. viewerObj.window.javascript.fRemoveOpenWindow(getScreenID()+"|"+getMyUID()+"|"+window.type+"|"+getTitle());
  726. }
  727. }
  728. // ?? ??? ??? ?? ID? sid? ??? ??? ??? ????.
  729. // ?? ??? ??? null? ????.
  730. function getOpenWindow(sid) {
  731. var viewerObj = getViewer("sysMessage");
  732. if (viewerObj != null && viewerObj.window.javascript.fGetOpenWindow != undefined) {
  733. return viewerObj.window.javascript.fGetOpenWindow(sid);
  734. } else {
  735. return null;
  736. }
  737. }
  738. // his main ??? ??? ????.
  739. // ?? window? ??? null? ????.
  740. function getMainViewer(){
  741. var viewerObj = getViewer("bizMain");
  742. //????(F5) ?? ??
  743. if ( viewerObj == null )
  744. {
  745. viewerObj = htmldocument.all.TFViewer1;
  746. }
  747. if ( viewerObj == null )
  748. {
  749. return null;
  750. } else{
  751. return viewerObj.window;
  752. }
  753. }
  754. //
  755. // ??? ??? ??
  756. //
  757. // parameter ??? ???? ??? ??
  758. function getParameterPath() {
  759. return gvParamPath;
  760. }
  761. // name ??? value ?? ??, ??? ?? name? ??? ??? ?? ???
  762. function setParameter(name, value){
  763. var valueNode = instance1.selectSingleNode(gvParamPath+"/"+name+"/"+name+"value");
  764. model.makeValue(gvParamPath+"/"+name+"/"+name+"value", value);
  765. }
  766. // name ??? value ?? ??
  767. function addParameter(name, value){
  768. var valueNode = instance1.selectSingleNode(gvParamPath+"/"+name+"/"+name+"value");
  769. if(valueNode==null){
  770. model.makeValue(gvParamPath+"/"+name+"/"+name+"value", value);
  771. }else{
  772. var nameNode = instance1.selectSingleNode(gvParamPath+"/"+name);
  773. valueNode = instance1.createNode("element", name+"value", "");
  774. valueNode.text = value;
  775. nameNode.appendChild(valueNode);
  776. }
  777. }
  778. // index ?? name? ?? ???, index ???? 1
  779. function getParameter(name, index){
  780. if (index==null) { index = 1; }
  781. return model.getValue(gvParamPath+"/"+name+"/"+name+"value["+index+"]");
  782. }
  783. function getParameterCount(name){
  784. return new Number(instance1.selectnodes(gvParamPath+"/"+name+"/"+name+"value").length);
  785. }
  786. // index ?? name? ?? ???, index ???? 1
  787. function removeParameter(name, index){
  788. if (index==null) { index = 1; }
  789. model.removeNode(gvParamPath+"/"+name+"/"+name+"value["+index+"]");
  790. }
  791. // name? ?? ?? ???
  792. function clearParameter(name){
  793. model.removeNode(gvParamPath+"/"+name);
  794. }
  795. // ??????? ???? ???? ???, ???? ???? ????.
  796. function getBizName(bizCode) {
  797. var firstChar = bizCode.charAt(2);
  798. //alert(firstChar);
  799. var bizName = "";
  800. switch(firstChar) {
  801. case 'P': // ??
  802. case 'p':
  803. bizName = "pam";
  804. break;
  805. case 'M': // EMR
  806. case 'm':
  807. bizName = "emr";
  808. break;
  809. case 'A': // ????
  810. case 'a':
  811. bizName = "ast";
  812. break;
  813. case 'L': // LIS
  814. case 'l':
  815. bizName = "lis";
  816. break;
  817. case 'R': // MIS
  818. case 'r':
  819. bizName = "mis";
  820. break;
  821. case 'Z': // ??
  822. case 'z':
  823. bizName = "com";
  824. break;
  825. case 'S': // ????
  826. case 's':
  827. bizName = "sts";
  828. break;
  829. case 'C': // CRM
  830. case 'c':
  831. bizName = "crm";
  832. break;
  833. case 'I': // CRC(??????)
  834. case 'i':
  835. bizName = "crc";
  836. break;
  837. case 'D': // CRD(????)
  838. case 'd':
  839. bizName = "crd";
  840. break;
  841. case 'T': // ??
  842. case 't':
  843. bizName = "tmp";
  844. break;
  845. default: // unknown
  846. bizName = "";
  847. break;
  848. }
  849. return bizName;
  850. }
  851. // ????? domain? ????.
  852. function getMainDomain() {
  853. var domainStr = getGlobalVariable("domain");
  854. if (domainStr == "") { // ????? ??
  855. domainStr = "http://localhost:9080";
  856. }
  857. return domainStr;
  858. }
  859. // syscd ? ???? ?? ???? ?? ??? URL? ??
  860. // syscd? null ?? ?? ??? ??? ??? ???? ?? ??? URL? ??
  861. function getDomain(syscd) {
  862. var domainStr = null;
  863. if (syscd == null || syscd == "") {
  864. syscd = model.getValue(gvSystemPath);
  865. }
  866. if (syscd == null || syscd == "") {
  867. domainStr = getMainDomain();
  868. } else {
  869. domainStr = getGlobalVariable("sysurl"+syscd.toUpperCase());
  870. }
  871. return domainStr;
  872. }
  873. function getScreenURL(sid,syscd) {
  874. return getDomain(syscd)+getScreenURI(sid);
  875. }
  876. function getScreenURI(sid) {
  877. return "/himed/webapps/cmc/web/xrw/"+sid+".xrw";
  878. }
  879. function getActionURI(submitID) {
  880. var bizName = getBizName(submitID);
  881. return "/himed/webapps/cmc/web/xrw/.live?submit_id="+submitID+"&business_id=" + bizName;
  882. }
  883. function getActionURL(submitID) {
  884. return getDomain()+getActionURI(submitID);
  885. }
  886. var gvOnSubmit = false;
  887. var gvShowAlert = false;
  888. var gvSuppressError = false;
  889. var gvForceSubmit = false;
  890. var gvHtmlRedirect = false;
  891. // ?? submit() ??? ???? ???? ???? ??? ??? MessageBox()? ????.
  892. function setAlertOn() {
  893. gvShowAlert = true;
  894. }
  895. // ?? submit() ??? ???? ???? ??? ?? ??? ???.
  896. function setErrorOff() {
  897. gvSuppressError = true;
  898. }
  899. // ?? submit() ??? ???? session timeout ? ???? submit()? ????? ??.
  900. function setForceOn() {
  901. gvForceSubmit = true;
  902. }
  903. // ?? submit() ??? ???? ??? HTML? ? ?? HTML ? ????? ????.
  904. function setHtmlRedirect() {
  905. gvHtmlRedirect = true;
  906. }
  907. // ?? ?? ?? ??
  908. function checkTimeout() {
  909. var timeOut = parseInt(getGlobalVariable("session_timeout"));
  910. if (isNaN(timeOut) || timeOut <= 0) { // timeout ???? ??
  911. return false;
  912. }
  913. var lastTime = getGlobalVariable("last_submit");
  914. var curTime = (new Date()).getTime();
  915. if (curTime - parseInt(lastTime) > (timeOut*60000)) {
  916. return true;
  917. } else {
  918. return false;
  919. }
  920. }
  921. function submit(submitID, refresh, ref, resultref, encoding) {
  922. var showAlert = gvShowAlert;
  923. var suppressError = gvSuppressError;
  924. gvShowAlert = false;
  925. gvSuppressError = false;
  926. if (!gvForceSubmit) {
  927. gvForceSubmit = false;
  928. if (checkTimeout()) {
  929. // ????? ???
  930. body.disabled = true;
  931. setParameter("type", "session");
  932. modal("SPZUM00400", "", "", "", "", "", "","width:241px;height:130px;align:center;");
  933. // window.load("../../../com/hismainweb/xrw/SPZUM00400_????.xrw","modal","","width:241px;height:130px;align:center;");
  934. body.disabled = false;
  935. if (checkTimeout()) {
  936. gvHtmlRedirect = false;
  937. return false; // ???? ??
  938. }
  939. }
  940. // submit ?? ????
  941. setGlobalVariable("last_submit", (new Date()).getTime());
  942. }
  943. // ?? submit ?? ?? ?? ??
  944. if (gvOnSubmit) {
  945. gvHtmlRedirect = false;
  946. return false;
  947. } else {
  948. gvOnSubmit = true;
  949. }
  950. var actionURL = getActionURL(submitID)
  951. + getUserSessionString(); // ????? query string ??.
  952. if ( refresh == null ) {
  953. refresh = true;
  954. }
  955. var retvalue = false;
  956. try {
  957. var sid = document.all(submitID);
  958. if (!sid) {
  959. messageBox("Submit["+submitID+"]? ????","E007");
  960. gvOnSubmit = false;
  961. gvHtmlRedirect = false;
  962. return false;
  963. }
  964. // ref? resultref? ????.
  965. // null ??? "" ?? ???? ???.
  966. if ( ref != null && ref != "" ) {
  967. sid.attribute("ref") = ref;
  968. }
  969. if ( resultref != null && resultref != "" ) {
  970. sid.attribute("resultref") = resultref;
  971. }
  972. // action url? ????.
  973. sid.attribute("action") = actionURL;
  974. if (encoding != null && encoding != "") {
  975. sid.attribute("encoding") = encoding;
  976. } else {
  977. sid.attribute("encoding") = "utf-8";
  978. }
  979. //alert(sid.attribute("encoding"));
  980. //sid.attribute("type") = "custom";
  981. // ??? submit???? ?? ?? ??? ????? ???.
  982. model.removeNode(gvErrorMsgPath);
  983. // ??? submit??.
  984. var ret = model.send(submitID, refresh, false, true);
  985. //alert("return = " + ret);
  986. if ( ret == 200 ) {
  987. // ???
  988. retvalue = showSystemMessage(showAlert,suppressError);
  989. } else {
  990. if (!suppressError) {
  991. messageBox("Submit["+submitID+"] ???","E009","[ret:"+ret+"]");
  992. }
  993. retvalue = false;
  994. }
  995. } catch (e) {
  996. if (!suppressError) {
  997. messageBox("Submit["+submitID+"] ???","E009","[exception:"+e+"]");
  998. }
  999. retvalue = false;
  1000. }
  1001. gvOnSubmit = false;
  1002. gvHtmlRedirect = false;
  1003. return retvalue;
  1004. }
  1005. function xforms_submit_error() {
  1006. if (error.errorcode == 3003) {
  1007. messageBox("?? ??? ? ???? ?? ??? ???? ?? ???","E009","[errorcode:"+error.errorcode+"]");
  1008. event.stopPropagation();
  1009. }
  1010. }
  1011. // ???? ??? ???? ??? ????.
  1012. function showSystemMessage(showAlert,suppressError) {
  1013. var type = model.getValue(gvErrorMsgPath+"/type");
  1014. var code = model.getValue(gvErrorMsgPath+"/code");
  1015. var msg = model.getValue(gvErrorMsgPath+"/msg");
  1016. var desc = model.getValue(gvErrorMsgPath+"/description");
  1017. if ( "error" == type ) {
  1018. if (suppressError == null || !suppressError) {
  1019. body.disabled = true;
  1020. window.load("../../../com/commonweb/xrw/SPZZZ00100_?????.xrw","modal","","width:514px;height:198px;align:center;",gvErrorMsgPath,"/root/main");
  1021. body.disabled = false;
  1022. }
  1023. return false;
  1024. } else {
  1025. setSystemMessage(msg);
  1026. if (showAlert != null && showAlert) {
  1027. messageBox(msg,"I");
  1028. }
  1029. return true;
  1030. }
  1031. }
  1032. // submit? ?? ??? ?? ?? HTML ???? ??? ??
  1033. function onredirecthtml() {
  1034. if( document.all(event.target).elementName == "xforms:submission" && gvHtmlRedirect == false) {
  1035. event.preventDefault();
  1036. event.stopPropagation();
  1037. }
  1038. gvHtmlRedirect = false;
  1039. }
  1040. // submit ??? <resultKM ../> ? ?? ??
  1041. function onerror() {
  1042. var msg = error.description;
  1043. var svrtime = error.errorSource;
  1044. var pctime = (new Date()).getTime();
  1045. // ?????? ??? ??? ???.
  1046. setGlobalVariable("timediff", svrtime - pctime);
  1047. event.stopPropagation();
  1048. // ?? ??? instance? ??
  1049. handleSystemMessage(msg);
  1050. }
  1051. // submit ??? ??? error event? ??? ????.
  1052. function handleSystemMessage(msg) {
  1053. // ?? ??? instance? ??
  1054. var msgItem = msg.split("|");
  1055. model.makeValue(gvErrorMsgPath+"/type",msgItem[0]); // error ?? info
  1056. model.makeValue(gvErrorMsgPath+"/code",msgItem[1]); // error? ?? ????
  1057. model.makeValue(gvErrorMsgPath+"/msg",msgItem[2].replace(";","\n"),true); // ???? newline ??? ; ? ?? ???????
  1058. var description = "";
  1059. if (msgItem[3] != null && msgItem[3] != "undefined") {
  1060. description = msgItem[3];
  1061. }
  1062. if (msgItem[4] != null && msgItem[4] != "undefined") {
  1063. description = description + "\n" + msgItem[4];
  1064. }
  1065. model.makeValue(gvErrorMsgPath+"/description",description); // error? ?? ????
  1066. }
  1067. // ??? ?? ?? ???? ?? ?? submit? ?? ??? ???
  1068. // ?? ???? action URL? query string?? ????.
  1069. // ?? ??? query string? ????.
  1070. function getUserSessionString() {
  1071. var sessionStr = "&macaddr="+getUserInfo("macaddr");
  1072. var isAnonymous = getGlobalVariable("anonymous");
  1073. if (isAnonymous == "true") { // ????? ?? ????? ????? ????.
  1074. sessionStr = sessionStr + "&anony_session="+encodeURI(getUserInfos());
  1075. }
  1076. return sessionStr;
  1077. }
  1078. /**
  1079. * msg_code : I(Information), C(Critical), E(Exclamation), Q(Question, YN), S(Select, YNC)
  1080. *I001=???????.
  1081. *I002=???????.
  1082. *I003=???????.
  1083. *I004=????.
  1084. *I005=?????.
  1085. *I006=?????.
  1086. *I007=??????.
  1087. *I008=????.
  1088. *I009=???.
  1089. *
  1090. *C001=?????? !
  1091. *C002=?????? !
  1092. *C003=?????? !
  1093. *
  1094. *E001=? ? ????.
  1095. *E002=??? ????.
  1096. *E003=???????.
  1097. *E004=???? ????.
  1098. *E005=???????.
  1099. *E006=???????.
  1100. *E007=?????.
  1101. *E008=???.
  1102. *E009=???????.
  1103. *E010=??? ?????.
  1104. *E011=??? ?????.
  1105. *E012=??? ?????.
  1106. *E013=???? ????.
  1107. *E014=???? ????.
  1108. *E015=????? ?????.
  1109. *E016=???? ????.
  1110. *
  1111. *Q001=?? ?????? ?
  1112. *Q002=?? ?????? ?
  1113. *Q003=?? ?????????
  1114. *Q004=?? ???????
  1115. *Q005=?? ???????
  1116. *Q006=?? ???????
  1117. *Q007=?? ???????
  1118. *Q008=?? ???????
  1119. *Q009=?? ???????
  1120. *Q010=??? ???????
  1121. *Q011=?? ???????
  1122. *Q012=?? ???????
  1123. *
  1124. *S001=???? ?(Yes)\n??? ???(No)
  1125. *S002=?????? ?(Yes)\n?????? ???(No)
  1126. *return : yes=6, no=7
  1127. */
  1128. function messageBox(pMessage, pCode, pOptMsg) {
  1129. var alertMsg = null;
  1130. var msgTitle = null;
  1131. var msgType = null;
  1132. var msgData = null;
  1133. var msgRtn = "";
  1134. // Title Message
  1135. switch( pCode.substr(0,1) ){
  1136. case "I": msgTitle = "??";
  1137. msgType = "64";
  1138. break;
  1139. case "C": msgTitle = "??";
  1140. msgType = "16";
  1141. break;
  1142. case "E": msgTitle = "??";
  1143. msgType = "48";
  1144. break;
  1145. case "Q": msgTitle = "??";
  1146. msgType = "36";
  1147. break;
  1148. case "S": msgTitle = "??";
  1149. msgType = "35";
  1150. break;
  1151. default : msgTitle = "??";
  1152. msgType = "16";
  1153. }
  1154. // Message Data
  1155. switch( pCode ){
  1156. case "I001": alertMsg = " ???????."; break;
  1157. case "I002": alertMsg = " ???????."; break;
  1158. case "I003": alertMsg = " ???????."; break;
  1159. case "I004": alertMsg = " ????."; break;
  1160. case "I005": alertMsg = " ?????."; break;
  1161. case "I006": alertMsg = " ?????."; break;
  1162. case "I007": alertMsg = " ??????."; break;
  1163. case "I008": alertMsg = " ????."; break;
  1164. case "I009": alertMsg = " ???."; break;
  1165. case "C001": alertMsg = " ??????."; break;
  1166. case "C002": alertMsg = " ??????."; break;
  1167. case "C003": alertMsg = " ??????."; break;
  1168. case "E001": alertMsg = " ? ? ????."; break;
  1169. case "E002": alertMsg = " ??? ????."; break;
  1170. case "E003": alertMsg = " ???????."; break;
  1171. case "E004": alertMsg = " ???? ????."; break;
  1172. case "E005": alertMsg = " ???????."; break;
  1173. case "E006": alertMsg = " ???????."; break;
  1174. case "E007": alertMsg = " ?????."; break;
  1175. case "E008": alertMsg = " ???."; break;
  1176. case "E009": alertMsg = " ???????."; break;
  1177. case "E010": alertMsg = " ??? ?????."; break;
  1178. case "E011": alertMsg = " ??? ?????."; break;
  1179. case "E012": alertMsg = " ??? ?????."; break;
  1180. case "E013": alertMsg = " ???? ????."; break;
  1181. case "E014": alertMsg = " ???? ????."; break;
  1182. case "E015": alertMsg = " ????? ?????."; break;
  1183. case "E016": alertMsg = " ???? ????."; break;
  1184. case "Q001": alertMsg = " ?? ???????"; break;
  1185. case "Q002": alertMsg = " ?? ???????"; break;
  1186. case "Q003": alertMsg = " ?? ?????????"; break;
  1187. case "Q004": alertMsg = " ?? ???????"; break;
  1188. case "Q005": alertMsg = " ?? ???????"; break;
  1189. case "Q006": alertMsg = " ?? ???????"; break;
  1190. case "Q007": alertMsg = " ?? ???????"; break;
  1191. case "Q008": alertMsg = " ?? ???????"; break;
  1192. case "Q009": alertMsg = " ?? ???????"; break;
  1193. case "Q010": alertMsg = " ??? ???????"; break;
  1194. case "Q011": alertMsg = " ?? ???????"; break;
  1195. case "Q012": alertMsg = " ?? ???????"; break;
  1196. case "S001": alertMsg = " ???? ?(Yes)\n??? ???(No)? ??????."; break;
  1197. case "S002": alertMsg = " ?????? ?(Yes)\n?????? ???(No)? ??????"; break;
  1198. default : alertMsg = "";
  1199. }
  1200. if(pOptMsg == null || pOptMsg == ""){
  1201. msgData = pMessage+alertMsg;
  1202. }else{
  1203. msgData = pMessage+alertMsg + "\n" + pOptMsg;
  1204. }
  1205. body.disabled = true;
  1206. msgRtn = window.alert( msgData, msgTitle, msgType );
  1207. body.disabled = false;
  1208. return msgRtn;
  1209. }
  1210. // ??? ???? ?????
  1211. function getUserId() {
  1212. return getUserInfo("userid");
  1213. }
  1214. function getUserName() {
  1215. return getUserInfo("usernm");
  1216. }
  1217. function getUserInfo(key) {
  1218. if ( getGlobalVariable("userinfos") == "" ) {
  1219. setDefaultUserInfo();
  1220. }
  1221. return getGlobalVariable(key);
  1222. }
  1223. function getUserInfos() {
  1224. if ( getGlobalVariable("userinfos") == "" ) {
  1225. setDefaultUserInfo();
  1226. }
  1227. return getGlobalVariable("userinfos");
  1228. }
  1229. function setDefaultUserInfo() {
  1230. 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";
  1231. var userInfoKeyArr = userInfoKeyStr.split("|");
  1232. var userInfoStr = "";
  1233. try {
  1234. var fso = new ActiveXObject("Scripting.FileSystemObject");
  1235. var f = fso.GetFile("session.txt");
  1236. var ts = f.OpenAsTextStream(1);
  1237. userInfoStr = ts.ReadLine();
  1238. ts.Close();
  1239. } catch(e) {
  1240. }
  1241. var userInfoArr = userInfoStr.split("|");
  1242. var len = userInfoKeyArr.length;
  1243. setGlobalVariable("anonymous","true"); // ???????? ??????
  1244. for(i=0;i<len;i++) {
  1245. setGlobalVariable(userInfoKeyArr[i],userInfoArr[i]);
  1246. }
  1247. setGlobalVariable("userinfos", userInfoStr);
  1248. }
  1249. /*-------------------------------------------------------------------
  1250. //?? ???? ?? ??
  1251. ---------------------------------------------------------------------*/
  1252. //?? ???? ????.
  1253. function getPropertyName(key, bizCode){
  1254. var bizName = "";
  1255. var propertyName = "";
  1256. if (bizCode == null || bizCode == "" || bizCode == "undefined")
  1257. {
  1258. bizName = "";
  1259. }else{
  1260. bizName = getBizName(bizCode)+"_";
  1261. }
  1262. return getSystemCd()+"_"+bizName+"gsv_"+key;
  1263. }
  1264. //????? ????.
  1265. function setGlobalVariable(key, value, bizCode){
  1266. model.property(getPropertyName(key, bizCode)) = value;
  1267. return true;
  1268. }
  1269. //????? ????.
  1270. function getGlobalVariable(key, bizCode){
  1271. return model.property(getPropertyName(key, bizCode));
  1272. }
  1273. // ???? ?? ?? ??? ?? ??? ????.
  1274. function getUserGroupList() {
  1275. var usergrp = getUserInfo("usergrp");
  1276. if (usergrp == null || usergrp == "") {
  1277. return null;
  1278. } else {
  1279. return usergrp.split(",");
  1280. }
  1281. }
  1282. // ???? ??? ?? ??? ??? ????? ??? ????.
  1283. function checkUserGroup(grpname) {
  1284. var usergrplist = getUserGroupList();
  1285. if (usergrplist == null) {
  1286. return false;
  1287. }
  1288. for(var i=0;i<usergrplist.length;i++) {
  1289. if (grpname == usergrplist[i]) {
  1290. return true;
  1291. }
  1292. }
  1293. return false;
  1294. }
  1295. /*-------------------------------------------------------------------
  1296. //???? ?? ??
  1297. ---------------------------------------------------------------------*/
  1298. /**
  1299. * ???? key
  1300. * pid : ????
  1301. * pname : ???
  1302. * age : ??(54/M)
  1303. * addr : ??
  1304. * insukind : ????
  1305. * ininfo : ????
  1306. * body : ??? ?
  1307. * btype : ???
  1308. * orddept : ???
  1309. * apntdr : ???? - ???
  1310. * attndr : ???? - ???
  1311. * diagnosis : ???
  1312. * operation : ????
  1313. * allergy : ??? ??(Y^Y)
  1314. * infection : ????(Y^Y^Y)
  1315. * intncare : ??(Y)
  1316. * cp : cp(Y)
  1317. * addrdetl : ????
  1318. * regstno : ????
  1319. * telno : ????
  1320. * zipcd : ????
  1321. */
  1322. function setPatientInfo(key, value) {
  1323. var viewerObj = getViewer("patientInfo");
  1324. if ( viewerObj != null){
  1325. if ( key != "pid" && value.split("|")[0] == getPatientId()){
  1326. return viewerObj.window.javascript.fSetPatientInfo(key, value.split("|")[1]);
  1327. }else{
  1328. return viewerObj.window.javascript.fSetPatientInfo(key, value);
  1329. }
  1330. }
  1331. return false;
  1332. }
  1333. /**
  1334. *???? ?? ??
  1335. *value|value|value....
  1336. */
  1337. function setPatientInfos(values){
  1338. var viewerObj = getViewer("patientInfo");
  1339. if ( viewerObj != null ){
  1340. return viewerObj.window.javascript.fSetPatientInfos(values);
  1341. }
  1342. return false;
  1343. }
  1344. //???? ??
  1345. function delPatientInfos(){
  1346. var viewerObj = getViewer("patientInfo");
  1347. if ( viewerObj != null ){
  1348. return viewerObj.window.javascript.fDelPatientInfos();
  1349. }
  1350. return false;
  1351. }
  1352. //???? ??
  1353. function getPatientInfo(key) {
  1354. var viewerObj = getViewer("patientInfo");
  1355. if ( viewerObj != null ){
  1356. return viewerObj.window.javascript.fGetPatientInfo(key);
  1357. }
  1358. return "";
  1359. }
  1360. //?????? ?? ??
  1361. function getPatientInfos() {
  1362. var viewerObj = getViewer("patientInfo");
  1363. if ( viewerObj != null ){
  1364. return viewerObj.window.javascript.fGetPatientInfos();
  1365. }
  1366. return "";
  1367. }
  1368. //???? ??
  1369. function getPatientId() {
  1370. var viewerObj = getViewer("patientInfo");
  1371. if ( viewerObj != null ){
  1372. return viewerObj.window.javascript.fGetPatientId();
  1373. }
  1374. return "";
  1375. }
  1376. //??? ??
  1377. function getPatientName() {
  1378. var viewerObj = getViewer("patientInfo");
  1379. if ( viewerObj != null ){
  1380. return viewerObj.window.javascript.fGetPatientName();
  1381. }
  1382. return "";
  1383. }
  1384. //????? ????.
  1385. function setPatientFlag(value){
  1386. var viewerObj = getViewer("patientInfo");
  1387. if ( viewerObj != null){
  1388. return viewerObj.window.javascript.fSetPatientFlag(value);
  1389. }
  1390. return false;
  1391. }
  1392. //????? ?? ????? ????.
  1393. function setPatientInfoDetail(srcPath){
  1394. var viewerObj = getViewer("patientInfo");
  1395. var srcPath = instance1.selectSingleNode(srcPath);
  1396. if ( viewerObj != null && srcPath != null){
  1397. var destPath = viewerObj.window.javascript.fGetPatientInfoPath();
  1398. if( destPath != ""){
  1399. viewerObj.window.model.makeNode(destPath);
  1400. viewerObj.window.model.copyNode(destPath, srcPath);
  1401. return viewerObj.window.javascript.fCheckPatientId(destPath, "paminfo");
  1402. }else{
  1403. messageBox("?????","E014");
  1404. }
  1405. }
  1406. return false;
  1407. }
  1408. //????? ?? ????? key? ???? value????.
  1409. function getPatientInfoDetail(key) {
  1410. var viewerObj = getViewer("patientInfo");
  1411. if ( viewerObj != null ){
  1412. return viewerObj.window.javascript.fGetPatientInfoDetail(key);
  1413. }
  1414. return "";
  1415. }
  1416. //????? ?? ???? ??? ????.
  1417. //??? ??? ?? copy??.
  1418. function getPatientInfoDetails(destPath) {
  1419. var viewerObj = getViewer("patientInfo");
  1420. var destPath = instance1.selectSingleNode(destPath);
  1421. if ( viewerObj != null && destPath != null){
  1422. srcPath = viewerObj.window.javascript.fGetPatientInfoPath();
  1423. if(srcPath != ""){
  1424. srcPath = viewerObj.window.instance1.selectSingleNode(srcPath);
  1425. if(srcPath != null){
  1426. model.copyNode(destPath, srcPath);
  1427. return true;
  1428. }
  1429. }
  1430. }
  1431. return false;
  1432. }
  1433. //???? ????? ????.
  1434. function setOperationInfo(srcPath){
  1435. var viewerObj = getViewer("patientInfo");
  1436. var srcPath = instance1.selectSingleNode(srcPath);
  1437. if ( viewerObj != null && srcPath != null){
  1438. viewerObj.window.model.makeNode(gvOperationInfoPath);
  1439. viewerObj.window.model.copyNode(gvOperationInfoPath, srcPath);
  1440. return viewerObj.window.javascript.fCheckPatientId(gvOperationInfoPath, "operation");
  1441. }
  1442. return false;
  1443. }
  1444. //key? ???? ???? ??? ????.
  1445. function getOperationInfo(key){
  1446. var viewerObj = getViewer("patientInfo");
  1447. if ( viewerObj != null){
  1448. return viewerObj.window.javascript.fGetOperationInfo(key);
  1449. }
  1450. return "";
  1451. }
  1452. //???? ??? ??? ??? ?? copyNode??.
  1453. function getOperationInfos(destPath){
  1454. var viewerObj = getViewer("patientInfo");
  1455. var destPath = instance1.selectSingleNode(destPath);
  1456. if ( viewerObj != null && destPath != null){
  1457. var srcPath = viewerObj.window.instance1.selectSingleNode(gvOperationInfoPath);
  1458. if(srcPath != null){
  1459. model.copyNode(destPath, srcPath);
  1460. return true;
  1461. }
  1462. }
  1463. return false;
  1464. }
  1465. //???? ????? ????.
  1466. function setConsultInfo(srcPath){
  1467. var viewerObj = getViewer("patientInfo");
  1468. var srcPath = instance1.selectSingleNode(srcPath);
  1469. if ( viewerObj != null && srcPath != null){
  1470. viewerObj.window.model.makeNode(gvConsultInfoPath);
  1471. viewerObj.window.model.copyNode(gvConsultInfoPath, srcPath);
  1472. return viewerObj.window.javascript.fCheckPatientId(gvConsultInfoPath, "consult");
  1473. }
  1474. return false;
  1475. }
  1476. //key? ???? ???? ??? ????.
  1477. function getConsultInfo(key){
  1478. var viewerObj = getViewer("patientInfo");
  1479. if ( viewerObj != null){
  1480. return viewerObj.window.javascript.fGetConsultInfo(key);
  1481. }
  1482. return "";
  1483. }
  1484. //???? ??? ??? ??? ?? copyNode??.
  1485. function getConsultInfos(destPath) {
  1486. var viewerObj = getViewer("patientInfo");
  1487. var destPath = instance1.selectSingleNode(destPath);
  1488. if ( viewerObj != null && destPath != null){
  1489. var srcPath = viewerObj.window.instance1.selectSingleNode(gvConsultInfoPath);
  1490. if(srcPath != null){
  1491. model.copyNode(destPath, srcPath);
  1492. return true;
  1493. }
  1494. }
  1495. return false;
  1496. }
  1497. //??????? copyNode
  1498. function getOrderBasicInfo(destPath){
  1499. var viewerObj = getViewer("sysMessage");
  1500. var destPath = instance1.selectSingleNode(destPath);
  1501. if ( viewerObj != null && destPath != null){
  1502. var srcPath = viewerObj.window.instance1.selectSingleNode(gvOrderBasicInfoPath);
  1503. if(srcPath != null){
  1504. model.copyNode(destPath, srcPath);
  1505. return true;
  1506. }
  1507. }
  1508. return false;
  1509. }
  1510. /*-------------------------------------------------------------------
  1511. //??? ?? ?? ??
  1512. ---------------------------------------------------------------------*/
  1513. //???? ????.
  1514. function exeReportPreview(rid, dataType, paramsXPath, submitId, print, printDialog, fileType, fileName, fileDialog, closeYn, monNo, parentObjId, printPaperBin, userService, showButton, printCount, zoomRate, printOption, dataXPath, mainDataXPath, subDataXPath)
  1515. {
  1516. var reportNode = instance1.selectSingleNode(gvReportPath);
  1517. var syscd = getSystemCd();
  1518. syscd = syscd.substr(3,3);
  1519. if(syscd == "888" || syscd == "999" || syscd == "") syscd = "001";
  1520. //??? ?? ?? ???
  1521. if(reportNode != null){
  1522. model.removeNodeset(gvReportPath);
  1523. }
  1524. model.makeNode(gvReportPath);
  1525. model.makeNode(gvReportParamsPath);
  1526. model.makeNode(gvReportPropsPath);
  1527. model.makeNode(gvReportOptionsPath);
  1528. paramsXPath = instance1.selectSingleNode(paramsXPath);
  1529. if(paramsXPath != null){
  1530. model.copyNode(gvReportParamsPath, paramsXPath);
  1531. }
  1532. model.makeValue(gvReportParamsPath+"/userid", getUserId());
  1533. model.makeValue(gvReportParamsPath+"/logoimgurl", getImageURL("error_logo"+getLogoImageKey()));
  1534. model.makeValue(gvReportParamsPath+"/url", rid);
  1535. model.makeValue(gvReportPropsPath+"/rex_rptname", rid);
  1536. model.makeValue(gvReportPropsPath+"/rex_datatype", dataType);
  1537. model.makeValue(gvReportPropsPath+"/rex_submitid", submitId);
  1538. model.makeValue(gvReportPropsPath+"/rex_userservice", userService);
  1539. model.makeValue(gvReportPropsPath+"/rex_data_xpath", dataXPath);
  1540. model.makeValue(gvReportPropsPath+"/rex_xpath", mainDataXPath);
  1541. model.makeValue(gvReportPropsPath+"/rex_xpath1", subDataXPath);
  1542. model.makeValue(gvReportOptionsPath+"/rex_print", print);
  1543. model.makeValue(gvReportOptionsPath+"/rex_printdialog", printDialog);
  1544. model.makeValue(gvReportOptionsPath+"/rex_printpaperbin", printPaperBin);
  1545. model.makeValue(gvReportOptionsPath+"/rex_filetype", fileType);
  1546. model.makeValue(gvReportOptionsPath+"/rex_filename", fileName);
  1547. model.makeValue(gvReportOptionsPath+"/rex_filedialog", fileDialog);
  1548. model.makeValue(gvReportOptionsPath+"/rex_close", closeYn);
  1549. model.makeValue(gvReportOptionsPath+"/rex_showbutton", showButton);
  1550. model.makeValue(gvReportOptionsPath+"/rex_printcount", printCount);
  1551. model.makeValue(gvReportOptionsPath+"/rex_zoomrate", zoomRate);
  1552. model.makeValue(gvReportOptionsPath+"/rex_printoption", printOption);
  1553. if(parentObjId == null || parentObjId == ""){
  1554. if(document.all("ivr_report") == null){
  1555. //popup
  1556. setParameter("onready","true");
  1557. modal("SPZUR00100", monNo);
  1558. }else{
  1559. //iviewer
  1560. ivr_report.window.javascript.fInitRexpert();
  1561. }
  1562. }else{
  1563. var parentObj = document.all(parentObjId);
  1564. if(parentObj != null){
  1565. var childObj = document.all("ivr_"+parentObjId);
  1566. if(childObj != null){
  1567. childObj.window.javascript.fInitRexpert();
  1568. }
  1569. }
  1570. }
  1571. }
  1572. //??? ???? Object? ????.
  1573. function makeReportPreview(left, top, width, height, parentObjId){
  1574. if(left==null || top==null || width==null || height==null){
  1575. messageBox("???? ?????", "I004");
  1576. }else{
  1577. if(parentObjId == null || parentObjId == ""){
  1578. if(document.all("ivr_report") == null){
  1579. if(document.all("grp_biz") == null){
  1580. body.createChild("xforms:iviewer", "id:ivr_report; src:../../../com/commonweb/xrw/SPZUR00100_???.xrw; left:"+left+"px; top:"+top+"px; width:"+width+"px; height:"+height+
  1581. "px;");
  1582. }else{
  1583. grp_biz.createChild("xforms:iviewer", "id:ivr_report; src:../../../com/commonweb/xrw/SPZUR00100_???.xrw; left:"+left+"px; top:"+top+"px; width:"+width+"px; height:"+height+
  1584. "px;");
  1585. }
  1586. }
  1587. }else{
  1588. var parentObj = document.all(parentObjId);
  1589. if(parentObj != null){
  1590. parentObj.createChild("xforms:iviewer", "id:ivr_"+parentObjId+"; src:../../../com/commonweb/xrw/SPZUR00100_???.xrw; left:"+left+"px; top:"+top+"px; width:"+width+"px; height:"+height+
  1591. "px;");
  1592. childObj = document.all("ivr_"+parentObjId);
  1593. }
  1594. }
  1595. }
  1596. }
  1597. //?????? clear??.
  1598. function resetReportPreview(parentObjId){
  1599. if(parentObjId == null || parentObjId == ""){
  1600. if(document.all("ivr_report") == null){
  1601. var child = getChildWindow("SPZUR00100");
  1602. if(child != null){
  1603. child.javascript.fCloseReport();
  1604. }
  1605. }else{
  1606. ivr_report.window.javascript.fCloseReport();
  1607. }
  1608. }else{
  1609. var parentObj = document.all(parentObjId);
  1610. if(parentObj != null){
  1611. childObj = document.all("ivr_"+parentObjId);
  1612. if(childObj != null){
  1613. childObj.window.javascript.fCloseReport();
  1614. }
  1615. }
  1616. }
  1617. }
  1618. //??? ????.
  1619. function removeReportPreview(parentObjId){
  1620. if(parentObjId == null || parentObjId == ""){
  1621. if(document.all("ivr_report") != null){
  1622. parentObjId = document.all("ivr_report").parent.attribute("id");
  1623. document.all(parentObjId).removeChild("ivr_report");
  1624. }
  1625. }else{
  1626. var parentObj = document.all(parentObjId);
  1627. if(parentObj != null){
  1628. parentObj.removeChild("ivr_"+parentObjId);
  1629. }
  1630. }
  1631. }
  1632. //??????
  1633. function screenPrint(){
  1634. modal("SPZUR00200");
  1635. }
  1636. //??? ??? url
  1637. function getImageURL(imgcd){
  1638. return getDomain()+"/himed/webapps/com/commonweb/images/"+imgcd+".gif";
  1639. }
  1640. //??? logo???
  1641. function getLogoImageURL(syscd){
  1642. return getImageURL("logo"+getLogoImageKey(syscd));
  1643. }
  1644. function getLogoImageKey(syscd){
  1645. var imageKey = "";
  1646. if(syscd == null || syscd == ""){
  1647. syscd = getSystemCd();
  1648. }
  1649. if(syscd.toUpperCase() == "MIS001") {
  1650. imageKey = getUserInfo("dutplceinstcd");
  1651. }else{
  1652. imageKey = syscd.substr(3,3);
  1653. }
  1654. if(!((imageKey >="011" && imageKey <= "018")|| imageKey == "103")){
  1655. imageKey = "001";
  1656. }
  1657. return imageKey;
  1658. }
  1659. //loading ??
  1660. function openLoadingBar(msg){
  1661. setParameter("msg", msg);
  1662. open("SPZZZ00400", "", "", "", "", "", "","width:327px; height:121px; caption:hidden; resize:false; align:center;");
  1663. // open("SPZZZ00400", "", "", "", "SPZZZ00400", "/root/properties/loadingmsg", "/root/main/msg", "width:327px; height:121px; caption:hidden; align:center;" );
  1664. }
  1665. function closeLoadingBar(){
  1666. var child = getChildWindow("SPZZZ00400");
  1667. if(child != null) {
  1668. child.close();
  1669. }
  1670. }
  1671. //??? ???? ?? ?? ??
  1672. function openPasswordValidate(titlemsg, helpMsg){
  1673. setParameter("titlemsg", titlemsg);
  1674. setParameter("helpmsg", helpMsg);
  1675. modal("SPZUM00400", "", "", "", "", "", "","width:280px;height:270px;align:center;");
  1676. return getParameter("pwdvalid");
  1677. }
  1678. //
  1679. // Caching API
  1680. //
  1681. var gvCommonCachePath="/root/hidden/common/cache";
  1682. // Cache?? itemname?? ??? ???? ??? resultref? ????.
  1683. // ?? itemname?? ??? ???? true? ??? ??? ??? false? ????.
  1684. // - itemname : cache?? ??? ??? ?? key
  1685. // - resultref : cache? ??? ??? ??
  1686. function copyFromCache(itemname,resultref) {
  1687. var viewerObj = getViewer("sysMessage");
  1688. if (viewerObj == null) {
  1689. return false;
  1690. }
  1691. //itemnode = viewerObj.window.instance1.selectSingleNode(gvCommonCachePath+"/"+itemname);
  1692. var srcPath = gvCommonCachePath+"/"+itemname;
  1693. model.makeNode(resultref); // ??? resultref ?? ??
  1694. // Cache ?? ?? ??
  1695. var itemnode = viewerObj.window.instance1.selectSingleNode(srcPath);
  1696. if (itemnode == null) {
  1697. //alert("no cache");
  1698. return false;
  1699. } else {
  1700. // ?? ?? ??
  1701. var dueDate = itemnode.getAttribute("duedate");
  1702. var curDate = (new Date()).valueOf();
  1703. if (dueDate < curDate) { // ?? ?? ??
  1704. //alert("obsolate");
  1705. return false;
  1706. }
  1707. }
  1708. // resultref ? ??
  1709. model.copyNode(resultref,itemnode);
  1710. return true;
  1711. }
  1712. // resultref ??? ???? ??? cache? ????.
  1713. // - itemname : cache? ?? ??? ?? Key
  1714. // - resultref : ?? ????? cache? ??
  1715. // - ???? : ? (???? 10??)
  1716. function storeIntoCache(itemname,resultref,duemin) {
  1717. var viewerObj = getViewer("sysMessage");
  1718. if (viewerObj == null) {
  1719. return;
  1720. }
  1721. var destPath = gvCommonCachePath+"/"+itemname;
  1722. viewerObj.window.model.makeNode(destPath); // ??? Cache ?? ??
  1723. // resultref ?? ?? ??
  1724. var itemnode = instance1.selectSingleNode(resultref);
  1725. if (itemnode == null) {
  1726. return;
  1727. }
  1728. // Cache? ??? ? ????? attribute? ??
  1729. viewerObj.window.model.copyNode(destPath,itemnode);
  1730. itemnode = viewerObj.window.instance1.selectSingleNode(destPath);
  1731. if (itemnode != null) {
  1732. var dueDate = (new Date()).valueOf();
  1733. //alert(dueDate);
  1734. if (duemin == null) {
  1735. duemin = 600; // 10 hours
  1736. }
  1737. dueDate = dueDate + duemin*60*1000;
  1738. //alert(dueDate);
  1739. itemnode.setAttribute("duedate",dueDate);
  1740. }
  1741. }